@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/bots.d.ts
ADDED
|
@@ -0,0 +1,1485 @@
|
|
|
1
|
+
import { DeclaredAccess } from '@voltro/protocol';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { Schema } from 'effect';
|
|
4
|
+
|
|
5
|
+
export declare const aimError: (degrees: number, rng: RoomBotRandom) => number;
|
|
6
|
+
|
|
7
|
+
declare type CollisionBody2D = {
|
|
8
|
+
readonly kind: 'circle';
|
|
9
|
+
readonly radius: number;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'aabb';
|
|
12
|
+
readonly halfWidth: number;
|
|
13
|
+
readonly halfHeight: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare interface CollisionResult2D {
|
|
17
|
+
readonly transform: Transform2D;
|
|
18
|
+
readonly collided: ReadonlyArray<string>;
|
|
19
|
+
readonly iterations: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Pure authoring. The host must supply a player's actual visibility projection
|
|
23
|
+
* and route the resulting intentions through ordinary room input admission. */
|
|
24
|
+
export declare const defineBot: <V extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, M extends Schema.Codec<unknown, unknown>>(input: RoomBotBehavior<V, I, M>) => RoomBotDescriptor<V, I, M>;
|
|
25
|
+
|
|
26
|
+
/** Exact reduced integer ratio over admitted coordinates/differences of magnitude <= u32.
|
|
27
|
+
* Shared 2D/3D slab arithmetic; never round a fraction before comparing it. */
|
|
28
|
+
declare interface FixedSlabFraction {
|
|
29
|
+
readonly numerator: number;
|
|
30
|
+
readonly denominator: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare interface GeometryBoxOverlapOptions {
|
|
34
|
+
readonly maxTests?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare type GeometryChunk = GeometryTileChunk | GeometryHeightfieldChunk | GeometryShapesChunk | GeometryVoxelChunk;
|
|
38
|
+
|
|
39
|
+
declare interface GeometryGridRayHit {
|
|
40
|
+
readonly kind: '2d-tiles' | '3d-voxel';
|
|
41
|
+
readonly scope: GeometryPersistenceScope;
|
|
42
|
+
readonly revision: number;
|
|
43
|
+
readonly cell: {
|
|
44
|
+
readonly x: number;
|
|
45
|
+
readonly y: number;
|
|
46
|
+
readonly z?: number;
|
|
47
|
+
};
|
|
48
|
+
/** Exact reduced infimum entry fraction on the offered segment, not a
|
|
49
|
+
* rounded contact point or a floating-point distance. */
|
|
50
|
+
readonly fraction: {
|
|
51
|
+
readonly numerator: number;
|
|
52
|
+
readonly denominator: number;
|
|
53
|
+
};
|
|
54
|
+
readonly visitedCells: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare interface GeometryGridRayOptions {
|
|
58
|
+
readonly maxVisitedCells?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare interface GeometryGridSweepHit {
|
|
62
|
+
readonly kind: '2d-tiles' | '3d-voxel';
|
|
63
|
+
readonly scope: GeometryPersistenceScope;
|
|
64
|
+
readonly revision: number;
|
|
65
|
+
readonly cell: {
|
|
66
|
+
readonly x: number;
|
|
67
|
+
readonly y: number;
|
|
68
|
+
readonly z?: number;
|
|
69
|
+
};
|
|
70
|
+
/** Infimum/supremum of positive-volume overlap, clipped to [0,1]. Contact
|
|
71
|
+
* alone is not an overlap; fractions are exact reduced integer ratios. */
|
|
72
|
+
readonly entry: FixedSlabFraction;
|
|
73
|
+
readonly exit: FixedSlabFraction;
|
|
74
|
+
readonly initialOverlap: boolean;
|
|
75
|
+
readonly testedCells: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** A half-open raw box `[min, max)` on all three axes; a heightfield box needs its z extent. */
|
|
79
|
+
declare interface GeometryHeightfieldBoxRaw {
|
|
80
|
+
readonly minXRaw: number;
|
|
81
|
+
readonly minYRaw: number;
|
|
82
|
+
readonly minZRaw: number;
|
|
83
|
+
readonly maxXRaw: number;
|
|
84
|
+
readonly maxYRaw: number;
|
|
85
|
+
readonly maxZRaw: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
declare type GeometryHeightfieldChunk = (typeof GeometryHeightfieldChunkSchema)["Type"];
|
|
89
|
+
|
|
90
|
+
declare const GeometryHeightfieldChunkSchema: Schema.Struct<{
|
|
91
|
+
readonly kind: Schema.Literal<"2d-heightfield">;
|
|
92
|
+
readonly formatVersion: Schema.Literal<1>;
|
|
93
|
+
readonly address: Schema.Struct<{
|
|
94
|
+
readonly worldId: Schema.String;
|
|
95
|
+
readonly layerSetId: Schema.String;
|
|
96
|
+
readonly cx: Schema.Int;
|
|
97
|
+
readonly cy: Schema.Int;
|
|
98
|
+
}>;
|
|
99
|
+
readonly version: Schema.String;
|
|
100
|
+
readonly width: Schema.Int;
|
|
101
|
+
readonly height: Schema.Int;
|
|
102
|
+
readonly sampleSpacingRaw: Schema.Int;
|
|
103
|
+
readonly baseHeightRaw: Schema.Int;
|
|
104
|
+
readonly heightQuantumRaw: Schema.Int;
|
|
105
|
+
readonly heights: Schema.$Array<Schema.Int>;
|
|
106
|
+
}>;
|
|
107
|
+
|
|
108
|
+
declare interface GeometryHeightfieldRayHit {
|
|
109
|
+
readonly kind: '2d-heightfield';
|
|
110
|
+
readonly scope: GeometryPersistenceScope;
|
|
111
|
+
readonly revision: number;
|
|
112
|
+
/** The first point on the segment at or below the surface, in global raw units. */
|
|
113
|
+
readonly point: GeometryHeightfieldRayPoint;
|
|
114
|
+
/** Exact reduced position on the offered segment whose raw-grid point is `point`. */
|
|
115
|
+
readonly fraction: {
|
|
116
|
+
readonly numerator: number;
|
|
117
|
+
readonly denominator: number;
|
|
118
|
+
};
|
|
119
|
+
readonly visitedSamples: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare interface GeometryHeightfieldRayPoint {
|
|
123
|
+
readonly xRaw: number;
|
|
124
|
+
readonly yRaw: number;
|
|
125
|
+
readonly zRaw: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare interface GeometryHeightfieldSweepHit {
|
|
129
|
+
readonly kind: '2d-heightfield';
|
|
130
|
+
/** The first box position along the path that reaches under the surface, on the raw grid. */
|
|
131
|
+
readonly box: GeometryHeightfieldBoxRaw;
|
|
132
|
+
/** Exact reduced position of `box` on the path: raw steps along the longest axis over its length. */
|
|
133
|
+
readonly fraction: {
|
|
134
|
+
readonly numerator: number;
|
|
135
|
+
readonly denominator: number;
|
|
136
|
+
};
|
|
137
|
+
/** The start box already reaches under the surface (fraction 0). */
|
|
138
|
+
readonly initialOverlap: boolean;
|
|
139
|
+
/** Overlap evaluations used, coarse and refining together. */
|
|
140
|
+
readonly evaluations: number;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
declare type GeometryKind = GeometryChunk['kind'];
|
|
144
|
+
|
|
145
|
+
declare interface GeometryPersistenceScope {
|
|
146
|
+
readonly tenantId: string;
|
|
147
|
+
readonly kind: GeometryKind;
|
|
148
|
+
readonly worldId: string;
|
|
149
|
+
readonly version: string;
|
|
150
|
+
readonly layerSetId: string;
|
|
151
|
+
readonly cx: number;
|
|
152
|
+
readonly cy: number;
|
|
153
|
+
readonly cz?: number | undefined;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare interface GeometryPreparedScope {
|
|
157
|
+
readonly tenantId: string;
|
|
158
|
+
readonly kind: GeometryKind;
|
|
159
|
+
readonly worldId: string;
|
|
160
|
+
readonly layerSetId: string;
|
|
161
|
+
readonly version: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare type GeometryShape = (typeof GeometryShapeSchema)["Type"];
|
|
165
|
+
|
|
166
|
+
declare interface GeometryShapeRayHit {
|
|
167
|
+
readonly kind: '3d-shapes';
|
|
168
|
+
readonly scope: GeometryPersistenceScope;
|
|
169
|
+
readonly revision: number;
|
|
170
|
+
/** Native LOCAL shape; scope identifies its owning chunk. */
|
|
171
|
+
readonly shape: GeometryShape;
|
|
172
|
+
/** Encloses the exact infimum entry time; width <= 2^-52. Presentation only.
|
|
173
|
+
* Selection and ownership decisions never use these rounded bounds. */
|
|
174
|
+
readonly fractionBounds: {
|
|
175
|
+
readonly lower: number;
|
|
176
|
+
readonly upper: number;
|
|
177
|
+
};
|
|
178
|
+
readonly visitedChunks: number;
|
|
179
|
+
readonly testedShapes: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
declare const GeometryShapeSchema: Schema.Union<readonly [Schema.Struct<{
|
|
183
|
+
readonly halfXRaw: Schema.Int;
|
|
184
|
+
readonly halfYRaw: Schema.Int;
|
|
185
|
+
readonly halfZRaw: Schema.Int;
|
|
186
|
+
readonly id: Schema.String;
|
|
187
|
+
readonly xRaw: Schema.Int;
|
|
188
|
+
readonly yRaw: Schema.Int;
|
|
189
|
+
readonly zRaw: Schema.Int;
|
|
190
|
+
readonly kind: Schema.Literal<"aabb">;
|
|
191
|
+
}>, Schema.Struct<{
|
|
192
|
+
readonly radiusRaw: Schema.Int;
|
|
193
|
+
readonly id: Schema.String;
|
|
194
|
+
readonly xRaw: Schema.Int;
|
|
195
|
+
readonly yRaw: Schema.Int;
|
|
196
|
+
readonly zRaw: Schema.Int;
|
|
197
|
+
readonly kind: Schema.Literal<"sphere">;
|
|
198
|
+
}>]>;
|
|
199
|
+
|
|
200
|
+
declare type GeometryShapesChunk = (typeof GeometryShapesChunkSchema)["Type"];
|
|
201
|
+
|
|
202
|
+
declare const GeometryShapesChunkSchema: Schema.Struct<{
|
|
203
|
+
readonly kind: Schema.Literal<"3d-shapes">;
|
|
204
|
+
readonly formatVersion: Schema.Literal<1>;
|
|
205
|
+
readonly address: Schema.Struct<{
|
|
206
|
+
readonly worldId: Schema.String;
|
|
207
|
+
readonly layerSetId: Schema.String;
|
|
208
|
+
readonly cx: Schema.Int;
|
|
209
|
+
readonly cy: Schema.Int;
|
|
210
|
+
readonly cz: Schema.Int;
|
|
211
|
+
}>;
|
|
212
|
+
readonly version: Schema.String;
|
|
213
|
+
readonly extentXRaw: Schema.Int;
|
|
214
|
+
readonly extentYRaw: Schema.Int;
|
|
215
|
+
readonly extentZRaw: Schema.Int;
|
|
216
|
+
readonly shapes: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
217
|
+
readonly halfXRaw: Schema.Int;
|
|
218
|
+
readonly halfYRaw: Schema.Int;
|
|
219
|
+
readonly halfZRaw: Schema.Int;
|
|
220
|
+
readonly id: Schema.String;
|
|
221
|
+
readonly xRaw: Schema.Int;
|
|
222
|
+
readonly yRaw: Schema.Int;
|
|
223
|
+
readonly zRaw: Schema.Int;
|
|
224
|
+
readonly kind: Schema.Literal<"aabb">;
|
|
225
|
+
}>, Schema.Struct<{
|
|
226
|
+
readonly radiusRaw: Schema.Int;
|
|
227
|
+
readonly id: Schema.String;
|
|
228
|
+
readonly xRaw: Schema.Int;
|
|
229
|
+
readonly yRaw: Schema.Int;
|
|
230
|
+
readonly zRaw: Schema.Int;
|
|
231
|
+
readonly kind: Schema.Literal<"sphere">;
|
|
232
|
+
}>]>>;
|
|
233
|
+
}>;
|
|
234
|
+
|
|
235
|
+
declare type GeometryTileChunk = (typeof GeometryTileChunkSchema)["Type"];
|
|
236
|
+
|
|
237
|
+
declare const GeometryTileChunkSchema: Schema.Struct<{
|
|
238
|
+
readonly kind: Schema.Literal<"2d-tiles">;
|
|
239
|
+
readonly formatVersion: Schema.Literal<1>;
|
|
240
|
+
readonly address: Schema.Struct<{
|
|
241
|
+
readonly worldId: Schema.String;
|
|
242
|
+
readonly layerSetId: Schema.String;
|
|
243
|
+
readonly cx: Schema.Int;
|
|
244
|
+
readonly cy: Schema.Int;
|
|
245
|
+
}>;
|
|
246
|
+
readonly version: Schema.String;
|
|
247
|
+
readonly width: Schema.Int;
|
|
248
|
+
readonly height: Schema.Int;
|
|
249
|
+
readonly tileSizeRaw: Schema.Int;
|
|
250
|
+
readonly palette: Schema.$Array<Schema.Struct<{
|
|
251
|
+
readonly key: Schema.String;
|
|
252
|
+
readonly solid: Schema.Boolean;
|
|
253
|
+
}>>;
|
|
254
|
+
readonly runs: Schema.$Array<Schema.Struct<{
|
|
255
|
+
readonly paletteIndex: Schema.Int;
|
|
256
|
+
readonly length: Schema.Int;
|
|
257
|
+
}>>;
|
|
258
|
+
}>;
|
|
259
|
+
|
|
260
|
+
declare interface GeometryTileCollisionOptions {
|
|
261
|
+
/** Total visited cells across every solver query, including its final check.
|
|
262
|
+
* May only narrow the world's maxOverlapTests. */
|
|
263
|
+
readonly maxTests?: number;
|
|
264
|
+
/** Existing discrete solver limit; defaults to 8, maximum 256. */
|
|
265
|
+
readonly maxIterations?: number;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
declare type GeometryTileMaterial = (typeof GeometryTileMaterialSchema)["Type"];
|
|
269
|
+
|
|
270
|
+
declare const GeometryTileMaterialSchema: Schema.Struct<{
|
|
271
|
+
readonly key: Schema.String;
|
|
272
|
+
readonly solid: Schema.Boolean;
|
|
273
|
+
}>;
|
|
274
|
+
|
|
275
|
+
declare type GeometryVoxelChunk = (typeof GeometryVoxelChunkSchema)["Type"];
|
|
276
|
+
|
|
277
|
+
declare const GeometryVoxelChunkSchema: Schema.Struct<{
|
|
278
|
+
readonly kind: Schema.Literal<"3d-voxel">;
|
|
279
|
+
readonly formatVersion: Schema.Literal<1>;
|
|
280
|
+
readonly address: Schema.Struct<{
|
|
281
|
+
readonly worldId: Schema.String;
|
|
282
|
+
readonly layerSetId: Schema.String;
|
|
283
|
+
readonly cx: Schema.Int;
|
|
284
|
+
readonly cy: Schema.Int;
|
|
285
|
+
readonly cz: Schema.Int;
|
|
286
|
+
}>;
|
|
287
|
+
readonly version: Schema.String;
|
|
288
|
+
readonly side: Schema.Int;
|
|
289
|
+
readonly voxelSizeRaw: Schema.Int;
|
|
290
|
+
readonly palette: Schema.$Array<Schema.Struct<{
|
|
291
|
+
readonly key: Schema.String;
|
|
292
|
+
readonly solid: Schema.Boolean;
|
|
293
|
+
}>>;
|
|
294
|
+
readonly sections: Schema.$Array<Schema.Struct<{
|
|
295
|
+
readonly sx: Schema.Int;
|
|
296
|
+
readonly sy: Schema.Int;
|
|
297
|
+
readonly sz: Schema.Int;
|
|
298
|
+
readonly runs: Schema.$Array<Schema.Struct<{
|
|
299
|
+
readonly paletteIndex: Schema.Int;
|
|
300
|
+
readonly length: Schema.Int;
|
|
301
|
+
}>>;
|
|
302
|
+
}>>;
|
|
303
|
+
}>;
|
|
304
|
+
|
|
305
|
+
/** Nonempty half-open raw box. Three-dimensional kinds require both Z fields. */
|
|
306
|
+
declare interface GeometryWorldBoxRaw {
|
|
307
|
+
readonly minXRaw: number;
|
|
308
|
+
readonly minYRaw: number;
|
|
309
|
+
readonly maxXRaw: number;
|
|
310
|
+
readonly maxYRaw: number;
|
|
311
|
+
readonly minZRaw?: number;
|
|
312
|
+
readonly maxZRaw?: number;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare interface GeometryWorldPointRaw {
|
|
316
|
+
readonly xRaw: number;
|
|
317
|
+
readonly yRaw: number;
|
|
318
|
+
readonly zRaw?: number;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
declare type GeometryWorldRayHit = GeometryGridRayHit | GeometryShapeRayHit | GeometryHeightfieldRayHit;
|
|
322
|
+
|
|
323
|
+
declare interface GeometryWorldRayOptions extends GeometryGridRayOptions {
|
|
324
|
+
/** Shapes only; narrows maxOverlapTests for the total shape scan. */
|
|
325
|
+
readonly maxTests?: number;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
declare interface GeometryWorldShapeHit {
|
|
329
|
+
readonly scope: GeometryPersistenceScope;
|
|
330
|
+
readonly revision: number;
|
|
331
|
+
readonly shape: GeometryShape;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare interface GeometryWorldView {
|
|
335
|
+
readonly kind: GeometryKind;
|
|
336
|
+
readonly scope: GeometryPreparedScope;
|
|
337
|
+
/** Discrete AABB/circle resolution in world units against current tile data.
|
|
338
|
+
* Reuses the Transform solver; no swept movement or velocity integration. */
|
|
339
|
+
collide(transform: Transform2D, body: CollisionBody2D, options?: GeometryTileCollisionOptions): CollisionResult2D;
|
|
340
|
+
/** Tiles/voxels only. Unloaded coordinates refuse, never implicit empty terrain. */
|
|
341
|
+
materialAtRaw(point: GeometryWorldPointRaw): GeometryTileMaterial;
|
|
342
|
+
/** Tiles/voxels/shapes: the stored solidity. Heightfields (points with `zRaw`): terrain is solid at and
|
|
343
|
+
* below its surface, the same surface `raycastRaw` hits. Heightfield material is not invented. */
|
|
344
|
+
solidAtRaw(point: GeometryWorldPointRaw): boolean;
|
|
345
|
+
/** Heightfield only, with exact existing native interpolation. */
|
|
346
|
+
heightAtRaw(point: GeometryWorldPointRaw): number;
|
|
347
|
+
/** Shapes only; hit volumes retain native LOCAL coordinates and exact chunk scope. */
|
|
348
|
+
shapesAtRaw(point: GeometryWorldPointRaw): ReadonlyArray<GeometryWorldShapeHit>;
|
|
349
|
+
/** Tiles/voxels return exact rational entry; shapes select exact quadratic
|
|
350
|
+
* entry and expose enclosing presentation bounds; heightfields (points with
|
|
351
|
+
* `zRaw`) return the first sampled point at or below the surface, refined to
|
|
352
|
+
* one raw unit (`raycastGeometryHeightfield`). Missing coverage refuses. */
|
|
353
|
+
raycastRaw(from: GeometryWorldPointRaw, to: GeometryWorldPointRaw, options?: GeometryWorldRayOptions): GeometryWorldRayHit | null;
|
|
354
|
+
/** Tiles/voxels/closed native shapes, clipped by half-open chunk ownership. Heightfields need the z extent:
|
|
355
|
+
* the box touches terrain when the highest surface point over its footprint is at or above `minZRaw`
|
|
356
|
+
* (`overlapsGeometryHeightfieldBox`). Nonempty half-open raw boxes only; missing data or work exhaustion refuses. */
|
|
357
|
+
overlapsBoxRaw(box: GeometryWorldBoxRaw, options?: GeometryBoxOverlapOptions): boolean;
|
|
358
|
+
/** Translation-only tile/voxel sweep. Shares maxOverlapTests; validates the
|
|
359
|
+
* whole swept bounding region before publishing the earliest overlap. */
|
|
360
|
+
sweepBoxRaw(from: GeometryWorldBoxRaw, to: GeometryWorldBoxRaw, options?: GeometryBoxOverlapOptions): GeometryGridSweepHit | null;
|
|
361
|
+
/** Heightfields only (boxes with a z extent): the first raw-grid position that reaches under the surface
|
|
362
|
+
* (`sweepGeometryHeightfieldBox`), coarse steps of a quarter sample spacing, at most
|
|
363
|
+
* `geometry.budgets.maxRayCells` overlap evaluations of `maxTests` reads each. */
|
|
364
|
+
sweepHeightfieldBoxRaw(from: GeometryHeightfieldBoxRaw, to: GeometryHeightfieldBoxRaw, options?: GeometryBoxOverlapOptions): GeometryHeightfieldSweepHit | null;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** Detached rectangular 4-neighbor grid, deterministic A* tie order. No nav
|
|
368
|
+
* service/store/path cache or movement authority is created. */
|
|
369
|
+
export declare const navGrid: (input: ReadonlyArray<ReadonlyArray<boolean>>) => RoomBotNavGrid;
|
|
370
|
+
|
|
371
|
+
/** Compute delay data; no timer is allocated. All angular helper units are degrees. */
|
|
372
|
+
export declare const reactionDelay: (milliseconds: number, jitterMilliseconds: number, rng: RoomBotRandom) => number;
|
|
373
|
+
|
|
374
|
+
/** One authoritative actor. This module contains no store, socket or timer. */
|
|
375
|
+
declare class RoomActor<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
376
|
+
readonly id: string;
|
|
377
|
+
readonly descriptor: RoomDescriptor<S, I, O>;
|
|
378
|
+
private readonly clock;
|
|
379
|
+
readonly tenantId: string;
|
|
380
|
+
private currentState;
|
|
381
|
+
private lastGoodState;
|
|
382
|
+
private lastGoodTick;
|
|
383
|
+
readonly options: (O)["Type"];
|
|
384
|
+
private readonly members;
|
|
385
|
+
private readonly grace;
|
|
386
|
+
private readonly inputs;
|
|
387
|
+
private readonly outbox;
|
|
388
|
+
private readonly clientOperations;
|
|
389
|
+
private readonly schedules;
|
|
390
|
+
private readonly extensionDurationMs;
|
|
391
|
+
private readonly extensionOverruns;
|
|
392
|
+
private tick;
|
|
393
|
+
private droppedTicks;
|
|
394
|
+
private commandSeq;
|
|
395
|
+
readonly epoch: number;
|
|
396
|
+
private nextTickAt;
|
|
397
|
+
private emptyAt;
|
|
398
|
+
private locked;
|
|
399
|
+
private disposed;
|
|
400
|
+
private publicationHeldAt;
|
|
401
|
+
private drainFrozen;
|
|
402
|
+
private drainAt;
|
|
403
|
+
private retiring;
|
|
404
|
+
private faulted;
|
|
405
|
+
private ticking;
|
|
406
|
+
private lastNow;
|
|
407
|
+
private readonly app;
|
|
408
|
+
private readonly scheduler;
|
|
409
|
+
private readonly worldPreviews;
|
|
410
|
+
private readonly worldReceipts;
|
|
411
|
+
private readonly deferredWorldLeaves;
|
|
412
|
+
private worldMovement;
|
|
413
|
+
private worldMovementClamps;
|
|
414
|
+
private worldMovementMargin;
|
|
415
|
+
private worldMovementIntents;
|
|
416
|
+
private worldFinalizationHold;
|
|
417
|
+
private readonly worldPublishedTransitions;
|
|
418
|
+
private lifecycleTail;
|
|
419
|
+
private lifecycleRequests;
|
|
420
|
+
private lifecycleActive;
|
|
421
|
+
private readonly geometry;
|
|
422
|
+
constructor(id: string, descriptor: RoomDescriptor<S, I, O>, initialState: (S)["Type"], options: (O)["Type"], clock: RoomClock, tenantId: string, recovery?: RoomActorRecovery, geometry?: GeometryWorldView);
|
|
423
|
+
get state(): RoomState<(S)["Type"]>;
|
|
424
|
+
private now;
|
|
425
|
+
private ensureOpen;
|
|
426
|
+
private stage;
|
|
427
|
+
private schedule;
|
|
428
|
+
join(client: RoomClient): void;
|
|
429
|
+
joinAsync(client: RoomClient, signal?: AbortSignal): Promise<void>;
|
|
430
|
+
/** Only a trusted SQL seat adapter supplies this cursor; player Hello/input
|
|
431
|
+
* never contains it. The successful lifecycle commits cursor and membership. */
|
|
432
|
+
/** `authorizeCommit` runs before the join hook and again before publication; the World
|
|
433
|
+
* member its first run returns reaches `onJoin` as `world`. */
|
|
434
|
+
joinReservedAsync(client: RoomClient, consumed: RoomConsumedSeat, signal?: AbortSignal, authorizeCommit?: () => Promise<RoomWorldMember | undefined | void>): Promise<void>;
|
|
435
|
+
/** Trusted Host-only pending membership. The caller must separately establish
|
|
436
|
+
* current SQL transition/Seat authority; the marker itself grants nothing. */
|
|
437
|
+
joinWorldReservedAsync(client: RoomClient, consumed: RoomConsumedSeat, authorize: () => Promise<void | 'pending' | 'committed' | 'settled'>, signal?: AbortSignal): Promise<void>;
|
|
438
|
+
/** The author's view of a transition arrival becoming an active member (`world.onMemberEnter`). */
|
|
439
|
+
private worldMemberEntered;
|
|
440
|
+
/** The committed World point of one entity through `world.movement.position`: the last good state, never a
|
|
441
|
+
* draft. Null without a movement hook, without that entity, or without a finite point. */
|
|
442
|
+
worldEntityPoint(entityId: string): WorldPoint | null;
|
|
443
|
+
/** Release only after the Host has persisted actual target enter and rechecked
|
|
444
|
+
* SQL authority. The retained canonical enter receipt is required locally. */
|
|
445
|
+
activateWorldReservedAsync(binding: WorldTargetSeatBinding, authorize: () => Promise<void>): Promise<void>;
|
|
446
|
+
private assertWorldMemberEntity;
|
|
447
|
+
isWorldPending(sessionId: string): boolean;
|
|
448
|
+
/** Explicit trusted local-host admission. Authentication still follows the
|
|
449
|
+
* descriptor; the resulting capability is bound to this exact Member object,
|
|
450
|
+
* so a stale bot cannot submit to or release a later reused session ID. */
|
|
451
|
+
joinBotAsync(client: RoomClient, countsAsPlayer?: boolean, signal?: AbortSignal): Promise<RoomActorBotLease>;
|
|
452
|
+
playerCount(): number;
|
|
453
|
+
availablePlayerSlots(): number;
|
|
454
|
+
monotonicNow(): number;
|
|
455
|
+
roster(): ReadonlyArray<Pick<RoomClient, 'sessionId' | 'subjectId' | 'tenantId'> & {
|
|
456
|
+
readonly isBot: boolean;
|
|
457
|
+
readonly countsAsPlayer: boolean;
|
|
458
|
+
}>;
|
|
459
|
+
/** Check identity/lock and current counted/grace capacity before replacing a
|
|
460
|
+
* bot. Full prepareJoin repeats these immediately before membership commit. */
|
|
461
|
+
humanAdmissionNeedsReplacement(client: RoomClient): boolean;
|
|
462
|
+
private prepareClientIdentity;
|
|
463
|
+
private prepareJoin;
|
|
464
|
+
leave(sessionId: string, reason?: RoomLeaveReason): void;
|
|
465
|
+
leaveAsync(sessionId: string, reason?: RoomLeaveReason, signal?: AbortSignal): Promise<void>;
|
|
466
|
+
private prepareLeave;
|
|
467
|
+
private assertWorldArrival;
|
|
468
|
+
private enterWorldDraft;
|
|
469
|
+
/** Execute actual target admission on an isolated draft. Nothing is published
|
|
470
|
+
* or receipted here. Author Effects receive prepare phase and must supply their
|
|
471
|
+
* own external idempotency/compensation; this is not an ownership commit. */
|
|
472
|
+
previewWorldEnter(input: Parameters<RoomActor<S, I, O>['applyWorldHook']>[1], maxBytes: number, signal?: AbortSignal): Promise<void>;
|
|
473
|
+
/** Trusted server lifecycle only. The caller supplies the configured World
|
|
474
|
+
* byte budget and current epoch; this grants no SQL/transition admission. */
|
|
475
|
+
applyWorldHook(operation: 'enter' | 'exit' | 'ghost', input: RoomWorldHookInput<RoomWorldEntity<(S)["Type"]>>, maxBytes: number, signal?: AbortSignal, authorizeCommit?: () => Promise<void>, replaceExitReceipt?: boolean, previousGhost?: RoomWorldHookInput<RoomWorldEntity<(S)["Type"]>>, retainGhostProjection?: boolean, promoteGhosts?: ReadonlyArray<RoomWorldHookInput<RoomWorldEntity<(S)["Type"]>>>): Promise<void>;
|
|
476
|
+
private assertWorldHookResult;
|
|
477
|
+
private assertWorldEnterVacant;
|
|
478
|
+
/** Trusted Host terminal-proof path only; it checkpoints the removal before
|
|
479
|
+
* returning. No gameplay state or external effect is undone here. */
|
|
480
|
+
retireWorldReceipt(requestId: string, operation: 'enter' | 'exit' | 'ghost'): Promise<void>;
|
|
481
|
+
/** Failed transition compensation, guarded before draft publication. The
|
|
482
|
+
* author removes its projection in onGhost phase rollback; no source rewind. */
|
|
483
|
+
cancelWorldGhost(input: Parameters<RoomActor<S, I, O>['applyWorldHook']>[1], maxBytes: number, authorize: () => Promise<void>): Promise<void>;
|
|
484
|
+
cancelWorldPreview(requestId: string, authorize: () => Promise<void>): Promise<void>;
|
|
485
|
+
hasWorldReceipt(requestId: string, operation: 'enter' | 'exit' | 'ghost'): boolean;
|
|
486
|
+
worldReceiptSnapshot(): ReadonlyArray<RoomWorldReceipt>;
|
|
487
|
+
/** Capture the actual current actor entity, never a caller-provided replacement.
|
|
488
|
+
* Returned data is detached bounded JSON; persistence remains outside the tick. */
|
|
489
|
+
captureWorldEntity(entityId: string, epoch: number, maxBytes: number): Promise<{
|
|
490
|
+
readonly entity: RoomWorldEntity<(S)["Type"]>;
|
|
491
|
+
readonly data: unknown;
|
|
492
|
+
}>;
|
|
493
|
+
configureWorldCellMovement(epoch: number, bounds?: WorldBounds, marginUnits?: number): Promise<void>;
|
|
494
|
+
worldMovementSnapshot(): {
|
|
495
|
+
readonly bound: boolean;
|
|
496
|
+
readonly clamped: number;
|
|
497
|
+
};
|
|
498
|
+
captureWorldMovement(epoch: number): Promise<WorldMovementObservation>;
|
|
499
|
+
private constrainWorldMovement;
|
|
500
|
+
listWorldEntityIds(epoch: number, maximum: number, maxBytes: number): Promise<ReadonlyArray<string>>;
|
|
501
|
+
captureWorldProjection(entityId: string, epoch: number, maxBytes: number): Promise<{
|
|
502
|
+
readonly entity: RoomWorldEntity<(S)["Type"]>;
|
|
503
|
+
readonly data: unknown;
|
|
504
|
+
readonly tick: number;
|
|
505
|
+
}>;
|
|
506
|
+
private captureWorldEntityOwned;
|
|
507
|
+
/** Trusted Host handoff: one bounded room hold survives ambiguous durable writes.
|
|
508
|
+
* Completion must follow checkpoint acknowledgement; never release by timeout. */
|
|
509
|
+
finalizeWorldExit(input: {
|
|
510
|
+
readonly afterglow?: {
|
|
511
|
+
readonly requestId: string;
|
|
512
|
+
readonly expiresAt: number;
|
|
513
|
+
};
|
|
514
|
+
readonly subjectId?: string;
|
|
515
|
+
readonly epoch: number;
|
|
516
|
+
readonly entityId: string;
|
|
517
|
+
readonly requestId: string;
|
|
518
|
+
readonly location: WorldEntityLocation;
|
|
519
|
+
}, maxBytes: number, retain: (capture: {
|
|
520
|
+
readonly entity: RoomWorldEntity<(S)["Type"]>;
|
|
521
|
+
readonly data: unknown;
|
|
522
|
+
}) => Promise<void>, authorize: () => Promise<void>, expectedEntity?: unknown, signal?: AbortSignal): Promise<void>;
|
|
523
|
+
/** The actual Runtime supplies the synchronous bounded reliable enqueue. No
|
|
524
|
+
* network completion is awaited while the lifecycle/SQL fence is held. */
|
|
525
|
+
notifyWorldHandoff(input: Omit<RoomWorldHandoffFrame, 'tick'>, authorize: () => Promise<void>, enqueue: (frame: RoomWorldHandoffFrame) => void): Promise<void>;
|
|
526
|
+
/** Only the actual Host may call this after its durable checkpoint succeeds. */
|
|
527
|
+
completeWorldFinalization(requestId: string, authorize: () => Promise<void>): Promise<void>;
|
|
528
|
+
worldFinalizationAfterglow(): {
|
|
529
|
+
readonly requestId: string;
|
|
530
|
+
readonly expiresAt: number;
|
|
531
|
+
} | undefined;
|
|
532
|
+
worldFinalizationRequest(): string | null;
|
|
533
|
+
isWorldFinalizationHeld(): boolean;
|
|
534
|
+
/** Recovery-only source reconstruction from final durable capture. Caller owns
|
|
535
|
+
* unpublished successor/recovery authority and checkpoints before fence clear. */
|
|
536
|
+
reconcileWorldSource(input: {
|
|
537
|
+
readonly epoch: number;
|
|
538
|
+
readonly requestId: string;
|
|
539
|
+
readonly entity: RoomWorldEntity<(S)["Type"]>;
|
|
540
|
+
readonly location: WorldEntityLocation;
|
|
541
|
+
}, maxBytes: number, authorize: () => Promise<void>, signal?: AbortSignal): Promise<void>;
|
|
542
|
+
private assertSynchronousLifecycle;
|
|
543
|
+
private serializeLifecycle;
|
|
544
|
+
private mutateMemberAsync;
|
|
545
|
+
private pruneGrace;
|
|
546
|
+
private mutateMember;
|
|
547
|
+
/** encodedBytes is measured by the host transport, never supplied by a player. */
|
|
548
|
+
input(sessionId: string, seq: number, tickHint: number, payload: unknown, encodedBytes: number): boolean;
|
|
549
|
+
private send;
|
|
550
|
+
private extension;
|
|
551
|
+
holdPublication(): void;
|
|
552
|
+
releasePublication(): void;
|
|
553
|
+
/** Called by the host's single monotonic loop. Catch-up never spins unbounded. */
|
|
554
|
+
advance(): number;
|
|
555
|
+
drainOutbox(): ReadonlyArray<RoomOutboxCommand>;
|
|
556
|
+
private stageClientOperation;
|
|
557
|
+
/** Transport callbacks are invoked only by the supervisor after advance. */
|
|
558
|
+
flushClientOperations(): void;
|
|
559
|
+
/** Ordinary socket members and reconnect grace only. Local bots own no SQL
|
|
560
|
+
* seat. Queued-but-unapplied inputs never become applied receipts; discarded
|
|
561
|
+
* pending World inputs carry a separate durable rejection cursor. */
|
|
562
|
+
inputReceiptSnapshot(): ReadonlyArray<RoomInputReceipt>;
|
|
563
|
+
/** Runtime-only confirmation after the actual checkpoint port acknowledges.
|
|
564
|
+
* Inputs arriving during the write remain unconfirmed and block activation. */
|
|
565
|
+
confirmInputCheckpoint(receipts: ReadonlyArray<RoomInputReceipt>): void;
|
|
566
|
+
lastAppliedInputSeq(sessionId: string): number;
|
|
567
|
+
lock(): void;
|
|
568
|
+
unlock(): void;
|
|
569
|
+
dispose(): void;
|
|
570
|
+
isDisposed(): boolean;
|
|
571
|
+
isLifecycleBusy(): boolean;
|
|
572
|
+
/** Permanent local simulation fence before the final planned-handoff snapshot. */
|
|
573
|
+
freezeForDrain(): Promise<void>;
|
|
574
|
+
/** Only after real SQL ownership handoff. No leave/dispose game hooks, SQL,
|
|
575
|
+
* or new commands may run after the saved state has moved to its successor. */
|
|
576
|
+
releaseTransferred(): void;
|
|
577
|
+
disposeAsync(signal?: AbortSignal): Promise<void>;
|
|
578
|
+
isRetiring(): boolean;
|
|
579
|
+
/** Only the supervisor calls this after the final hibernated SQL receipt.
|
|
580
|
+
* Hibernate pauses a durable room; it must not run game-ending onDispose. */
|
|
581
|
+
releaseHibernated(): void;
|
|
582
|
+
isFaulted(): boolean;
|
|
583
|
+
commandCursor(): number;
|
|
584
|
+
scheduleSnapshot(): ReadonlyArray<RoomScheduleSnapshot>;
|
|
585
|
+
lastGoodSnapshot(): {
|
|
586
|
+
readonly tick: number;
|
|
587
|
+
readonly state: RoomState<(S)["Type"]>;
|
|
588
|
+
};
|
|
589
|
+
metrics(): RoomActorMetrics;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
declare interface RoomActorBotLease {
|
|
593
|
+
readonly sessionId: string;
|
|
594
|
+
isCurrent(): boolean;
|
|
595
|
+
input(seq: number, tickHint: number, payload: unknown, encodedBytes: number): boolean;
|
|
596
|
+
leave(signal?: AbortSignal): Promise<void>;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
declare interface RoomActorMetrics {
|
|
600
|
+
readonly tick: number;
|
|
601
|
+
readonly droppedTicks: number;
|
|
602
|
+
readonly queuedInputs: number;
|
|
603
|
+
readonly outboxCommands: number;
|
|
604
|
+
readonly clients: number;
|
|
605
|
+
readonly extensionDurationMs: Readonly<Record<string, number>>;
|
|
606
|
+
readonly extensionOverruns: Readonly<Record<string, number>>;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
declare interface RoomActorRecovery {
|
|
610
|
+
/** SQL ownership generation; a new owner must use a strictly newer epoch. */
|
|
611
|
+
readonly epoch: number;
|
|
612
|
+
readonly commandCursor: number;
|
|
613
|
+
readonly tick?: number;
|
|
614
|
+
readonly rehydrate?: boolean;
|
|
615
|
+
readonly worldReceipts?: ReadonlyArray<RoomWorldReceipt> | undefined;
|
|
616
|
+
readonly schedules?: ReadonlyArray<RoomScheduleSnapshot>;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/** Commands are staged in memory and drained outside the tick. */
|
|
620
|
+
declare interface RoomAppBridge {
|
|
621
|
+
publish(event: string, payload: unknown, options: {
|
|
622
|
+
readonly key: string;
|
|
623
|
+
}): string;
|
|
624
|
+
run(descriptor: string, input: unknown): string;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
declare interface RoomAuthoringStrategies<S = unknown> {
|
|
628
|
+
readonly budgets?: (options: Readonly<Partial<RoomBudgets>>) => RoomBudgets;
|
|
629
|
+
readonly reconnectPolicy?: (options: Readonly<Partial<{
|
|
630
|
+
readonly graceMs: number;
|
|
631
|
+
}>>) => {
|
|
632
|
+
readonly graceMs: number;
|
|
633
|
+
};
|
|
634
|
+
readonly snapshotPolicy?: (options: Readonly<Partial<RoomSnapshotPolicy<S>>>) => RoomSnapshotPolicy<S>;
|
|
635
|
+
readonly spectatorPolicy?: (options: Readonly<Partial<RoomSpectatorPolicy>>) => RoomSpectatorPolicy;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export declare interface RoomBotBehavior<V extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, M extends Schema.Codec<unknown, unknown>> {
|
|
639
|
+
readonly name: string;
|
|
640
|
+
readonly view: V;
|
|
641
|
+
readonly input: I;
|
|
642
|
+
readonly memory: M;
|
|
643
|
+
readonly initialMemory: () => (M)["Type"];
|
|
644
|
+
readonly decide: (context: RoomBotDecisionContext<(V)["Type"], (M)["Type"]>) => ReadonlyArray<(I)["Type"]>;
|
|
645
|
+
readonly maxInputs?: number;
|
|
646
|
+
readonly maxRandomDraws?: number;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/** No actor state, seat, clock, timer, socket or store. Explicit send-cadence
|
|
650
|
+
* calls commit detached memory only after every intention passes its schema.
|
|
651
|
+
* Rejected decisions retain bounded random draws, so retry consumes the same
|
|
652
|
+
* stream rather than silently advancing the caller's generator again. */
|
|
653
|
+
export declare class RoomBotBrain<V extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, M extends Schema.Codec<unknown, unknown>> {
|
|
654
|
+
private readonly rng;
|
|
655
|
+
readonly descriptor: RoomBotDescriptor<V, I, M>;
|
|
656
|
+
private memory;
|
|
657
|
+
private lastTick;
|
|
658
|
+
private readonly pendingRandom;
|
|
659
|
+
private deciding;
|
|
660
|
+
private decision;
|
|
661
|
+
constructor(descriptor: RoomBotDescriptor<V, I, M>, rng: RoomBotRandom);
|
|
662
|
+
step(view: unknown, tick: number, difficulty?: number): ReadonlyArray<(I)["Encoded"]>;
|
|
663
|
+
snapshot(): RoomBotBrainSnapshot<(M)["Type"]>;
|
|
664
|
+
restore(snapshot: RoomBotBrainSnapshot<(M)["Type"]>): void;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
export declare interface RoomBotBrainSnapshot<M> {
|
|
668
|
+
readonly version: 1;
|
|
669
|
+
readonly memory: M;
|
|
670
|
+
readonly lastTick: number | null;
|
|
671
|
+
readonly pendingRandom: ReadonlyArray<number>;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
export declare interface RoomBotDecisionContext<V, M> {
|
|
675
|
+
readonly view: V;
|
|
676
|
+
readonly memory: RoomState<M>;
|
|
677
|
+
readonly tick: number;
|
|
678
|
+
readonly difficulty: number;
|
|
679
|
+
readonly rng: RoomBotRandom;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export declare interface RoomBotDescriptor<V extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, M extends Schema.Codec<unknown, unknown>> extends Omit<RoomBotBehavior<V, I, M>, 'maxInputs' | 'maxRandomDraws'> {
|
|
683
|
+
readonly _tag: 'RoomBotDescriptor';
|
|
684
|
+
readonly maxInputs: number;
|
|
685
|
+
readonly maxRandomDraws: number;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/** Host-owned local fill. Explicit identities/RNG are mandatory; there is no
|
|
689
|
+
* fabricated Subject, remote credential, durable counter or SQL capacity claim.
|
|
690
|
+
* The host calls turn/admitHuman/close outside simulation and owns SQL seat
|
|
691
|
+
* coordination before integrating this helper into ordinary reservations. */
|
|
692
|
+
export declare class RoomBotFill<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
693
|
+
private readonly actor;
|
|
694
|
+
private readonly options;
|
|
695
|
+
private readonly startedAt;
|
|
696
|
+
private lastTime;
|
|
697
|
+
private ordinal;
|
|
698
|
+
private readonly bots;
|
|
699
|
+
private current;
|
|
700
|
+
private kind;
|
|
701
|
+
private stopped;
|
|
702
|
+
private closing;
|
|
703
|
+
constructor(actor: RoomActor<S, I, O>, input: RoomBotFillOptions<S, I, O>);
|
|
704
|
+
metrics(): {
|
|
705
|
+
readonly humans: number;
|
|
706
|
+
readonly bots: number;
|
|
707
|
+
readonly npcs: number;
|
|
708
|
+
readonly ownedBots: number;
|
|
709
|
+
};
|
|
710
|
+
private desiredBots;
|
|
711
|
+
private execute;
|
|
712
|
+
turn(): Promise<void>;
|
|
713
|
+
/** Local capacity replacement is ordered leave -> ordinary human join. It is
|
|
714
|
+
* not an atomic SQL reservation and failed human join does not undo onLeave. */
|
|
715
|
+
admitHuman(client: RoomClient, signal?: AbortSignal): Promise<void>;
|
|
716
|
+
fence(): void;
|
|
717
|
+
close(): Promise<void>;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export declare interface RoomBotFillContext<S, O> {
|
|
721
|
+
readonly state: S;
|
|
722
|
+
readonly options: O;
|
|
723
|
+
readonly tick: number;
|
|
724
|
+
readonly roster: ReadonlyArray<RoomLocalBotIdentity & {
|
|
725
|
+
readonly isBot: boolean;
|
|
726
|
+
readonly countsAsPlayer: boolean;
|
|
727
|
+
}>;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export declare interface RoomBotFillOptions<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
731
|
+
readonly toMin: number;
|
|
732
|
+
readonly afterMs?: number;
|
|
733
|
+
readonly removeWhenHuman?: boolean;
|
|
734
|
+
readonly behaviors: ReadonlyArray<RoomBotDescriptor<S, I, Schema.Codec<any, any>>>;
|
|
735
|
+
readonly makeIdentity: (ordinal: number) => RoomLocalBotIdentity;
|
|
736
|
+
readonly random: (ordinal: number) => RoomBotRandom;
|
|
737
|
+
readonly difficultyFrom?: (context: RoomBotFillContext<(S)["Type"], (O)["Type"]>) => number;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/** Explicit local host composition. Owns one actual actor Member capability;
|
|
741
|
+
* every intention goes through the normal actor schema/rate/byte/queue path.
|
|
742
|
+
* No SQL seat, provider, socket, timer or automatic runtime install is implied. */
|
|
743
|
+
export declare class RoomBotLocalClient<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>, M extends Schema.Codec<unknown, unknown>> {
|
|
744
|
+
private readonly actor;
|
|
745
|
+
readonly identity: RoomLocalBotIdentity;
|
|
746
|
+
readonly countsAsPlayer: boolean;
|
|
747
|
+
private readonly brain;
|
|
748
|
+
private readonly codec;
|
|
749
|
+
private readonly now;
|
|
750
|
+
private readonly interval;
|
|
751
|
+
private readonly difficulty;
|
|
752
|
+
private readonly view;
|
|
753
|
+
private lease;
|
|
754
|
+
private nextSendAt;
|
|
755
|
+
private lastTime;
|
|
756
|
+
private sequence;
|
|
757
|
+
private stopped;
|
|
758
|
+
private cleaned;
|
|
759
|
+
private closing;
|
|
760
|
+
private failed;
|
|
761
|
+
private constructor();
|
|
762
|
+
static attach<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>, M extends Schema.Codec<unknown, unknown>>(actor: RoomActor<S, I, O>, identity: RoomLocalBotIdentity, descriptor: RoomBotDescriptor<S, I, M>, rng: RoomBotRandom, options?: RoomLocalBotOptions): Promise<RoomBotLocalClient<S, I, O, M>>;
|
|
763
|
+
get failure(): RoomBotNetworkFailure | null;
|
|
764
|
+
get isClosed(): boolean;
|
|
765
|
+
isCurrent(): boolean;
|
|
766
|
+
snapshot(): RoomBotBrainSnapshot<(M)["Type"]>;
|
|
767
|
+
turn(): ReadonlyArray<number>;
|
|
768
|
+
fence(): void;
|
|
769
|
+
/** Cleanup failures keep the exact lease for another cleanup attempt. Prior
|
|
770
|
+
* decision failure remains in failure; successful cleanup does not erase it. */
|
|
771
|
+
close(): Promise<void>;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
export declare interface RoomBotNavGrid {
|
|
775
|
+
readonly width: number;
|
|
776
|
+
readonly height: number;
|
|
777
|
+
path(start: RoomBotVector, destination: RoomBotVector, maxVisited?: number): ReadonlyArray<RoomBotVector> | null;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/** Explicitly driven load/test client over the ordinary RoomConnection. It
|
|
781
|
+
* borrows that connection, reads only its delivered projection and submits
|
|
782
|
+
* intentions through its normal input/reconnect history. A failed send is an
|
|
783
|
+
* uncertain outcome: retain the failure and never assign a replacement input
|
|
784
|
+
* sequence. The connection itself may replay its original pending sequence. */
|
|
785
|
+
export declare class RoomBotNetworkClient<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, M extends Schema.Codec<unknown, unknown>, JoinInput> {
|
|
786
|
+
private readonly connection;
|
|
787
|
+
private readonly brain;
|
|
788
|
+
private readonly now;
|
|
789
|
+
private readonly send;
|
|
790
|
+
private readonly interval;
|
|
791
|
+
private readonly difficulty;
|
|
792
|
+
private nextSendAt;
|
|
793
|
+
private lastTime;
|
|
794
|
+
private current;
|
|
795
|
+
private stopped;
|
|
796
|
+
private failed;
|
|
797
|
+
private submitted;
|
|
798
|
+
constructor(connection: RoomConnection<S, I, JoinInput>, descriptor: RoomBotDescriptor<S, I, M>, rng: RoomBotRandom, clock: RoomClock, options: RoomBotNetworkOptions);
|
|
799
|
+
get failure(): RoomBotNetworkFailure | null;
|
|
800
|
+
/** Submitted counts are local completed sends, never applied ACKs/throughput. */
|
|
801
|
+
metrics(): {
|
|
802
|
+
readonly submitted: number;
|
|
803
|
+
readonly stopped: boolean;
|
|
804
|
+
readonly failed: boolean;
|
|
805
|
+
};
|
|
806
|
+
snapshot(): RoomBotBrainSnapshot<(M)["Type"]>;
|
|
807
|
+
turn(): Promise<ReadonlyArray<number>>;
|
|
808
|
+
private execute;
|
|
809
|
+
/** Fencing prevents another decision/send; an already accepted send is awaited.
|
|
810
|
+
* Closing this borrowed wrapper never closes the app-owned connection. */
|
|
811
|
+
fence(): void;
|
|
812
|
+
close(): Promise<void>;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
export declare interface RoomBotNetworkFailure {
|
|
816
|
+
readonly tick: number;
|
|
817
|
+
readonly intentionIndex: number | null;
|
|
818
|
+
readonly cause: unknown;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
export declare interface RoomBotNetworkOptions {
|
|
822
|
+
readonly sendRate: number;
|
|
823
|
+
readonly difficulty?: number;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
export declare type RoomBotRandom = () => number;
|
|
827
|
+
|
|
828
|
+
export declare interface RoomBotUtilityAction<C, A> {
|
|
829
|
+
readonly id: string;
|
|
830
|
+
readonly action: A;
|
|
831
|
+
readonly score: (context: C) => number;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
export declare interface RoomBotVector {
|
|
835
|
+
readonly x: number;
|
|
836
|
+
readonly y: number;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
declare interface RoomBudgets {
|
|
840
|
+
readonly inputsPerSecond: number;
|
|
841
|
+
readonly bytesPerSecond: number;
|
|
842
|
+
readonly burst: number;
|
|
843
|
+
readonly maxQueuedInputs: number;
|
|
844
|
+
readonly maxOutboxCommands: number;
|
|
845
|
+
readonly maxScheduledHooks: number;
|
|
846
|
+
readonly maxQueuedLifecycleHooks: number;
|
|
847
|
+
readonly maxNpcs: number;
|
|
848
|
+
/** A player input acting on state older than this many milliseconds behind the newest state
|
|
849
|
+
* the Host sent that client is dropped (it arrived too late to apply fairly). */
|
|
850
|
+
readonly inputLatencyBudgetMs: number;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
declare interface RoomChannel {
|
|
854
|
+
readonly schema: Schema.Codec<unknown, unknown>;
|
|
855
|
+
readonly direction: 'both' | 'server' | 'client';
|
|
856
|
+
readonly reliable: boolean;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
declare interface RoomClient {
|
|
860
|
+
readonly sessionId: string;
|
|
861
|
+
readonly subjectId: string | null;
|
|
862
|
+
readonly tenantId: string;
|
|
863
|
+
/** App data the API resolved for this seat (`seatAttributes` on the Rooms API binding), signed into
|
|
864
|
+
* the seat; absent without one. Not a secret from the player: it travels in their seat token. */
|
|
865
|
+
readonly attributes?: RoomSeatAttributes | undefined;
|
|
866
|
+
/** Actor-owned classification, never accepted from a socket input. */
|
|
867
|
+
readonly isBot?: boolean | undefined;
|
|
868
|
+
readonly countsAsPlayer?: boolean | undefined;
|
|
869
|
+
send(channel: string, payload: unknown): void;
|
|
870
|
+
kick(reason: string): void;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/** API-facing reservation result. Credentials are retained only for Hello. */
|
|
874
|
+
declare interface RoomClientReservation {
|
|
875
|
+
readonly roomId: string;
|
|
876
|
+
readonly sessionId: string;
|
|
877
|
+
readonly token: Uint8Array;
|
|
878
|
+
readonly address: string;
|
|
879
|
+
readonly expiresAt: number;
|
|
880
|
+
readonly endpoints?: RoomTransportEndpoints | undefined;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
declare interface RoomClock {
|
|
884
|
+
now(): number;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
declare type RoomClockPingCadence = (joinedForMs: number) => number;
|
|
888
|
+
|
|
889
|
+
declare interface RoomClockSamplingOptions {
|
|
890
|
+
readonly maxPendingPings: number;
|
|
891
|
+
readonly pingTimeoutMs: number;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/** Framework-free reserve -> transport -> Hello orchestration. It preserves
|
|
895
|
+
* the last authoritative state during reconnect and never writes a token to
|
|
896
|
+
* persistent storage. RPC facade/platform/render-hook integration is pending. */
|
|
897
|
+
declare class RoomConnection<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, JoinInput> {
|
|
898
|
+
readonly manifest: RoomWireManifest<S, I>;
|
|
899
|
+
readonly clock: RoomClock;
|
|
900
|
+
readonly reservations: RoomReservationClient<JoinInput>;
|
|
901
|
+
readonly connect: (address: string, signal: AbortSignal, endpoints?: RoomTransportEndpoints) => Promise<RoomTransport>;
|
|
902
|
+
private readonly controller;
|
|
903
|
+
private readonly listeners;
|
|
904
|
+
private readonly buffered;
|
|
905
|
+
private readonly pendingInputs;
|
|
906
|
+
private readonly options;
|
|
907
|
+
private session;
|
|
908
|
+
private handoffDetach;
|
|
909
|
+
private readonly handoffListeners;
|
|
910
|
+
private sessionDetach;
|
|
911
|
+
private currentState;
|
|
912
|
+
private currentStatus;
|
|
913
|
+
private currentError;
|
|
914
|
+
private reconnectTask;
|
|
915
|
+
private startTask;
|
|
916
|
+
private started;
|
|
917
|
+
private leaving;
|
|
918
|
+
private lastSessionId;
|
|
919
|
+
private lastTick;
|
|
920
|
+
private nextSeq;
|
|
921
|
+
private appliedSeq;
|
|
922
|
+
private clockTimer;
|
|
923
|
+
private readonly messageListeners;
|
|
924
|
+
private readonly messageDetach;
|
|
925
|
+
private reservation;
|
|
926
|
+
private readonly cleanupTasks;
|
|
927
|
+
private readonly cleanupFailures;
|
|
928
|
+
private pendingReservationCalls;
|
|
929
|
+
private pendingTransportCalls;
|
|
930
|
+
private readonly transportOwners;
|
|
931
|
+
private readonly transportLifetimes;
|
|
932
|
+
private withdrawalAttempted;
|
|
933
|
+
private leaveTask;
|
|
934
|
+
private left;
|
|
935
|
+
constructor(manifest: RoomWireManifest<S, I>, clock: RoomClock, reservations: RoomReservationClient<JoinInput>, connect: (address: string, signal: AbortSignal, endpoints?: RoomTransportEndpoints) => Promise<RoomTransport>, options: RoomConnectionOptions);
|
|
936
|
+
/* Excluded from this release type: captureGeometrySession */
|
|
937
|
+
/** `waking`: the pool scaled to zero and is starting a host; entry continues on its own. */
|
|
938
|
+
get status(): RoomSessionStatus | 'reserving' | 'waking';
|
|
939
|
+
get error(): unknown;
|
|
940
|
+
get state(): (S)["Type"] | null;
|
|
941
|
+
get id(): string | null;
|
|
942
|
+
/** Reserved Room identity, without exposing its seat credential. */
|
|
943
|
+
get roomId(): string | null;
|
|
944
|
+
get lastAppliedTick(): number;
|
|
945
|
+
get lastAppliedInputSeq(): number;
|
|
946
|
+
/** Exact current-session pairing; epoch changes need prediction reset. */
|
|
947
|
+
get reconciliationSnapshot(): RoomReconciliationSnapshot<(S)["Type"]> | null;
|
|
948
|
+
deliveredSnapshot(): RoomDeliveredState<(S)["Type"]> | null;
|
|
949
|
+
clockStats(): {
|
|
950
|
+
readonly rttMs: number | null;
|
|
951
|
+
readonly offsetMs: number | null;
|
|
952
|
+
};
|
|
953
|
+
serverNow(): number | null;
|
|
954
|
+
/** The current session's estimated datagram loss (0–1), null until measured. */
|
|
955
|
+
get lossRate(): number | null;
|
|
956
|
+
subscribe(listener: () => void): () => void;
|
|
957
|
+
private notify;
|
|
958
|
+
private active;
|
|
959
|
+
start(input: JoinInput): Promise<void>;
|
|
960
|
+
private attempt;
|
|
961
|
+
private install;
|
|
962
|
+
private waitForJoin;
|
|
963
|
+
private beginReconnect;
|
|
964
|
+
send(input: (I)["Type"]): Promise<number>;
|
|
965
|
+
private submit;
|
|
966
|
+
message(channel: string, payload: unknown): Promise<void>;
|
|
967
|
+
onWorldHandoff(listener: (frame: RoomWorldHandoffFrame) => void): () => void;
|
|
968
|
+
onMessage(channel: string, listener: (payload: unknown) => void): () => void;
|
|
969
|
+
private attachMessages;
|
|
970
|
+
private requestReservation;
|
|
971
|
+
private releaseReservation;
|
|
972
|
+
private stopClockSampling;
|
|
973
|
+
private releaseTransport;
|
|
974
|
+
private retainTransport;
|
|
975
|
+
private runTransportCleanup;
|
|
976
|
+
private startClockSampling;
|
|
977
|
+
private terminal;
|
|
978
|
+
leave(): Promise<void>;
|
|
979
|
+
private withdraw;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
declare interface RoomConnectionOptions {
|
|
983
|
+
readonly graceMs: number;
|
|
984
|
+
readonly maxBufferedInputs?: number;
|
|
985
|
+
readonly maxPendingInputs?: number;
|
|
986
|
+
readonly initialBackoffMs?: number;
|
|
987
|
+
readonly maxBackoffMs?: number;
|
|
988
|
+
readonly connectTimeoutMs?: number;
|
|
989
|
+
readonly random?: () => number;
|
|
990
|
+
readonly sleep?: (milliseconds: number, signal: AbortSignal) => Promise<void>;
|
|
991
|
+
readonly reconnectPolicy?: RoomReconnectPolicy;
|
|
992
|
+
readonly clockSampling?: RoomClockSamplingOptions;
|
|
993
|
+
readonly inputRedundancy?: RoomInputRedundancyOptions;
|
|
994
|
+
readonly clockPingCadence?: RoomClockPingCadence;
|
|
995
|
+
readonly maxPendingReservationCalls?: number;
|
|
996
|
+
readonly maxCleanupFailures?: number;
|
|
997
|
+
readonly maxPendingTransportCalls?: number;
|
|
998
|
+
/** How long entry keeps waiting while a scaled-to-zero pool starts a host (`RoomPoolWaking`). Default 180000. */
|
|
999
|
+
readonly wakeTimeoutMs?: number;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
declare interface RoomConsumedSeat {
|
|
1003
|
+
readonly lastAppliedSeq: number;
|
|
1004
|
+
readonly discardedThrough?: number;
|
|
1005
|
+
readonly worldTarget?: WorldTargetSeatBinding;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
declare interface RoomDatagramLane {
|
|
1009
|
+
readonly maxDatagramBytes: number;
|
|
1010
|
+
send(frame: Uint8Array): void;
|
|
1011
|
+
onFrame(listener: (frame: Uint8Array, receivedAt: number) => void): () => void;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
declare interface RoomDefinition<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
1015
|
+
readonly name: string;
|
|
1016
|
+
readonly mode?: 'state-sync';
|
|
1017
|
+
readonly state: S;
|
|
1018
|
+
readonly auth?: 'subject' | 'public';
|
|
1019
|
+
readonly guards?: DeclaredAccess;
|
|
1020
|
+
readonly openAccess?: string | undefined;
|
|
1021
|
+
readonly input: I;
|
|
1022
|
+
readonly options: O;
|
|
1023
|
+
/** Author-owned initial state; no game values are guessed by the host. */
|
|
1024
|
+
readonly initialState?: (options: (O)["Type"]) => (S)["Type"];
|
|
1025
|
+
readonly tickRate?: number;
|
|
1026
|
+
readonly sendRate?: number;
|
|
1027
|
+
readonly maxClients?: number;
|
|
1028
|
+
readonly maxCatchUpTicks?: number;
|
|
1029
|
+
readonly lifecycleTimeoutMs?: number;
|
|
1030
|
+
readonly budgets?: Partial<RoomBudgets>;
|
|
1031
|
+
readonly strategies?: RoomAuthoringStrategies<(S)["Type"]> | undefined;
|
|
1032
|
+
readonly reconnect?: {
|
|
1033
|
+
readonly graceMs: number;
|
|
1034
|
+
};
|
|
1035
|
+
readonly autoDispose?: {
|
|
1036
|
+
readonly afterEmptyMs: number;
|
|
1037
|
+
readonly hibernate?: boolean;
|
|
1038
|
+
};
|
|
1039
|
+
readonly snapshot?: Partial<RoomSnapshotPolicy<(S)["Type"]>>;
|
|
1040
|
+
/** Opt-in shared history; host must supply the actual common view/admission. */
|
|
1041
|
+
readonly spectator?: Partial<RoomSpectatorPolicy> | undefined;
|
|
1042
|
+
readonly messages?: Readonly<Record<string, RoomChannel>>;
|
|
1043
|
+
readonly view?: (context: RoomViewContext<(S)["Type"]>) => (S)["Type"];
|
|
1044
|
+
readonly viewBudgetMs?: number;
|
|
1045
|
+
/** How the Room appears in `rooms.list`, derived from its state: `private` takes it off the list
|
|
1046
|
+
* (it stays joinable by ID), `locked` refuses every new seat, `metadata` is shown to listers.
|
|
1047
|
+
* Omitted fields keep their current value. The Host writes a change with the next checkpoint,
|
|
1048
|
+
* which a change triggers at once. Synchronous and pure, like `view`. */
|
|
1049
|
+
readonly listing?: (context: RoomListingContext<(S)["Type"], (O)["Type"]>) => RoomListing;
|
|
1050
|
+
readonly extensions?: ReadonlyArray<RoomExtension<(S)["Type"], (I)["Type"]>>;
|
|
1051
|
+
readonly world?: RoomWorldHooks<(S)["Type"]> | undefined;
|
|
1052
|
+
readonly onCreate?: RoomSyncHook<Omit<RoomMemberContext<(S)["Type"], (O)["Type"]>, 'client'>>;
|
|
1053
|
+
readonly onRehydrate?: RoomSyncHook<Omit<RoomMemberContext<(S)["Type"], (O)["Type"]>, 'client'>>;
|
|
1054
|
+
readonly onJoin?: RoomLifecycleHook<RoomMemberContext<(S)["Type"], (O)["Type"]>>;
|
|
1055
|
+
readonly onLeave?: RoomLifecycleHook<RoomMemberContext<(S)["Type"], (O)["Type"]> & {
|
|
1056
|
+
readonly reason: RoomLeaveReason;
|
|
1057
|
+
}>;
|
|
1058
|
+
readonly onTick: RoomSyncHook<RoomTickContext<(S)["Type"], (I)["Type"]>>;
|
|
1059
|
+
readonly onSchedule?: RoomSyncHook<RoomTickContext<(S)["Type"], (I)["Type"]> & {
|
|
1060
|
+
readonly label: string;
|
|
1061
|
+
}>;
|
|
1062
|
+
readonly onDispose?: RoomLifecycleHook<{
|
|
1063
|
+
readonly state: RoomState<(S)["Type"]> | undefined;
|
|
1064
|
+
readonly app: RoomAppBridge;
|
|
1065
|
+
readonly geometry?: GeometryWorldView;
|
|
1066
|
+
}> | undefined;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
declare interface RoomDeliveredState<S> {
|
|
1070
|
+
readonly epoch: number;
|
|
1071
|
+
readonly tick: number;
|
|
1072
|
+
/** Local transport observation, not an authoritative server timestamp. */
|
|
1073
|
+
readonly receivedAt: number;
|
|
1074
|
+
readonly state: S;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
declare interface RoomDescriptor<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> extends RoomDefinition<S, I, O> {
|
|
1078
|
+
readonly _tag: 'RoomDescriptor';
|
|
1079
|
+
readonly auth: 'subject' | 'public';
|
|
1080
|
+
readonly guards: DeclaredAccess;
|
|
1081
|
+
readonly tickRate: number;
|
|
1082
|
+
readonly sendRate: number;
|
|
1083
|
+
readonly maxClients: number;
|
|
1084
|
+
readonly maxCatchUpTicks: number;
|
|
1085
|
+
readonly lifecycleTimeoutMs: number;
|
|
1086
|
+
readonly budgets: RoomBudgets;
|
|
1087
|
+
readonly view: (context: RoomViewContext<(S)["Type"]>) => (S)["Type"];
|
|
1088
|
+
readonly reconnect: {
|
|
1089
|
+
readonly graceMs: number;
|
|
1090
|
+
};
|
|
1091
|
+
readonly autoDispose: {
|
|
1092
|
+
readonly afterEmptyMs: number;
|
|
1093
|
+
readonly hibernate: boolean;
|
|
1094
|
+
};
|
|
1095
|
+
readonly snapshot: RoomSnapshotPolicy<(S)["Type"]>;
|
|
1096
|
+
readonly spectator?: RoomSpectatorPolicy | undefined;
|
|
1097
|
+
readonly messages: Readonly<Record<string, RoomChannel>>;
|
|
1098
|
+
readonly viewBudgetMs: number;
|
|
1099
|
+
readonly extensions: ReadonlyArray<RoomExtension<(S)["Type"], (I)["Type"]>>;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
declare interface RoomExtension<S, I> {
|
|
1103
|
+
readonly name: string;
|
|
1104
|
+
readonly fields: ReadonlyArray<Extract<keyof S, string>>;
|
|
1105
|
+
readonly channel: string;
|
|
1106
|
+
readonly tickBudgetMs: number;
|
|
1107
|
+
readonly beforeTick?: RoomSyncHook<RoomExtensionContext<S, I>>;
|
|
1108
|
+
readonly afterTick?: RoomSyncHook<RoomExtensionContext<S, I>>;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
declare interface RoomExtensionContext<S, I> {
|
|
1112
|
+
/** Prepared native CPU queries only, installed before actor lifecycle. */
|
|
1113
|
+
readonly geometry?: GeometryWorldView | undefined;
|
|
1114
|
+
readonly state: RoomState<Partial<S>>;
|
|
1115
|
+
readonly tick: number;
|
|
1116
|
+
readonly dt: number;
|
|
1117
|
+
readonly inputs: ReadonlyArray<Omit<RoomInput<I>, 'client'> & {
|
|
1118
|
+
readonly client: Pick<RoomClient, 'sessionId' | 'subjectId' | 'tenantId' | 'isBot' | 'countsAsPlayer' | 'attributes'>;
|
|
1119
|
+
}>;
|
|
1120
|
+
readonly clock: RoomClock;
|
|
1121
|
+
send(sessionId: string, payload: unknown): void;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
declare interface RoomInput<I> {
|
|
1125
|
+
readonly client: RoomClient;
|
|
1126
|
+
readonly seq: number;
|
|
1127
|
+
readonly tickHint: number;
|
|
1128
|
+
readonly input: I;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/** Captured outside the tick and stored with the exact state it describes. */
|
|
1132
|
+
declare interface RoomInputReceipt {
|
|
1133
|
+
readonly sessionId: string;
|
|
1134
|
+
readonly subjectId: string | null;
|
|
1135
|
+
readonly lastAppliedSeq: number;
|
|
1136
|
+
/** Intentionally discarded pending World input; never an applied ACK. */
|
|
1137
|
+
readonly discardedThrough?: number;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
declare interface RoomInputRedundancyOptions {
|
|
1141
|
+
/** Input count is a redundancy budget, never a delivery guarantee. */
|
|
1142
|
+
readonly inputRedundancy: number;
|
|
1143
|
+
readonly maxInputHistoryBytes: number;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
declare type RoomLeaveReason = 'left' | 'kicked' | 'reconnecting' | 'timeout' | 'disposed';
|
|
1147
|
+
|
|
1148
|
+
/** Lifecycle Effects are run by the host outside the synchronous tick. `void` admits block bodies;
|
|
1149
|
+
* a returned Promise is refused at runtime with an authoring error. */
|
|
1150
|
+
declare type RoomLifecycleHook<C> = (context: C) => void | Effect.Effect<void, unknown>;
|
|
1151
|
+
|
|
1152
|
+
/** A Room's own listing; scalar metadata only, at most 16 keys and 2 KiB. */
|
|
1153
|
+
declare interface RoomListing {
|
|
1154
|
+
readonly metadata?: Readonly<Record<string, RoomScalar>>;
|
|
1155
|
+
readonly private?: boolean;
|
|
1156
|
+
readonly locked?: boolean;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
declare interface RoomListingContext<S, O> {
|
|
1160
|
+
readonly state: S;
|
|
1161
|
+
readonly options: O;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
export declare type RoomLocalBotIdentity = Pick<RoomClient, 'sessionId' | 'subjectId' | 'tenantId'>;
|
|
1165
|
+
|
|
1166
|
+
export declare interface RoomLocalBotOptions {
|
|
1167
|
+
readonly sendRate?: number;
|
|
1168
|
+
readonly difficulty?: number;
|
|
1169
|
+
readonly countsAsPlayer?: boolean | undefined;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
declare interface RoomMemberContext<S, O> {
|
|
1173
|
+
/** Prepared native CPU queries only, installed before actor lifecycle. */
|
|
1174
|
+
readonly geometry?: GeometryWorldView | undefined;
|
|
1175
|
+
readonly state: RoomState<S>;
|
|
1176
|
+
readonly options: O;
|
|
1177
|
+
readonly client: RoomClient;
|
|
1178
|
+
readonly app: RoomAppBridge;
|
|
1179
|
+
readonly clock: RoomClock;
|
|
1180
|
+
readonly scheduler: RoomScheduler;
|
|
1181
|
+
/** World Rooms, ordinary player join: the server-owned entity this Session controls and
|
|
1182
|
+
* its last persisted `persistEntity` data. Build the state entity from it when absent. */
|
|
1183
|
+
readonly world?: RoomWorldMember | undefined;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
declare interface RoomOutboxCommand {
|
|
1187
|
+
readonly requestId: string;
|
|
1188
|
+
readonly kind: 'publish' | 'run';
|
|
1189
|
+
readonly name: string;
|
|
1190
|
+
readonly payload: unknown;
|
|
1191
|
+
readonly key?: string;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
/** Framework-free binary session core. Reservation, reconnect orchestration and
|
|
1195
|
+
* render hooks are separate; this core never persists a seat token. */
|
|
1196
|
+
declare interface RoomReconciliationSnapshot<S> {
|
|
1197
|
+
readonly epoch: number;
|
|
1198
|
+
readonly tick: number;
|
|
1199
|
+
readonly lastAppliedSeq: number;
|
|
1200
|
+
readonly state: S;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
declare type RoomReconnectPolicy = (input: RoomReconnectPolicyInput) => number;
|
|
1204
|
+
|
|
1205
|
+
declare interface RoomReconnectPolicyInput {
|
|
1206
|
+
readonly attempt: number;
|
|
1207
|
+
readonly initialBackoffMs: number;
|
|
1208
|
+
readonly maxBackoffMs: number;
|
|
1209
|
+
readonly remainingMs: number;
|
|
1210
|
+
readonly random: number;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
declare interface RoomReliableLane {
|
|
1214
|
+
send(frame: Uint8Array): Promise<void>;
|
|
1215
|
+
onFrame(listener: (frame: Uint8Array, receivedAt: number) => void): () => void;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
declare interface RoomReservationClient<JoinInput> {
|
|
1219
|
+
reserve(input: JoinInput, signal: AbortSignal): Promise<RoomClientReservation>;
|
|
1220
|
+
resume(sessionId: string, signal: AbortSignal): Promise<RoomClientReservation>;
|
|
1221
|
+
release?(sessionId: string, token: Uint8Array, signal: AbortSignal): Promise<void>;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
declare type RoomScalar = string | number | boolean | null;
|
|
1225
|
+
|
|
1226
|
+
declare interface RoomScheduler {
|
|
1227
|
+
after(milliseconds: number, label: string): void;
|
|
1228
|
+
every(milliseconds: number, label: string): void;
|
|
1229
|
+
cancel(label: string): void;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
declare interface RoomScheduleSnapshot {
|
|
1233
|
+
readonly label: string;
|
|
1234
|
+
readonly remainingMs: number;
|
|
1235
|
+
readonly intervalMs: number | null;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
/** App data for one seat, resolved by the API when the seat is reserved (`seatAttributes`) and signed
|
|
1239
|
+
* into it; scalars only, at most 16 keys and 2 KiB. */
|
|
1240
|
+
declare type RoomSeatAttributes = Readonly<Record<string, RoomScalar>>;
|
|
1241
|
+
|
|
1242
|
+
declare type RoomSessionStatus = 'connecting' | 'joined' | 'reconnecting' | 'left' | 'kicked' | 'gone';
|
|
1243
|
+
|
|
1244
|
+
declare interface RoomSnapshotPolicy<S> {
|
|
1245
|
+
readonly everyMs: number;
|
|
1246
|
+
readonly onlyIfChanged: boolean;
|
|
1247
|
+
readonly mode: 'full' | 'delta';
|
|
1248
|
+
readonly fullEvery: number;
|
|
1249
|
+
readonly keepFulls: number;
|
|
1250
|
+
readonly store: 'auto';
|
|
1251
|
+
/** Maximum inline codec payload; the host may impose a smaller cutoff. */
|
|
1252
|
+
readonly maxInlineBytes: number;
|
|
1253
|
+
/** Full-schema projection of volatile data; never a partial-state format. */
|
|
1254
|
+
readonly pick: (state: S) => S;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
declare interface RoomSpectatorPolicy {
|
|
1258
|
+
readonly delayMs: number;
|
|
1259
|
+
readonly retentionMs: number;
|
|
1260
|
+
readonly maxFrames: number;
|
|
1261
|
+
readonly maxBytes: number;
|
|
1262
|
+
readonly maxFrameBytes: number;
|
|
1263
|
+
readonly checkpointEveryMs: number;
|
|
1264
|
+
readonly maxDeliveryFrames: number;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/** Plain mutable state; the author receives no store or database capability. */
|
|
1268
|
+
declare type RoomState<A> = A extends ReadonlyArray<infer V> ? Array<RoomState<V>> : A extends object ? {
|
|
1269
|
+
-readonly [K in keyof A]: RoomState<A[K]>;
|
|
1270
|
+
} : A;
|
|
1271
|
+
|
|
1272
|
+
/** Synchronous hook. `void` admits parameterless block bodies (TypeScript cannot narrow those to
|
|
1273
|
+
* `undefined`); any returned value, a Promise included, is refused at runtime with an authoring error. */
|
|
1274
|
+
declare type RoomSyncHook<C> = (context: C) => void;
|
|
1275
|
+
|
|
1276
|
+
declare interface RoomTickContext<S, I> {
|
|
1277
|
+
/** Prepared native CPU queries only, installed before actor lifecycle. */
|
|
1278
|
+
readonly geometry?: GeometryWorldView | undefined;
|
|
1279
|
+
readonly state: RoomState<S>;
|
|
1280
|
+
readonly tick: number;
|
|
1281
|
+
readonly dt: number;
|
|
1282
|
+
readonly inputs: ReadonlyArray<RoomInput<I>>;
|
|
1283
|
+
readonly app: RoomAppBridge;
|
|
1284
|
+
readonly clock: RoomClock;
|
|
1285
|
+
readonly scheduler: RoomScheduler;
|
|
1286
|
+
broadcast(channel: string, payload: unknown): void;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
declare interface RoomTransport {
|
|
1290
|
+
readonly name: 'ws' | 'wt';
|
|
1291
|
+
readonly reliable: RoomReliableLane;
|
|
1292
|
+
readonly unreliable?: RoomDatagramLane | undefined;
|
|
1293
|
+
readonly signal: AbortSignal;
|
|
1294
|
+
stats(): {
|
|
1295
|
+
readonly rttMs: number | null;
|
|
1296
|
+
readonly queuedBytes: number;
|
|
1297
|
+
readonly droppedDatagrams: number;
|
|
1298
|
+
};
|
|
1299
|
+
close(code: number, reason: string): void;
|
|
1300
|
+
/** When provided, joins actual parent/stream withdrawal and permits retry.
|
|
1301
|
+
* Synchronous close alone does not establish native terminal evidence. */
|
|
1302
|
+
closeAsync?(code: number, reason: string): Promise<void>;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
/** Public routing metadata only. Neither endpoint conveys seat authority. */
|
|
1306
|
+
declare interface RoomTransportEndpoints {
|
|
1307
|
+
readonly ws: string;
|
|
1308
|
+
readonly wt?: string | undefined;
|
|
1309
|
+
/** Base64 SHA-256 of a short-lived development certificate the browser pins
|
|
1310
|
+
* through `serverCertificateHashes`. Absent for a publicly trusted certificate. */
|
|
1311
|
+
readonly wtCertificateHash?: string | undefined;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
declare interface RoomViewContext<S> {
|
|
1315
|
+
readonly state: S;
|
|
1316
|
+
readonly client: Pick<RoomClient, 'sessionId' | 'subjectId' | 'tenantId' | 'isBot' | 'countsAsPlayer' | 'attributes'>;
|
|
1317
|
+
readonly role: 'player' | 'spectator';
|
|
1318
|
+
readonly tick: number;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
declare interface RoomWireManifest<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> {
|
|
1322
|
+
readonly state: S;
|
|
1323
|
+
readonly input: I;
|
|
1324
|
+
readonly messages?: Readonly<Record<string, RoomChannel>>;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
/** World Rooms keep their authored entities in the declared state record. */
|
|
1328
|
+
declare type RoomWorldEntity<S> = S extends {
|
|
1329
|
+
readonly entities: Readonly<Record<string, infer E>>;
|
|
1330
|
+
} ? RoomState<E> & {
|
|
1331
|
+
readonly id: string;
|
|
1332
|
+
} : never;
|
|
1333
|
+
|
|
1334
|
+
/** Render/connection coordination only: no token and no ownership assertion. */
|
|
1335
|
+
declare interface RoomWorldHandoffFrame {
|
|
1336
|
+
readonly kind: 'WorldHandoff';
|
|
1337
|
+
readonly phase: 'departed' | 'cancelled';
|
|
1338
|
+
readonly transitionId: string;
|
|
1339
|
+
readonly entityId: string;
|
|
1340
|
+
readonly tick: number;
|
|
1341
|
+
readonly sourceEpoch: number;
|
|
1342
|
+
readonly targetRoomId: string;
|
|
1343
|
+
readonly targetEpoch: number;
|
|
1344
|
+
readonly holdMs: number;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
declare interface RoomWorldHookContext<S> {
|
|
1348
|
+
readonly state: RoomState<S>;
|
|
1349
|
+
readonly phase: 'prepare' | 'commit' | 'rollback';
|
|
1350
|
+
readonly requestId?: string | undefined;
|
|
1351
|
+
readonly entity: RoomWorldEntity<S>;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
declare interface RoomWorldHookInput<E = unknown> {
|
|
1355
|
+
/** Actual target placement, distinct from the source location. Only guarded
|
|
1356
|
+
* target entry uses it; source rollback must restore its exact snapshot. */
|
|
1357
|
+
readonly arrival?: WorldEntityLocation;
|
|
1358
|
+
readonly epoch: number;
|
|
1359
|
+
readonly entity: E;
|
|
1360
|
+
readonly location: WorldEntityLocation;
|
|
1361
|
+
readonly requestId?: string | undefined;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
declare interface RoomWorldHooks<S> {
|
|
1365
|
+
/** Opt-in cell movement: synchronous author projection/write, no I/O. */
|
|
1366
|
+
readonly movement?: RoomWorldMovement<S>;
|
|
1367
|
+
/** Retained checkpoint receipts awaiting confirmed transition retirement. */
|
|
1368
|
+
readonly maxPendingTransitions?: number;
|
|
1369
|
+
readonly onEnter: RoomLifecycleHook<RoomWorldHookContext<S> & {
|
|
1370
|
+
readonly from: WorldEntityLocation;
|
|
1371
|
+
readonly to?: WorldEntityLocation;
|
|
1372
|
+
}>;
|
|
1373
|
+
readonly onExit: RoomLifecycleHook<RoomWorldHookContext<S> & {
|
|
1374
|
+
readonly to: WorldEntityLocation;
|
|
1375
|
+
}>;
|
|
1376
|
+
/** Publish a projection on commit; remove that projection on rollback. Never
|
|
1377
|
+
* promote it into authoritative entities. Rollback may retry after failure. */
|
|
1378
|
+
readonly onGhost: RoomLifecycleHook<RoomWorldHookContext<S>>;
|
|
1379
|
+
/** Synchronous, bounded JSON projection; no SQL or asynchronous effect here. */
|
|
1380
|
+
readonly persistEntity: (context: {
|
|
1381
|
+
readonly entity: RoomWorldEntity<S>;
|
|
1382
|
+
}) => unknown;
|
|
1383
|
+
/** A player who arrived by a World transition is now an active member. `onJoin` does not run for
|
|
1384
|
+
* such arrivals (the entity came with `onEnter`); this is where the Room sees the arriving client,
|
|
1385
|
+
* e.g. its seat attributes (`client.attributes`). */
|
|
1386
|
+
readonly onMemberEnter?: RoomLifecycleHook<{
|
|
1387
|
+
readonly state: RoomState<S>;
|
|
1388
|
+
readonly client: RoomClient;
|
|
1389
|
+
readonly entityId: string;
|
|
1390
|
+
}>;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
/** The server-owned entity an ordinary World player Session controls, as last persisted.
|
|
1394
|
+
* The Room's `onJoin` receives it as `world` and builds the state entity when absent. */
|
|
1395
|
+
declare interface RoomWorldMember {
|
|
1396
|
+
readonly entityId: string;
|
|
1397
|
+
readonly worldId: string;
|
|
1398
|
+
readonly zoneId: string;
|
|
1399
|
+
readonly cellId: string;
|
|
1400
|
+
readonly layer: number;
|
|
1401
|
+
readonly revision: number;
|
|
1402
|
+
/** The Room's `persistEntity` projection from the entity's last write. */
|
|
1403
|
+
readonly data: unknown;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
declare interface RoomWorldMovement<S> {
|
|
1407
|
+
readonly maxEntities: number;
|
|
1408
|
+
readonly maxBytesPerTick: number;
|
|
1409
|
+
readonly position: (entity: RoomWorldEntity<S>) => WorldPoint;
|
|
1410
|
+
readonly move: (entity: RoomWorldEntity<S>, at: WorldPoint) => void;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
declare interface RoomWorldReceipt {
|
|
1414
|
+
readonly requestId: string;
|
|
1415
|
+
readonly operation: 'enter' | 'exit' | 'ghost';
|
|
1416
|
+
readonly fingerprint: string;
|
|
1417
|
+
readonly projection?: {
|
|
1418
|
+
readonly entity: unknown;
|
|
1419
|
+
readonly location: WorldEntityLocation;
|
|
1420
|
+
readonly expiresAt?: number;
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/** Returns an intention vector, never a claimed authoritative position. */
|
|
1425
|
+
export declare const steer: Readonly<{
|
|
1426
|
+
seek: (from: RoomBotVector, to: RoomBotVector, magnitude?: number) => RoomBotVector;
|
|
1427
|
+
flee: (from: RoomBotVector, threat: RoomBotVector, magnitude?: number) => RoomBotVector;
|
|
1428
|
+
wander: (headingDegrees: number, maxTurnDegrees: number, rng: RoomBotRandom, magnitude?: number) => {
|
|
1429
|
+
readonly headingDegrees: number;
|
|
1430
|
+
readonly intention: RoomBotVector;
|
|
1431
|
+
};
|
|
1432
|
+
}>;
|
|
1433
|
+
|
|
1434
|
+
declare const Transform2D: Schema.Struct<{
|
|
1435
|
+
readonly x: Schema.Number;
|
|
1436
|
+
readonly y: Schema.Number;
|
|
1437
|
+
readonly rot: Schema.Number;
|
|
1438
|
+
readonly vx: Schema.optional<Schema.Number>;
|
|
1439
|
+
readonly vy: Schema.optional<Schema.Number>;
|
|
1440
|
+
}>;
|
|
1441
|
+
|
|
1442
|
+
declare type Transform2D = (typeof Transform2D)["Type"];
|
|
1443
|
+
|
|
1444
|
+
/** Stable configuration order breaks ties; scorer failures do not choose an
|
|
1445
|
+
* arbitrary action. Actual behavior owns interpretation of the returned data. */
|
|
1446
|
+
export declare const utilityAI: <C, A>(input: {
|
|
1447
|
+
readonly actions: ReadonlyArray<RoomBotUtilityAction<C, A>>;
|
|
1448
|
+
}) => ((context: C) => A | null);
|
|
1449
|
+
|
|
1450
|
+
declare type WorldBounds = readonly [minimum: WorldPoint, maximum: WorldPoint];
|
|
1451
|
+
|
|
1452
|
+
declare interface WorldEntityLocation {
|
|
1453
|
+
readonly worldId: string;
|
|
1454
|
+
readonly zoneId: string;
|
|
1455
|
+
readonly at: WorldPoint;
|
|
1456
|
+
readonly layer: number;
|
|
1457
|
+
readonly roomId: string;
|
|
1458
|
+
readonly epoch: number;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
declare interface WorldMovementIntent {
|
|
1462
|
+
readonly entityId: string;
|
|
1463
|
+
readonly sourceAt: WorldPoint;
|
|
1464
|
+
readonly targetAt: WorldPoint;
|
|
1465
|
+
readonly crossing: boolean;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
declare interface WorldMovementObservation {
|
|
1469
|
+
readonly epoch: number;
|
|
1470
|
+
readonly tick: number;
|
|
1471
|
+
readonly intents: ReadonlyArray<WorldMovementIntent>;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
declare type WorldPoint = readonly [x: number, y: number];
|
|
1475
|
+
|
|
1476
|
+
/** Private durable restriction, never a bearer or a grant of transition authority.
|
|
1477
|
+
* The enclosing Seat supplies tenant, target Room, Subject and ownership epoch. */
|
|
1478
|
+
declare interface WorldTargetSeatBinding {
|
|
1479
|
+
readonly transitionId: string;
|
|
1480
|
+
readonly sourceRoomId: string;
|
|
1481
|
+
readonly requestId: string;
|
|
1482
|
+
readonly entityId: string;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
export { }
|