@voltro/plugin-rooms 0.0.0-stage → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24329 -0
- package/LICENSE +61 -0
- package/README.md +9204 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +11322 -0
- package/dist/actor.js +1474 -0
- package/dist/apiBinding.js +678 -0
- package/dist/apiRegistryBinding.js +399 -0
- package/dist/apiReservations.js +433 -0
- package/dist/baselines.js +73 -0
- package/dist/bots.d.ts +1485 -0
- package/dist/bots.js +563 -0
- package/dist/catalog.js +80 -0
- package/dist/checkpointJson.js +24 -0
- package/dist/checkpointStore.js +386 -0
- package/dist/client.js +56 -0
- package/dist/clockSync.js +51 -0
- package/dist/collision.js +156 -0
- package/dist/commandDelivery.js +101 -0
- package/dist/commandRecord.js +11 -0
- package/dist/commandWithdrawal.js +183 -0
- package/dist/connection.js +497 -0
- package/dist/controlCarrier.js +375 -0
- package/dist/controlRegistry.js +79 -0
- package/dist/controlTarget.js +45 -0
- package/dist/controlTransport.js +574 -0
- package/dist/developmentBinding.js +113 -0
- package/dist/directory.js +323 -0
- package/dist/directoryProjection.js +117 -0
- package/dist/errors.d.ts +125 -0
- package/dist/errors.js +53 -0
- package/dist/fixed.d.ts +284 -0
- package/dist/fixed.js +10 -0
- package/dist/fixed32.js +134 -0
- package/dist/fixedCollision.js +60 -0
- package/dist/fixedCollision32.js +109 -0
- package/dist/fixedMath.js +56 -0
- package/dist/fixedRaw.js +11 -0
- package/dist/fixedSlabs.js +34 -0
- package/dist/fixedTrig.js +48 -0
- package/dist/fixedTrig32.js +38 -0
- package/dist/fixedVectors.js +113 -0
- package/dist/fixedVectors32.js +95 -0
- package/dist/fixedWide.js +50 -0
- package/dist/fixedWords.js +46 -0
- package/dist/gateway.js +57 -0
- package/dist/geometry-retention-app/rooms.geometryJournalRetention.workflow.server.tsx +4 -0
- package/dist/geometry-retention-app/rooms.geometryJournalRetention.workflow.tsx +14 -0
- package/dist/geometry-worker/worker.d.mts +2 -0
- package/dist/geometry-worker/worker.mjs +50 -0
- package/dist/geometry.d.ts +2249 -0
- package/dist/geometry.js +40 -0
- package/dist/geometryActivation.js +82 -0
- package/dist/geometryActorInventory.js +108 -0
- package/dist/geometryAdminClient.js +87 -0
- package/dist/geometryAdminData.js +32 -0
- package/dist/geometryAdminFixtures.js +50 -0
- package/dist/geometryAdminPorts.js +5 -0
- package/dist/geometryAdminRpc.js +58 -0
- package/dist/geometryAdminRpcRoutes.js +49 -0
- package/dist/geometryAdminSchemas.js +39 -0
- package/dist/geometryAdministration.js +190 -0
- package/dist/geometryAdministrationPorts.js +5 -0
- package/dist/geometryApiBinding.js +165 -0
- package/dist/geometryAppStorage.js +58 -0
- package/dist/geometryArtifacts.js +198 -0
- package/dist/geometryAssetBundle.js +117 -0
- package/dist/geometryAssetClient.js +25 -0
- package/dist/geometryAssetData.js +106 -0
- package/dist/geometryAssetHttp.js +123 -0
- package/dist/geometryAssetPorts.js +5 -0
- package/dist/geometryAssetRpc.js +30 -0
- package/dist/geometryAssetRpcRoutes.js +40 -0
- package/dist/geometryAssetStorageGrant.js +103 -0
- package/dist/geometryBoxOverlap.js +110 -0
- package/dist/geometryCatalogueDigest.js +111 -0
- package/dist/geometryCellCoverage.js +85 -0
- package/dist/geometryCellLoader.js +28 -0
- package/dist/geometryChannel.js +134 -0
- package/dist/geometryChunkHttp.js +54 -0
- package/dist/geometryChunkLeases.js +22 -0
- package/dist/geometryClient.d.ts +1429 -0
- package/dist/geometryClient.js +149 -0
- package/dist/geometryClientChunks.js +330 -0
- package/dist/geometryClientDelta.js +25 -0
- package/dist/geometryClientHttp.js +37 -0
- package/dist/geometryClientInterest.js +109 -0
- package/dist/geometryClientStatic.js +34 -0
- package/dist/geometryCms.d.ts +763 -0
- package/dist/geometryCms.js +217 -0
- package/dist/geometryCommitCoordinator.js +241 -0
- package/dist/geometryCompactionFixture.js +84 -0
- package/dist/geometryCompactionStrategies.js +38 -0
- package/dist/geometryConnectionClient.js +23 -0
- package/dist/geometryDerivationFixtures.js +141 -0
- package/dist/geometryDerivationStrategies.js +27 -0
- package/dist/geometryDigest.js +13 -0
- package/dist/geometryEditChannel.js +70 -0
- package/dist/geometryEditIngress.js +263 -0
- package/dist/geometryEdits.js +366 -0
- package/dist/geometryEnvelope.js +41 -0
- package/dist/geometryGridRaycast.js +92 -0
- package/dist/geometryGridSweep.js +92 -0
- package/dist/geometryHeightfield.js +166 -0
- package/dist/geometryHeightfieldRaycast.js +74 -0
- package/dist/geometryHeightfieldSweep.js +85 -0
- package/dist/geometryHeightfieldVolume.js +45 -0
- package/dist/geometryHost.js +322 -0
- package/dist/geometryHostDirectory.js +207 -0
- package/dist/geometryHostMutations.js +137 -0
- package/dist/geometryHostStreams.js +124 -0
- package/dist/geometryHttpBody.js +76 -0
- package/dist/geometryHttpRoutes.js +112 -0
- package/dist/geometryImportGltf.js +300 -0
- package/dist/geometryImportLdtk.js +54 -0
- package/dist/geometryImportPng.js +144 -0
- package/dist/geometryImportPublication.js +67 -0
- package/dist/geometryImportTiled.js +39 -0
- package/dist/geometryImportTiles.js +136 -0
- package/dist/geometryImportVox.js +130 -0
- package/dist/geometryImportedSource.js +101 -0
- package/dist/geometryInspectEndpoint.js +248 -0
- package/dist/geometryInspection.js +92 -0
- package/dist/geometryInstall.js +121 -0
- package/dist/geometryJournalArchiveData.js +21 -0
- package/dist/geometryJournalArchiveIndex.js +330 -0
- package/dist/geometryJournalArchiveTable.js +21 -0
- package/dist/geometryJournalCompaction.js +100 -0
- package/dist/geometryJournalPatch.js +47 -0
- package/dist/geometryJournalRetention.js +112 -0
- package/dist/geometryJournalRetentionSchemas.js +36 -0
- package/dist/geometryJournalRetentionSweep.js +112 -0
- package/dist/geometryJournalRetentionWorkflow.js +28 -0
- package/dist/geometryJournalRetentionWorkflowData.js +31 -0
- package/dist/geometryJournalStorage.js +148 -0
- package/dist/geometryLoader.js +118 -0
- package/dist/geometryManifest.js +113 -0
- package/dist/geometryManifestChannel.js +93 -0
- package/dist/geometryManifestClient.js +122 -0
- package/dist/geometryManifestData.js +49 -0
- package/dist/geometryManifestPorts.js +5 -0
- package/dist/geometryManifestPublication.js +109 -0
- package/dist/geometryManifestSource.js +68 -0
- package/dist/geometryMigrationJournal.js +14 -0
- package/dist/geometryMigrationStrategies.js +7 -0
- package/dist/geometryMigrations.js +323 -0
- package/dist/geometryNativeMetadata.js +52 -0
- package/dist/geometryPatch.js +170 -0
- package/dist/geometryPersistence.js +449 -0
- package/dist/geometryPersistenceCapture.js +69 -0
- package/dist/geometryPersistenceData.js +140 -0
- package/dist/geometryPersistencePorts.js +5 -0
- package/dist/geometryPlayerAdmission.js +34 -0
- package/dist/geometryPlayerEditOwner.js +265 -0
- package/dist/geometryPlayerEdits.js +49 -0
- package/dist/geometryPrepared.js +188 -0
- package/dist/geometryPrivacyFence.js +24 -0
- package/dist/geometryProceduralPublication.js +91 -0
- package/dist/geometryProceduralWorker.js +164 -0
- package/dist/geometryPublication.js +110 -0
- package/dist/geometryRayAlgebra.js +116 -0
- package/dist/geometryReadClient.js +157 -0
- package/dist/geometryReadPorts.js +5 -0
- package/dist/geometryReadRpc.js +27 -0
- package/dist/geometryReadRpcRoutes.js +47 -0
- package/dist/geometryReliablePublication.js +82 -0
- package/dist/geometryReloadPorts.js +46 -0
- package/dist/geometryReloadSource.js +278 -0
- package/dist/geometryRenderCache.js +165 -0
- package/dist/geometryRenderLod.js +102 -0
- package/dist/geometryRollback.js +125 -0
- package/dist/geometryRollbackCoordinator.js +203 -0
- package/dist/geometryRollbackPorts.js +46 -0
- package/dist/geometryRollbackSource.js +209 -0
- package/dist/geometryRollbackStore.js +198 -0
- package/dist/geometrySchemas.js +27 -0
- package/dist/geometryServer.d.ts +2766 -0
- package/dist/geometryServer.js +62 -0
- package/dist/geometryShapeRaycast.js +111 -0
- package/dist/geometryShapeSegments.js +34 -0
- package/dist/geometryShapes.js +223 -0
- package/dist/geometrySnapshot.js +76 -0
- package/dist/geometrySnapshotChannel.js +160 -0
- package/dist/geometrySnapshotClient.js +159 -0
- package/dist/geometrySnapshotPreparation.js +76 -0
- package/dist/geometrySnapshotServer.js +191 -0
- package/dist/geometrySqlOwner.js +21 -0
- package/dist/geometryStorage.js +127 -0
- package/dist/geometryStorageGrant.js +69 -0
- package/dist/geometryStorageIdentity.js +9 -0
- package/dist/geometryTileArtifact.js +10 -0
- package/dist/geometryTileCodec.js +194 -0
- package/dist/geometryTileCollision.js +96 -0
- package/dist/geometryTileNavigation.js +128 -0
- package/dist/geometryTileView.js +35 -0
- package/dist/geometryVersionActivation.js +114 -0
- package/dist/geometryVersionClient.js +238 -0
- package/dist/geometryVersionCompare.js +40 -0
- package/dist/geometryVersionMigration.js +106 -0
- package/dist/geometryVoxel.js +253 -0
- package/dist/geometryWorldEntitySubject.js +32 -0
- package/dist/geometryWorldExtent.js +12 -0
- package/dist/geometryWorldMetadata.js +38 -0
- package/dist/geometryWorldStrategyFixtures.js +127 -0
- package/dist/geometryWorldView.js +307 -0
- package/dist/host.js +128 -0
- package/dist/hostBinding.js +277 -0
- package/dist/hostCellObservation.js +114 -0
- package/dist/hostClientCapacity.js +90 -0
- package/dist/hostCommandScope.js +64 -0
- package/dist/hostController.js +3094 -0
- package/dist/hostDeployment.js +65 -0
- package/dist/hostDrain.js +152 -0
- package/dist/hostDrainPorts.js +5 -0
- package/dist/hostDriver.js +179 -0
- package/dist/hostLane.js +288 -0
- package/dist/hostListener.js +79 -0
- package/dist/hostListenerBinding.js +19 -0
- package/dist/hostLoopObservation.js +90 -0
- package/dist/hostMetrics.js +56 -0
- package/dist/hostRegistryBinding.js +418 -0
- package/dist/hostSelection.js +16 -0
- package/dist/hostShutdown.js +47 -0
- package/dist/hostTurnObservation.js +53 -0
- package/dist/identities.js +4 -0
- package/dist/index.d.ts +8632 -0
- package/dist/index.js +232 -0
- package/dist/inputReceipts.js +63 -0
- package/dist/inputRedundancy.js +55 -0
- package/dist/inspect.js +238 -0
- package/dist/lockstep.d.ts +436 -0
- package/dist/lockstep.js +382 -0
- package/dist/lockstepAdmission.js +262 -0
- package/dist/lockstepAdmissionCodec.js +94 -0
- package/dist/lockstepAdmissionPorts.js +5 -0
- package/dist/lockstepClientSession.js +578 -0
- package/dist/lockstepDefinition.js +148 -0
- package/dist/lockstepHostLoop.js +243 -0
- package/dist/lockstepInitialAdmission.js +67 -0
- package/dist/lockstepInitialStrategyFixtures.js +45 -0
- package/dist/lockstepJournal.js +395 -0
- package/dist/lockstepJournalCodec.js +254 -0
- package/dist/lockstepJournalPorts.js +5 -0
- package/dist/lockstepJournalRebuild.js +208 -0
- package/dist/lockstepJournalRows.js +57 -0
- package/dist/lockstepMembers.js +131 -0
- package/dist/lockstepMessages.js +47 -0
- package/dist/lockstepOwnedRoom.js +764 -0
- package/dist/lockstepPolicies.js +84 -0
- package/dist/lockstepReact.js +47 -0
- package/dist/lockstepRecoveryTruth.js +121 -0
- package/dist/lockstepRosterConfig.js +32 -0
- package/dist/lockstepSeed.js +12 -0
- package/dist/lockstepSeedFixture.js +20 -0
- package/dist/lockstepServer.d.ts +3897 -0
- package/dist/lockstepServer.js +325 -0
- package/dist/lockstepServerConfig.js +101 -0
- package/dist/lockstepServerRoles.js +403 -0
- package/dist/lockstepServerStrategyFixtures.js +33 -0
- package/dist/lockstepStrategies.js +6 -0
- package/dist/lockstepStrategyFixtures.js +137 -0
- package/dist/lockstepTerminal.js +90 -0
- package/dist/lockstepTerminalPorts.js +5 -0
- package/dist/lockstepTransport.js +773 -0
- package/dist/lockstepTransportConfig.js +32 -0
- package/dist/lockstepWireRoster.js +34 -0
- package/dist/matchRoomProvider.js +32 -0
- package/dist/matchRooms.js +19 -0
- package/dist/membershipObserver.js +47 -0
- package/dist/moderation.js +98 -0
- package/dist/movementSpecials.js +104 -0
- package/dist/ownership.js +17 -0
- package/dist/ownershipWithdrawal.js +18 -0
- package/dist/pcg32.js +96 -0
- package/dist/ports.d.ts +1241 -0
- package/dist/ports.js +11 -0
- package/dist/quaternion.js +70 -0
- package/dist/react.d.ts +406 -0
- package/dist/react.js +109 -0
- package/dist/reaper-app/rooms.reaper.workflow.server.tsx +5 -0
- package/dist/reaper-app/rooms.reaper.workflow.tsx +13 -0
- package/dist/reaper.js +243 -0
- package/dist/reaperSchemas.js +42 -0
- package/dist/reaperWorkflow.js +70 -0
- package/dist/recovery.js +189 -0
- package/dist/recoverySeats.js +26 -0
- package/dist/replay.d.ts +273 -0
- package/dist/replay.js +485 -0
- package/dist/replayPorts.js +5 -0
- package/dist/replayRecording.js +67 -0
- package/dist/replaySchema.js +157 -0
- package/dist/replayStorage.d.ts +149 -0
- package/dist/replayStorage.js +485 -0
- package/dist/reservationBatch.js +422 -0
- package/dist/reservationSchemas.js +17 -0
- package/dist/reservations.js +259 -0
- package/dist/reservePort.js +69 -0
- package/dist/resolvedOptions.js +4 -0
- package/dist/room.d.ts +1006 -0
- package/dist/room.js +284 -0
- package/dist/roomAccessSweep.js +95 -0
- package/dist/roomAppCommandControl.js +59 -0
- package/dist/roomAuthoringStrategy.js +17 -0
- package/dist/roomErasure.js +198 -0
- package/dist/roomPoolRuntimeDefaults.js +24 -0
- package/dist/roomPoolSelection.js +19 -0
- package/dist/roomPoolTopology.js +212 -0
- package/dist/rpc.d.ts +551 -0
- package/dist/rpc.js +112 -0
- package/dist/rpcClient.js +152 -0
- package/dist/rpcRoutes.js +28 -0
- package/dist/runtime.js +1123 -0
- package/dist/schemaHistory.js +98 -0
- package/dist/seatStore.js +151 -0
- package/dist/seatStrategyFixtures.js +52 -0
- package/dist/seatSubject.js +32 -0
- package/dist/seats.js +130 -0
- package/dist/serverSession.js +811 -0
- package/dist/serverSessionConfig.js +43 -0
- package/dist/sessionAdmission.js +53 -0
- package/dist/sidecarAdmission.js +103 -0
- package/dist/sidecarConfig.js +116 -0
- package/dist/sidecarConfigPublication.js +64 -0
- package/dist/sidecarHostListener.js +208 -0
- package/dist/sidecarIpc.js +205 -0
- package/dist/sidecarPeer.js +310 -0
- package/dist/sidecarProcessPort.js +28 -0
- package/dist/sidecarRuntime.js +168 -0
- package/dist/sidecarSelection.js +142 -0
- package/dist/sidecarWire.js +178 -0
- package/dist/sidecarWrites.js +163 -0
- package/dist/simulation.d.ts +391 -0
- package/dist/simulation.js +282 -0
- package/dist/simulationAuthoring.js +29 -0
- package/dist/simulationBytes.js +27 -0
- package/dist/simulationConformance.js +305 -0
- package/dist/simulationInputHistoryCapture.js +35 -0
- package/dist/simulationInputHistoryWire.js +193 -0
- package/dist/simulationOptionsWire.js +78 -0
- package/dist/simulationRecoveryWire.js +134 -0
- package/dist/simulationReplay.js +127 -0
- package/dist/simulationSnapshotWire.js +112 -0
- package/dist/simulationState.js +178 -0
- package/dist/snapshotBlob.js +126 -0
- package/dist/snapshotBlobCleanup.js +93 -0
- package/dist/snapshotBlobIndex.js +38 -0
- package/dist/snapshotBudget.js +80 -0
- package/dist/snapshotChain.js +185 -0
- package/dist/snapshotErasure.js +172 -0
- package/dist/snapshotInspection.js +105 -0
- package/dist/snapshotSegmentBlobs.js +58 -0
- package/dist/snapshotUploads.js +166 -0
- package/dist/socketTransport.js +253 -0
- package/dist/spatial.js +104 -0
- package/dist/spectatorPolicy.js +26 -0
- package/dist/spectatorProducer.js +89 -0
- package/dist/startFailureCause.js +4 -0
- package/dist/stateCodec.js +658 -0
- package/dist/strategies.d.ts +210 -0
- package/dist/strategies.js +8 -0
- package/dist/strategiesServer.d.ts +286 -0
- package/dist/strategiesServer.js +11 -0
- package/dist/strategyFixtures.js +182 -0
- package/dist/streamFraming.js +122 -0
- package/dist/streamTransport.js +266 -0
- package/dist/subjectAdmission.js +50 -0
- package/dist/subjectPrivacy.js +281 -0
- package/dist/subjectPrivacyBinding.js +90 -0
- package/dist/systemManifest.js +182 -0
- package/dist/tables.js +159 -0
- package/dist/testHarness.js +89 -0
- package/dist/testing.d.ts +3684 -0
- package/dist/testing.js +221 -0
- package/dist/testingPorts.js +271 -0
- package/dist/testingServer.d.ts +4060 -0
- package/dist/testingServer.js +18 -0
- package/dist/transform.d.ts +692 -0
- package/dist/transform.js +217 -0
- package/dist/transform3d.js +118 -0
- package/dist/transformCollection.js +24 -0
- package/dist/transformCollection3d.js +24 -0
- package/dist/transformCollectionCore.js +156 -0
- package/dist/transformFrames.js +121 -0
- package/dist/transformPrediction3d.js +127 -0
- package/dist/transformRules.js +123 -0
- package/dist/transformSchemas.js +20 -0
- package/dist/transport.js +32 -0
- package/dist/transportAuthoring.js +29 -0
- package/dist/transportCleanup.js +22 -0
- package/dist/transportConformance.js +124 -0
- package/dist/transportConnector.js +82 -0
- package/dist/transportEndpoints.js +38 -0
- package/dist/transportsServer.d.ts +5515 -0
- package/dist/transportsServer.js +6 -0
- package/dist/viewProjection.js +16 -0
- package/dist/web.d.ts +2286 -0
- package/dist/web.js +518 -0
- package/dist/webTransportClient.js +173 -0
- package/dist/wire.d.ts +992 -0
- package/dist/wire.js +492 -0
- package/dist/withdrawalPort.js +28 -0
- package/dist/world.d.ts +1894 -0
- package/dist/world.js +333 -0
- package/dist/worldActorReceipts.js +48 -0
- package/dist/worldActorTransferSnapshot.js +14 -0
- package/dist/worldAdmissionPending.js +8 -0
- package/dist/worldBoundaryCoordinator.js +148 -0
- package/dist/worldCatalog.js +81 -0
- package/dist/worldCellAllocation.js +203 -0
- package/dist/worldCellDestination.js +68 -0
- package/dist/worldCells.js +489 -0
- package/dist/worldChange.js +32 -0
- package/dist/worldClient.js +664 -0
- package/dist/worldClientControl.js +141 -0
- package/dist/worldClientPendingInput.js +16 -0
- package/dist/worldClientRpc.js +133 -0
- package/dist/worldClientRpcRoutes.js +43 -0
- package/dist/worldClientSchemas.js +28 -0
- package/dist/worldCommands.js +140 -0
- package/dist/worldData.js +42 -0
- package/dist/worldDefaultBinding.js +377 -0
- package/dist/worldDefaultGroupAdmission.js +82 -0
- package/dist/worldDefaultGroupAppServices.js +31 -0
- package/dist/worldDefaultGroupCompensation.js +109 -0
- package/dist/worldDefaultGroupContinuation.js +96 -0
- package/dist/worldDefaultGroupControl.js +72 -0
- package/dist/worldDefaultGroupMembers.js +85 -0
- package/dist/worldDefaultGroups.js +21 -0
- package/dist/worldDefaultPending.js +79 -0
- package/dist/worldDefaultService.js +245 -0
- package/dist/worldEntities.js +2980 -0
- package/dist/worldEntityCodec.js +21 -0
- package/dist/worldEntityHandoffView.js +154 -0
- package/dist/worldGeometry.js +170 -0
- package/dist/worldGhostAdmission.js +65 -0
- package/dist/worldGhostDestination.js +118 -0
- package/dist/worldGhostGateway.js +132 -0
- package/dist/worldGhostHandshake.js +108 -0
- package/dist/worldGhostHost.js +42 -0
- package/dist/worldGhostIngress.js +132 -0
- package/dist/worldGhostNeighborhood.js +70 -0
- package/dist/worldGhostNeighbors.js +86 -0
- package/dist/worldGhostOutbound.js +110 -0
- package/dist/worldGhostPublisher.js +216 -0
- package/dist/worldGhostReceiver.js +213 -0
- package/dist/worldGhostSender.js +146 -0
- package/dist/worldGhostSocket.js +78 -0
- package/dist/worldGhostWire.js +172 -0
- package/dist/worldGroupCommand.js +49 -0
- package/dist/worldGroupDeadline.js +115 -0
- package/dist/worldGroupPreparation.js +115 -0
- package/dist/worldGroupReadyControl.js +128 -0
- package/dist/worldGroupSupervisor.js +120 -0
- package/dist/worldHandoffMetrics.js +59 -0
- package/dist/worldHandoffView.js +100 -0
- package/dist/worldHostSource.js +69 -0
- package/dist/worldInspectEndpoint.js +250 -0
- package/dist/worldInspection.js +109 -0
- package/dist/worldInstanceAdmission.js +31 -0
- package/dist/worldInstanceAllocation.js +116 -0
- package/dist/worldInstanceDestination.js +64 -0
- package/dist/worldInstanceExpiry.js +282 -0
- package/dist/worldInstanceExpirySupervisor.js +88 -0
- package/dist/worldInstanceLifecycle.js +103 -0
- package/dist/worldInstanceState.js +52 -0
- package/dist/worldInstances.js +478 -0
- package/dist/worldJoin.js +56 -0
- package/dist/worldLayers.js +151 -0
- package/dist/worldLeases.js +78 -0
- package/dist/worldManifest.js +25 -0
- package/dist/worldMovement.js +63 -0
- package/dist/worldPersistence.js +134 -0
- package/dist/worldProjection.js +221 -0
- package/dist/worldReact.js +110 -0
- package/dist/worldRecoveryActor.js +35 -0
- package/dist/worldReturnAnchor.js +49 -0
- package/dist/worldRoomHooks.js +57 -0
- package/dist/worldRoomPool.js +27 -0
- package/dist/worldRoomSteps.js +133 -0
- package/dist/worldSeatBinding.js +36 -0
- package/dist/worldServer.d.ts +6936 -0
- package/dist/worldServer.js +48 -0
- package/dist/worldSourceSeatPending.js +9 -0
- package/dist/worldStrategyFixtures.js +164 -0
- package/dist/worldTesting.js +27 -0
- package/dist/worldTransitionDefaults.js +198 -0
- package/dist/worldTransitionExecutor.js +519 -0
- package/dist/worldTransitionGroup.js +113 -0
- package/dist/worldTransitionPhysicalSteps.js +40 -0
- package/dist/worldTransitionResolver.js +228 -0
- package/dist/worldTransitionSeatGroup.js +64 -0
- package/dist/worldTransitionSeats.js +260 -0
- package/dist/worldTransitionState.js +95 -0
- package/dist/worldTransitions.js +101 -0
- package/package.json +189 -4
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
import { ProtocolError as e, RoomAuthoringError as t } from "./errors.js";
|
|
2
|
+
import { RoomFieldId as n, RoomNonAuthoritative as r, RoomPrecision as i, RoomQuantization as a, RoomTransform as o, dequantize as s, quantizationStep as c, quantize as l } from "./room.js";
|
|
3
|
+
import { captureTransformRules as u } from "./transformRules.js";
|
|
4
|
+
import { decodeQuaternionSmallestThree as d, encodeQuaternionSmallestThree as f, quaternionByteLength as p } from "./quaternion.js";
|
|
5
|
+
import { shapeDigest as m } from "@voltro/protocol";
|
|
6
|
+
import { Result as h, Schema as g } from "effect";
|
|
7
|
+
//#region src/stateCodec.ts
|
|
8
|
+
function _(t) {
|
|
9
|
+
throw new e({ detail: t });
|
|
10
|
+
}
|
|
11
|
+
function v(e) {
|
|
12
|
+
throw new t({
|
|
13
|
+
room: "state-codec",
|
|
14
|
+
detail: e
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
var y = (e) => typeof e == "object" && e && !Array.isArray(e) ? e : _("Expected a state object"), b = class {
|
|
18
|
+
limit;
|
|
19
|
+
input;
|
|
20
|
+
output = [];
|
|
21
|
+
at = 0;
|
|
22
|
+
constructor(e, t) {
|
|
23
|
+
this.limit = e, this.input = t;
|
|
24
|
+
}
|
|
25
|
+
byte(e) {
|
|
26
|
+
if (e !== void 0) return (!Number.isInteger(e) || e < 0 || e > 255 || this.output.length >= this.limit) && _("Invalid byte or state byte budget exceeded"), this.output.push(e), e;
|
|
27
|
+
let t = this.input?.[this.at++];
|
|
28
|
+
return t === void 0 ? _("Truncated state") : t;
|
|
29
|
+
}
|
|
30
|
+
writeUint(e) {
|
|
31
|
+
e < 0n && _("Negative unsigned integer");
|
|
32
|
+
do {
|
|
33
|
+
let t = Number(e & 127n);
|
|
34
|
+
e >>= 7n, this.byte(t | (e > 0n ? 128 : 0));
|
|
35
|
+
} while (e > 0n);
|
|
36
|
+
}
|
|
37
|
+
readUint(e = 53) {
|
|
38
|
+
let t = 0n;
|
|
39
|
+
for (let n = 0; n < Math.ceil(e / 7); n++) {
|
|
40
|
+
let r = this.byte(), i = r & 127;
|
|
41
|
+
if (t |= BigInt(i) << BigInt(n * 7), r < 128) return (n > 0 && i === 0 || t >= 1n << BigInt(e)) && _("Noncanonical or overflowing integer"), t;
|
|
42
|
+
}
|
|
43
|
+
return _("Integer exceeds its bit budget");
|
|
44
|
+
}
|
|
45
|
+
writeCount(e) {
|
|
46
|
+
(!Number.isSafeInteger(e) || e < 0) && _("Invalid count"), this.writeUint(BigInt(e));
|
|
47
|
+
}
|
|
48
|
+
count(e) {
|
|
49
|
+
let t = Number(this.readUint());
|
|
50
|
+
return t <= e ? t : _("Collection exceeds its budget");
|
|
51
|
+
}
|
|
52
|
+
string(e) {
|
|
53
|
+
if (e !== void 0) {
|
|
54
|
+
e.isWellFormed() || _("Invalid Unicode string"), e.length > this.limit && _("String exceeds its byte budget");
|
|
55
|
+
let t = new TextEncoder().encode(e);
|
|
56
|
+
this.writeCount(t.length);
|
|
57
|
+
for (let e of t) this.byte(e);
|
|
58
|
+
return e;
|
|
59
|
+
}
|
|
60
|
+
let t = this.count(this.limit);
|
|
61
|
+
(!this.input || t > this.input.length - this.at) && _("Truncated string");
|
|
62
|
+
let n = new Uint8Array(t);
|
|
63
|
+
for (let e = 0; e < t; e++) n[e] = this.byte();
|
|
64
|
+
return new TextDecoder("utf-8", { fatal: !0 }).decode(n);
|
|
65
|
+
}
|
|
66
|
+
float(e, t = "f32") {
|
|
67
|
+
let n = new Uint8Array(t === "f32" ? 4 : 8), r = new DataView(n.buffer);
|
|
68
|
+
if (e !== void 0) {
|
|
69
|
+
t === "f32" ? r.setFloat32(0, e, !0) : r.setFloat64(0, e, !0), Number.isFinite(t === "f32" ? r.getFloat32(0, !0) : r.getFloat64(0, !0)) || _("Number exceeds its finite precision range");
|
|
70
|
+
for (let e of n) this.byte(e);
|
|
71
|
+
return e;
|
|
72
|
+
}
|
|
73
|
+
for (let e = 0; e < n.length; e++) n[e] = this.byte();
|
|
74
|
+
let i = t === "f32" ? r.getFloat32(0, !0) : r.getFloat64(0, !0);
|
|
75
|
+
return Number.isFinite(i) ? i : _("Nonfinite state number");
|
|
76
|
+
}
|
|
77
|
+
end() {
|
|
78
|
+
this.input && this.at !== this.input.length && _("Trailing state bytes");
|
|
79
|
+
}
|
|
80
|
+
}, x = (e, t) => {
|
|
81
|
+
for (let n = (e?.length ?? 0) - 1; n >= 0; n--) {
|
|
82
|
+
let r = e[n], i = r.annotations === void 0 ? void 0 : Reflect.get(r.annotations, t);
|
|
83
|
+
if (i !== void 0) return i;
|
|
84
|
+
if (r._tag === "FilterGroup") {
|
|
85
|
+
let e = x(r.checks, t);
|
|
86
|
+
if (e !== void 0) return e;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, S = (e, t) => {
|
|
90
|
+
let n = x(e.checks, t);
|
|
91
|
+
if (n !== void 0) return n;
|
|
92
|
+
let r = e.annotations === void 0 ? void 0 : Reflect.get(e.annotations, t);
|
|
93
|
+
if (r !== void 0) return r;
|
|
94
|
+
if (e._tag === "Union") {
|
|
95
|
+
let n = e.types.map((e) => S(e, t)).filter((e) => e !== void 0);
|
|
96
|
+
if (n.length === 1) return n[0];
|
|
97
|
+
}
|
|
98
|
+
}, C = (e) => typeof e == "bigint" ? v("BigInt state literals require a declared integer representation") : e, w = (e) => e?.some((e) => e.annotations?.representation?.id === "effect/schema/isInt" || e._tag === "FilterGroup" && w(e.checks)) ?? !1, T = (e, t = 0) => {
|
|
99
|
+
t > 64 && v("State schema nesting exceeds its compile budget");
|
|
100
|
+
let n = [];
|
|
101
|
+
for (let r of e) {
|
|
102
|
+
if (r.encoding !== void 0) return;
|
|
103
|
+
if (r._tag === "Literal") n.push(C(r.literal));
|
|
104
|
+
else if (r._tag === "Null") n.push(null);
|
|
105
|
+
else if (r._tag === "Union") {
|
|
106
|
+
let e = T(r.types, t + 1);
|
|
107
|
+
if (e === void 0) return;
|
|
108
|
+
n.push(...e);
|
|
109
|
+
} else return;
|
|
110
|
+
if (n.length > 256) return;
|
|
111
|
+
}
|
|
112
|
+
return n;
|
|
113
|
+
}, E = (e, t, s = 0, l = !1, d, f = "f32", p = !0, m, h = "f32") => {
|
|
114
|
+
s > 64 && v("State schema nesting exceeds its compile budget"), d = S(e, a) ?? d;
|
|
115
|
+
let _ = S(e, i), y = S(e, o) ?? m;
|
|
116
|
+
if (y !== void 0 && !p && v("Transform metadata belongs to authoritative state, not input intentions"), _ !== void 0 && (_ !== "f32" && _ !== "f64" && v("Number precision must be f32 or f64"), f = _), e.encoding !== void 0 && v("Transformed state/input schemas require an explicit supported binary representation"), y !== void 0 && e._tag !== "Objects" && e._tag !== "Union" && v("Transform metadata requires a declared movement struct"), e._tag === "Number") return d && c(d), {
|
|
117
|
+
kind: "number",
|
|
118
|
+
integer: l || w(e.checks),
|
|
119
|
+
precision: f,
|
|
120
|
+
q: d ? Object.freeze({ ...d }) : void 0
|
|
121
|
+
};
|
|
122
|
+
if (e._tag === "String") return { kind: "string" };
|
|
123
|
+
if (e._tag === "Boolean") return { kind: "boolean" };
|
|
124
|
+
if (e._tag === "Null") return {
|
|
125
|
+
kind: "literal",
|
|
126
|
+
values: [null]
|
|
127
|
+
};
|
|
128
|
+
if (e._tag === "Literal") return {
|
|
129
|
+
kind: "literal",
|
|
130
|
+
values: [C(e.literal)]
|
|
131
|
+
};
|
|
132
|
+
if (e._tag === "Union") {
|
|
133
|
+
let n = e.types.filter((e) => e._tag !== "Undefined");
|
|
134
|
+
if (n.length === 1 && n[0]) return E(n[0], t, s + 1, l, d, f, p, y, h);
|
|
135
|
+
y !== void 0 && v("Transform metadata cannot annotate state variants");
|
|
136
|
+
let r = T(n);
|
|
137
|
+
return r !== void 0 && r.length > 0 ? {
|
|
138
|
+
kind: "literal",
|
|
139
|
+
values: r
|
|
140
|
+
} : !p && n.length > 0 && n.length <= 256 ? {
|
|
141
|
+
kind: "union",
|
|
142
|
+
variants: n.map((e) => ({
|
|
143
|
+
node: E(e, t, s + 1, !1, void 0, h, !1, void 0, h),
|
|
144
|
+
matches: g.is(g.make(e))
|
|
145
|
+
}))
|
|
146
|
+
} : v("State unions must be literal enums; input unions are separate from state");
|
|
147
|
+
}
|
|
148
|
+
if (e._tag === "Arrays" && e.elements.length === 0 && e.rest.length === 1 && e.rest[0]) return {
|
|
149
|
+
kind: "array",
|
|
150
|
+
element: E(e.rest[0], t, s + 1, !1, void 0, h, p, void 0, h)
|
|
151
|
+
};
|
|
152
|
+
if (e._tag === "Objects") {
|
|
153
|
+
let a = y === void 0 ? void 0 : u(y), o = a?.bounds.min.length === 2 ? a : void 0, c = a?.bounds.min.length === 3 ? a : void 0;
|
|
154
|
+
if (o && (e.indexSignatures.length !== 0 || e.propertySignatures.some((e) => typeof e.name != "string" || ![
|
|
155
|
+
"x",
|
|
156
|
+
"y",
|
|
157
|
+
"rot",
|
|
158
|
+
"vx",
|
|
159
|
+
"vy"
|
|
160
|
+
].includes(e.name) || ["vx", "vy"].includes(e.name) && !(e.type.context?.isOptional ?? !1)) || [
|
|
161
|
+
"x",
|
|
162
|
+
"y",
|
|
163
|
+
"rot"
|
|
164
|
+
].some((t) => e.propertySignatures.filter((e) => e.name === t && !(e.type.context?.isOptional ?? !1)).length !== 1)) && v("Transform metadata requires x/y/rot and only optional vx/vy in a 2D struct"), c && (e.indexSignatures.length !== 0 || e.propertySignatures.length !== 7 || e.propertySignatures.some((e) => typeof e.name != "string" || (e.type.context?.isOptional ?? !1) || ![
|
|
165
|
+
"x",
|
|
166
|
+
"y",
|
|
167
|
+
"z",
|
|
168
|
+
"qx",
|
|
169
|
+
"qy",
|
|
170
|
+
"qz",
|
|
171
|
+
"qw"
|
|
172
|
+
].includes(e.name)) || [
|
|
173
|
+
"x",
|
|
174
|
+
"y",
|
|
175
|
+
"z",
|
|
176
|
+
"qx",
|
|
177
|
+
"qy",
|
|
178
|
+
"qz",
|
|
179
|
+
"qw"
|
|
180
|
+
].some((t) => e.propertySignatures.filter((e) => e.name === t).length !== 1)) && v("3D transform metadata requires exactly x/y/z/qx/qy/qz/qw"), e.propertySignatures.length === 0 && e.indexSignatures.length === 1 && e.indexSignatures[0]) {
|
|
181
|
+
let n = e.indexSignatures[0];
|
|
182
|
+
return n.parameter._tag !== "String" && v("State records require string keys"), {
|
|
183
|
+
kind: "record",
|
|
184
|
+
element: E(n.type, t, s + 1, !1, void 0, h, p, void 0, h)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
e.indexSignatures.length !== 0 && v("Mixed record/struct state schemas are not allowed");
|
|
188
|
+
let l = /* @__PURE__ */ new Set(), d = (p ? e.propertySignatures : [...e.propertySignatures].sort((e, t) => String(e.name) < String(t.name) ? -1 : +(String(e.name) > String(t.name)))).map((e, a) => {
|
|
189
|
+
let u = (e.type.context?.annotations === void 0 ? void 0 : Reflect.get(e.type.context.annotations, n)) ?? S(e.type, n) ?? (p ? void 0 : a + 1);
|
|
190
|
+
if (typeof e.name != "string" || typeof u != "number" || !Number.isSafeInteger(u) || u < 1 || u > t.maxFieldId || l.has(u)) return v("Every struct field needs a unique fieldId within its configured budget");
|
|
191
|
+
l.add(u);
|
|
192
|
+
let d = E(e.type, t, s + 1, !1, void 0, h, p, void 0, h);
|
|
193
|
+
if (o) {
|
|
194
|
+
if ((d.kind !== "number" || d.integer || d.q || S(e.type, i) !== void 0) && v("Transform components must be ordinary numbers without competing encoding annotations"), e.name === "x" || e.name === "y") {
|
|
195
|
+
let t = e.name === "x" ? 0 : 1;
|
|
196
|
+
d = {
|
|
197
|
+
...d,
|
|
198
|
+
q: Object.freeze({
|
|
199
|
+
min: o.bounds.min[t],
|
|
200
|
+
max: o.bounds.max[t],
|
|
201
|
+
step: o.precision
|
|
202
|
+
})
|
|
203
|
+
};
|
|
204
|
+
} else if (e.name === "rot") {
|
|
205
|
+
let e = 2 ** (o.rotation?.bits ?? 9), t = 360 / e;
|
|
206
|
+
d = {
|
|
207
|
+
...d,
|
|
208
|
+
q: Object.freeze({
|
|
209
|
+
min: 0,
|
|
210
|
+
max: 360 - t,
|
|
211
|
+
step: t
|
|
212
|
+
}),
|
|
213
|
+
wrap: e
|
|
214
|
+
};
|
|
215
|
+
} else o.velocity === "send" && (d = {
|
|
216
|
+
...d,
|
|
217
|
+
q: Object.freeze({
|
|
218
|
+
min: -o.maxSpeed,
|
|
219
|
+
max: o.maxSpeed,
|
|
220
|
+
step: o.maxSpeed * 2 / 255
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (c && ((d.kind !== "number" || d.integer || d.q || S(e.type, i) !== void 0) && v("3D transform components must be ordinary numbers without competing encoding annotations"), e.name === "x" || e.name === "y" || e.name === "z")) {
|
|
225
|
+
let t = e.name === "x" ? 0 : e.name === "y" ? 1 : 2;
|
|
226
|
+
d = {
|
|
227
|
+
...d,
|
|
228
|
+
q: Object.freeze({
|
|
229
|
+
min: c.bounds.min[t],
|
|
230
|
+
max: c.bounds.max[t],
|
|
231
|
+
step: c.precision
|
|
232
|
+
})
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
let f = o && (e.name === "vx" || e.name === "vy") && (o.velocity === "derive" || o.velocity === "none");
|
|
236
|
+
return {
|
|
237
|
+
name: e.name,
|
|
238
|
+
id: u,
|
|
239
|
+
optional: e.type.context?.isOptional ?? !1,
|
|
240
|
+
node: d,
|
|
241
|
+
...f ? { omit: !0 } : {},
|
|
242
|
+
...(e.type.context?.annotations === void 0 ? void 0 : Reflect.get(e.type.context.annotations, r)) === !0 || S(e.type, r) === !0 ? { nonAuthoritative: !0 } : {}
|
|
243
|
+
};
|
|
244
|
+
}).sort((e, t) => e.id - t.id);
|
|
245
|
+
return c ? {
|
|
246
|
+
kind: "transform3d",
|
|
247
|
+
fields: d,
|
|
248
|
+
transform: c
|
|
249
|
+
} : {
|
|
250
|
+
kind: "struct",
|
|
251
|
+
fields: d,
|
|
252
|
+
...o ? { transform: o } : {}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
return v(`State schema node ${e._tag} has no binary state representation`);
|
|
256
|
+
}, D = (e, t, n = !0) => E(e.ast, t, 0, !1, void 0, "f32", n), O = (e, t) => {
|
|
257
|
+
if (typeof t != "number" || !Number.isFinite(t)) return _("Expected a finite number");
|
|
258
|
+
if (e.q) return e.wrap === void 0 ? l(t, e.q) : Math.round((t % 360 + 360) % 360 / c(e.q)) % e.wrap;
|
|
259
|
+
if (e.integer) return Number.isSafeInteger(t) ? t : _("Expected a safe integer");
|
|
260
|
+
let n = e.precision === "f64" ? t : Math.fround(t);
|
|
261
|
+
return Number.isFinite(n) ? n : _("Number exceeds finite f32 range");
|
|
262
|
+
}, k = (e) => 1n << BigInt(e - 1), A = (e, t) => Array.isArray(e) && e.length <= t.maxCollectionLength ? e : _("Array exceeds its budget or has an invalid shape"), j = (e) => ({
|
|
263
|
+
kind: "struct",
|
|
264
|
+
fields: e.fields.filter((e) => [
|
|
265
|
+
"x",
|
|
266
|
+
"y",
|
|
267
|
+
"z"
|
|
268
|
+
].includes(e.name))
|
|
269
|
+
}), M = (e, t) => {
|
|
270
|
+
let n = y(t), r = f({
|
|
271
|
+
qx: n.qx,
|
|
272
|
+
qy: n.qy,
|
|
273
|
+
qz: n.qz,
|
|
274
|
+
qw: n.qw
|
|
275
|
+
}, e.transform.rotation?.bits ?? 10);
|
|
276
|
+
if (h.isFailure(r)) throw r.failure;
|
|
277
|
+
return r.success;
|
|
278
|
+
}, N = (e, t, n) => {
|
|
279
|
+
let r = M(e, t), i = M(e, n);
|
|
280
|
+
return r.length === i.length && r.every((e, t) => e === i[t]);
|
|
281
|
+
}, P = (e, t) => {
|
|
282
|
+
let n = e.transform.rotation?.bits ?? 10, r = new Uint8Array(p(n));
|
|
283
|
+
for (let e = 0; e < r.length; e++) r[e] = t.byte();
|
|
284
|
+
let i = d(r, n);
|
|
285
|
+
if (h.isFailure(i)) throw i.failure;
|
|
286
|
+
return i.success;
|
|
287
|
+
}, F = (e, t, n, r) => {
|
|
288
|
+
switch (e.kind) {
|
|
289
|
+
case "transform3d":
|
|
290
|
+
F(j(e), t, n, r);
|
|
291
|
+
for (let r of M(e, t)) n.byte(r);
|
|
292
|
+
return;
|
|
293
|
+
case "union": {
|
|
294
|
+
let i = e.variants.findIndex((e) => e.matches(t)), a = e.variants[i];
|
|
295
|
+
a || _("Input matches no declared union variant"), n.byte(i), F(a.node, t, n, r);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
case "number": {
|
|
299
|
+
let r = O(e, t);
|
|
300
|
+
if (e.q) n.writeCount(r);
|
|
301
|
+
else if (e.integer) {
|
|
302
|
+
let e = BigInt(r);
|
|
303
|
+
n.writeUint(e < 0n ? -e * 2n - 1n : e * 2n);
|
|
304
|
+
} else n.float(r, e.precision);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
case "string":
|
|
308
|
+
typeof t != "string" && _("Expected a string"), n.string(t);
|
|
309
|
+
return;
|
|
310
|
+
case "boolean":
|
|
311
|
+
typeof t != "boolean" && _("Expected a boolean"), n.byte(+!!t);
|
|
312
|
+
return;
|
|
313
|
+
case "literal": {
|
|
314
|
+
let r = e.values.indexOf(t);
|
|
315
|
+
r < 0 && _("Unknown literal"), n.byte(r);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
case "array": {
|
|
319
|
+
let i = A(t, r);
|
|
320
|
+
n.writeCount(i.length);
|
|
321
|
+
for (let t of i) F(e.element, t, n, r);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
case "record": {
|
|
325
|
+
let i = y(t), a = Object.keys(i).sort();
|
|
326
|
+
a.length > r.maxCollectionLength && _("Record exceeds its budget"), n.writeCount(a.length);
|
|
327
|
+
for (let t of a) n.string(t), F(e.element, i[t], n, r);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
case "struct": {
|
|
331
|
+
let i = y(t), a = e.fields.filter((e) => e.node.kind === "boolean");
|
|
332
|
+
a.length && n.writeUint(a.reduce((e, t, n) => i[t.name] === !0 ? e | k(n + 1) : e, 0n));
|
|
333
|
+
for (let t of e.fields) {
|
|
334
|
+
if (t.omit) continue;
|
|
335
|
+
let e = i[t.name];
|
|
336
|
+
t.optional && n.byte(e === void 0 ? 0 : 1), t.node.kind !== "boolean" && (e !== void 0 || !t.optional) && F(t.node, e, n, r);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}, I = (e, t, n) => {
|
|
341
|
+
Object.defineProperty(e, t, {
|
|
342
|
+
value: n,
|
|
343
|
+
writable: !0,
|
|
344
|
+
enumerable: !0,
|
|
345
|
+
configurable: !0
|
|
346
|
+
});
|
|
347
|
+
}, L = (e, t, n) => {
|
|
348
|
+
switch (e.kind) {
|
|
349
|
+
case "transform3d": return Object.assign(y(L(j(e), t, n)), P(e, t));
|
|
350
|
+
case "union": {
|
|
351
|
+
let r = e.variants[t.byte()];
|
|
352
|
+
return r ? L(r.node, t, n) : _("Invalid input union variant");
|
|
353
|
+
}
|
|
354
|
+
case "number": {
|
|
355
|
+
if (e.q) return s(Number(t.readUint()), e.q);
|
|
356
|
+
if (!e.integer) return t.float(void 0, e.precision);
|
|
357
|
+
let n = t.readUint(54), r = n & 1n ? -(n + 1n) / 2n : n / 2n, i = Number(r);
|
|
358
|
+
return Number.isSafeInteger(i) ? i : _("Integer exceeds safe precision");
|
|
359
|
+
}
|
|
360
|
+
case "string": return t.string();
|
|
361
|
+
case "boolean": {
|
|
362
|
+
let e = t.byte();
|
|
363
|
+
return e < 2 ? e === 1 : _("Invalid boolean");
|
|
364
|
+
}
|
|
365
|
+
case "literal": {
|
|
366
|
+
let n = t.byte();
|
|
367
|
+
return n < e.values.length ? e.values[n] : _("Invalid literal index");
|
|
368
|
+
}
|
|
369
|
+
case "array": {
|
|
370
|
+
let r = t.count(n.maxCollectionLength), i = [];
|
|
371
|
+
for (let a = 0; a < r; a++) i.push(L(e.element, t, n));
|
|
372
|
+
return i;
|
|
373
|
+
}
|
|
374
|
+
case "record": {
|
|
375
|
+
let r = {}, i = t.count(n.maxCollectionLength);
|
|
376
|
+
for (let a = 0; a < i; a++) {
|
|
377
|
+
let i = t.string();
|
|
378
|
+
Object.hasOwn(r, i) && _("Duplicate record key"), I(r, i, L(e.element, t, n));
|
|
379
|
+
}
|
|
380
|
+
return r;
|
|
381
|
+
}
|
|
382
|
+
case "struct": {
|
|
383
|
+
let r = {}, i = e.fields.filter((e) => e.node.kind === "boolean"), a = i.length ? t.readUint(i.length) : 0n;
|
|
384
|
+
for (let o of e.fields) if (!o.omit) {
|
|
385
|
+
if (o.optional) {
|
|
386
|
+
let e = t.byte();
|
|
387
|
+
if (e > 1 && _("Invalid optional presence"), !e) continue;
|
|
388
|
+
}
|
|
389
|
+
I(r, o.name, o.node.kind === "boolean" ? (a & k(i.indexOf(o) + 1)) !== 0n : L(o.node, t, n));
|
|
390
|
+
}
|
|
391
|
+
return r;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}, R = (e, t, n, r) => {
|
|
395
|
+
if (t === void 0 || n === void 0) return t === n;
|
|
396
|
+
if (e.kind === "number") return O(e, t) === O(e, n);
|
|
397
|
+
if (e.kind === "transform3d") return R(j(e), t, n, r) && N(e, t, n);
|
|
398
|
+
if (e.kind === "struct") return e.fields.every((e) => e.omit || R(e.node, y(t)[e.name], y(n)[e.name], r));
|
|
399
|
+
if (e.kind === "record") {
|
|
400
|
+
let i = y(t), a = y(n), o = Object.keys(i);
|
|
401
|
+
return o.length === Object.keys(a).length && o.every((t) => Object.hasOwn(a, t) && R(e.element, i[t], a[t], r));
|
|
402
|
+
}
|
|
403
|
+
if (e.kind === "array") {
|
|
404
|
+
let i = A(t, r), a = A(n, r);
|
|
405
|
+
return i.length === a.length && i.every((t, n) => R(e.element, t, a[n], r));
|
|
406
|
+
}
|
|
407
|
+
return t === n;
|
|
408
|
+
}, z = (e, t, n, r, i) => {
|
|
409
|
+
if (e.kind === "transform3d") {
|
|
410
|
+
z(j(e), t, n, r, i);
|
|
411
|
+
let a = !N(e, t, n);
|
|
412
|
+
if (r.byte(+!!a), a) for (let n of M(e, t)) r.byte(n);
|
|
413
|
+
} else if (e.kind === "number" && (e.q || e.integer)) {
|
|
414
|
+
let i = BigInt(O(e, t)) - BigInt(O(e, n));
|
|
415
|
+
if (e.wrap !== void 0) {
|
|
416
|
+
let t = BigInt(e.wrap), n = t / 2n;
|
|
417
|
+
i = ((i + n) % t + t) % t - n;
|
|
418
|
+
}
|
|
419
|
+
r.writeUint(i < 0n ? -i * 2n - 1n : i * 2n);
|
|
420
|
+
} else if (e.kind === "array") {
|
|
421
|
+
let a = A(t, i), o = A(n, i);
|
|
422
|
+
if (a.length === 0) {
|
|
423
|
+
r.writeCount(1), r.byte(3);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
let s = Math.min(a.length, o.length), c = [];
|
|
427
|
+
for (let t = 0; t < s; t++) R(e.element, a[t], o[t], i) || c.push(t);
|
|
428
|
+
r.writeCount(c.length + Math.abs(a.length - o.length));
|
|
429
|
+
for (let t of c) r.byte(0), r.writeCount(t), F(e.element, a[t], r, i);
|
|
430
|
+
for (let e = o.length - 1; e >= a.length; e--) r.byte(2), r.writeCount(e);
|
|
431
|
+
for (let t = o.length; t < a.length; t++) r.byte(1), F(e.element, a[t], r, i);
|
|
432
|
+
} else if (e.kind === "struct") {
|
|
433
|
+
let a = y(t), o = y(n), s = e.fields.filter((e) => !e.omit && !R(e.node, a[e.name], o[e.name], i));
|
|
434
|
+
r.writeUint(s.reduce((e, t) => e | k(t.id), 0n));
|
|
435
|
+
let c = s.filter((e) => e.node.kind === "boolean");
|
|
436
|
+
c.length && r.writeUint(c.reduce((e, t, n) => a[t.name] === !0 ? e | k(n + 1) : e, 0n));
|
|
437
|
+
for (let e of s) {
|
|
438
|
+
let t = a[e.name], n = o[e.name];
|
|
439
|
+
e.optional && t === void 0 ? r.byte(0) : (r.byte(n === void 0 ? 1 : 2), e.node.kind !== "boolean" && (n === void 0 ? F(e.node, t, r, i) : z(e.node, t, n, r, i)));
|
|
440
|
+
}
|
|
441
|
+
} else if (e.kind === "record") {
|
|
442
|
+
let a = y(t), o = y(n), s = Object.keys(o).filter((e) => !Object.hasOwn(a, e)).sort(), c = Object.keys(a).filter((t) => !Object.hasOwn(o, t) || !R(e.element, a[t], o[t], i)).sort();
|
|
443
|
+
r.writeCount(s.length + c.length);
|
|
444
|
+
for (let e of s) r.byte(2), r.string(e);
|
|
445
|
+
for (let t of c) {
|
|
446
|
+
let n = Object.hasOwn(o, t);
|
|
447
|
+
r.byte(+!!n), r.string(t), n ? z(e.element, a[t], o[t], r, i) : F(e.element, a[t], r, i);
|
|
448
|
+
}
|
|
449
|
+
} else F(e, t, r, i);
|
|
450
|
+
}, B = (e, t, n, r) => {
|
|
451
|
+
if (e.kind === "transform3d") {
|
|
452
|
+
let i = y(B(j(e), t, n, r)), a = n.byte();
|
|
453
|
+
return a > 1 && _("Invalid 3D quaternion delta flag"), a ? Object.assign(i, P(e, n)) : i;
|
|
454
|
+
}
|
|
455
|
+
if (e.kind === "number" && (e.q || e.integer)) {
|
|
456
|
+
let r = n.readUint(55), i = r & 1n ? -(r + 1n) / 2n : r / 2n, a = BigInt(O(e, t)) + i;
|
|
457
|
+
if (e.wrap !== void 0) {
|
|
458
|
+
let t = BigInt(e.wrap), n = t / 2n;
|
|
459
|
+
(i < -n || i >= n) && _("Noncanonical wrapped rotation delta"), a = (a % t + t) % t;
|
|
460
|
+
}
|
|
461
|
+
let o = Number(a);
|
|
462
|
+
return Number.isSafeInteger(o) || _("Numeric delta exceeds safe precision"), e.q ? s(o, e.q) : o;
|
|
463
|
+
}
|
|
464
|
+
if (e.kind === "array") {
|
|
465
|
+
let i = [...A(t, r)], a = n.count(r.maxCollectionLength * 2);
|
|
466
|
+
for (let t = 0; t < a; t++) {
|
|
467
|
+
let t = n.byte();
|
|
468
|
+
if (t === 0) {
|
|
469
|
+
let t = n.count(r.maxCollectionLength);
|
|
470
|
+
t >= i.length && _("Array set index is absent"), i[t] = L(e.element, n, r);
|
|
471
|
+
} else if (t === 1) i.length >= r.maxCollectionLength && _("Array exceeds its budget"), i.push(L(e.element, n, r));
|
|
472
|
+
else if (t === 2) {
|
|
473
|
+
let e = n.count(r.maxCollectionLength);
|
|
474
|
+
e >= i.length && _("Array remove index is absent"), i.splice(e, 1);
|
|
475
|
+
} else t === 3 && a === 1 ? i.length = 0 : _("Invalid array delta operation");
|
|
476
|
+
}
|
|
477
|
+
return i;
|
|
478
|
+
}
|
|
479
|
+
if (e.kind === "struct") {
|
|
480
|
+
let i = { ...y(t) }, a = n.readUint(r.maxFieldId);
|
|
481
|
+
(a & ~e.fields.reduce((e, t) => t.omit ? e : e | k(t.id), 0n)) !== 0n && _("Delta refers to an undeclared field");
|
|
482
|
+
let o = e.fields.filter((e) => e.node.kind === "boolean" && (a & k(e.id)) !== 0n), s = o.length ? n.readUint(o.length) : 0n;
|
|
483
|
+
for (let t of e.fields) {
|
|
484
|
+
if (t.omit) {
|
|
485
|
+
delete i[t.name];
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
if ((a & k(t.id)) === 0n) continue;
|
|
489
|
+
let e = n.byte();
|
|
490
|
+
e === 0 && t.optional ? delete i[t.name] : (e === 1 || e === 2) && t.node.kind === "boolean" && (e === 1 || i[t.name] !== void 0) ? Object.defineProperty(i, t.name, {
|
|
491
|
+
value: (s & k(o.indexOf(t) + 1)) !== 0n,
|
|
492
|
+
writable: !0,
|
|
493
|
+
enumerable: !0,
|
|
494
|
+
configurable: !0
|
|
495
|
+
}) : e === 1 ? Object.defineProperty(i, t.name, {
|
|
496
|
+
value: L(t.node, n, r),
|
|
497
|
+
writable: !0,
|
|
498
|
+
enumerable: !0,
|
|
499
|
+
configurable: !0
|
|
500
|
+
}) : e === 2 && i[t.name] !== void 0 ? Object.defineProperty(i, t.name, {
|
|
501
|
+
value: B(t.node, i[t.name], n, r),
|
|
502
|
+
writable: !0,
|
|
503
|
+
enumerable: !0,
|
|
504
|
+
configurable: !0
|
|
505
|
+
}) : _("Invalid field delta mode");
|
|
506
|
+
}
|
|
507
|
+
return i;
|
|
508
|
+
}
|
|
509
|
+
if (e.kind === "record") {
|
|
510
|
+
let i = {}, a = n.count(r.maxCollectionLength * 2);
|
|
511
|
+
for (let [e, n] of Object.entries(y(t))) I(i, e, n);
|
|
512
|
+
let o = /* @__PURE__ */ new Set();
|
|
513
|
+
for (let t = 0; t < a; t++) {
|
|
514
|
+
let t = n.byte(), a = n.string();
|
|
515
|
+
o.has(a) && _("Repeated record delta key"), o.add(a), t === 0 && !Object.hasOwn(i, a) ? I(i, a, L(e.element, n, r)) : t === 1 && Object.hasOwn(i, a) ? I(i, a, B(e.element, i[a], n, r)) : t === 2 && Object.hasOwn(i, a) ? delete i[a] : _("Invalid record operation"), Object.keys(i).length > r.maxCollectionLength && _("Record exceeds its budget");
|
|
516
|
+
}
|
|
517
|
+
return i;
|
|
518
|
+
}
|
|
519
|
+
return L(e, n, r);
|
|
520
|
+
}, V = class {
|
|
521
|
+
schema;
|
|
522
|
+
schemaHash;
|
|
523
|
+
limits;
|
|
524
|
+
node;
|
|
525
|
+
constructor(e, t = {}, n = !0, r = "f32") {
|
|
526
|
+
this.schema = e, r !== "f32" && r !== "f64" && v("Invalid codec default number precision");
|
|
527
|
+
let i = t.maxBytes ?? 1048576;
|
|
528
|
+
this.limits = Object.freeze({
|
|
529
|
+
maxBytes: i,
|
|
530
|
+
maxCollectionLength: 16384,
|
|
531
|
+
maxFieldId: Number.isSafeInteger(i) && i > 0 ? Math.min(4096, i * 7) : 4096,
|
|
532
|
+
...t
|
|
533
|
+
});
|
|
534
|
+
for (let e of Object.values(this.limits)) (!Number.isSafeInteger(e) || e < 1) && v("Codec limits must be positive safe integers");
|
|
535
|
+
this.limits.maxFieldId > this.limits.maxBytes * 7 && v("Field-ID masks exceed the configured byte budget"), this.node = E(e.ast, this.limits, 0, !1, void 0, r, n, void 0, r), this.schemaHash = Number.parseInt(m(JSON.stringify(this.node)), 16);
|
|
536
|
+
}
|
|
537
|
+
fieldManifest() {
|
|
538
|
+
let e = [], t = (n, r) => {
|
|
539
|
+
if (n.kind === "struct" || n.kind === "transform3d") for (let i of n.fields) e.push(Object.freeze({
|
|
540
|
+
scope: r,
|
|
541
|
+
id: i.id,
|
|
542
|
+
name: i.name
|
|
543
|
+
})), t(i.node, `${r}/${i.id}`);
|
|
544
|
+
else n.kind === "array" ? t(n.element, `${r}/array`) : n.kind === "record" ? t(n.element, `${r}/record`) : n.kind === "union" && n.variants.forEach((e, n) => t(e.node, `${r}/variant/${n}`));
|
|
545
|
+
};
|
|
546
|
+
return t(this.node, "root"), Object.freeze(e);
|
|
547
|
+
}
|
|
548
|
+
description() {
|
|
549
|
+
return JSON.stringify(this.node);
|
|
550
|
+
}
|
|
551
|
+
transformRulesManifest() {
|
|
552
|
+
let e = [], t = (n, r) => {
|
|
553
|
+
if (n.kind === "struct" || n.kind === "transform3d") {
|
|
554
|
+
n.transform && e.push(Object.freeze({
|
|
555
|
+
scope: r,
|
|
556
|
+
rules: u(n.transform)
|
|
557
|
+
}));
|
|
558
|
+
for (let e of n.fields) t(e.node, `${r}/${e.id}`);
|
|
559
|
+
} else n.kind === "array" ? t(n.element, `${r}/array`) : n.kind === "record" ? t(n.element, `${r}/record`) : n.kind === "union" && n.variants.forEach((e, n) => t(e.node, `${r}/variant/${n}`));
|
|
560
|
+
};
|
|
561
|
+
return t(this.node, "root"), Object.freeze(e);
|
|
562
|
+
}
|
|
563
|
+
result(t) {
|
|
564
|
+
try {
|
|
565
|
+
return h.succeed(t());
|
|
566
|
+
} catch (t) {
|
|
567
|
+
return h.fail(t instanceof e ? t : new e({ detail: "State does not match its declared binary schema" }));
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
validated(e) {
|
|
571
|
+
return g.decodeUnknownSync(this.schema)(e), e;
|
|
572
|
+
}
|
|
573
|
+
full(e) {
|
|
574
|
+
return this.result(() => {
|
|
575
|
+
let t = new b(this.limits.maxBytes);
|
|
576
|
+
return F(this.node, this.validated(e), t, this.limits), Uint8Array.from(t.output);
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
decodeFull(e) {
|
|
580
|
+
return this.result(() => {
|
|
581
|
+
e.length > this.limits.maxBytes && _("State exceeds byte budget");
|
|
582
|
+
let t = new b(this.limits.maxBytes, e), n = L(this.node, t, this.limits);
|
|
583
|
+
return t.end(), this.validated(n);
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
delta(e, t, n = !1) {
|
|
587
|
+
return this.result(() => {
|
|
588
|
+
typeof n != "boolean" && _("Unchanged delta selection must be boolean");
|
|
589
|
+
let r = this.validated(e), i = this.validated(t);
|
|
590
|
+
if (R(this.node, r, i, this.limits) && !n) return null;
|
|
591
|
+
let a = new b(this.limits.maxBytes);
|
|
592
|
+
return z(this.node, r, i, a, this.limits), Uint8Array.from(a.output);
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
decodeDelta(e, t) {
|
|
596
|
+
return this.result(() => {
|
|
597
|
+
e.length > this.limits.maxBytes && _("Delta exceeds byte budget");
|
|
598
|
+
let n = this.validated(t), r = new b(this.limits.maxBytes, e), i = B(this.node, n, r, this.limits);
|
|
599
|
+
return r.end(), this.validated(i);
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}, H = class {
|
|
603
|
+
schema;
|
|
604
|
+
codec;
|
|
605
|
+
constructor(e, t = {}) {
|
|
606
|
+
this.schema = e, this.codec = new V(e, t, !0);
|
|
607
|
+
}
|
|
608
|
+
get schemaHash() {
|
|
609
|
+
return this.codec.schemaHash;
|
|
610
|
+
}
|
|
611
|
+
get limits() {
|
|
612
|
+
return this.codec.limits;
|
|
613
|
+
}
|
|
614
|
+
schemaDescription() {
|
|
615
|
+
return this.codec.description();
|
|
616
|
+
}
|
|
617
|
+
fieldManifest() {
|
|
618
|
+
return this.codec.fieldManifest();
|
|
619
|
+
}
|
|
620
|
+
transformRulesManifest() {
|
|
621
|
+
return this.codec.transformRulesManifest();
|
|
622
|
+
}
|
|
623
|
+
full(e) {
|
|
624
|
+
return this.codec.full(e);
|
|
625
|
+
}
|
|
626
|
+
decodeFull(e) {
|
|
627
|
+
return this.codec.decodeFull(e);
|
|
628
|
+
}
|
|
629
|
+
delta(e, t, n = !1) {
|
|
630
|
+
return this.codec.delta(e, t, n);
|
|
631
|
+
}
|
|
632
|
+
decodeDelta(e, t) {
|
|
633
|
+
return this.codec.decodeDelta(e, t);
|
|
634
|
+
}
|
|
635
|
+
}, U = class {
|
|
636
|
+
schema;
|
|
637
|
+
codec;
|
|
638
|
+
constructor(e, t = {}, n = "f32") {
|
|
639
|
+
this.schema = e, this.codec = new V(e, t, !1, n);
|
|
640
|
+
}
|
|
641
|
+
get schemaHash() {
|
|
642
|
+
return this.codec.schemaHash;
|
|
643
|
+
}
|
|
644
|
+
get limits() {
|
|
645
|
+
return this.codec.limits;
|
|
646
|
+
}
|
|
647
|
+
schemaDescription() {
|
|
648
|
+
return this.codec.description();
|
|
649
|
+
}
|
|
650
|
+
full(e) {
|
|
651
|
+
return this.codec.full(e);
|
|
652
|
+
}
|
|
653
|
+
decodeFull(e) {
|
|
654
|
+
return this.codec.decodeFull(e);
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
//#endregion
|
|
658
|
+
export { U as RoomInputCodec, H as RoomStateCodec, D as simulationSchemaNode };
|