agentscape3d 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/README.md +23 -48
  2. package/dist/core.d.ts +68 -0
  3. package/dist/core.js +209 -0
  4. package/dist/core.js.map +1 -0
  5. package/dist/index.d.ts +10 -229
  6. package/dist/index.js +192 -15462
  7. package/dist/index.js.map +1 -1
  8. package/package.json +11 -40
  9. package/cli.mjs +0 -27
  10. package/dist/AssetCompiler-CDFiElji.js +0 -2451
  11. package/dist/AssetCompiler-CDFiElji.js.map +0 -1
  12. package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
  13. package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
  14. package/dist/AssetRecipe-DmFpzxr-.js +0 -55
  15. package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
  16. package/dist/BrowserCodeWorker.js +0 -53615
  17. package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
  18. package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
  19. package/dist/SceneSerializer-DPVOyeRk.js +0 -353
  20. package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
  21. package/dist/StylePack-DNrdLeGI.js +0 -6314
  22. package/dist/StylePack-DNrdLeGI.js.map +0 -1
  23. package/dist/WorldArchive-pSBIGxLa.js +0 -420
  24. package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
  25. package/dist/WorldIO-wsDfZGM4.js +0 -150
  26. package/dist/WorldIO-wsDfZGM4.js.map +0 -1
  27. package/dist/blankWorld-CBWbwJGj.js +0 -76
  28. package/dist/blankWorld-CBWbwJGj.js.map +0 -1
  29. package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
  30. package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
  31. package/dist/environments-DgH66NqV.js +0 -4220
  32. package/dist/environments-DgH66NqV.js.map +0 -1
  33. package/dist/gltfIO-B87nJaat.js +0 -10
  34. package/dist/gltfIO-B87nJaat.js.map +0 -1
  35. package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
  36. package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
  37. package/dist/magicCabin-D64fD1E2.js +0 -11024
  38. package/dist/magicCabin-D64fD1E2.js.map +0 -1
  39. package/dist/mcp.d.ts +0 -2
  40. package/dist/mcp.js +0 -1
  41. package/dist/monumentHall-BKbs0UOQ.js +0 -404
  42. package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
  43. package/dist/node.d.ts +0 -16
  44. package/dist/node.js +0 -25
  45. package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
  46. package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
  47. package/dist/runtime/application/AgentTools.js +0 -25
  48. package/dist/runtime/application/README.md +0 -14
  49. package/dist/runtime/application/buildTaskObservation.js +0 -117
  50. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
  51. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
  52. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
  53. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
  54. package/dist/runtime/application/createSession.js +0 -66
  55. package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
  56. package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
  57. package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
  58. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
  59. package/dist/runtime/application/native-scene/CodeProject.js +0 -119
  60. package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
  61. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
  62. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
  63. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
  64. package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
  65. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
  66. package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
  67. package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
  68. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
  69. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
  70. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
  71. package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
  72. package/dist/runtime/application/scene/RequestWindow.js +0 -54
  73. package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
  74. package/dist/runtime/application/scene/SceneContracts.js +0 -45
  75. package/dist/runtime/application/scene/SceneEditService.js +0 -144
  76. package/dist/runtime/application/scene/SceneFacade.js +0 -267
  77. package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
  78. package/dist/runtime/application/scene/SceneJobController.js +0 -229
  79. package/dist/runtime/application/scene/ScenePackage.js +0 -162
  80. package/dist/runtime/application/scene/ScenePersistence.js +0 -50
  81. package/dist/runtime/application/scene/SceneProject.js +0 -95
  82. package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
  83. package/dist/runtime/application/scene/StarterScene.js +0 -56
  84. package/dist/runtime/application/scene/WorldArchive.js +0 -87
  85. package/dist/runtime/application/scene/WorldDirectory.js +0 -20
  86. package/dist/runtime/application/scene/WorldDocument.js +0 -74
  87. package/dist/runtime/application/scene/WorldIO.js +0 -103
  88. package/dist/runtime/application/scene/WorldStorage.js +0 -137
  89. package/dist/runtime/application/skills/SkillRegistry.js +0 -163
  90. package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
  91. package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
  92. package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
  93. package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
  94. package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
  95. package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
  96. package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
  97. package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
  98. package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
  99. package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
  100. package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
  101. package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
  102. package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
  103. package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
  104. package/dist/runtime/application/skills/skillPrimitives.js +0 -4
  105. package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
  106. package/dist/runtime/application/tasks.jsonl +0 -67
  107. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
  108. package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
  109. package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
  110. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
  111. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
  112. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
  113. package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
  114. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
  115. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
  116. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
  117. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
  118. package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
  119. package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
  120. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
  121. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
  122. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
  123. package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
  124. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
  125. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
  126. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
  127. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
  128. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
  129. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
  130. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
  131. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
  132. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
  133. package/dist/runtime/apps/mcp-server/README.md +0 -150
  134. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
  135. package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
  136. package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
  137. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
  138. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
  139. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
  140. package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
  141. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
  142. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
  143. package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
  144. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
  145. package/dist/runtime/apps/mcp-server/main.mjs +0 -56
  146. package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
  147. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
  148. package/dist/runtime/apps/mcp-server/security.js +0 -21
  149. package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
  150. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
  151. package/dist/runtime/apps/server/README.md +0 -7
  152. package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
  153. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
  154. package/dist/runtime/apps/server/tasks.jsonl +0 -10
  155. package/dist/runtime/foundation/EventBus.js +0 -18
  156. package/dist/runtime/foundation/JsonGateway.js +0 -47
  157. package/dist/runtime/foundation/PolicyEngine.js +0 -21
  158. package/dist/runtime/foundation/README.md +0 -7
  159. package/dist/runtime/foundation/TraceRecorder.js +0 -76
  160. package/dist/runtime/foundation/errors.js +0 -8
  161. package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
  162. package/dist/runtime/foundation/version.js +0 -2
  163. package/dist/runtime/modules/agent/README.md +0 -11
  164. package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
  165. package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
  166. package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
  167. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
  168. package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
  169. package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
  170. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
  171. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
  172. package/dist/runtime/modules/agent/prompt/index.js +0 -46
  173. package/dist/runtime/modules/agent/tasks.jsonl +0 -94
  174. package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
  175. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
  176. package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
  177. package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
  178. package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
  179. package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
  180. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
  181. package/dist/runtime/modules/artifact/README.md +0 -7
  182. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
  183. package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
  184. package/dist/runtime/modules/asset/AssetModule.js +0 -399
  185. package/dist/runtime/modules/asset/README.md +0 -54
  186. package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
  187. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
  188. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
  189. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
  190. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
  191. package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
  192. package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
  193. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
  194. package/dist/runtime/modules/asset/model/admission.js +0 -117
  195. package/dist/runtime/modules/asset/model/errors.js +0 -6
  196. package/dist/runtime/modules/asset/model/parts.js +0 -27
  197. package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
  198. package/dist/runtime/modules/asset/model/schema.js +0 -150
  199. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
  200. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
  201. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
  202. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
  203. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
  204. package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
  205. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
  206. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
  207. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
  208. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
  209. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
  210. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
  211. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
  212. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
  213. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
  214. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
  215. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
  216. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
  217. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
  218. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
  219. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
  220. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
  221. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
  222. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
  223. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
  224. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
  225. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
  226. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
  227. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
  228. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
  229. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
  230. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
  231. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
  232. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
  233. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
  234. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
  235. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
  236. package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
  237. package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
  238. package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
  239. package/dist/runtime/modules/asset/tasks.jsonl +0 -87
  240. package/dist/runtime/modules/generation/README.md +0 -9
  241. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
  242. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
  243. package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
  244. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
  245. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
  246. package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
  247. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
  248. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
  249. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
  250. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
  251. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
  252. package/dist/runtime/modules/generation/tasks.jsonl +0 -35
  253. package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
  254. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
  255. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
  256. package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
  257. package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
  258. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
  259. package/dist/runtime/modules/rendering/README.md +0 -7
  260. package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
  261. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
  262. package/dist/runtime/modules/rendering/createRenderer.js +0 -76
  263. package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
  264. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
  265. package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
  266. package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
  267. package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
  268. package/dist/runtime/modules/world/README.md +0 -13
  269. package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
  270. package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
  271. package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
  272. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
  273. package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
  274. package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
  275. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
  276. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
  277. package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
  278. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
  279. package/dist/runtime/modules/world/content/blankWorld.js +0 -35
  280. package/dist/runtime/modules/world/content/environments.js +0 -84
  281. package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
  282. package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
  283. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
  284. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
  285. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
  286. package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
  287. package/dist/runtime/modules/world/content/magicCabin.js +0 -190
  288. package/dist/runtime/modules/world/content/monumentHall.js +0 -154
  289. package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
  290. package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
  291. package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
  292. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
  293. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
  294. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
  295. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
  296. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
  297. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
  298. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
  301. package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
  302. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
  303. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
  304. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
  305. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
  306. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
  307. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
  308. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
  309. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
  310. package/dist/runtime/modules/world/errors.js +0 -9
  311. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
  312. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
  313. package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
  314. package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
  315. package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
  316. package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
  317. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
  318. package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
  319. package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
  320. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
  321. package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
  322. package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
  323. package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
  324. package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
  325. package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
  326. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
  327. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
  328. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
  329. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
  330. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
  331. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
  332. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
  333. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
  334. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
  335. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
  336. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
  337. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
  338. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
  339. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
  340. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
  341. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
  342. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
  343. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
  344. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
  345. package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
  346. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
  347. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
  348. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
  349. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
  350. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
  351. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
  352. package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
  353. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
  354. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
  355. package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
  356. package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
  357. package/dist/runtime/modules/world/tasks.jsonl +0 -530
  358. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
  359. package/dist/runtime/modules/world/verification/Finding.js +0 -105
  360. package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
  361. package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
  362. package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
  363. package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
  364. package/dist/runtime/package-lock.json +0 -6245
  365. package/dist/runtime/package.json +0 -91
  366. package/dist/runtime/public/assets/cabinet.glb +0 -0
  367. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  368. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  369. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  370. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  371. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  372. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  373. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  374. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  375. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  376. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  377. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  379. package/dist/schema-Dudvovhu.js +0 -364
  380. package/dist/schema-Dudvovhu.js.map +0 -1
  381. package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
  382. package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
  383. package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
  384. package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
  385. package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
  386. package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
@@ -1,590 +0,0 @@
1
- const HEX_SHA256 = /^[0-9a-f]{64}$/i;
2
- const JOB_ID = /^job-[0-9a-f]{32}$/;
3
- const SAFE_LINEAGE_KEYS = new Set(['providerCommit','modalBuildCommit','embodiedGenCommit','workflow','workflowVersion','modelRevision','seed']);
4
-
5
- const safeRelativeRef = (value, label) => {
6
- if (value == null) return undefined;
7
- const text=String(value).trim();
8
- const segments=text.split('/');
9
- if (!text || text.length > 512 || text.includes('://') || text.includes('?') || text.includes('#') || text.startsWith('/') || text.includes('\\') || segments.includes('..')) {
10
- fail('EMBODIEDGEN_ARTIFACT_REFERENCE_INVALID', `${label} must be a bounded relative reference without URL/query data.`);
11
- }
12
- return text;
13
- };
14
-
15
- const safeLineage = (value) => {
16
- if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
17
- const out={};
18
- for (const [key,item] of Object.entries(value)) {
19
- if (!SAFE_LINEAGE_KEYS.has(key)) continue;
20
- if (typeof item === 'string' && item.length <= 256 && !/https?:\/\//i.test(item)) out[key]=item;
21
- else if (typeof item === 'number' && Number.isFinite(item)) out[key]=item;
22
- else if (typeof item === 'boolean') out[key]=item;
23
- }
24
- return Object.keys(out).length ? out : null;
25
- };
26
-
27
- const fail = (code, message, details = undefined) => {
28
- const error = new Error(message);
29
- error.code = code;
30
- if (details !== undefined) error.details = details;
31
- throw error;
32
- };
33
-
34
- const normalizeBytes = (value, label) => {
35
- if (value instanceof Uint8Array) return value;
36
- if (value instanceof ArrayBuffer) return new Uint8Array(value);
37
- if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
38
- fail('EMBODIEDGEN_ARTIFACT_BYTES_MISSING', `Missing bytes for ${label}.`);
39
- };
40
-
41
- const sha256Hex = async (bytes) => {
42
- const subtle = globalThis.crypto?.subtle;
43
- if (!subtle) fail('EMBODIEDGEN_CRYPTO_UNAVAILABLE', 'WebCrypto SHA-256 is unavailable.');
44
- const digest = new Uint8Array(await subtle.digest('SHA-256', bytes));
45
- return Array.from(digest, (value) => value.toString(16).padStart(2, '0')).join('');
46
- };
47
-
48
- const artifactBytesFor = (artifactBytes, descriptor) => {
49
- if (artifactBytes instanceof Map) return artifactBytes.get(descriptor.id) ?? artifactBytes.get(descriptor.role);
50
- if (artifactBytes && typeof artifactBytes === 'object') return artifactBytes[descriptor.id] ?? artifactBytes[descriptor.role];
51
- return undefined;
52
- };
53
-
54
- const assertDescriptor = (descriptor, seenIds, seenRoles) => {
55
- if (!descriptor || typeof descriptor !== 'object') fail('EMBODIEDGEN_ARTIFACT_DESCRIPTOR_INVALID', 'Artifact descriptor must be an object.');
56
- const id = String(descriptor.id || '').trim();
57
- const role = String(descriptor.role || '').trim();
58
- const mediaType = String(descriptor.mediaType || descriptor.mime || '').trim().toLowerCase();
59
- const sha256 = String(descriptor.sha256 || '').trim().toLowerCase();
60
- if (!id || !role || !mediaType || !HEX_SHA256.test(sha256)) {
61
- fail('EMBODIEDGEN_ARTIFACT_DESCRIPTOR_INVALID', 'Artifact descriptor requires id, role, mediaType and SHA-256.', { id:id || null, role:role || null });
62
- }
63
- if (seenIds.has(id)) fail('EMBODIEDGEN_ARTIFACT_ID_DUPLICATE', `Duplicate artifact id: ${id}`);
64
- if (seenRoles.has(role)) fail('EMBODIEDGEN_ARTIFACT_ROLE_DUPLICATE', `Duplicate artifact role: ${role}`);
65
- seenIds.add(id); seenRoles.add(role);
66
- return {
67
- id, role, mediaType, sha256,
68
- ...(descriptor.fileName ? { fileName:safeRelativeRef(descriptor.fileName, `${id}.fileName`) } : {}),
69
- ...(descriptor.path ? { path:safeRelativeRef(descriptor.path, `${id}.path`) } : {}),
70
- ...(Number.isInteger(descriptor.bytes) && descriptor.bytes >= 0 ? { bytes:descriptor.bytes } : {})
71
- };
72
- };
73
-
74
- const assertHash = async (descriptor, bytes) => {
75
- if (Number.isInteger(descriptor.bytes) && descriptor.bytes !== bytes.byteLength) {
76
- fail('EMBODIEDGEN_ARTIFACT_SIZE_MISMATCH', `Artifact byte size mismatch for ${descriptor.id}.`, { expected:descriptor.bytes, actual:bytes.byteLength });
77
- }
78
- const actual = await sha256Hex(bytes);
79
- if (actual !== descriptor.sha256) {
80
- fail('EMBODIEDGEN_ARTIFACT_HASH_MISMATCH', `Artifact SHA-256 mismatch for ${descriptor.id}.`, { expected:descriptor.sha256, actual });
81
- }
82
- return actual;
83
- };
84
-
85
- const parseJsonArtifact = (descriptor, bytes) => {
86
- if (!['application/json', 'application/vnd.agentscape.part-segmentation+json'].includes(descriptor.mediaType)) {
87
- fail('EMBODIEDGEN_ARTIFACT_MEDIA_TYPE_INVALID', `Unsupported JSON artifact media type for ${descriptor.role}: ${descriptor.mediaType}`);
88
- }
89
- try { return JSON.parse(new TextDecoder().decode(bytes)); }
90
- catch (error) { fail('EMBODIEDGEN_ARTIFACT_JSON_INVALID', `Invalid JSON artifact for ${descriptor.role}: ${error.message}`); }
91
- };
92
-
93
- const validateSegmentation = (evidence, primary) => {
94
- if (!evidence || evidence.version !== 1 || !evidence.source || !Number.isInteger(evidence.faceCount) || evidence.faceCount <= 0 || !Array.isArray(evidence.segments)) {
95
- fail('EMBODIEDGEN_SEGMENTATION_INVALID', 'Part segmentation must be Segmentation Evidence v1.');
96
- }
97
- const boundSha = String(evidence.artifact?.sha256 || '').toLowerCase();
98
- if (!HEX_SHA256.test(boundSha) || boundSha !== primary.sha256) {
99
- fail('EMBODIEDGEN_SEGMENTATION_GLB_MISMATCH', 'Part segmentation is not bound to the primary GLB SHA-256.', { primarySha256:primary.sha256, segmentationGlbSha256:boundSha || null });
100
- }
101
- const materialization = evidence.materialization;
102
- if (!materialization?.sourceNode || !Array.isArray(materialization.primitives) || !materialization.primitives.length) {
103
- fail('EMBODIEDGEN_SEGMENTATION_MATERIALIZATION_INVALID', 'Part segmentation requires sourceNode and primitive face labels.');
104
- }
105
- for (const entry of materialization.primitives) {
106
- if (!Number.isInteger(entry?.primitive) || entry.primitive < 0 || !Array.isArray(entry.faceLabels) || !entry.faceLabels.length) {
107
- fail('EMBODIEDGEN_SEGMENTATION_MATERIALIZATION_INVALID', 'Each segmentation primitive requires primitive>=0 and non-empty faceLabels[].');
108
- }
109
- }
110
- };
111
-
112
-
113
- const GRASP_MAX_BYTES = 2 * 1024 * 1024;
114
- const GRASP_MAX_CANDIDATES = 256;
115
- const GRASP_SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,159}$/;
116
- const FORBIDDEN_GRASP_KEYS = /(actions?|pickup|held|runtime[-_]?verified|(^|[_-])verified($|[_-])|authorization|api[-_]?key|token|secret|credential|signed[-_]?url|(^|[_-])url($|[_-])|(^|[_-])path($|[_-])|prompt|image[-_]?bytes|base64)/i;
117
-
118
- const safeGraspText=(value,label,max=160)=>{
119
- const text=String(value ?? '').trim();
120
- if (!text || text.length>max || /[\u0000-\u001f\u007f]/.test(text) || /https?:\/\/|Bearer\s+/i.test(text)) {
121
- fail('EMBODIEDGEN_GRASP_INVALID',`${label} must be bounded safe text.`);
122
- }
123
- return text;
124
- };
125
-
126
- const rejectForbiddenGraspFields=(value,path='graspEvidence')=>{
127
- if (!value || typeof value!=='object') return;
128
- if (Array.isArray(value)) {
129
- value.forEach((item,index)=>rejectForbiddenGraspFields(item,`${path}[${index}]`));
130
- return;
131
- }
132
- for (const [key,item] of Object.entries(value)) {
133
- if (FORBIDDEN_GRASP_KEYS.test(key)) {
134
- fail('EMBODIEDGEN_GRASP_FORBIDDEN_FIELD',`Grasp evidence contains forbidden execution/transport field: ${path}.${key}`);
135
- }
136
- rejectForbiddenGraspFields(item,`${path}.${key}`);
137
- }
138
- };
139
-
140
- const determinant3=(m)=>
141
- m[0][0]*(m[1][1]*m[2][2]-m[1][2]*m[2][1])-
142
- m[0][1]*(m[1][0]*m[2][2]-m[1][2]*m[2][0])+
143
- m[0][2]*(m[1][0]*m[2][1]-m[1][1]*m[2][0]);
144
- const dot3=(a,b)=>a[0]*b[0]+a[1]*b[1]+a[2]*b[2];
145
- const rigidGraspPose=(value,label)=>{
146
- if (!Array.isArray(value) || value.length!==4 || value.some((row)=>!Array.isArray(row)||row.length!==4||!row.every(Number.isFinite))) {
147
- fail('EMBODIEDGEN_GRASP_INVALID',`${label} requires finite 4x4 pose.`);
148
- }
149
- const pose=value.map((row)=>row.map(Number));
150
- const tail=pose[3];
151
- if (Math.abs(tail[0])>1e-6 || Math.abs(tail[1])>1e-6 || Math.abs(tail[2])>1e-6 || Math.abs(tail[3]-1)>1e-6) {
152
- fail('EMBODIEDGEN_GRASP_INVALID',`${label} must be affine with [0,0,0,1] final row.`);
153
- }
154
- const r=pose.slice(0,3).map((row)=>row.slice(0,3));
155
- for (let i=0;i<3;i++) {
156
- if (Math.abs(dot3(r[i],r[i])-1)>1e-3) fail('EMBODIEDGEN_GRASP_INVALID',`${label} rotation rows must be unit length.`);
157
- for (let j=i+1;j<3;j++) if (Math.abs(dot3(r[i],r[j]))>1e-3) fail('EMBODIEDGEN_GRASP_INVALID',`${label} rotation rows must be orthogonal.`);
158
- }
159
- if (Math.abs(determinant3(r)-1)>1e-3) fail('EMBODIEDGEN_GRASP_INVALID',`${label} rotation must be right-handed.`);
160
- for (let i=0;i<3;i++) if (Math.abs(pose[i][3])>1e6) fail('EMBODIEDGEN_GRASP_INVALID',`${label} translation exceeds bounded evidence range.`);
161
- return pose;
162
- };
163
-
164
- const normalizeGraspEvidence=(payload,{role,descriptor,bundleSourceJobId=null})=>{
165
- if (!payload || typeof payload!=='object' || Array.isArray(payload) || payload.version!==1 || !Array.isArray(payload.grasps)) {
166
- fail('EMBODIEDGEN_GRASP_INVALID',`${role} must be Grasp Evidence v1 with grasps[].`);
167
- }
168
- rejectForbiddenGraspFields(payload);
169
- if (payload.grasps.length>GRASP_MAX_CANDIDATES) fail('EMBODIEDGEN_GRASP_INVALID',`${role} exceeds ${GRASP_MAX_CANDIDATES} grasp candidates.`);
170
- const expectedLevel=role==='sapien_grasps'?'simulator-validated':'raw';
171
- if (String(payload.evidence_level||'')!==expectedLevel) {
172
- fail('EMBODIEDGEN_GRASP_INVALID',`${role} requires evidence_level=${expectedLevel}.`);
173
- }
174
- const sourceJobId=payload.source_job_id==null?null:String(payload.source_job_id).trim();
175
- const outputJobId=payload.output_job_id==null?null:String(payload.output_job_id).trim();
176
- if (sourceJobId && !JOB_ID.test(sourceJobId)) fail('EMBODIEDGEN_GRASP_INVALID',`${role} source_job_id is invalid.`);
177
- if (outputJobId && !JOB_ID.test(outputJobId)) fail('EMBODIEDGEN_GRASP_INVALID',`${role} output_job_id is invalid.`);
178
- if (bundleSourceJobId && sourceJobId && sourceJobId!==bundleSourceJobId) {
179
- fail('EMBODIEDGEN_GRASP_SOURCE_MISMATCH',`${role} source_job_id does not match bundle sourceJobId.`,{bundleSourceJobId,graspSourceJobId:sourceJobId});
180
- }
181
- const gripper=safeGraspText(payload.gripper,`${role}.gripper`,120);
182
- if (!GRASP_SAFE_ID.test(gripper)) fail('EMBODIEDGEN_GRASP_INVALID',`${role}.gripper must be a stable identifier.`);
183
- const sourceFrame=safeGraspText(payload.source_frame,`${role}.source_frame`,160);
184
- const backend=safeGraspText(payload.backend,`${role}.backend`,120);
185
- const seenRanks=new Set();
186
- let topScore=null;
187
- payload.grasps.forEach((grasp,index)=>{
188
- if (!grasp || typeof grasp!=='object' || Array.isArray(grasp)) fail('EMBODIEDGEN_GRASP_INVALID',`${role}.grasps[${index}] must be an object.`);
189
- const rank=Number(grasp.rank);
190
- const score=Number(grasp.score);
191
- if (!Number.isSafeInteger(rank)||rank<0||seenRanks.has(rank)) fail('EMBODIEDGEN_GRASP_INVALID',`${role}.grasps[${index}].rank must be unique non-negative integer.`);
192
- seenRanks.add(rank);
193
- if (!Number.isFinite(score)||score<0||score>1) fail('EMBODIEDGEN_GRASP_INVALID',`${role}.grasps[${index}].score must be within [0,1].`);
194
- rigidGraspPose(grasp.pose,`${role}.grasps[${index}].pose`);
195
- topScore=topScore==null?score:Math.max(topScore,score);
196
- });
197
- if (payload.seed!=null && !Number.isSafeInteger(Number(payload.seed))) fail('EMBODIEDGEN_GRASP_INVALID',`${role}.seed must be a safe integer.`);
198
- return {
199
- artifactId:descriptor.id,
200
- sha256:descriptor.sha256,
201
- status:'verified',
202
- evidenceLevel:expectedLevel,
203
- count:payload.grasps.length,
204
- topScore,
205
- gripper,
206
- sourceFrame,
207
- backend,
208
- sourceJobId,
209
- outputJobId,
210
- ...(payload.seed==null?{}:{seed:Number(payload.seed)})
211
- };
212
- };
213
-
214
- const URDF_PROPOSAL_MAX_PARTS = 128;
215
- const URDF_MAX_BYTES = 5 * 1024 * 1024;
216
- const URDF_JOINT_TYPES = new Set(['revolute','prismatic','continuous']);
217
- const URDF_PART_ID = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,159}$/;
218
- const FORBIDDEN_URDF_KEYS = /(actions?|physics|targets?|motor|authorization|api[-_]?key|token|secret|credential|signed[-_]?url|(^|[_-])url($|[_-])|(^|[_-])path($|[_-])|prompt|pose|remote.*id|function.*id)/i;
219
-
220
- const safeEvidenceText = (value, label, { allowRoot = false } = {}) => {
221
- const text=String(value ?? '').trim();
222
- if (allowRoot && text === '$root') return text;
223
- if (!text || text.length > 160 || /[\u0000-\u001f\u007f]/.test(text) || /https?:\/\/|Bearer\s+/i.test(text)) {
224
- fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `${label} must be bounded safe text.`);
225
- }
226
- return text;
227
- };
228
-
229
- const finiteVector = (value, length, label) => {
230
- if (!Array.isArray(value) || value.length !== length || !value.every(Number.isFinite)) {
231
- fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `${label} requires finite [${length}].`);
232
- }
233
- return value.map(Number);
234
- };
235
-
236
- const finiteMatrix4 = (value, label) => {
237
- if (!Array.isArray(value) || value.length !== 4 || value.some((row) => !Array.isArray(row) || row.length !== 4 || !row.every(Number.isFinite))) {
238
- fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `${label} requires finite 4x4 matrix.`);
239
- }
240
- return value.map((row) => row.map(Number));
241
- };
242
-
243
- const rejectForbiddenUrdfFields = (value, path = 'partProposal') => {
244
- if (!value || typeof value !== 'object') return;
245
- if (Array.isArray(value)) {
246
- value.forEach((item,index) => rejectForbiddenUrdfFields(item, `${path}[${index}]`));
247
- return;
248
- }
249
- for (const [key,item] of Object.entries(value)) {
250
- if (FORBIDDEN_URDF_KEYS.test(key)) {
251
- fail('EMBODIEDGEN_URDF_PROPOSAL_FORBIDDEN_FIELD', `URDF proposal contains forbidden executable/transport field: ${path}.${key}`);
252
- }
253
- rejectForbiddenUrdfFields(item, `${path}.${key}`);
254
- }
255
- };
256
-
257
- const normalizeUrdfProposal = (payload) => {
258
- const proposal=payload?.partProposal;
259
- if (!proposal || proposal.version !== 1 || proposal.source !== 'urdf/yourdfpy' || proposal.frameConvention !== 'urdf-link-local' || !Array.isArray(proposal.parts)) {
260
- fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', 'URDF proposal requires Part Proposal v1 from urdf/yourdfpy with urdf-link-local frameConvention.');
261
- }
262
- if (proposal.parts.length > URDF_PROPOSAL_MAX_PARTS) {
263
- fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal exceeds ${URDF_PROPOSAL_MAX_PARTS} movable parts.`);
264
- }
265
- rejectForbiddenUrdfFields(proposal);
266
- const seen=new Set();
267
- const seenNodes=new Set();
268
- const parts=proposal.parts.map((raw,index) => {
269
- if (!raw || typeof raw !== 'object' || Array.isArray(raw)) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal part ${index} must be an object.`);
270
- const id=safeEvidenceText(raw.id, `parts[${index}].id`);
271
- if (!URDF_PART_ID.test(id) || id === '$root') fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal part id is not a stable identifier: ${id}`);
272
- if (seen.has(id)) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `Duplicate URDF proposal part id: ${id}`);
273
- seen.add(id);
274
- const node=safeEvidenceText(raw.node, `parts[${index}].node`);
275
- if (seenNodes.has(node)) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `Duplicate URDF proposal child node: ${node}`);
276
- seenNodes.add(node);
277
- const parent=safeEvidenceText(raw.parent || '$root', `parts[${index}].parent`, { allowRoot:true });
278
- if (parent !== '$root' && !URDF_PART_ID.test(parent)) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal parent is not a stable identifier: ${parent}`);
279
- const joint=raw.joint;
280
- if (!joint || typeof joint !== 'object' || Array.isArray(joint) || !URDF_JOINT_TYPES.has(joint.type)) {
281
- fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal part ${id} requires revolute/prismatic/continuous joint.`);
282
- }
283
- const axis=finiteVector(joint.axis,3,`parts[${index}].joint.axis`);
284
- if (Math.hypot(...axis) < 1e-9) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal part ${id} has zero joint axis.`);
285
- let limits;
286
- if (joint.limits != null) {
287
- limits=finiteVector(joint.limits,2,`parts[${index}].joint.limits`);
288
- if (limits[0] >= limits[1]) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal part ${id} has invalid joint limits.`);
289
- }
290
- const urdf=joint.urdf;
291
- if (!urdf || typeof urdf !== 'object' || Array.isArray(urdf)) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal part ${id} requires urdf metadata.`);
292
- const normalizedUrdf={
293
- name:safeEvidenceText(urdf.name, `parts[${index}].joint.urdf.name`),
294
- parentLink:safeEvidenceText(urdf.parentLink, `parts[${index}].joint.urdf.parentLink`),
295
- childLink:safeEvidenceText(urdf.childLink, `parts[${index}].joint.urdf.childLink`),
296
- originMatrix:finiteMatrix4(urdf.originMatrix,`parts[${index}].joint.urdf.originMatrix`),
297
- parentToJointMatrix:finiteMatrix4(urdf.parentToJointMatrix,`parts[${index}].joint.urdf.parentToJointMatrix`)
298
- };
299
- const confidence=Number(raw.confidence ?? proposal.confidence ?? 0);
300
- if (!Number.isFinite(confidence) || confidence < 0 || confidence > 1) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal part ${id} confidence must be within [0,1].`);
301
- return {
302
- id,node,parent,
303
- joint:{type:joint.type,axis,...(limits?{limits}:{}),urdf:normalizedUrdf},
304
- confidence
305
- };
306
- });
307
- const ids=new Set(parts.map((part)=>part.id));
308
- for (const part of parts) {
309
- if (part.parent === part.id) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal part cannot parent itself: ${part.id}`);
310
- if (part.parent !== '$root' && !ids.has(part.parent)) {
311
- fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal parent does not exist: ${part.parent}`);
312
- }
313
- }
314
- const byId=new Map(parts.map((part)=>[part.id,part]));
315
- for (const part of parts) {
316
- const visited=new Set([part.id]);
317
- let parent=part.parent;
318
- while (parent !== '$root') {
319
- if (visited.has(parent)) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', `URDF proposal hierarchy contains a cycle at ${parent}`);
320
- visited.add(parent);
321
- parent=byId.get(parent)?.parent || '$root';
322
- }
323
- }
324
- const confidence=Number(proposal.confidence ?? 0);
325
- if (!Number.isFinite(confidence) || confidence < 0 || confidence > 1) fail('EMBODIEDGEN_URDF_PROPOSAL_INVALID', 'URDF proposal confidence must be within [0,1].');
326
- return {version:1,source:'urdf/yourdfpy',frameConvention:'urdf-link-local',confidence,parts};
327
- };
328
-
329
- const SEMANTIC_MAX_BYTES = 1024 * 1024;
330
- const SEMANTIC_SAFE_TEXT = /^[^\u0000-\u001f\u007f]{1,800}$/;
331
- const SEMANTIC_FORBIDDEN_KEYS = /(joint|axis|anchors?|limits?|motor|actions?|targets?|pickup|runtime[-_]?verified|(^|[_-])verified($|[_-])|authorization|api[-_]?key|token|secret|credential|signed[-_]?url|(^|[_-])url($|[_-])|(^|[_-])path($|[_-])|image[-_]?bytes|base64)/i;
332
-
333
- const safeSemanticText=(value,label,max=800)=>{
334
- const text=String(value ?? '').trim();
335
- if (!text || text.length>max || !SEMANTIC_SAFE_TEXT.test(text) || /https?:\/\/|Bearer\s+/i.test(text)) {
336
- fail('EMBODIEDGEN_SEMANTICS_INVALID',`${label} must be bounded safe text.`);
337
- }
338
- return text;
339
- };
340
-
341
- const rejectForbiddenSemanticFields=(value,path='partSemantics')=>{
342
- if (!value || typeof value!=='object') return;
343
- if (Array.isArray(value)) {
344
- value.forEach((item,index)=>rejectForbiddenSemanticFields(item,`${path}[${index}]`));
345
- return;
346
- }
347
- for (const [key,item] of Object.entries(value)) {
348
- if (SEMANTIC_FORBIDDEN_KEYS.test(key)) {
349
- fail('EMBODIEDGEN_SEMANTICS_FORBIDDEN_FIELD',`Part semantics contains forbidden executable/secret field: ${path}.${key}`);
350
- }
351
- rejectForbiddenSemanticFields(item,`${path}.${key}`);
352
- }
353
- };
354
-
355
- const normalizeSemanticEvidence=(payload,{descriptor,bundleSourceJobId,segmentation,segmentationDescriptor})=>{
356
- if (!payload || typeof payload!=='object' || Array.isArray(payload) || payload.version!==1 || payload.source!=='embodiedgen/gpt-part-semantics' || payload.profile!=='part-semantics-v1' || !Array.isArray(payload.parts)) {
357
- fail('EMBODIEDGEN_SEMANTICS_INVALID','part_semantics must be EmbodiedGen Part Semantics v1.');
358
- }
359
- rejectForbiddenSemanticFields(payload);
360
- const sourceJobId=String(payload.sourceJobId || '').trim();
361
- const outputJobId=String(payload.outputJobId || '').trim();
362
- if (!JOB_ID.test(sourceJobId) || !JOB_ID.test(outputJobId)) fail('EMBODIEDGEN_SEMANTICS_INVALID','part_semantics requires valid sourceJobId/outputJobId.');
363
- if (bundleSourceJobId && sourceJobId!==bundleSourceJobId) {
364
- fail('EMBODIEDGEN_SEMANTICS_SOURCE_MISMATCH','part_semantics sourceJobId does not match bundle sourceJobId.',{bundleSourceJobId,semanticSourceJobId:sourceJobId});
365
- }
366
- const boundSegmentationSha=String(payload.input?.segmentationSha256 || '').toLowerCase();
367
- if (!HEX_SHA256.test(boundSegmentationSha) || boundSegmentationSha!==segmentationDescriptor.sha256) {
368
- fail('EMBODIEDGEN_SEMANTICS_SEGMENTATION_MISMATCH','part_semantics is not bound to the bundle part_segmentation SHA-256.',{expected:segmentationDescriptor.sha256,actual:boundSegmentationSha||null});
369
- }
370
- const expectedIds=new Set((segmentation?.segments || []).map((item)=>String(item?.id ?? '')).filter(Boolean));
371
- if (!expectedIds.size) fail('EMBODIEDGEN_SEMANTICS_INVALID','part_semantics requires non-empty segmentation IDs.');
372
- const seen=new Set();
373
- const parts=[];
374
- for (let index=0;index<payload.parts.length;index++) {
375
- const raw=payload.parts[index];
376
- if (!raw || typeof raw!=='object' || Array.isArray(raw)) fail('EMBODIEDGEN_SEMANTICS_INVALID',`part_semantics.parts[${index}] must be an object.`);
377
- const rawId=raw.id;
378
- const id=typeof rawId==='number' && Number.isSafeInteger(rawId) ? String(rawId) : String(rawId ?? '').trim();
379
- if (!id || !expectedIds.has(id) || seen.has(id)) fail('EMBODIEDGEN_SEMANTICS_INVALID',`Invalid or duplicate semantic part id: ${id||'<missing>'}.`);
380
- seen.add(id);
381
- const maskColor=safeSemanticText(raw.mask_color,`parts[${index}].mask_color`,80);
382
- const partName=safeSemanticText(raw.part_name,`parts[${index}].part_name`,160);
383
- if (typeof raw.graspable!=='boolean') fail('EMBODIEDGEN_SEMANTICS_INVALID',`parts[${index}].graspable must be boolean.`);
384
- const scenarios=raw.grasp_scenarios;
385
- if (!Array.isArray(scenarios) || scenarios.length>8) fail('EMBODIEDGEN_SEMANTICS_INVALID',`parts[${index}].grasp_scenarios must be a bounded list.`);
386
- if (raw.graspable && !scenarios.length) fail('EMBODIEDGEN_SEMANTICS_INVALID',`Graspable semantic part ${id} requires a grasp scenario.`);
387
- if (!raw.graspable && scenarios.length) fail('EMBODIEDGEN_SEMANTICS_INVALID',`Non-graspable semantic part ${id} must not claim grasp scenarios.`);
388
- const normalizedScenarios=scenarios.map((scenario,scenarioIndex)=>{
389
- if (!scenario || typeof scenario!=='object' || Array.isArray(scenario) || new Set(Object.keys(scenario)).size!==2 || !Object.hasOwn(scenario,'scenario') || !Object.hasOwn(scenario,'confidence')) {
390
- fail('EMBODIEDGEN_SEMANTICS_INVALID',`parts[${index}].grasp_scenarios[${scenarioIndex}] has invalid schema.`);
391
- }
392
- const text=safeSemanticText(scenario.scenario,`parts[${index}].grasp_scenarios[${scenarioIndex}].scenario`,280);
393
- const confidence=Number(scenario.confidence);
394
- if (!Number.isFinite(confidence) || confidence<0 || confidence>1) fail('EMBODIEDGEN_SEMANTICS_INVALID',`parts[${index}].grasp_scenarios[${scenarioIndex}].confidence must be within [0,1].`);
395
- return {scenario:text,confidence};
396
- });
397
- if (!Array.isArray(raw.functional_labels) || raw.functional_labels.length<1 || raw.functional_labels.length>8) {
398
- fail('EMBODIEDGEN_SEMANTICS_INVALID',`parts[${index}].functional_labels must contain 1..8 labels.`);
399
- }
400
- const functionalLabels=raw.functional_labels.map((label,labelIndex)=>safeSemanticText(label,`parts[${index}].functional_labels[${labelIndex}]`,160));
401
- const description=safeSemanticText(raw.semantic_description,`parts[${index}].semantic_description`,800);
402
- parts.push({id,maskColor,partName,graspable:raw.graspable,graspScenarios:normalizedScenarios,functionalLabels,description});
403
- }
404
- if (seen.size!==expectedIds.size || [...expectedIds].some((id)=>!seen.has(id))) {
405
- fail('EMBODIEDGEN_SEMANTICS_ID_COVERAGE','part_semantics IDs must exactly cover segmentation IDs.',{semanticIds:[...seen].sort(),segmentationIds:[...expectedIds].sort()});
406
- }
407
- const model=safeSemanticText(payload.provenance?.model,'provenance.model',200);
408
- const apiStyle=safeSemanticText(payload.provenance?.apiStyle,'provenance.apiStyle',80);
409
- const promptRevision=String(payload.provenance?.promptRevision || '').toLowerCase();
410
- if (!HEX_SHA256.test(promptRevision)) fail('EMBODIEDGEN_SEMANTICS_INVALID','provenance.promptRevision must be SHA-256.');
411
- return {
412
- evidence:{
413
- artifactId:descriptor.id,sha256:descriptor.sha256,status:'verified',source:payload.source,profile:payload.profile,
414
- sourceJobId,outputJobId,partCount:parts.length,model,apiStyle,promptRevision,
415
- parts:parts.map(({id,partName,graspable,functionalLabels,graspScenarios})=>({id,partName,graspable,functionalLabels,graspScenarioCount:graspScenarios.length}))
416
- },
417
- proposal:{
418
- version:1,source:'embodiedgen/gpt-part-semantics',confidence:0,
419
- parts:parts.map((part)=>({id:part.id,semantic:part.partName,confidence:0}))
420
- }
421
- };
422
- };
423
-
424
- const safeErrorCode = (error) => {
425
- const code=String(error?.code || error?.name || 'URDF_PROPOSAL_FAILED').trim();
426
- return /^[A-Za-z0-9._:-]{1,120}$/.test(code) ? code : 'URDF_PROPOSAL_FAILED';
427
- };
428
-
429
- const evidenceLevel = (roles, urdfStatus = 'none', graspLevel = 'none', semanticLevel = 'none') => ({
430
- partSegmentation: roles.has('part_segmentation') ? 'provider' : 'none',
431
- partSemantics: semanticLevel === 'none' && roles.has('part_semantics') ? 'provider-unverified' : semanticLevel,
432
- grasps:graspLevel,
433
- urdf:urdfStatus
434
- });
435
-
436
- export class EmbodiedGenBundleAdapter {
437
- constructor({ compilerProvider = null } = {}) { this.compilerProvider=compilerProvider; }
438
-
439
- /**
440
- * Convert a versioned EmbodiedGen artifact bundle into existing AssetCompiler input.
441
- * This adapter preserves provider evidence; it never creates a runtime Manifest.
442
- */
443
- async prepare(bundle, { artifactBytes = {} } = {}) {
444
- if (!bundle || bundle.version !== 1 || bundle.provider !== 'embodiedgen' || !Array.isArray(bundle.artifacts)) {
445
- fail('EMBODIEDGEN_BUNDLE_INVALID', 'EmbodiedGen bundle requires version=1, provider="embodiedgen" and artifacts[].');
446
- }
447
- const sourceJobId = String(bundle.sourceJobId || bundle.job?.id || '').trim();
448
- if (sourceJobId && !JOB_ID.test(sourceJobId)) fail('EMBODIEDGEN_JOB_ID_INVALID', `Invalid EmbodiedGen source job id: ${sourceJobId}`);
449
-
450
- const seenIds = new Set(); const seenRoles = new Set();
451
- const descriptors = bundle.artifacts.map((descriptor) => assertDescriptor(descriptor, seenIds, seenRoles));
452
- const byRole = new Map(descriptors.map((descriptor) => [descriptor.role, descriptor]));
453
- const primary = byRole.get('primary_glb');
454
- if (!primary) fail('EMBODIEDGEN_PRIMARY_GLB_MISSING', 'EmbodiedGen bundle requires exactly one primary_glb artifact.');
455
- if (primary.mediaType !== 'model/gltf-binary') {
456
- fail('EMBODIEDGEN_PRIMARY_GLB_MEDIA_TYPE_INVALID', `primary_glb must use model/gltf-binary, got ${primary.mediaType}.`);
457
- }
458
- const primaryBytes = normalizeBytes(artifactBytesFor(artifactBytes, primary), primary.id);
459
- await assertHash(primary, primaryBytes);
460
-
461
- const verifiedRoles=new Set(['primary_glb']);
462
- let partSegmentation = null;
463
- const segmentationDescriptor = byRole.get('part_segmentation');
464
- if (segmentationDescriptor) {
465
- const segmentationBytes = normalizeBytes(artifactBytesFor(artifactBytes, segmentationDescriptor), segmentationDescriptor.id);
466
- await assertHash(segmentationDescriptor, segmentationBytes);
467
- verifiedRoles.add('part_segmentation');
468
- partSegmentation = parseJsonArtifact(segmentationDescriptor, segmentationBytes);
469
- validateSegmentation(partSegmentation, primary);
470
- }
471
-
472
- let semanticProposal=null;
473
- let semanticEvidence=null;
474
- let semanticLevel='none';
475
- const semanticDescriptor=byRole.get('part_semantics');
476
- if (semanticDescriptor) {
477
- if (!segmentationDescriptor || !partSegmentation) {
478
- fail('EMBODIEDGEN_SEMANTICS_REQUIRES_SEGMENTATION','part_semantics requires verified part_segmentation in the same bundle.');
479
- }
480
- if (semanticDescriptor.mediaType!=='application/json') fail('EMBODIEDGEN_SEMANTICS_MEDIA_TYPE_INVALID','part_semantics must use application/json.');
481
- const rawSemanticBytes=artifactBytesFor(artifactBytes,semanticDescriptor);
482
- if (rawSemanticBytes == null) {
483
- semanticEvidence={artifactId:semanticDescriptor.id,sha256:semanticDescriptor.sha256,status:'descriptor-only'};
484
- semanticLevel='provider-unverified';
485
- } else {
486
- const semanticBytes=normalizeBytes(rawSemanticBytes,semanticDescriptor.id);
487
- if (semanticBytes.byteLength>SEMANTIC_MAX_BYTES) fail('EMBODIEDGEN_SEMANTICS_TOO_LARGE',`part_semantics exceeds ${SEMANTIC_MAX_BYTES} bytes.`,{bytes:semanticBytes.byteLength,maxBytes:SEMANTIC_MAX_BYTES});
488
- await assertHash(semanticDescriptor,semanticBytes);
489
- const semanticPayload=parseJsonArtifact(semanticDescriptor,semanticBytes);
490
- const normalized=normalizeSemanticEvidence(semanticPayload,{descriptor:semanticDescriptor,bundleSourceJobId:sourceJobId||null,segmentation:partSegmentation,segmentationDescriptor});
491
- semanticEvidence=normalized.evidence;
492
- semanticProposal=normalized.proposal;
493
- semanticLevel='provider-verified';
494
- verifiedRoles.add('part_semantics');
495
- }
496
- }
497
-
498
- let partProposal=null;
499
- let urdfEvidence=null;
500
- let urdfStatus='none';
501
- const urdfDescriptor=byRole.get('source_urdf');
502
- if (urdfDescriptor) {
503
- if (!['application/xml','text/xml','application/urdf+xml'].includes(urdfDescriptor.mediaType)) {
504
- fail('EMBODIEDGEN_URDF_MEDIA_TYPE_INVALID', `source_urdf has unsupported media type: ${urdfDescriptor.mediaType}`);
505
- }
506
- const urdfBytes=normalizeBytes(artifactBytesFor(artifactBytes,urdfDescriptor),urdfDescriptor.id);
507
- if (urdfBytes.byteLength > URDF_MAX_BYTES) {
508
- fail('EMBODIEDGEN_URDF_TOO_LARGE', `source_urdf exceeds ${URDF_MAX_BYTES} bytes.`, { bytes:urdfBytes.byteLength, maxBytes:URDF_MAX_BYTES });
509
- }
510
- await assertHash(urdfDescriptor,urdfBytes);
511
- verifiedRoles.add('source_urdf');
512
- urdfStatus='verified-bytes-only';
513
- urdfEvidence={artifactId:urdfDescriptor.id,sha256:urdfDescriptor.sha256,status:urdfStatus,parser:null,partCount:null,frameConvention:null};
514
- const parser=this.compilerProvider;
515
- const canParse=typeof parser?.runUrdfProposal === 'function' && (typeof parser.isConfigured !== 'function' || parser.isConfigured());
516
- if (canParse) {
517
- try {
518
- partProposal=normalizeUrdfProposal(await parser.runUrdfProposal(urdfBytes));
519
- urdfStatus='service-parsed';
520
- urdfEvidence={
521
- artifactId:urdfDescriptor.id,sha256:urdfDescriptor.sha256,status:urdfStatus,
522
- parser:'asset-compiler/yourdfpy',partCount:partProposal.parts.length,frameConvention:partProposal.frameConvention
523
- };
524
- } catch (error) {
525
- partProposal=null;
526
- urdfStatus='parse-rejected';
527
- urdfEvidence={
528
- artifactId:urdfDescriptor.id,sha256:urdfDescriptor.sha256,status:urdfStatus,
529
- parser:'asset-compiler/yourdfpy',partCount:null,frameConvention:null,errorCode:safeErrorCode(error)
530
- };
531
- }
532
- }
533
- }
534
-
535
- let semanticProposalApplied=false;
536
- if (semanticProposal && (!partProposal || !Array.isArray(partProposal.parts) || partProposal.parts.length===0)) {
537
- partProposal=semanticProposal;
538
- semanticProposalApplied=true;
539
- }
540
-
541
- const graspEvidence={};
542
- for (const role of ['raw_grasps','sapien_grasps']) {
543
- const descriptor=byRole.get(role);
544
- if (!descriptor) continue;
545
- if (descriptor.mediaType!=='application/json') fail('EMBODIEDGEN_GRASP_MEDIA_TYPE_INVALID',`${role} must use application/json.`);
546
- const rawBytes=artifactBytesFor(artifactBytes,descriptor);
547
- if (rawBytes == null) {
548
- graspEvidence[role]={artifactId:descriptor.id,sha256:descriptor.sha256,status:'descriptor-only'};
549
- continue;
550
- }
551
- const bytes=normalizeBytes(rawBytes,descriptor.id);
552
- if (bytes.byteLength>GRASP_MAX_BYTES) fail('EMBODIEDGEN_GRASP_TOO_LARGE',`${role} exceeds ${GRASP_MAX_BYTES} bytes.`,{bytes:bytes.byteLength,maxBytes:GRASP_MAX_BYTES});
553
- await assertHash(descriptor,bytes);
554
- const payload=parseJsonArtifact(descriptor,bytes);
555
- graspEvidence[role]=normalizeGraspEvidence(payload,{role,descriptor,bundleSourceJobId:sourceJobId||null});
556
- verifiedRoles.add(role);
557
- }
558
- const graspLevel = graspEvidence.sapien_grasps?.status==='verified' ? 'sapien-validated-provider-only'
559
- : graspEvidence.raw_grasps?.status==='verified' ? 'raw-provider-only'
560
- : graspEvidence.sapien_grasps ? 'sapien-provider-unverified'
561
- : graspEvidence.raw_grasps ? 'raw-provider-unverified'
562
- : 'none';
563
-
564
- const providerEvidence = {
565
- provider:'embodiedgen',
566
- bundleVersion:1,
567
- sourceJobId:sourceJobId || null,
568
- lineage:safeLineage(bundle.lineage),
569
- levels:evidenceLevel(seenRoles,urdfStatus,graspLevel,semanticLevel),
570
- ...(Object.keys(graspEvidence).length ? { grasps:graspEvidence } : {}),
571
- ...(semanticEvidence ? { semantics:{...semanticEvidence,mappedToPartProposal:semanticProposalApplied} } : {}),
572
- ...(urdfEvidence ? { urdf:urdfEvidence } : {}),
573
- artifacts:descriptors.map((descriptor) => ({ ...descriptor, verified:verifiedRoles.has(descriptor.role) }))
574
- };
575
-
576
- const asset = bundle.asset && typeof bundle.asset === 'object' ? bundle.asset : {};
577
- const compilerInput = {
578
- bytes:primaryBytes,
579
- sourceName:primary.fileName || primary.path?.split('/').pop() || 'embodiedgen.glb',
580
- assetId:asset.id || bundle.assetId || undefined,
581
- label:asset.label || bundle.label || undefined,
582
- partSegmentation,
583
- // Verified semantic evidence may become an unpromoted semantic-only Part Proposal.
584
- // Verified URDF proposal wins when it has explicit movable parts; grasp evidence remains non-executable.
585
- partProposal,
586
- providerEvidence
587
- };
588
- return { compilerInput, providerEvidence };
589
- }
590
- }