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 { validateAssetManifest } from '../../model/schema.js';
|
|
2
|
+
import { createAssetGLTFIO } from './gltfIO.js';
|
|
3
|
+
import { GLTFInspectPass } from './passes/GLTFInspectPass.js';
|
|
4
|
+
import { JointFramePass } from './passes/JointFramePass.js';
|
|
5
|
+
import { SegmentMaterializePass } from './passes/SegmentMaterializePass.js';
|
|
6
|
+
import { SegmentationEvidencePass } from './passes/SegmentationEvidencePass.js';
|
|
7
|
+
import { PartColliderPass } from './passes/PartColliderPass.js';
|
|
8
|
+
import { PartProposalPass } from './passes/PartProposalPass.js';
|
|
9
|
+
import { PartGeometryEnrichmentPass } from './passes/PartGeometryEnrichmentPass.js';
|
|
10
|
+
import { ArticulatedCollisionPass } from './passes/ArticulatedCollisionPass.js';
|
|
11
|
+
import { OptimizeGLBPass } from './passes/OptimizeGLBPass.js';
|
|
12
|
+
import { StructurePass } from './passes/StructurePass.js';
|
|
13
|
+
import { NormalizeTransformPass } from './passes/NormalizeTransformPass.js';
|
|
14
|
+
import { GeometryPass } from './passes/GeometryPass.js';
|
|
15
|
+
import { SemanticHeuristicPass } from './passes/SemanticHeuristicPass.js';
|
|
16
|
+
import { ArticulationCandidatePass } from './passes/ArticulationCandidatePass.js';
|
|
17
|
+
import { KinematicEvidencePass } from './passes/KinematicEvidencePass.js';
|
|
18
|
+
import { ColliderFallbackPass } from './passes/ColliderFallbackPass.js';
|
|
19
|
+
import { RemoteEnrichmentPass } from './passes/RemoteEnrichmentPass.js';
|
|
20
|
+
import { ResourceBudgetPass } from './passes/ResourceBudgetPass.js';
|
|
21
|
+
import { RESOURCE_BUDGET } from '../../model/resourceBudget.js';
|
|
22
|
+
import { CompileQualityPass } from './passes/CompileQualityPass.js';
|
|
23
|
+
import { ManifestPass } from './passes/ManifestPass.js';
|
|
24
|
+
import { AuthoringIntentPass } from './passes/AuthoringIntentPass.js';
|
|
25
|
+
import { ExplicitDefinitionPass } from './passes/ExplicitDefinitionPass.js';
|
|
26
|
+
import { assertEmbeddedGLB, interactionReviewSchema, assetDigest, canonicalAssetJson } from '../../model/AssetInputContracts.js';
|
|
27
|
+
|
|
28
|
+
export class AssetCompiler {
|
|
29
|
+
async compileVisual({ bytes, assetId, label = 'Imported model', persist = true }) {
|
|
30
|
+
assertEmbeddedGLB(bytes);
|
|
31
|
+
let context = { bytes, assetId, authoringIntent: { usage: 'static' }, compilerVersion: this.version };
|
|
32
|
+
for (const pass of [new GLTFInspectPass({ io: this.io }), new StructurePass(), new GeometryPass(), new OptimizeGLBPass({ io: this.io }), new ResourceBudgetPass()]) context = await pass.run(context);
|
|
33
|
+
const hard = [...context.geometry.warnings.filter(w => w.severity === 'hard'), ...context.resources.hard];
|
|
34
|
+
const advisory = [...context.geometry.warnings.filter(w => w.severity !== 'hard'), ...context.resources.advisory];
|
|
35
|
+
const quality = { status: hard.length ? 'rejected' : advisory.length ? 'provisional' : 'ready', hard, advisory };
|
|
36
|
+
if (hard.length) throw Object.assign(new Error('Visual asset rejected'), { code: 'ASSET_COMPILE_REJECTED', details: quality });
|
|
37
|
+
const manifest = { id: assetId, type: 'visual', label, capabilityLevel: 'visual', actions: [], source: { kind: 'compiled', key: assetId }, compiler: { version: this.version, quality, resources: context.resources } };
|
|
38
|
+
validateAssetManifest(manifest);
|
|
39
|
+
if (persist) await this.store.put(assetId, context.optimizedBytes, { manifestId: assetId, quality: quality.status });
|
|
40
|
+
return { manifest, quality, resources: context.resources, optimizedBytes: context.optimizedBytes };
|
|
41
|
+
}
|
|
42
|
+
constructor({ store, provider = null, events = null, version = 'dev' } = {}) {
|
|
43
|
+
this.store = store; this.provider = provider; this.events = events; this.version = version;
|
|
44
|
+
this.io = createAssetGLTFIO();
|
|
45
|
+
this.passes = [
|
|
46
|
+
new GLTFInspectPass({ io: this.io }),
|
|
47
|
+
new StructurePass(),
|
|
48
|
+
new NormalizeTransformPass(),
|
|
49
|
+
new GeometryPass(),
|
|
50
|
+
new KinematicEvidencePass(),
|
|
51
|
+
new SemanticHeuristicPass(),
|
|
52
|
+
new AuthoringIntentPass(),
|
|
53
|
+
new ArticulationCandidatePass(),
|
|
54
|
+
new ColliderFallbackPass(),
|
|
55
|
+
new RemoteEnrichmentPass({ provider }),
|
|
56
|
+
new SegmentMaterializePass(),
|
|
57
|
+
new SegmentationEvidencePass(),
|
|
58
|
+
new JointFramePass(),
|
|
59
|
+
new PartColliderPass(),
|
|
60
|
+
new PartProposalPass(),
|
|
61
|
+
new PartGeometryEnrichmentPass({ provider, io:this.io }),
|
|
62
|
+
new ArticulatedCollisionPass(),
|
|
63
|
+
new OptimizeGLBPass({ io: this.io }),
|
|
64
|
+
new ExplicitDefinitionPass(),
|
|
65
|
+
new ResourceBudgetPass(),
|
|
66
|
+
new CompileQualityPass(),
|
|
67
|
+
new ManifestPass()
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async fetchBytes(url) {
|
|
72
|
+
const response = await fetch(url);
|
|
73
|
+
if (!response.ok) throw new Error(`Failed to fetch GLB: HTTP ${response.status}`);
|
|
74
|
+
const declared = Number(response.headers.get('content-length') || 0);
|
|
75
|
+
if (declared > RESOURCE_BUDGET.maxInputBytes) throw Object.assign(new Error(`GLB exceeds input limit: ${declared}`), { code: 'ASSET_INPUT_TOO_LARGE' });
|
|
76
|
+
if (!response.body) return new Uint8Array(await response.arrayBuffer());
|
|
77
|
+
|
|
78
|
+
const reader = response.body.getReader();
|
|
79
|
+
const chunks = [];
|
|
80
|
+
let total = 0;
|
|
81
|
+
while (true) {
|
|
82
|
+
const { done, value } = await reader.read();
|
|
83
|
+
if (done) break;
|
|
84
|
+
total += value.byteLength;
|
|
85
|
+
if (total > RESOURCE_BUDGET.maxInputBytes) {
|
|
86
|
+
await reader.cancel();
|
|
87
|
+
throw Object.assign(new Error(`GLB exceeds input limit: ${total}`), { code: 'ASSET_INPUT_TOO_LARGE' });
|
|
88
|
+
}
|
|
89
|
+
chunks.push(value);
|
|
90
|
+
}
|
|
91
|
+
const bytes = new Uint8Array(total);
|
|
92
|
+
let offset = 0;
|
|
93
|
+
for (const chunk of chunks) { bytes.set(chunk, offset); offset += chunk.byteLength; }
|
|
94
|
+
return bytes;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async proposeInteraction({bytes,sourceName='import.glb',label,partProposal=null,urdfHash=null}={}) {
|
|
98
|
+
assertEmbeddedGLB(bytes);
|
|
99
|
+
const output=await this.compile({bytes,sourceName,label,assetId:'interaction_candidate',partProposal,interactionProposal:true,
|
|
100
|
+
authoringIntent:{usage:'static'},persist:false});
|
|
101
|
+
const sourceHash=await assetDigest(bytes);
|
|
102
|
+
const parts=(output.partProposal?.parts || []).map(part=>({ ...part, executable:false, physicsVerified:false,
|
|
103
|
+
missing:['mass','friction',...['axis','parentAnchor','childAnchor','limits'].filter(field=>part.joint?.[field]==null).map(field=>`joint.${field}`),'review-confirmation','runtime-verification'] }));
|
|
104
|
+
const proposal={schema:'agentscape.capability-proposal',schemaVersion:1,sourceHash,urdfHash,compilerVersion:this.version,
|
|
105
|
+
physics:{body:null,mass:null,friction:null,colliders:output.manifest.physics.colliders},parts,
|
|
106
|
+
kinematics:output.kinematicEvidence || {schema:'agentscape.kinematic-evidence',schemaVersion:1,hypotheses:[],issues:[]},
|
|
107
|
+
operations:[
|
|
108
|
+
...(output.geometry.bounds.size.every(size=>Number.isFinite(size)&&size>0&&size<=1.25)
|
|
109
|
+
? ['pickup','drop','place'].map(action=>({action,executable:false,physicsVerified:false,requires:'reviewed-dynamic-body-mass-and-carry-geometry'})) : []),
|
|
110
|
+
...['push','drag','rotate'].map(action=>({action,executable:false,physicsVerified:false,requires:'reviewed-dynamic-body'})),
|
|
111
|
+
...parts.filter(part=>['prismatic','revolute'].includes(part.joint?.type)).map(part=>({action:part.joint.type==='prismatic'?'slide':'rotateJoint',part:part.id,executable:false,physicsVerified:false,requires:'reviewed-and-verified-joint'})),
|
|
112
|
+
...(output.articulation.candidates||[]).flatMap(candidate=>(candidate.suggestedActions||[])
|
|
113
|
+
.filter(action=>!['slide','rotateJoint'].includes(action))
|
|
114
|
+
.map(action=>({action,part:candidate.partId||candidate.node,executable:false,physicsVerified:false,
|
|
115
|
+
requires:'semantic-review-and-verified-joint-target'})))
|
|
116
|
+
],
|
|
117
|
+
missing:['physics.body','physics.mass','physics.friction','review-confirmation','runtime-verification'],
|
|
118
|
+
evidence:{geometry:output.geometry.bounds,collisionStrategy:output.collision.strategy,articulationSource:output.partProposal?.source || output.articulation.source,
|
|
119
|
+
confidenceScope:'name-or-source-metadata-only; not physical verification',
|
|
120
|
+
semanticConfidence:output.manifest.compiler.semanticConfidence,jointFrame:output.partProposal?.jointFrame || null,
|
|
121
|
+
issues:output.partProposal?.issues || [],passes:['SemanticHeuristicPass','KinematicEvidencePass','ArticulationCandidatePass','PartColliderPass','JointFramePass']}};
|
|
122
|
+
return {...proposal,proposalId:await assetDigest(new TextEncoder().encode(canonicalAssetJson(proposal)))};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async compile({ url, bytes, sourceName, assetId, label, partProposal = null, partSegmentation = null, providerEvidence = null, authoringIntent = null, definition = null,
|
|
126
|
+
interactionProposal=false,interactionReview=null,persist=true } = {}) {
|
|
127
|
+
if(interactionReview) interactionReview=interactionReviewSchema.parse(interactionReview);
|
|
128
|
+
if (!bytes && !url) throw new Error('AssetCompiler requires url or bytes');
|
|
129
|
+
const inputBytes = bytes instanceof Uint8Array ? bytes : bytes ? new Uint8Array(bytes) : await this.fetchBytes(url);
|
|
130
|
+
if (inputBytes.byteLength > RESOURCE_BUDGET.maxInputBytes) {
|
|
131
|
+
const error = new Error(`GLB exceeds input limit: ${inputBytes.byteLength} > ${RESOURCE_BUDGET.maxInputBytes}`);
|
|
132
|
+
error.code = 'ASSET_INPUT_TOO_LARGE';
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
const name = sourceName || (url ? new URL(url, globalThis.location?.href || 'http://localhost').pathname.split('/').pop() : 'asset.glb');
|
|
136
|
+
let context = { bytes:inputBytes, sourceUrl:url || null, sourceName:name, assetId, label, partProposal, partSegmentation, providerEvidence, authoringIntent, definition, interactionProposal,interactionReview, compilerVersion:this.version };
|
|
137
|
+
for (const pass of this.passes) {
|
|
138
|
+
const started = performance.now();
|
|
139
|
+
this.events?.emit('assetCompiler.pass.started', { pass: pass.constructor.name, sourceName: name });
|
|
140
|
+
context = await pass.run(context);
|
|
141
|
+
this.events?.emit('assetCompiler.pass.completed', { pass: pass.constructor.name, elapsedMs: Math.round(performance.now()-started) });
|
|
142
|
+
}
|
|
143
|
+
validateAssetManifest(context.manifest);
|
|
144
|
+
if (context.quality.status === 'rejected') {
|
|
145
|
+
const error = new Error('Asset compilation rejected by quality gate');
|
|
146
|
+
error.code = 'ASSET_COMPILE_REJECTED';
|
|
147
|
+
error.details = context.quality;
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
const storageKey = context.manifest.source.key;
|
|
151
|
+
if(persist) await this.store.put(storageKey, context.optimizedBytes, { sourceName: name, manifestId: context.manifest.id, quality: context.quality.status });
|
|
152
|
+
return {
|
|
153
|
+
manifest: context.manifest,
|
|
154
|
+
optimizedBytes: context.optimizedBytes,
|
|
155
|
+
inspection: context.inspection,
|
|
156
|
+
structure: context.structure,
|
|
157
|
+
normalization: context.normalization,
|
|
158
|
+
geometry: context.geometry,
|
|
159
|
+
optimization: context.optimization,
|
|
160
|
+
articulation: context.articulation,
|
|
161
|
+
kinematicEvidence: context.kinematicEvidence || null,
|
|
162
|
+
collision: context.collision,
|
|
163
|
+
enrichment: context.enrichment,
|
|
164
|
+
meshQuality: context.meshQuality || null,
|
|
165
|
+
partProposal: context.partProposal || null,
|
|
166
|
+
partSegmentation: context.partSegmentation || null,
|
|
167
|
+
partCollision: context.partCollision || null,
|
|
168
|
+
partGeometry: context.partGeometry || null,
|
|
169
|
+
resources: context.resources,
|
|
170
|
+
quality: context.quality
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from 'three';
|
|
2
|
+
|
|
3
|
+
// Experimental GLB motion-evidence extractor. This reports hypotheses only;
|
|
4
|
+
// it never authorizes or registers a physical interaction.
|
|
5
|
+
const round = value => Number(value.toFixed(6));
|
|
6
|
+
const vec = vector => vector.toArray().map(round);
|
|
7
|
+
const sqDistance = (a, b) => a.reduce((sum, x, i) => sum + (x - b[i]) ** 2, 0);
|
|
8
|
+
const dot = (a, b) => a.reduce((sum, x, i) => sum + x * b[i], 0);
|
|
9
|
+
const norm = value => Math.hypot(...value);
|
|
10
|
+
const sub = (a, b) => a.map((value, index) => value - b[index]);
|
|
11
|
+
const mul = (v, scalar) => v.map(value => value * scalar);
|
|
12
|
+
const hasMesh = node => Boolean(node.getMesh()) || node.listChildren().some(hasMesh);
|
|
13
|
+
const issue = (code, node, clip) => ({ code, node, clip });
|
|
14
|
+
|
|
15
|
+
function readSamples(channel) {
|
|
16
|
+
const sampler = channel.getSampler();
|
|
17
|
+
const path = channel.getTargetPath();
|
|
18
|
+
if (!sampler || sampler.getInterpolation() !== 'LINEAR') return { error:'INTERPOLATION_UNSUPPORTED' };
|
|
19
|
+
const input = sampler.getInput()?.getArray();
|
|
20
|
+
const output = sampler.getOutput()?.getArray();
|
|
21
|
+
const width = path === 'rotation' ? 4 : 3;
|
|
22
|
+
if (!input || !output || input.length < 2 || output.length !== input.length * width
|
|
23
|
+
|| [...input, ...output].some(number => !Number.isFinite(number))
|
|
24
|
+
|| Array.from(input).some((value, index) => index && value <= input[index - 1])) {
|
|
25
|
+
return { error:'ANIMATION_TRACK_INVALID' };
|
|
26
|
+
}
|
|
27
|
+
const samples = Array.from(input, (_, index) =>
|
|
28
|
+
Array.from(output.slice(index * width, (index + 1) * width)));
|
|
29
|
+
return { samples };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function translationMotion(node, samples) {
|
|
33
|
+
const rest = node.getTranslation();
|
|
34
|
+
if (sqDistance(rest, samples[0]) > 1e-6) return { error:'ANIMATION_REST_POSE_MISMATCH' };
|
|
35
|
+
const deltas = samples.map(sample => sub(sample, samples[0]));
|
|
36
|
+
const longest = deltas.reduce((best, value) => norm(value) > norm(best) ? value : best, [0, 0, 0]);
|
|
37
|
+
const span = norm(longest);
|
|
38
|
+
if (span < .03) return null;
|
|
39
|
+
const axis = mul(longest, 1 / span);
|
|
40
|
+
const residual = Math.max(...deltas.map(delta => norm(sub(delta, mul(axis, dot(delta, axis))))));
|
|
41
|
+
if (residual > Math.max(.005, span * .02)) return { error:'TRANSLATION_NONLINEAR' };
|
|
42
|
+
const values = deltas.map(delta => dot(delta, axis));
|
|
43
|
+
return { type:'prismatic', axis:axis.map(round), limits:[round(Math.min(0, ...values)), round(Math.max(0, ...values))],
|
|
44
|
+
residual:round(residual) };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function rotationMotion(node, samples) {
|
|
48
|
+
const start = new Quaternion().fromArray(samples[0]).normalize();
|
|
49
|
+
const rest = new Quaternion().fromArray(node.getRotation()).normalize();
|
|
50
|
+
if (Math.abs(start.dot(rest)) < .9999) return { error:'ANIMATION_REST_POSE_MISMATCH' };
|
|
51
|
+
const inverse = start.clone().invert();
|
|
52
|
+
const deltas = samples.map(sample => {
|
|
53
|
+
const delta = new Quaternion().fromArray(sample).normalize().multiply(inverse);
|
|
54
|
+
if (delta.w < 0) delta.set(-delta.x, -delta.y, -delta.z, -delta.w);
|
|
55
|
+
const sinHalf = Math.hypot(delta.x, delta.y, delta.z);
|
|
56
|
+
return { angle:2 * Math.atan2(sinHalf, delta.w),
|
|
57
|
+
axis:sinHalf > 1e-8 ? new Vector3(delta.x / sinHalf, delta.y / sinHalf, delta.z / sinHalf) : null };
|
|
58
|
+
});
|
|
59
|
+
const largest = deltas.reduce((best, value) => value.angle > best.angle ? value : best, deltas[0]);
|
|
60
|
+
if (largest.angle < .1) return null;
|
|
61
|
+
if (largest.angle > Math.PI - .01) return { error:'ROTATION_RANGE_AMBIGUOUS' };
|
|
62
|
+
const axis = largest.axis;
|
|
63
|
+
const signed = [];
|
|
64
|
+
for (const delta of deltas) {
|
|
65
|
+
if (delta.angle < 1e-5) { signed.push(0); continue; }
|
|
66
|
+
const alignment = delta.axis.dot(axis);
|
|
67
|
+
if (Math.abs(alignment) < .995) return { error:'ROTATION_MULTIPLE_AXES' };
|
|
68
|
+
signed.push(delta.angle * Math.sign(alignment));
|
|
69
|
+
}
|
|
70
|
+
const jumps = signed.slice(1).map((value, index) => Math.abs(value - signed[index]));
|
|
71
|
+
if (Math.max(...jumps) > Math.PI - .01) return { error:'ROTATION_UNWRAP_AMBIGUOUS' };
|
|
72
|
+
return { type:'revolute', axis:vec(axis), limits:[round(Math.min(0, ...signed)), round(Math.max(0, ...signed))],
|
|
73
|
+
residual:round(Math.max(...deltas.map(delta => delta.angle < 1e-5 ? 0 : 1 - Math.abs(delta.axis.dot(axis))))) };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function inferAnimationMotion(document) {
|
|
77
|
+
const candidates = [], issues = [];
|
|
78
|
+
const nodes = document.getRoot().listNodes();
|
|
79
|
+
for (const animation of document.getRoot().listAnimations()) {
|
|
80
|
+
const clip = animation.getName() || '(unnamed)';
|
|
81
|
+
const tracks = new Map();
|
|
82
|
+
for (const channel of animation.listChannels()) {
|
|
83
|
+
const node = channel.getTargetNode();
|
|
84
|
+
const path = channel.getTargetPath();
|
|
85
|
+
if (!node || !['translation', 'rotation', 'scale'].includes(path)) continue;
|
|
86
|
+
if (!tracks.has(node)) tracks.set(node, {});
|
|
87
|
+
const group = tracks.get(node);
|
|
88
|
+
if (group[path]) { issues.push(issue('ANIMATION_DUPLICATE_CHANNEL', node.getName(), clip)); group.error = true; continue; }
|
|
89
|
+
group[path] = path === 'scale' ? { error:'SCALE_ANIMATION_UNSUPPORTED' } : readSamples(channel);
|
|
90
|
+
}
|
|
91
|
+
for (const [node, group] of tracks) {
|
|
92
|
+
if (group.error || !hasMesh(node)) continue;
|
|
93
|
+
if (group.scale) { issues.push(issue('SCALE_ANIMATION_UNSUPPORTED', node.getName(), clip)); continue; }
|
|
94
|
+
const translation = group.translation?.error ? group.translation
|
|
95
|
+
: group.translation ? translationMotion(node, group.translation.samples) : null;
|
|
96
|
+
const rotation = group.rotation?.error ? group.rotation
|
|
97
|
+
: group.rotation ? rotationMotion(node, group.rotation.samples) : null;
|
|
98
|
+
const error = translation?.error || rotation?.error
|
|
99
|
+
|| (translation && rotation ? 'COMPOUND_MOTION_UNSUPPORTED' : null);
|
|
100
|
+
if (error) { issues.push(issue(error, node.getName(), clip)); continue; }
|
|
101
|
+
const motion = rotation || translation;
|
|
102
|
+
if (!motion) continue;
|
|
103
|
+
candidates.push({
|
|
104
|
+
node:node.getName() || null, nodeIndex:nodes.indexOf(node),
|
|
105
|
+
parent:node.getParentNode()?.getName() || '$root',
|
|
106
|
+
hypothesis:{ type:motion.type, axis:motion.axis,
|
|
107
|
+
parentAnchor:node.getTranslation().map(round), childAnchor:[0,0,0],
|
|
108
|
+
limits:motion.limits },
|
|
109
|
+
evidence:{ type:'gltf-animation', clip, sampleCount:(group.rotation || group.translation).samples.length,
|
|
110
|
+
axisResidual:motion.residual, scope:'observed-local-motion-not-mechanical-truth' },
|
|
111
|
+
status:'candidate', executable:false, physicsVerified:false,
|
|
112
|
+
missing:['geometry-contact-analysis','mass-and-colliders','isolated-physics-verification','task-verification']
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Multiple animation clips may depict different motions; no automatic merge
|
|
117
|
+
// without a coherence check, even if one axis looks plausible.
|
|
118
|
+
const count = new Map();
|
|
119
|
+
for (const candidate of candidates) count.set(candidate.nodeIndex, (count.get(candidate.nodeIndex) || 0) + 1);
|
|
120
|
+
for (const [nodeIndex, amount] of count) if (amount > 1)
|
|
121
|
+
issues.push({ code:'MULTIPLE_CLIPS_REQUIRE_REVIEW', node:nodes[nodeIndex].getName() });
|
|
122
|
+
return { schema:'agentscape.motion-evidence-experiment', schemaVersion:1,
|
|
123
|
+
candidates:candidates.filter(candidate => count.get(candidate.nodeIndex) === 1), issues };
|
|
124
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getBounds } from '@gltf-transform/core';
|
|
2
|
+
|
|
3
|
+
// Report-only front/back planar-panel hypotheses. A static mesh does not prove
|
|
4
|
+
// a door or a hinge exists: both edge pivots remain unresolved alternatives.
|
|
5
|
+
const round = value => Number(value.toFixed(5));
|
|
6
|
+
const boxOf = node => {
|
|
7
|
+
const { min, max } = getBounds(node);
|
|
8
|
+
const size = min.map((value, index) => max[index] - value);
|
|
9
|
+
return { node, min, max, size, volume:size.reduce((product, value) => product * Math.max(0, value), 1) };
|
|
10
|
+
};
|
|
11
|
+
const overlap = (a, b, index) => Math.max(0, Math.min(a.max[index], b.max[index]) - Math.max(a.min[index], b.min[index]));
|
|
12
|
+
|
|
13
|
+
export function inferStaticPanelHypotheses(document) {
|
|
14
|
+
const nodes = document.getRoot().listNodes().filter(node => node.getMesh()).map(boxOf)
|
|
15
|
+
.filter(item => item.size.every(value => Number.isFinite(value) && value > 1e-5));
|
|
16
|
+
const body = [...nodes].sort((a, b) => b.volume - a.volume)[0];
|
|
17
|
+
const candidates = [];
|
|
18
|
+
if (!body || body.size[0] < .3 || body.size[1] < .3 || body.size[2] < .15) {
|
|
19
|
+
return { schema:'agentscape.static-panel-experiment',schemaVersion:1,candidates,limitations:['BODY_REFERENCE_NOT_AVAILABLE'] };
|
|
20
|
+
}
|
|
21
|
+
for (const part of nodes) {
|
|
22
|
+
if (part === body) continue;
|
|
23
|
+
const [width, height, depth] = part.size;
|
|
24
|
+
const widthCover = width / body.size[0], heightCover = height / body.size[1];
|
|
25
|
+
const thicknessRatio = depth / Math.min(width, height);
|
|
26
|
+
const xyOverlap = Math.min(overlap(part, body, 0) / width, overlap(part, body, 1) / height);
|
|
27
|
+
const positiveFaceGap = Math.abs(part.min[2] - body.max[2]);
|
|
28
|
+
const negativeFaceGap = Math.abs(part.max[2] - body.min[2]);
|
|
29
|
+
const face = positiveFaceGap <= negativeFaceGap ? 'front' : 'back';
|
|
30
|
+
const faceGap = Math.min(positiveFaceGap, negativeFaceGap);
|
|
31
|
+
const faceThreshold = Math.max(.035, body.size[2] * .09);
|
|
32
|
+
if (widthCover < .3 || widthCover > 1.12
|
|
33
|
+
|| heightCover < .4 || heightCover > 1.12
|
|
34
|
+
|| thicknessRatio > .12 || xyOverlap < .85
|
|
35
|
+
|| faceGap > faceThreshold) continue;
|
|
36
|
+
const centerZ = (part.min[2] + part.max[2]) / 2;
|
|
37
|
+
candidates.push({
|
|
38
|
+
node:part.node.getName() || null,
|
|
39
|
+
nodeIndex:document.getRoot().listNodes().indexOf(part.node),
|
|
40
|
+
referenceNode:body.node.getName() || null,
|
|
41
|
+
kind:'planar-panel-near-body-face',
|
|
42
|
+
jointTypeHypothesis:'revolute',
|
|
43
|
+
alternatives:[
|
|
44
|
+
{ axis:[0,1,0], worldHingeLinePoint:[round(part.min[0]),round(part.min[1]),round(centerZ)] },
|
|
45
|
+
{ axis:[0,1,0], worldHingeLinePoint:[round(part.max[0]),round(part.min[1]),round(centerZ)] }
|
|
46
|
+
],
|
|
47
|
+
evidence:{ source:'axis-aligned-geometry', face, widthCover:round(widthCover),
|
|
48
|
+
heightCover:round(heightCover), thicknessRatio:round(thicknessRatio),
|
|
49
|
+
surfaceGap:round(faceGap), xyOverlap:round(xyOverlap) },
|
|
50
|
+
status:'hypothesis', executable:false, physicsVerified:false,
|
|
51
|
+
missing:['semantic-function','which-hinge','rest-frame-validation','joint-limits','mass-and-colliders','physics-and-task-verification']
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return { schema:'agentscape.static-panel-experiment',schemaVersion:1,candidates,
|
|
55
|
+
limitations:['ONLY_AXIS_ALIGNED_FRONT_BACK_PANELS','STATIC_GEOMETRY_CANNOT_PROVE_MOBILITY','BOTH_PIVOT_EDGES_AMBIGUOUS'] };
|
|
56
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
const ONE = new THREE.Vector3(1, 1, 1);
|
|
4
|
+
|
|
5
|
+
export function rigidInverse(node) {
|
|
6
|
+
if (!node) return new THREE.Matrix4();
|
|
7
|
+
const world = new THREE.Matrix4().fromArray(node.getWorldMatrix());
|
|
8
|
+
const position = new THREE.Vector3();
|
|
9
|
+
const rotation = new THREE.Quaternion();
|
|
10
|
+
const scale = new THREE.Vector3();
|
|
11
|
+
world.decompose(position, rotation, scale);
|
|
12
|
+
return new THREE.Matrix4().compose(position, rotation, ONE).invert();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function expandMeshBounds(target, meshNode, ownerInverse) {
|
|
16
|
+
const mesh = meshNode.getMesh();
|
|
17
|
+
if (!mesh) return 0;
|
|
18
|
+
const transform = ownerInverse.clone().multiply(new THREE.Matrix4().fromArray(meshNode.getWorldMatrix()));
|
|
19
|
+
const point = new THREE.Vector3();
|
|
20
|
+
const element = [0, 0, 0];
|
|
21
|
+
let visited = 0;
|
|
22
|
+
|
|
23
|
+
for (const primitive of mesh.listPrimitives()) {
|
|
24
|
+
const position = primitive.getAttribute('POSITION');
|
|
25
|
+
if (!position) continue;
|
|
26
|
+
const indices = primitive.getIndices();
|
|
27
|
+
const count = indices ? indices.getCount() : position.getCount();
|
|
28
|
+
for (let i = 0; i < count; i++) {
|
|
29
|
+
const index = indices ? indices.getScalar(i) : i;
|
|
30
|
+
position.getElement(index, element);
|
|
31
|
+
point.fromArray(element).applyMatrix4(transform);
|
|
32
|
+
target.expandByPoint(point);
|
|
33
|
+
visited += 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return visited;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function boxCollidersForNodes(nodes, ownerNode = null) {
|
|
40
|
+
const ownerInverse = rigidInverse(ownerNode);
|
|
41
|
+
const colliders = [];
|
|
42
|
+
for (const node of nodes) {
|
|
43
|
+
if (!node.getMesh()) continue;
|
|
44
|
+
const box = new THREE.Box3();
|
|
45
|
+
if (!expandMeshBounds(box, node, ownerInverse) || box.isEmpty()) continue;
|
|
46
|
+
const size = new THREE.Vector3();
|
|
47
|
+
const center = new THREE.Vector3();
|
|
48
|
+
box.getSize(size);
|
|
49
|
+
box.getCenter(center);
|
|
50
|
+
colliders.push({
|
|
51
|
+
shape: 'box',
|
|
52
|
+
halfExtents: [Math.max(size.x / 2, 0.005), Math.max(size.y / 2, 0.005), Math.max(size.z / 2, 0.005)],
|
|
53
|
+
translation: center.toArray()
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return colliders;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function sceneMeshOwnership(scene, partNodes) {
|
|
60
|
+
const owners = new Map();
|
|
61
|
+
const partByNode = new Map(Object.entries(partNodes).map(([id, node]) => [node, id]));
|
|
62
|
+
for (const root of scene.listChildren()) {
|
|
63
|
+
root.traverse((node) => {
|
|
64
|
+
if (!node.getMesh()) return;
|
|
65
|
+
let owner = null;
|
|
66
|
+
for (let current = node; current; current = current.getParentNode?.()) {
|
|
67
|
+
if (partByNode.has(current)) { owner = partByNode.get(current); break; }
|
|
68
|
+
}
|
|
69
|
+
if (!owners.has(owner)) owners.set(owner, []);
|
|
70
|
+
owners.get(owner).push(node);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return owners;
|
|
74
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { boxCollidersForNodes, sceneMeshOwnership } from '../partGeometry.js';
|
|
2
|
+
|
|
3
|
+
export class ArticulatedCollisionPass {
|
|
4
|
+
async run(context) {
|
|
5
|
+
const parts = context.articulation.parts || {};
|
|
6
|
+
const ids = Object.keys(parts);
|
|
7
|
+
if (!ids.length) return context;
|
|
8
|
+
const root = context.document.getRoot();
|
|
9
|
+
const scene = root.getDefaultScene() || root.listScenes()[0];
|
|
10
|
+
if (!scene) return context;
|
|
11
|
+
const nodes = new Map(root.listNodes().map((node) => [node.getName(), node]));
|
|
12
|
+
const partNodes = {};
|
|
13
|
+
for (const id of ids) {
|
|
14
|
+
const node = nodes.get(parts[id].node);
|
|
15
|
+
if (node) partNodes[id] = node;
|
|
16
|
+
}
|
|
17
|
+
const ownership = sceneMeshOwnership(scene, partNodes);
|
|
18
|
+
const generated = [];
|
|
19
|
+
const preserved = [];
|
|
20
|
+
const finalParts = structuredClone(parts);
|
|
21
|
+
|
|
22
|
+
for (const id of ids) {
|
|
23
|
+
const part = finalParts[id];
|
|
24
|
+
if (!part.physics?.collider?.generated && part.physics?.colliders?.length) {
|
|
25
|
+
preserved.push({ part:id, colliders:part.physics.colliders.length });
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const node = partNodes[id];
|
|
29
|
+
const colliders = boxCollidersForNodes(ownership.get(id) || [], node);
|
|
30
|
+
if (!colliders.length) continue;
|
|
31
|
+
part.physics = {
|
|
32
|
+
body: part.physics?.body || 'dynamic',
|
|
33
|
+
...part.physics,
|
|
34
|
+
colliders,
|
|
35
|
+
collider: { strategy:'owned-mesh-aabb', quality:'coarse', generated:true }
|
|
36
|
+
};
|
|
37
|
+
generated.push({ part:id, colliders:colliders.length, meshNodes:(ownership.get(id) || []).map((item) => item.getName()) });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const rootColliders = boxCollidersForNodes(ownership.get(null) || []);
|
|
41
|
+
const generatedPartColliders = generated.length > 0;
|
|
42
|
+
const wholeAssetMass = Number.isFinite(context.physics?.mass) ? context.physics.mass : null;
|
|
43
|
+
const physics = context.physics ? { ...context.physics } : context.physics;
|
|
44
|
+
if (physics && wholeAssetMass != null) delete physics.mass;
|
|
45
|
+
return {
|
|
46
|
+
...context,
|
|
47
|
+
physics,
|
|
48
|
+
articulation: { ...context.articulation, parts:finalParts },
|
|
49
|
+
collision: { strategy:'articulated-owned-mesh-aabb', quality:rootColliders.length || generatedPartColliders ? 'coarse' : 'provider-part-colliders', colliders:rootColliders },
|
|
50
|
+
partCollision: {
|
|
51
|
+
...(context.partCollision || {}),
|
|
52
|
+
final: {
|
|
53
|
+
strategy:'nearest-executable-part-ownership',
|
|
54
|
+
rootColliders:rootColliders.length,
|
|
55
|
+
rootMeshNodes:(ownership.get(null) || []).map((node) => node.getName()),
|
|
56
|
+
generated,
|
|
57
|
+
preserved,
|
|
58
|
+
...(wholeAssetMass != null ? { mass:{ status:'unpartitioned', wholeAssetMass } } : {})
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const revoluteWords = ['door','lid','hinge','flap','valve','wheel','page','leaf','cover','knob','dial','门','盖','阀','轮','页','旋钮'];
|
|
2
|
+
const prismaticWords = ['drawer','slider','slide','抽屉','滑轨'];
|
|
3
|
+
const tokenize = name => String(name || '').replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase();
|
|
4
|
+
const includesWord = (name, word) => /^[a-z]+$/.test(word)
|
|
5
|
+
? (name.match(/[a-z]+/g) || []).includes(word) : name.includes(word);
|
|
6
|
+
|
|
7
|
+
function suggestActions(name, jointType) {
|
|
8
|
+
if (jointType === 'prismatic') return ['slide'];
|
|
9
|
+
if (['page','leaf','页'].some(word => includesWord(name, word))) return ['turnPage'];
|
|
10
|
+
if (['lid','cover','door','hinge','flap','门','盖'].some(word => includesWord(name, word))) return ['open','close'];
|
|
11
|
+
if (['knob','dial','旋钮'].some(word => includesWord(name, word))) return ['adjust'];
|
|
12
|
+
return ['rotateJoint'];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Name/URDF hints may propose a joint, but never grant an executable action. */
|
|
16
|
+
export class ArticulationCandidatePass {
|
|
17
|
+
async run(context) {
|
|
18
|
+
const candidates = [];
|
|
19
|
+
const proposals = new Map((context.partProposal?.parts || [])
|
|
20
|
+
.filter(part => part.node && ['revolute','prismatic'].includes(part.joint?.type))
|
|
21
|
+
.map(part => [part.node, part]));
|
|
22
|
+
for (const node of context.inspection.nodes) {
|
|
23
|
+
const name = tokenize(node.name);
|
|
24
|
+
if (!name) continue;
|
|
25
|
+
const provider = proposals.get(node.name);
|
|
26
|
+
const revolute = revoluteWords.some(word => includesWord(name, word));
|
|
27
|
+
const prismatic = prismaticWords.some(word => includesWord(name, word));
|
|
28
|
+
const jointType = provider?.joint.type || (revolute ? 'revolute' : prismatic ? 'prismatic' : null);
|
|
29
|
+
if (!jointType) continue;
|
|
30
|
+
candidates.push({
|
|
31
|
+
node:node.name, jointType, ...(provider ? {partId:provider.id} : {}),
|
|
32
|
+
source:provider ? 'joint-metadata' : 'node-name-heuristic',
|
|
33
|
+
confidence:provider ? Math.min(1, Math.max(0, Number(provider.confidence) || 0.75))
|
|
34
|
+
: name.includes('hinge') ? .75 : jointType === 'prismatic' ? .55 : .5,
|
|
35
|
+
suggestedActions:suggestActions(name, jointType),
|
|
36
|
+
executable:false, physicsVerified:false, requiresReview:true
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const partProposal = context.partProposal || (context.interactionProposal && candidates.length ? {
|
|
40
|
+
version:1,source:'node-name-heuristic',parts:candidates.map((candidate,index)=>({
|
|
41
|
+
id:'part_' + (index+1),node:candidate.node,joint:{type:candidate.jointType},
|
|
42
|
+
confidence:candidate.confidence,requiresReview:true
|
|
43
|
+
}))
|
|
44
|
+
} : null);
|
|
45
|
+
return { ...context, ...(partProposal ? {partProposal} : {}),
|
|
46
|
+
articulation: { candidates, source:'structural-candidate-analysis' } };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Explicit authored intent is configuration, never evidence of runtime success.
|
|
2
|
+
export class AuthoringIntentPass {
|
|
3
|
+
async run(context) {
|
|
4
|
+
if (context.interactionReview) return {...context,semantics:{...context.semantics,actions:[]},physics:context.interactionReview.physics};
|
|
5
|
+
const intent = context.authoringIntent;
|
|
6
|
+
if (!intent) return context;
|
|
7
|
+
if (!['static', 'movable', 'interactive'].includes(intent.usage)) throw new TypeError('Invalid authoring usage');
|
|
8
|
+
if (intent.usage === 'interactive') return context;
|
|
9
|
+
const movable = intent.usage === 'movable';
|
|
10
|
+
return {
|
|
11
|
+
...context,
|
|
12
|
+
semantics:{ ...context.semantics, actions:movable ? ['move', 'pickup', 'drop', 'place'] : ['move'] },
|
|
13
|
+
physics:{ ...context.physics, body:movable ? 'dynamic' : 'fixed' }
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class ColliderFallbackPass {
|
|
2
|
+
async run(context) {
|
|
3
|
+
const [x,y,z] = context.geometry.bounds.size;
|
|
4
|
+
const translation = context.geometry.bounds.center;
|
|
5
|
+
if (context.semantics?.tags?.includes('round')) {
|
|
6
|
+
const radius = Math.max(Math.min(x / 2, z / 2, Math.max(y / 2 - 0.005, 0.005)), 0.005);
|
|
7
|
+
const halfHeight = Math.max(y / 2 - radius, 0.005);
|
|
8
|
+
return {
|
|
9
|
+
...context,
|
|
10
|
+
collision: {
|
|
11
|
+
strategy: 'capsule-fit',
|
|
12
|
+
quality: 'primitive',
|
|
13
|
+
colliders: [{ shape:'capsule', halfHeight, radius, translation }]
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
...context,
|
|
19
|
+
collision: {
|
|
20
|
+
strategy: 'aabb-fallback',
|
|
21
|
+
quality: 'coarse',
|
|
22
|
+
colliders: [{
|
|
23
|
+
shape: 'box',
|
|
24
|
+
halfExtents: [Math.max(x/2,0.005), Math.max(y/2,0.005), Math.max(z/2,0.005)],
|
|
25
|
+
translation
|
|
26
|
+
}]
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|