@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
package/dist/reaper.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomFull as n } from "./errors.js";
|
|
2
|
+
import { ROOMS_TABLE as r, ROOM_CHECKPOINTS_TABLE as i, ROOM_HOSTS_TABLE as a } from "./identities.js";
|
|
3
|
+
import { RoomReaperPort as o } from "./ports.js";
|
|
4
|
+
import { captureRoomSnapshotBlobs as s, captureRoomSnapshotEffectRunner as c } from "./snapshotBlobIndex.js";
|
|
5
|
+
import { assertRoomPoolRecoveryTarget as l, captureAdmittedRoomPoolTopology as u } from "./roomPoolTopology.js";
|
|
6
|
+
import { loadDurableRoomCheckpoint as d, prefetchRoomCheckpointBlobs as f } from "./checkpointStore.js";
|
|
7
|
+
import { captureRoomLockstepRecoveryOptions as p, readRoomLockstepRecoveryTruth as m } from "./lockstepRecoveryTruth.js";
|
|
8
|
+
import { resolveRoomHostSelection as h } from "./hostSelection.js";
|
|
9
|
+
import { resolveRoomPoolHostSelection as g } from "./roomPoolSelection.js";
|
|
10
|
+
import { and as _, eq as v, gt as y, or as b } from "@voltro/database";
|
|
11
|
+
import { Effect as x, Layer as S, Result as C } from "effect";
|
|
12
|
+
//#region src/reaper.ts
|
|
13
|
+
var w = (e) => {
|
|
14
|
+
if (typeof e != "string" || !e.trim() || e.length > 191) throw new t({ detail: "Invalid Room reaper identity" });
|
|
15
|
+
return e;
|
|
16
|
+
}, T = (e, t, n, r, i, a = !1) => e.query({
|
|
17
|
+
table: t,
|
|
18
|
+
predicate: n,
|
|
19
|
+
order: [{
|
|
20
|
+
column: "id",
|
|
21
|
+
direction: "asc"
|
|
22
|
+
}],
|
|
23
|
+
take: r,
|
|
24
|
+
skip: void 0,
|
|
25
|
+
projection: [...i],
|
|
26
|
+
...a ? { lock: "update" } : {}
|
|
27
|
+
}), E = async (e) => {
|
|
28
|
+
let t = await x.runPromise(x.result(e));
|
|
29
|
+
if (C.isFailure(t)) throw t.failure;
|
|
30
|
+
return t.success;
|
|
31
|
+
}, D = (o, S) => {
|
|
32
|
+
let C = S.pools === void 0 ? void 0 : u(S.pools), D = S.maxHosts ?? 32, O = S.maxRoomsPerHost ?? 32, k = S.maxCheckpointBytes ?? 1048576;
|
|
33
|
+
if (![
|
|
34
|
+
D,
|
|
35
|
+
O,
|
|
36
|
+
k
|
|
37
|
+
].every((e) => Number.isSafeInteger(e) && e > 0)) throw new t({ detail: "Invalid Room reaper budgets" });
|
|
38
|
+
let A = Object.getOwnPropertyDescriptor(S, "lockstep");
|
|
39
|
+
if (A && (!A.enumerable || !("value" in A)) || !A && "lockstep" in S) throw new t({ detail: "Lockstep reaper configuration requires own data without accessors" });
|
|
40
|
+
let j = p(A?.value), M = [
|
|
41
|
+
"id",
|
|
42
|
+
"tenantId",
|
|
43
|
+
"pool",
|
|
44
|
+
"hostId",
|
|
45
|
+
"state",
|
|
46
|
+
"epoch",
|
|
47
|
+
"name",
|
|
48
|
+
"maxClients",
|
|
49
|
+
"options",
|
|
50
|
+
"lockstepAdmission",
|
|
51
|
+
"lockstepJournal",
|
|
52
|
+
"lockstepCreatorSubjectId",
|
|
53
|
+
"erasure",
|
|
54
|
+
"snapshotErasure"
|
|
55
|
+
], N = !1, P = S.snapshotCodec, F = s(S.snapshotBlobs), I = async (e, t, n, r, a) => {
|
|
56
|
+
let o = (await T(n, i, _(v("roomId", e), v("tenantId", t)), 1, [
|
|
57
|
+
"id",
|
|
58
|
+
"checkpoint",
|
|
59
|
+
"bytes",
|
|
60
|
+
"digest",
|
|
61
|
+
"storage",
|
|
62
|
+
"blob"
|
|
63
|
+
]))[0];
|
|
64
|
+
return o ? d(n, o, e, t, k, P, r, a) : null;
|
|
65
|
+
}, L = async (e, t, n) => {
|
|
66
|
+
let r = S.membership.list();
|
|
67
|
+
return (await E(S.directory.hosts(e, n))).filter((e) => e.id !== t && e.membership && r.some((t) => t.instanceId === e.membership.instanceId && t.startedAt === e.membership.startedAt));
|
|
68
|
+
}, R = (e, n, r) => {
|
|
69
|
+
if (!C) return h(e, n, S.strategies?.selectHost);
|
|
70
|
+
let i = e.map((e) => {
|
|
71
|
+
if (e.pool === void 0 || e.clientCapacity === void 0) throw new t({ detail: "Reaper candidate lacks pool registration metadata" });
|
|
72
|
+
return e;
|
|
73
|
+
});
|
|
74
|
+
return g(C, i, w(r.name), w(r.tenantId), n, w(r.pool), S.poolSelectHost ?? (S.strategies?.selectHost === void 0 ? void 0 : (e, t) => {
|
|
75
|
+
let n = S.strategies.selectHost(e, t);
|
|
76
|
+
return n === null ? null : n;
|
|
77
|
+
}));
|
|
78
|
+
}, z = async (e, n, i, a, s, c) => {
|
|
79
|
+
let l = await f(o, n, i, k, P, F, s);
|
|
80
|
+
return o.transactional(async (o) => {
|
|
81
|
+
let u = (await T(o, r, _(v("id", n), v("tenantId", i)), 1, M, !0))[0];
|
|
82
|
+
if (!u || u.hostId !== e || u.epoch !== a || u.state !== "live") throw new t({ detail: "Room adoption has no matching live SQL ownership observation" });
|
|
83
|
+
let d = await m(o, u, j);
|
|
84
|
+
if (d) {
|
|
85
|
+
if (!c || JSON.stringify(d.admission) !== JSON.stringify(c.admission) || c.journal && (!d.journal || JSON.stringify(d.journal.initial) !== JSON.stringify(c.journal.initial) || d.journal.ticks.length < c.journal.ticks.length || c.journal.ticks.some((e, t) => JSON.stringify(e) !== JSON.stringify(d.journal.ticks[t])))) throw new t({ detail: "Lockstep adoption changed its admitted initial truth or retained input prefix" });
|
|
86
|
+
let e = a - 1;
|
|
87
|
+
if (d.admission.adoption?.priorEpoch !== e || d.journal && d.journal.adoption?.priorEpoch !== e) throw new t({ detail: "Lockstep adoption has no matching immutable successor truth" });
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (c) throw new t({ detail: "Lockstep adoption lost its retained SQL truth" });
|
|
91
|
+
let f = await I(n, i, o, l, s);
|
|
92
|
+
if (!f || f.epoch !== a || f.disposition !== "live") throw new t({ detail: "Room adoption has no matching live SQL checkpoint observation" });
|
|
93
|
+
});
|
|
94
|
+
}, B = async (e, i, a, s) => {
|
|
95
|
+
let c = w(i.id), u = w(i.tenantId), d = w(e.id), p = i.epoch;
|
|
96
|
+
if (l(C, w(i.name), u, i.pool, e.pool, w(e.region)), typeof p != "number" || !Number.isSafeInteger(p) || p < 1) throw new t({ detail: "Invalid durable Room reaper epoch" });
|
|
97
|
+
if (!a && i.state === "creating") {
|
|
98
|
+
let n = await f(o, c, u, k, P, F, s), i = await o.transactional(async (i) => {
|
|
99
|
+
let a = (await T(i, r, _(v("id", c), v("tenantId", u)), 1, M, !0))[0];
|
|
100
|
+
if (!a || a.hostId !== d || a.epoch !== p || a.state !== "creating") throw new t({ detail: "Creating adoption changed its exact SQL owner" });
|
|
101
|
+
l(C, w(a.name), u, a.pool, e.pool, w(e.region));
|
|
102
|
+
let o = await m(i, a, j);
|
|
103
|
+
if (o) return {
|
|
104
|
+
needed: o.admission.adoption?.priorEpoch === p - 1 && (!o.journal || o.journal.adoption?.priorEpoch === p - 1),
|
|
105
|
+
lockstep: o
|
|
106
|
+
};
|
|
107
|
+
let f = await I(c, u, i, n, s);
|
|
108
|
+
return {
|
|
109
|
+
needed: f !== null && [
|
|
110
|
+
"live",
|
|
111
|
+
"hibernating",
|
|
112
|
+
"hibernated"
|
|
113
|
+
].includes(f.disposition) && f.epoch < p,
|
|
114
|
+
lockstep: null
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
if (i.needed) return await E(S.adoption.adopt(d, c, u, p - 1)), await z(d, c, u, p, s, i.lockstep), Object.freeze({
|
|
118
|
+
roomId: c,
|
|
119
|
+
tenantId: u,
|
|
120
|
+
state: "adopted"
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (!a && i.state !== "orphaned") return Object.freeze({
|
|
124
|
+
roomId: c,
|
|
125
|
+
tenantId: u,
|
|
126
|
+
state: "waiting-observation"
|
|
127
|
+
});
|
|
128
|
+
if ((await E(S.recovery.orphan(d, c, u, p))).state === "disposed") return Object.freeze({
|
|
129
|
+
roomId: c,
|
|
130
|
+
tenantId: u,
|
|
131
|
+
state: "disposed"
|
|
132
|
+
});
|
|
133
|
+
let h = w(e.region), g = await L(h, d, C ? w(i.pool) : void 0);
|
|
134
|
+
for (let e = 0; e < D && g.length; e++) {
|
|
135
|
+
let e = R(g, h, i);
|
|
136
|
+
if (!e) break;
|
|
137
|
+
let r;
|
|
138
|
+
try {
|
|
139
|
+
r = await E(S.recovery.claim(e.id, c, u, p));
|
|
140
|
+
} catch (t) {
|
|
141
|
+
if (!(t instanceof n)) throw t;
|
|
142
|
+
g.splice(g.findIndex((t) => t.id === e.id), 1);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (r.listing.id !== c || r.listing.tenantId !== u || r.listing.hostId !== e.id || r.listing.epoch !== p + 1) throw new t({ detail: "Reaper recovery claim changed its exact selected ownership" });
|
|
146
|
+
return await E(S.adoption.adopt(e.id, c, u, p)), await z(e.id, c, u, p + 1, s, r.mode === "lockstep" ? r.lockstep : null), Object.freeze({
|
|
147
|
+
roomId: c,
|
|
148
|
+
tenantId: u,
|
|
149
|
+
state: "adopted"
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return Object.freeze({
|
|
153
|
+
roomId: c,
|
|
154
|
+
tenantId: u,
|
|
155
|
+
state: "waiting-target"
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
return Object.freeze({ run: (n) => x.flatMap(x.context(), (i) => x.uninterruptible(x.tryPromise({
|
|
159
|
+
try: async () => {
|
|
160
|
+
let e = c(i);
|
|
161
|
+
if (N) throw new t({ detail: "Room reaper pass cannot overlap in one process" });
|
|
162
|
+
if (!n || typeof n != "object" || Object.keys(n).some((e) => ![
|
|
163
|
+
"hostId",
|
|
164
|
+
"afterHostId",
|
|
165
|
+
"afterRoomId"
|
|
166
|
+
].includes(e)) || n.hostId !== void 0 && n.afterHostId !== void 0 || n.afterRoomId !== void 0 && n.hostId === void 0) throw new t({ detail: "Invalid Room reaper page selection" });
|
|
167
|
+
for (let e of [
|
|
168
|
+
n.hostId,
|
|
169
|
+
n.afterHostId,
|
|
170
|
+
n.afterRoomId
|
|
171
|
+
]) e !== void 0 && w(e);
|
|
172
|
+
N = !0;
|
|
173
|
+
try {
|
|
174
|
+
let t = await T(o, a, n.hostId === void 0 ? n.afterHostId === void 0 ? void 0 : y("id", n.afterHostId) : v("id", n.hostId), D + 1, [
|
|
175
|
+
"id",
|
|
176
|
+
"region",
|
|
177
|
+
"pool",
|
|
178
|
+
"instanceId",
|
|
179
|
+
"membershipStartedAt"
|
|
180
|
+
]), i = [];
|
|
181
|
+
for (let a of t.slice(0, D)) {
|
|
182
|
+
let t = w(a.id);
|
|
183
|
+
if (a.instanceId === null || a.instanceId === void 0 || a.membershipStartedAt === null || a.membershipStartedAt === void 0) {
|
|
184
|
+
i.push(Object.freeze({
|
|
185
|
+
hostId: t,
|
|
186
|
+
state: "untracked",
|
|
187
|
+
rooms: [],
|
|
188
|
+
nextAfterRoom: null
|
|
189
|
+
}));
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
let s;
|
|
193
|
+
try {
|
|
194
|
+
s = (await E(S.recovery.observe(t))).state;
|
|
195
|
+
} catch {
|
|
196
|
+
i.push(Object.freeze({
|
|
197
|
+
hostId: t,
|
|
198
|
+
state: "failed",
|
|
199
|
+
rooms: [],
|
|
200
|
+
nextAfterRoom: null
|
|
201
|
+
}));
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
let c = await T(o, r, _(v("hostId", t), b(v("state", "live"), v("state", "creating"), v("state", "orphaned"), v("state", "hibernating")), ...n.afterRoomId === void 0 ? [] : [y("id", n.afterRoomId)]), O + 1, [
|
|
205
|
+
"id",
|
|
206
|
+
"tenantId",
|
|
207
|
+
"name",
|
|
208
|
+
"pool",
|
|
209
|
+
"epoch",
|
|
210
|
+
"state"
|
|
211
|
+
]), l = [];
|
|
212
|
+
for (let t of c.slice(0, O)) {
|
|
213
|
+
let n = w(t.id), r = w(t.tenantId);
|
|
214
|
+
try {
|
|
215
|
+
l.push(await B(a, t, s === "presumed-unreachable", e));
|
|
216
|
+
} catch {
|
|
217
|
+
l.push(Object.freeze({
|
|
218
|
+
roomId: n,
|
|
219
|
+
tenantId: r,
|
|
220
|
+
state: "failed"
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
i.push(Object.freeze({
|
|
225
|
+
hostId: t,
|
|
226
|
+
state: s,
|
|
227
|
+
rooms: Object.freeze(l),
|
|
228
|
+
nextAfterRoom: c.length > O ? w(c[O - 1].id) : null
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
return Object.freeze({
|
|
232
|
+
hosts: Object.freeze(i),
|
|
233
|
+
nextAfterHost: t.length > D ? w(t[D - 1].id) : null
|
|
234
|
+
});
|
|
235
|
+
} finally {
|
|
236
|
+
N = !1;
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
catch: (n) => n instanceof t || n instanceof e ? n : new t({ detail: "Room reaper pass failed" })
|
|
240
|
+
}))) });
|
|
241
|
+
}, O = (e, t) => S.succeed(o, D(e, t));
|
|
242
|
+
//#endregion
|
|
243
|
+
export { D as dataStoreRoomReaper, O as roomReaperLayer };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
//#region src/reaperSchemas.ts
|
|
3
|
+
var t = e.NonEmptyString.pipe(e.check(e.isMaxLength(191))), n = e.Int.pipe(e.check(e.isGreaterThanOrEqualTo(0))), r = e.Struct({
|
|
4
|
+
hosts: e.Array(e.Struct({
|
|
5
|
+
hostId: t,
|
|
6
|
+
state: e.Literals([
|
|
7
|
+
"observing",
|
|
8
|
+
"presumed-unreachable",
|
|
9
|
+
"untracked",
|
|
10
|
+
"failed"
|
|
11
|
+
]),
|
|
12
|
+
rooms: e.Array(e.Struct({
|
|
13
|
+
roomId: t,
|
|
14
|
+
tenantId: t,
|
|
15
|
+
state: e.Literals([
|
|
16
|
+
"disposed",
|
|
17
|
+
"adopted",
|
|
18
|
+
"waiting-target",
|
|
19
|
+
"waiting-observation",
|
|
20
|
+
"failed"
|
|
21
|
+
])
|
|
22
|
+
})),
|
|
23
|
+
nextAfterRoom: e.NullOr(t)
|
|
24
|
+
})),
|
|
25
|
+
nextAfterHost: e.NullOr(t)
|
|
26
|
+
}), i = e.Struct({
|
|
27
|
+
runKey: t,
|
|
28
|
+
maxPages: e.Int.pipe(e.check(e.isBetween({
|
|
29
|
+
minimum: 1,
|
|
30
|
+
maximum: 4096
|
|
31
|
+
})))
|
|
32
|
+
}), a = e.Struct({
|
|
33
|
+
pages: n,
|
|
34
|
+
hostsObserved: n,
|
|
35
|
+
roomsObserved: n,
|
|
36
|
+
adopted: n,
|
|
37
|
+
disposed: n,
|
|
38
|
+
waiting: n,
|
|
39
|
+
untrackedHosts: n
|
|
40
|
+
});
|
|
41
|
+
//#endregion
|
|
42
|
+
export { r as RoomReaperReportSchema, i as RoomReaperWorkflowPayload, a as RoomReaperWorkflowResult };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
|
|
2
|
+
import { RoomReaperReportSchema as n, RoomReaperWorkflowPayload as r } from "./reaperSchemas.js";
|
|
3
|
+
import { RoomReaperPort as i } from "./ports.js";
|
|
4
|
+
import { Effect as a, Result as o, Schema as s } from "effect";
|
|
5
|
+
//#region src/reaperWorkflow.ts
|
|
6
|
+
function c() {
|
|
7
|
+
throw new t({ detail: "Room reaper provider returned invalid or non-advancing pages" });
|
|
8
|
+
}
|
|
9
|
+
var l = (e, t) => {
|
|
10
|
+
if (!e || !Array.isArray(e.hosts) || e.hosts.length > 256 || e.hosts.some((e) => !e || !Array.isArray(e.rooms) || e.rooms.length > 256)) return c();
|
|
11
|
+
let r = s.decodeUnknownResult(s.toType(n))(e);
|
|
12
|
+
if (o.isFailure(r)) return c();
|
|
13
|
+
let i = t.afterHostId ?? "";
|
|
14
|
+
for (let e of r.success.hosts) {
|
|
15
|
+
if (e.hostId <= i || t.hostId !== void 0 && e.hostId !== t.hostId) return c();
|
|
16
|
+
i = e.hostId;
|
|
17
|
+
let n = t.afterRoomId ?? "";
|
|
18
|
+
for (let t of e.rooms) {
|
|
19
|
+
if (t.roomId <= n) return c();
|
|
20
|
+
n = t.roomId;
|
|
21
|
+
}
|
|
22
|
+
if (e.nextAfterRoom !== null && (!e.rooms.length || e.nextAfterRoom !== n)) return c();
|
|
23
|
+
}
|
|
24
|
+
return t.hostId !== void 0 && (r.success.hosts.length > 1 || r.success.nextAfterHost !== null) || r.success.nextAfterHost !== null && (!r.success.hosts.length || r.success.nextAfterHost !== i) ? c() : structuredClone(r.success);
|
|
25
|
+
}, u = (n, i) => a.gen(function* () {
|
|
26
|
+
let c = s.decodeUnknownResult(s.toType(r))(i);
|
|
27
|
+
if (o.isFailure(c)) return yield* a.fail(new t({ detail: "Invalid Room reaper workflow payload" }));
|
|
28
|
+
let u = Object.freeze({ ...c.success }), d = 0, f = 0, p = 0, m = 0, h = 0, g = 0, _ = 0, v = !1, y = (r) => a.gen(function* () {
|
|
29
|
+
if (d >= u.maxPages) return yield* a.fail(new e({
|
|
30
|
+
budget: "reaperWorkflowPages",
|
|
31
|
+
limit: u.maxPages
|
|
32
|
+
}));
|
|
33
|
+
d++;
|
|
34
|
+
let i = yield* n.run(Object.freeze({ ...r }));
|
|
35
|
+
return yield* a.try({
|
|
36
|
+
try: () => l(i, r),
|
|
37
|
+
catch: () => new t({ detail: "Room reaper provider returned invalid or non-advancing pages" })
|
|
38
|
+
});
|
|
39
|
+
}), b = (e) => {
|
|
40
|
+
e.state === "failed" && (v = !0);
|
|
41
|
+
for (let t of e.rooms) p++, t.state === "failed" ? v = !0 : t.state === "adopted" ? m++ : t.state === "disposed" ? h++ : g++;
|
|
42
|
+
}, x;
|
|
43
|
+
do {
|
|
44
|
+
let e = yield* y(x === void 0 ? {} : { afterHostId: x });
|
|
45
|
+
for (let t of e.hosts) {
|
|
46
|
+
f++, t.state === "untracked" && _++;
|
|
47
|
+
let e = t;
|
|
48
|
+
for (b(e); e.nextAfterRoom !== null;) {
|
|
49
|
+
let t = (yield* y({
|
|
50
|
+
hostId: e.hostId,
|
|
51
|
+
afterRoomId: e.nextAfterRoom
|
|
52
|
+
})).hosts[0];
|
|
53
|
+
if (!t) break;
|
|
54
|
+
e = t, b(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
x = e.nextAfterHost ?? void 0;
|
|
58
|
+
} while (x !== void 0);
|
|
59
|
+
return v ? yield* a.fail(new t({ detail: "Room reaper sweep retained failed recovery observations" })) : Object.freeze({
|
|
60
|
+
pages: d,
|
|
61
|
+
hostsObserved: f,
|
|
62
|
+
roomsObserved: p,
|
|
63
|
+
adopted: m,
|
|
64
|
+
disposed: h,
|
|
65
|
+
waiting: g,
|
|
66
|
+
untrackedHosts: _
|
|
67
|
+
});
|
|
68
|
+
}), d = (e) => i.pipe(a.flatMap((t) => u(t, e)));
|
|
69
|
+
//#endregion
|
|
70
|
+
export { d as roomReaperWorkflowExecutor, u as runRoomReaperWorkflow };
|
package/dist/recovery.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomForbidden as n, RoomFull as r, RoomGone as i } from "./errors.js";
|
|
2
|
+
import { ROOMS_TABLE as a, ROOM_CHECKPOINTS_TABLE as o, ROOM_HOSTS_TABLE as s, ROOM_SEATS_TABLE as c } from "./identities.js";
|
|
3
|
+
import { RoomRecoveryPort as l } from "./ports.js";
|
|
4
|
+
import { storedLockstepJournalHeader as u } from "./lockstepJournalRows.js";
|
|
5
|
+
import { captureRoomSnapshotBlobs as d, captureRoomSnapshotEffectRunner as f } from "./snapshotBlobIndex.js";
|
|
6
|
+
import { assertRoomPoolRecoveryTarget as p, captureAdmittedRoomPoolTopology as m } from "./roomPoolTopology.js";
|
|
7
|
+
import { assertHostClientCapacity as h } from "./hostClientCapacity.js";
|
|
8
|
+
import { loadDurableRoomCheckpoint as g, prefetchRoomCheckpointBlobs as _ } from "./checkpointStore.js";
|
|
9
|
+
import { adoptRoomLockstepRecoveryTruth as v, captureRoomLockstepRecoveryOptions as y, readRoomLockstepRecoveryTruth as b } from "./lockstepRecoveryTruth.js";
|
|
10
|
+
import { fenceRoomRecoverySeats as x } from "./recoverySeats.js";
|
|
11
|
+
import { decodeRoomDirectoryListing as S } from "./directory.js";
|
|
12
|
+
import { RoomMembershipObserver as C } from "./membershipObserver.js";
|
|
13
|
+
import { and as w, eq as T, or as E } from "@voltro/database";
|
|
14
|
+
import { Effect as D, Layer as O } from "effect";
|
|
15
|
+
//#region src/recovery.ts
|
|
16
|
+
function k(e) {
|
|
17
|
+
throw new t({ detail: e });
|
|
18
|
+
}
|
|
19
|
+
var A = (e) => typeof e == "string" && e.trim() && e.length <= 191 ? e : k("Invalid Room recovery identity"), j = (e) => typeof e == "number" && Number.isSafeInteger(e) && e >= 0 ? e : k("Invalid durable Room recovery counter"), M = (e) => {
|
|
20
|
+
let t = e instanceof Date ? e.getTime() : typeof e == "string" ? Date.parse(e) : NaN;
|
|
21
|
+
return Number.isFinite(t) ? t : k("Invalid durable Room recovery timestamp");
|
|
22
|
+
}, N = (e, t, n, r, i = !1) => e.query({
|
|
23
|
+
table: t,
|
|
24
|
+
predicate: n,
|
|
25
|
+
order: [{
|
|
26
|
+
column: "id",
|
|
27
|
+
direction: "asc"
|
|
28
|
+
}],
|
|
29
|
+
take: r,
|
|
30
|
+
skip: void 0,
|
|
31
|
+
projection: void 0,
|
|
32
|
+
...i ? { lock: "update" } : {}
|
|
33
|
+
}), P = (e) => ({
|
|
34
|
+
hostId: A(e.id),
|
|
35
|
+
instanceId: A(e.instanceId),
|
|
36
|
+
startedAt: M(e.membershipStartedAt),
|
|
37
|
+
sqlHeartbeat: j(e.heartbeatRevision)
|
|
38
|
+
}), F = (a) => D.flatMap(D.context(), (o) => D.uninterruptible(D.tryPromise({
|
|
39
|
+
try: () => a(f(o)),
|
|
40
|
+
catch: (a) => a instanceof t || a instanceof e || a instanceof n || a instanceof r || a instanceof i ? a : new t({ detail: "Durable Room recovery failed" })
|
|
41
|
+
}))), I = (t, l) => {
|
|
42
|
+
let f = l.pools === void 0 ? void 0 : m(l.pools), D = l.maxSeatRows ?? 4096, O = l.maxCheckpointBytes ?? 1048576, I = l.maxHostCapacity ?? 4096;
|
|
43
|
+
(![
|
|
44
|
+
l.heartbeatEveryMs,
|
|
45
|
+
l.hostHeartbeatTtlMs,
|
|
46
|
+
...typeof l.graceMs == "number" ? [l.graceMs] : [],
|
|
47
|
+
D,
|
|
48
|
+
O,
|
|
49
|
+
I
|
|
50
|
+
].every((e) => Number.isSafeInteger(e) && e > 0) || typeof l.graceMs != "number" && typeof l.graceMs != "function" || l.heartbeatEveryMs > (2 ** 53 - 1) / 3 || l.hostHeartbeatTtlMs <= l.heartbeatEveryMs) && k("Invalid Room recovery budgets");
|
|
51
|
+
let L = Object.getOwnPropertyDescriptor(l, "lockstep");
|
|
52
|
+
(L && (!L.enumerable || !("value" in L)) || !L && "lockstep" in l) && k("Lockstep recovery configuration requires own data without accessors");
|
|
53
|
+
let R = y(L?.value), z = new C(l.membership, l.observerNow, l.heartbeatEveryMs * 3, l.maxObservedHosts), B = l.snapshotCodec, V = d(l.snapshotBlobs), H = () => {
|
|
54
|
+
let e = l.epochNow();
|
|
55
|
+
return Number.isSafeInteger(e) && e >= 0 && e <= 864e13 ? e : k("Invalid Room recovery wall clock");
|
|
56
|
+
}, U = (e, t) => w(T("roomId", e), T("tenantId", t)), W = (e, t) => w(T("id", e), T("tenantId", t)), G = async (e, t, n, r, i) => {
|
|
57
|
+
let a = (await N(e, o, U(t, n), 1, !0))[0];
|
|
58
|
+
return a ? g(e, a, t, n, O, B, r, i) : null;
|
|
59
|
+
}, K = (e) => {
|
|
60
|
+
(j(e) < 1 || e >= 2 ** 53 - 1) && k("Room recovery epoch is invalid or exhausted");
|
|
61
|
+
}, q = async (t, n, r) => {
|
|
62
|
+
let i = await N(t, c, w(U(n, r), E(T("state", "reserved"), T("state", "connected"), T("state", "grace"))), D + 1, !0);
|
|
63
|
+
if (i.length > D) throw new e({
|
|
64
|
+
budget: "recoverySeatRows",
|
|
65
|
+
limit: D
|
|
66
|
+
});
|
|
67
|
+
return i;
|
|
68
|
+
};
|
|
69
|
+
return Object.freeze({
|
|
70
|
+
observe: (e) => F(async () => {
|
|
71
|
+
let n = (await N(t, s, T("id", A(e)), 1))[0];
|
|
72
|
+
if (!n) throw new i({ roomId: "host" });
|
|
73
|
+
return z.observe(P(n));
|
|
74
|
+
}),
|
|
75
|
+
orphan: (e, r, o, c) => F(async (u) => {
|
|
76
|
+
let d = await _(t, r, o, O, B, V, u);
|
|
77
|
+
return t.transactional(async (t) => {
|
|
78
|
+
A(e), A(r), A(o), K(c);
|
|
79
|
+
let f = (await N(t, s, T("id", e), 1, !0))[0];
|
|
80
|
+
if (!f) throw new i({ roomId: "host" });
|
|
81
|
+
let p = (await N(t, a, W(r, o), 1, !0))[0];
|
|
82
|
+
if (!p || p.hostId !== e) throw new n({ roomId: r });
|
|
83
|
+
if (p.state === "disposed" && p.epoch === c + 1) return Object.freeze({
|
|
84
|
+
roomId: r,
|
|
85
|
+
tenantId: o,
|
|
86
|
+
epoch: c + 1,
|
|
87
|
+
state: "disposed"
|
|
88
|
+
});
|
|
89
|
+
if (p.epoch !== c) throw new n({ roomId: r });
|
|
90
|
+
if (p.state === "orphaned") return Object.freeze({
|
|
91
|
+
roomId: r,
|
|
92
|
+
tenantId: o,
|
|
93
|
+
epoch: c,
|
|
94
|
+
state: "orphaned"
|
|
95
|
+
});
|
|
96
|
+
if (![
|
|
97
|
+
"live",
|
|
98
|
+
"creating",
|
|
99
|
+
"hibernating"
|
|
100
|
+
].includes(String(p.state))) throw new i({ roomId: r });
|
|
101
|
+
z.observe(P(f)).state !== "presumed-unreachable" && k("Room recovery requires both locally observed silence windows");
|
|
102
|
+
let m = await b(t, p, R), h = m ? null : await G(t, r, o, d, u);
|
|
103
|
+
h && (h.epoch > c || p.state !== "creating" && h.epoch !== c) && k("Recovery checkpoint does not match the fenced owner epoch");
|
|
104
|
+
let g = H(), _ = m !== null || h?.disposition === "live" || h?.disposition === "hibernating" || h?.disposition === "hibernated", v = typeof l.graceMs == "function" ? l.graceMs(r, o) : l.graceMs;
|
|
105
|
+
(!Number.isSafeInteger(v) || v <= 0 || g > 864e13 - v) && k("Invalid Room recovery grace policy");
|
|
106
|
+
let y = await q(t, r, o), S = await x(t, r, o, c, y, g, v, _, j(p.maxClients)), C = _ ? "orphaned" : "disposed", E = _ ? c : c + 1;
|
|
107
|
+
return await t.updateMany("_voltro_rooms", {
|
|
108
|
+
state: C,
|
|
109
|
+
clients: S,
|
|
110
|
+
epoch: E,
|
|
111
|
+
updatedAt: new Date(g)
|
|
112
|
+
}, { where: w(W(r, o), T("hostId", e), T("epoch", c), T("state", p.state)) }) !== 1 && k("Room orphan transaction lost its ownership CAS"), f.ready === !0 && await t.updateMany(s, { ready: !1 }, { where: T("id", e) }), Object.freeze({
|
|
113
|
+
roomId: r,
|
|
114
|
+
tenantId: o,
|
|
115
|
+
epoch: E,
|
|
116
|
+
state: C
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}),
|
|
120
|
+
claim: (e, o, d, m) => F(async (g) => {
|
|
121
|
+
let y = await _(t, o, d, O, B, V, g);
|
|
122
|
+
return t.transactional(async (t) => {
|
|
123
|
+
A(e), A(o), A(d), K(m);
|
|
124
|
+
let _ = H(), x = (await N(t, s, T("id", e), 1, !0))[0];
|
|
125
|
+
if (!x || x.ready !== !0 || x.draining === !0 || M(x.lastHeartbeatAt) <= _ - l.hostHeartbeatTtlMs) throw new i({ roomId: "host" });
|
|
126
|
+
let C = P(x);
|
|
127
|
+
l.membership.list().some((e) => e.instanceId === C.instanceId && e.startedAt === C.startedAt) || k("Recovery target is absent from the borrowed process membership");
|
|
128
|
+
let D = (await N(t, a, W(o, d), 1, !0))[0];
|
|
129
|
+
if (!D) throw new i({ roomId: o });
|
|
130
|
+
p(f, A(D.name), d, D.pool, x.pool, A(x.region));
|
|
131
|
+
let O = D.hostId === e && D.epoch === m + 1 && ["creating", "live"].includes(String(D.state)), F = D.state === "hibernated" && D.hostId === null && D.epoch === m;
|
|
132
|
+
if (!O && !F && (D.state !== "orphaned" || D.epoch !== m || D.hostId === e)) throw new n({ roomId: o });
|
|
133
|
+
let L = await b(t, D, R), z = L ? null : await G(t, o, d, y, g);
|
|
134
|
+
L && F && k("Lockstep recovery cannot wake a state hibernation"), !L && (!z || ![
|
|
135
|
+
"live",
|
|
136
|
+
"hibernating",
|
|
137
|
+
"hibernated"
|
|
138
|
+
].includes(z.disposition) || z.epoch > (O ? m + 1 : m) || F && (z.disposition !== "hibernated" || z.epoch !== m)) && k("Recovery requires the matching recoverable durable checkpoint");
|
|
139
|
+
let B = L ? v(L, e, m, O, R.maxJournalBytes) : null, V = j(x.capacity);
|
|
140
|
+
(V < 1 || V > I) && k("Invalid recovery target host capacity budget");
|
|
141
|
+
let J = await N(t, a, w(T("hostId", e), E(T("state", "live"), T("state", "creating"), T("state", "hibernating"))), V + 1);
|
|
142
|
+
if (O ? J.length > V : J.length >= V) throw new r({ roomId: "host" });
|
|
143
|
+
await h(t, e, O ? 0 : j(D.clients), I), typeof D.private != "boolean" && k("Invalid durable Room recovery visibility");
|
|
144
|
+
let Y = m + 1;
|
|
145
|
+
if (!O) {
|
|
146
|
+
let n = await q(t, o, d);
|
|
147
|
+
(F ? n.length !== 0 || D.clients !== 0 : n.some((e) => e.state !== "grace" || e.epoch !== m)) && k("Recovery admission requires empty hibernation or fenced grace seats"), await t.updateMany(c, {
|
|
148
|
+
epoch: Y,
|
|
149
|
+
updatedAt: new Date(_)
|
|
150
|
+
}, { where: w(U(o, d), T("state", "grace"), T("epoch", m)) }), await t.updateMany("_voltro_rooms", {
|
|
151
|
+
hostId: e,
|
|
152
|
+
epoch: Y,
|
|
153
|
+
state: "creating",
|
|
154
|
+
updatedAt: new Date(_),
|
|
155
|
+
...B ? {
|
|
156
|
+
lockstepAdmission: B.admission,
|
|
157
|
+
lockstepJournal: u(B.journal)
|
|
158
|
+
} : {}
|
|
159
|
+
}, { where: w(W(o, d), T("hostId", D.hostId), T("epoch", m), T("state", F ? "hibernated" : "orphaned")) }) !== 1 && k("Room adoption lost its ownership CAS");
|
|
160
|
+
}
|
|
161
|
+
let X = {
|
|
162
|
+
listing: S({
|
|
163
|
+
...D,
|
|
164
|
+
hostId: e,
|
|
165
|
+
epoch: Y
|
|
166
|
+
}),
|
|
167
|
+
private: D.private,
|
|
168
|
+
ticksLost: null
|
|
169
|
+
};
|
|
170
|
+
return B ? Object.freeze({
|
|
171
|
+
...X,
|
|
172
|
+
mode: "lockstep",
|
|
173
|
+
checkpoint: null,
|
|
174
|
+
lockstep: B,
|
|
175
|
+
options: B.options,
|
|
176
|
+
recoveredTick: B.journal?.ticks.length ?? 0
|
|
177
|
+
}) : z ? Object.freeze({
|
|
178
|
+
...X,
|
|
179
|
+
mode: "state-sync",
|
|
180
|
+
checkpoint: z,
|
|
181
|
+
options: structuredClone(D.options),
|
|
182
|
+
recoveredTick: z.tick
|
|
183
|
+
}) : k("Recovery lost its durable state claim");
|
|
184
|
+
});
|
|
185
|
+
})
|
|
186
|
+
});
|
|
187
|
+
}, L = (e, t) => O.succeed(l, I(e, t));
|
|
188
|
+
//#endregion
|
|
189
|
+
export { I as dataStoreRoomRecovery, L as roomRecoveryLayer };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import "./identities.js";
|
|
3
|
+
import { and as t, eq as n } from "@voltro/database";
|
|
4
|
+
//#region src/recoverySeats.ts
|
|
5
|
+
var r = async (r, i, a, o, s, c, l, u, d) => {
|
|
6
|
+
let f = () => {
|
|
7
|
+
throw new e({ detail: "Recovery seat scope, capacity or grace policy is invalid" });
|
|
8
|
+
};
|
|
9
|
+
(!Number.isSafeInteger(l) || l <= 0 || c > 864e13 - l) && f();
|
|
10
|
+
let p = (e) => {
|
|
11
|
+
let t = e instanceof Date ? e.getTime() : typeof e == "string" ? Date.parse(e) : NaN;
|
|
12
|
+
return Number.isFinite(t) ? t : f();
|
|
13
|
+
}, m = 0;
|
|
14
|
+
for (let e of s) {
|
|
15
|
+
(e.roomId !== i || e.tenantId !== a || e.epoch !== o) && f();
|
|
16
|
+
let s = e.state === "connected" || e.state === "reserved" && p(e.expiresAt) > c || e.state === "grace" && p(e.graceUntil) > c, d = !!(u && s && typeof e.subjectId == "string" && e.subjectId.trim()), h = e.state === "grace" ? Math.min(p(e.graceUntil), c + l) : c + l;
|
|
17
|
+
await r.updateMany("_voltro_room_seats", {
|
|
18
|
+
state: d ? "grace" : "released",
|
|
19
|
+
graceUntil: d ? new Date(h) : null,
|
|
20
|
+
updatedAt: new Date(c)
|
|
21
|
+
}, { where: t(n("roomId", i), n("tenantId", a), n("id", e.id), n("epoch", o), n("state", e.state)) }) !== 1 && f(), d && m++;
|
|
22
|
+
}
|
|
23
|
+
return (!Number.isSafeInteger(d) || m > d) && f(), m;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { r as fenceRoomRecoverySeats };
|