agentscape3d-engine 0.0.0-stage → 1.0.0-beta.3
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/LICENSE +21 -0
- package/README.md +19 -2
- package/cli.mjs +53 -0
- package/dist/ArticulationVerifier-BfGxXY8V.js +337 -0
- package/dist/ArticulationVerifier-BfGxXY8V.js.map +1 -0
- package/dist/AssetCompiler-BLj09iu1.js +2424 -0
- package/dist/AssetCompiler-BLj09iu1.js.map +1 -0
- package/dist/AssetModule-DME-XaFS.js +2637 -0
- package/dist/AssetModule-DME-XaFS.js.map +1 -0
- package/dist/AssetRecipe-g8dZBhgJ.js +298 -0
- package/dist/AssetRecipe-g8dZBhgJ.js.map +1 -0
- package/dist/BrowserCodeWorker.js +53856 -0
- package/dist/BrowserCodeWorker.js.map +1 -0
- package/dist/CarryCapability-CXwHU5ay.js +104 -0
- package/dist/CarryCapability-CXwHU5ay.js.map +1 -0
- package/dist/KinematicHypothesisScreen-C3TKiuYR.js +241 -0
- package/dist/KinematicHypothesisScreen-C3TKiuYR.js.map +1 -0
- package/dist/ObjectTransform-BlQUNK7c.js +61 -0
- package/dist/ObjectTransform-BlQUNK7c.js.map +1 -0
- package/dist/RapierPhysicsBackend-B2wQe_Vl.js +3259 -0
- package/dist/RapierPhysicsBackend-B2wQe_Vl.js.map +1 -0
- package/dist/RenderingSystem-WIr1ZuGu.js +1042 -0
- package/dist/RenderingSystem-WIr1ZuGu.js.map +1 -0
- package/dist/ScenePresentation-LsYiDxbm.js +152 -0
- package/dist/ScenePresentation-LsYiDxbm.js.map +1 -0
- package/dist/SceneProject-K7HH1s8o.js +2687 -0
- package/dist/SceneProject-K7HH1s8o.js.map +1 -0
- package/dist/SceneSerializer-zOzbX4jZ.js +932 -0
- package/dist/SceneSerializer-zOzbX4jZ.js.map +1 -0
- package/dist/SimulationProfile-DSYZbBLQ.js +165 -0
- package/dist/SimulationProfile-DSYZbBLQ.js.map +1 -0
- package/dist/StylePack-DcRa_kU0.js +88 -0
- package/dist/StylePack-DcRa_kU0.js.map +1 -0
- package/dist/WorldArchive-BiFGLt--.js +451 -0
- package/dist/WorldArchive-BiFGLt--.js.map +1 -0
- package/dist/WorldCommands-Debj7V4L.js +2207 -0
- package/dist/WorldCommands-Debj7V4L.js.map +1 -0
- package/dist/WorldIO-Ch8QBfKY.js +151 -0
- package/dist/WorldIO-Ch8QBfKY.js.map +1 -0
- package/dist/admission-CVEvsrdz.js +121 -0
- package/dist/admission-CVEvsrdz.js.map +1 -0
- package/dist/blankWorld-B0MW6g7q.js +75 -0
- package/dist/blankWorld-B0MW6g7q.js.map +1 -0
- package/dist/core.d.ts +68 -0
- package/dist/core.js +209 -0
- package/dist/core.js.map +1 -0
- package/dist/disposeObject3D-DIMzy0FA.js +128 -0
- package/dist/disposeObject3D-DIMzy0FA.js.map +1 -0
- package/dist/environments-HOe3sJXH.js +567 -0
- package/dist/environments-HOe3sJXH.js.map +1 -0
- package/dist/gltfIO-BzVKLyaL.js +339 -0
- package/dist/gltfIO-BzVKLyaL.js.map +1 -0
- package/dist/grandUrbanBlock-DRndRZjF.js +515 -0
- package/dist/grandUrbanBlock-DRndRZjF.js.map +1 -0
- package/dist/index.d.ts +345 -0
- package/dist/index.js +16952 -0
- package/dist/index.js.map +1 -0
- package/dist/magicCabin-CfBZjx2Q.js +11019 -0
- package/dist/magicCabin-CfBZjx2Q.js.map +1 -0
- package/dist/manifests-D0LwbJ36.js +866 -0
- package/dist/manifests-D0LwbJ36.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +1 -0
- package/dist/monumentHall-awZiGtda.js +403 -0
- package/dist/monumentHall-awZiGtda.js.map +1 -0
- package/dist/node.d.ts +16 -0
- package/dist/node.js +26 -0
- package/dist/parts-DrEcfJRl.js +37 -0
- package/dist/parts-DrEcfJRl.js.map +1 -0
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/ruinedCourtyard-DuF7NmUU.js +696 -0
- package/dist/ruinedCourtyard-DuF7NmUU.js.map +1 -0
- package/dist/runtime/application/AgentTools.js +28 -0
- package/dist/runtime/application/README.md +14 -0
- package/dist/runtime/application/agent/ProgressiveAgentTools.js +92 -0
- package/dist/runtime/application/agent/StudioMcpAllowlist.js +10 -0
- package/dist/runtime/application/agent/StudioProjectTools.js +18 -0
- package/dist/runtime/application/agent/TaskEvidence.js +199 -0
- package/dist/runtime/application/buildTaskObservation.js +117 -0
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +50 -0
- package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +35 -0
- package/dist/runtime/application/code-execution/BrowserCodeWorker.js +17 -0
- package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +82 -0
- package/dist/runtime/application/createSession.js +66 -0
- package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
- package/dist/runtime/application/generation/GenerationOrchestrator.js +630 -0
- package/dist/runtime/application/generation/GenerationRuntime.js +215 -0
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +289 -0
- package/dist/runtime/application/native-scene/CodeProject.js +215 -0
- package/dist/runtime/application/native-scene/CodeProjectModules.js +143 -0
- package/dist/runtime/application/native-scene/ExampleWorldCatalog.js +35 -0
- package/dist/runtime/application/native-scene/NativeArticulation.js +53 -0
- package/dist/runtime/application/native-scene/NativeEditableRegistry.js +150 -0
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +85 -0
- package/dist/runtime/application/native-scene/NativeLightingInspection.js +33 -0
- package/dist/runtime/application/native-scene/NativeMaterialInspection.js +52 -0
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
- package/dist/runtime/application/native-scene/NativePhysicsGeometry.js +64 -0
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
- package/dist/runtime/application/native-scene/NativeSceneHost.js +406 -0
- package/dist/runtime/application/native-scene/NativeSceneInspection.js +203 -0
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
- package/dist/runtime/application/native-scene/NativeSceneQuery.js +123 -0
- package/dist/runtime/application/native-scene/NativeSceneReview.js +132 -0
- package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
- package/dist/runtime/application/native-scene/SceneObserver.js +97 -0
- package/dist/runtime/application/native-scene/VisualCapturePolicy.js +4 -0
- package/dist/runtime/application/object-forge/SceneObjectForge.js +263 -0
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +59 -0
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +22 -0
- package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +40 -0
- package/dist/runtime/application/scene/CapabilityResolver.js +90 -0
- package/dist/runtime/application/scene/NativeEditableContracts.js +18 -0
- package/dist/runtime/application/scene/RequestWindow.js +54 -0
- package/dist/runtime/application/scene/SceneAgentTools.js +21 -0
- package/dist/runtime/application/scene/SceneContracts.js +49 -0
- package/dist/runtime/application/scene/SceneEditService.js +154 -0
- package/dist/runtime/application/scene/SceneFacade.js +356 -0
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +41 -0
- package/dist/runtime/application/scene/SceneJobController.js +320 -0
- package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
- package/dist/runtime/application/scene/ScenePackage.js +173 -0
- package/dist/runtime/application/scene/ScenePersistence.js +50 -0
- package/dist/runtime/application/scene/SceneProject.js +95 -0
- package/dist/runtime/application/scene/SceneSkillNames.js +5 -0
- package/dist/runtime/application/scene/StarterScene.js +56 -0
- package/dist/runtime/application/scene/WorldArchive.js +89 -0
- package/dist/runtime/application/scene/WorldDirectory.js +20 -0
- package/dist/runtime/application/scene/WorldDocument.js +76 -0
- package/dist/runtime/application/scene/WorldIO.js +103 -0
- package/dist/runtime/application/scene/WorldStorage.js +155 -0
- package/dist/runtime/application/skills/SkillRegistry.js +193 -0
- package/dist/runtime/application/skills/packs/acceptanceSkills.js +32 -0
- package/dist/runtime/application/skills/packs/affordanceSkills.js +36 -0
- package/dist/runtime/application/skills/packs/assetSkills.js +46 -0
- package/dist/runtime/application/skills/packs/authoringSkills.js +16 -0
- package/dist/runtime/application/skills/packs/batchSkills.js +22 -0
- package/dist/runtime/application/skills/packs/codeSkills.js +106 -0
- package/dist/runtime/application/skills/packs/generationSkills.js +45 -0
- package/dist/runtime/application/skills/packs/interactionSkills.js +46 -0
- package/dist/runtime/application/skills/packs/recoverySkills.js +80 -0
- package/dist/runtime/application/skills/packs/sceneSkills.js +24 -0
- package/dist/runtime/application/skills/packs/spatialSkills.js +35 -0
- package/dist/runtime/application/skills/packs/verificationSkills.js +14 -0
- package/dist/runtime/application/skills/packs/worldSkills.js +45 -0
- package/dist/runtime/application/skills/registerCoreSkills.js +31 -0
- package/dist/runtime/application/skills/skillPrimitives.js +4 -0
- package/dist/runtime/application/tasks/CabinetCupTask.js +76 -0
- package/dist/runtime/application/tasks.jsonl +67 -0
- package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +42 -0
- package/dist/runtime/application/world-authoring/AuthoringDiff.js +149 -0
- package/dist/runtime/application/world-authoring/AuthoringDocument.js +825 -0
- package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +109 -0
- package/dist/runtime/application/world-authoring/AuthoringIdentity.js +17 -0
- package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +29 -0
- package/dist/runtime/application/world-authoring/AuthoringPatch.js +118 -0
- package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +334 -0
- package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +126 -0
- package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +144 -0
- package/dist/runtime/application/world-authoring/HeadlessImageExport.js +92 -0
- package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
- package/dist/runtime/application/world-authoring/SceneGLBExport.js +88 -0
- package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
- package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +68 -0
- package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +1 -0
- package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +30 -0
- package/dist/runtime/apps/mcp-server/BuildEnvironment.js +17 -0
- package/dist/runtime/apps/mcp-server/CodeExecutor.js +71 -0
- package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +42 -0
- package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +66 -0
- package/dist/runtime/apps/mcp-server/FileAssetRepository.js +159 -0
- package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +8 -0
- package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +47 -0
- package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +157 -0
- package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +6 -0
- package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +116 -0
- package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +60 -0
- package/dist/runtime/apps/mcp-server/README.md +269 -0
- package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +1 -0
- package/dist/runtime/apps/mcp-server/SandboxBundle.js +13 -0
- package/dist/runtime/apps/mcp-server/SessionManager.js +148 -0
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +75 -0
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +246 -0
- package/dist/runtime/apps/mcp-server/StudioProjectToolContracts.js +58 -0
- package/dist/runtime/apps/mcp-server/TransferHttp.js +47 -0
- package/dist/runtime/apps/mcp-server/TransferLimits.js +6 -0
- package/dist/runtime/apps/mcp-server/TransferStore.js +134 -0
- package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +16 -0
- package/dist/runtime/apps/mcp-server/VALIDATION.md +45 -0
- package/dist/runtime/apps/mcp-server/acceptance-evidence.json +332 -0
- package/dist/runtime/apps/mcp-server/errorDiagnostics.js +32 -0
- package/dist/runtime/apps/mcp-server/examples/code-house.js +24 -0
- package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +85 -0
- package/dist/runtime/apps/mcp-server/main.mjs +82 -0
- package/dist/runtime/apps/mcp-server/registerTools.js +274 -0
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
- package/dist/runtime/apps/mcp-server/security.js +23 -0
- package/dist/runtime/apps/mcp-server/tasks.jsonl +9 -0
- package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +157 -0
- package/dist/runtime/apps/server/README.md +7 -0
- package/dist/runtime/apps/server/WorldRepository.js +338 -0
- package/dist/runtime/apps/server/WorldRepositoryHttp.js +96 -0
- package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +278 -0
- package/dist/runtime/apps/server/tasks.jsonl +10 -0
- package/dist/runtime/apps/shared/node/WorldDiskStorage.js +62 -0
- package/dist/runtime/foundation/EventBus.js +26 -0
- package/dist/runtime/foundation/JsonGateway.js +47 -0
- package/dist/runtime/foundation/PngRgba.js +99 -0
- package/dist/runtime/foundation/PolicyEngine.js +21 -0
- package/dist/runtime/foundation/README.md +7 -0
- package/dist/runtime/foundation/TraceRecorder.js +76 -0
- package/dist/runtime/foundation/errors.js +8 -0
- package/dist/runtime/foundation/simulation/SimulationProfile.js +143 -0
- package/dist/runtime/foundation/version.js +2 -0
- package/dist/runtime/modules/agent/README.md +11 -0
- package/dist/runtime/modules/agent/ToolCallingAgent.js +19 -0
- package/dist/runtime/modules/agent/bootstrapWorld.js +10 -0
- package/dist/runtime/modules/agent/buildRecoveryProposals.js +533 -0
- package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +128 -0
- package/dist/runtime/modules/agent/execution/AgentRunResults.js +55 -0
- package/dist/runtime/modules/agent/execution/AgentRunSession.js +393 -0
- package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +40 -0
- package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +19 -0
- package/dist/runtime/modules/agent/prompt/index.js +52 -0
- package/dist/runtime/modules/agent/tasks.jsonl +94 -0
- package/dist/runtime/modules/artifact/ArtifactContentGate.js +144 -0
- package/dist/runtime/modules/artifact/ArtifactDescriptor.js +280 -0
- package/dist/runtime/modules/artifact/ArtifactImporter.js +185 -0
- package/dist/runtime/modules/artifact/ArtifactModule.js +111 -0
- package/dist/runtime/modules/artifact/ArtifactRegistry.js +197 -0
- package/dist/runtime/modules/artifact/IncrementalSha256.js +129 -0
- package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +115 -0
- package/dist/runtime/modules/artifact/README.md +7 -0
- package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +67 -0
- package/dist/runtime/modules/artifact/tasks.jsonl +31 -0
- package/dist/runtime/modules/asset/AssetModule.js +416 -0
- package/dist/runtime/modules/asset/README.md +67 -0
- package/dist/runtime/modules/asset/loading/AssetLoader.js +157 -0
- package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +61 -0
- package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +95 -0
- package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +33 -0
- package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +103 -0
- package/dist/runtime/modules/asset/model/AssetInputContracts.js +139 -0
- package/dist/runtime/modules/asset/model/AssetRef.js +12 -0
- package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +172 -0
- package/dist/runtime/modules/asset/model/ProceduralTextureContract.js +24 -0
- package/dist/runtime/modules/asset/model/admission.js +117 -0
- package/dist/runtime/modules/asset/model/errors.js +6 -0
- package/dist/runtime/modules/asset/model/parts.js +27 -0
- package/dist/runtime/modules/asset/model/resourceBudget.js +10 -0
- package/dist/runtime/modules/asset/model/schema.js +150 -0
- package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +78 -0
- package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +84 -0
- package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +86 -0
- package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +81 -0
- package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +272 -0
- package/dist/runtime/modules/asset/production/AssetRecipe.js +91 -0
- package/dist/runtime/modules/asset/production/ProceduralTexture.js +85 -0
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +45 -0
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +590 -0
- package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +173 -0
- package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +124 -0
- package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +56 -0
- package/dist/runtime/modules/asset/production/compiler/gltfIO.js +6 -0
- package/dist/runtime/modules/asset/production/compiler/partGeometry.js +74 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +63 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +48 -0
- package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +16 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +30 -0
- package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +75 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +20 -0
- package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +34 -0
- package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +32 -0
- package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +116 -0
- package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +84 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +63 -0
- package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +16 -0
- package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +23 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +50 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +60 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +93 -0
- package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +32 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +55 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +203 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +43 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +33 -0
- package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +60 -0
- package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +23 -0
- package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +198 -0
- package/dist/runtime/modules/asset/registry/AssetCatalog.js +72 -0
- package/dist/runtime/modules/asset/registry/AssetRegistry.js +51 -0
- package/dist/runtime/modules/asset/registry/manifests/index.js +173 -0
- package/dist/runtime/modules/asset/tasks.jsonl +87 -0
- package/dist/runtime/modules/generation/README.md +9 -0
- package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +45 -0
- package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +169 -0
- package/dist/runtime/modules/generation/connector/ConnectorClient.js +192 -0
- package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +167 -0
- package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +179 -0
- package/dist/runtime/modules/generation/connector/ConnectorSession.js +202 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +239 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +99 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +91 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +50 -0
- package/dist/runtime/modules/generation/providers/ProviderRegistry.js +304 -0
- package/dist/runtime/modules/generation/tasks.jsonl +35 -0
- package/dist/runtime/modules/navigation/NavigationBackend.js +17 -0
- package/dist/runtime/modules/navigation/RecastNavigationBackend.js +263 -0
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +660 -0
- package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +414 -0
- package/dist/runtime/modules/rendering/README.md +7 -0
- package/dist/runtime/modules/rendering/RendererProbe.js +153 -0
- package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +140 -0
- package/dist/runtime/modules/rendering/captureStill.js +54 -0
- package/dist/runtime/modules/rendering/createRenderer.js +76 -0
- package/dist/runtime/modules/rendering/disposeObject3D.js +37 -0
- package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +74 -0
- package/dist/runtime/modules/rendering/spatial/ThreeBvhRuntime.js +107 -0
- package/dist/runtime/modules/rendering/style/StylePack.js +34 -0
- package/dist/runtime/modules/rendering/style/StyleSystem.js +173 -0
- package/dist/runtime/modules/rendering/tasks.jsonl +7 -0
- package/dist/runtime/modules/world/README.md +13 -0
- package/dist/runtime/modules/world/build/WorldBuilder.js +170 -0
- package/dist/runtime/modules/world/compiler/PipelineEngine.js +32 -0
- package/dist/runtime/modules/world/compiler/WorldAdmission.js +43 -0
- package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +68 -0
- package/dist/runtime/modules/world/compiler/WorldCompilation.js +157 -0
- package/dist/runtime/modules/world/compiler/WorldComposer.js +201 -0
- package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +76 -0
- package/dist/runtime/modules/world/compiler/WorldRecompiler.js +356 -0
- package/dist/runtime/modules/world/compiler/WorldRetry.js +75 -0
- package/dist/runtime/modules/world/compiler/createWorldPipeline.js +379 -0
- package/dist/runtime/modules/world/content/blankWorld.js +35 -0
- package/dist/runtime/modules/world/content/environments.js +84 -0
- package/dist/runtime/modules/world/content/grandUrbanBlock.js +189 -0
- package/dist/runtime/modules/world/content/magic-cabin/README.md +28 -0
- package/dist/runtime/modules/world/content/magic-cabin/affordances.js +64 -0
- package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +7078 -0
- package/dist/runtime/modules/world/content/magic-cabin/lighting.js +26 -0
- package/dist/runtime/modules/world/content/magic-cabin/materials.js +20 -0
- package/dist/runtime/modules/world/content/magicCabin.js +190 -0
- package/dist/runtime/modules/world/content/monumentHall.js +154 -0
- package/dist/runtime/modules/world/content/ruinedCourtyard.js +196 -0
- package/dist/runtime/modules/world/content/suzhouGarden/README.md +141 -0
- package/dist/runtime/modules/world/content/suzhouGarden/index.js +137 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +491 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +670 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +578 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +127 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +642 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +650 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +280 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +242 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +215 -0
- package/dist/runtime/modules/world/content/woodlandWorkshop.js +192 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/README.md +36 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +351 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +490 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/core.js +505 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/index.js +101 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +435 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +169 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/water.js +245 -0
- package/dist/runtime/modules/world/errors.js +9 -0
- package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +50 -0
- package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +297 -0
- package/dist/runtime/modules/world/runtime/CommandHistory.js +111 -0
- package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +165 -0
- package/dist/runtime/modules/world/runtime/NativeNavigationGeometry.js +84 -0
- package/dist/runtime/modules/world/runtime/NativePhysicsSnapshot.js +245 -0
- package/dist/runtime/modules/world/runtime/ObjectStore.js +31 -0
- package/dist/runtime/modules/world/runtime/ObjectTransform.js +62 -0
- package/dist/runtime/modules/world/runtime/ObservedEntity.js +37 -0
- package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +240 -0
- package/dist/runtime/modules/world/runtime/SceneExtensions.js +36 -0
- package/dist/runtime/modules/world/runtime/ScenePresentation.js +101 -0
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +281 -0
- package/dist/runtime/modules/world/runtime/WorldAuthority.js +41 -0
- package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +14 -0
- package/dist/runtime/modules/world/runtime/WorldCommands.js +503 -0
- package/dist/runtime/modules/world/runtime/WorldObservation.js +71 -0
- package/dist/runtime/modules/world/runtime/WorldQueries.js +340 -0
- package/dist/runtime/modules/world/runtime/WorldRecovery.js +78 -0
- package/dist/runtime/modules/world/runtime/WorldRuntime.js +806 -0
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +110 -0
- package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +130 -0
- package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +79 -0
- package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +195 -0
- package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +70 -0
- package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +115 -0
- package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +390 -0
- package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +214 -0
- package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +65 -0
- package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +244 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +147 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
- package/dist/runtime/modules/world/runtime/interaction/ManipulationActions.js +7 -0
- package/dist/runtime/modules/world/runtime/interaction/NativePhysicalTarget.js +31 -0
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +134 -0
- package/dist/runtime/modules/world/runtime/semantic/NativePhysicsState.js +89 -0
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +129 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +104 -0
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
- package/dist/runtime/modules/world/runtime/simulation/WorldTimeline.js +110 -0
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
- package/dist/runtime/modules/world/runtime/spatial/VisualMeshBounds.js +41 -0
- package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +306 -0
- package/dist/runtime/modules/world/runtime/systems/Instrument.js +39 -0
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +806 -0
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +281 -0
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +561 -0
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1752 -0
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +527 -0
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +402 -0
- package/dist/runtime/modules/world/spec/WorldIR.js +165 -0
- package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +86 -0
- package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +51 -0
- package/dist/runtime/modules/world/spec/WorldRevision.js +231 -0
- package/dist/runtime/modules/world/spec/WorldSpec.js +86 -0
- package/dist/runtime/modules/world/tasks.jsonl +530 -0
- package/dist/runtime/modules/world/verification/ArticulationVerifier.js +254 -0
- package/dist/runtime/modules/world/verification/Finding.js +105 -0
- package/dist/runtime/modules/world/verification/InteractionEvidence.js +73 -0
- package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
- package/dist/runtime/modules/world/verification/VisualLayoutAcceptance.js +58 -0
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +176 -0
- package/dist/runtime/modules/world/verification/WorldValidator.js +67 -0
- package/dist/runtime/package-lock.json +16071 -0
- package/dist/runtime/package.json +106 -0
- 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-DT7K9NjP.js +165 -0
- package/dist/schema-DT7K9NjP.js.map +1 -0
- package/dist/suzhouGarden-Y3hny8j6.js +6150 -0
- package/dist/suzhouGarden-Y3hny8j6.js.map +1 -0
- package/dist/version-CHc-i8ch.js +5 -0
- package/dist/version-CHc-i8ch.js.map +1 -0
- package/dist/woodlandWorkshop-DsScU-cx.js +483 -0
- package/dist/woodlandWorkshop-DsScU-cx.js.map +1 -0
- package/dist/yuanmingyuan-DsFnPzzR.js +4955 -0
- package/dist/yuanmingyuan-DsFnPzzR.js.map +1 -0
- package/package.json +75 -4
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { resolveStylePack } from './StylePack.js';
|
|
3
|
+
|
|
4
|
+
const fail = code => Object.assign(new Error(code), { code });
|
|
5
|
+
const array = material => Array.isArray(material) ? material : [material];
|
|
6
|
+
const ancestors = function* (node) { for (let p = node; p; p = p.parent) yield p; };
|
|
7
|
+
const meshes = scene => {
|
|
8
|
+
const result = [];
|
|
9
|
+
scene.traverse(node => { if (node.isMesh && ![...ancestors(node)].some(p => p.userData?.visualDecorationRoot)) result.push(node); });
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
const cloneVisual = node => {
|
|
13
|
+
if (node.userData?.visualDecorationRoot) return null;
|
|
14
|
+
const clone = node.clone(false);
|
|
15
|
+
for (const child of node.children) { const visual = cloneVisual(child); if (visual) clone.add(visual); }
|
|
16
|
+
return clone;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** Owns derived visual resources only. Never receives a World/Physics/Store. */
|
|
20
|
+
export class StyleSystem {
|
|
21
|
+
constructor({ scene, getRenderer, getCamera, events, prepareTimeoutMs = 30_000 }) {
|
|
22
|
+
this.scene = scene; this.getRenderer = getRenderer; this.getCamera = getCamera;
|
|
23
|
+
this.events = events;
|
|
24
|
+
this.prepareTimeoutMs = prepareTimeoutMs;
|
|
25
|
+
this.originals = new Map(); this.derived = new Map(); this.current = null; this.base = null;
|
|
26
|
+
this.rig = null;
|
|
27
|
+
this.unsub = [
|
|
28
|
+
events.on('object.spawned', () => this.refresh()),
|
|
29
|
+
events.on('scene.restored', () => this.refresh()),
|
|
30
|
+
events.on('environment.replaced', () => { this.restoreMeshes(mesh => ![...ancestors(mesh)].includes(this.scene), true); this.refresh(); }),
|
|
31
|
+
events.on('object.removing', ({ id }) => this.restoreMeshes(mesh => [...ancestors(mesh)].some(node => node.userData?.instanceId === id))),
|
|
32
|
+
events.on('world.disposing', () => this.dispose())
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
export() { return this.current ? structuredClone(this.current) : null; }
|
|
36
|
+
notify() { try { this.events.emit('style.changed', { id: this.current?.id || null }); return []; } catch { return ['STYLE_OBSERVER_FAILED']; } }
|
|
37
|
+
capabilities() { return new Set(['material.standard', 'material.toon', 'material.flat', 'renderer.exposure', 'renderer.shadows', 'scene.fog']); }
|
|
38
|
+
capture() {
|
|
39
|
+
const renderer = this.getRenderer();
|
|
40
|
+
return { background: this.scene.background, fog: this.scene.fog, exposure: renderer.toneMappingExposure, toneMapping: renderer.toneMapping, shadows: renderer.shadowMap?.enabled, rig: this.rig };
|
|
41
|
+
}
|
|
42
|
+
restoreVisual(value) {
|
|
43
|
+
const renderer = this.getRenderer();
|
|
44
|
+
this.scene.background = value.background; this.scene.fog = value.fog;
|
|
45
|
+
if (renderer) { renderer.toneMappingExposure = value.exposure; renderer.toneMapping = value.toneMapping; if (renderer.shadowMap) renderer.shadowMap.enabled = value.shadows; }
|
|
46
|
+
if (this.rig !== value.rig) { this.releaseRig(this.rig); this.rig = value.rig; if (this.rig) this.scene.add(this.rig); }
|
|
47
|
+
}
|
|
48
|
+
material(original, pack, cache, warnings) {
|
|
49
|
+
if (!original || original.isShaderMaterial || original.isRawShaderMaterial || original.transmission > 0) {
|
|
50
|
+
if (pack.material.unsupported === 'reject') throw fail('STYLE_MATERIAL_UNSUPPORTED');
|
|
51
|
+
warnings.add('STYLE_MATERIAL_PRESERVED'); return original;
|
|
52
|
+
}
|
|
53
|
+
if (cache.has(original)) return cache.get(original);
|
|
54
|
+
let next;
|
|
55
|
+
if (pack.material.mode === 'toon') {
|
|
56
|
+
next = new THREE.MeshToonMaterial();
|
|
57
|
+
for (const key of ['map', 'normalMap', 'alphaMap', 'emissiveMap', 'aoMap', 'transparent', 'opacity', 'side', 'alphaTest', 'depthWrite', 'vertexColors', 'blending']) if (original[key] != null) next[key] = original[key];
|
|
58
|
+
if (original.color) next.color.copy(original.color);
|
|
59
|
+
if (original.emissive) next.emissive.copy(original.emissive);
|
|
60
|
+
if (original.normalScale) next.normalScale.copy(original.normalScale);
|
|
61
|
+
} else {
|
|
62
|
+
next = original.clone();
|
|
63
|
+
if ('roughness' in next) next.roughness = pack.material.roughness;
|
|
64
|
+
if ('metalness' in next) next.metalness = pack.material.metalness;
|
|
65
|
+
next.flatShading = pack.material.mode === 'flat';
|
|
66
|
+
}
|
|
67
|
+
next.needsUpdate = true; cache.set(original, next); return next;
|
|
68
|
+
}
|
|
69
|
+
prepare(pack, targets, reuse = false) {
|
|
70
|
+
const cache = reuse ? new Map(this.derived) : new Map(), warnings = new Set(), assignments = [];
|
|
71
|
+
const existing = new Set(this.derived.values());
|
|
72
|
+
try {
|
|
73
|
+
for (const mesh of targets) {
|
|
74
|
+
const original = this.originals.get(mesh)?.material || mesh.material;
|
|
75
|
+
const converted = array(original).map(material => this.material(material, pack, cache, warnings));
|
|
76
|
+
assignments.push({ mesh, material: Array.isArray(original) ? converted : converted[0], original, previous: mesh.material, geometry: mesh.geometry });
|
|
77
|
+
}
|
|
78
|
+
return { cache, warnings: [...warnings], assignments };
|
|
79
|
+
} catch (error) { for (const material of cache.values()) if (!existing.has(material)) material.dispose(); throw error; }
|
|
80
|
+
}
|
|
81
|
+
makeRig(pack) {
|
|
82
|
+
const rig = new THREE.Group(); rig.name = '$agentscape-style-lights'; rig.userData.visualDecorationRoot = true;
|
|
83
|
+
const ambient = new THREE.AmbientLight('#ffffff', pack.lighting.ambient);
|
|
84
|
+
const directional = new THREE.DirectionalLight('#ffffff', pack.lighting.directional);
|
|
85
|
+
directional.position.set(8, 12, 6); directional.castShadow = pack.postprocessing.shadows;
|
|
86
|
+
rig.add(ambient, directional); return rig;
|
|
87
|
+
}
|
|
88
|
+
releaseRig(rig) { if (!rig) return; rig.removeFromParent(); rig.traverse(node => { if (node.isLight) node.dispose?.(); }); }
|
|
89
|
+
applyScene(pack, refresh = false) {
|
|
90
|
+
const renderer = this.getRenderer();
|
|
91
|
+
this.scene.background = new THREE.Color(pack.scene.background);
|
|
92
|
+
this.scene.fog = pack.scene.fog ? new THREE.Fog(pack.scene.fog.color, pack.scene.fog.near, pack.scene.fog.far) : null;
|
|
93
|
+
renderer.toneMappingExposure = pack.postprocessing.exposure;
|
|
94
|
+
renderer.toneMapping = pack.postprocessing.toneMapping === 'aces' ? THREE.ACESFilmicToneMapping : THREE.LinearToneMapping;
|
|
95
|
+
if (renderer.shadowMap) renderer.shadowMap.enabled = pack.postprocessing.shadows;
|
|
96
|
+
// Gameplay may read its own light state; visual lighting owns a separate rig.
|
|
97
|
+
if (!refresh || !this.rig) { this.rig?.removeFromParent(); this.rig = this.makeRig(pack); }
|
|
98
|
+
if (this.rig.parent !== this.scene) this.scene.add(this.rig);
|
|
99
|
+
}
|
|
100
|
+
async set(input, { fallback = 'reject' } = {}) {
|
|
101
|
+
let pack = resolveStylePack(input); const visited = new Set();
|
|
102
|
+
const requested = pack.id;
|
|
103
|
+
while (pack.requires.some(capability => !this.capabilities().has(capability))) {
|
|
104
|
+
if (fallback !== 'declared' || !pack.fallbackStyle || visited.has(pack.id) || visited.size >= 8) throw fail('STYLE_CAPABILITY_UNAVAILABLE');
|
|
105
|
+
visited.add(pack.id); pack = resolveStylePack(pack.fallbackStyle);
|
|
106
|
+
}
|
|
107
|
+
const renderer = this.getRenderer();
|
|
108
|
+
if (!renderer) { this.current = pack; return { status: 'deferred', pack: structuredClone(pack), requested, applied: null, warnings: this.notify(), rendered: false }; }
|
|
109
|
+
if (typeof renderer.compileAsync !== 'function') throw fail('STYLE_RENDERER_UNSUPPORTED');
|
|
110
|
+
const prepared = this.prepare(pack, meshes(this.scene));
|
|
111
|
+
const previous = this.capture();
|
|
112
|
+
const programs = new Set(renderer.info?.programs || []);
|
|
113
|
+
let committing = false;
|
|
114
|
+
let stagedRig;
|
|
115
|
+
try {
|
|
116
|
+
const stage = cloneVisual(this.scene), staged = meshes(stage);
|
|
117
|
+
stage.getObjectByName('$agentscape-style-lights')?.removeFromParent();
|
|
118
|
+
stagedRig = this.makeRig(pack); stage.add(stagedRig);
|
|
119
|
+
for (let index = 0; index < staged.length; index++) staged[index].material = prepared.assignments[index].material;
|
|
120
|
+
let timer;
|
|
121
|
+
try { await Promise.race([renderer.compileAsync(stage, this.getCamera()), new Promise((_, reject) => { timer = setTimeout(() => reject(fail('STYLE_PREPARATION_TIMEOUT')), this.prepareTimeoutMs); })]); }
|
|
122
|
+
finally { clearTimeout(timer); }
|
|
123
|
+
if ((renderer.info?.programs || []).some(program => !programs.has(program) && program.diagnostics?.runnable === false)) throw fail('STYLE_COMPILE_FAILED');
|
|
124
|
+
const live = meshes(this.scene);
|
|
125
|
+
if (live.length !== prepared.assignments.length || prepared.assignments.some((entry, index) => live[index] !== entry.mesh || entry.mesh.material !== entry.previous || entry.mesh.geometry !== entry.geometry)) throw fail('STYLE_SCENE_CHANGED');
|
|
126
|
+
// Synchronous commit: no visible half-style frame between assignments.
|
|
127
|
+
committing = true;
|
|
128
|
+
for (const entry of prepared.assignments) {
|
|
129
|
+
if (!this.originals.has(entry.mesh)) this.originals.set(entry.mesh, { material: entry.original });
|
|
130
|
+
entry.mesh.material = entry.material;
|
|
131
|
+
}
|
|
132
|
+
this.applyScene(pack);
|
|
133
|
+
} catch (error) {
|
|
134
|
+
if (committing) {
|
|
135
|
+
for (const entry of prepared.assignments) entry.mesh.material = entry.previous;
|
|
136
|
+
this.restoreVisual(previous);
|
|
137
|
+
}
|
|
138
|
+
for (const material of prepared.cache.values()) material.dispose();
|
|
139
|
+
throw error.code ? error : Object.assign(fail('STYLE_PREPARATION_FAILED'), { cause: error });
|
|
140
|
+
} finally { this.releaseRig(stagedRig); }
|
|
141
|
+
this.base ||= previous;
|
|
142
|
+
if (previous.rig !== this.rig) this.releaseRig(previous.rig);
|
|
143
|
+
for (const material of this.derived.values()) material.dispose();
|
|
144
|
+
this.derived = prepared.cache; this.current = pack;
|
|
145
|
+
return { status: 'applied', pack: structuredClone(pack), requested, applied: pack.id, warnings: [...prepared.warnings, ...this.notify(), ...(requested !== pack.id ? ['STYLE_FALLBACK_APPLIED'] : [])], rendered: true };
|
|
146
|
+
}
|
|
147
|
+
refresh() {
|
|
148
|
+
if (!this.current || !this.getRenderer()) return;
|
|
149
|
+
this.base ||= this.capture();
|
|
150
|
+
const targets = meshes(this.scene).filter(mesh => !this.originals.has(mesh));
|
|
151
|
+
const prepared = this.prepare(this.current, targets, true);
|
|
152
|
+
for (const entry of prepared.assignments) { this.originals.set(entry.mesh, { material: entry.original }); entry.mesh.material = entry.material; }
|
|
153
|
+
this.derived = prepared.cache;
|
|
154
|
+
this.applyScene(this.current, true);
|
|
155
|
+
}
|
|
156
|
+
restoreMeshes(predicate, releaseOriginals = false) {
|
|
157
|
+
const removed = new Set();
|
|
158
|
+
for (const [mesh, original] of this.originals) if (predicate(mesh)) { mesh.material = original.material; array(original.material).forEach(material => removed.add(material)); this.originals.delete(mesh); }
|
|
159
|
+
const used = new Set([...this.originals.values()].flatMap(value => array(value.material)));
|
|
160
|
+
for (const [original, material] of this.derived) if (!used.has(original)) { material.dispose(); this.derived.delete(original); }
|
|
161
|
+
if (releaseOriginals) for (const material of removed) if (!used.has(material)) material.dispose();
|
|
162
|
+
}
|
|
163
|
+
dispose() {
|
|
164
|
+
this.clear();
|
|
165
|
+
this.unsub.forEach(unsubscribe => unsubscribe()); this.unsub = [];
|
|
166
|
+
}
|
|
167
|
+
clear() {
|
|
168
|
+
this.restoreMeshes(() => true);
|
|
169
|
+
if (this.base) this.restoreVisual(this.base);
|
|
170
|
+
this.current = null; this.base = null;
|
|
171
|
+
this.notify();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{"id": "RENDERING-001", "type": "test", "title": "为 renderer mode 非法值 normalization 增加测试", "status": "DONE", "priority": "P1", "path": "core.rendering", "depends": [], "files": ["modules/rendering/createRenderer.js"], "criteria": ["非法 mode 回落策略稳定"]}
|
|
2
|
+
{"id": "RENDERING-002", "type": "test", "title": "WebGPU 初始化失败时验证 WebGL2 fallback diagnostics", "status": "DONE", "priority": "P1", "path": "core.rendering", "depends": ["RENDERING-001"], "files": ["modules/rendering/createRenderer.js"], "criteria": ["diagnostics 明确 requested/backend/fallback"]}
|
|
3
|
+
{"id": "RENDERING-003", "type": "test", "title": "RendererProbe 在无 timestamp-query 时返回 supported=false", "status": "DONE", "priority": "P1", "path": "core.rendering", "depends": [], "files": ["modules/rendering/RendererProbe.js"], "criteria": ["不抛错,GPU timing 标 unavailable"]}
|
|
4
|
+
{"id": "RENDERING-008", "type": "test", "title": "Gaussian budget 对 maxSplats=0 明确行为", "status": "DONE", "priority": "P1", "path": "core.rendering", "depends": [], "files": ["modules/rendering/loadGaussianSplatVisual.js"], "criteria": ["返回空或明确错误,测试固定"]}
|
|
5
|
+
{"id": "RENDERING-009", "type": "test", "title": "Gaussian budget 超限抽样保持 deterministic", "status": "DONE", "priority": "P1", "path": "core.rendering", "depends": ["RENDERING-008"], "files": ["modules/rendering/loadGaussianSplatVisual.js"], "criteria": ["同输入两次选中相同 splat 集"]}
|
|
6
|
+
{"id": "RENDERING-011", "type": "test", "title": "PostFX option normalization 非有限数字 fail/normalize", "status": "DONE", "priority": "P2", "path": "core.rendering", "depends": [], "files": ["modules/rendering/WebGpuPostFxPipeline.js"], "criteria": ["不向 GPU 传 NaN/Infinity"]}
|
|
7
|
+
{"id": "RENDERING-012", "type": "test", "title": "PostFX dispose 后重复 dispose 幂等", "status": "DONE", "priority": "P2", "path": "core.rendering", "depends": [], "files": ["modules/rendering/WebGpuPostFxPipeline.js"], "criteria": ["第二次 dispose 不抛且无资源访问"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# World
|
|
2
|
+
|
|
3
|
+
负责世界描述与编译、实例状态、物理/导航/交互/仿真、变更保护与验证。
|
|
4
|
+
入口:runtime/WorldRuntime.js、compiler/createWorldPipeline.js。
|
|
5
|
+
spec/compiler/runtime/verification 等已有子系统保留,不按统一模块模板重新拆分。
|
|
6
|
+
生成世界坐标语义现在位于 generated/。
|
|
7
|
+
|
|
8
|
+
World 只消费限定的 Asset 契约,不调用 Provider。
|
|
9
|
+
WorldRuntime 可独立 headless 运行;展示能力通过 attachRendering() 可选连接。编辑入口和结果证据的进一步封装需具体任务驱动。
|
|
10
|
+
|
|
11
|
+
六大 Runtime System 的冻结依赖、truth ownership、mutation/invalidation 与 simulation frame 见 [`../../docs/architecture/world-runtime.md`](../../docs/architecture/world-runtime.md)。
|
|
12
|
+
|
|
13
|
+
任务见 tasks.jsonl。验证:npm run test:world 和 npm run world:viability。
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { createCanonicalWorldPipeline } from '../compiler/createWorldPipeline.js';
|
|
2
|
+
import { buildWorldRetryPlan } from '../compiler/WorldRetry.js';
|
|
3
|
+
import { recompileWorldRevision } from '../compiler/WorldRecompiler.js';
|
|
4
|
+
import { captureWorldAuthority, restoreWorldAuthority } from '../runtime/WorldAuthority.js';
|
|
5
|
+
|
|
6
|
+
export class WorldBuilder {
|
|
7
|
+
constructor(runtime, { pipeline = null, retryBudget = 2 } = {}) {
|
|
8
|
+
if (!runtime) throw new TypeError('WorldBuilder requires a runtime');
|
|
9
|
+
if (!Number.isInteger(retryBudget) || retryBudget < 1) throw new TypeError('WorldBuilder retryBudget must be a positive integer');
|
|
10
|
+
this.runtime = runtime;
|
|
11
|
+
this.pipeline = pipeline || createCanonicalWorldPipeline(runtime);
|
|
12
|
+
this.retryBudget = retryBudget;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async run(plan) {
|
|
16
|
+
const runtime = this.runtime;
|
|
17
|
+
const before = runtime.snapshot();
|
|
18
|
+
const authorityBefore = captureWorldAuthority(runtime);
|
|
19
|
+
const attempts = [];
|
|
20
|
+
let candidate = plan;
|
|
21
|
+
|
|
22
|
+
const restoreBefore = async (cause = null) => {
|
|
23
|
+
try {
|
|
24
|
+
await runtime.restoreSnapshot(before);
|
|
25
|
+
restoreWorldAuthority(runtime,authorityBefore);
|
|
26
|
+
} catch (rollbackError) {
|
|
27
|
+
const failure = new AggregateError(
|
|
28
|
+
cause ? [cause, rollbackError] : [rollbackError],
|
|
29
|
+
'World build rollback failed',
|
|
30
|
+
cause ? { cause } : undefined
|
|
31
|
+
);
|
|
32
|
+
failure.code = 'WORLD_BUILD_ROLLBACK_FAILED'; runtime.quarantine?.(failure.code);
|
|
33
|
+
failure.rollbackError = rollbackError;
|
|
34
|
+
throw failure;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const runCandidate = async (candidatePlan) => {
|
|
39
|
+
try {
|
|
40
|
+
runtime.loadRuleGraph?.([]);
|
|
41
|
+
await runtime.clearObjects({ silent:true });
|
|
42
|
+
return await this.pipeline.run(candidatePlan);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
await restoreBefore(error);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
for (let attempt = 1; attempt <= this.retryBudget; attempt++) {
|
|
50
|
+
const pipeline = await runCandidate(candidate);
|
|
51
|
+
const admission = pipeline.state?.reports?.worldAdmission;
|
|
52
|
+
if (!admission) {
|
|
53
|
+
const error = new Error('Canonical world pipeline produced no world admission');
|
|
54
|
+
error.code = 'WORLD_PIPELINE_ADMISSION_MISSING';
|
|
55
|
+
await restoreBefore(error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const record = { attempt, admission:structuredClone(admission) };
|
|
60
|
+
attempts.push(record);
|
|
61
|
+
if (admission.status !== 'rejected') {
|
|
62
|
+
return {
|
|
63
|
+
status:`world-${admission.status}`,
|
|
64
|
+
admission,
|
|
65
|
+
pipeline,
|
|
66
|
+
attempts,
|
|
67
|
+
retry:attempts.length > 1 ? attempts.at(-2).retry : null
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
await restoreBefore();
|
|
72
|
+
const retry = buildWorldRetryPlan(pipeline, {
|
|
73
|
+
generatorConfigured:runtime.generation?.canGenerateAsset?.() === true,
|
|
74
|
+
attempt,
|
|
75
|
+
budget:this.retryBudget
|
|
76
|
+
});
|
|
77
|
+
record.retry = retry;
|
|
78
|
+
if (retry.status !== 'retry-proposed') {
|
|
79
|
+
return {
|
|
80
|
+
status:'world-rejected',
|
|
81
|
+
reason:admission.reasons?.[0] || 'WORLD_REJECTED',
|
|
82
|
+
rolledBack:true,
|
|
83
|
+
admission,
|
|
84
|
+
pipeline,
|
|
85
|
+
attempts,
|
|
86
|
+
retry
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const generation = await this.materializeRetryAssets(retry);
|
|
91
|
+
record.generation = generation.status === 'generated'
|
|
92
|
+
? { status:generation.status, assets:structuredClone(generation.assets) }
|
|
93
|
+
: { status:generation.status, reason:generation.reason, ...(generation.error ? { error:generation.error } : {}) };
|
|
94
|
+
if (generation.status !== 'generated') {
|
|
95
|
+
const failedRetry = { ...retry, status:'generation-failed', retriable:false, generation:record.generation };
|
|
96
|
+
record.retry = failedRetry;
|
|
97
|
+
return {
|
|
98
|
+
status:'world-rejected',
|
|
99
|
+
reason:generation.reason || 'GENERATION_FAILED',
|
|
100
|
+
rolledBack:true,
|
|
101
|
+
admission,
|
|
102
|
+
pipeline,
|
|
103
|
+
attempts,
|
|
104
|
+
retry:failedRetry
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
candidate = generation.plan;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
throw new Error('World retry loop exceeded its fixed budget');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
recompile(options = {}) {
|
|
114
|
+
return recompileWorldRevision(this.runtime, { ...options, pipeline:this.pipeline });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async materializeRetryAssets(retry) {
|
|
118
|
+
const runtime = this.runtime;
|
|
119
|
+
if (retry?.status !== 'retry-proposed') return { status:'not-requested', plan:retry?.nextIR || null, assets:[] };
|
|
120
|
+
if (typeof runtime.generation?.generateAsset !== 'function') {
|
|
121
|
+
return { status:'generation-failed', reason:'GENERATOR_UNAVAILABLE', plan:null, assets:[] };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const plan = structuredClone(retry.nextIR);
|
|
125
|
+
const generated = [];
|
|
126
|
+
for (const action of retry.actions || []) {
|
|
127
|
+
if (action.kind !== 'enable-generation') continue;
|
|
128
|
+
const entity = plan.entities.find((item) =>
|
|
129
|
+
(action.instanceId && item.id === action.instanceId)
|
|
130
|
+
|| (!action.instanceId && item.asset?.query === action.query)
|
|
131
|
+
);
|
|
132
|
+
if (!entity) {
|
|
133
|
+
return { status:'generation-failed', reason:'RETRY_ENTITY_NOT_FOUND', plan:null, assets:generated, action:structuredClone(action) };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const asset = entity.asset || {};
|
|
137
|
+
const prompt = asset.prompt || asset.query || asset.type || action.query || '';
|
|
138
|
+
let produced;
|
|
139
|
+
try {
|
|
140
|
+
produced = await runtime.generation.generateAsset(prompt, {
|
|
141
|
+
...(entity.id ? { instanceId:entity.id } : {}),
|
|
142
|
+
...(asset.provider ? { provider:asset.provider } : {})
|
|
143
|
+
});
|
|
144
|
+
} catch (error) {
|
|
145
|
+
return {
|
|
146
|
+
status:'generation-failed',
|
|
147
|
+
reason:error?.code || 'GENERATION_FAILED',
|
|
148
|
+
plan:null,
|
|
149
|
+
assets:generated,
|
|
150
|
+
error:{ code:error?.code || 'GENERATION_FAILED', message:error?.message || String(error) }
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const assetId = produced?.id || null;
|
|
155
|
+
if (!assetId || runtime.assetModule?.hasAsset?.(assetId) !== true) {
|
|
156
|
+
return {
|
|
157
|
+
status:'generation-failed',
|
|
158
|
+
reason:produced?.status || 'GENERATED_ASSET_NOT_PUBLISHED',
|
|
159
|
+
plan:null,
|
|
160
|
+
assets:generated,
|
|
161
|
+
result:produced ? structuredClone(produced) : null
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
entity.asset = { ...asset, assetId };
|
|
165
|
+
generated.push({ instanceId:entity.id || null, assetId, status:produced.status || 'generated' });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return { status:'generated', plan, assets:generated };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class PipelineEngine {
|
|
2
|
+
constructor({ events = null, trace = null } = {}) {
|
|
3
|
+
this.events = events;
|
|
4
|
+
this.trace = trace;
|
|
5
|
+
this.stages = new Map();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
register(name, handler) {
|
|
9
|
+
if (this.stages.has(name)) throw new Error(`Pipeline stage already exists: ${name}`);
|
|
10
|
+
this.stages.set(name, handler);
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async run(input, { stages, context = {} } = {}) {
|
|
15
|
+
const selected = stages || [...this.stages.keys()];
|
|
16
|
+
let state = { input, artifacts: {}, reports: {}, ...context };
|
|
17
|
+
const timeline = [];
|
|
18
|
+
for (const name of selected) {
|
|
19
|
+
const handler = this.stages.get(name);
|
|
20
|
+
if (!handler) throw new Error(`Unknown pipeline stage: ${name}`);
|
|
21
|
+
const started = performance.now();
|
|
22
|
+
this.events?.emit('pipeline.stage.started', { name });
|
|
23
|
+
this.trace?.emit('pipeline.stage.started', { name }, { actor: 'pipeline' });
|
|
24
|
+
state = await handler(state) || state;
|
|
25
|
+
const elapsedMs = Math.round(performance.now() - started);
|
|
26
|
+
timeline.push({ name, elapsedMs });
|
|
27
|
+
this.events?.emit('pipeline.stage.completed', { name, elapsedMs });
|
|
28
|
+
this.trace?.emit('pipeline.stage.completed', { name, elapsedMs }, { actor: 'pipeline' });
|
|
29
|
+
}
|
|
30
|
+
return { state, timeline };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const clone = (value) => value == null ? value : structuredClone(value);
|
|
2
|
+
|
|
3
|
+
export function evaluateWorldAdmission({
|
|
4
|
+
validation = null,
|
|
5
|
+
acceptance = null,
|
|
6
|
+
assetAdmission = null,
|
|
7
|
+
layoutAdmission = null,
|
|
8
|
+
behaviorAdmission = null,
|
|
9
|
+
physicsAdmission = null,
|
|
10
|
+
relationAdmission = null
|
|
11
|
+
} = {}) {
|
|
12
|
+
const hard = validation?.counts?.hard || 0;
|
|
13
|
+
const advisory = validation?.counts?.advisory || 0;
|
|
14
|
+
const acceptanceRejected = acceptance?.status === 'world-incomplete';
|
|
15
|
+
const rejected = [assetAdmission, layoutAdmission, behaviorAdmission, physicsAdmission, relationAdmission]
|
|
16
|
+
.some((admission) => admission?.status === 'rejected');
|
|
17
|
+
const provisional = advisory
|
|
18
|
+
|| assetAdmission?.status === 'provisional'
|
|
19
|
+
|| layoutAdmission?.status === 'provisional';
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
status: hard || rejected || acceptanceRejected ? 'rejected' : provisional ? 'provisional' : 'ready',
|
|
23
|
+
reasons: [
|
|
24
|
+
...(hard ? [`VALIDATION_HARD:${hard}`] : []),
|
|
25
|
+
...(advisory ? [`VALIDATION_ADVISORY:${advisory}`] : []),
|
|
26
|
+
...(assetAdmission?.status === 'rejected' ? ['ASSET_UNRESOLVED'] : []),
|
|
27
|
+
...(assetAdmission?.status === 'provisional' ? ['ASSET_PROVISIONAL'] : []),
|
|
28
|
+
...(layoutAdmission?.status === 'rejected' ? [layoutAdmission.reason || 'LAYOUT_REJECTED'] : []),
|
|
29
|
+
...(layoutAdmission?.status === 'provisional' ? ['LAYOUT_PROVISIONAL'] : []),
|
|
30
|
+
...(behaviorAdmission?.status === 'rejected' ? [behaviorAdmission.reason || behaviorAdmission.issues?.[0]?.code || 'BEHAVIOR_REJECTED'] : []),
|
|
31
|
+
...(physicsAdmission?.status === 'rejected' ? [physicsAdmission.reason || physicsAdmission.issues?.[0]?.code || 'PHYSICS_REJECTED'] : []),
|
|
32
|
+
...(relationAdmission?.status === 'rejected' ? [relationAdmission.reason || 'RELATION_REJECTED'] : []),
|
|
33
|
+
...(acceptanceRejected ? ['WORLD_ACCEPTANCE_FAILED'] : [])
|
|
34
|
+
],
|
|
35
|
+
validation: { hard, advisory },
|
|
36
|
+
...(assetAdmission ? { assets:clone(assetAdmission) } : {}),
|
|
37
|
+
...(layoutAdmission ? { layout:clone(layoutAdmission) } : {}),
|
|
38
|
+
...(behaviorAdmission ? { behavior:clone(behaviorAdmission) } : {}),
|
|
39
|
+
...(physicsAdmission ? { physics:clone(physicsAdmission) } : {}),
|
|
40
|
+
...(relationAdmission ? { relations:clone(relationAdmission) } : {}),
|
|
41
|
+
...(acceptance ? { acceptance:clone(acceptance) } : {})
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { assetIdFromRef } from '../../asset/model/AssetRef.js';
|
|
2
|
+
import { inferCarryCapability, isCarryOperation } from '../runtime/interaction/CarryCapability.js';
|
|
3
|
+
import { compileBehaviorGraph } from '../runtime/behavior/BehaviorCompiler.js';
|
|
4
|
+
import { compileRuleGraph } from '../runtime/behavior/RuleGraph.js';
|
|
5
|
+
|
|
6
|
+
export const WORLD_BEHAVIOR_BUNDLE_SCHEMA='agentscape.world-behavior-bundle';
|
|
7
|
+
export const WORLD_BEHAVIOR_BUNDLE_VERSION=1;
|
|
8
|
+
|
|
9
|
+
export function compileWorldBehaviorBundle(worldIR){
|
|
10
|
+
const entityIds=new Set((worldIR?.entities||[]).map((entity)=>entity.id).filter(Boolean));
|
|
11
|
+
const behaviorGraph=compileBehaviorGraph(worldIR?.interactions||[],{worldRevisionId:worldIR?.revision?.id || null});
|
|
12
|
+
for(const command of behaviorGraph.commands){
|
|
13
|
+
for(const [field,id] of [['targetId',command.targetId],['supportId',command.supportId]]){
|
|
14
|
+
if(id&&!entityIds.has(id)){
|
|
15
|
+
const error=new Error(`Behavior ${field} is outside World IR entities: ${id}`);
|
|
16
|
+
error.code='WORLD_BEHAVIOR_REFERENCE_INVALID'; error.commandId=command.commandId; error.entityId=id; throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const capabilityIntents=(worldIR?.entities||[])
|
|
21
|
+
.filter((entity)=>entity.id && entity.capabilityIntent?.length)
|
|
22
|
+
.map((entity)=>({entityId:entity.id,capabilities:[...entity.capabilityIntent]}));
|
|
23
|
+
const ruleGraph=compileRuleGraph(worldIR?.rules||[]);
|
|
24
|
+
for(const rule of ruleGraph.rules){
|
|
25
|
+
const refs=[rule.condition?.targetId,rule.effect?.targetId].filter(Boolean);
|
|
26
|
+
for(const id of refs){
|
|
27
|
+
if(!entityIds.has(id)){
|
|
28
|
+
const error=new Error(`Rule target is outside World IR entities: ${id}`);
|
|
29
|
+
error.code='WORLD_RULE_REFERENCE_INVALID'; error.ruleId=rule.id; error.entityId=id; throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {schema:WORLD_BEHAVIOR_BUNDLE_SCHEMA,schemaVersion:WORLD_BEHAVIOR_BUNDLE_VERSION,worldRevisionId:worldIR?.revision?.id || null,capabilityIntents,behaviorGraph,ruleGraph};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function admitWorldBehavior(bundle,{resolvedAssets=[],getManifest}={}){
|
|
37
|
+
if(bundle?.schema!==WORLD_BEHAVIOR_BUNDLE_SCHEMA||bundle.schemaVersion!==WORLD_BEHAVIOR_BUNDLE_VERSION) throw new TypeError('Unsupported WorldBehavior bundle');
|
|
38
|
+
const byId=new Map((resolvedAssets||[]).filter((item)=>item.id).map((item)=>[item.id,item]));
|
|
39
|
+
const issues=[];
|
|
40
|
+
for(const intent of bundle.capabilityIntents||[]){
|
|
41
|
+
const target=byId.get(intent.entityId);
|
|
42
|
+
if(!target){issues.push({code:'BEHAVIOR_INTENT_TARGET_MISSING',targetId:intent.entityId});continue;}
|
|
43
|
+
const assetId=assetIdFromRef(target.assetRef);
|
|
44
|
+
if(!assetId){issues.push({code:'BEHAVIOR_INTENT_TARGET_UNRESOLVED',targetId:intent.entityId});continue;}
|
|
45
|
+
const manifest=getManifest?.(assetId);
|
|
46
|
+
const actions=new Set((manifest?.actions||[]).map((action)=>String(action).toUpperCase()));
|
|
47
|
+
if (inferCarryCapability(manifest).eligible) for (const name of ['PICKUP','DROP','PLACE']) actions.add(name);
|
|
48
|
+
else if (manifest?.physics?.carryable === false) for (const name of ['PICKUP','DROP','PLACE']) actions.delete(name);
|
|
49
|
+
for(const capability of intent.capabilities){
|
|
50
|
+
if(!actions.has(capability)) issues.push({code:'BEHAVIOR_CAPABILITY_INTENT_UNSUPPORTED',targetId:intent.entityId,capability,assetId});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
for(const command of bundle.behaviorGraph.commands){
|
|
54
|
+
const targetId=command.targetId;
|
|
55
|
+
const target=targetId?byId.get(targetId):null;
|
|
56
|
+
if(targetId&&!target){issues.push({code:'BEHAVIOR_TARGET_MISSING',commandId:command.commandId,targetId});continue;}
|
|
57
|
+
const assetId=assetIdFromRef(target?.assetRef);
|
|
58
|
+
if(targetId&&!assetId){issues.push({code:'BEHAVIOR_TARGET_UNRESOLVED',commandId:command.commandId,targetId});continue;}
|
|
59
|
+
if(['OPEN','CLOSE','PICKUP'].includes(command.capability)){
|
|
60
|
+
const manifest=getManifest?.(assetId);
|
|
61
|
+
const action=command.capability.toLowerCase();
|
|
62
|
+
const supported = (manifest?.actions?.includes(action) || (isCarryOperation(action) && inferCarryCapability(manifest).eligible))
|
|
63
|
+
&& (!isCarryOperation(action) || manifest?.physics?.carryable !== false);
|
|
64
|
+
if(!supported) issues.push({code:'BEHAVIOR_CAPABILITY_UNSUPPORTED',commandId:command.commandId,targetId,capability:command.capability,assetId});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {status:issues.length?'rejected':'ready',issues};
|
|
68
|
+
}
|