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,157 @@
|
|
|
1
|
+
import { normalizeWorldIR, upgradeLegacyWorldSpec } from '../spec/WorldIR.js';
|
|
2
|
+
import { normalizeWorldSpec } from '../spec/WorldSpec.js';
|
|
3
|
+
import { compileWorldBehaviorBundle } from './WorldBehaviorCompiler.js';
|
|
4
|
+
import { compileWorldPhysicsRequirements } from './WorldPhysicsAdmission.js';
|
|
5
|
+
import { compileWorldAcceptance } from '../verification/WorldAcceptance.js';
|
|
6
|
+
import { createAssetRef } from '../../asset/model/AssetRef.js';
|
|
7
|
+
|
|
8
|
+
export const WORLD_COMPILATION_SCHEMA = 'agentscape.world-compilation';
|
|
9
|
+
export const WORLD_COMPILATION_VERSION = 2;
|
|
10
|
+
|
|
11
|
+
const clone = (value) => structuredClone(value);
|
|
12
|
+
const hasState = (entity) => Object.keys(entity.initialState || {}).length > 0;
|
|
13
|
+
|
|
14
|
+
const invalidReference = (path, entityId) => {
|
|
15
|
+
const error = new TypeError(`WorldIR ${path} references unknown entity: ${entityId}`);
|
|
16
|
+
error.code = 'WORLD_IR_REFERENCE_INVALID';
|
|
17
|
+
error.path = path;
|
|
18
|
+
error.entityId = entityId;
|
|
19
|
+
return error;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const requireEntity = (entityIds, path, entityId) => {
|
|
23
|
+
if (entityId && !entityIds.has(entityId)) throw invalidReference(path, entityId);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const unsupportedExecutionFeatures = (worldIR) => {
|
|
27
|
+
const features=[];
|
|
28
|
+
if(worldIR.spatial.constraints.length) features.push('spatial.constraints');
|
|
29
|
+
const fallback=worldIR.policy.physics?.fallbackPolicy;
|
|
30
|
+
if(fallback && fallback!=='deny') features.push('policy.physics.fallbackPolicy');
|
|
31
|
+
for(const entity of worldIR.entities){
|
|
32
|
+
const qualityFallback=entity.physicsRequirement?.qualityPolicy?.fallbackPolicy;
|
|
33
|
+
if(qualityFallback && qualityFallback!=='deny') features.push(`entities.${entity.id||'$anonymous'}.physicsRequirement.qualityPolicy.fallbackPolicy`);
|
|
34
|
+
}
|
|
35
|
+
if(features.length){
|
|
36
|
+
const error=new TypeError(`WorldIR features are not executable by the canonical pipeline: ${features.join(', ')}`);
|
|
37
|
+
error.code='WORLD_IR_FEATURE_UNSUPPORTED';
|
|
38
|
+
error.features=features;
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
return worldIR;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export function assertWorldIRReferences(worldIR) {
|
|
45
|
+
const entityIds = new Set(worldIR.entities.map((entity) => entity.id).filter(Boolean));
|
|
46
|
+
const entityById = new Map(worldIR.entities.filter((entity)=>entity.id).map((entity)=>[entity.id,entity]));
|
|
47
|
+
|
|
48
|
+
worldIR.entities.forEach((entity, index) => {
|
|
49
|
+
if (!entity.id && (entity.capabilityIntent.length || hasState(entity))) {
|
|
50
|
+
const error = new TypeError(`WorldIR entity[${index}] requires id for capabilityIntent or initialState`);
|
|
51
|
+
error.code = 'WORLD_IR_ENTITY_ID_REQUIRED';
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const anchoredSubjects=new Set();
|
|
57
|
+
worldIR.spatial.relations.forEach((relation, index) => {
|
|
58
|
+
requireEntity(entityIds, `spatial.relations[${index}].subject`, relation.subject);
|
|
59
|
+
if(relation.object) requireEntity(entityIds, `spatial.relations[${index}].object`, relation.object);
|
|
60
|
+
if(relation.anchor?.kind==='observation'){
|
|
61
|
+
if(anchoredSubjects.has(relation.subject)){
|
|
62
|
+
const error=new TypeError(`WorldIR entity ${relation.subject} has multiple observation anchors`);
|
|
63
|
+
error.code='WORLD_IR_OBSERVATION_ANCHOR_AMBIGUOUS';
|
|
64
|
+
error.entityId=relation.subject;
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
anchoredSubjects.add(relation.subject);
|
|
68
|
+
if(entityById.get(relation.subject)?.transform?.position){
|
|
69
|
+
const error=new TypeError(`WorldIR entity ${relation.subject} cannot combine explicit transform.position with an observation anchor`);
|
|
70
|
+
error.code='WORLD_IR_OBSERVATION_ANCHOR_POSITION_CONFLICT';
|
|
71
|
+
error.entityId=relation.subject;
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
worldIR.spatial.constraints.forEach((constraint, index) => {
|
|
77
|
+
requireEntity(entityIds, `spatial.constraints[${index}].subject`, constraint.subject);
|
|
78
|
+
requireEntity(entityIds, `spatial.constraints[${index}].object`, constraint.object);
|
|
79
|
+
});
|
|
80
|
+
worldIR.interactions.forEach((interaction, index) => {
|
|
81
|
+
requireEntity(entityIds, `interactions[${index}].targetId`, interaction.targetId);
|
|
82
|
+
requireEntity(entityIds, `interactions[${index}].supportId`, interaction.supportId);
|
|
83
|
+
});
|
|
84
|
+
worldIR.acceptance.forEach((criterion, index) => {
|
|
85
|
+
requireEntity(entityIds, `acceptance[${index}].targetId`, criterion.targetId);
|
|
86
|
+
requireEntity(entityIds, `acceptance[${index}].subject`, criterion.subject);
|
|
87
|
+
requireEntity(entityIds, `acceptance[${index}].object`, criterion.object);
|
|
88
|
+
});
|
|
89
|
+
return worldIR;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const assetRequests = (worldIR) => worldIR.entities.map((entity) => ({
|
|
93
|
+
...(entity.id ? { id:entity.id } : {}),
|
|
94
|
+
...clone(entity.asset)
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
const executionEntities = (worldIR) => worldIR.entities.map((entity) => ({
|
|
98
|
+
...(entity.id ? { id:entity.id } : {}),
|
|
99
|
+
...(entity.asset.assetId ? { assetRef:createAssetRef(entity.asset.assetId) } : {}),
|
|
100
|
+
...(entity.transform.position ? { position:[...entity.transform.position] } : {}),
|
|
101
|
+
...(entity.capabilityIntent.length ? { capabilityIntent:[...entity.capabilityIntent] } : {}),
|
|
102
|
+
...(hasState(entity) ? { initialState:clone(entity.initialState) } : {})
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
const compatibilityWorldSpec = (worldIR) => {
|
|
106
|
+
const anchored=worldIR.spatial.relations.find((relation)=>relation.anchor);
|
|
107
|
+
if(anchored){
|
|
108
|
+
const error=new TypeError('Legacy WorldSpec cannot represent observation-anchored relations');
|
|
109
|
+
error.code='WORLD_IR_COMPATIBILITY_UNSUPPORTED';
|
|
110
|
+
error.feature='spatial.relations.anchor';
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
return normalizeWorldSpec({
|
|
114
|
+
name:worldIR.intent.name,
|
|
115
|
+
description:worldIR.intent.description,
|
|
116
|
+
generation:clone(worldIR.policy.generation),
|
|
117
|
+
assets:worldIR.entities.map((entity) => ({
|
|
118
|
+
...(entity.id ? { id:entity.id } : {}),
|
|
119
|
+
...clone(entity.asset),
|
|
120
|
+
...(entity.transform.position ? { position:[...entity.transform.position] } : {})
|
|
121
|
+
})),
|
|
122
|
+
relations:worldIR.spatial.relations.map(clone)
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export function projectWorldIRToWorldSpec(input) {
|
|
127
|
+
return compatibilityWorldSpec(assertWorldIRReferences(normalizeWorldIR(input)));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function compileWorldInput(input) {
|
|
131
|
+
if(input?.schema==='agentscape.world-ir') return compileWorldIR(input);
|
|
132
|
+
const worldIR=upgradeLegacyWorldSpec(input);
|
|
133
|
+
return {
|
|
134
|
+
...compileWorldIR(worldIR),
|
|
135
|
+
compatibility:{source:'legacy-world-spec',worldSpec:compatibilityWorldSpec(worldIR)}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function compileWorldIR(input) {
|
|
140
|
+
const worldIR = unsupportedExecutionFeatures(assertWorldIRReferences(normalizeWorldIR(input)));
|
|
141
|
+
const behaviorBundle = compileWorldBehaviorBundle(worldIR);
|
|
142
|
+
const physicsRequirements = compileWorldPhysicsRequirements(worldIR);
|
|
143
|
+
const acceptanceGraph = worldIR.acceptance.length ? compileWorldAcceptance(worldIR.acceptance) : null;
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
schema:WORLD_COMPILATION_SCHEMA,
|
|
147
|
+
schemaVersion:WORLD_COMPILATION_VERSION,
|
|
148
|
+
worldRevisionId:worldIR.revision.id,
|
|
149
|
+
worldIR:clone(worldIR),
|
|
150
|
+
assetRequests:assetRequests(worldIR),
|
|
151
|
+
entities:executionEntities(worldIR),
|
|
152
|
+
relations:worldIR.spatial.relations.map(clone),
|
|
153
|
+
behaviorBundle,
|
|
154
|
+
physicsRequirements,
|
|
155
|
+
acceptanceGraph
|
|
156
|
+
};
|
|
157
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { assetIdFromRef } from '../../asset/model/AssetRef.js';
|
|
2
|
+
|
|
3
|
+
const rootColliderExtent = (spec) => {
|
|
4
|
+
const t=spec.translation || [0,0,0];
|
|
5
|
+
if (spec.shape==='box' && spec.halfExtents?.length===3) {
|
|
6
|
+
const [hx,hy,hz]=spec.halfExtents;
|
|
7
|
+
return {radius:Math.hypot(t[0],t[2])+Math.hypot(hx,hz),minY:t[1]-hy};
|
|
8
|
+
}
|
|
9
|
+
if (spec.shape==='cylinder' && Number.isFinite(spec.radius) && Number.isFinite(spec.halfHeight)) {
|
|
10
|
+
return {radius:Math.hypot(t[0],t[2])+spec.radius,minY:t[1]-spec.halfHeight};
|
|
11
|
+
}
|
|
12
|
+
if (spec.shape==='capsule' && Number.isFinite(spec.radius) && Number.isFinite(spec.halfHeight)) {
|
|
13
|
+
return {radius:Math.hypot(t[0],t[2])+spec.radius,minY:t[1]-(spec.halfHeight+spec.radius)};
|
|
14
|
+
}
|
|
15
|
+
if (spec.shape==='convexHull' && Array.isArray(spec.vertices)) {
|
|
16
|
+
let radius=0,minY=Infinity;
|
|
17
|
+
for(let i=0;i+2<spec.vertices.length;i+=3) {
|
|
18
|
+
radius=Math.max(radius,Math.hypot(t[0]+spec.vertices[i],t[2]+spec.vertices[i+2]));
|
|
19
|
+
minY=Math.min(minY,t[1]+spec.vertices[i+1]);
|
|
20
|
+
}
|
|
21
|
+
if (Number.isFinite(minY)) return {radius,minY};
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function manifestFootprint(manifest) {
|
|
27
|
+
const colliders=manifest?.physics?.colliders || [];
|
|
28
|
+
if (!colliders.length) return {checked:false,reason:'ROOT_COLLIDER_UNAVAILABLE'};
|
|
29
|
+
let radius=.01,minY=Infinity;
|
|
30
|
+
for(const collider of colliders) {
|
|
31
|
+
const extent=rootColliderExtent(collider);
|
|
32
|
+
if (!extent) return {checked:false,reason:'ROOT_COLLIDER_UNSUPPORTED',shape:collider.shape || null};
|
|
33
|
+
radius=Math.max(radius,extent.radius);
|
|
34
|
+
minY=Math.min(minY,extent.minY);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
checked:true,radius,minY,
|
|
38
|
+
coverage:Object.values(manifest.parts || {}).some((part)=>part.physics?.colliders?.length)?'root-only':'full-root'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const candidatePoints = ({minX,maxX,minZ,maxZ,step=1}) => {
|
|
43
|
+
const cx=(minX+maxX)/2,cz=(minZ+maxZ)/2;
|
|
44
|
+
const nx=Math.max(0,Math.floor((maxX-minX)/(2*step)));
|
|
45
|
+
const nz=Math.max(0,Math.floor((maxZ-minZ)/(2*step)));
|
|
46
|
+
const values=[];
|
|
47
|
+
for(let ix=-nx;ix<=nx;ix++) for(let iz=-nz;iz<=nz;iz++) {
|
|
48
|
+
const x=cx+ix*step,z=cz+iz*step;
|
|
49
|
+
if(x<minX-1e-9||x>maxX+1e-9||z<minZ-1e-9||z>maxZ+1e-9) continue;
|
|
50
|
+
values.push({x,z,d2:(x-cx)**2+(z-cz)**2});
|
|
51
|
+
}
|
|
52
|
+
return values.sort((a,b)=>a.d2-b.d2 || a.z-b.z || a.x-b.x);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const circlesOverlap=(a,b,clearance)=>Math.hypot(a.x-b.x,a.z-b.z)<a.radius+b.radius+clearance-1e-9;
|
|
56
|
+
|
|
57
|
+
const normalizeLayout=(layout)=>{
|
|
58
|
+
if(!layout?.bounds || !Number.isFinite(layout.groundY)) return {checked:false,reason:'WORLD_LAYOUT_UNAVAILABLE'};
|
|
59
|
+
const [minX,minZ]=layout.bounds.min || [],[maxX,maxZ]=layout.bounds.max || [];
|
|
60
|
+
if(![minX,minZ,maxX,maxZ].every(Number.isFinite) || minX>=maxX || minZ>=maxZ) return {checked:false,reason:'WORLD_LAYOUT_INVALID'};
|
|
61
|
+
return {checked:true,minX,minZ,maxX,maxZ,groundY:layout.groundY,margin:Number.isFinite(layout.margin)?Math.max(0,layout.margin):.5};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const checkPosition=(manifest,footprint,position,{layout,reserved=[],poseClear,clearance=.35}={})=>{
|
|
65
|
+
const circle={x:position[0],z:position[2],radius:footprint.radius};
|
|
66
|
+
if(circle.x-footprint.radius<layout.minX+layout.margin || circle.x+footprint.radius>layout.maxX-layout.margin || circle.z-footprint.radius<layout.minZ+layout.margin || circle.z+footprint.radius>layout.maxZ-layout.margin) return {checked:true,clear:false,reason:'OUTSIDE_LAYOUT_BOUNDS',circle};
|
|
67
|
+
if(reserved.some((other)=>circlesOverlap(circle,other,clearance))) return {checked:true,clear:false,reason:'BATCH_FOOTPRINT_OVERLAP',circle};
|
|
68
|
+
const physics=poseClear?.(manifest,position);
|
|
69
|
+
if(!physics?.checked) return {checked:false,clear:false,reason:physics?.reason || 'LAYOUT_PHYSICS_UNAVAILABLE',circle,physics};
|
|
70
|
+
if(!physics.clear) return {checked:true,clear:false,reason:'WORLD_POSE_BLOCKED',blockedBy:physics.blockedBy || [],circle,physics};
|
|
71
|
+
return {checked:true,clear:true,circle,physics};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export function preflightWorldPosition(manifest,position,{layout,poseClear,occupied=[],clearance=.35}={}){
|
|
75
|
+
const normalized=normalizeLayout(layout);
|
|
76
|
+
if(!normalized.checked) return normalized;
|
|
77
|
+
if(!Array.isArray(position) || position.length!==3 || !position.every(Number.isFinite)) return {checked:false,reason:'WORLD_POSITION_INVALID'};
|
|
78
|
+
const footprint=manifestFootprint(manifest);
|
|
79
|
+
if(!footprint.checked) return footprint;
|
|
80
|
+
const reserved=[];
|
|
81
|
+
for(const item of occupied){
|
|
82
|
+
if(!item?.manifest || !Array.isArray(item.position) || item.position.length!==3) return {checked:false,reason:'OCCUPIED_POSITION_INVALID'};
|
|
83
|
+
const other=manifestFootprint(item.manifest);
|
|
84
|
+
if(!other.checked) return {checked:false,reason:other.reason,occupiedId:item.id || null};
|
|
85
|
+
reserved.push({x:item.position[0],z:item.position[2],radius:other.radius});
|
|
86
|
+
}
|
|
87
|
+
const verdict=checkPosition(manifest,footprint,position,{layout:normalized,reserved,poseClear,clearance});
|
|
88
|
+
return {...verdict,coverage:footprint.coverage,status:verdict.clear?(footprint.coverage==='root-only'?'provisional':'ready'):'rejected'};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function composeWorldLayout(requests,{getManifest,poseClear,layout,clearance=.35}={}) {
|
|
92
|
+
const normalized=normalizeLayout(layout);
|
|
93
|
+
if(!normalized.checked) return {status:'rejected',reason:normalized.reason,placements:[],issues:[]};
|
|
94
|
+
const {minX,minZ,maxX,maxZ,groundY,margin}=normalized;
|
|
95
|
+
const reserved=[]; const placements=[]; const issues=[];
|
|
96
|
+
let provisional=false;
|
|
97
|
+
|
|
98
|
+
for(const request of requests) {
|
|
99
|
+
const assetId=assetIdFromRef(request.assetRef);
|
|
100
|
+
if (!assetId) continue;
|
|
101
|
+
const manifest=getManifest(assetId);
|
|
102
|
+
const footprint=manifestFootprint(manifest);
|
|
103
|
+
if (!footprint.checked) return {status:'rejected',reason:footprint.reason,placements,issues:[...issues,{id:request.id || null,assetId,reason:footprint.reason}]};
|
|
104
|
+
if (footprint.coverage==='root-only') { provisional=true; issues.push({id:request.id || null,assetId,reason:'ARTICULATED_LAYOUT_ROOT_ONLY'}); }
|
|
105
|
+
const groundPositionY=groundY-footprint.minY+.01;
|
|
106
|
+
const test=(position)=>{
|
|
107
|
+
const verdict=checkPosition(manifest,footprint,position,{layout:normalized,reserved,poseClear,clearance});
|
|
108
|
+
return verdict.clear?{ok:true,circle:verdict.circle,physics:verdict.physics}:{ok:false,reason:verdict.reason,blockedBy:verdict.blockedBy || []};
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
let position=request.position ? [...request.position] : null;
|
|
112
|
+
let mode='explicit';
|
|
113
|
+
const explicitGroundY=groundY-footprint.minY;
|
|
114
|
+
if(position && Math.abs(position[1]-explicitGroundY)<=.03) {
|
|
115
|
+
position[1]=Number(groundPositionY.toFixed(4));
|
|
116
|
+
mode='explicit-grounded';
|
|
117
|
+
}
|
|
118
|
+
let verdict=position ? test(position) : null;
|
|
119
|
+
if (!position) {
|
|
120
|
+
mode='auto';
|
|
121
|
+
const autoY=groundPositionY;
|
|
122
|
+
const step=Math.max(.5,Math.min(2,footprint.radius));
|
|
123
|
+
for(const point of candidatePoints({minX:minX+margin+footprint.radius,maxX:maxX-margin-footprint.radius,minZ:minZ+margin+footprint.radius,maxZ:maxZ-margin-footprint.radius,step})) {
|
|
124
|
+
const candidate=[Number(point.x.toFixed(4)),Number(autoY.toFixed(4)),Number(point.z.toFixed(4))];
|
|
125
|
+
const result=test(candidate);
|
|
126
|
+
if (result.ok) { position=candidate; verdict=result; break; }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (!position || !verdict?.ok) return {status:'rejected',reason:verdict?.reason || 'NO_LAYOUT_POSITION',placements,issues:[...issues,{id:request.id || null,assetId,reason:verdict?.reason || 'NO_LAYOUT_POSITION',blockedBy:verdict?.blockedBy || []}]};
|
|
130
|
+
reserved.push(verdict.circle);
|
|
131
|
+
placements.push({id:request.id || null,assetId,position,mode,radius:Number(footprint.radius.toFixed(4)),coverage:footprint.coverage});
|
|
132
|
+
}
|
|
133
|
+
return {status:provisional?'provisional':'ready',reason:provisional?'ARTICULATED_LAYOUT_ROOT_ONLY':null,placements,issues};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
export function composeNearPlacement(subjectManifest,targetManifest,targetPosition,{subjectY=0,distance=null,poseClear,clearance=.35}={}) {
|
|
138
|
+
const subject=manifestFootprint(subjectManifest),target=manifestFootprint(targetManifest);
|
|
139
|
+
if (!subject.checked) return {checked:false,reason:subject.reason,source:'subject-footprint'};
|
|
140
|
+
if (!target.checked) return {checked:false,reason:target.reason,source:'target-footprint'};
|
|
141
|
+
const minimum=subject.radius+target.radius+clearance;
|
|
142
|
+
const spacing=distance == null ? minimum : Number(distance);
|
|
143
|
+
if (!Number.isFinite(spacing) || spacing<=0) return {checked:false,reason:'NEAR_DISTANCE_INVALID'};
|
|
144
|
+
if (spacing+1e-9<minimum) return {checked:false,reason:'NEAR_DISTANCE_TOO_SMALL',minimumDistance:minimum,requestedDistance:spacing};
|
|
145
|
+
const [x,,z]=targetPosition;
|
|
146
|
+
const candidates=[[x+spacing,subjectY,z],[x-spacing,subjectY,z],[x,subjectY,z+spacing],[x,subjectY,z-spacing]];
|
|
147
|
+
const blocked=[];
|
|
148
|
+
for (const position of candidates) {
|
|
149
|
+
const result=poseClear(subjectManifest,position);
|
|
150
|
+
if (result?.checked && result.clear) return {
|
|
151
|
+
checked:true,position:position.map((v)=>Number(v.toFixed(4))),distance:Number(spacing.toFixed(4)),
|
|
152
|
+
mode:distance == null?'runtime-derived':'explicit',coverage:subject.coverage
|
|
153
|
+
};
|
|
154
|
+
blocked.push({position,reason:result?.reason || (result?.checked?'WORLD_POSE_BLOCKED':'LAYOUT_PHYSICS_UNAVAILABLE'),blockedBy:result?.blockedBy || []});
|
|
155
|
+
}
|
|
156
|
+
return {checked:false,reason:'NEAR_NO_CLEAR_POSE',distance:spacing,blocked};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const observedCenter=(observation)=>{
|
|
160
|
+
const point=observation?.localization?.kind==='point-scale' ? observation.localization.center : observation?.center;
|
|
161
|
+
return Array.isArray(point)&&point.length===3&&point.every(Number.isFinite) ? [...point] : null;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export function composeObservedNearPlacement(subjectManifest,observation,{layout,poseClear,distance=null,clearance=.35,maxDistance=3,occupied=[]}={}){
|
|
165
|
+
const normalized=normalizeLayout(layout);
|
|
166
|
+
if(!normalized.checked) return {checked:false,reason:normalized.reason};
|
|
167
|
+
const footprint=manifestFootprint(subjectManifest);
|
|
168
|
+
if(!footprint.checked) return {checked:false,reason:footprint.reason,source:'subject-footprint'};
|
|
169
|
+
const center=observedCenter(observation);
|
|
170
|
+
if(!center) return {checked:false,reason:'OBSERVATION_LOCALIZATION_UNAVAILABLE'};
|
|
171
|
+
if(typeof poseClear!=='function') return {checked:false,reason:'LAYOUT_PHYSICS_UNAVAILABLE'};
|
|
172
|
+
const reserved=[];
|
|
173
|
+
for(const item of occupied){
|
|
174
|
+
if(!item?.manifest || !Array.isArray(item.position) || item.position.length!==3) return {checked:false,reason:'OCCUPIED_POSITION_INVALID'};
|
|
175
|
+
const other=manifestFootprint(item.manifest);
|
|
176
|
+
if(!other.checked) return {checked:false,reason:other.reason,occupiedId:item.id || null};
|
|
177
|
+
reserved.push({x:item.position[0],z:item.position[2],radius:other.radius});
|
|
178
|
+
}
|
|
179
|
+
const explicit=distance!=null;
|
|
180
|
+
const observedScale=Number.isFinite(observation?.localization?.scale)&&observation.localization.scale>0 ? observation.localization.scale : 0;
|
|
181
|
+
const startDistance=explicit ? Number(distance) : Math.max(footprint.radius+clearance+.25,Math.min(1.5,observedScale+footprint.radius+clearance));
|
|
182
|
+
if(!Number.isFinite(startDistance)||startDistance<=0) return {checked:false,reason:'NEAR_DISTANCE_INVALID'};
|
|
183
|
+
const limit=Math.max(startDistance,Number.isFinite(maxDistance)?maxDistance:3);
|
|
184
|
+
const groundY=normalized.groundY-footprint.minY+.01;
|
|
185
|
+
const directions=[[1,0],[-1,0],[0,1],[0,-1],[Math.SQRT1_2,Math.SQRT1_2],[-Math.SQRT1_2,Math.SQRT1_2],[Math.SQRT1_2,-Math.SQRT1_2],[-Math.SQRT1_2,-Math.SQRT1_2]];
|
|
186
|
+
const blocked=[];
|
|
187
|
+
for(let radius=startDistance;radius<=limit+1e-9;radius+=.35){
|
|
188
|
+
for(const [dx,dz] of directions){
|
|
189
|
+
const position=[Number((center[0]+dx*radius).toFixed(4)),Number(groundY.toFixed(4)),Number((center[2]+dz*radius).toFixed(4))];
|
|
190
|
+
const bounds=checkPosition(subjectManifest,footprint,position,{layout:normalized,reserved,poseClear,clearance});
|
|
191
|
+
if(bounds.checked&&bounds.clear) return {
|
|
192
|
+
checked:true,status:footprint.coverage==='root-only'?'provisional':'ready',position,
|
|
193
|
+
distance:Number(Math.hypot(position[0]-center[0],position[2]-center[2]).toFixed(4)),
|
|
194
|
+
requestedDistance:explicit?startDistance:null,mode:explicit?'observation-explicit':'observation-auto',
|
|
195
|
+
observationId:observation?.id||null,anchor:[...center],radius:Number(footprint.radius.toFixed(4)),coverage:footprint.coverage,collisionVerified:true
|
|
196
|
+
};
|
|
197
|
+
blocked.push({position,reason:bounds.reason,blockedBy:bounds.blockedBy||[]});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return {checked:false,reason:'OBSERVATION_NEAR_NO_CLEAR_POSE',observationId:observation?.id||null,anchor:center,startDistance,maxDistance:limit,blocked};
|
|
201
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { assetIdFromRef } from '../../asset/model/AssetRef.js';
|
|
2
|
+
|
|
3
|
+
export const WORLD_PHYSICS_REQUIREMENTS_SCHEMA='agentscape.world-physics-requirements';
|
|
4
|
+
export const WORLD_PHYSICS_REQUIREMENTS_VERSION=1;
|
|
5
|
+
|
|
6
|
+
const BODY_CAPABILITIES={
|
|
7
|
+
transform:['transform-state'],
|
|
8
|
+
rigid:['rigid-body'],
|
|
9
|
+
articulated:['articulated-body','joints'],
|
|
10
|
+
character:['character-controller'],
|
|
11
|
+
soft:['soft-body'],
|
|
12
|
+
cloth:['cloth']
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function compileWorldPhysicsRequirements(worldIR){
|
|
16
|
+
const requirements=[];
|
|
17
|
+
for(const entity of worldIR?.entities||[]){
|
|
18
|
+
if(!entity.physicsRequirement) continue;
|
|
19
|
+
if(!entity.id) throw new TypeError('PhysicsRequirement entity requires id');
|
|
20
|
+
const requirement=structuredClone(entity.physicsRequirement);
|
|
21
|
+
const requiredCapabilities=[...new Set([...(BODY_CAPABILITIES[requirement.bodyClass]||[]),...(requirement.requiredCapabilities||[])])];
|
|
22
|
+
requirements.push({
|
|
23
|
+
entityId:entity.id,
|
|
24
|
+
...(requirement.bodyClass?{bodyClass:requirement.bodyClass}:{}),
|
|
25
|
+
requiredCapabilities,
|
|
26
|
+
executionMode:requirement.executionMode||(requirement.bodyClass==='transform'?'render-only':'realtime'),
|
|
27
|
+
qualityPolicy:structuredClone(requirement.qualityPolicy||{})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
schema:WORLD_PHYSICS_REQUIREMENTS_SCHEMA,schemaVersion:WORLD_PHYSICS_REQUIREMENTS_VERSION,
|
|
32
|
+
worldRevisionId:worldIR?.revision?.id||null,
|
|
33
|
+
policy:structuredClone(worldIR?.policy?.physics||{}),requirements
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function admitWorldPhysics(bundle,{profile,resolvedAssets=[],getManifest}={}){
|
|
38
|
+
if(bundle?.schema!==WORLD_PHYSICS_REQUIREMENTS_SCHEMA||bundle.schemaVersion!==WORLD_PHYSICS_REQUIREMENTS_VERSION) throw new TypeError('Unsupported WorldPhysics requirements');
|
|
39
|
+
if(!profile){
|
|
40
|
+
return {status:bundle.requirements.length?'rejected':'ready',backend:null,requirements:structuredClone(bundle.requirements),issues:bundle.requirements.length?[{code:'PHYSICS_BACKEND_UNAVAILABLE'}]:[]};
|
|
41
|
+
}
|
|
42
|
+
const capabilities=new Set(profile.capabilities||[]);
|
|
43
|
+
const executionModes=new Set(profile.executionModes||[]);
|
|
44
|
+
const byId=new Map((resolvedAssets||[]).filter((item)=>item.id).map((item)=>[item.id,item]));
|
|
45
|
+
const issues=[];
|
|
46
|
+
for(const requirement of bundle.requirements){
|
|
47
|
+
const resolved=byId.get(requirement.entityId);
|
|
48
|
+
const assetId=assetIdFromRef(resolved?.assetRef);
|
|
49
|
+
if(!assetId){issues.push({code:'PHYSICS_TARGET_UNRESOLVED',entityId:requirement.entityId});continue;}
|
|
50
|
+
for(const capability of requirement.requiredCapabilities){
|
|
51
|
+
if(!capabilities.has(capability)) issues.push({code:'PHYSICS_BACKEND_CAPABILITY_MISSING',entityId:requirement.entityId,capability,backend:profile.identity});
|
|
52
|
+
}
|
|
53
|
+
if(!executionModes.has(requirement.executionMode)) issues.push({code:'PHYSICS_EXECUTION_MODE_UNSUPPORTED',entityId:requirement.entityId,executionMode:requirement.executionMode,backend:profile.identity});
|
|
54
|
+
if(requirement.qualityPolicy?.realtimeRequired===true&&profile.qualities?.realtime!==true) issues.push({code:'PHYSICS_REALTIME_QUALITY_UNMET',entityId:requirement.entityId,backend:profile.identity});
|
|
55
|
+
if(requirement.qualityPolicy?.deterministicRequired===true&&profile.qualities?.deterministic!==true) issues.push({code:'PHYSICS_DETERMINISM_QUALITY_UNMET',entityId:requirement.entityId,backend:profile.identity});
|
|
56
|
+
if(requirement.bodyClass==='articulated'){
|
|
57
|
+
const manifest=getManifest?.(assetId);
|
|
58
|
+
const parts=Object.values(manifest?.parts||{});
|
|
59
|
+
if(!parts.some((part)=>part?.joint)) issues.push({code:'PHYSICS_ASSET_ARTICULATION_MISSING',entityId:requirement.entityId,assetId});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
status:issues.length?'rejected':'ready',
|
|
64
|
+
backend:{
|
|
65
|
+
identity:profile.identity,
|
|
66
|
+
backendCapabilities:[...(profile.backendCapabilities||[])],
|
|
67
|
+
runtimeCapabilities:[...(profile.runtimeCapabilities||[])],
|
|
68
|
+
capabilities:[...(profile.capabilities||[])],
|
|
69
|
+
backendExecutionModes:[...(profile.backendExecutionModes||[])],
|
|
70
|
+
runtimeExecutionModes:[...(profile.runtimeExecutionModes||[])],
|
|
71
|
+
executionModes:[...(profile.executionModes||[])],
|
|
72
|
+
qualities:{...(profile.qualities||{})}
|
|
73
|
+
},
|
|
74
|
+
requirements:structuredClone(bundle.requirements),issues
|
|
75
|
+
};
|
|
76
|
+
}
|