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,104 @@
|
|
|
1
|
+
import { t as assetAdmission } from "./admission-CVEvsrdz.js";
|
|
2
|
+
// modules/world/runtime/interaction/CarryCapability.js
|
|
3
|
+
const DEFAULT_CARRY_LIMITS = Object.freeze({
|
|
4
|
+
mass: 15,
|
|
5
|
+
span: 1.25,
|
|
6
|
+
colliderCount: 16
|
|
7
|
+
});
|
|
8
|
+
const shapes = /* @__PURE__ */ new Set([
|
|
9
|
+
"box",
|
|
10
|
+
"cylinder",
|
|
11
|
+
"capsule"
|
|
12
|
+
]);
|
|
13
|
+
const deny = (reason) => ({
|
|
14
|
+
eligible: false,
|
|
15
|
+
reason,
|
|
16
|
+
mode: "kinematic-anchor",
|
|
17
|
+
graspVerified: false
|
|
18
|
+
});
|
|
19
|
+
const positive = (n) => Number.isFinite(n) && n > 0;
|
|
20
|
+
function colliderExtents(collider) {
|
|
21
|
+
if (collider.shape === "box" && collider.halfExtents?.length === 3 && collider.halfExtents.every(positive)) return collider.halfExtents;
|
|
22
|
+
if (collider.shape === "cylinder" && positive(collider.radius) && positive(collider.halfHeight)) return [
|
|
23
|
+
collider.radius,
|
|
24
|
+
collider.halfHeight,
|
|
25
|
+
collider.radius
|
|
26
|
+
];
|
|
27
|
+
if (collider.shape === "capsule" && positive(collider.radius) && positive(collider.halfHeight)) return [
|
|
28
|
+
collider.radius,
|
|
29
|
+
collider.halfHeight + collider.radius,
|
|
30
|
+
collider.radius
|
|
31
|
+
];
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
/** Physical eligibility only; reach, occupied hands, and motion sweeps are live checks. */
|
|
35
|
+
function inferCarryCapability(manifest, { scale = 1, limits = DEFAULT_CARRY_LIMITS, allowProvisional = false } = {}) {
|
|
36
|
+
const physics = manifest?.physics;
|
|
37
|
+
if (physics?.carryable === false) return deny("CARRY_DISABLED");
|
|
38
|
+
if (manifest?.capabilityLevel === "visual") return deny("TARGET_PHYSICS_UNAVAILABLE");
|
|
39
|
+
if (physics?.body !== "dynamic") return deny("TARGET_NOT_DYNAMIC");
|
|
40
|
+
if (physics.sensor === true) return deny("CARRY_SENSOR_UNSUPPORTED");
|
|
41
|
+
if (physics.lockTranslation?.some(Boolean)) return deny("CARRY_TRANSLATION_LOCKED");
|
|
42
|
+
if (Object.keys(manifest.parts || {}).length) return deny("ARTICULATED_TARGET_UNSUPPORTED");
|
|
43
|
+
if (!positive(physics.mass)) return deny("CARRY_MASS_UNDECLARED");
|
|
44
|
+
if (!positive(scale)) return deny("CARRY_SCALE_INVALID");
|
|
45
|
+
if (physics.mass * scale ** 3 > limits.mass) return deny("CARRY_MASS_EXCEEDED");
|
|
46
|
+
const colliders = physics.colliders || [];
|
|
47
|
+
if (!colliders.length || colliders.length > limits.colliderCount || colliders.some((c) => !shapes.has(c.shape))) return deny("CARRY_COLLIDER_UNSUPPORTED");
|
|
48
|
+
const low = [
|
|
49
|
+
1e400,
|
|
50
|
+
1e400,
|
|
51
|
+
1e400
|
|
52
|
+
], high = [
|
|
53
|
+
-1e400,
|
|
54
|
+
-1e400,
|
|
55
|
+
-1e400
|
|
56
|
+
];
|
|
57
|
+
for (const collider of colliders) {
|
|
58
|
+
const extents = colliderExtents(collider);
|
|
59
|
+
if (!extents) return deny("CARRY_COLLIDER_UNSUPPORTED");
|
|
60
|
+
const rotation = collider.rotation || [
|
|
61
|
+
0,
|
|
62
|
+
0,
|
|
63
|
+
0,
|
|
64
|
+
1
|
|
65
|
+
];
|
|
66
|
+
if (!Array.isArray(rotation) || rotation.length !== 4 || !rotation.every(Number.isFinite) || Math.abs(rotation[0]) > 1e-6 || Math.abs(rotation[2]) > 1e-6) return deny("CARRY_COLLIDER_ROTATION_UNSUPPORTED");
|
|
67
|
+
const t = collider.translation || [
|
|
68
|
+
0,
|
|
69
|
+
0,
|
|
70
|
+
0
|
|
71
|
+
];
|
|
72
|
+
if (t.length !== 3 || !t.every(Number.isFinite)) return deny("CARRY_COLLIDER_UNSUPPORTED");
|
|
73
|
+
const horizontal = Math.hypot(extents[0], extents[2]);
|
|
74
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
75
|
+
const extent = axis === 1 ? extents[1] : horizontal;
|
|
76
|
+
low[axis] = Math.min(low[axis], (t[axis] - extent) * scale);
|
|
77
|
+
high[axis] = Math.max(high[axis], (t[axis] + extent) * scale);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const span = high.map((value, axis) => value - low[axis]);
|
|
81
|
+
if (span.some((value) => value > limits.span)) return deny("CARRY_SIZE_EXCEEDED");
|
|
82
|
+
if (manifest.source?.kind === "compiled") {
|
|
83
|
+
const admission = assetAdmission(manifest);
|
|
84
|
+
const approvedEditing = allowProvisional && admission.status === "provisional" && manifest.provenance?.authoringIntent?.usage === "movable";
|
|
85
|
+
if (admission.status !== "ready" && !approvedEditing) return deny("CARRY_ASSET_UNVERIFIED");
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
eligible: true,
|
|
89
|
+
reason: null,
|
|
90
|
+
source: "physical-geometry",
|
|
91
|
+
mode: "kinematic-anchor",
|
|
92
|
+
graspVerified: false,
|
|
93
|
+
mass: physics.mass,
|
|
94
|
+
span: span.map((value) => Number(value.toFixed(4)))
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const isCarryOperation = (action) => [
|
|
98
|
+
"pickup",
|
|
99
|
+
"drop",
|
|
100
|
+
"place"
|
|
101
|
+
].includes(action);
|
|
102
|
+
export { isCarryOperation as n, inferCarryCapability as t };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=CarryCapability-CXwHU5ay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarryCapability-CXwHU5ay.js","names":[],"sources":["../../../modules/world/runtime/interaction/CarryCapability.js"],"sourcesContent":["import { assetAdmission } from '../../../asset/model/admission.js';\n\n// Kinematic-anchor carrying is not force-verified grasping. These conservative\n// defaults describe the existing single-anchor humanoid, not every robot.\nexport const DEFAULT_CARRY_LIMITS = Object.freeze({ mass: 15, span: 1.25, colliderCount: 16 });\nconst shapes = new Set(['box', 'cylinder', 'capsule']);\nconst deny = reason => ({ eligible: false, reason, mode: 'kinematic-anchor', graspVerified: false });\nconst positive = n => Number.isFinite(n) && n > 0;\n\nfunction colliderExtents(collider) {\n if (collider.shape === 'box' && collider.halfExtents?.length === 3\n && collider.halfExtents.every(positive)) return collider.halfExtents;\n if (collider.shape === 'cylinder' && positive(collider.radius) && positive(collider.halfHeight))\n return [collider.radius, collider.halfHeight, collider.radius];\n if (collider.shape === 'capsule' && positive(collider.radius) && positive(collider.halfHeight))\n return [collider.radius, collider.halfHeight + collider.radius, collider.radius];\n return null;\n}\n\n/** Physical eligibility only; reach, occupied hands, and motion sweeps are live checks. */\nexport function inferCarryCapability(manifest, { scale = 1, limits = DEFAULT_CARRY_LIMITS, allowProvisional = false } = {}) {\n const physics = manifest?.physics;\n if (physics?.carryable === false) return deny('CARRY_DISABLED');\n if (manifest?.capabilityLevel === 'visual') return deny('TARGET_PHYSICS_UNAVAILABLE');\n if (physics?.body !== 'dynamic') return deny('TARGET_NOT_DYNAMIC');\n if (physics.sensor === true) return deny('CARRY_SENSOR_UNSUPPORTED');\n if (physics.lockTranslation?.some(Boolean)) return deny('CARRY_TRANSLATION_LOCKED');\n if (Object.keys(manifest.parts || {}).length) return deny('ARTICULATED_TARGET_UNSUPPORTED');\n if (!positive(physics.mass)) return deny('CARRY_MASS_UNDECLARED');\n if (!positive(scale)) return deny('CARRY_SCALE_INVALID');\n if (physics.mass * scale ** 3 > limits.mass) return deny('CARRY_MASS_EXCEEDED');\n const colliders = physics.colliders || [];\n if (!colliders.length || colliders.length > limits.colliderCount || colliders.some(c => !shapes.has(c.shape)))\n return deny('CARRY_COLLIDER_UNSUPPORTED');\n const low = [Infinity, Infinity, Infinity], high = [-Infinity, -Infinity, -Infinity];\n for (const collider of colliders) {\n const extents = colliderExtents(collider);\n if (!extents) return deny('CARRY_COLLIDER_UNSUPPORTED');\n const rotation = collider.rotation || [0, 0, 0, 1];\n if (!Array.isArray(rotation) || rotation.length !== 4 || !rotation.every(Number.isFinite)\n || Math.abs(rotation[0]) > 1e-6 || Math.abs(rotation[2]) > 1e-6)\n return deny('CARRY_COLLIDER_ROTATION_UNSUPPORTED');\n const t = collider.translation || [0, 0, 0];\n if (t.length !== 3 || !t.every(Number.isFinite)) return deny('CARRY_COLLIDER_UNSUPPORTED');\n // A yaw-rotated collider is bounded conservatively by its horizontal radius.\n const horizontal = Math.hypot(extents[0], extents[2]);\n for (let axis = 0; axis < 3; axis++) {\n const extent = axis === 1 ? extents[1] : horizontal;\n low[axis] = Math.min(low[axis], (t[axis] - extent) * scale);\n high[axis] = Math.max(high[axis], (t[axis] + extent) * scale);\n }\n }\n const span = high.map((value, axis) => value - low[axis]);\n if (span.some(value => value > limits.span)) return deny('CARRY_SIZE_EXCEEDED');\n if (manifest.source?.kind === 'compiled') {\n const admission = assetAdmission(manifest);\n const approvedEditing = allowProvisional && admission.status === 'provisional'\n && manifest.provenance?.authoringIntent?.usage === 'movable';\n if (admission.status !== 'ready' && !approvedEditing) return deny('CARRY_ASSET_UNVERIFIED');\n }\n return { eligible: true, reason: null, source: 'physical-geometry', mode: 'kinematic-anchor',\n graspVerified: false, mass: physics.mass, span: span.map(value => Number(value.toFixed(4))) };\n}\n\nexport const isCarryOperation = action => ['pickup', 'drop', 'place'].includes(action);\n"],"mappings":";;AAIA,MAAa,uBAAuB,OAAO,OAAO;CAAE,MAAM;CAAI,MAAM;CAAM,eAAe;AAAG,CAAC;AAC7F,MAAM,yBAAS,IAAI,IAAI;CAAC;CAAO;CAAY;AAAS,CAAC;AACrD,MAAM,QAAO,YAAW;CAAE,UAAU;CAAO;CAAQ,MAAM;CAAoB,eAAe;AAAM;AAClG,MAAM,YAAW,MAAK,OAAO,SAAS,CAAC,KAAK,IAAI;AAEhD,SAAS,gBAAgB,UAAU;CACjC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;CAC5F;CACA,OAAO;EAAE,UAAU;EAAM,QAAQ;EAAM,QAAQ;EAAqB,MAAM;EACxE,eAAe;EAAO,MAAM,QAAQ;EAAM,MAAM,KAAK,KAAI,UAAS,OAAO,MAAM,QAAQ,CAAC,CAAC,CAAC;CAAE;AAChG;AAEA,MAAa,oBAAmB,WAAU;CAAC;CAAU;CAAQ;AAAO,CAAC,CAAC,SAAS,MAAM"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { t as validateAssetManifest } from "./schema-DT7K9NjP.js";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
// modules/asset/production/verification/KinematicHypothesisScreen.js
|
|
4
|
+
const vec3 = (values) => new THREE.Vector3(...values);
|
|
5
|
+
const reason = (code) => Object.assign(new Error(code), { code });
|
|
6
|
+
function colliderBoxes(object, owner, shouldInclude) {
|
|
7
|
+
object.updateMatrixWorld(true);
|
|
8
|
+
const ownerInverse = owner.matrixWorld.clone().invert();
|
|
9
|
+
const colliders = [];
|
|
10
|
+
object.traverse((mesh) => {
|
|
11
|
+
if (!mesh.isMesh || !shouldInclude(mesh)) return;
|
|
12
|
+
if (mesh.isSkinnedMesh || mesh.morphTargetInfluences?.length) throw reason("HYPOTHESIS_DEFORMING_MESH_UNSUPPORTED");
|
|
13
|
+
if (colliders.length >= 32) throw reason("HYPOTHESIS_COLLIDER_BUDGET");
|
|
14
|
+
const geometry = mesh.geometry;
|
|
15
|
+
if (!geometry.boundingBox) geometry.computeBoundingBox();
|
|
16
|
+
if (!geometry.boundingBox || geometry.boundingBox.isEmpty()) return;
|
|
17
|
+
const box = geometry.boundingBox.clone().applyMatrix4(ownerInverse.clone().multiply(mesh.matrixWorld));
|
|
18
|
+
const size = new THREE.Vector3(), center = new THREE.Vector3();
|
|
19
|
+
box.getSize(size);
|
|
20
|
+
box.getCenter(center);
|
|
21
|
+
if (![
|
|
22
|
+
size.x,
|
|
23
|
+
size.y,
|
|
24
|
+
size.z
|
|
25
|
+
].every(Number.isFinite)) throw reason("HYPOTHESIS_INVALID_GEOMETRY");
|
|
26
|
+
colliders.push({
|
|
27
|
+
shape: "box",
|
|
28
|
+
halfExtents: size.toArray().map((value) => Math.max(.005, value / 2)),
|
|
29
|
+
translation: center.toArray()
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return colliders;
|
|
33
|
+
}
|
|
34
|
+
function buildProbeRig(object, hypothesis, { mass = 1, friction = .5, requestedTarget = null } = {}) {
|
|
35
|
+
if (!["prismatic", "revolute"].includes(hypothesis.jointType)) throw reason("HYPOTHESIS_JOINT_UNSUPPORTED");
|
|
36
|
+
const axisWorld = vec3(hypothesis.axisWorld);
|
|
37
|
+
if (![
|
|
38
|
+
axisWorld.x,
|
|
39
|
+
axisWorld.y,
|
|
40
|
+
axisWorld.z
|
|
41
|
+
].every(Number.isFinite) || axisWorld.lengthSq() < .99 || axisWorld.lengthSq() > 1.01) throw reason("HYPOTHESIS_AXIS_INVALID");
|
|
42
|
+
if (!Array.isArray(hypothesis.pivotWorld) || hypothesis.pivotWorld.length !== 3 || !hypothesis.pivotWorld.every(Number.isFinite)) throw reason("HYPOTHESIS_PIVOT_INVALID");
|
|
43
|
+
if (!hypothesis.node) throw reason("HYPOTHESIS_NODE_UNNAMED");
|
|
44
|
+
const matches = [];
|
|
45
|
+
object.traverse((node) => {
|
|
46
|
+
if (node.name === hypothesis.node) matches.push(node);
|
|
47
|
+
});
|
|
48
|
+
if (matches.length !== 1 || matches[0] === object) throw reason("HYPOTHESIS_NODE_UNRESOLVED");
|
|
49
|
+
const node = matches[0];
|
|
50
|
+
if (!node.parent || !node.getObjectByProperty("isMesh", true) && !node.isMesh) throw reason("HYPOTHESIS_PART_EMPTY");
|
|
51
|
+
object.updateMatrixWorld(true);
|
|
52
|
+
const baseScale = new THREE.Vector3();
|
|
53
|
+
object.getWorldScale(baseScale);
|
|
54
|
+
if (Math.max(...baseScale.toArray().map((value) => Math.abs(value - 1))) > 1e-5) throw reason("HYPOTHESIS_ROOT_SCALE_UNSUPPORTED");
|
|
55
|
+
if (node.parent === object && node.isBone) throw reason("HYPOTHESIS_BONE_UNSUPPORTED");
|
|
56
|
+
const nodeWorldPos = new THREE.Vector3();
|
|
57
|
+
node.getWorldPosition(nodeWorldPos);
|
|
58
|
+
const pivotWorld = vec3(hypothesis.pivotWorld);
|
|
59
|
+
if (hypothesis.source === "gltf-animation" && nodeWorldPos.distanceTo(pivotWorld) > .005) throw reason("HYPOTHESIS_REST_FRAME_MISMATCH");
|
|
60
|
+
const pivot = new THREE.Object3D();
|
|
61
|
+
pivot.name = "__agent_scape_kinematic_probe_pivot__";
|
|
62
|
+
if (object.getObjectByName(pivot.name)) throw reason("HYPOTHESIS_PIVOT_NAME_CONFLICT");
|
|
63
|
+
object.add(pivot);
|
|
64
|
+
pivot.position.copy(object.worldToLocal(pivotWorld.clone()));
|
|
65
|
+
object.updateMatrixWorld(true);
|
|
66
|
+
pivot.attach(node);
|
|
67
|
+
object.updateMatrixWorld(true);
|
|
68
|
+
const isUnderPivot = (mesh) => {
|
|
69
|
+
for (let parent = mesh; parent; parent = parent.parent) if (parent === pivot) return true;
|
|
70
|
+
return false;
|
|
71
|
+
};
|
|
72
|
+
const partColliders = colliderBoxes(object, pivot, isUnderPivot);
|
|
73
|
+
const rootColliders = colliderBoxes(object, object, (mesh) => !isUnderPivot(mesh));
|
|
74
|
+
if (!partColliders.length) throw reason("HYPOTHESIS_PART_COLLIDER_MISSING");
|
|
75
|
+
if (!rootColliders.length) throw reason("HYPOTHESIS_ROOT_COLLIDER_MISSING");
|
|
76
|
+
const axis = axisWorld.clone().transformDirection(object.matrixWorld.clone().invert()).normalize().toArray();
|
|
77
|
+
const observed = hypothesis.limits?.length === 2 && hypothesis.limits.every(Number.isFinite);
|
|
78
|
+
const bounds = observed ? hypothesis.limits : requestedTarget < 0 ? [-.5, 0] : [0, .5];
|
|
79
|
+
const target = requestedTarget ?? bounds.reduce((best, value) => Math.abs(value) > Math.abs(best) ? value : best, 0);
|
|
80
|
+
if (!Number.isFinite(target) || Math.abs(target) < .1 || Math.abs(target) > Math.PI * .95 || bounds[0] > 0 || bounds[1] < 0 || bounds[0] >= bounds[1]) throw reason("HYPOTHESIS_TARGET_UNSUPPORTED");
|
|
81
|
+
const safeTarget = Math.sign(target) * Math.min(Math.abs(target), hypothesis.jointType === "revolute" ? .6 : .45);
|
|
82
|
+
const manifest = {
|
|
83
|
+
id: "candidate_probe",
|
|
84
|
+
type: "object",
|
|
85
|
+
label: "Isolated mechanical hypothesis",
|
|
86
|
+
actions: ["probe", "return"],
|
|
87
|
+
source: {
|
|
88
|
+
kind: "compiled",
|
|
89
|
+
key: "unpublished-sandbox"
|
|
90
|
+
},
|
|
91
|
+
physics: {
|
|
92
|
+
body: "fixed",
|
|
93
|
+
mass: 1,
|
|
94
|
+
friction,
|
|
95
|
+
colliders: rootColliders
|
|
96
|
+
},
|
|
97
|
+
parts: { probe: {
|
|
98
|
+
node: pivot.name,
|
|
99
|
+
parent: "$root",
|
|
100
|
+
actions: ["probe", "return"],
|
|
101
|
+
targets: {
|
|
102
|
+
probe: safeTarget,
|
|
103
|
+
return: 0
|
|
104
|
+
},
|
|
105
|
+
physics: {
|
|
106
|
+
body: "dynamic",
|
|
107
|
+
mass,
|
|
108
|
+
friction,
|
|
109
|
+
colliders: partColliders
|
|
110
|
+
},
|
|
111
|
+
joint: {
|
|
112
|
+
type: hypothesis.jointType,
|
|
113
|
+
axis,
|
|
114
|
+
parentAnchor: pivot.position.toArray(),
|
|
115
|
+
childAnchor: [
|
|
116
|
+
0,
|
|
117
|
+
0,
|
|
118
|
+
0
|
|
119
|
+
],
|
|
120
|
+
limits: [Math.min(0, ...bounds), Math.max(0, ...bounds)],
|
|
121
|
+
motor: {
|
|
122
|
+
stiffness: 80,
|
|
123
|
+
damping: 12
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} }
|
|
127
|
+
};
|
|
128
|
+
validateAssetManifest(manifest);
|
|
129
|
+
return {
|
|
130
|
+
object,
|
|
131
|
+
manifest,
|
|
132
|
+
assumptions: {
|
|
133
|
+
rootBody: "fixed",
|
|
134
|
+
partMass: mass,
|
|
135
|
+
friction,
|
|
136
|
+
colliders: "local-mesh-AABB",
|
|
137
|
+
jointLimits: observed ? "observed-animation" : "assumed-one-sided-directional-probe",
|
|
138
|
+
probeTarget: safeTarget
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function summarize(report) {
|
|
143
|
+
const part = report.parts?.[0];
|
|
144
|
+
const actions = (part?.actions || []).map((entry) => ({
|
|
145
|
+
name: entry.action,
|
|
146
|
+
target: entry.target,
|
|
147
|
+
ok: entry.ok,
|
|
148
|
+
moved: entry.moved,
|
|
149
|
+
targetReached: entry.targetReached,
|
|
150
|
+
settled: entry.settled,
|
|
151
|
+
failures: entry.failures
|
|
152
|
+
}));
|
|
153
|
+
return {
|
|
154
|
+
feasible: report.ok === true && report.physicsRegistered === true && report.tested === 1 && actions.some((action) => action.name === "probe" && action.moved === true) && part?.reversibility?.ok === true && part?.reversibility?.checked === true,
|
|
155
|
+
evidence: {
|
|
156
|
+
physicsRegistered: report.physicsRegistered,
|
|
157
|
+
tested: report.tested,
|
|
158
|
+
actions,
|
|
159
|
+
reversibility: part?.reversibility || null,
|
|
160
|
+
failures: part?.failures || [],
|
|
161
|
+
baselinePenetrations: part?.baselinePenetrations || []
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Run bounded physical experiments against source-bound, compiler-discovered
|
|
167
|
+
* hypotheses. This does not review a part, register an asset, grant a runtime
|
|
168
|
+
* capability or establish semantic function.
|
|
169
|
+
*/
|
|
170
|
+
async function screenKinematicHypotheses({ bytes, proposal, ids, loader, verifier }) {
|
|
171
|
+
if (!loader?.loadBytes || !verifier?.verify) throw reason("HYPOTHESIS_SCREEN_UNAVAILABLE");
|
|
172
|
+
const hypothesisById = new Map((proposal.kinematics?.hypotheses || []).map((item) => [item.id, item]));
|
|
173
|
+
if (!Array.isArray(ids) || ids.length < 1 || ids.length > 4 || new Set(ids).size !== ids.length) throw reason("HYPOTHESIS_SELECTION_INVALID");
|
|
174
|
+
for (const id of ids) if (!hypothesisById.has(id)) throw reason("HYPOTHESIS_NOT_FOUND");
|
|
175
|
+
const results = [];
|
|
176
|
+
for (const id of ids) {
|
|
177
|
+
const hypothesis = hypothesisById.get(id);
|
|
178
|
+
const targets = hypothesis.limits == null ? [-.5, .5] : [null];
|
|
179
|
+
const trials = [];
|
|
180
|
+
for (const target of targets) {
|
|
181
|
+
let object;
|
|
182
|
+
try {
|
|
183
|
+
object = await loader.loadBytes(bytes);
|
|
184
|
+
const rig = buildProbeRig(object, hypothesis, { requestedTarget: target });
|
|
185
|
+
const report = await verifier.verify("candidate_probe", {
|
|
186
|
+
manifest: rig.manifest,
|
|
187
|
+
requireRegistration: true,
|
|
188
|
+
requireSettled: true,
|
|
189
|
+
instantiate: async () => ({ object: rig.object })
|
|
190
|
+
});
|
|
191
|
+
object = null;
|
|
192
|
+
const evaluated = summarize(report);
|
|
193
|
+
trials.push({
|
|
194
|
+
target: rig.assumptions.probeTarget,
|
|
195
|
+
status: evaluated.feasible ? "simulation-passed" : "simulation-failed",
|
|
196
|
+
mechanicalFeasible: evaluated.feasible,
|
|
197
|
+
assumptions: rig.assumptions,
|
|
198
|
+
evidence: evaluated.evidence
|
|
199
|
+
});
|
|
200
|
+
} catch (error) {
|
|
201
|
+
trials.push({
|
|
202
|
+
target,
|
|
203
|
+
status: "blocked",
|
|
204
|
+
mechanicalFeasible: false,
|
|
205
|
+
diagnostics: [{ code: error.code || "HYPOTHESIS_SIMULATION_ERROR" }]
|
|
206
|
+
});
|
|
207
|
+
} finally {
|
|
208
|
+
if (object) {
|
|
209
|
+
const { disposeObject3D } = await import("./disposeObject3D-DIMzy0FA.js").then((n) => n.r);
|
|
210
|
+
disposeObject3D(object);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const feasible = trials.some((item) => item.mechanicalFeasible);
|
|
215
|
+
const allBlocked = trials.every((item) => item.status === "blocked");
|
|
216
|
+
results.push({
|
|
217
|
+
id,
|
|
218
|
+
source: hypothesis.source,
|
|
219
|
+
jointType: hypothesis.jointType,
|
|
220
|
+
status: feasible ? "simulation-passed" : allBlocked ? "blocked" : "simulation-failed",
|
|
221
|
+
mechanicalFeasible: feasible,
|
|
222
|
+
physicsVerified: false,
|
|
223
|
+
functionVerified: false,
|
|
224
|
+
admission: "not-granted",
|
|
225
|
+
trials,
|
|
226
|
+
assumptions: trials.find((item) => item.assumptions)?.assumptions || null
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
schema: "agentscape.kinematic-screen",
|
|
231
|
+
schemaVersion: 1,
|
|
232
|
+
proposalId: proposal.proposalId,
|
|
233
|
+
sourceHash: proposal.sourceHash,
|
|
234
|
+
results,
|
|
235
|
+
admission: "not-granted",
|
|
236
|
+
interpretation: "simulation-only; no semantic authorization or real-world mechanism proof"
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
export { screenKinematicHypotheses };
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=KinematicHypothesisScreen-C3TKiuYR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KinematicHypothesisScreen-C3TKiuYR.js","names":[],"sources":["../../../modules/asset/production/verification/KinematicHypothesisScreen.js"],"sourcesContent":["import * as THREE from 'three';\nimport { validateAssetManifest } from '../../model/schema.js';\n\n// A purely temporary mechanical rig. The original GLB, asset registry and\n// WorldRuntime are never changed; the verifier owns and disposes each instance.\nconst vec3 = values => new THREE.Vector3(...values);\nconst reason = code => Object.assign(new Error(code), { code });\n\nfunction colliderBoxes(object, owner, shouldInclude) {\n object.updateMatrixWorld(true);\n const ownerInverse = owner.matrixWorld.clone().invert();\n const colliders = [];\n object.traverse(mesh => {\n if (!mesh.isMesh || !shouldInclude(mesh)) return;\n if (mesh.isSkinnedMesh || mesh.morphTargetInfluences?.length) throw reason('HYPOTHESIS_DEFORMING_MESH_UNSUPPORTED');\n if (colliders.length >= 32) throw reason('HYPOTHESIS_COLLIDER_BUDGET');\n const geometry = mesh.geometry;\n if (!geometry.boundingBox) geometry.computeBoundingBox();\n if (!geometry.boundingBox || geometry.boundingBox.isEmpty()) return;\n const box = geometry.boundingBox.clone().applyMatrix4(ownerInverse.clone().multiply(mesh.matrixWorld));\n const size = new THREE.Vector3(), center = new THREE.Vector3();\n box.getSize(size);\n box.getCenter(center);\n if (![size.x, size.y, size.z].every(Number.isFinite)) throw reason('HYPOTHESIS_INVALID_GEOMETRY');\n colliders.push({\n shape:'box',\n halfExtents:size.toArray().map(value => Math.max(0.005, value / 2)),\n translation:center.toArray()\n });\n });\n return colliders;\n}\n\nfunction buildProbeRig(object, hypothesis, { mass = 1, friction = 0.5, requestedTarget = null } = {}) {\n if (!['prismatic', 'revolute'].includes(hypothesis.jointType)) throw reason('HYPOTHESIS_JOINT_UNSUPPORTED');\n const axisWorld = vec3(hypothesis.axisWorld);\n if (![axisWorld.x, axisWorld.y, axisWorld.z].every(Number.isFinite) || axisWorld.lengthSq() < .99\n || axisWorld.lengthSq() > 1.01) throw reason('HYPOTHESIS_AXIS_INVALID');\n if (!Array.isArray(hypothesis.pivotWorld) || hypothesis.pivotWorld.length !== 3\n || !hypothesis.pivotWorld.every(Number.isFinite)) throw reason('HYPOTHESIS_PIVOT_INVALID');\n if (!hypothesis.node) throw reason('HYPOTHESIS_NODE_UNNAMED');\n\n const matches = [];\n object.traverse(node => { if (node.name === hypothesis.node) matches.push(node); });\n if (matches.length !== 1 || matches[0] === object) throw reason('HYPOTHESIS_NODE_UNRESOLVED');\n const node = matches[0];\n if (!node.parent || !node.getObjectByProperty('isMesh', true) && !node.isMesh) throw reason('HYPOTHESIS_PART_EMPTY');\n object.updateMatrixWorld(true);\n const baseScale = new THREE.Vector3();\n object.getWorldScale(baseScale);\n if (Math.max(...baseScale.toArray().map(value => Math.abs(value - 1))) > 1e-5) throw reason('HYPOTHESIS_ROOT_SCALE_UNSUPPORTED');\n if (node.parent === object && node.isBone) throw reason('HYPOTHESIS_BONE_UNSUPPORTED');\n\n const nodeWorldPos = new THREE.Vector3();\n node.getWorldPosition(nodeWorldPos);\n const pivotWorld = vec3(hypothesis.pivotWorld);\n if (hypothesis.source === 'gltf-animation' && nodeWorldPos.distanceTo(pivotWorld) > .005)\n throw reason('HYPOTHESIS_REST_FRAME_MISMATCH');\n\n const pivot = new THREE.Object3D();\n pivot.name = '__agent_scape_kinematic_probe_pivot__';\n if (object.getObjectByName(pivot.name)) throw reason('HYPOTHESIS_PIVOT_NAME_CONFLICT');\n object.add(pivot);\n pivot.position.copy(object.worldToLocal(pivotWorld.clone()));\n object.updateMatrixWorld(true);\n pivot.attach(node);\n object.updateMatrixWorld(true);\n\n const isUnderPivot = mesh => {\n for (let parent = mesh; parent; parent = parent.parent) if (parent === pivot) return true;\n return false;\n };\n const partColliders = colliderBoxes(object, pivot, isUnderPivot);\n const rootColliders = colliderBoxes(object, object, mesh => !isUnderPivot(mesh));\n if (!partColliders.length) throw reason('HYPOTHESIS_PART_COLLIDER_MISSING');\n if (!rootColliders.length) throw reason('HYPOTHESIS_ROOT_COLLIDER_MISSING');\n\n const axis = axisWorld.clone().transformDirection(object.matrixWorld.clone().invert()).normalize().toArray();\n // Missing limits are *not* inferred. Limited signed sandbox probes are\n // simulation assumptions only, never reviewed or publishable joint limits.\n const observed = hypothesis.limits?.length === 2 && hypothesis.limits.every(Number.isFinite);\n // Keep each unobserved direction inside a *separate one-sided* sandbox joint.\n // A symmetric interval permits return-motor overshoot into the opposite,\n // already-colliding direction and would produce a false negative.\n const bounds = observed ? hypothesis.limits : requestedTarget < 0 ? [-.5, 0] : [0, .5];\n const target = requestedTarget ?? bounds.reduce((best, value) => Math.abs(value) > Math.abs(best) ? value : best, 0);\n if (!Number.isFinite(target) || Math.abs(target) < .1 || Math.abs(target) > Math.PI * .95\n || bounds[0] > 0 || bounds[1] < 0 || bounds[0] >= bounds[1]) throw reason('HYPOTHESIS_TARGET_UNSUPPORTED');\n const safeTarget = Math.sign(target) * Math.min(Math.abs(target), hypothesis.jointType === 'revolute' ? .6 : .45);\n\n const manifest = {\n id:'candidate_probe',\n type:'object',\n label:'Isolated mechanical hypothesis',\n actions:['probe','return'],\n source:{kind:'compiled',key:'unpublished-sandbox'},\n physics:{body:'fixed',mass:1,friction,colliders:rootColliders},\n parts:{\n probe:{\n node:pivot.name,parent:'$root',actions:['probe','return'],targets:{probe:safeTarget,return:0},\n physics:{body:'dynamic',mass,friction,colliders:partColliders},\n joint:{type:hypothesis.jointType,axis,parentAnchor:pivot.position.toArray(),childAnchor:[0,0,0],\n limits:[Math.min(0,...bounds),Math.max(0,...bounds)],motor:{stiffness:80,damping:12}}\n }\n }\n };\n validateAssetManifest(manifest);\n return { object, manifest, assumptions:{\n rootBody:'fixed',partMass:mass,friction,colliders:'local-mesh-AABB',\n jointLimits:observed?'observed-animation':'assumed-one-sided-directional-probe',\n probeTarget:safeTarget\n }};\n}\n\nfunction summarize(report) {\n const part = report.parts?.[0];\n const actions = (part?.actions || []).map(entry => ({\n name:entry.action,target:entry.target,ok:entry.ok,moved:entry.moved,\n targetReached:entry.targetReached,settled:entry.settled,\n failures:entry.failures\n }));\n const feasible = report.ok === true && report.physicsRegistered === true\n && report.tested === 1 && actions.some(action => action.name === 'probe' && action.moved === true)\n && part?.reversibility?.ok === true && part?.reversibility?.checked === true;\n return { feasible, evidence:{\n physicsRegistered:report.physicsRegistered, tested:report.tested,\n actions, reversibility:part?.reversibility || null, failures:part?.failures || [],\n baselinePenetrations:part?.baselinePenetrations || []\n }};\n}\n\n/**\n * Run bounded physical experiments against source-bound, compiler-discovered\n * hypotheses. This does not review a part, register an asset, grant a runtime\n * capability or establish semantic function.\n */\nexport async function screenKinematicHypotheses({ bytes, proposal, ids, loader, verifier }) {\n if (!loader?.loadBytes || !verifier?.verify) throw reason('HYPOTHESIS_SCREEN_UNAVAILABLE');\n const hypothesisById = new Map((proposal.kinematics?.hypotheses || []).map(item => [item.id, item]));\n if (!Array.isArray(ids) || ids.length < 1 || ids.length > 4\n || new Set(ids).size !== ids.length) throw reason('HYPOTHESIS_SELECTION_INVALID');\n for (const id of ids) if (!hypothesisById.has(id)) throw reason('HYPOTHESIS_NOT_FOUND');\n const results = [];\n for (const id of ids) {\n const hypothesis = hypothesisById.get(id);\n // A static GLB does not indicate the permitted opening direction.\n // Testing only one sign would incorrectly reject possible hinges.\n const targets = hypothesis.limits == null ? [-.5, .5] : [null];\n const trials = [];\n for (const target of targets) {\n let object;\n try {\n object = await loader.loadBytes(bytes);\n const rig = buildProbeRig(object, hypothesis, { requestedTarget:target });\n const report = await verifier.verify('candidate_probe',{\n manifest:rig.manifest,\n requireRegistration:true,\n requireSettled:true,\n instantiate:async () => ({object:rig.object})\n });\n object = null; // The verifier owns disposal after instantiate.\n const evaluated = summarize(report);\n trials.push({\n target:rig.assumptions.probeTarget,\n status:evaluated.feasible ? 'simulation-passed' : 'simulation-failed',\n mechanicalFeasible:evaluated.feasible,\n assumptions:rig.assumptions,\n evidence:evaluated.evidence\n });\n } catch (error) {\n // One rejected direction must not prevent trying the opposite one.\n trials.push({target,status:'blocked',mechanicalFeasible:false,\n diagnostics:[{code:error.code || 'HYPOTHESIS_SIMULATION_ERROR'}]});\n } finally {\n if (object) {\n const {disposeObject3D} = await import('../../../rendering/disposeObject3D.js');\n disposeObject3D(object);\n }\n }\n }\n const feasible=trials.some(item=>item.mechanicalFeasible);\n const allBlocked=trials.every(item=>item.status==='blocked');\n results.push({id,source:hypothesis.source,jointType:hypothesis.jointType,\n status:feasible?'simulation-passed':allBlocked?'blocked':'simulation-failed',\n mechanicalFeasible:feasible,physicsVerified:false,functionVerified:false,\n admission:'not-granted',trials,\n assumptions:trials.find(item=>item.assumptions)?.assumptions || null});\n }\n return {\n schema:'agentscape.kinematic-screen',\n schemaVersion:1,\n proposalId:proposal.proposalId,\n sourceHash:proposal.sourceHash,\n results,\n admission:'not-granted',\n interpretation:'simulation-only; no semantic authorization or real-world mechanism proof'\n };\n}\n"],"mappings":";;;AAKA,MAAM,QAAO,WAAU,IAAI,MAAM,QAAQ,GAAG,MAAM;AAClD,MAAM,UAAS,SAAQ,OAAO,OAAO,IAAI,MAAM,IAAI,GAAG,EAAE,KAAK,CAAC;AAE9D,SAAS,cAAc,QAAQ,OAAO,eAAe;CACnD,OAAO,kBAAkB,IAAI;CAC7B,MAAM,eAAe,MAAM,YAAY,MAAM,CAAC,CAAC,OAAO;CACtD,MAAM,YAAY,CAAC;CACnB,OAAO,UAAS,SAAQ;EACtB,IAAI,CAAC,KAAK,UAAU,CAAC,cAAc,IAAI,GAAG;EAC1C,IAAI,KAAK,iBAAiB,KAAK,uBAAuB,QAAQ,MAAM,OAAO,uCAAuC;EAClH,IAAI,UAAU,UAAU,IAAI,MAAM,OAAO,4BAA4B;EACrE,MAAM,WAAW,KAAK;EACtB,IAAI,CAAC,SAAS,aAAa,SAAS,mBAAmB;EACvD,IAAI,CAAC,SAAS,eAAe,SAAS,YAAY,QAAQ,GAAG;EAC7D,MAAM,MAAM,SAAS,YAAY,MAAM,CAAC,CAAC,aAAa,aAAa,MAAM,CAAC,CAAC,SAAS,KAAK,WAAW,CAAC;EACrG,MAAM,OAAO,IAAI,MAAM,QAAQ,GAAG,SAAS,IAAI,MAAM,QAAQ;EAC7D,IAAI,QAAQ,IAAI;EAChB,IAAI,UAAU,MAAM;EACpB,IAAI,CAAC;GAAC,KAAK;GAAG,KAAK;GAAG,KAAK;EAAC,CAAC,CAAC,MAAM,OAAO,QAAQ,GAAG,MAAM,OAAO,6BAA6B;EAChG,UAAU,KAAK;GACb,OAAM;GACN,aAAY,KAAK,QAAQ,CAAC,CAAC,KAAI,UAAS,KAAK,IAAI,MAAO,QAAQ,CAAC,CAAC;GAClE,aAAY,OAAO,QAAQ;EAC7B,CAAC;CACH,CAAC;CACD,OAAO;AACT;A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NIFORM_SCALE = .05;
|
|
4
|
+
const scaled = (values, factor) => Array.isArray(values) ? values.map((value) => value * factor) : values;
|
|
5
|
+
function uniformScaleValue(value, fallback = 1) {
|
|
6
|
+
const values = typeof value === "number" ? [
|
|
7
|
+
value,
|
|
8
|
+
value,
|
|
9
|
+
value
|
|
10
|
+
] : value;
|
|
11
|
+
if (!Array.isArray(values) || values.length !== 3 || !values.every(Number.isFinite)) {
|
|
12
|
+
const error = /* @__PURE__ */ new TypeError("Object scale must be a finite uniform number or vec3");
|
|
13
|
+
error.code = "OBJECT_SCALE_INVALID";
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
const [x, y, z] = values;
|
|
17
|
+
if (Math.max(Math.abs(x - y), Math.abs(x - z), Math.abs(y - z)) > SCALE_EPSILON) {
|
|
18
|
+
const error = /* @__PURE__ */ new Error("AgentScape currently supports uniform object scaling only");
|
|
19
|
+
error.code = "OBJECT_SCALE_NON_UNIFORM_UNSUPPORTED";
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
const scale = (x + y + z) / 3;
|
|
23
|
+
if (!Number.isFinite(scale) || scale < .05 || scale > 20) {
|
|
24
|
+
const error = /* @__PURE__ */ new RangeError(`Object scale must be within ${MIN_UNIFORM_SCALE}..20`);
|
|
25
|
+
error.code = "OBJECT_SCALE_OUT_OF_RANGE";
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
return Number.isFinite(scale) ? scale : fallback;
|
|
29
|
+
}
|
|
30
|
+
function scaleCollider(collider, factor) {
|
|
31
|
+
const result = structuredClone(collider);
|
|
32
|
+
if (Array.isArray(result.translation)) result.translation = scaled(result.translation, factor);
|
|
33
|
+
if (result.shape === "box" && Array.isArray(result.halfExtents)) result.halfExtents = scaled(result.halfExtents, factor);
|
|
34
|
+
if (["cylinder", "capsule"].includes(result.shape)) {
|
|
35
|
+
if (Number.isFinite(result.radius)) result.radius *= factor;
|
|
36
|
+
if (Number.isFinite(result.halfHeight)) result.halfHeight *= factor;
|
|
37
|
+
}
|
|
38
|
+
if (result.shape === "convexHull" && Array.isArray(result.vertices)) result.vertices = scaled(result.vertices, factor);
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
function physicsManifestForUniformScale(manifest, scaleValue) {
|
|
42
|
+
const factor = uniformScaleValue(scaleValue);
|
|
43
|
+
const result = structuredClone(manifest);
|
|
44
|
+
if (Math.abs(factor - 1) <= SCALE_EPSILON) return result;
|
|
45
|
+
if (Object.values(result.parts || {}).filter((part) => part?.joint || part?.physics?.colliders?.length).length) {
|
|
46
|
+
const error = /* @__PURE__ */ new Error(`Uniform scale is not yet supported for articulated asset: ${result.id || "unknown"}`);
|
|
47
|
+
error.code = "OBJECT_SCALE_ARTICULATED_UNSUPPORTED";
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
if (result.physics) {
|
|
51
|
+
result.physics.colliders = (result.physics.colliders || []).map((collider) => scaleCollider(collider, factor));
|
|
52
|
+
if (Number.isFinite(result.physics.mass)) result.physics.mass *= factor ** 3;
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
function scalesEqual(a, b) {
|
|
57
|
+
return Math.abs(Number(a) - Number(b)) <= SCALE_EPSILON;
|
|
58
|
+
}
|
|
59
|
+
export { scalesEqual as n, uniformScaleValue as r, physicsManifestForUniformScale as t };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=ObjectTransform-BlQUNK7c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectTransform-BlQUNK7c.js","names":[],"sources":["../../../modules/world/runtime/ObjectTransform.js"],"sourcesContent":["const SCALE_EPSILON = 1e-6;\nexport const MIN_UNIFORM_SCALE = 0.05;\nexport const MAX_UNIFORM_SCALE = 20;\n\nconst scaled = (values, factor) => Array.isArray(values) ? values.map((value) => value * factor) : values;\n\nexport function uniformScaleValue(value, fallback = 1) {\n const values = typeof value === 'number' ? [value, value, value] : value;\n if (!Array.isArray(values) || values.length !== 3 || !values.every(Number.isFinite)) {\n const error = new TypeError('Object scale must be a finite uniform number or vec3');\n error.code = 'OBJECT_SCALE_INVALID';\n throw error;\n }\n const [x, y, z] = values;\n if (Math.max(Math.abs(x - y), Math.abs(x - z), Math.abs(y - z)) > SCALE_EPSILON) {\n const error = new Error('AgentScape currently supports uniform object scaling only');\n error.code = 'OBJECT_SCALE_NON_UNIFORM_UNSUPPORTED';\n throw error;\n }\n const scale = (x + y + z) / 3;\n if (!Number.isFinite(scale) || scale < MIN_UNIFORM_SCALE || scale > MAX_UNIFORM_SCALE) {\n const error = new RangeError(`Object scale must be within ${MIN_UNIFORM_SCALE}..${MAX_UNIFORM_SCALE}`);\n error.code = 'OBJECT_SCALE_OUT_OF_RANGE';\n throw error;\n }\n return Number.isFinite(scale) ? scale : fallback;\n}\n\nfunction scaleCollider(collider, factor) {\n const result = structuredClone(collider);\n if (Array.isArray(result.translation)) result.translation = scaled(result.translation, factor);\n if (result.shape === 'box' && Array.isArray(result.halfExtents)) result.halfExtents = scaled(result.halfExtents, factor);\n if (['cylinder', 'capsule'].includes(result.shape)) {\n if (Number.isFinite(result.radius)) result.radius *= factor;\n if (Number.isFinite(result.halfHeight)) result.halfHeight *= factor;\n }\n if (result.shape === 'convexHull' && Array.isArray(result.vertices)) result.vertices = scaled(result.vertices, factor);\n return result;\n}\n\nexport function physicsManifestForUniformScale(manifest, scaleValue) {\n const factor = uniformScaleValue(scaleValue);\n const result = structuredClone(manifest);\n if (Math.abs(factor - 1) <= SCALE_EPSILON) return result;\n\n const articulatedParts = Object.values(result.parts || {}).filter((part) => part?.joint || part?.physics?.colliders?.length);\n if (articulatedParts.length) {\n const error = new Error(`Uniform scale is not yet supported for articulated asset: ${result.id || 'unknown'}`);\n error.code = 'OBJECT_SCALE_ARTICULATED_UNSUPPORTED';\n throw error;\n }\n\n if (result.physics) {\n result.physics.colliders = (result.physics.colliders || []).map((collider) => scaleCollider(collider, factor));\n if (Number.isFinite(result.physics.mass)) result.physics.mass *= factor ** 3;\n }\n return result;\n}\n\nexport function scalesEqual(a, b) {\n return Math.abs(Number(a) - Number(b)) <= SCALE_EPSILON;\n}\n"],"mappings":";AAAA,MAAM,gBAAgB;AACtB,MAAa,oBAAoB;AAGjC,MAAM,UAAU,QAAQ,WAAW,MAAM,QAAQ,MAAM,IAAI,OAAO,KAAK,UAAU,QAAQ,MAAM,IAAI;AAEnG,SAAgB,kBAAkB,OAAO,WAAW,GAAG;CACrD,MAAM,SAAS,OAAO,UAAU,WAAW;EAAC;EAAO;EAAO;CAAK,IAAI;CACnE,IAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,KAAK,CAAC,OAAO,MAAM,OAAO,QAAQ,GAAG;EACnF,MAAM,wBAAQ,IAAI,UAAU,sDAAsD;EAClF,MAAM,OAAO;EACb,MAAM;CACR;CACA,MAAM,CAAC,GAAG,GAAG,KAAK;CAClB,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,eAAe;EAC/E,MAAM,wBAAQ,IAAI,MAAM,2DAA2D;EACnF,MAAM,OAAO;EACb,MAAM;CACR;CACA,MAAM,SAAS,IAAI,IAAI,KAAK;CAC5B,IAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAA,OAA6B,QAAA,IAA2B;EACrF,MAAM,wBAAQ,IAAI,WAAW,+BAA+B,kBAAkB,KAAuB;EACrG,MAAM,OAAO;EACb,MAAM;CACR;CACA,OAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;AAEA,SAAS,cAAc,UAAU,QAAQ;CACvC,MAAM,SAAS,gBAAgB,QAAQ;CACvC,IAAI,MAAM,QAAQ,OAAO,WAAW,GAAG,OAAO,cAAc,OAAO,OAAO,aAAa,MAAM;CAC7F,IAAI,OAAO,UAAU,SAAS,MAAM,QAAQ,OAAO,WAAW,GAA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