agentscape3d 1.0.0-beta.1 → 1.0.0-beta.2
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/README.md +23 -48
- package/dist/core.d.ts +68 -0
- package/dist/core.js +209 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +10 -229
- package/dist/index.js +192 -15462
- package/dist/index.js.map +1 -1
- package/package.json +11 -40
- package/cli.mjs +0 -27
- package/dist/AssetCompiler-CDFiElji.js +0 -2451
- package/dist/AssetCompiler-CDFiElji.js.map +0 -1
- package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
- package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
- package/dist/AssetRecipe-DmFpzxr-.js +0 -55
- package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
- package/dist/BrowserCodeWorker.js +0 -53615
- package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
- package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
- package/dist/SceneSerializer-DPVOyeRk.js +0 -353
- package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
- package/dist/StylePack-DNrdLeGI.js +0 -6314
- package/dist/StylePack-DNrdLeGI.js.map +0 -1
- package/dist/WorldArchive-pSBIGxLa.js +0 -420
- package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
- package/dist/WorldIO-wsDfZGM4.js +0 -150
- package/dist/WorldIO-wsDfZGM4.js.map +0 -1
- package/dist/blankWorld-CBWbwJGj.js +0 -76
- package/dist/blankWorld-CBWbwJGj.js.map +0 -1
- package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
- package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
- package/dist/environments-DgH66NqV.js +0 -4220
- package/dist/environments-DgH66NqV.js.map +0 -1
- package/dist/gltfIO-B87nJaat.js +0 -10
- package/dist/gltfIO-B87nJaat.js.map +0 -1
- package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
- package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
- package/dist/magicCabin-D64fD1E2.js +0 -11024
- package/dist/magicCabin-D64fD1E2.js.map +0 -1
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.js +0 -1
- package/dist/monumentHall-BKbs0UOQ.js +0 -404
- package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
- package/dist/node.d.ts +0 -16
- package/dist/node.js +0 -25
- package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
- package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
- package/dist/runtime/application/AgentTools.js +0 -25
- package/dist/runtime/application/README.md +0 -14
- package/dist/runtime/application/buildTaskObservation.js +0 -117
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
- package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
- package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
- package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
- package/dist/runtime/application/createSession.js +0 -66
- package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
- package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
- package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
- package/dist/runtime/application/native-scene/CodeProject.js +0 -119
- package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
- package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
- package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
- package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
- package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
- package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
- package/dist/runtime/application/scene/RequestWindow.js +0 -54
- package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
- package/dist/runtime/application/scene/SceneContracts.js +0 -45
- package/dist/runtime/application/scene/SceneEditService.js +0 -144
- package/dist/runtime/application/scene/SceneFacade.js +0 -267
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
- package/dist/runtime/application/scene/SceneJobController.js +0 -229
- package/dist/runtime/application/scene/ScenePackage.js +0 -162
- package/dist/runtime/application/scene/ScenePersistence.js +0 -50
- package/dist/runtime/application/scene/SceneProject.js +0 -95
- package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
- package/dist/runtime/application/scene/StarterScene.js +0 -56
- package/dist/runtime/application/scene/WorldArchive.js +0 -87
- package/dist/runtime/application/scene/WorldDirectory.js +0 -20
- package/dist/runtime/application/scene/WorldDocument.js +0 -74
- package/dist/runtime/application/scene/WorldIO.js +0 -103
- package/dist/runtime/application/scene/WorldStorage.js +0 -137
- package/dist/runtime/application/skills/SkillRegistry.js +0 -163
- package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
- package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
- package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
- package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
- package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
- package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
- package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
- package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
- package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
- package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
- package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
- package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
- package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
- package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
- package/dist/runtime/application/skills/skillPrimitives.js +0 -4
- package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
- package/dist/runtime/application/tasks.jsonl +0 -67
- package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
- package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
- package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
- package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
- package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
- package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
- package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
- package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
- package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
- package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
- package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
- package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
- package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
- package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
- package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
- package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
- package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
- package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
- package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
- package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
- package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
- package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
- package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
- package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
- package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
- package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
- package/dist/runtime/apps/mcp-server/README.md +0 -150
- package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
- package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
- package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
- package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
- package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
- package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
- package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
- package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
- package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
- package/dist/runtime/apps/mcp-server/main.mjs +0 -56
- package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
- package/dist/runtime/apps/mcp-server/security.js +0 -21
- package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
- package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
- package/dist/runtime/apps/server/README.md +0 -7
- package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
- package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
- package/dist/runtime/apps/server/tasks.jsonl +0 -10
- package/dist/runtime/foundation/EventBus.js +0 -18
- package/dist/runtime/foundation/JsonGateway.js +0 -47
- package/dist/runtime/foundation/PolicyEngine.js +0 -21
- package/dist/runtime/foundation/README.md +0 -7
- package/dist/runtime/foundation/TraceRecorder.js +0 -76
- package/dist/runtime/foundation/errors.js +0 -8
- package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
- package/dist/runtime/foundation/version.js +0 -2
- package/dist/runtime/modules/agent/README.md +0 -11
- package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
- package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
- package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
- package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
- package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
- package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
- package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
- package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
- package/dist/runtime/modules/agent/prompt/index.js +0 -46
- package/dist/runtime/modules/agent/tasks.jsonl +0 -94
- package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
- package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
- package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
- package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
- package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
- package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
- package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
- package/dist/runtime/modules/artifact/README.md +0 -7
- package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
- package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
- package/dist/runtime/modules/asset/AssetModule.js +0 -399
- package/dist/runtime/modules/asset/README.md +0 -54
- package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
- package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
- package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
- package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
- package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
- package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
- package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
- package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
- package/dist/runtime/modules/asset/model/admission.js +0 -117
- package/dist/runtime/modules/asset/model/errors.js +0 -6
- package/dist/runtime/modules/asset/model/parts.js +0 -27
- package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
- package/dist/runtime/modules/asset/model/schema.js +0 -150
- package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
- package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
- package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
- package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
- package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
- package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
- package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
- package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
- package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
- package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
- package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
- package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
- package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
- package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
- package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
- package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
- package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
- package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
- package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
- package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
- package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
- package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
- package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
- package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
- package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
- package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
- package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
- package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
- package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
- package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
- package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
- package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
- package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
- package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
- package/dist/runtime/modules/asset/tasks.jsonl +0 -87
- package/dist/runtime/modules/generation/README.md +0 -9
- package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
- package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
- package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
- package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
- package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
- package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
- package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
- package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
- package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
- package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
- package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
- package/dist/runtime/modules/generation/tasks.jsonl +0 -35
- package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
- package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
- package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
- package/dist/runtime/modules/rendering/README.md +0 -7
- package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
- package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
- package/dist/runtime/modules/rendering/createRenderer.js +0 -76
- package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
- package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
- package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
- package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
- package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
- package/dist/runtime/modules/world/README.md +0 -13
- package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
- package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
- package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
- package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
- package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
- package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
- package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
- package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
- package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
- package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
- package/dist/runtime/modules/world/content/blankWorld.js +0 -35
- package/dist/runtime/modules/world/content/environments.js +0 -84
- package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
- package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
- package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
- package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
- package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
- package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
- package/dist/runtime/modules/world/content/magicCabin.js +0 -190
- package/dist/runtime/modules/world/content/monumentHall.js +0 -154
- package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
- package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
- package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
- package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
- package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
- package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
- package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
- package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
- package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
- package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
- package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
- package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
- package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
- package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
- package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
- package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
- package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
- package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
- package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
- package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
- package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
- package/dist/runtime/modules/world/errors.js +0 -9
- package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
- package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
- package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
- package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
- package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
- package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
- package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
- package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
- package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
- package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
- package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
- package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
- package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
- package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
- package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
- package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
- package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
- package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
- package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
- package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
- package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
- package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
- package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
- package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
- package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
- package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
- package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
- package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
- package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
- package/dist/runtime/modules/world/tasks.jsonl +0 -530
- package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
- package/dist/runtime/modules/world/verification/Finding.js +0 -105
- package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
- package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
- package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
- package/dist/runtime/package-lock.json +0 -6245
- package/dist/runtime/package.json +0 -91
- package/dist/runtime/public/assets/cabinet.glb +0 -0
- package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
- package/dist/schema-Dudvovhu.js +0 -364
- package/dist/schema-Dudvovhu.js.map +0 -1
- package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
- package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
- package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
- package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
- package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
- package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
|
@@ -1,502 +0,0 @@
|
|
|
1
|
-
import { assetAdmission } from '../../asset/model/admission.js';
|
|
2
|
-
import { physicsManifestForUniformScale } from './ObjectTransform.js';
|
|
3
|
-
import { samePhysicalGeometry } from './WorldCollisionSignature.js';
|
|
4
|
-
|
|
5
|
-
const round3 = (value) => Number(value.toFixed(3));
|
|
6
|
-
const vec3Round = (value) => Array.isArray(value) ? value.map(round3) : value;
|
|
7
|
-
const yawFromQuat = ([x, y, z, w]) => Math.atan2(2 * (w * y + x * z), 1 - 2 * (y * y + z * z));
|
|
8
|
-
|
|
9
|
-
export class WorldCommands {
|
|
10
|
-
constructor(runtime) {
|
|
11
|
-
if (!runtime) throw new TypeError('WorldCommands requires a WorldRuntime');
|
|
12
|
-
this.runtime = runtime;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
assertReady(command) {
|
|
16
|
-
if (this.runtime.ready !== false) return;
|
|
17
|
-
const assembled = this.runtime.sceneGraph
|
|
18
|
-
&& this.runtime.history
|
|
19
|
-
&& this.runtime.navigation
|
|
20
|
-
&& this.runtime.locomotion
|
|
21
|
-
&& this.runtime.interactions;
|
|
22
|
-
if (assembled) return;
|
|
23
|
-
const error = new Error(`World command requires an initialized WorldRuntime: ${command}`);
|
|
24
|
-
error.code = 'WORLD_COMMAND_NOT_READY';
|
|
25
|
-
error.command = command;
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async spawn(assetId, options = {}) {
|
|
30
|
-
this.assertReady('spawn');
|
|
31
|
-
const admission = assetAdmission(this.runtime.assetModule.getManifest(assetId));
|
|
32
|
-
if (admission.status === 'rejected') {
|
|
33
|
-
return { status:'asset-rejected', assetId, admission };
|
|
34
|
-
}
|
|
35
|
-
const id = await this.runtime.spawn(assetId, options);
|
|
36
|
-
return admission.status === 'ready'
|
|
37
|
-
? id
|
|
38
|
-
: { status:'asset-provisional', id, assetId, admission };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async replaceAsset(id, assetId) {
|
|
42
|
-
this.assertReady('replaceAsset');
|
|
43
|
-
const record=this.runtime.store.get(id);
|
|
44
|
-
if(record.state?.heldBy)throw Object.assign(new Error('Put down the object before upgrading its asset'),{code:'ASSET_INSTANCE_HELD'});
|
|
45
|
-
if(record.manifest.type==='agent')throw Object.assign(new Error('Agent embodiment upgrades are not supported'),{code:'ASSET_UPGRADE_AGENT_UNSUPPORTED'});
|
|
46
|
-
const manifest=this.runtime.assetModule.getManifest(assetId);
|
|
47
|
-
if(assetAdmission(manifest).status!=='ready')throw Object.assign(new Error('Asset is not ready'),{code:'ASSET_NOT_READY'});
|
|
48
|
-
const pose={id,position:record.object.position.toArray(),quaternion:record.object.quaternion.toArray(),scale:record.object.scale.x};
|
|
49
|
-
const previousAssetId=record.assetId;
|
|
50
|
-
return this.runtime.mutate('asset:replace',async()=>{
|
|
51
|
-
// An identical collider/joint layout preserves legitimate resting contacts; new physics is still registered.
|
|
52
|
-
const sameCollision=samePhysicalGeometry(manifest,record.manifest);
|
|
53
|
-
const check=sameCollision || manifest.capabilityLevel==='visual'?{checked:true,clear:true}:this.runtime.physics.checkManifestPose(physicsManifestForUniformScale(manifest,pose.scale),pose.position,{quaternion:pose.quaternion,excludeIds:[id]});
|
|
54
|
-
if(!check.checked||!check.clear)throw Object.assign(new Error('New asset does not fit at the current pose'),{code:'ASSET_UPGRADE_PLACEMENT_BLOCKED'});
|
|
55
|
-
this.remove(id);await this.spawn(assetId,pose);
|
|
56
|
-
const navigation=await this.runtime.navigation.ensureCurrent();
|
|
57
|
-
if(!navigation.success || (manifest.capabilityLevel!=='visual' && !this.runtime.physics.getPosition(id)))throw Object.assign(new Error('New entity failed runtime registration'),{code:'ASSET_UPGRADE_FAILED'});
|
|
58
|
-
return {status:'asset-instance-updated',id,assetId,previousAssetId,stateReset:true};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
transform(id, transform = {}, options = {}) {
|
|
63
|
-
this.assertReady('transform');
|
|
64
|
-
if (this.runtime.store.get(id).state?.heldBy || this.runtime.interactions?.isHeld?.(id) || this.runtime.interactions?.carry?.agentHeld?.has(id)) throw Object.assign(new Error('Put down the object before editing'), { code: 'OBJECT_HELD' });
|
|
65
|
-
return this.runtime.applyObjectTransform(id, transform, options);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
beginTransform(id) {
|
|
69
|
-
this.assertReady('beginTransform');
|
|
70
|
-
if (this.runtime.store.get(id).state?.heldBy || this.runtime.interactions?.isHeld?.(id) || this.runtime.interactions?.carry?.agentHeld?.has(id)) throw Object.assign(new Error('Put down the object before editing'), { code: 'OBJECT_HELD' });
|
|
71
|
-
return this.runtime.physics.beginTransform(id);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
endTransform(id) {
|
|
75
|
-
this.assertReady('endTransform');
|
|
76
|
-
return this.runtime.physics.endTransform(id);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
setHumanViewPose(pose) {
|
|
80
|
-
this.assertReady('setHumanViewPose');
|
|
81
|
-
return this.runtime.interactions.setHumanViewPose(pose);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
async duplicate(id) {
|
|
85
|
-
this.assertReady('duplicate');
|
|
86
|
-
const source = this.runtime.store.get(id);
|
|
87
|
-
const assetId = source.assetId;
|
|
88
|
-
const admission = assetAdmission(this.runtime.assetModule.getManifest(assetId));
|
|
89
|
-
if (admission.status === 'rejected') {
|
|
90
|
-
return { status:'asset-rejected', assetId, sourceId:id, admission };
|
|
91
|
-
}
|
|
92
|
-
const duplicateId = await this.runtime.duplicate(id);
|
|
93
|
-
return admission.status === 'ready'
|
|
94
|
-
? duplicateId
|
|
95
|
-
: { status:'asset-provisional', id:duplicateId, assetId, sourceId:id, admission };
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
remove(id, options = {}) {
|
|
99
|
-
this.assertReady('remove');
|
|
100
|
-
if (this.runtime.store.get(id).state?.heldBy || this.runtime.interactions?.isHeld?.(id) || this.runtime.interactions?.carry?.agentHeld?.has(id)) throw Object.assign(new Error('Put down the object before editing'), { code: 'OBJECT_HELD' });
|
|
101
|
-
return this.runtime.remove(id, options);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
navigate(id, end, options = {}) {
|
|
105
|
-
this.assertReady('navigate');
|
|
106
|
-
return this.runtime.locomotion.navigate(id, end, options);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async moveForward(id, { distance = 0.8, speed } = {}) {
|
|
110
|
-
this.assertReady('moveForward');
|
|
111
|
-
if (!this.runtime.store?.has?.(id)) {
|
|
112
|
-
const error = new Error(`Object not found: ${id}`);
|
|
113
|
-
error.code = 'OBJECT_NOT_FOUND';
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
if (!Number.isFinite(distance) || distance <= 0 || distance > 4) {
|
|
117
|
-
const error = new Error('moveForward distance must be within (0, 4]');
|
|
118
|
-
error.code = 'MOVE_FORWARD_DISTANCE_INVALID';
|
|
119
|
-
throw error;
|
|
120
|
-
}
|
|
121
|
-
const record = this.runtime.store.get(id);
|
|
122
|
-
if (record.manifest?.type !== 'agent' || !record.manifest.actions?.includes('navigate')) {
|
|
123
|
-
const error = new Error(`Object is not a navigable agent: ${id}`);
|
|
124
|
-
error.code = 'NOT_NAVIGABLE_AGENT';
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
if (record.manifest.physics?.body !== 'kinematic') {
|
|
128
|
-
const error = new Error(`Navigable agent must use a kinematic body: ${id}`);
|
|
129
|
-
error.code = 'NAVIGABLE_BODY_INVALID';
|
|
130
|
-
throw error;
|
|
131
|
-
}
|
|
132
|
-
const start = this.runtime.physics?.getPosition?.(id);
|
|
133
|
-
if (!start) {
|
|
134
|
-
const error = new Error(`Physics body not available: ${id}`);
|
|
135
|
-
error.code = 'PHYSICS_BODY_UNAVAILABLE';
|
|
136
|
-
throw error;
|
|
137
|
-
}
|
|
138
|
-
const rotation = this.runtime.physics?.getRotation?.(id);
|
|
139
|
-
if (!Array.isArray(rotation) || rotation.length !== 4 || !rotation.every(Number.isFinite)) {
|
|
140
|
-
const error = new Error(`Agent rotation unavailable: ${id}`);
|
|
141
|
-
error.code = 'AGENT_ROTATION_UNAVAILABLE';
|
|
142
|
-
throw error;
|
|
143
|
-
}
|
|
144
|
-
const yaw = yawFromQuat(rotation);
|
|
145
|
-
// 与 LocomotionSystem.steer 的 character facing 一致:[-sin(yaw), 0, -cos(yaw)]
|
|
146
|
-
const forward = [-Math.sin(yaw), 0, -Math.cos(yaw)];
|
|
147
|
-
const end = [
|
|
148
|
-
start[0] + forward[0] * distance,
|
|
149
|
-
start[1],
|
|
150
|
-
start[2] + forward[2] * distance
|
|
151
|
-
];
|
|
152
|
-
const result = await this.runtime.locomotion.navigate(id, end, { speed });
|
|
153
|
-
const position = Array.isArray(result?.position) ? result.position : null;
|
|
154
|
-
const moved = position
|
|
155
|
-
? Math.hypot(position[0] - start[0], position[2] - start[2])
|
|
156
|
-
: (result?.status === 'arrived' ? distance : 0);
|
|
157
|
-
const base = {
|
|
158
|
-
...result,
|
|
159
|
-
skill: 'moveForward',
|
|
160
|
-
start: vec3Round(start),
|
|
161
|
-
end: vec3Round(end),
|
|
162
|
-
distance,
|
|
163
|
-
yaw: round3(yaw),
|
|
164
|
-
forward: vec3Round(forward),
|
|
165
|
-
moved: round3(moved)
|
|
166
|
-
};
|
|
167
|
-
if (result?.status === 'arrived' && moved < Math.max(0.05, distance * 0.35)) {
|
|
168
|
-
return {
|
|
169
|
-
...base,
|
|
170
|
-
status: 'blocked',
|
|
171
|
-
reason: 'INSUFFICIENT_FORWARD_DISPLACEMENT'
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
return base;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
activateEnvironmentInteraction(interactionId, { actorId = null, requireReach = true } = {}) {
|
|
178
|
-
this.assertReady('activateEnvironmentInteraction');
|
|
179
|
-
const runtime = this.runtime;
|
|
180
|
-
const interactions = runtime.environment?.interactions || [];
|
|
181
|
-
const item = interactions.find((entry) => entry.id === interactionId);
|
|
182
|
-
if (!item) {
|
|
183
|
-
return { status:'interaction-not-found', interactionId, environmentId:runtime.environment?.id || null };
|
|
184
|
-
}
|
|
185
|
-
if (typeof item.activate !== 'function') {
|
|
186
|
-
return { status:'interaction-not-executable', interactionId, label:item.label || null };
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const position = (() => {
|
|
190
|
-
const object = item.object;
|
|
191
|
-
if (!object) return null;
|
|
192
|
-
if (object.isObject3D) {
|
|
193
|
-
object.updateWorldMatrix?.(true, false);
|
|
194
|
-
const elements = object.matrixWorld?.elements;
|
|
195
|
-
if (elements) return [elements[12], elements[13], elements[14]];
|
|
196
|
-
}
|
|
197
|
-
return null;
|
|
198
|
-
})();
|
|
199
|
-
|
|
200
|
-
// Formally declared actions use the contract's own reach and postcondition checks.
|
|
201
|
-
// Native object pivots are not authoritative interaction target positions.
|
|
202
|
-
if (item.contractId) {
|
|
203
|
-
const contract = runtime.affordances?.get?.(item.contractId);
|
|
204
|
-
if (contract) {
|
|
205
|
-
const state = contract.read?.() || {};
|
|
206
|
-
let action = null;
|
|
207
|
-
if (contract.kind === 'book') action = state.out ? 'return' : 'pull_out';
|
|
208
|
-
else if (contract.kind === 'switch') action = state.on ? 'turn_off' : 'turn_on';
|
|
209
|
-
else if (state.requestedOpen === true || state.out === true) action = 'close';
|
|
210
|
-
else if (state.requestedOpen === false || state.out === false) action = 'open';
|
|
211
|
-
if (action && contract.actions?.includes(action)) {
|
|
212
|
-
const response = runtime.affordances.execute({ targetId:item.contractId, action, actorId }, {});
|
|
213
|
-
const withNativeId = value => value?.status === 'world-action-blocked'
|
|
214
|
-
? { ...value, interactionId } : value;
|
|
215
|
-
return response?.then ? response.then(withNativeId) : withNativeId(response);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (requireReach && actorId) {
|
|
221
|
-
const feet = runtime.physics?.getPosition?.(actorId);
|
|
222
|
-
if (!feet) {
|
|
223
|
-
return { status:'world-action-blocked', interactionId, reason:'ACTOR_PHYSICS_UNAVAILABLE', actorId };
|
|
224
|
-
}
|
|
225
|
-
if (!position) {
|
|
226
|
-
return { status:'world-action-blocked', interactionId, reason:'INTERACTION_POSITION_UNAVAILABLE', actorId };
|
|
227
|
-
}
|
|
228
|
-
const distance = Math.hypot(position[0]-feet[0], position[1]-feet[1], position[2]-feet[2]);
|
|
229
|
-
if (distance > 1.5) {
|
|
230
|
-
return {
|
|
231
|
-
status:'world-action-blocked', interactionId, reason:'OUT_OF_REACH',
|
|
232
|
-
actorId, distance:round3(distance), maxDistance:1.5, position:vec3Round(position)
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
if (runtime.physics?.hasCapability?.('scene-query') && runtime.physics.raycast) {
|
|
236
|
-
const origin = [feet[0], feet[1] + 1.2, feet[2]];
|
|
237
|
-
const hit = runtime.physics.raycast(origin, position, { excludeId: actorId });
|
|
238
|
-
if (hit && hit.distance < distance - 0.12) {
|
|
239
|
-
return {
|
|
240
|
-
status:'world-action-blocked', interactionId, reason:'OCCLUDED',
|
|
241
|
-
actorId, blocker:hit.provenance || { id:hit.id }, distance:round3(distance)
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
item.activate();
|
|
248
|
-
return {
|
|
249
|
-
status:'environment-interaction-activated',
|
|
250
|
-
interactionId,
|
|
251
|
-
label:item.label || null,
|
|
252
|
-
contractId:item.contractId || null,
|
|
253
|
-
environmentId:runtime.environment?.id || null,
|
|
254
|
-
position:vec3Round(position),
|
|
255
|
-
via:'native-activate',
|
|
256
|
-
provisional:true,
|
|
257
|
-
verification:'native-provisional',
|
|
258
|
-
evidenceKind:'animated-transform',
|
|
259
|
-
physicsVerified:false,
|
|
260
|
-
note:'Native Three.js scene interaction; not force-verified articulated asset physics.'
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
async resolveEnvironmentApproach(target, start, { radii = [0.9, 1.2, 1.5, 1.8], samples = 16, maxSnapDistance = 0.75 } = {}) {
|
|
265
|
-
const runtime = this.runtime;
|
|
266
|
-
const navigation = runtime.navigation;
|
|
267
|
-
if (!navigation?.findPath || !Array.isArray(target) || !Array.isArray(start)) {
|
|
268
|
-
return { reachable:false, reason:'NAVIGATION_UNAVAILABLE', candidates:0 };
|
|
269
|
-
}
|
|
270
|
-
// 整圈采样,不按 agent 距离排序:门关着时「朝 agent」可能是屋内侧,会系统性打偏。
|
|
271
|
-
const candidates = [];
|
|
272
|
-
for (const radius of radii) {
|
|
273
|
-
for (let i = 0; i < samples; i += 1) {
|
|
274
|
-
const angle = (i / samples) * Math.PI * 2;
|
|
275
|
-
candidates.push([target[0] + Math.sin(angle)*radius, target[1], target[2] + Math.cos(angle)*radius]);
|
|
276
|
-
}
|
|
277
|
-
// 明确加轴向外点(门通常有一侧是可站立室外)
|
|
278
|
-
candidates.push([target[0] + radius, target[1], target[2]]);
|
|
279
|
-
candidates.push([target[0] - radius, target[1], target[2]]);
|
|
280
|
-
candidates.push([target[0], target[1], target[2] + radius]);
|
|
281
|
-
candidates.push([target[0], target[1], target[2] - radius]);
|
|
282
|
-
}
|
|
283
|
-
const tried = [];
|
|
284
|
-
const budget = Math.min(candidates.length, 28);
|
|
285
|
-
for (let index = 0; index < budget; index += 1) {
|
|
286
|
-
const end = candidates[index];
|
|
287
|
-
const route = await navigation.findPath(start, end, { maxSnapDistance, endTolerance: 0.6 });
|
|
288
|
-
tried.push({ end: vec3Round(end), reachable: route?.reachable === true, reason: route?.reason || null, cost: route?.cost ?? null });
|
|
289
|
-
if (route?.reachable) {
|
|
290
|
-
return { reachable:true, end, route, tried, candidates:candidates.length };
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return { reachable:false, reason:'NO_APPROACH_POSE', tried, candidates:candidates.length };
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
async findEnvironmentInteractApproach(interactionId, { actorId = null } = {}) {
|
|
297
|
-
this.assertReady('findEnvironmentInteractApproach');
|
|
298
|
-
const runtime = this.runtime;
|
|
299
|
-
const item = (runtime.environment?.interactions || []).find((entry) => entry.id === interactionId);
|
|
300
|
-
if (!item) return { status:'interaction-not-found', interactionId };
|
|
301
|
-
const target = (() => {
|
|
302
|
-
const object = item.object;
|
|
303
|
-
if (!object?.isObject3D) return null;
|
|
304
|
-
object.updateWorldMatrix?.(true, false);
|
|
305
|
-
const elements = object.matrixWorld?.elements;
|
|
306
|
-
return elements ? [elements[12], elements[13], elements[14]] : null;
|
|
307
|
-
})();
|
|
308
|
-
if (!target) return { status:'interaction-position-unavailable', interactionId };
|
|
309
|
-
const start = actorId ? runtime.physics?.getPosition?.(actorId) : null;
|
|
310
|
-
if (!start) return { status:'actor-required-or-unavailable', interactionId, actorId };
|
|
311
|
-
const approach = await this.resolveEnvironmentApproach(target, start);
|
|
312
|
-
return {
|
|
313
|
-
status: approach.reachable ? 'approach-ready' : 'approach-unreachable',
|
|
314
|
-
interactionId,
|
|
315
|
-
label:item.label || null,
|
|
316
|
-
contractId:item.contractId || null,
|
|
317
|
-
actorId,
|
|
318
|
-
start:vec3Round(start),
|
|
319
|
-
target:vec3Round(target),
|
|
320
|
-
approach: approach.reachable ? vec3Round(approach.end) : null,
|
|
321
|
-
distance: round3(Math.hypot(target[0]-start[0], target[1]-start[1], target[2]-start[2])),
|
|
322
|
-
reason: approach.reachable ? null : (approach.reason || 'NO_APPROACH_POSE'),
|
|
323
|
-
tried: approach.tried || []
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
async approachAndActivateEnvironmentInteract(interactionId, { actorId = null, speed } = {}) {
|
|
328
|
-
this.assertReady('approachAndActivateEnvironmentInteract');
|
|
329
|
-
const runtime = this.runtime;
|
|
330
|
-
const skill = 'approachAndActivateEnvironmentInteract';
|
|
331
|
-
const item = (runtime.environment?.interactions || []).find((entry) => entry.id === interactionId);
|
|
332
|
-
if (!item) {
|
|
333
|
-
return { status:'interaction-not-found', skill, interactionId, environmentId:runtime.environment?.id || null };
|
|
334
|
-
}
|
|
335
|
-
if (typeof item.activate !== 'function') {
|
|
336
|
-
return { status:'interaction-not-executable', skill, interactionId, label:item.label || null };
|
|
337
|
-
}
|
|
338
|
-
if (!actorId) {
|
|
339
|
-
return { status:'actor-required', skill, interactionId };
|
|
340
|
-
}
|
|
341
|
-
const start = runtime.physics?.getPosition?.(actorId);
|
|
342
|
-
if (!start) {
|
|
343
|
-
return { status:'world-action-blocked', skill, interactionId, reason:'ACTOR_PHYSICS_UNAVAILABLE', actorId };
|
|
344
|
-
}
|
|
345
|
-
const target = (() => {
|
|
346
|
-
const object = item.object;
|
|
347
|
-
if (!object?.isObject3D) return null;
|
|
348
|
-
object.updateWorldMatrix?.(true, false);
|
|
349
|
-
const elements = object.matrixWorld?.elements;
|
|
350
|
-
return elements ? [elements[12], elements[13], elements[14]] : null;
|
|
351
|
-
})();
|
|
352
|
-
if (!target) {
|
|
353
|
-
return { status:'world-action-blocked', skill, interactionId, reason:'INTERACTION_POSITION_UNAVAILABLE', actorId };
|
|
354
|
-
}
|
|
355
|
-
const distanceToTarget = Math.hypot(target[0]-start[0], target[1]-start[1], target[2]-start[2]);
|
|
356
|
-
if (distanceToTarget <= 1.5) {
|
|
357
|
-
const activation = await this.activateEnvironmentInteraction(interactionId, { actorId });
|
|
358
|
-
runtime.navigation?.invalidate?.('environment-interaction-activated');
|
|
359
|
-
const navigationBuild = runtime.navigation?.ensureBuilt ? await runtime.navigation.ensureBuilt() : null;
|
|
360
|
-
return {
|
|
361
|
-
...activation,
|
|
362
|
-
skill, phase:'activated', start:vec3Round(start), target:vec3Round(target),
|
|
363
|
-
distance:round3(distanceToTarget), navigated:false,
|
|
364
|
-
navigationInvalidated:true,
|
|
365
|
-
navigationBuild: navigationBuild ? { success:navigationBuild.success === true, buildVersion:navigationBuild.buildVersion ?? null, code:navigationBuild.code || null } : null,
|
|
366
|
-
nextStepHint:item.contractId
|
|
367
|
-
? 'NavMesh rebuilt after door/path change; call navigateTo/findPath on a fresh planning round before entering or climbing.'
|
|
368
|
-
: 'Native activation does not rebuild NavMesh by itself.'
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
const approach = await this.resolveEnvironmentApproach(target, start);
|
|
372
|
-
if (!approach.reachable) {
|
|
373
|
-
return {
|
|
374
|
-
status:'unreachable',
|
|
375
|
-
skill,
|
|
376
|
-
interactionId,
|
|
377
|
-
label:item.label || null,
|
|
378
|
-
actorId,
|
|
379
|
-
start:vec3Round(start),
|
|
380
|
-
target:vec3Round(target),
|
|
381
|
-
distance:round3(distanceToTarget),
|
|
382
|
-
reason:approach.reason || 'NO_PATH_TO_ENVIRONMENT_INTERACTION',
|
|
383
|
-
tried:approach.tried || []
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
const end = approach.end;
|
|
387
|
-
const navResult = await runtime.locomotion.navigate(actorId, end, { speed });
|
|
388
|
-
if (navResult?.status !== 'arrived') {
|
|
389
|
-
return {
|
|
390
|
-
...navResult,
|
|
391
|
-
skill,
|
|
392
|
-
phase:'approach',
|
|
393
|
-
interactionId,
|
|
394
|
-
label:item.label || null,
|
|
395
|
-
target:vec3Round(target),
|
|
396
|
-
approach:vec3Round(end)
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
const activation = await this.activateEnvironmentInteraction(interactionId, { actorId });
|
|
400
|
-
runtime.navigation?.invalidate?.('environment-interaction-activated');
|
|
401
|
-
// 门/路径类原生交互后立刻重建 NavMesh,避免下一轮 navigateTo 仍打在关门烘焙结果上。
|
|
402
|
-
const navigationBuild = runtime.navigation?.ensureBuilt ? await runtime.navigation.ensureBuilt() : null;
|
|
403
|
-
return {
|
|
404
|
-
...activation,
|
|
405
|
-
skill,
|
|
406
|
-
phase:'activated',
|
|
407
|
-
start:vec3Round(start),
|
|
408
|
-
approach:vec3Round(end),
|
|
409
|
-
target:vec3Round(target),
|
|
410
|
-
navigated:true,
|
|
411
|
-
navigationInvalidated:true,
|
|
412
|
-
navigationBuild: navigationBuild ? { success:navigationBuild.success === true, buildVersion:navigationBuild.buildVersion ?? null, code:navigationBuild.code || null } : null,
|
|
413
|
-
nextStepHint:item.contractId
|
|
414
|
-
? 'NavMesh rebuilt after door/path change; fresh replan then navigateTo/findPath before entering or going upstairs.'
|
|
415
|
-
: 'Native activation does not rebuild NavMesh by itself.'
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
pickup(id) {
|
|
420
|
-
this.assertReady('pickup');
|
|
421
|
-
return this.runtime.interactions.pickup(id);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
drop(id) {
|
|
425
|
-
this.assertReady('drop');
|
|
426
|
-
return this.runtime.interactions.drop(id);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
place(id, targetId, options = {}) {
|
|
430
|
-
this.assertReady('place');
|
|
431
|
-
return this.runtime.interactions.place(id, targetId, options);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
setArticulationAction(id, action, options = {}) {
|
|
435
|
-
this.assertReady('setArticulationAction');
|
|
436
|
-
return this.runtime.interactions.setArticulationAction(id, action, options);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
approachAndInteract(actorId, targetId, action, options = {}) {
|
|
440
|
-
this.assertReady('approachAndInteract');
|
|
441
|
-
return this.runtime.interactions.approachAndInteract(actorId, targetId, action, options);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
approachAndPickup(actorId, targetId, options = {}) {
|
|
445
|
-
this.assertReady('approachAndPickup');
|
|
446
|
-
return this.runtime.interactions.approachAndPickup(actorId, targetId, options);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
approachAndPlace(actorId, supportId, options = {}) {
|
|
450
|
-
this.assertReady('approachAndPlace');
|
|
451
|
-
return this.runtime.interactions.approachAndPlace(actorId, supportId, options);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
dropHeld(actorId) {
|
|
455
|
-
this.assertReady('dropHeld');
|
|
456
|
-
return this.runtime.interactions.dropHeld(actorId);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
markRecoveryHeld(actorId, details) {
|
|
460
|
-
this.assertReady('markRecoveryHeld');
|
|
461
|
-
return this.runtime.interactions.markRecoveryHeld(actorId, details);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
cleanupRecoveryBlocker(actorId, targetId, options = {}) {
|
|
465
|
-
this.assertReady('cleanupRecoveryBlocker');
|
|
466
|
-
return this.runtime.interactions.cleanupRecoveryBlocker(actorId, targetId, options);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
applyStateTransition(id, stateKey, value, meta = {}) {
|
|
470
|
-
this.assertReady('applyStateTransition');
|
|
471
|
-
return this.runtime.applyStateTransition(id, stateKey, value, meta);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
executeAffordance(args = {}, options = {}) {
|
|
475
|
-
this.assertReady('executeAffordance');
|
|
476
|
-
return options.approach ? this.runtime.affordances.approachAndExecute(args) : this.runtime.affordances.execute(args, options);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
repair(report, options = {}) {
|
|
480
|
-
this.assertReady('repair');
|
|
481
|
-
return this.runtime.repair.repair(report, options);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
syncAssetVerification(assetId, manifest) {
|
|
485
|
-
let updated = 0;
|
|
486
|
-
for (const record of this.runtime.store?.values?.() || []) {
|
|
487
|
-
if (record.assetId !== assetId) continue;
|
|
488
|
-
record.manifest.verification = structuredClone(manifest.verification || {});
|
|
489
|
-
if (manifest.compiler?.quality && record.manifest.compiler) {
|
|
490
|
-
record.manifest.compiler.quality = structuredClone(manifest.compiler.quality);
|
|
491
|
-
}
|
|
492
|
-
if (record.object?.userData?.manifest) {
|
|
493
|
-
record.object.userData.manifest.verification = structuredClone(record.manifest.verification);
|
|
494
|
-
if (record.manifest.compiler?.quality && record.object.userData.manifest.compiler) {
|
|
495
|
-
record.object.userData.manifest.compiler.quality = structuredClone(record.manifest.compiler.quality);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
updated += 1;
|
|
499
|
-
}
|
|
500
|
-
return { status:'asset-verification-synced', assetId, instances:updated };
|
|
501
|
-
}
|
|
502
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const clone = (value) => value == null ? value : structuredClone(value);
|
|
2
|
-
|
|
3
|
-
export class WorldObservation {
|
|
4
|
-
constructor(runtime) {
|
|
5
|
-
this.runtime = runtime;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
hasObject(id) {
|
|
9
|
-
return Boolean(id && this.runtime.store?.has(id));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
object(id) {
|
|
13
|
-
if (!this.hasObject(id)) return null;
|
|
14
|
-
const record = this.runtime.store.get(id);
|
|
15
|
-
const position = this.runtime.physics?.getPosition?.(id) || record.object?.position?.toArray?.() || null;
|
|
16
|
-
return {
|
|
17
|
-
id,
|
|
18
|
-
asset: record.assetId,
|
|
19
|
-
type: record.manifest?.type,
|
|
20
|
-
position: Array.isArray(position) ? [...position] : null
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
relations(ids = [], { limit = 8 } = {}) {
|
|
25
|
-
if (!this.runtime.sceneGraph || !ids.length) return [];
|
|
26
|
-
this.runtime.sceneGraph.update();
|
|
27
|
-
const relevant = new Set(ids);
|
|
28
|
-
const edges = [];
|
|
29
|
-
for (const edge of this.runtime.sceneGraph.list()) {
|
|
30
|
-
if (!relevant.has(edge.subject) && !relevant.has(edge.object)) continue;
|
|
31
|
-
edges.push(clone(edge));
|
|
32
|
-
if (edges.length >= limit) break;
|
|
33
|
-
}
|
|
34
|
-
return edges;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
actor(id) {
|
|
38
|
-
const object = this.object(id);
|
|
39
|
-
if (!object) return null;
|
|
40
|
-
return {
|
|
41
|
-
id,
|
|
42
|
-
position: object.position,
|
|
43
|
-
navigation: this.runtime.locomotion?.status?.(id) || null,
|
|
44
|
-
carry: this.runtime.interactions?.carryStatus?.(id) || null
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
affordances(ids = [], { actorId = null } = {}) {
|
|
49
|
-
const runtimeAffordances = this.runtime.affordances;
|
|
50
|
-
if (!runtimeAffordances?.list) return null;
|
|
51
|
-
const listing = runtimeAffordances.list({ actorId, limit:1 });
|
|
52
|
-
if (!listing.total) return null;
|
|
53
|
-
return {
|
|
54
|
-
count: listing.total,
|
|
55
|
-
lastResult: clone(runtimeAffordances.lastResult || null),
|
|
56
|
-
focus: ids.map((id) => runtimeAffordances.inspect(id, { actorId })).filter(Boolean)
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
articulation(id) {
|
|
61
|
-
if (!this.hasObject(id)) return null;
|
|
62
|
-
const parts = this.runtime.store.get(id).manifest?.parts || {};
|
|
63
|
-
const supported = Object.values(parts).some((part) => part?.joint && part?.physics && part.joint.type !== 'fixed');
|
|
64
|
-
if (!supported || !this.runtime.interactions?.articulationStatus) return null;
|
|
65
|
-
try {
|
|
66
|
-
return clone(this.runtime.interactions.articulationStatus(id));
|
|
67
|
-
} catch {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|