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,116 @@
|
|
|
1
|
+
# 程序化资产与可信世界恢复 v0.3
|
|
2
|
+
|
|
3
|
+
在现有 `agentscape-world` 中完成:Three.js 源码 → Linux 容器隔离构建 → GLB / 显式 Manifest → AssetModule → WorldCommands → WorldRuntime → 文件保存与恢复。没有第二个 MCP,也没有复制 Three.js 编辑器、物理、导航或场景序列化系统。
|
|
4
|
+
|
|
5
|
+
## 准备隔离环境
|
|
6
|
+
|
|
7
|
+
PC2 使用 Docker Desktop 的 Linux 引擎。先启动 Docker Desktop,准备官方基础镜像,然后构建固定运行镜像:
|
|
8
|
+
|
|
9
|
+
```powershell
|
|
10
|
+
docker pull node:24-alpine
|
|
11
|
+
node dev/build-programmatic-sandbox.mjs
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
构建脚本将基础镜像解析为不可变 RepoDigest。上下文是临时目录,只复制固定 QuickJS 依赖、受信任构建入口及由本项目固定 Three.js 生成的 bundle,不包含仓库、私有配置或凭据。镜像生成后把不可变 image ID 和代码 digest 保存到数据目录的 `sandbox.json`。运行期间禁止自动拉取镜像;镜像缺失、引擎不可达、Linux 不可用、镜像标签或代码 digest 不匹配时返回 `SANDBOX_UNAVAILABLE`,无进程内回退。
|
|
15
|
+
|
|
16
|
+
每次构建通过 stdin 输入,容器采用:`network=none`、只读根文件系统、UID/GID 65534、cap-drop ALL、no-new-privileges、1 CPU、256MiB 内存及相同 swap 上限、64 PID、受限 /tmp tmpfs、无宿主挂载和 Docker socket。创建后读取实际 Docker inspect 并核对这些配置,再启动构建。代码还在容器内部的 QuickJS WASM 中执行,不注入 Node、文件、网络、模块加载或环境变量接口。
|
|
17
|
+
|
|
18
|
+
默认源码执行1500ms、QuickJS分配96MiB、整个容器运行15秒。超时、输出超过4MiB或取消时杀死附着进程并强制删除容器;无法确认清理会报告 `SANDBOX_CLEANUP_FAILED`。不把正则或普通 Worker 当成 OS 隔离。
|
|
19
|
+
|
|
20
|
+
源码/运行入口更新后重新执行镜像构建脚本。容器镜像是隔离构建依赖,不是常驻服务。Docker 未运行时,原有观察和内置世界操作仍可用,所有远程源码构建明确失败关闭。
|
|
21
|
+
|
|
22
|
+
## 输入与工具
|
|
23
|
+
|
|
24
|
+
`asset_build_submit` 接收:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"contract":"agentscape.procedural-asset.v1",
|
|
29
|
+
"source":"export function createAsset(THREE) { /* 返回 Group 或 Mesh */ }",
|
|
30
|
+
"definition":{"id":"box","type":"box","label":"箱子","actions":["move"],"physics":{"body":"fixed","colliders":[{"shape":"box","halfExtents":[0.5,0.5,0.5],"translation":[0,0.5,0]}]}},
|
|
31
|
+
"requestId":"<UUID>"
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
源码必须同步返回有效 Object3D,根变换为单位变换。支持 Mesh/Group、基础 BufferGeometry、Basic/Standard/Physical 材质与有界 RGBA DataTexture。动态脚本、事件/渲染回调、Shader、模型 URL、第三方依赖、灯光相机及蒙皮明确拒绝。源码最多32768字节,Manifest最多24576字符;原有 HTTP 64KiB 总请求限制仍然生效。
|
|
36
|
+
|
|
37
|
+
Manifest 使用既有 `validateAssetManifest()` 格式,另加远程接口字段与资源预算。输入的 `id` 是逻辑名称;`source`、最终不可变 ID、compiler、provenance 和 verification 由服务端生成,不接受客户端自证成功。声明 requiredNodes、surfaces、receptacles、physics、parts/joint/targets 和可选 interactionContract。必需节点必须唯一存在。关节不能仅靠节点命名推断为可交互。
|
|
38
|
+
|
|
39
|
+
| 新增工具 | 用法 |
|
|
40
|
+
|---|---|
|
|
41
|
+
| asset_build_submit | 提交并返回 Build ID;相同 requestId 参数冲突会拒绝 |
|
|
42
|
+
| asset_build_status | 查询 running / succeeded / failed / cancelled / interrupted,以及诊断、资产版本和准入 |
|
|
43
|
+
| asset_build_cancel | 取消自己的任务并终止构建容器 |
|
|
44
|
+
| asset_publish | 发布成功构建;非 ready 默认拒绝,provisional 必须显式选择编辑态 |
|
|
45
|
+
| asset_inspect | 查看自己的源码(可选)、Manifest、哈希和运行验证 |
|
|
46
|
+
| asset_list | 分页查询自己的已发布版本 |
|
|
47
|
+
| world_save | 保存当前会话,返回服务端 saveId |
|
|
48
|
+
| world_restore | 用自己的 saveId 和新 requestId 创建恢复会话,不接受磁盘路径 |
|
|
49
|
+
|
|
50
|
+
原16工具保留,共24工具。`action_execute` 原六种动作保留,新增 `replaceAsset`;`spawnAsset` 仅允许内置资产、当前会话创作资产,或当前身份已发布的资产。新发布资产在使用时注册到现有会话;新会话和恢复会话按需加载,不把整个资产库复制为另一份世界状态。
|
|
51
|
+
|
|
52
|
+
provisional 发布用于保留和审查,不提升准入。当前发布资产的 `spawnAsset` / `replaceAsset` 要求 ready;草稿编辑态继续使用原 authoring 接口。
|
|
53
|
+
|
|
54
|
+
构建不占用某个世界的互斥锁;最多4个并行构建,每身份最多2个。客户端应查询状态而非阻塞一个长 HTTP 请求。同一身份、相同内容的并发普通构建共用任务;不同 requestId 可复用已存在版本。`forceRebuild=true` 强制重建并校验相同版本产物;不一致返回 `BUILD_NONDETERMINISTIC`,保留旧产物。
|
|
55
|
+
|
|
56
|
+
## 实际调用顺序
|
|
57
|
+
|
|
58
|
+
真实示例位于 `apps/mcp-server/examples/procedural-assets.js`,包含箱子、带 top 支撑面的桌子、可开关门的冰箱。
|
|
59
|
+
|
|
60
|
+
1. 使用示例 source/definition 调用 `asset_build_submit`,轮询状态。
|
|
61
|
+
2. 成功后调用 `asset_publish`,取得 `pa_<SHA256>` Asset ID。
|
|
62
|
+
3. 创建会话;通过 `action_execute(skill="spawnAsset",args={assetId,instanceId,position})` 加入世界。
|
|
63
|
+
4. 通过原 navigate / approachAndPickup / approachAndPlace / approachAndInteract 操作。
|
|
64
|
+
5. 通过参数化 `world_verify.criteria` 检查目标实体与物理关系。
|
|
65
|
+
6. `world_save` 保存;服务重启后 `world_restore` 恢复为新的私有会话。
|
|
66
|
+
|
|
67
|
+
资产采用既有 GLB 导出与 AssetCompiler。显式定义替换推断碰撞与语义,仍经过几何、资源预算、Schema 和加载验证。物理注册和关节开/关目标在既有隔离 Rapier 验证器执行,证据写回 Manifest;构建成功、资产准入与世界动作完成依然是三个独立事实。
|
|
68
|
+
|
|
69
|
+
## 不可变版本与升级
|
|
70
|
+
|
|
71
|
+
版本取决于原始源码、规范化 Manifest 和构建环境,包括固定容器 image/digest、Three.js版本、编译/验证源码和依赖锁文件的 digest。逻辑 id 可以相同,版本修改后生成新 Asset ID。不会覆盖 GLB,也不会自动升级世界中的旧实例。
|
|
72
|
+
|
|
73
|
+
显式执行 `action_execute(skill="replaceAsset",args={id,assetId})` 升级实体。保留实例 ID、位置、旋转与缩放,重置交互状态;不支持直接升级 Agent embodiment,不允许替换正在持有的对象。通过 WorldCommands 事务执行,新资产放置或导航检查失败则恢复原实体和物理体。物理形状完全相同的非关节资产保留已有接触,不因求解器接触容差误拒绝纯材质升级。
|
|
74
|
+
|
|
75
|
+
## 持久化与生命周期
|
|
76
|
+
|
|
77
|
+
默认目录 `D:\AgentScapeData\mcp-assets`;CLI 可设置 `AGENTSCAPE_MCP_DATA_ROOT`。测试与其他设备应显式使用独立 dataRoot。单个数据目录由一个 MCP 写入实例管理,不支持多进程共享写入。
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
mcp-assets/
|
|
81
|
+
sandbox.json
|
|
82
|
+
owners/<身份SHA256>/
|
|
83
|
+
assets/pa_<版本>/
|
|
84
|
+
source.js
|
|
85
|
+
asset.glb
|
|
86
|
+
manifest.json
|
|
87
|
+
build.json
|
|
88
|
+
published.json
|
|
89
|
+
builds/<Build-ID>
|
|
90
|
+
requests/<requestId>
|
|
91
|
+
worlds/<saveId>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
资产临时目录写完并复核后原子发布,发布标识与已完成构建分离;不同内容不得覆盖同一版本。读取和恢复时复核源码、定义、GLB 和 Manifest 哈希、身份、格式与当前支持的 Three.js版本。不会执行保存文件中的源码。快照通过现有 SceneSerializer 恢复,资产依赖必须能解析;导入失败关闭新会话,不破坏其他世界。历史交互验收记录不作为恢复后的新动作证据,恢复后重新运行验收或动作。
|
|
95
|
+
|
|
96
|
+
内存世界关闭或TTL到期会释放;已保存资产和世界不会随会话删除。进程退出时构建任务取消;异常退出后遗留 running 记录变为 interrupted,不自动执行旧源码。默认保留所有已发布版本和世界存档,旧版本由快照依赖明确引用,不自动垃圾回收,避免删除仍被存档使用的版本。
|
|
97
|
+
|
|
98
|
+
首版每身份最多128个资产目录、1024个任务、128个存档;配额到达返回明确错误。未发布构建也保留用于审查,占用资产配额。尚未提供在线删除/自动GC接口;维护时应停服备份,再核对所有存档依赖后处理未发布或无引用数据。不能只按创建时间清除旧版本,也不应把数据目录提交到 Git。
|
|
99
|
+
|
|
100
|
+
## 验证
|
|
101
|
+
|
|
102
|
+
```powershell
|
|
103
|
+
# 普通回归;真实 Docker 测试明确标为需环境的集成测试
|
|
104
|
+
npm run test:mcp
|
|
105
|
+
|
|
106
|
+
# PC2 已执行:包含真实隔离容器、安全、物理与服务器重新创建的恢复验收
|
|
107
|
+
$env:AGENTSCAPE_SANDBOX_INTEGRATION='1'
|
|
108
|
+
npm run check
|
|
109
|
+
git diff --check
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
安全测试覆盖宿主 API、环境变量、网络、非法模块、循环、内存与几何超量、非法 Manifest、取消和容器清理。恢复测试重新建立整个 HTTP Server/SessionManager,再读取磁盘资产和场景;PC2 另通过 AgentDock 验证实际部署。没有进行宿主断电、Docker内核漏洞或多进程并发存储验收。
|
|
113
|
+
|
|
114
|
+
本版不实现任意 npm、持久运行的 JS、自定义 Shader 无损迁移、Studio 当前世界实时控制、任意远程资产 URL、自动推断任意可靠关节。接入级别 Visual / Physical / Interactive 与统一 Scene API 属于下一轮接口精简,本分支保留现有引擎系统边界。
|
|
115
|
+
|
|
116
|
+
Docker 参数依据:[官方容器运行文档](https://docs.docker.com/reference/cli/docker/container/run/)。
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { parseDefinition, canonical } from '../../application/programmatic-assets/ProgrammaticAssetContract.js';
|
|
3
|
+
import { assetVersion, hash } from './FileAssetRepository.js';
|
|
4
|
+
|
|
5
|
+
export class ProgrammaticAssets {
|
|
6
|
+
constructor({repository,builder,runner}) {Object.assign(this,{repository,builder,runner});this.running=new Map();this.locks=new Map();this.closed=false;}
|
|
7
|
+
async exclusive(owner,fn) {const previous=this.locks.get(owner)||Promise.resolve();const next=previous.catch(()=>{}).then(fn);this.locks.set(owner,next);try{return await next;}finally{if(this.locks.get(owner)===next)this.locks.delete(owner);}}
|
|
8
|
+
summary(job) {return {buildId:job.buildId,status:job.status,assetId:job.assetId,execution:job.execution || {status:job.status==='running'?'running':'unknown'},admission:job.admission,verification:job.verification || {status:'not-requested'},error:job.error,...(job.diagnostics?{diagnostics:job.diagnostics}:{})};}
|
|
9
|
+
async submit(owner,{source,definition,requestId,forceRebuild=false}) {
|
|
10
|
+
if(this.closed)throw new Error('ASSET_SERVICE_CLOSED');
|
|
11
|
+
if(typeof source!=='string'||!source.trim()||Buffer.byteLength(source)>32768)throw new Error('BUILD_SOURCE_LIMIT');
|
|
12
|
+
definition=definition == null ? null : parseDefinition(definition);
|
|
13
|
+
const environment=await this.runner.environment();
|
|
14
|
+
const version=assetVersion(source,definition,environment),assetId=`pa_${version}`;
|
|
15
|
+
return this.exclusive(owner,async()=>{
|
|
16
|
+
if(this.closed)throw new Error('ASSET_SERVICE_CLOSED');
|
|
17
|
+
const requestFile=this.repository.target(owner,'requests',requestId),fingerprint=hash(canonical({source,definition,environment,forceRebuild}));
|
|
18
|
+
try{const existing=await this.repository.json(requestFile);if(existing.fingerprint!==fingerprint)throw new Error('IDEMPOTENCY_CONFLICT');return this.status(owner,existing.buildId);}catch(e){if(e.code!=='ENOENT')throw e;}
|
|
19
|
+
if(!forceRebuild){
|
|
20
|
+
const matching=[...this.running.entries()].find(([,entry])=>entry.owner===owner&&entry.assetId===assetId);
|
|
21
|
+
if(matching){await this.repository.atomic(requestFile,{fingerprint,buildId:matching[0]});return this.status(owner,matching[0]);}
|
|
22
|
+
}
|
|
23
|
+
if(this.running.size>=4||[...this.running.values()].filter(j=>j.owner===owner).length>=2)throw new Error('BUILD_LIMIT');
|
|
24
|
+
if((await this.repository.ids(owner,'builds')).length>=1024)throw new Error('BUILD_STORAGE_QUOTA');
|
|
25
|
+
const job={buildId:randomUUID(),owner:hash(owner),status:'running',assetId};
|
|
26
|
+
if(!forceRebuild){try{const existing=await this.repository.get(owner,assetId);job.status='succeeded';job.admission=existing.build.admission;job.execution={status:'succeeded'};job.verification=existing.build.validation?.runtime;}catch(e){if(e.code!=='ENOENT')throw e;}}
|
|
27
|
+
const jobFile=this.repository.target(owner,'builds',job.buildId);
|
|
28
|
+
await this.repository.atomic(jobFile,job);await this.repository.atomic(requestFile,{fingerprint,buildId:job.buildId});
|
|
29
|
+
if(job.status==='running'){
|
|
30
|
+
const controller=new AbortController();const entry={owner,assetId,controller,promise:null};this.running.set(job.buildId,entry);
|
|
31
|
+
entry.promise=(async()=>{
|
|
32
|
+
try{
|
|
33
|
+
const built=await this.builder.build({source,definition,assetId},{signal:controller.signal});
|
|
34
|
+
if(controller.signal.aborted)throw new Error('BUILD_CANCELLED');
|
|
35
|
+
if(canonical(built.environment)!==canonical(environment))throw new Error('BUILD_ENVIRONMENT_CHANGED');
|
|
36
|
+
const stored=await this.repository.save(owner,{source,definition,environment,...built});
|
|
37
|
+
job.status='succeeded';job.admission=stored.build.admission;job.execution={status:'succeeded'};job.verification=stored.build.validation.runtime;
|
|
38
|
+
}catch(error){job.status=controller.signal.aborted?'cancelled':'failed';job.execution=error.execution || {status:job.status};job.error=/^[A-Z_]+$/.test(error.message)?error.message:'BUILD_FAILED';if(error.details&&JSON.stringify(error.details).length<=65536)job.diagnostics=error.details;}
|
|
39
|
+
finally{await this.repository.atomic(jobFile,job);this.running.delete(job.buildId);}
|
|
40
|
+
})();
|
|
41
|
+
entry.promise.catch(()=>{});
|
|
42
|
+
}
|
|
43
|
+
return this.summary(job);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async status(owner,buildId) {
|
|
47
|
+
let job;try{job=await this.repository.json(this.repository.target(owner,'builds',buildId));}catch(e){if(e.code==='ENOENT')throw new Error('BUILD_NOT_FOUND');throw e;}if(job.owner!==hash(owner))throw new Error('BUILD_NOT_FOUND');
|
|
48
|
+
if(job.status==='running'&&!this.running.has(buildId)){job.status='interrupted';job.error='BUILD_INTERRUPTED';await this.repository.atomic(this.repository.target(owner,'builds',buildId),job);}
|
|
49
|
+
return this.summary(job);
|
|
50
|
+
}
|
|
51
|
+
async cancel(owner,buildId) {await this.status(owner,buildId);const entry=this.running.get(buildId);if(entry){entry.controller.abort();await entry.promise;}return this.status(owner,buildId);}
|
|
52
|
+
async publish(owner,buildId,allowProvisional=false) {
|
|
53
|
+
const job=await this.status(owner,buildId);if(job.status!=='succeeded')throw new Error('BUILD_NOT_SUCCEEDED');
|
|
54
|
+
const asset=await this.repository.get(owner,job.assetId);
|
|
55
|
+
if(asset.build.admission.status==='rejected'||(asset.build.admission.status!=='ready'&&!allowProvisional))throw new Error('ASSET_NOT_READY');
|
|
56
|
+
await this.repository.publish(owner,job.assetId);return {assetId:job.assetId,version:asset.build.version,admission:asset.build.admission,published:true};
|
|
57
|
+
}
|
|
58
|
+
async inspect(owner,assetId,includeSource=false) {const a=await this.repository.get(owner,assetId);return {assetId,published:a.published,manifest:a.manifest,build:a.build,...(includeSource?{source:a.source}:{})};}
|
|
59
|
+
async close() {this.closed=true;for(const entry of this.running.values())entry.controller.abort();await Promise.allSettled([...this.running.values()].map(j=>j.promise));this.runner.close();}
|
|
60
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# AgentScape Remote MCP v0.3
|
|
2
|
+
|
|
3
|
+
自由代码项目可通过同一 Scene 工具发现并调用 `action:'custom'`、任意项目动作名和 JSON 参数;无验证器也允许执行,证据单列为未验证。现已新增统一 `action:'invoke'`:先 `scene_observe({target})` 读取 `capabilities`,再用 `scene_interact({interaction:{action:'invoke',target,name,actor?,partName?,args?}})` 调用已声明的资产关节、环境或代码项目动作。物理动作仍要求真实 Agent 和关节完成验证;保存重开不继承历史验证结果。代码、Shader、持续逻辑和作品迁移见 [Code Project](../../docs/modules/code-project.md),示例入口 `/examples/code-project/`。源码由本地项目入口显式运行,MCP 不自动执行远端源码。`scene_capture(operation=capture, expectedRevision=...)` 可以只读获取正在运行项目的真实 JPEG 帧,并返回项目/Scene 修订号;只有当前源码修订正在运行且 Canvas 可读取时才允许,截图本身不做审美评价。Canvas 正在初始化时会短暂等待(最多约 2 秒);若仍不可用则返回 `VISUAL_CANVAS_NOT_READY`,请针对同一运行修订重试。拒绝短边小于 32 像素的无效视觉证据。`studio_project(read)` 读取本地项目列表和已有共享列表缓存,不依赖共享仓库实时访问。`studio_files` 的 `preview_batch` 可对最多 32 项文件/资源操作预览差异但不发布;`apply_batch` 使用 `previewId` 和 `expectedRevision` 原子持久化,`discard_batch` 放弃预览,`undo_batch` 在无后续编辑时撤销最近一批;预览仅在当前 Studio 会话内有效。
|
|
4
|
+
|
|
5
|
+
新增容器隔离的程序化资产构建/发布、不可变版本与文件存储、可信世界保存恢复。原有 33 个工具继续兼容;新增 4 个 Studio Live Bridge 配对/会话工具,使用同一个 `agentscape-world` 连接。契约、示例、隔离设施和保存边界见 [PROGRAMMATIC-ASSETS.md](./PROGRAMMATIC-ASSETS.md)。
|
|
6
|
+
|
|
7
|
+
新增 scene_object_definition:将 AI 声明与真实 Three.js 节点结构分析结合,并通过 inspect/preview/apply/fork 对单实例进行版本化定点修正。详见 docs/modules/object-forge-refinement.md。当前 MCP 共 43 个工具。
|
|
8
|
+
|
|
9
|
+
Scene 工具为 `scene_thermal`(Asset Forge 材料实验查询、热功率和真实时步)、`scene_observe`、`scene_apply`、`scene_add_model`、`scene_interact`、`scene_job`、`scene_cancel`、`scene_verify`、`scene_save`、`scene_import`、`scene_object_definition`、`scene_set_style`。它们使用与 SDK/Studio 相同的 Scene 应用服务和 Runtime。`scene_interact` 立即返回 JobRef,由宿主推进模拟,调用方轮询任务并分别检查执行状态与验证证据。Recipe 可以直接作为 scene_add_model 的 model.asset 输入,无需生成 JavaScript。
|
|
10
|
+
|
|
11
|
+
**视觉布局验收(不等于物理验收)**:`scene_verify` 支持独立的 `visual-layout` criterion。用于静态展示、科学示意图和机械外观装配中有意相交或悬浮的 visual-only 资产。原始 WorldValidator 诊断完整保留,物理验收 `world-valid` 不变。
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
scene_verify({
|
|
15
|
+
worldSessionId: "...",
|
|
16
|
+
criteria: [{
|
|
17
|
+
id: "cart-layout",
|
|
18
|
+
kind: "visual-layout",
|
|
19
|
+
expectedOverlaps: [
|
|
20
|
+
{ object: "wheel", other: "axle", reason: "Wheel hub mounted on axle" }
|
|
21
|
+
],
|
|
22
|
+
expectedFloating: []
|
|
23
|
+
}]
|
|
24
|
+
})
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
每类声明最多 64 项,须包含对象 ID 和明确理由;重复、未知、未命中、非 visual 资产或已存在物理记录的声明均不允许通过。未声明的硬问题及警告仍使该 criterion 失败。返回的 `scope: "visual-layout-only"`、`validation`、`acknowledged` 与 `unexpectedHard/Advisory` 分开记录。这里仅承认有意的包围盒诊断,不能证明真实接触、关节连接或力学可行性。声明是当次验收参数,不修改世界结构、物理碰撞或保存格式;回导后需要重新传入并核验。该 criterion 已通过私有离线 Scene 的真实 MCP 往返测试;并非 WorldIR 的新物理编译约束,未承诺所有代码项目桥接模式都支持。
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
外部 GLB 可通过 `scene_add_model` 的 `mode: "prepare"` 生成能力候选(包含 `kinematics.hypotheses`);若希望在不注册资产的情况下做隔离 Rapier 机械测试,可再次调用相同工具并设置 `mode: "screen"`、`model: {asset: 相同的 GLB source, proposalId: 上轮提案 ID, hypothesisIds?: 候选 ID[]}`。筛选逐方向返回 `trials` 和碰撞、稳定性报告,**即便机械测试通过也不会授权语义动作**。最后才使用默认 `mode: "add"`,附明确审核参数进行正式编译、物理验证和注册;配套 URDF 仍复用既有 Compiler Provider。接口、证据边界、Studio 审核入口和传输配额见 [资产交互化流程](../../docs/asset-interaction-pipeline.md)。
|
|
31
|
+
|
|
32
|
+
`scene_observe({ worldSessionId, target, actor? })` 等价于 SDK 的 `scene.inspect(target, { actor })`,返回资产或环境契约的统一能力说明。省略 target 时,场景观察的 `affordances` 包含这些对象的能力列表(最多 100 项,total 为总数)。能力在每次查询时读取当前状态,不额外保存对象状态。
|
|
33
|
+
|
|
34
|
+
每项动作包含 `parameters`、`execution`、`available` 和不可用时的 `reason`。未提供 actor 时,具身动作的 available 为 null,表示未检查可达性;提供后复用当前距离、遮挡及持有能力检查。available 只描述当前检查结果,不能替代执行后的碰撞、放置空间或关节完成验证。
|
|
35
|
+
|
|
36
|
+
`execution: interaction` 的动作统一调用 `scene_interact`;`world-action` 的环境契约现也可通过同一个 `scene_interact` 调用(open/close、turn_on/turn_off、pull_out/return、write),交由 Runtime 的 `WorldCommands.executeAffordance` 执行并核对后置状态。`editor` 使用 `scene_apply`,不代表 Agent 施力。环境契约的 `evidenceKind` 和 `physicsVerified=false` 不得冒充真实物理力学验证。Studio 的同一交互入口与验收边界参见 [统一交互](../../docs/studio-unified-interactions.md)。
|
|
37
|
+
|
|
38
|
+
通用物理操作不要求 Manifest 声明专用动作:动态刚体可发现 push/drag/rotate,真实滑动/旋转关节可发现 slide/rotateJoint。固定、持有、忙碌或缺少物理解算能力的对象会返回具体阻塞原因。物理元数据的 body 为资产声明,currentBody 为查询时的实际刚体类型。
|
|
39
|
+
|
|
40
|
+
| action | args | 执行和验证 |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| push / drag | direction: 非零水平向量;distance: (0, 5] 米;maxForce?: (0, 1000] 牛,默认 100 | 从实际包围盒计算接触代理位置,通过 applyForce 驱动;验证位移、偏移和静止状态 |
|
|
43
|
+
| rotate | axis: 非零世界轴;angle: [-π, π] 弧度且非零;maxTorque?: (0, 1000] 牛米,默认 100 | applyTorque 驱动;验证真实姿态、轴向偏移与角速度 |
|
|
44
|
+
| slide / rotateJoint | part: 部件名;target: 绝对关节坐标,或 distance / angle: 相对变化量(二选一) | 仅驱动真实物理关节,检查限位并复用现有关节稳定、停滞与超时验证 |
|
|
45
|
+
|
|
46
|
+
例如 `scene_interact({ worldSessionId, requestId, interaction: { actor: "agent_01", target: "new_box", action: "push", args: { direction: [1, 0, 0], distance: 1 } } })` 返回 JobRef,随后使用 scene_job 查询结果。成功必须同时有终态 succeeded 和 verification.status=verified。实际证据区分 rigid-body-force、rigid-body-torque 和 joint-motor。
|
|
47
|
+
|
|
48
|
+
这些操作使用现有 1.5 米交互半径内的接触代理,推/拖会选择相应方向的可达站位;执行中持续复核距离、遮挡、持有状态和碰撞。它不是手指抓取,graspVerified 不会被标为 true。遇阻、偏移、超时或取消时保留真实的部分运动,报告未验证;不修改物体坐标来完成目标。箱子推动一米、不同质量、墙体阻挡、椅子拖动、轮子扭矩、滑动/旋转关节及取消均有 Runtime 验收,推动一米还覆盖真实 HTTP MCP 客户端。
|
|
49
|
+
|
|
50
|
+
保存和历史快照从 PhysicsSystem 读取部件的实际姿态及电机目标;恢复时按快照恢复,不另建关节状态缓存。实时物理操作与快照恢复路径分开。
|
|
51
|
+
|
|
52
|
+
注意:Headless MCP 没有渲染画布。调用 `scene_set_style` 成功后,返回的 `status=deferred`、`rendered=false`、`applied=null` 表示 StylePack 已记录到场景配置,**不表示实际画面已经切换或视觉渲染通过验收**。请在 Studio 或带图形渲染器的 SDK 客户端另行验证视觉效果;不要把无渲染器时的 deferred 状态误报为已应用。
|
|
53
|
+
|
|
54
|
+
`scene_import` 接受此前 `scene_save` 导出的完整 `bundle`,在当前私有世界或已连接 Studio 中导入,复用 Scene 的隔离校验、资源哈希和失败回滚;内联场景包受 8 MiB 配额约束,完整 MCP 消息受 10 MiB 上限约束。仅导入世界资产与状态,不恢复历史动作已验证证据。`world_save/world_restore` 仍只接受内置资产与同身份已发布的不可变资产;临时 `scene_add_model` 编译资产须使用 `scene_save/scene_import` 完成跨会话恢复。
|
|
55
|
+
|
|
56
|
+
`scene_save` 返回有资源字节和锁定哈希的完整项目包,仍受服务端导出配额限制。旧 world_export 的 JSON-only 语义保留。新版资产引用 `asset://sha256/<版本摘要>` 可以引用同一身份已发布的 pa_ 资产;未发布或其他身份的资产不能借此接入世界。
|
|
57
|
+
|
|
58
|
+
v0.2 的七个草稿接口和参数化 `world_verify` 保留;远程源码执行现已要求同一受限容器,不再仅依赖 Worker/WASM。原草稿工作流见 [AUTHORING.md](./AUTHORING.md)。
|
|
59
|
+
|
|
60
|
+
独立 Node.js 进程,为外部 Agent 提供可观察、可执行、可验证的私有 3D 世界。无需内部 LLM,不调用在线生成。SDK 固定为官方 MCP v2 2.4.0。
|
|
61
|
+
|
|
62
|
+
```mermaid
|
|
63
|
+
flowchart TD
|
|
64
|
+
Client[ChatGPT / Claude / Codex / OpenCode] --> HTTP[MCP Streamable HTTP + Bearer 鉴权]
|
|
65
|
+
HTTP --> Sessions[SessionManager: 身份、TTL、互斥、幂等]
|
|
66
|
+
Sessions --> Host[HeadlessWorldHost: 正式 createSession、固定时步]
|
|
67
|
+
Host --> Tools[AgentTools / SkillRegistry / Policy]
|
|
68
|
+
Tools --> Commands[WorldCommands / Runtime mutation 与 History]
|
|
69
|
+
Commands --> Runtime[WorldRuntime / Physics / Navigation / Interaction]
|
|
70
|
+
Host --> Queries[WorldQueries / WorldObservation / Acceptance]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 多 Studio 世界的安全选择
|
|
74
|
+
|
|
75
|
+
通过 MCP 调用 `studio_sessions_list({})`,读取当前身份能够访问的在线世界
|
|
76
|
+
`{worlds:[{worldSessionId,worldId,mode,status,connected}]}`。返回值不包含浏览器令牌,
|
|
77
|
+
也不会自动认领尚未绑定身份的 Studio 标签页。请使用返回的
|
|
78
|
+
`worldSessionId` 调用 `session_attach`、`scene_observe`、`scene_apply`
|
|
79
|
+
等工具;在同一浏览器开多个世界时,未指定 ID 的自动寻址会拒绝
|
|
80
|
+
`STUDIO_MULTIPLE_WORLDS`,而不是猜测目标。只有一个自动世界时保持原有自动连接。
|
|
81
|
+
已失联的会话在枚举时剔除;旧 ID 不可复用,重新连接需要重新列举。
|
|
82
|
+
|
|
83
|
+
## Windows 启动
|
|
84
|
+
|
|
85
|
+
在独立检出目录执行。Node.js 20+,本次使用本机 Node.js;安装依赖不会加载 Studio 私有配置。
|
|
86
|
+
|
|
87
|
+
```powershell
|
|
88
|
+
cd D:\a_programming_list\A-Python-Project\wk08\AgentScape
|
|
89
|
+
npm ci
|
|
90
|
+
$credential = [Convert]::ToHexString([Security.Cryptography.RandomNumberGenerator]::GetBytes(32))
|
|
91
|
+
$env:AGENTSCAPE_MCP_TOKENS = ConvertTo-Json -Compress -AsArray @{ identity = 'my-agent'; token = $credential }
|
|
92
|
+
npm run mcp:serve
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
客户端请求头配置 `Authorization: Bearer <credential>`,URL 为 `http://127.0.0.1:39015/mcp`。凭据需通过私有配置安全交给客户端。服务不打印凭据。环境变量包含 JSON 数组,可为不同客户端配置不同 identity/token。相同 identity 代表同一访问主体,能够共享该主体创建的世界。不要复用 Studio 或模型 API 密钥。
|
|
96
|
+
|
|
97
|
+
只监听 127.0.0.1,端口冲突直接失败。Ctrl+C 关闭全部世界。默认快照写入当前检出的 `.mcp-sessions/<worldSessionId>/`,不会加载 Studio 存档。工作目录必须是独立检出。
|
|
98
|
+
|
|
99
|
+
## 工具接口
|
|
100
|
+
|
|
101
|
+
| 工具 | 参数 | 结果 |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| session_create | template: monument-hall(默认) | worldSessionId、tick、状态;预置 agent_01 / cabinet_01 / cup_01 / table_01,杯子位于柜内 |
|
|
104
|
+
| session_status | worldSessionId | 世界与执行状态、闲置到期时间 |
|
|
105
|
+
| session_close | worldSessionId | 取消执行并释放 Runtime |
|
|
106
|
+
| agent_hear | worldSessionId | 当前角色 agent_01 的活跃声音、方向、距离、遮挡及可听度 |
|
|
107
|
+
| world_observe | worldSessionId、offset=0、limit=25(最多50) | 有界对象、Agent、空间关系和分页游标 |
|
|
108
|
+
| object_inspect | worldSessionId、id | 对象与关节、空间证据 |
|
|
109
|
+
| skills_list | worldSessionId | 六个审核动作及各自 JSON Schema |
|
|
110
|
+
| action_execute | worldSessionId、skill、args、requestId(UUID) | state、真实 Runtime result、steps、tick |
|
|
111
|
+
| world_verify | worldSessionId | verified/unverified、逐项验收证据、持物状态 |
|
|
112
|
+
| world_export | worldSessionId | fileName、bytes、snapshot、scope=scene-json-only |
|
|
113
|
+
|
|
114
|
+
### Studio 实时世界的轻量观察与批量编辑
|
|
115
|
+
|
|
116
|
+
Studio 已自动连接时,`scene_observe` 可不传 `worldSessionId`(仅允许一个自动连接的本地世界)。默认返回完整对象、交互能力及空间关系;传入 `target` 则检查单个对象;传入 `limit`(1–1000)和可选 `offset` 则返回轻量 `agentscape.scene-object-page`,包含 `total`、`objects` 和 `nextOffset`,不会展开全局空间关系。`offset` 必须配合 `limit`,且分页参数不能与 `target` 同时使用。
|
|
117
|
+
|
|
118
|
+
批量编辑使用 `scene_apply`,一个 UUID `requestId` 对应最多 32 个 `operations`。Runtime 仍逐条执行,失败时保留已执行操作并返回 `applied`、`failed`、`notRun`;这**不是原子回滚事务**。SceneGraph 在一次批量调用结束后合并关系更新,避免无意义的重复全量重建。大量相同资产推荐先注册资产,再使用 `scene_apply` 按引用批量实例化。
|
|
119
|
+
|
|
120
|
+
场景关系 CPU 基准:`node dev/scripts/benchmark-scene-graph.mjs`。它只测试稀疏对象的 SceneGraph,不能作为 MCP 往返、GPU、物理或导航性能指标。
|
|
121
|
+
|
|
122
|
+
MCP Transport 使用无状态 HTTP;没有 MCP 协议会话 ID,worldSessionId 专属于世界生命周期。每个工具调用仍要求 Bearer 鉴权。SDK 处理协议消息及参数验证;工具执行错误返回 isError 和脱敏错误码。
|
|
123
|
+
|
|
124
|
+
动作白名单:spawnAsset、moveObject、navigateTo、approachAndInteract、approachAndPickup、approachAndPlace。参数完全遵循 skills_list 返回的 Schema;拒绝未知字段。初始资产为本地 agent / cabinet / cup / table,也允许实例化当前会话已编译注册的创作资产。动作接口不能指定 URL 或磁盘目录;Three.js 代码只能通过 authoring_execute 在受限引擎内执行。profile、actor 的授权身份均由服务端固定,actorId 只是世界内对象 ID。
|
|
125
|
+
|
|
126
|
+
按顺序调用(每次动作生成独立 requestId;重试相同动作使用原 ID):
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{"skill":"approachAndInteract","args":{"actorId":"agent_01","targetId":"cabinet_01","action":"open"}}
|
|
130
|
+
{"skill":"approachAndPickup","args":{"actorId":"agent_01","targetId":"cup_01"}}
|
|
131
|
+
{"skill":"approachAndPlace","args":{"actorId":"agent_01","supportId":"table_01","surfaceId":"top"}}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
以上动作参数还需添加 worldSessionId 和 requestId。之后执行 world_verify、world_export、session_close。调用成功不代表动作成功:读取 state(verified / unverified / blocked / failed / requested)和 result 中的最终证据。请求型返回不提升为 verified。
|
|
135
|
+
|
|
136
|
+
单世界只允许一个操作,包括读取、验收和导出;并发返回 SESSION_BUSY。Runtime 负责事务、回滚和 History。requestId 绑定动作和参数,冲突拒绝;每个会话最多保留 256 条请求记录,完成记录默认保留 5 分钟,容量紧张时可提前淘汰。窗口内使用相同 ID 和参数可重放结果,运行中的记录受保护。恢复请求使用独立的有界窗口,重放已关闭会话的恢复请求返回 SESSION_NOT_FOUND。
|
|
137
|
+
|
|
138
|
+
Studio 命令绑定具体 Runtime 实例。切换世界会撤销排队命令;超过 8 MiB 的 Studio JSON 回执通过同一身份的 GET /files/:id/content 下载。已派发的操作超时会返回 STUDIO_RESULT_UNKNOWN。请使用原请求 ID 和相同参数重试以取得回执。自动连接在同一浏览器客户端和世界内重连时仍可重放。刷新页面或超过回执窗口后,应先检查世界状态。
|
|
139
|
+
|
|
140
|
+
## 安全与资源
|
|
141
|
+
|
|
142
|
+
默认最多4个世界,空闲15分钟回收;每世界64个对象、256次动作;单动作最多12000个 1/60 秒模拟步和30秒墙钟时间。每12步让出事件循环。取消/超时重复终止 Runtime interaction/locomotion,并给予最多240步清理;无法收敛则关闭该 Host,禁止继续动作。
|
|
143
|
+
|
|
144
|
+
两个 MCP 端点完整 HTTP 请求及响应默认最多 10 MiB,每身份每分钟 600 次请求;Host 白名单默认 localhost/127.0.0.1,Origin 默认全部拒绝(无 Origin 的非浏览器客户端可用)。headers 10 秒、request 120 秒接收超时(不是工具执行时限)。快照最多 8 MiB,临时文件 JSON 复核后原子 rename;客户端不能指定路径。快照是 SceneSerializer JSON,不包含完整 GLB/纹理作品包。
|
|
145
|
+
|
|
146
|
+
对象和动作预算限制会话增长;当前 Node.js 同进程承载多个 Runtime,不提供每会话操作系统级硬内存隔离。需要硬内存限制时应采用受限进程/容器部署,不应将本版宣传为任意用户公网沙箱。
|
|
147
|
+
|
|
148
|
+
进程崩溃后内存世界丢失,启动时不会恢复任何旧世界、鉴权所有权或临时快照;旧的快照和未发布 .tmp 文件可能留在私有目录,须由服务拥有者离线清理。v0.1 不支持快照导入,错误导入不构成开放接口。
|
|
149
|
+
|
|
150
|
+
## 远程连接
|
|
151
|
+
|
|
152
|
+
通过可信 TLS 反向代理或隧道转发到 127.0.0.1:39015,保留 Authorization。代理应将上游 Host 设为 localhost;浏览器客户端需由部署代码向 startServer 的 security.origins 传入明确完整 Origin,禁止通配。默认 CLI 不开放跨域浏览器访问。不要暴露本地端口。
|
|
153
|
+
|
|
154
|
+
这是私有 Bearer 部署,不包含 OAuth 授权发现;要求 OAuth 的托管客户端需要额外授权层。已通过 PC2 AgentDock 的真实工具调用验证完整工作流,部署详情见 DEPLOYMENT-PC2.md;其他客户端各自的直连配置尚未验证。
|
|
155
|
+
|
|
156
|
+
## 文件职责与验证
|
|
157
|
+
|
|
158
|
+
- main.mjs:独立 HTTP 启动及关闭、官方 SDK Transport。
|
|
159
|
+
- registerTools.js:九工具、严格动作参数 Schema、调用映射。
|
|
160
|
+
- security.js:私有身份鉴权、Host/Origin、请求体和频率预算。
|
|
161
|
+
- SessionManager.js:所有权、互斥、幂等、TTL、原子导出。
|
|
162
|
+
- HeadlessWorldHost.js:复用 createSession/WorldBuilder/AgentTools,独立模拟驱动、动作证据和释放。
|
|
163
|
+
- tasks.jsonl:阶段任务;acceptance-evidence.json:真实 MCP 验收记录。
|
|
164
|
+
- tests/mcp/:官方 HTTP Client 物理任务、隔离、安全和生命周期自动断言。
|
|
165
|
+
- 根 package.json/lock:固定 MCP 依赖和启动/测试脚本;.gitignore:排除私有会话目录。
|
|
166
|
+
|
|
167
|
+
```powershell
|
|
168
|
+
npm run test:mcp
|
|
169
|
+
npm run check
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
测试覆盖未鉴权、Origin、请求体限制、频率限制、端口冲突、跨身份隔离、未知 Session、非法参数、白名单、幂等冲突、互斥、取消、超时、异常解锁、TTL、关闭释放、导出预算、原子发布和残留文件不恢复。真实任务使用 Rapier、Recast、柜体 GLB;没有在线模型调用。
|
|
173
|
+
|
|
174
|
+
已知语义限制:资产/布局准入仍可能 provisional;这与真实动作及最终支撑关系 verified 是不同证据。pickup 为 kinematic attachment,不证明夹持力。未提供截图、在线生成、Studio 同步、多用户公网账号、完整作品包迁移。
|
|
175
|
+
|
|
176
|
+
机械资产 v1:scene_add_model 的 model.asset 可提交 agentscape.mechanical-draft JSON(几何节点、旋转铰链、滑轨),先经过 GLB 编译与隔离物理验证。详见 [机械资产创建工作台](../../docs/capabilities/mechanical-asset-workbench.md)。
|
|
177
|
+
|
|
178
|
+
Studio Live Bridge:调用 studio_pair_create 取得一次性配对码,然后在本机 Studio 的「MCP 连接」中明确授权;通过返回的 worldSessionId 使用既有 Scene 工具操作浏览器当前世界。切换世界自动撤销连接。完整说明见 [Studio Live Bridge](../../docs/mcp-studio-live-bridge.md)。
|
|
179
|
+
|
|
180
|
+
本机 Studio MCP 自动连接默认开启:打开 Studio 后由浏览器自动注册当前世界,认证 MCP 客户端可省略 Scene 工具的 worldSessionId;手动配对仍可在高级设置中使用。见 [自动连接说明](../../docs/mcp-studio-auto-connect.md)。
|
|
181
|
+
|
|
182
|
+
项目与全局资产:scene_save/scene_import 保存 Object Forge 可编辑声明和 revision;asset_publish_project 发布当前用户全局不可变版本;scene_object_definition 的 fork 从全局资产复制当前项目可编辑定义。详见 docs/modules/project-global-assets.md。
|
|
183
|
+
|
|
184
|
+
## MCP 工具契约(分类版)
|
|
185
|
+
|
|
186
|
+
普通 /mcp 与受限 /agent-mcp 使用同一组分类工具,通过原有 Studio Bridge project 方法转发;不新增世界实例或重复底层能力。
|
|
187
|
+
|
|
188
|
+
| 工具 | 操作 |
|
|
189
|
+
| --- | --- |
|
|
190
|
+
| studio_project | read、create、create_world、open、run、save、close |
|
|
191
|
+
| studio_files | write、patch、file_read、file、resource、preview_batch、apply_batch、discard_batch、undo_batch |
|
|
192
|
+
| scene_query | search、inspect、inspect_batch |
|
|
193
|
+
| scene_capture | capture、suggest_views |
|
|
194
|
+
| scene_timeline | command=status/pause/resume/step(无需 operation) |
|
|
195
|
+
|
|
196
|
+
迁移:此前 studio_project(operation=write,create=true) 改为 studio_project(operation=create),保留 name/source/project;修改现有源码使用 studio_files(operation=write),观察和截图改用对应分类工具。旧混合 operation 不再注册,不提供重复别名。运行后使用返回的 revision/runtimeId,观察结果提供 sceneRevision/objectUuid,后续请求绑定这些标识。所有实际运行场景的查询、截图和时间控制必须传 expectedRevision。
|
|
197
|
+
|
|
198
|
+
受限项目模式只允许 studio_project read/run/save,studio_files 不接受 create;五类工具均由服务端绑定预定 worldSessionId 和 expectedProjectId。修改权限以实际 Zod 校验为准,不仅隐藏 Schema 字段。注册语义实体和动作仍使用 scene_observe / scene_interact,客观条件验收使用 scene_verify。截图不是验收结论。Code Project 的 scene_verify 可选 snapshot=inspect 或 visual:在同一次同步采样中返回后置条件、原生根节点观察及可选 JPEG,并附 projectId/projectRevision/runtimeId/sceneRevision/frame/tick;非代码世界不支持此选项。Canvas 暂未就绪时重试整组采样,不混合不同帧。普通 scene_verify 契约不变。
|
|
199
|
+
|
|
200
|
+
### Scene navigation diagnosis
|
|
201
|
+
|
|
202
|
+
`scene_navigation({actor,position})` is a read-only live route query with provisional, actor-eligible registered articulation recovery candidates. Native numerical joints use hypothetical collider poses at declared limits and bounded external sweep checks; managed open diagnosis retains its obstacle-suppression assumption. No solver state or history is changed. Use the returned `recommendation.interaction` only for an authorized goal with `scene_interact`, await `scene_job`, then query `scene_navigation` again. A predicted path is not evidence of real passage. Native/mixed ON and SUPPORTS criteria are verified from current geometry, actual supporting contacts and motion rather than a past placement receipt.
|
|
203
|
+
|
|
204
|
+
Serial native barriers can now return a provisional `recommendation.progress` of kind `partial-route-progress` even while `counterfactual.reachable` is false. This is measured advancement of the same partial route, not destination reachability. Native candidates also require a real current-world joint approach preflight. Execute one verified interaction, then re-query; do not batch hypothetical recoveries or assume eventual completion. Complete-route unlocks have priority. The progress heuristic is bounded and does not search arbitrary joint combinations.
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
## 大型资源传输(OpenAI 风格)
|
|
208
|
+
|
|
209
|
+
独立 HTTP 接口使用相同 Bearer 身份、Host/Origin 检查及速率限制。不把二进制编码成 MCP JSON。以下接口为 AgentScape 自有协议,并非 OpenAI Uploads API 的线缆兼容实现。
|
|
210
|
+
|
|
211
|
+
| HTTP | 输入 / 输出 |
|
|
212
|
+
| --- | --- |
|
|
213
|
+
| POST /uploads | JSON {bytes, sha256?} → upload ID |
|
|
214
|
+
| GET /uploads/:id | 当前接收字节数、分片及过期时间 |
|
|
215
|
+
| POST /uploads/:id/parts | 原始二进制请求体 → part ID、字节数、SHA-256 |
|
|
216
|
+
| POST /uploads/:id/complete | JSON {partIds: [...]}(按目标文件顺序)→ file ID |
|
|
217
|
+
| POST /uploads/:id/cancel | 取消并释放暂存空间 |
|
|
218
|
+
| GET /files/:id | 文件元信息 |
|
|
219
|
+
| GET /files/:id/content | 流式下载,Content-Length 与 X-Content-SHA256 |
|
|
220
|
+
| DELETE /files/:id | 删除未被使用的文件 |
|
|
221
|
+
|
|
222
|
+
默认每文件 8,000,000,000 字节、每分片 64,000,000 字节、上传与完成文件的默认有效期均为 1 小时,活动下载租约阻止回收,释放后重新计时、最多 1024 分片。服务级暂存与世界块共享 24 GB 磁盘配额,最多 128 个文件/上传和 4 个并发传输。单个上传串行写入分片,完成时按指定顺序逐块重新校验,无需拼接整份文件。通过 startServer 的 security、managerOptions、transferOptions 可调整默认值。已完成文件仅在当前服务进程有效,正常关闭清理暂存;尚不支持重启恢复、跨进程共享或自动清理崩溃遗留目录。
|
|
223
|
+
|
|
224
|
+
私有离线世界可调用 `scene_save({worldSessionId, format: "world-file"})` 获取 fileId、bytes、sha256,再通过 HTTP 下载 .asworld;`scene_import({worldSessionId, requestId, fileId})` 通过已有 WorldArchive/WorldStorage 校验并事务提交。导入后的资源块保留到世界替换或关闭,不受上传文件删除影响。使用每次操作独立的磁盘块存储;不接受依赖外部未提供资源块的 linked 包。Studio 桥接不支持此文件模式,原 inline 模式仍保留。.asworld 保存世界数据而非 Object Forge 编辑声明,后者使用 inline 包。资产解码预算和世界激活预算保持独立,不承诺单个 8 GB GLB 可加载。
|
|
225
|
+
|
|
226
|
+
验证:`npx vitest run tests/mcp/world-transfer.test.js tests/mcp/http-security.test.js`;可选本机压力测试 `node dev/scripts/benchmark-mcp-transfer.mjs`(最大 1 GiB 暂存,完成后删除测试数据)。
|
|
227
|
+
|
|
228
|
+
### 离线视觉场景导出(GLB)
|
|
229
|
+
|
|
230
|
+
`scene_export_glb` 是独立的静态视觉导出,不改变 `scene_save` 的存档与恢复语义。
|
|
231
|
+
指定私有离线世界 ID,可选择活动对象 ID(默认全部活动托管对象)、透视相机及最多 16 个平行光、点光源或聚光灯。例如:
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"worldSessionId": "当前私有离线世界 UUID",
|
|
236
|
+
"options": {
|
|
237
|
+
"objectIds": ["floor", "table"],
|
|
238
|
+
"camera": {"position":[8,5,10],"target":[0,1,0],"fov":45,"aspect":1.7777778},
|
|
239
|
+
"lights":[{"type":"directional","position":[3,8,4],"target":[0,0,0],"intensity":3}]
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
返回 `fileId`、`bytes`、`sha256`、对象/材质/纹理统计和限制说明;使用原有 `GET /files/:id/content` 下载并在不需要后 DELETE 文件。GLB 使用 glTF Y-up 坐标,包含世界变换、PBR 材质及受支持纹理,镜头和光源为导出时的独立配置,不修改或持久化到当前世界。未导出内置环境、仿真、交互、编辑器状态、动画;暂不支持蒙皮、合批网格、自定义 Shader 或非受支持的纹理。非 PBR 材质可能有损,渲染器的阴影、后处理与环境照明也不属于 GLB。完整 AgentScape 恢复仍使用 `scene_save`。
|
|
245
|
+
|
|
246
|
+
Recipe 的 `material` 支持可选 `clearcoat`、`clearcoatRoughness`、`transmission`、`ior`、`emissiveIntensity`,使用 glTF 标准材质扩展,不改变旧 Recipe 的默认值。
|
|
247
|
+
|
|
248
|
+
持久化相机与灯光:通过 `scene_apply` 的操作
|
|
249
|
+
`{"type":"setPresentation","presentation":{"camera":{"position":[8,5,10],"target":[0,1,0]},"lights":[{"type":"point","position":[0,4,0],"intensity":30}]}}`
|
|
250
|
+
一次替换整个创作灯光/镜头组;传入空对象清除。该组是实际 Three.js 对象,独立于视口控制与内置环境灯光,支持统一撤销/重做,随世界 JSON、inline bundle 和 .asworld 保存及恢复。`scene_observe` 返回 presentation;未指定导出参数时 `scene_export_glb` 复用保存的配置;显式 `camera:null` 或 `lights:[]` 仅在该次导出中禁用对应项,不修改世界。
|
|
251
|
+
|
|
252
|
+
### 程序化纹理与单实例材质编辑
|
|
253
|
+
|
|
254
|
+
Recipe 的 `parts[].material.texture` 支持 wood、stone、fabric、brushed-metal,详见 `modules/asset/README.md`。
|
|
255
|
+
对已登记 Recipe 的对象,可调用 `scene_object_definition` 的 inspect → preview → apply,preview 的 changes 示例:
|
|
256
|
+
`[{"path":"/parts/@body/material","value":{"color":"#ffffff","roughness":0.7,"texture":{"pattern":"wood","seed":42}}}]`。
|
|
257
|
+
即使该部件原先未声明 material,也可设置完整材质。完整声明重新校验、编译并替换当前实例;不修改其他使用同一资产版本的对象。inline 项目包保留可编辑声明及纹理资源;.asworld 保存已编译纹理与世界状态(不含 Object Forge 编辑声明)。
|
|
258
|
+
|
|
259
|
+
创作场景表现还支持 `environment:{"preset":"interior","intensity":1.4,"background":true}`(预设 `interior|courtyard|street|none`,`null` 或缺省继承世界基础光照)以及各灯光的可选 `castShadow`。通过同一 `setPresentation` 操作、历史及世界包保存;Studio 负责实际 HDRI 渲染,离线会话只保存设置。GLB 不嵌入 HDRI 或阴影设置;浏览器 Studio 复用共享导出核心。预设仅指向应用自带 HDR 文件,不接受任意网络 URL。
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
Recipe 增加真实穿孔板几何(不使用黑色贴片或透明材质伪装孔洞):
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{"type":"perforated-box","size":[2.65,0.075,1.05],"holes":[{"center":[-0.5,0.2],"radius":0.018},{"center":[0.5,-0.2],"radius":0.018}]}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
尺寸沿局部 X/Y/Z,孔中心沿 X/Z,沿 Y 贯穿;可借助部件 quaternion 旋转为垂直面板。圆孔有真实内壁,边缘与孔间必须保留正间距(至少 0.0001 m),半径最小 0.001 m,每部件最多 128 孔,每 Recipe 最多 256 孔。圆周为有界多边形近似。此为视觉几何,不自动生成开孔碰撞体;physical/interactive 仍须独立声明、验证碰撞体和能力。
|
|
269
|
+
MCP 会话默认允许最多 `maxSessions` 个活跃世界。退出会话后仍有异步写入的宿主继续占用资源预算,直到写入结束。创建世界时同时计算活跃、正在创建及等待回收的宿主,总上限为 `maxSessions + maxRetiredHosts`。后者默认等于 `maxSessions`,达到上限返回 `RETIRED_HOST_BUDGET`。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { validateRemoteAuthoringDocument, remoteAuthoringLimits } from '../../application/code-execution/RemoteAuthoringDocument.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { rolldown } from 'rolldown';
|
|
5
|
+
let cached;
|
|
6
|
+
export function sandboxBundle() {
|
|
7
|
+
cached ||= (async()=>{
|
|
8
|
+
const build=await rolldown({input:fileURLToPath(new URL('./AuthoringSandboxEntry.js',import.meta.url)),platform:'neutral'});
|
|
9
|
+
let code;try{code=(await build.generate({format:'iife',name:'AuthoringSandbox'})).output[0].code;}finally{await build.close();}
|
|
10
|
+
const runner=await readFile(new URL('./sandbox/run.mjs',import.meta.url),'utf8');
|
|
11
|
+
return {code,runner,digest:createHash('sha256').update(code).update(runner).digest('hex')};
|
|
12
|
+
})();return cached;
|
|
13
|
+
}
|