agentscape3d-engine 0.0.0-stage → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +19 -2
- package/cli.mjs +53 -0
- package/dist/AssetCompiler-A99wKf7H.js +2424 -0
- package/dist/AssetCompiler-A99wKf7H.js.map +1 -0
- package/dist/AssetInputContracts-uKYeQu-X.js +245 -0
- package/dist/AssetInputContracts-uKYeQu-X.js.map +1 -0
- package/dist/AssetRecipe-DCaLLXvG.js +67 -0
- package/dist/AssetRecipe-DCaLLXvG.js.map +1 -0
- package/dist/BrowserCodeWorker.js +53850 -0
- package/dist/BrowserCodeWorker.js.map +1 -0
- package/dist/KinematicHypothesisScreen-4v7GBwdv.js +241 -0
- package/dist/KinematicHypothesisScreen-4v7GBwdv.js.map +1 -0
- package/dist/SceneSerializer-CLCzQjL_.js +350 -0
- package/dist/SceneSerializer-CLCzQjL_.js.map +1 -0
- package/dist/StylePack-CD_BC-Mv.js +6317 -0
- package/dist/StylePack-CD_BC-Mv.js.map +1 -0
- package/dist/WorldArchive-dYf1OpSe.js +417 -0
- package/dist/WorldArchive-dYf1OpSe.js.map +1 -0
- package/dist/WorldIO-Dqz4MqTQ.js +149 -0
- package/dist/WorldIO-Dqz4MqTQ.js.map +1 -0
- package/dist/blankWorld-OoOvN_IK.js +75 -0
- package/dist/blankWorld-OoOvN_IK.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-B3HCflvO.js +128 -0
- package/dist/disposeObject3D-B3HCflvO.js.map +1 -0
- package/dist/environments-B1WaICAN.js +4197 -0
- package/dist/environments-B1WaICAN.js.map +1 -0
- package/dist/gltfIO-BMK1hc2D.js +9 -0
- package/dist/gltfIO-BMK1hc2D.js.map +1 -0
- package/dist/grandUrbanBlock-Bdjgc6ZT.js +515 -0
- package/dist/grandUrbanBlock-Bdjgc6ZT.js.map +1 -0
- package/dist/index.d.ts +275 -0
- package/dist/index.js +16239 -0
- package/dist/index.js.map +1 -0
- package/dist/magicCabin-DPQi_jh-.js +11019 -0
- package/dist/magicCabin-DPQi_jh-.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +1 -0
- package/dist/monumentHall-IOLbRZQC.js +403 -0
- package/dist/monumentHall-IOLbRZQC.js.map +1 -0
- package/dist/node.d.ts +16 -0
- package/dist/node.js +26 -0
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/ruinedCourtyard-BtaF_aOi.js +696 -0
- package/dist/ruinedCourtyard-BtaF_aOi.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 +8 -0
- package/dist/runtime/application/buildTaskObservation.js +117 -0
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +46 -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 +72 -0
- package/dist/runtime/application/createSession.js +66 -0
- package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
- package/dist/runtime/application/generation/GenerationOrchestrator.js +629 -0
- package/dist/runtime/application/generation/GenerationRuntime.js +214 -0
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +285 -0
- package/dist/runtime/application/native-scene/CodeProject.js +119 -0
- package/dist/runtime/application/native-scene/CodeProjectModules.js +128 -0
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +62 -0
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
- package/dist/runtime/application/native-scene/NativeSceneHost.js +319 -0
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
- package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
- package/dist/runtime/application/object-forge/SceneObjectForge.js +232 -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 +79 -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 +45 -0
- package/dist/runtime/application/scene/SceneEditService.js +144 -0
- package/dist/runtime/application/scene/SceneFacade.js +261 -0
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +40 -0
- package/dist/runtime/application/scene/SceneJobController.js +229 -0
- package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
- package/dist/runtime/application/scene/ScenePackage.js +162 -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 +87 -0
- package/dist/runtime/application/scene/WorldDirectory.js +20 -0
- package/dist/runtime/application/scene/WorldDocument.js +74 -0
- package/dist/runtime/application/scene/WorldIO.js +103 -0
- package/dist/runtime/application/scene/WorldStorage.js +137 -0
- package/dist/runtime/application/skills/SkillRegistry.js +189 -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 +174 -0
- package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
- package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
- package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +77 -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 +132 -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 +150 -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 +80 -0
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +58 -0
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +190 -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 +65 -0
- package/dist/runtime/apps/mcp-server/registerTools.js +225 -0
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
- package/dist/runtime/apps/mcp-server/security.js +21 -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/WorldDiskStorage.js +51 -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/foundation/EventBus.js +18 -0
- package/dist/runtime/foundation/JsonGateway.js +47 -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 +399 -0
- package/dist/runtime/modules/asset/README.md +54 -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 +100 -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/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 +47 -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 +245 -0
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +651 -0
- package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +410 -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/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 +80 -0
- package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +150 -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 +207 -0
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +246 -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 +502 -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 +665 -0
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +107 -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 +305 -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 +222 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +130 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +120 -0
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +102 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +99 -0
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
- package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +125 -0
- package/dist/runtime/modules/world/runtime/systems/Instrument.js +38 -0
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +728 -0
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +269 -0
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +469 -0
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1673 -0
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +457 -0
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +284 -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 +69 -0
- package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +158 -0
- package/dist/runtime/modules/world/verification/WorldValidator.js +65 -0
- package/dist/runtime/package-lock.json +16048 -0
- package/dist/runtime/package.json +105 -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-BWpTl0Wj.js +359 -0
- package/dist/schema-BWpTl0Wj.js.map +1 -0
- package/dist/suzhouGarden-H9tiPgxq.js +6150 -0
- package/dist/suzhouGarden-H9tiPgxq.js.map +1 -0
- package/dist/woodlandWorkshop-D6zzSbHr.js +483 -0
- package/dist/woodlandWorkshop-D6zzSbHr.js.map +1 -0
- package/dist/yuanmingyuan-D6IHqjZ-.js +4955 -0
- package/dist/yuanmingyuan-D6IHqjZ-.js.map +1 -0
- package/package.json +70 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const ROOT_PART = '$root';
|
|
2
|
+
|
|
3
|
+
export function orderParts(parts = {}) {
|
|
4
|
+
const ordered = [];
|
|
5
|
+
const visiting = new Set();
|
|
6
|
+
const visited = new Set();
|
|
7
|
+
|
|
8
|
+
const visit = (name) => {
|
|
9
|
+
if (visited.has(name)) return;
|
|
10
|
+
if (visiting.has(name)) throw new Error(`Part hierarchy cycle: ${name}`);
|
|
11
|
+
const part = parts[name];
|
|
12
|
+
if (!part) throw new Error(`Unknown part: ${name}`);
|
|
13
|
+
visiting.add(name);
|
|
14
|
+
const parent = part.parent || ROOT_PART;
|
|
15
|
+
if (parent !== ROOT_PART) {
|
|
16
|
+
if (!parts[parent]) throw new Error(`Unknown parent part: ${parent}`);
|
|
17
|
+
if (parent === name) throw new Error(`Part cannot parent itself: ${name}`);
|
|
18
|
+
visit(parent);
|
|
19
|
+
}
|
|
20
|
+
visiting.delete(name);
|
|
21
|
+
visited.add(name);
|
|
22
|
+
ordered.push([name, part]);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
Object.keys(parts).forEach(visit);
|
|
26
|
+
return ordered;
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const MiB = 1024 * 1024;
|
|
2
|
+
|
|
3
|
+
export const RESOURCE_BUDGET = Object.freeze({
|
|
4
|
+
maxInputBytes: 100 * MiB,
|
|
5
|
+
renderVertices: { advisory: 1_000_000, hard: 3_000_000 },
|
|
6
|
+
drawCalls: { advisory: 200, hard: 800 },
|
|
7
|
+
textureVRAM: { advisory: 256 * MiB, hard: 512 * MiB },
|
|
8
|
+
maxTextureDimension: { advisory: 4096, hard: 8192 },
|
|
9
|
+
animationKeyframes: { advisory: 100_000, hard: 500_000 }
|
|
10
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { Errors } from './errors.js';
|
|
2
|
+
import { orderParts, ROOT_PART } from './parts.js';
|
|
3
|
+
import { validateSimulationProfile } from '../../../foundation/simulation/SimulationProfile.js';
|
|
4
|
+
|
|
5
|
+
const BODY_TYPES = new Set(['fixed', 'dynamic', 'kinematic']);
|
|
6
|
+
const SHAPES = new Set(['box', 'cylinder', 'capsule', 'convexHull']);
|
|
7
|
+
const ARTICULATION_ACTIONS = new Set(['open', 'close']);
|
|
8
|
+
|
|
9
|
+
function validateInteractionContract(value, context = {}) {
|
|
10
|
+
if (value == null) return;
|
|
11
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) throw Errors.invalidManifest('interactionContract must be an object', context);
|
|
12
|
+
if (value.schema !== 'agentscape.interaction-contract') throw Errors.invalidManifest('interactionContract.schema must be agentscape.interaction-contract', context);
|
|
13
|
+
if (value.schemaVersion !== 1) throw Errors.invalidManifest('interactionContract.schemaVersion must be 1', context);
|
|
14
|
+
if (value.entityId !== context.id) throw Errors.invalidManifest('interactionContract.entityId must match manifest id', context);
|
|
15
|
+
if (!Array.isArray(value.contracts)) throw Errors.invalidManifest('interactionContract.contracts must be an array', context);
|
|
16
|
+
const ids=new Set();
|
|
17
|
+
for (const contract of value.contracts) {
|
|
18
|
+
if (!contract?.id || ids.has(contract.id)) throw Errors.invalidManifest('interactionContract contract ids must be unique', context);
|
|
19
|
+
ids.add(contract.id);
|
|
20
|
+
if (!contract.capability || !contract.action) throw Errors.invalidManifest('interactionContract contract requires capability and action', context);
|
|
21
|
+
if (!Array.isArray(contract.preconditions) || !Array.isArray(contract.effects)) throw Errors.invalidManifest('interactionContract contract requires preconditions and effects arrays', context);
|
|
22
|
+
if (!contract.verifierTarget?.type || contract.verifierTarget.type !== 'articulation-state') throw Errors.invalidManifest('interactionContract verifierTarget must be articulation-state', context);
|
|
23
|
+
if (!Number.isFinite(contract.verifierTarget.target)) throw Errors.invalidManifest('interactionContract verifierTarget.target must be finite', context);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
function validateReceptacles(receptacles, context = {}) {
|
|
29
|
+
if (receptacles == null) return;
|
|
30
|
+
if (!Array.isArray(receptacles)) throw Errors.invalidManifest('Manifest receptacles must be an array', context);
|
|
31
|
+
const ids=new Set();
|
|
32
|
+
for (const receptacle of receptacles) {
|
|
33
|
+
if (!receptacle?.id || typeof receptacle.id !== 'string' || ids.has(receptacle.id)) throw Errors.invalidManifest('Receptacle ids must be unique non-empty strings', context);
|
|
34
|
+
ids.add(receptacle.id);
|
|
35
|
+
if (!Array.isArray(receptacle.localPosition) || receptacle.localPosition.length !== 3 || !receptacle.localPosition.every(Number.isFinite)) throw Errors.invalidManifest(`Receptacle ${receptacle.id} localPosition requires finite [3]`, context);
|
|
36
|
+
if (!Array.isArray(receptacle.size) || receptacle.size.length !== 3 || !receptacle.size.every((value)=>Number.isFinite(value) && value > 0)) throw Errors.invalidManifest(`Receptacle ${receptacle.id} size requires positive finite [3]`, context);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function validateEmbodiment(embodiment, context = {}) {
|
|
41
|
+
if (!embodiment) return;
|
|
42
|
+
const anchor = embodiment.holdAnchor;
|
|
43
|
+
if (!anchor) return;
|
|
44
|
+
if (!Array.isArray(anchor.translation) || anchor.translation.length !== 3 || !anchor.translation.every(Number.isFinite)) {
|
|
45
|
+
throw Errors.invalidManifest('embodiment.holdAnchor.translation requires finite [3]', context);
|
|
46
|
+
}
|
|
47
|
+
if (anchor.rotation != null && (!Array.isArray(anchor.rotation) || anchor.rotation.length !== 4 || !anchor.rotation.every(Number.isFinite))) {
|
|
48
|
+
throw Errors.invalidManifest('embodiment.holdAnchor.rotation requires finite quaternion[4]', context);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function validatePhysics(physics, context = {}) {
|
|
53
|
+
if (!physics) return;
|
|
54
|
+
if (physics.body && !BODY_TYPES.has(physics.body)) throw Errors.invalidManifest(`Unsupported physics body: ${physics.body}`, context);
|
|
55
|
+
if (physics.carryable != null && typeof physics.carryable !== 'boolean') throw Errors.invalidManifest('physics.carryable must be boolean', context);
|
|
56
|
+
if (physics.navigationObstacle != null && typeof physics.navigationObstacle !== 'boolean') throw Errors.invalidManifest('physics.navigationObstacle must be boolean', context);
|
|
57
|
+
if (physics.ccd != null && typeof physics.ccd !== 'boolean') throw Errors.invalidManifest('physics.ccd must be boolean', context);
|
|
58
|
+
if (physics.sensor != null && typeof physics.sensor !== 'boolean') throw Errors.invalidManifest('physics.sensor must be boolean', context);
|
|
59
|
+
if (physics.collisionEvents != null && typeof physics.collisionEvents !== 'boolean') throw Errors.invalidManifest('physics.collisionEvents must be boolean', context);
|
|
60
|
+
if (physics.canSleep != null && typeof physics.canSleep !== 'boolean') throw Errors.invalidManifest('physics.canSleep must be boolean', context);
|
|
61
|
+
for (const key of ['lockTranslation','lockRotation']) {
|
|
62
|
+
if (physics[key] != null && (!Array.isArray(physics[key]) || physics[key].length !== 3 || !physics[key].every((value)=>typeof value === 'boolean'))) throw Errors.invalidManifest(`physics.${key} must be boolean[3]`, context);
|
|
63
|
+
}
|
|
64
|
+
if (physics.collision != null) {
|
|
65
|
+
if (!physics.collision || typeof physics.collision !== 'object' || Array.isArray(physics.collision)) throw Errors.invalidManifest('physics.collision must be an object', context);
|
|
66
|
+
const { groups, collidesWith } = physics.collision;
|
|
67
|
+
if (!Array.isArray(groups) || groups.length === 0 || groups.some((value) => typeof value !== 'string' || !value.trim())) throw Errors.invalidManifest('physics.collision.groups requires non-empty string[]', context);
|
|
68
|
+
if (new Set(groups).size !== groups.length) throw Errors.invalidManifest('physics.collision.groups must be unique', context);
|
|
69
|
+
if (!Array.isArray(collidesWith) || collidesWith.some((value) => typeof value !== 'string' || !value.trim())) throw Errors.invalidManifest('physics.collision.collidesWith requires string[]', context);
|
|
70
|
+
if (new Set(collidesWith).size !== collidesWith.length) throw Errors.invalidManifest('physics.collision.collidesWith must be unique', context);
|
|
71
|
+
}
|
|
72
|
+
if (physics.mass != null && (!Number.isFinite(physics.mass) || physics.mass <= 0)) throw Errors.invalidManifest('physics.mass must be positive finite', context);
|
|
73
|
+
for (const key of ['friction','restitution','linearDamping','angularDamping']) {
|
|
74
|
+
if (physics[key] != null && (!Number.isFinite(physics[key]) || physics[key] < 0)) throw Errors.invalidManifest(`physics.${key} must be finite and >= 0`, context);
|
|
75
|
+
}
|
|
76
|
+
if (physics.restitution != null && physics.restitution > 1) throw Errors.invalidManifest('physics.restitution must be <= 1', context);
|
|
77
|
+
if (physics.gravityScale != null && !Number.isFinite(physics.gravityScale)) throw Errors.invalidManifest('physics.gravityScale must be finite', context);
|
|
78
|
+
for (const collider of physics.colliders || []) {
|
|
79
|
+
if (!SHAPES.has(collider.shape)) throw Errors.invalidManifest(`Unsupported collider shape: ${collider.shape}`, context);
|
|
80
|
+
if (collider.translation && (collider.translation.length !== 3 || !collider.translation.every(Number.isFinite))) throw Errors.invalidManifest('Collider translation requires finite [3]', context);
|
|
81
|
+
if (collider.shape === 'box' && (collider.halfExtents?.length !== 3 || !collider.halfExtents.every((v) => Number.isFinite(v) && v > 0))) throw Errors.invalidManifest('Box collider requires positive finite halfExtents[3]', context);
|
|
82
|
+
if (collider.shape === 'cylinder' && (!Number.isFinite(collider.halfHeight) || collider.halfHeight <= 0 || !Number.isFinite(collider.radius) || collider.radius <= 0)) throw Errors.invalidManifest('Cylinder collider requires positive finite halfHeight and radius', context);
|
|
83
|
+
if (collider.shape === 'capsule' && (!Number.isFinite(collider.halfHeight) || collider.halfHeight <= 0 || !Number.isFinite(collider.radius) || collider.radius <= 0)) throw Errors.invalidManifest('Capsule collider requires positive finite halfHeight and radius', context);
|
|
84
|
+
if (collider.shape === 'convexHull' && (!Array.isArray(collider.vertices) || collider.vertices.length < 12 || collider.vertices.length % 3 !== 0 || !collider.vertices.every(Number.isFinite))) throw Errors.invalidManifest('Convex hull collider requires finite flat vertices[] with at least 4 points', context);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function validateAssetManifest(manifest) {
|
|
89
|
+
if (!manifest || typeof manifest !== 'object') throw Errors.invalidManifest('Manifest must be an object');
|
|
90
|
+
if (!manifest.id || typeof manifest.id !== 'string') throw Errors.invalidManifest('Manifest requires string id');
|
|
91
|
+
if (!manifest.type || typeof manifest.type !== 'string') throw Errors.invalidManifest('Manifest requires string type', { id: manifest.id });
|
|
92
|
+
if (manifest.capabilityLevel != null && !['visual', 'physical', 'interactive'].includes(manifest.capabilityLevel)) throw Errors.invalidManifest('Invalid capability level');
|
|
93
|
+
if (manifest.capabilityLevel === 'visual' && (manifest.physics || Object.keys(manifest.parts || {}).length || manifest.actions?.length || manifest.surfaces?.length)) throw Errors.invalidManifest('Visual assets cannot declare physical capabilities');
|
|
94
|
+
if (!Array.isArray(manifest.actions)) throw Errors.invalidManifest('Manifest actions must be an array', { id: manifest.id });
|
|
95
|
+
if (new Set(manifest.actions).size !== manifest.actions.length) throw Errors.invalidManifest('Manifest actions must be unique', { id: manifest.id });
|
|
96
|
+
if (!['builtin', 'glb', 'compiled'].includes(manifest.source?.kind)) throw Errors.invalidManifest('Manifest source.kind must be builtin, glb or compiled', { id: manifest.id });
|
|
97
|
+
if (manifest.source.kind === 'glb' && !manifest.source.url) throw Errors.invalidManifest('GLB source requires url', { id: manifest.id });
|
|
98
|
+
if (manifest.source.kind === 'compiled' && !manifest.source.key) throw Errors.invalidManifest('Compiled source requires key', { id: manifest.id });
|
|
99
|
+
validateInteractionContract(manifest.interactionContract, { id: manifest.id });
|
|
100
|
+
validatePhysics(manifest.physics, { id: manifest.id });
|
|
101
|
+
validateSimulationProfile(manifest.simulation);
|
|
102
|
+
if(manifest.simulation?.schemaVersion===2){
|
|
103
|
+
for(const node of manifest.simulation.nodes){
|
|
104
|
+
if(node.partName!=='$root' && !Object.hasOwn(manifest.parts || {},node.partName))
|
|
105
|
+
throw Errors.invalidManifest('Thermal node references an unknown physical part: '+node.partName,{id:manifest.id});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
validateEmbodiment(manifest.embodiment, { id: manifest.id });
|
|
109
|
+
validateReceptacles(manifest.receptacles, { id: manifest.id });
|
|
110
|
+
for (const [name, part] of Object.entries(manifest.parts || {})) {
|
|
111
|
+
const context = { id: manifest.id, part: name };
|
|
112
|
+
if (!part.node) throw Errors.invalidManifest(`Part ${name} requires node`, context);
|
|
113
|
+
if (part.actions && (!Array.isArray(part.actions) || new Set(part.actions).size !== part.actions.length)) throw Errors.invalidManifest(`Part ${name} actions must be a unique array`, context);
|
|
114
|
+
if (part.joint && !['revolute', 'prismatic', 'fixed'].includes(part.joint.type)) throw Errors.invalidManifest(`Unsupported joint type: ${part.joint.type}`, context);
|
|
115
|
+
if (part.joint) {
|
|
116
|
+
if (part.joint.type === 'fixed') {
|
|
117
|
+
if (part.joint.axis != null) throw Errors.invalidManifest(`Part ${name} fixed joint must not define axis`, context);
|
|
118
|
+
if (part.joint.limits != null) throw Errors.invalidManifest(`Part ${name} fixed joint must not define limits`, context);
|
|
119
|
+
if (part.joint.motor != null) throw Errors.invalidManifest(`Part ${name} fixed joint must not define motor`, context);
|
|
120
|
+
if (Object.keys(part.targets || {}).length) throw Errors.invalidManifest(`Part ${name} fixed joint must not define targets`, context);
|
|
121
|
+
} else if (!Array.isArray(part.joint.axis) || part.joint.axis.length !== 3 || !part.joint.axis.every(Number.isFinite) || Math.hypot(...part.joint.axis) < 1e-6) throw Errors.invalidManifest(`Part ${name} joint requires non-zero finite axis[3]`, context);
|
|
122
|
+
for (const anchor of ['parentAnchor','childAnchor']) {
|
|
123
|
+
if (!Array.isArray(part.joint[anchor]) || part.joint[anchor].length !== 3 || !part.joint[anchor].every(Number.isFinite)) throw Errors.invalidManifest(`Part ${name} joint requires finite ${anchor}[3]`, context);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (part.joint?.limits && (part.joint.limits.length !== 2 || !part.joint.limits.every(Number.isFinite) || part.joint.limits[0] >= part.joint.limits[1])) throw Errors.invalidManifest(`Part ${name} joint requires ascending finite limits[2]`, context);
|
|
127
|
+
for (const [action, target] of Object.entries(part.targets || {})) {
|
|
128
|
+
if (!part.actions?.includes(action)) throw Errors.invalidManifest(`Part ${name} target ${action} requires matching action`, context);
|
|
129
|
+
if (!Number.isFinite(target)) throw Errors.invalidManifest(`Part ${name} target ${action} must be finite`, context);
|
|
130
|
+
if (!part.joint?.limits || target < part.joint.limits[0] || target > part.joint.limits[1]) throw Errors.invalidManifest(`Part ${name} target ${action} must be within joint limits`, context);
|
|
131
|
+
}
|
|
132
|
+
for (const action of part.actions || []) {
|
|
133
|
+
if (Number.isFinite(part.targets?.[action]) && (!part.joint || part.joint.type === 'fixed' || !part.physics?.colliders?.length)) throw Errors.invalidManifest(`Part ${name} executable target ${action} requires a movable joint and colliders`, context);
|
|
134
|
+
if (ARTICULATION_ACTIONS.has(action) && (!part.joint || !part.physics?.colliders?.length || !Number.isFinite(part.targets?.[action]))) throw Errors.invalidManifest(`Part ${name} action ${action} requires physics, joint and explicit target`, context);
|
|
135
|
+
}
|
|
136
|
+
validatePhysics(part.physics, context);
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
for (const [name, part] of orderParts(manifest.parts || {})) {
|
|
140
|
+
if ((part.parent || ROOT_PART) === name) throw new Error(`Part cannot parent itself: ${name}`);
|
|
141
|
+
}
|
|
142
|
+
} catch (error) {
|
|
143
|
+
throw Errors.invalidManifest(error.message, { id: manifest.id });
|
|
144
|
+
}
|
|
145
|
+
for (const action of manifest.actions.filter((action) => ARTICULATION_ACTIONS.has(action))) {
|
|
146
|
+
const executable = Object.values(manifest.parts || {}).some((part) => part.actions?.includes(action) && Number.isFinite(part.targets?.[action]));
|
|
147
|
+
if (!executable) throw Errors.invalidManifest(`Top-level action ${action} requires an executable part target`, { id: manifest.id, action });
|
|
148
|
+
}
|
|
149
|
+
return manifest;
|
|
150
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const DB_NAME = 'agentscape-asset-manifests';
|
|
2
|
+
const DB_VERSION = 1;
|
|
3
|
+
const STORE_NAME = 'manifests';
|
|
4
|
+
|
|
5
|
+
const clone = (value) => value == null ? value : structuredClone(value);
|
|
6
|
+
|
|
7
|
+
export class AssetManifestStore {
|
|
8
|
+
constructor({ indexedDBImpl = globalThis.indexedDB } = {}) {
|
|
9
|
+
this.indexedDB = indexedDBImpl;
|
|
10
|
+
this.memory = new Map();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async open() {
|
|
14
|
+
if (!this.indexedDB) return null;
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const request = this.indexedDB.open(DB_NAME, DB_VERSION);
|
|
17
|
+
request.onupgradeneeded = () => {
|
|
18
|
+
const db = request.result;
|
|
19
|
+
if (!db.objectStoreNames.contains(STORE_NAME)) db.createObjectStore(STORE_NAME);
|
|
20
|
+
};
|
|
21
|
+
request.onsuccess = () => resolve(request.result);
|
|
22
|
+
request.onerror = () => reject(request.error);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async put(manifest) {
|
|
27
|
+
const value = clone(manifest);
|
|
28
|
+
const db = await this.open();
|
|
29
|
+
if (!db) {
|
|
30
|
+
this.memory.set(value.id, value);
|
|
31
|
+
return value.id;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
await new Promise((resolve, reject) => {
|
|
35
|
+
const tx = db.transaction(STORE_NAME, 'readwrite');
|
|
36
|
+
tx.objectStore(STORE_NAME).put(value, value.id);
|
|
37
|
+
tx.oncomplete = resolve;
|
|
38
|
+
tx.onerror = () => reject(tx.error);
|
|
39
|
+
tx.onabort = () => reject(tx.error);
|
|
40
|
+
});
|
|
41
|
+
return value.id;
|
|
42
|
+
} finally {
|
|
43
|
+
db.close();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async list() {
|
|
48
|
+
const db = await this.open();
|
|
49
|
+
if (!db) return [...this.memory.values()].map(clone);
|
|
50
|
+
try {
|
|
51
|
+
return await new Promise((resolve, reject) => {
|
|
52
|
+
const tx = db.transaction(STORE_NAME, 'readonly');
|
|
53
|
+
const request = tx.objectStore(STORE_NAME).getAll();
|
|
54
|
+
request.onsuccess = () => resolve((request.result || []).map(clone));
|
|
55
|
+
request.onerror = () => reject(request.error);
|
|
56
|
+
});
|
|
57
|
+
} finally {
|
|
58
|
+
db.close();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async delete(id) {
|
|
63
|
+
const db = await this.open();
|
|
64
|
+
if (!db) return this.memory.delete(id);
|
|
65
|
+
try {
|
|
66
|
+
await new Promise((resolve, reject) => {
|
|
67
|
+
const tx = db.transaction(STORE_NAME, 'readwrite');
|
|
68
|
+
tx.objectStore(STORE_NAME).delete(id);
|
|
69
|
+
tx.oncomplete = resolve;
|
|
70
|
+
tx.onerror = () => reject(tx.error);
|
|
71
|
+
tx.onabort = () => reject(tx.error);
|
|
72
|
+
});
|
|
73
|
+
return true;
|
|
74
|
+
} finally {
|
|
75
|
+
db.close();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const DB_NAME = 'agentscape-assets';
|
|
2
|
+
const STORE_NAME = 'compiled-glb';
|
|
3
|
+
const DB_VERSION = 1;
|
|
4
|
+
|
|
5
|
+
export class CompiledAssetStore {
|
|
6
|
+
constructor({ indexedDBImpl = globalThis.indexedDB, maxDecodeBytes = 32 * 1024 * 1024 } = {}) {
|
|
7
|
+
this.indexedDB = indexedDBImpl;
|
|
8
|
+
this.memory = new Map();
|
|
9
|
+
this.sources = new Map();
|
|
10
|
+
this.maxDecodeBytes = maxDecodeBytes;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
registerSource(key, { bytes, read }) {
|
|
14
|
+
if (!Number.isSafeInteger(bytes) || bytes < 0 || typeof read !== 'function' || this.sources.has(key)) throw new TypeError('Invalid compiled resource source');
|
|
15
|
+
this.sources.set(key, { bytes, read });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async open() {
|
|
19
|
+
if (!this.indexedDB) return null;
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const request = this.indexedDB.open(DB_NAME, DB_VERSION);
|
|
22
|
+
request.onupgradeneeded = () => {
|
|
23
|
+
const db = request.result;
|
|
24
|
+
if (!db.objectStoreNames.contains(STORE_NAME)) db.createObjectStore(STORE_NAME);
|
|
25
|
+
};
|
|
26
|
+
request.onsuccess = () => resolve(request.result);
|
|
27
|
+
request.onerror = () => reject(request.error);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async put(key, bytes, metadata = {}) {
|
|
32
|
+
const value = { bytes: bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes), metadata, savedAt: new Date().toISOString() };
|
|
33
|
+
const db = await this.open();
|
|
34
|
+
if (!db) { this.memory.set(key, value); return key; }
|
|
35
|
+
await new Promise((resolve, reject) => {
|
|
36
|
+
const tx = db.transaction(STORE_NAME, 'readwrite');
|
|
37
|
+
tx.objectStore(STORE_NAME).put(value, key);
|
|
38
|
+
tx.oncomplete = resolve;
|
|
39
|
+
tx.onerror = () => reject(tx.error);
|
|
40
|
+
});
|
|
41
|
+
db.close();
|
|
42
|
+
return key;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async get(key) {
|
|
46
|
+
const source = this.sources.get(key);
|
|
47
|
+
if (source) {
|
|
48
|
+
if (source.bytes > this.maxDecodeBytes) throw Object.assign(new Error('ASSET_DECODE_BUDGET'), { code: 'ASSET_DECODE_BUDGET' });
|
|
49
|
+
const bytes = new Uint8Array(source.bytes); let offset = 0;
|
|
50
|
+
for await (const chunk of source.read()) {
|
|
51
|
+
if (!(chunk instanceof Uint8Array) || offset + chunk.length > bytes.length) throw new Error('ASSET_RESOURCE_SIZE_MISMATCH');
|
|
52
|
+
bytes.set(chunk, offset); offset += chunk.length;
|
|
53
|
+
}
|
|
54
|
+
if (offset !== bytes.length) throw new Error('ASSET_RESOURCE_SIZE_MISMATCH');
|
|
55
|
+
return { bytes, metadata: { contentAddressed: true } };
|
|
56
|
+
}
|
|
57
|
+
const db = await this.open();
|
|
58
|
+
if (!db) return this.memory.get(key) || null;
|
|
59
|
+
const value = await new Promise((resolve, reject) => {
|
|
60
|
+
const tx = db.transaction(STORE_NAME, 'readonly');
|
|
61
|
+
const request = tx.objectStore(STORE_NAME).get(key);
|
|
62
|
+
request.onsuccess = () => resolve(request.result || null);
|
|
63
|
+
request.onerror = () => reject(request.error);
|
|
64
|
+
});
|
|
65
|
+
db.close();
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async has(key) { return Boolean(await this.get(key)); }
|
|
70
|
+
|
|
71
|
+
async delete(key) {
|
|
72
|
+
if (this.sources.delete(key)) return true;
|
|
73
|
+
const db = await this.open();
|
|
74
|
+
if (!db) return this.memory.delete(key);
|
|
75
|
+
await new Promise((resolve, reject) => {
|
|
76
|
+
const tx = db.transaction(STORE_NAME, 'readwrite');
|
|
77
|
+
tx.objectStore(STORE_NAME).delete(key);
|
|
78
|
+
tx.oncomplete = resolve;
|
|
79
|
+
tx.onerror = () => reject(tx.error);
|
|
80
|
+
});
|
|
81
|
+
db.close();
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { LocalAssetLibraryStore } from './LocalAssetLibraryStore.js';
|
|
2
|
+
|
|
3
|
+
const clone=(value)=>value==null?value:structuredClone(value);
|
|
4
|
+
|
|
5
|
+
export class LocalAssetLibrary {
|
|
6
|
+
constructor({assetRegistry,compiledStore,store=null,now=()=>new Date().toISOString()}={}) {
|
|
7
|
+
this.assetRegistry=assetRegistry;
|
|
8
|
+
if(!this.assetRegistry?.getManifest || !this.assetRegistry?.has) throw new TypeError('LocalAssetLibrary requires AssetRegistry');
|
|
9
|
+
if(!compiledStore || (typeof compiledStore.has!=='function' && typeof compiledStore.get!=='function')) throw new TypeError('LocalAssetLibrary requires CompiledAssetStore');
|
|
10
|
+
this.compiledStore=compiledStore;
|
|
11
|
+
this.store=store || new LocalAssetLibraryStore();
|
|
12
|
+
this.now=now;
|
|
13
|
+
this.entries=new Map();
|
|
14
|
+
this.hydrated=false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async hydrate() {
|
|
18
|
+
if(this.hydrated) return {restored:this.entries.size};
|
|
19
|
+
const entries=await this.store.list();
|
|
20
|
+
this.entries.clear();
|
|
21
|
+
for(const entry of entries) if(entry?.assetId) this.entries.set(entry.assetId,clone(entry));
|
|
22
|
+
this.hydrated=true;
|
|
23
|
+
return {restored:this.entries.size};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async approve(assetId,metadata={}) {
|
|
27
|
+
const manifest=this.assetRegistry.getManifest(assetId);
|
|
28
|
+
if(manifest.source?.kind!=='compiled' || !manifest.source?.key) {
|
|
29
|
+
const error=new Error(`Only compiled assets can enter the persistent local library: ${assetId}`);
|
|
30
|
+
error.code='ASSET_LIBRARY_COMPILED_REQUIRED';
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
const bytesAvailable=typeof this.compiledStore.has==='function'
|
|
34
|
+
? await this.compiledStore.has(manifest.source.key)
|
|
35
|
+
: Boolean(await this.compiledStore.get(manifest.source.key));
|
|
36
|
+
if(!bytesAvailable) {
|
|
37
|
+
const error=new Error(`Compiled GLB bytes are missing for asset: ${assetId}`);
|
|
38
|
+
error.code='ASSET_LIBRARY_BYTES_MISSING';
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
const previous=await this.store.get(assetId);
|
|
42
|
+
const entry={
|
|
43
|
+
assetId,
|
|
44
|
+
status:'approved',
|
|
45
|
+
approvedAt:previous?.approvedAt || this.now(),
|
|
46
|
+
updatedAt:this.now(),
|
|
47
|
+
sourceKey:manifest.source.key,
|
|
48
|
+
label:String(metadata.label || manifest.label || assetId),
|
|
49
|
+
sourceImageArtifactId:metadata.sourceImageArtifactId || previous?.sourceImageArtifactId || null,
|
|
50
|
+
notes:metadata.notes || previous?.notes || null
|
|
51
|
+
};
|
|
52
|
+
await this.store.put(entry);
|
|
53
|
+
this.entries.set(assetId,clone(entry));
|
|
54
|
+
this.hydrated=true;
|
|
55
|
+
return clone(entry);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async get(assetId) {
|
|
59
|
+
if(!this.hydrated) await this.hydrate();
|
|
60
|
+
const entry=this.entries.get(assetId)||null;
|
|
61
|
+
if(!entry || !this.assetRegistry.has(assetId)) return null;
|
|
62
|
+
return clone(entry);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async isApproved(assetId) {
|
|
66
|
+
return (await this.get(assetId))?.status==='approved';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async list() {
|
|
70
|
+
if(!this.hydrated) await this.hydrate();
|
|
71
|
+
return this.listSync();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
listSync() {
|
|
75
|
+
return [...this.entries.values()]
|
|
76
|
+
.filter((entry)=>entry?.status==='approved' && this.assetRegistry.has(entry.assetId))
|
|
77
|
+
.sort((a,b)=>String(b.updatedAt||'').localeCompare(String(a.updatedAt||'')))
|
|
78
|
+
.map(clone);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async remove(assetId) {
|
|
82
|
+
const removed=await this.store.delete(assetId);
|
|
83
|
+
this.entries.delete(assetId);
|
|
84
|
+
return removed;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const DB_NAME='agentscape-asset-library';
|
|
2
|
+
const DB_VERSION=1;
|
|
3
|
+
const STORE_NAME='entries';
|
|
4
|
+
const clone=(value)=>value==null?value:structuredClone(value);
|
|
5
|
+
|
|
6
|
+
export class LocalAssetLibraryStore {
|
|
7
|
+
constructor({indexedDBImpl=globalThis.indexedDB}={}) {
|
|
8
|
+
this.indexedDB=indexedDBImpl;
|
|
9
|
+
this.memory=new Map();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async open() {
|
|
13
|
+
if(!this.indexedDB) return null;
|
|
14
|
+
return new Promise((resolve,reject)=>{
|
|
15
|
+
const request=this.indexedDB.open(DB_NAME,DB_VERSION);
|
|
16
|
+
request.onupgradeneeded=()=>{
|
|
17
|
+
const db=request.result;
|
|
18
|
+
if(!db.objectStoreNames.contains(STORE_NAME)) db.createObjectStore(STORE_NAME);
|
|
19
|
+
};
|
|
20
|
+
request.onsuccess=()=>resolve(request.result);
|
|
21
|
+
request.onerror=()=>reject(request.error);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async put(entry) {
|
|
26
|
+
const value=clone(entry);
|
|
27
|
+
const db=await this.open();
|
|
28
|
+
if(!db) { this.memory.set(value.assetId,value); return value.assetId; }
|
|
29
|
+
try {
|
|
30
|
+
await new Promise((resolve,reject)=>{
|
|
31
|
+
const tx=db.transaction(STORE_NAME,'readwrite');
|
|
32
|
+
tx.objectStore(STORE_NAME).put(value,value.assetId);
|
|
33
|
+
tx.oncomplete=resolve;
|
|
34
|
+
tx.onerror=()=>reject(tx.error);
|
|
35
|
+
tx.onabort=()=>reject(tx.error);
|
|
36
|
+
});
|
|
37
|
+
return value.assetId;
|
|
38
|
+
} finally { db.close(); }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async get(assetId) {
|
|
42
|
+
const db=await this.open();
|
|
43
|
+
if(!db) return clone(this.memory.get(assetId)||null);
|
|
44
|
+
try {
|
|
45
|
+
return await new Promise((resolve,reject)=>{
|
|
46
|
+
const tx=db.transaction(STORE_NAME,'readonly');
|
|
47
|
+
const request=tx.objectStore(STORE_NAME).get(assetId);
|
|
48
|
+
request.onsuccess=()=>resolve(clone(request.result||null));
|
|
49
|
+
request.onerror=()=>reject(request.error);
|
|
50
|
+
});
|
|
51
|
+
} finally { db.close(); }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async list() {
|
|
55
|
+
const db=await this.open();
|
|
56
|
+
if(!db) return [...this.memory.values()].map(clone);
|
|
57
|
+
try {
|
|
58
|
+
return await new Promise((resolve,reject)=>{
|
|
59
|
+
const tx=db.transaction(STORE_NAME,'readonly');
|
|
60
|
+
const request=tx.objectStore(STORE_NAME).getAll();
|
|
61
|
+
request.onsuccess=()=>resolve((request.result||[]).map(clone));
|
|
62
|
+
request.onerror=()=>reject(request.error);
|
|
63
|
+
});
|
|
64
|
+
} finally { db.close(); }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async delete(assetId) {
|
|
68
|
+
const db=await this.open();
|
|
69
|
+
if(!db) return this.memory.delete(assetId);
|
|
70
|
+
try {
|
|
71
|
+
await new Promise((resolve,reject)=>{
|
|
72
|
+
const tx=db.transaction(STORE_NAME,'readwrite');
|
|
73
|
+
tx.objectStore(STORE_NAME).delete(assetId);
|
|
74
|
+
tx.oncomplete=resolve;
|
|
75
|
+
tx.onerror=()=>reject(tx.error);
|
|
76
|
+
tx.onabort=()=>reject(tx.error);
|
|
77
|
+
});
|
|
78
|
+
return true;
|
|
79
|
+
} finally { db.close(); }
|
|
80
|
+
}
|
|
81
|
+
}
|