agentscape3d 1.0.0-beta.1 → 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 -21
- package/README.md +23 -48
- package/dist/core.d.ts +68 -0
- package/dist/core.js +209 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +10 -229
- package/dist/index.js +192 -15462
- package/dist/index.js.map +1 -1
- package/package.json +16 -40
- package/cli.mjs +0 -27
- package/dist/AssetCompiler-CDFiElji.js +0 -2451
- package/dist/AssetCompiler-CDFiElji.js.map +0 -1
- package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
- package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
- package/dist/AssetRecipe-DmFpzxr-.js +0 -55
- package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
- package/dist/BrowserCodeWorker.js +0 -53615
- package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
- package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
- package/dist/SceneSerializer-DPVOyeRk.js +0 -353
- package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
- package/dist/StylePack-DNrdLeGI.js +0 -6314
- package/dist/StylePack-DNrdLeGI.js.map +0 -1
- package/dist/WorldArchive-pSBIGxLa.js +0 -420
- package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
- package/dist/WorldIO-wsDfZGM4.js +0 -150
- package/dist/WorldIO-wsDfZGM4.js.map +0 -1
- package/dist/blankWorld-CBWbwJGj.js +0 -76
- package/dist/blankWorld-CBWbwJGj.js.map +0 -1
- package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
- package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
- package/dist/environments-DgH66NqV.js +0 -4220
- package/dist/environments-DgH66NqV.js.map +0 -1
- package/dist/gltfIO-B87nJaat.js +0 -10
- package/dist/gltfIO-B87nJaat.js.map +0 -1
- package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
- package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
- package/dist/magicCabin-D64fD1E2.js +0 -11024
- package/dist/magicCabin-D64fD1E2.js.map +0 -1
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.js +0 -1
- package/dist/monumentHall-BKbs0UOQ.js +0 -404
- package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
- package/dist/node.d.ts +0 -16
- package/dist/node.js +0 -25
- package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
- package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
- package/dist/runtime/application/AgentTools.js +0 -25
- package/dist/runtime/application/README.md +0 -14
- package/dist/runtime/application/buildTaskObservation.js +0 -117
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
- package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
- package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
- package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
- package/dist/runtime/application/createSession.js +0 -66
- package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
- package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
- package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
- package/dist/runtime/application/native-scene/CodeProject.js +0 -119
- package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
- package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
- package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
- package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
- package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
- package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
- package/dist/runtime/application/scene/RequestWindow.js +0 -54
- package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
- package/dist/runtime/application/scene/SceneContracts.js +0 -45
- package/dist/runtime/application/scene/SceneEditService.js +0 -144
- package/dist/runtime/application/scene/SceneFacade.js +0 -267
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
- package/dist/runtime/application/scene/SceneJobController.js +0 -229
- package/dist/runtime/application/scene/ScenePackage.js +0 -162
- package/dist/runtime/application/scene/ScenePersistence.js +0 -50
- package/dist/runtime/application/scene/SceneProject.js +0 -95
- package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
- package/dist/runtime/application/scene/StarterScene.js +0 -56
- package/dist/runtime/application/scene/WorldArchive.js +0 -87
- package/dist/runtime/application/scene/WorldDirectory.js +0 -20
- package/dist/runtime/application/scene/WorldDocument.js +0 -74
- package/dist/runtime/application/scene/WorldIO.js +0 -103
- package/dist/runtime/application/scene/WorldStorage.js +0 -137
- package/dist/runtime/application/skills/SkillRegistry.js +0 -163
- package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
- package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
- package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
- package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
- package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
- package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
- package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
- package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
- package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
- package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
- package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
- package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
- package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
- package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
- package/dist/runtime/application/skills/skillPrimitives.js +0 -4
- package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
- package/dist/runtime/application/tasks.jsonl +0 -67
- package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
- package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
- package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
- package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
- package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
- package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
- package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
- package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
- package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
- package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
- package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
- package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
- package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
- package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
- package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
- package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
- package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
- package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
- package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
- package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
- package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
- package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
- package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
- package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
- package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
- package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
- package/dist/runtime/apps/mcp-server/README.md +0 -150
- package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
- package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
- package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
- package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
- package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
- package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
- package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
- package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
- package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
- package/dist/runtime/apps/mcp-server/main.mjs +0 -56
- package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
- package/dist/runtime/apps/mcp-server/security.js +0 -21
- package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
- package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
- package/dist/runtime/apps/server/README.md +0 -7
- package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
- package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
- package/dist/runtime/apps/server/tasks.jsonl +0 -10
- package/dist/runtime/foundation/EventBus.js +0 -18
- package/dist/runtime/foundation/JsonGateway.js +0 -47
- package/dist/runtime/foundation/PolicyEngine.js +0 -21
- package/dist/runtime/foundation/README.md +0 -7
- package/dist/runtime/foundation/TraceRecorder.js +0 -76
- package/dist/runtime/foundation/errors.js +0 -8
- package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
- package/dist/runtime/foundation/version.js +0 -2
- package/dist/runtime/modules/agent/README.md +0 -11
- package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
- package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
- package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
- package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
- package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
- package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
- package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
- package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
- package/dist/runtime/modules/agent/prompt/index.js +0 -46
- package/dist/runtime/modules/agent/tasks.jsonl +0 -94
- package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
- package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
- package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
- package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
- package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
- package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
- package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
- package/dist/runtime/modules/artifact/README.md +0 -7
- package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
- package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
- package/dist/runtime/modules/asset/AssetModule.js +0 -399
- package/dist/runtime/modules/asset/README.md +0 -54
- package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
- package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
- package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
- package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
- package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
- package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
- package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
- package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
- package/dist/runtime/modules/asset/model/admission.js +0 -117
- package/dist/runtime/modules/asset/model/errors.js +0 -6
- package/dist/runtime/modules/asset/model/parts.js +0 -27
- package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
- package/dist/runtime/modules/asset/model/schema.js +0 -150
- package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
- package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
- package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
- package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
- package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
- package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
- package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
- package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
- package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
- package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
- package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
- package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
- package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
- package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
- package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
- package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
- package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
- package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
- package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
- package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
- package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
- package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
- package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
- package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
- package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
- package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
- package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
- package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
- package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
- package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
- package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
- package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
- package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
- package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
- package/dist/runtime/modules/asset/tasks.jsonl +0 -87
- package/dist/runtime/modules/generation/README.md +0 -9
- package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
- package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
- package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
- package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
- package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
- package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
- package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
- package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
- package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
- package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
- package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
- package/dist/runtime/modules/generation/tasks.jsonl +0 -35
- package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
- package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
- package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
- package/dist/runtime/modules/rendering/README.md +0 -7
- package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
- package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
- package/dist/runtime/modules/rendering/createRenderer.js +0 -76
- package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
- package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
- package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
- package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
- package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
- package/dist/runtime/modules/world/README.md +0 -13
- package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
- package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
- package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
- package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
- package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
- package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
- package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
- package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
- package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
- package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
- package/dist/runtime/modules/world/content/blankWorld.js +0 -35
- package/dist/runtime/modules/world/content/environments.js +0 -84
- package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
- package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
- package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
- package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
- package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
- package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
- package/dist/runtime/modules/world/content/magicCabin.js +0 -190
- package/dist/runtime/modules/world/content/monumentHall.js +0 -154
- package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
- package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
- package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
- package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
- package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
- package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
- package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
- package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
- package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
- package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
- package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
- package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
- package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
- package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
- package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
- package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
- package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
- package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
- package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
- package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
- package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
- package/dist/runtime/modules/world/errors.js +0 -9
- package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
- package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
- package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
- package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
- package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
- package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
- package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
- package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
- package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
- package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
- package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
- package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
- package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
- package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
- package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
- package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
- package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
- package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
- package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
- package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
- package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
- package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
- package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
- package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
- package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
- package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
- package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
- package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
- package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
- package/dist/runtime/modules/world/tasks.jsonl +0 -530
- package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
- package/dist/runtime/modules/world/verification/Finding.js +0 -105
- package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
- package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
- package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
- package/dist/runtime/package-lock.json +0 -6245
- package/dist/runtime/package.json +0 -91
- 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-Dudvovhu.js +0 -364
- package/dist/schema-Dudvovhu.js.map +0 -1
- package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
- package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
- package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
- package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
- package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
- package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { ArtifactContractError, normalizeArtifactHash, requireSafeArtifactId } from './ArtifactDescriptor.js';
|
|
2
|
-
|
|
3
|
-
const COMMIT_TOKEN=Symbol('artifact-byte-store-commit');
|
|
4
|
-
|
|
5
|
-
const cloneEntry=(entry)=>entry?{
|
|
6
|
-
key:entry.key,artifactId:entry.artifactId,hash:entry.hash,mime:entry.mime,bytes:entry.bytes,
|
|
7
|
-
data:new Uint8Array(entry.data)
|
|
8
|
-
}:null;
|
|
9
|
-
|
|
10
|
-
class MemoryArtifactByteWriter {
|
|
11
|
-
#store;
|
|
12
|
-
#artifactId;
|
|
13
|
-
#maxBytes;
|
|
14
|
-
#chunks=[];
|
|
15
|
-
#bytes=0;
|
|
16
|
-
#state='open';
|
|
17
|
-
|
|
18
|
-
constructor(store,{artifactId,maxBytes}) {
|
|
19
|
-
this.#store=store;
|
|
20
|
-
this.#artifactId=requireSafeArtifactId(artifactId);
|
|
21
|
-
this.#maxBytes=maxBytes;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get state() { return this.#state; }
|
|
25
|
-
get bytesWritten() { return this.#bytes; }
|
|
26
|
-
|
|
27
|
-
async write(chunk) {
|
|
28
|
-
if (this.#state!=='open') throw new ArtifactContractError('ARTIFACT_BYTE_STORE_STATE','Artifact byte writer is not open');
|
|
29
|
-
if (!(chunk instanceof Uint8Array)) throw new ArtifactContractError('ARTIFACT_BYTE_STORE_INVALID','Artifact byte writer requires Uint8Array chunks');
|
|
30
|
-
if (this.#bytes+chunk.byteLength>this.#maxBytes) throw new ArtifactContractError('ARTIFACT_BYTES_LIMIT','Artifact temporary byte store exceeded maxBytes');
|
|
31
|
-
this.#chunks.push(new Uint8Array(chunk));
|
|
32
|
-
this.#bytes+=chunk.byteLength;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async commit({key,hash,mime,bytes}) {
|
|
36
|
-
if (this.#state!=='open') throw new ArtifactContractError('ARTIFACT_BYTE_STORE_STATE','Artifact byte writer is not open');
|
|
37
|
-
const cacheKey=requireSafeArtifactId(key,'cacheKey');
|
|
38
|
-
const canonicalHash=normalizeArtifactHash(hash);
|
|
39
|
-
const expected=Number(bytes);
|
|
40
|
-
if (!Number.isSafeInteger(expected)||expected<0||expected!==this.#bytes) throw new ArtifactContractError('ARTIFACT_BYTE_STORE_INVALID','Artifact byte store commit length mismatch');
|
|
41
|
-
const data=new Uint8Array(this.#bytes);
|
|
42
|
-
let offset=0;
|
|
43
|
-
for (const chunk of this.#chunks) { data.set(chunk,offset); offset+=chunk.byteLength; }
|
|
44
|
-
const result=this.#store._commit(COMMIT_TOKEN,{
|
|
45
|
-
key:cacheKey,artifactId:this.#artifactId,hash:canonicalHash,mime:String(mime||'').toLowerCase(),bytes:expected,data
|
|
46
|
-
});
|
|
47
|
-
this.#chunks=[];
|
|
48
|
-
this.#state='committed';
|
|
49
|
-
return result;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async abort() {
|
|
53
|
-
if (this.#state==='open') {
|
|
54
|
-
this.#chunks=[];
|
|
55
|
-
this.#bytes=0;
|
|
56
|
-
this.#state='aborted';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export class MemoryArtifactByteStore {
|
|
62
|
-
#entries=new Map();
|
|
63
|
-
#hashIndex=new Map();
|
|
64
|
-
|
|
65
|
-
restore(entry={}) {
|
|
66
|
-
const key=requireSafeArtifactId(entry.key,'cacheKey');
|
|
67
|
-
const artifactId=requireSafeArtifactId(entry.artifactId);
|
|
68
|
-
const hash=normalizeArtifactHash(entry.hash);
|
|
69
|
-
const mime=String(entry.mime||'').trim().toLowerCase();
|
|
70
|
-
const bytes=Number(entry.bytes);
|
|
71
|
-
const data=entry.data instanceof Uint8Array ? new Uint8Array(entry.data) : null;
|
|
72
|
-
if (!mime || !Number.isSafeInteger(bytes) || bytes<0 || !data || data.byteLength!==bytes) {
|
|
73
|
-
throw new ArtifactContractError('ARTIFACT_BYTE_STORE_INVALID','Persisted Artifact cache entry is invalid',{key});
|
|
74
|
-
}
|
|
75
|
-
return this._commit(COMMIT_TOKEN,{key,artifactId,hash,mime,bytes,data});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
begin({artifactId,maxBytes}) {
|
|
79
|
-
const limit=Number(maxBytes);
|
|
80
|
-
if (!Number.isSafeInteger(limit)||limit<0) throw new ArtifactContractError('ARTIFACT_BYTES_LIMIT','Artifact byte store maxBytes must be a non-negative safe integer');
|
|
81
|
-
return new MemoryArtifactByteWriter(this,{artifactId,maxBytes:limit});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
_commit(token,entry) {
|
|
85
|
-
if (token!==COMMIT_TOKEN) throw new ArtifactContractError('ARTIFACT_BYTE_STORE_STATE','Artifact byte store commit is writer-managed only');
|
|
86
|
-
const previous=this.#entries.get(entry.key);
|
|
87
|
-
if (previous) {
|
|
88
|
-
if (previous.hash!==entry.hash || previous.bytes!==entry.bytes || previous.mime!==entry.mime || previous.artifactId!==entry.artifactId) {
|
|
89
|
-
throw new ArtifactContractError('ARTIFACT_CACHE_KEY_CONFLICT','Artifact cache key already contains different content',{key:entry.key});
|
|
90
|
-
}
|
|
91
|
-
return {key:entry.key,hash:entry.hash,mime:entry.mime,bytes:entry.bytes};
|
|
92
|
-
}
|
|
93
|
-
this.#entries.set(entry.key,entry);
|
|
94
|
-
if (!this.#hashIndex.has(entry.hash)) this.#hashIndex.set(entry.hash,new Set());
|
|
95
|
-
this.#hashIndex.get(entry.hash).add(entry.key);
|
|
96
|
-
return {key:entry.key,hash:entry.hash,mime:entry.mime,bytes:entry.bytes};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
get(key) { return cloneEntry(this.#entries.get(key)); }
|
|
100
|
-
|
|
101
|
-
remove(key) {
|
|
102
|
-
const entry=this.#entries.get(key);
|
|
103
|
-
if (!entry) return false;
|
|
104
|
-
this.#entries.delete(key);
|
|
105
|
-
const keys=this.#hashIndex.get(entry.hash);
|
|
106
|
-
keys?.delete(key);
|
|
107
|
-
if (keys && !keys.size) this.#hashIndex.delete(entry.hash);
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
findByHash(hash) {
|
|
112
|
-
const canonical=normalizeArtifactHash(hash);
|
|
113
|
-
return [...(this.#hashIndex.get(canonical)||[])].sort();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const DB_NAME = 'agentscape-artifacts';
|
|
2
|
-
const DB_VERSION = 1;
|
|
3
|
-
const DESCRIPTOR_STORE = 'descriptors';
|
|
4
|
-
const BYTE_STORE = 'bytes';
|
|
5
|
-
|
|
6
|
-
const clone = (value) => value == null ? value : structuredClone(value);
|
|
7
|
-
|
|
8
|
-
export class IndexedDbArtifactStore {
|
|
9
|
-
constructor({ indexedDBImpl = globalThis.indexedDB } = {}) {
|
|
10
|
-
this.indexedDB = indexedDBImpl;
|
|
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(DESCRIPTOR_STORE)) db.createObjectStore(DESCRIPTOR_STORE);
|
|
20
|
-
if (!db.objectStoreNames.contains(BYTE_STORE)) db.createObjectStore(BYTE_STORE);
|
|
21
|
-
};
|
|
22
|
-
request.onsuccess = () => resolve(request.result);
|
|
23
|
-
request.onerror = () => reject(request.error);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async load() {
|
|
28
|
-
const db = await this.open();
|
|
29
|
-
if (!db) return { descriptors: [], entries: [] };
|
|
30
|
-
try {
|
|
31
|
-
const tx = db.transaction([DESCRIPTOR_STORE, BYTE_STORE], 'readonly');
|
|
32
|
-
const readAll = (storeName) => new Promise((resolve, reject) => {
|
|
33
|
-
const request = tx.objectStore(storeName).getAll();
|
|
34
|
-
request.onsuccess = () => resolve(request.result || []);
|
|
35
|
-
request.onerror = () => reject(request.error);
|
|
36
|
-
});
|
|
37
|
-
const [descriptors, entries] = await Promise.all([
|
|
38
|
-
readAll(DESCRIPTOR_STORE),
|
|
39
|
-
readAll(BYTE_STORE)
|
|
40
|
-
]);
|
|
41
|
-
return {
|
|
42
|
-
descriptors: descriptors.map(clone),
|
|
43
|
-
entries: entries.map((entry) => ({ ...clone(entry), data: new Uint8Array(entry.data) }))
|
|
44
|
-
};
|
|
45
|
-
} finally {
|
|
46
|
-
db.close();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async putArtifact(descriptor, entry) {
|
|
51
|
-
const db = await this.open();
|
|
52
|
-
if (!db) return false;
|
|
53
|
-
try {
|
|
54
|
-
await new Promise((resolve, reject) => {
|
|
55
|
-
const tx = db.transaction([DESCRIPTOR_STORE, BYTE_STORE], 'readwrite');
|
|
56
|
-
tx.objectStore(DESCRIPTOR_STORE).put(clone(descriptor), descriptor.id);
|
|
57
|
-
tx.objectStore(BYTE_STORE).put({ ...clone(entry), data: new Uint8Array(entry.data) }, entry.key);
|
|
58
|
-
tx.oncomplete = resolve;
|
|
59
|
-
tx.onerror = () => reject(tx.error);
|
|
60
|
-
tx.onabort = () => reject(tx.error);
|
|
61
|
-
});
|
|
62
|
-
return true;
|
|
63
|
-
} finally {
|
|
64
|
-
db.close();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{"id": "ARTIFACT-001", "type": "test", "title": "descriptor id 拒绝斜杠/空格/控制字符", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["三类非法 ID 都返回 ARTIFACT_ID_INVALID"]}
|
|
2
|
-
{"id": "ARTIFACT-002", "type": "test", "title": "descriptor hash 只接受 lowercase canonical sha256", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["uppercase/长度错误 hash 被拒绝"]}
|
|
3
|
-
{"id": "ARTIFACT-003", "type": "test", "title": "descriptor 禁止 signedUrl/token/filePath 字段", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["深层嵌套 forbidden field 也被拒绝"]}
|
|
4
|
-
{"id": "ARTIFACT-004", "type": "test", "title": "producer operation 必须 provider-scoped + .vN", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["非稳定 operation 被拒绝"]}
|
|
5
|
-
{"id": "ARTIFACT-005", "type": "test", "title": "lineage 禁止 self-reference", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["自引用返回 ARTIFACT_LINEAGE_INVALID"]}
|
|
6
|
-
{"id": "ARTIFACT-006", "type": "test", "title": "lineage 禁止重复 parent edge", "status": "DONE", "priority": "P1", "path": "artifact", "depends": ["ARTIFACT-005"], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["同 artifact+relation 第二次被拒绝"]}
|
|
7
|
-
{"id": "ARTIFACT-007", "type": "test", "title": "available connector location 必须有 safe access handle", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["缺 access 被拒绝"]}
|
|
8
|
-
{"id": "ARTIFACT-008", "type": "test", "title": "local-cache access key 只能 safe artifact id 字符集", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["path-like cache key 被拒绝"]}
|
|
9
|
-
{"id": "ARTIFACT-009", "type": "test", "title": "retention expiry 早于 createdAt 被拒绝", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["返回稳定 contract error"]}
|
|
10
|
-
{"id": "ARTIFACT-010", "type": "test", "title": "untrusted descriptor 不能自报 integrity=verified", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactDescriptor.js"], "criteria": ["返回 ARTIFACT_INTEGRITY_EVIDENCE_REQUIRED"]}
|
|
11
|
-
{"id": "ARTIFACT-011", "type": "test", "title": "Registry 相同 ID+相同 immutable signature 幂等", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactRegistry.js"], "criteria": ["第二次 register 返回同事实不新增索引"]}
|
|
12
|
-
{"id": "ARTIFACT-012", "type": "test", "title": "Registry 相同 ID+不同 hash 冲突", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactRegistry.js"], "criteria": ["ARTIFACT_IDENTITY_CONFLICT"]}
|
|
13
|
-
{"id": "ARTIFACT-013", "type": "test", "title": "hash index 对多个不同 ID 同 hash 可检索", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactRegistry.js"], "criteria": ["findByHash 返回排序稳定的全部 IDs"]}
|
|
14
|
-
{"id": "ARTIFACT-014", "type": "test", "title": "location 更新不能改变 kind/scope/access identity", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactRegistry.js"], "criteria": ["冲突返回 ARTIFACT_LOCATION_IDENTITY_CONFLICT"]}
|
|
15
|
-
{"id": "ARTIFACT-015", "type": "test", "title": "被 lease 的 location 不能删除", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactRegistry.js"], "criteria": ["ARTIFACT_LOCATION_LEASED"]}
|
|
16
|
-
{"id": "ARTIFACT-016", "type": "test", "title": "expired lease 不阻塞 location 删除", "status": "DONE", "priority": "P1", "path": "artifact", "depends": ["ARTIFACT-015"], "files": ["modules/artifact/ArtifactRegistry.js"], "criteria": ["includeExpired=false 后可删除"]}
|
|
17
|
-
{"id": "ARTIFACT-017", "type": "test", "title": "integrity verify 的 bytes/hash/mime 任一不匹配均失败", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactRegistry.js"], "criteria": ["三个独立 case 都是 mismatch"]}
|
|
18
|
-
{"id": "ARTIFACT-018", "type": "test", "title": "integrity reject 后状态保存 rejection code/time", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactRegistry.js"], "criteria": ["get() 返回 rejected evidence"]}
|
|
19
|
-
{"id": "ARTIFACT-019", "type": "test", "title": "Importer Content-Length 大于 maxBytes 在读 stream 前拒绝", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactImporter.js"], "criteria": ["reader 未启动、无 byteStore commit"]}
|
|
20
|
-
{"id": "ARTIFACT-020", "type": "test", "title": "Importer stream 实际 bytes 超 descriptor 时立即 cancel", "status": "DONE", "priority": "P1", "path": "artifact", "depends": ["ARTIFACT-019"], "files": ["modules/artifact/ArtifactImporter.js"], "criteria": ["reader.cancel 被调用且 cache 回滚"]}
|
|
21
|
-
{"id": "ARTIFACT-021", "type": "test", "title": "Importer hash mismatch 后不留下 local-cache location", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactImporter.js"], "criteria": ["Registry/location/byteStore 三者无残留"]}
|
|
22
|
-
{"id": "ARTIFACT-022", "type": "test", "title": "Importer writer commit 后 registry 更新失败时删除 committed cache", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactImporter.js"], "criteria": ["无 orphan cache"]}
|
|
23
|
-
{"id": "ARTIFACT-023", "type": "test", "title": "Importer chunkCount 超上限 fail-closed", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactImporter.js"], "criteria": ["ARTIFACT_STREAM_LIMIT"]}
|
|
24
|
-
{"id": "ARTIFACT-024", "type": "test", "title": "GLB magic/version/declared length 分别验证", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactContentGate.js"], "criteria": ["每种坏 header 有稳定错误"]}
|
|
25
|
-
{"id": "ARTIFACT-025", "type": "test", "title": "PNG/JPEG/WebP signature 分别验证", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactContentGate.js"], "criteria": ["MIME spoof 三个 case 被拒绝"]}
|
|
26
|
-
{"id": "ARTIFACT-026", "type": "test", "title": "PLY/SPZ signature 分别验证", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactContentGate.js"], "criteria": ["错 magic 被拒绝"]}
|
|
27
|
-
{"id": "ARTIFACT-027", "type": "test", "title": "JSON maxDepth 与 maxNodes 各自触发限制", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactContentGate.js"], "criteria": ["两类结构炸弹不进入无界解析路径"]}
|
|
28
|
-
{"id": "ARTIFACT-028", "type": "test", "title": "archive MIME 明确 fail-closed", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactContentGate.js"], "criteria": ["zip/tar/gzip 返回 ARTIFACT_ARCHIVE_UNSUPPORTED"]}
|
|
29
|
-
{"id": "ARTIFACT-031", "type": "test", "title": "persisted verified descriptor 缺 byte entry 时 hydrate fail-closed", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactModule.js"], "criteria": ["ARTIFACT_PERSISTENCE_INTEGRITY_MISMATCH"]}
|
|
30
|
-
{"id": "ARTIFACT-032", "type": "test", "title": "persisted byte hash 被改后 hydrate 拒绝", "status": "DONE", "priority": "P1", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactModule.js"], "criteria": ["contentHash mismatch 被捕获"]}
|
|
31
|
-
{"id": "ARTIFACT-033", "type": "test", "title": "persistArtifact 缺 descriptor 或 entry 返回 false", "status": "DONE", "priority": "P2", "path": "artifact", "depends": [], "files": ["modules/artifact/ArtifactModule.js"], "criteria": ["无异常、无部分写入"]}
|
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { AssetCatalog } from './registry/AssetCatalog.js';
|
|
2
|
-
import { AssetRegistry } from './registry/AssetRegistry.js';
|
|
3
|
-
import { AssetLoader } from './loading/AssetLoader.js';
|
|
4
|
-
import { AssetProductionError, createAssetProducer } from './production/AssetProductionPipeline.js';
|
|
5
|
-
import { HttpCompilerProvider } from './production/compiler/providers/HttpCompilerProvider.js';
|
|
6
|
-
import { CompiledAssetStore } from './persistence/CompiledAssetStore.js';
|
|
7
|
-
import { AssetManifestStore } from './persistence/AssetManifestStore.js';
|
|
8
|
-
import { LocalAssetLibrary } from './persistence/LocalAssetLibrary.js';
|
|
9
|
-
import { LocalAssetLibraryStore } from './persistence/LocalAssetLibraryStore.js';
|
|
10
|
-
import { assetAdmission } from './model/admission.js';
|
|
11
|
-
import { mechanicalDraftSchema, mechanicalDraftToAssetRecipe, mechanicalDraftToManifest } from './model/MechanicalAssetDraft.js';
|
|
12
|
-
import { recipeSchema, canonicalAssetJson, assetDigest, assertEmbeddedGLB, interactionReviewSchema } from './model/AssetInputContracts.js';
|
|
13
|
-
|
|
14
|
-
export async function verifyAndUpdateAssetArticulation(assets,assetId,options) {
|
|
15
|
-
const report=await assets.verifyArticulation(assetId,options);
|
|
16
|
-
const manifest=assets.getManifest(assetId);
|
|
17
|
-
manifest.verification={...(manifest.verification||{}),articulation:report};
|
|
18
|
-
const quality=manifest.compiler?.quality;
|
|
19
|
-
if(quality){
|
|
20
|
-
quality.advisory=(quality.advisory||[]).filter(item=>!['ARTICULATION_UNVERIFIED','ARTICULATION_VERIFICATION_FAILED'].includes(item.code));
|
|
21
|
-
if(!report.ok)quality.advisory.push({code:'ARTICULATION_VERIFICATION_FAILED',message:'运行时运动验证失败'});
|
|
22
|
-
quality.status=quality.hard?.length?'rejected':quality.advisory.length?'provisional':'ready';
|
|
23
|
-
}
|
|
24
|
-
await assets.registerManifest(manifest,{replace:true});
|
|
25
|
-
const admission=assetAdmission(manifest);
|
|
26
|
-
return {...report,readiness:admission.status,admission};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function createAssetModule({
|
|
30
|
-
manifests,
|
|
31
|
-
volatile = false,
|
|
32
|
-
compiledStore = null,
|
|
33
|
-
manifestStore = undefined,
|
|
34
|
-
libraryStore = undefined,
|
|
35
|
-
gltfLoader = undefined,
|
|
36
|
-
now = () => Date.now()
|
|
37
|
-
} = {}) {
|
|
38
|
-
const store = compiledStore || new CompiledAssetStore({ indexedDBImpl: volatile ? null : globalThis.indexedDB });
|
|
39
|
-
const durableManifests = manifestStore === undefined
|
|
40
|
-
? (globalThis.indexedDB ? new AssetManifestStore() : null)
|
|
41
|
-
: manifestStore;
|
|
42
|
-
|
|
43
|
-
const registry = new AssetRegistry({ manifests });
|
|
44
|
-
const loader = new AssetLoader({ registry, compiledStore:store, ...(gltfLoader ? {gltfLoader} : {}) });
|
|
45
|
-
const catalog = new AssetCatalog({ registry });
|
|
46
|
-
|
|
47
|
-
const durableLibrary = libraryStore === undefined
|
|
48
|
-
? new LocalAssetLibraryStore()
|
|
49
|
-
: (libraryStore || new LocalAssetLibraryStore({ indexedDBImpl:null }));
|
|
50
|
-
const library = new LocalAssetLibrary({
|
|
51
|
-
assetRegistry:registry,
|
|
52
|
-
compiledStore:store,
|
|
53
|
-
store:durableLibrary,
|
|
54
|
-
now:()=>new Date(now()).toISOString()
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
let producer = null;
|
|
58
|
-
let hydrated = false;
|
|
59
|
-
let configuredCompilerProvider = null;
|
|
60
|
-
let configuredCompiler = null;
|
|
61
|
-
let configuredCompilerGetter = null;
|
|
62
|
-
let articulationVerifier = null;
|
|
63
|
-
|
|
64
|
-
const persistManifest = async (manifest) => {
|
|
65
|
-
if (manifest?.source?.kind !== 'compiled' || !durableManifests?.put) return false;
|
|
66
|
-
await durableManifests.put(manifest);
|
|
67
|
-
return true;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const configureCompiler = ({ provider = null, endpoint = '', events = null, version = 'dev' } = {}) => {
|
|
71
|
-
configuredCompilerProvider = provider || new HttpCompilerProvider({ endpoint:String(endpoint || '').trim() });
|
|
72
|
-
configuredCompiler = null;
|
|
73
|
-
configuredCompilerGetter = async () => {
|
|
74
|
-
if (!configuredCompiler) {
|
|
75
|
-
const { AssetCompiler } = await import('./production/compiler/AssetCompiler.js');
|
|
76
|
-
configuredCompiler = new AssetCompiler({ store, provider:configuredCompilerProvider, events, version });
|
|
77
|
-
}
|
|
78
|
-
return configuredCompiler;
|
|
79
|
-
};
|
|
80
|
-
return configuredCompilerGetter;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const module = {
|
|
84
|
-
async readAssetBytes(id) {
|
|
85
|
-
const manifest = registry.getManifest(id);
|
|
86
|
-
if (manifest.source.kind === 'compiled') {
|
|
87
|
-
const entry = await store.get(manifest.source.key);
|
|
88
|
-
if (!entry?.bytes) throw new Error('RESOURCE_UNAVAILABLE');
|
|
89
|
-
return entry.bytes.slice();
|
|
90
|
-
}
|
|
91
|
-
if (manifest.source.kind !== 'glb') throw new Error('RESOURCE_UNAVAILABLE');
|
|
92
|
-
const { AssetCompiler } = await import('./production/compiler/AssetCompiler.js');
|
|
93
|
-
return new AssetCompiler({ store }).fetchBytes(manifest.source.url);
|
|
94
|
-
},
|
|
95
|
-
async installPreparedAssets(entries, operation) {
|
|
96
|
-
const added = [];
|
|
97
|
-
try {
|
|
98
|
-
const durableIds = new Set((await durableManifests?.list?.() || []).map(manifest => manifest.id));
|
|
99
|
-
for (const entry of entries) if (!registry.has(entry.manifest.id) && durableIds.has(entry.manifest.id)) throw new Error('ASSET_ID_CONFLICT');
|
|
100
|
-
// Check every identity before touching durable storage.
|
|
101
|
-
for (const entry of entries) if (registry.has(entry.manifest.id)) {
|
|
102
|
-
const existing = registry.getManifest(entry.manifest.id);
|
|
103
|
-
const definition = Object.fromEntries(Object.keys(entry.expectedDefinition).map(key => [key, existing[key]]));
|
|
104
|
-
if (canonicalAssetJson(definition) !== canonicalAssetJson(entry.expectedDefinition) || await assetDigest(await module.readAssetBytes(existing.id)) !== entry.expectedSourceHash) throw new Error('ASSET_ID_CONFLICT');
|
|
105
|
-
}
|
|
106
|
-
for (const entry of entries) {
|
|
107
|
-
if (registry.has(entry.manifest.id)) continue;
|
|
108
|
-
const key = entry.manifest.source.key, previous = await store.get(key);
|
|
109
|
-
if (previous && await assetDigest(previous.bytes) !== await assetDigest(entry.bytes)) throw new Error('ASSET_ID_CONFLICT');
|
|
110
|
-
added.push({ id: entry.manifest.id, key, bytesAdded: !previous });
|
|
111
|
-
await store.put(key, entry.bytes, { manifestId: entry.manifest.id });
|
|
112
|
-
await module.registerManifest(entry.manifest);
|
|
113
|
-
}
|
|
114
|
-
return await operation();
|
|
115
|
-
} catch (error) {
|
|
116
|
-
const failures = [];
|
|
117
|
-
for (const entry of added.reverse()) try {
|
|
118
|
-
registry.removeManifest(entry.id);
|
|
119
|
-
await durableManifests?.delete?.(entry.id);
|
|
120
|
-
if (entry.bytesAdded) await store.delete(entry.key);
|
|
121
|
-
} catch (failure) { failures.push(failure); }
|
|
122
|
-
if (failures.length) throw Object.assign(new AggregateError([error, ...failures], 'Project resource rollback failed'), { code: 'PROJECT_ROLLBACK_FAILED' });
|
|
123
|
-
throw error;
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
async importMechanicalDraft(input) {
|
|
127
|
-
const draft=mechanicalDraftSchema.parse(input);
|
|
128
|
-
const hash=await assetDigest(new TextEncoder().encode(canonicalAssetJson({draft,compiler:'mechanical-draft-v1'})));
|
|
129
|
-
const id='asset_'+hash;
|
|
130
|
-
if(registry.has(id)) {
|
|
131
|
-
const manifest=registry.getManifest(id);
|
|
132
|
-
return {manifest,admission:assetAdmission(manifest)};
|
|
133
|
-
}
|
|
134
|
-
const { compileRecipeGeometry } = await import('./production/AssetRecipe.js');
|
|
135
|
-
const {bytes}=await compileRecipeGeometry(mechanicalDraftToAssetRecipe(draft));
|
|
136
|
-
return module.importPackageAsset({id,bytes,definition:mechanicalDraftToManifest(draft)});
|
|
137
|
-
},
|
|
138
|
-
async importPackageAsset({ id, bytes, definition }) {
|
|
139
|
-
assertEmbeddedGLB(bytes);
|
|
140
|
-
if (registry.has(id)) throw Object.assign(new Error('Asset id already exists'), {code:'ASSET_ID_CONFLICT'});
|
|
141
|
-
const { AssetCompiler } = await import('./production/compiler/AssetCompiler.js');
|
|
142
|
-
const compiler = new AssetCompiler({ store, version: 'v2-input-1' });
|
|
143
|
-
// Prepare bytes without publishing them. Failed physical checks must leave no binary.
|
|
144
|
-
const output = definition.capabilityLevel === 'visual'
|
|
145
|
-
? await compiler.compileVisual({ bytes, assetId:id, label:definition.label, persist:false })
|
|
146
|
-
: await compiler.compile({ bytes, assetId:id, sourceName:'package.glb', definition,
|
|
147
|
-
authoringIntent:{usage:'interactive'}, persist:false });
|
|
148
|
-
output.manifest.capabilityLevel = definition.capabilityLevel;
|
|
149
|
-
if (Object.values(output.manifest.parts || {}).some(part=>part.joint && part.joint.type!=='fixed')) {
|
|
150
|
-
if (!articulationVerifier) throw Object.assign(new Error('Runtime verification unavailable'), {code:'RUNTIME_VERIFICATION_UNAVAILABLE'});
|
|
151
|
-
const report=await articulationVerifier.verify(id,{manifest:output.manifest,requireRegistration:true,requireSettled:true,
|
|
152
|
-
instantiate:async()=>({object:await loader.gltfLoader.loadBytes(output.optimizedBytes)})});
|
|
153
|
-
if (!report.ok) throw Object.assign(new Error('Package articulation failed validation'),
|
|
154
|
-
{code:'ASSET_PHYSICS_VERIFICATION_FAILED',details:report});
|
|
155
|
-
output.manifest.verification={articulation:report};
|
|
156
|
-
output.manifest.compiler.quality.advisory=output.manifest.compiler.quality.advisory.filter(item=>item.code!=='ARTICULATION_UNVERIFIED');
|
|
157
|
-
output.manifest.compiler.quality.status=output.manifest.compiler.quality.advisory.length?'provisional':'ready';
|
|
158
|
-
}
|
|
159
|
-
const previous=await store.get(id);
|
|
160
|
-
if (previous) throw Object.assign(new Error('Compiled asset id already exists'), {code:'ASSET_ID_CONFLICT'});
|
|
161
|
-
try {
|
|
162
|
-
await store.put(id,output.optimizedBytes,{manifestId:id,quality:output.manifest.compiler.quality.status});
|
|
163
|
-
await module.registerManifest(output.manifest);
|
|
164
|
-
} catch (error) {
|
|
165
|
-
registry.removeManifest(id);
|
|
166
|
-
try {
|
|
167
|
-
await durableManifests?.delete?.(id);
|
|
168
|
-
await store.delete(id);
|
|
169
|
-
} catch (rollbackError) {
|
|
170
|
-
throw Object.assign(new AggregateError([error,rollbackError],'Package publish rollback failed'),
|
|
171
|
-
{code:'ASSET_PUBLISH_ROLLBACK_FAILED'});
|
|
172
|
-
}
|
|
173
|
-
throw error;
|
|
174
|
-
}
|
|
175
|
-
return {manifest:output.manifest,admission:assetAdmission(output.manifest)};
|
|
176
|
-
},
|
|
177
|
-
async prepareInteraction({bytes,urdfBytes,name='import.glb'}) {
|
|
178
|
-
if(!(bytes instanceof Uint8Array) || bytes.byteLength>32*1024*1024) throw Object.assign(new Error('Invalid GLB input'),{code:'ASSET_INPUT_INVALID'});
|
|
179
|
-
bytes=bytes.slice();assertEmbeddedGLB(bytes);
|
|
180
|
-
let partProposal=null,urdfHash=null;
|
|
181
|
-
if(urdfBytes) {
|
|
182
|
-
if(!(urdfBytes instanceof Uint8Array) || !urdfBytes.length || urdfBytes.length>1024*1024) throw Object.assign(new Error('Invalid URDF input'),{code:'ASSET_INPUT_INVALID'});
|
|
183
|
-
urdfBytes=urdfBytes.slice();urdfHash=await assetDigest(urdfBytes);
|
|
184
|
-
if(!configuredCompilerProvider?.runUrdfProposal || configuredCompilerProvider.isConfigured?.()===false) throw Object.assign(new Error('URDF requires the configured compiler provider'),{code:'URDF_PROVIDER_UNAVAILABLE'});
|
|
185
|
-
const response=await configuredCompilerProvider.runUrdfProposal(urdfBytes);
|
|
186
|
-
partProposal=response.partProposal;
|
|
187
|
-
if(partProposal?.version!==1 || !Array.isArray(partProposal.parts) || partProposal.parts.length>32) throw Object.assign(new Error('Invalid URDF proposal'),{code:'CAPABILITY_PROPOSAL_INVALID'});
|
|
188
|
-
}
|
|
189
|
-
const {AssetCompiler}=await import('./production/compiler/AssetCompiler.js');
|
|
190
|
-
return new AssetCompiler({store,version:'interaction-v1'}).proposeInteraction({bytes,sourceName:name,partProposal,urdfHash});
|
|
191
|
-
},
|
|
192
|
-
async screenInteraction({bytes,urdfBytes,name='import.glb',proposalId,hypothesisIds}={}) {
|
|
193
|
-
assertEmbeddedGLB(bytes);
|
|
194
|
-
if (!/^[a-f0-9]{64}$/.test(String(proposalId || ''))) throw Object.assign(new Error('Invalid proposal ID'),{code:'PROPOSAL_MISMATCH'});
|
|
195
|
-
if (!articulationVerifier) throw Object.assign(new Error('Runtime verification unavailable'),{code:'RUNTIME_VERIFICATION_UNAVAILABLE'});
|
|
196
|
-
// Recompute from *these bytes*, with the same name and optional URDF:
|
|
197
|
-
// the client never provides joint frames, evidence or verification flags.
|
|
198
|
-
const proposal=await module.prepareInteraction({bytes,urdfBytes,name});
|
|
199
|
-
if (proposal.proposalId !== proposalId) throw Object.assign(new Error('Review does not match the imported source'),{code:'PROPOSAL_MISMATCH'});
|
|
200
|
-
const hypotheses=proposal.kinematics?.hypotheses || [];
|
|
201
|
-
const ids=hypothesisIds || hypotheses.slice(0,4).map(item=>item.id);
|
|
202
|
-
if (!Array.isArray(ids) || ids.length > 4 || ids.some(id=>typeof id!=='string'))
|
|
203
|
-
throw Object.assign(new Error('Invalid hypothesis selection'),{code:'HYPOTHESIS_SELECTION_INVALID'});
|
|
204
|
-
if (!ids.length) return {schema:'agentscape.kinematic-screen',schemaVersion:1,
|
|
205
|
-
proposalId,sourceHash:proposal.sourceHash,results:[],admission:'not-granted',
|
|
206
|
-
interpretation:'simulation-only; no semantic authorization or real-world mechanism proof'};
|
|
207
|
-
const {screenKinematicHypotheses}=await import('./production/verification/KinematicHypothesisScreen.js');
|
|
208
|
-
return screenKinematicHypotheses({bytes,proposal,ids,loader:loader.gltfLoader,verifier:articulationVerifier});
|
|
209
|
-
},
|
|
210
|
-
async importReviewedGLB({bytes,urdfBytes,name='import.glb',review,level='physical'}) {
|
|
211
|
-
review=interactionReviewSchema.parse(review);
|
|
212
|
-
bytes=bytes.slice();urdfBytes=urdfBytes?.slice();
|
|
213
|
-
const proposal=await module.prepareInteraction({bytes,urdfBytes,name});
|
|
214
|
-
if(review.proposalId!==proposal.proposalId) throw Object.assign(new Error('Review does not match the imported source'),{code:'PROPOSAL_MISMATCH'});
|
|
215
|
-
const hash=await assetDigest(new TextEncoder().encode(canonicalAssetJson({source:proposal.sourceHash,review,compiler:'interaction-v1'}))),assetId=`asset_${hash}`;
|
|
216
|
-
if(registry.has(assetId)) return {asset:`asset://sha256/${hash}`,manifest:registry.getManifest(assetId),admission:assetAdmission(registry.getManifest(assetId))};
|
|
217
|
-
if(!articulationVerifier) throw Object.assign(new Error('Runtime verification unavailable'),{code:'RUNTIME_VERIFICATION_UNAVAILABLE'});
|
|
218
|
-
const {AssetCompiler}=await import('./production/compiler/AssetCompiler.js');
|
|
219
|
-
const output=await new AssetCompiler({store,version:'interaction-v1'}).compile({bytes,assetId,sourceName:name,
|
|
220
|
-
authoringIntent:{usage:'interactive'},interactionReview:review,
|
|
221
|
-
partProposal:review.parts.length ? {version:1,source:'reviewed-capability-proposal',parts:review.parts.map(part=>({...part,actions:[],targets:{}}))} : null});
|
|
222
|
-
try {
|
|
223
|
-
if(Object.keys(output.manifest.parts || {}).length!==review.parts.length) throw Object.assign(new Error('Part review did not compile'),{code:'CAPABILITY_REVIEW_INVALID'});
|
|
224
|
-
const report=await articulationVerifier.verify(assetId,{manifest:output.manifest,requireRegistration:true,verifyRigidBody:true,requireSettled:true,
|
|
225
|
-
instantiate:async()=>({object:await loader.loadCompiled(output.manifest.source)})});
|
|
226
|
-
if(!report.ok || !report.physicsRegistered || report.tested!==review.parts.length || report.parts.some(part=>!part.actions?.some(action=>action.moved))) throw Object.assign(new Error('Imported physics failed validation'),{code:'ASSET_PHYSICS_VERIFICATION_FAILED',details:report});
|
|
227
|
-
output.manifest.verification={articulation:report};
|
|
228
|
-
output.manifest.capabilityLevel=level;output.manifest.contentHash=hash;
|
|
229
|
-
output.manifest.compiler.quality.advisory=output.manifest.compiler.quality.advisory.filter(item=>item.code!=='ARTICULATION_UNVERIFIED');
|
|
230
|
-
output.manifest.compiler.quality.status=output.manifest.compiler.quality.advisory.length?'provisional':'ready';
|
|
231
|
-
output.manifest.provenance.interactionSource={sourceHash:proposal.sourceHash,urdfHash:proposal.urdfHash,proposalId:proposal.proposalId};
|
|
232
|
-
await module.registerManifest(output.manifest);
|
|
233
|
-
return {asset:`asset://sha256/${hash}`,manifest:output.manifest,admission:assetAdmission(output.manifest)};
|
|
234
|
-
} catch(error) { await store.delete?.(assetId);throw error; }
|
|
235
|
-
},
|
|
236
|
-
async importGLB({ bytes, level = 'visual', label = 'Imported model', review = null, urdfBytes, name }) {
|
|
237
|
-
if(review) return module.importReviewedGLB({bytes,level,review,urdfBytes,name});
|
|
238
|
-
if (level !== 'visual') throw Object.assign(new Error('GLB physical import requires an explicit compiled definition'), { code: 'CAPABILITY_UNAVAILABLE' });
|
|
239
|
-
if (!(bytes instanceof Uint8Array) || bytes.byteLength > 32 * 1024 * 1024) throw Object.assign(new Error('Invalid GLB input'), { code: 'ASSET_INPUT_INVALID' });
|
|
240
|
-
// Own the input before asynchronous hashing; callers may reuse their buffer.
|
|
241
|
-
bytes = bytes.slice();
|
|
242
|
-
assertEmbeddedGLB(bytes);
|
|
243
|
-
const hash = await assetDigest(bytes), assetId = `asset_${hash}`;
|
|
244
|
-
if (registry.has(assetId)) return { asset: `asset://sha256/${hash}`, manifest: registry.getManifest(assetId), admission: assetAdmission(registry.getManifest(assetId)) };
|
|
245
|
-
const { AssetCompiler } = await import('./production/compiler/AssetCompiler.js');
|
|
246
|
-
const output = await new AssetCompiler({ store, version: 'v2-input-1' }).compileVisual({ bytes, assetId, label });
|
|
247
|
-
output.manifest.contentHash = hash;
|
|
248
|
-
await module.registerManifest(output.manifest);
|
|
249
|
-
return { asset: `asset://sha256/${hash}`, manifest: output.manifest, admission: assetAdmission(output.manifest) };
|
|
250
|
-
},
|
|
251
|
-
async importRecipe(input) {
|
|
252
|
-
const recipe = recipeSchema.parse(input);
|
|
253
|
-
const hash = await assetDigest(new TextEncoder().encode(canonicalAssetJson({ recipe, compiler: 'v2-input-1' }))), assetId = `asset_${hash}`;
|
|
254
|
-
if (registry.has(assetId)) return { asset: `asset://sha256/${hash}`, manifest: registry.getManifest(assetId), admission: assetAdmission(registry.getManifest(assetId)) };
|
|
255
|
-
const { compileRecipeGeometry } = await import('./production/AssetRecipe.js');
|
|
256
|
-
const { AssetCompiler } = await import('./production/compiler/AssetCompiler.js');
|
|
257
|
-
const { bytes } = await compileRecipeGeometry(recipe);
|
|
258
|
-
const compiler = new AssetCompiler({ store, version: 'v2-input-1' });
|
|
259
|
-
const output = recipe.capabilities.level === 'visual' ? await compiler.compileVisual({ bytes, assetId, label: recipe.id })
|
|
260
|
-
: await compiler.compile({ bytes, assetId, sourceName: 'recipe.glb', label: recipe.id,
|
|
261
|
-
authoringIntent: { usage: recipe.capabilities.physics.body === 'dynamic' ? 'movable' : 'static' },
|
|
262
|
-
definition: { type: 'prop', label: recipe.id, actions: recipe.capabilities.actions, physics: recipe.capabilities.physics, surfaces: recipe.capabilities.surfaces } });
|
|
263
|
-
output.manifest.capabilityLevel = recipe.capabilities.level;
|
|
264
|
-
output.manifest.contentHash = hash;
|
|
265
|
-
output.manifest.provenance = { ...output.manifest.provenance, recipe };
|
|
266
|
-
const admission = assetAdmission(output.manifest);
|
|
267
|
-
if (admission.status === 'rejected') throw Object.assign(new Error('Recipe rejected'), { code: 'ASSET_REJECTED' });
|
|
268
|
-
await module.registerManifest(output.manifest);
|
|
269
|
-
return { asset: `asset://sha256/${hash}`, manifest: output.manifest, admission };
|
|
270
|
-
},
|
|
271
|
-
registry,
|
|
272
|
-
loader,
|
|
273
|
-
catalog,
|
|
274
|
-
compiledStore:store,
|
|
275
|
-
manifestStore:durableManifests,
|
|
276
|
-
library,
|
|
277
|
-
|
|
278
|
-
getManifest(assetId) {
|
|
279
|
-
return registry.getManifest(assetId);
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
hasAsset(assetId) {
|
|
283
|
-
return registry.has(assetId);
|
|
284
|
-
},
|
|
285
|
-
|
|
286
|
-
assertCompatibleManifest(manifest) {
|
|
287
|
-
return registry.assertCompatibleManifest(manifest);
|
|
288
|
-
},
|
|
289
|
-
|
|
290
|
-
configureRenderer(renderer) {
|
|
291
|
-
return loader.configureRenderer?.(renderer);
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
instantiate(assetId, options) {
|
|
295
|
-
return loader.instantiate(assetId, options);
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
configureVerification({ articulationVerifier: verifier = null } = {}) {
|
|
299
|
-
if (verifier != null && typeof verifier.verify !== 'function') {
|
|
300
|
-
throw new TypeError('Asset articulation verifier must provide verify(assetId)');
|
|
301
|
-
}
|
|
302
|
-
articulationVerifier = verifier;
|
|
303
|
-
return module;
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
async verifyArticulation(assetId, options) {
|
|
307
|
-
if (!articulationVerifier) {
|
|
308
|
-
const error = new Error('Asset articulation verification is not configured');
|
|
309
|
-
error.code = 'ASSET_ARTICULATION_VERIFIER_UNAVAILABLE';
|
|
310
|
-
throw error;
|
|
311
|
-
}
|
|
312
|
-
return options==null ? articulationVerifier.verify(assetId) : articulationVerifier.verify(assetId, options);
|
|
313
|
-
},
|
|
314
|
-
|
|
315
|
-
async verifyAndUpdateArticulation(assetId, options) {
|
|
316
|
-
return verifyAndUpdateAssetArticulation(module,assetId,options);
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
async hydrate() {
|
|
320
|
-
if (hydrated) return { manifests:registry.size, restored:false };
|
|
321
|
-
if (!durableManifests?.list) {
|
|
322
|
-
await library.hydrate();
|
|
323
|
-
hydrated = true;
|
|
324
|
-
return { manifests:registry.size, restored:false };
|
|
325
|
-
}
|
|
326
|
-
const persisted = await durableManifests.list();
|
|
327
|
-
let restored = 0;
|
|
328
|
-
for (const manifest of persisted) {
|
|
329
|
-
const changed = registry.registerManifest(manifest);
|
|
330
|
-
if (changed) restored += 1;
|
|
331
|
-
}
|
|
332
|
-
await library.hydrate();
|
|
333
|
-
hydrated = true;
|
|
334
|
-
return { manifests:persisted.length, restored };
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
async registerManifest(manifest, options = {}) {
|
|
338
|
-
const changed = registry.registerManifest(manifest, options);
|
|
339
|
-
await persistManifest(registry.getManifest(manifest.id));
|
|
340
|
-
return changed;
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
async approveAsset(assetId, metadata = {}) {
|
|
344
|
-
return library.approve(assetId, metadata);
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
async listApprovedAssets() {
|
|
348
|
-
return library.list();
|
|
349
|
-
},
|
|
350
|
-
|
|
351
|
-
configureProduction({
|
|
352
|
-
artifacts,
|
|
353
|
-
getAssetCompiler = null,
|
|
354
|
-
compilerProvider = null,
|
|
355
|
-
compilerEndpoint = '',
|
|
356
|
-
events = null,
|
|
357
|
-
version = 'dev',
|
|
358
|
-
idFactory = undefined
|
|
359
|
-
} = {}) {
|
|
360
|
-
if (!artifacts?.registry || !artifacts?.byteStore) {
|
|
361
|
-
throw new AssetProductionError('ASSET_PRODUCTION_INVALID', 'Asset production requires an ArtifactModule boundary');
|
|
362
|
-
}
|
|
363
|
-
const compilerGetter = getAssetCompiler || configureCompiler({
|
|
364
|
-
provider:compilerProvider,
|
|
365
|
-
endpoint:compilerEndpoint,
|
|
366
|
-
events,
|
|
367
|
-
version
|
|
368
|
-
});
|
|
369
|
-
producer = createAssetProducer({
|
|
370
|
-
artifactRegistry:artifacts.registry,
|
|
371
|
-
byteStore:artifacts.byteStore,
|
|
372
|
-
getAssetCompiler:compilerGetter,
|
|
373
|
-
assetRegistry:registry,
|
|
374
|
-
onManifestRegistered:persistManifest,
|
|
375
|
-
events,
|
|
376
|
-
now,
|
|
377
|
-
...(idFactory ? { idFactory } : {})
|
|
378
|
-
});
|
|
379
|
-
return module;
|
|
380
|
-
},
|
|
381
|
-
|
|
382
|
-
setCompilerEndpoint(endpoint = '') {
|
|
383
|
-
configuredCompilerProvider?.setEndpoint?.(String(endpoint || '').trim());
|
|
384
|
-
return module;
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
async produceAsset(request = {}) {
|
|
388
|
-
if (!producer) {
|
|
389
|
-
throw new AssetProductionError(
|
|
390
|
-
'ASSET_PRODUCTION_NOT_CONFIGURED',
|
|
391
|
-
'Asset production requires composition-time compiler configuration'
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
return producer(request);
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
return module;
|
|
399
|
-
}
|