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,93 +0,0 @@
1
- import { orderParts, ROOT_PART } from '../../../model/parts.js';
2
-
3
- const SUPPORTED_JOINTS = new Set(['revolute', 'prismatic']);
4
- const finiteVec = (value, length) => Array.isArray(value) && value.length === length && value.every(Number.isFinite);
5
-
6
- function executableReason(part, reviewed = false) {
7
- if (!part.joint) return 'missing-joint';
8
- if (!SUPPORTED_JOINTS.has(part.joint.type)) return 'unsupported-joint';
9
- if (!finiteVec(part.joint.axis, 3) || Math.hypot(...part.joint.axis) < 1e-6) return 'invalid-axis';
10
- if (!finiteVec(part.joint.parentAnchor, 3) || !finiteVec(part.joint.childAnchor, 3)) return 'missing-anchor';
11
- if (!finiteVec(part.joint.limits, 2) || part.joint.limits[0] >= part.joint.limits[1]) return 'invalid-limits';
12
- if (!part.physics?.colliders?.length) return 'missing-collider';
13
- if (!part.actions?.length && !reviewed) return 'missing-actions';
14
- if (!(part.actions || []).every((action) => Number.isFinite(part.targets?.[action]))) return 'missing-target';
15
- return null;
16
- }
17
-
18
- export class PartProposalPass {
19
- async run(context) {
20
- const proposal = context.partProposal;
21
- if (!proposal) return context;
22
- if (proposal.version !== 1 || !Array.isArray(proposal.parts)) {
23
- return {
24
- ...context,
25
- partProposal: { ...proposal, accepted:false, promoted:[], unpromoted:[], issues:[{ code:'PART_PROPOSAL_FORMAT', message:'Part proposal requires version=1 and parts[].' }] }
26
- };
27
- }
28
-
29
- const issues = [];
30
- const parts = {};
31
- const currentNodes = context.document?.getRoot?.().listNodes?.() || [];
32
- const nodeNames = currentNodes.length ? currentNodes.map((node) => node.getName()) : context.inspection.nodes.map((node) => node.name);
33
- const nodeCounts = new Map();
34
- for (const name of nodeNames) if (name) nodeCounts.set(name, (nodeCounts.get(name) || 0) + 1);
35
- for (const raw of proposal.parts) {
36
- const id = String(raw.id || '').trim();
37
- if (!id || parts[id]) { issues.push({ code:'PART_ID_INVALID', part:id || null, message:'Part id must be unique and non-empty.' }); continue; }
38
- const matches = nodeCounts.get(raw.node) || 0;
39
- if (matches === 0) { issues.push({ code:'PART_NODE_MISSING', part:id, node:raw.node, message:`GLB node not found: ${raw.node}` }); continue; }
40
- if (matches > 1) { issues.push({ code:'PART_NODE_AMBIGUOUS', part:id, node:raw.node, message:`GLB node name is not unique: ${raw.node}` }); continue; }
41
- parts[id] = {
42
- node: raw.node,
43
- parent: raw.parent || ROOT_PART,
44
- ...(raw.semantic ? { semantic:raw.semantic } : {}),
45
- ...(Array.isArray(raw.actions) ? { actions:[...new Set(raw.actions)] } : {}),
46
- ...(raw.targets ? { targets:{...raw.targets} } : {}),
47
- ...(raw.physics ? { physics:structuredClone(raw.physics) } : {}),
48
- ...(raw.joint ? { joint:structuredClone(raw.joint) } : {}),
49
- proposal: { source:proposal.source || 'provider', confidence:Number(raw.confidence ?? proposal.confidence ?? 0) }
50
- };
51
- }
52
-
53
- let ordered = [];
54
- try { ordered = orderParts(parts); }
55
- catch (error) { issues.push({ code:'PART_HIERARCHY_INVALID', message:error.message }); }
56
-
57
- if (!issues.length && context.document) {
58
- const nodes = new Map(context.document.getRoot().listNodes().map((node) => [node.getName(), node]));
59
- const isAncestor = (ancestor, node) => {
60
- for (let current = node?.getParentNode?.(); current; current = current.getParentNode?.()) if (current === ancestor) return true;
61
- return false;
62
- };
63
- for (const [id, part] of ordered) {
64
- const parentId = part.parent || ROOT_PART;
65
- if (parentId === ROOT_PART) continue;
66
- const parentNode = nodes.get(parts[parentId].node);
67
- const childNode = nodes.get(part.node);
68
- if (!isAncestor(parentNode, childNode)) {
69
- issues.push({ code:'PART_NODE_HIERARCHY_MISMATCH', part:id, parent:parentId, message:`GLB node ${part.node} is not under parent part node ${parts[parentId].node}.` });
70
- }
71
- }
72
- }
73
-
74
- const promoted = {};
75
- const unpromoted = [];
76
- if (!issues.length) {
77
- for (const [id, part] of ordered) {
78
- const reason = executableReason(part, Boolean(context.interactionReview));
79
- const parent = part.parent || ROOT_PART;
80
- if (reason) { unpromoted.push({ part:id, reason }); continue; }
81
- if (parent !== ROOT_PART && !promoted[parent]) { unpromoted.push({ part:id, reason:'parent-not-executable' }); continue; }
82
- promoted[id] = part;
83
- }
84
- }
85
-
86
- const accepted = issues.length === 0;
87
- return {
88
- ...context,
89
- articulation: { ...context.articulation, ...(accepted && Object.keys(promoted).length ? { parts:promoted, source:'part-proposal' } : {}) },
90
- partProposal: { ...proposal, accepted, promoted:Object.keys(promoted), unpromoted, issues }
91
- };
92
- }
93
- }
@@ -1,32 +0,0 @@
1
- export class RemoteEnrichmentPass {
2
- constructor({ provider } = {}) { this.provider = provider; }
3
-
4
- async run(context) {
5
- if (!this.provider?.isConfigured()) return { ...context, enrichment: { skipped: true } };
6
- try {
7
- const response = await this.provider.run('enrich', {
8
- source: { name: context.sourceName, url: context.sourceUrl },
9
- inspection: { nodes: context.inspection.nodes, stats: context.inspection.stats },
10
- geometry: context.geometry,
11
- semantics: context.semantics,
12
- articulationCandidates: context.articulation.candidates
13
- });
14
- return {
15
- ...context,
16
- semantics: response?.semantics ? { ...context.semantics, ...response.semantics, source: 'provider' } : context.semantics,
17
- articulation: context.articulation,
18
- partProposal: response?.partProposal || context.partProposal || null,
19
- partSegmentation: response?.partSegmentation || context.partSegmentation || null,
20
- collision: response?.collision || context.collision,
21
- physics: response?.physics || context.physics,
22
- meshQuality: response?.geometry || context.meshQuality || null,
23
- enrichment: { skipped: false, provider: this.provider.endpoint }
24
- };
25
- } catch (error) {
26
- return {
27
- ...context,
28
- enrichment: { skipped: true, provider: this.provider.endpoint, error: error.message }
29
- };
30
- }
31
- }
32
- }
@@ -1,55 +0,0 @@
1
- import { inspect } from '@gltf-transform/functions';
2
-
3
- import { RESOURCE_BUDGET } from '../../../model/resourceBudget.js';
4
-
5
- const textureDimension = (resolution = '') => Math.max(...resolution.split('x').map(Number).filter(Number.isFinite), 0);
6
- const countDrawCalls = (scene) => {
7
- let count = 0;
8
- const visit = (node) => {
9
- count += node.getMesh()?.listPrimitives().length || 0;
10
- node.listChildren().forEach(visit);
11
- };
12
- scene?.listChildren().forEach(visit);
13
- return count;
14
- };
15
-
16
- export class ResourceBudgetPass {
17
- async run(context) {
18
- const report = inspect(context.document);
19
- const scenes = context.document.getRoot().listScenes();
20
- const sceneIndex = context.structure.defaultSceneIndex >= 0 ? context.structure.defaultSceneIndex : 0;
21
- const scene = scenes[sceneIndex];
22
- const sceneReport = report.scenes.properties[sceneIndex];
23
- const metrics = {
24
- optimizedBytes: context.optimizedBytes.byteLength,
25
- renderVertices: sceneReport?.renderVertexCount || 0,
26
- uploadVertices: sceneReport?.uploadVertexCount || 0,
27
- drawCalls: countDrawCalls(scene),
28
- textureVRAM: report.textures.properties.reduce((sum, texture) => sum + (texture.gpuSize || 0), 0),
29
- maxTextureDimension: report.textures.properties.reduce((max, texture) => Math.max(max, textureDimension(texture.resolution)), 0),
30
- animationKeyframes: report.animations.properties.reduce((sum, animation) => sum + animation.keyframes, 0)
31
- };
32
-
33
- const hard = [];
34
- const advisory = [];
35
- const checks = [
36
- ['renderVertices', 'RENDER_VERTICES', '渲染顶点数'],
37
- ['drawCalls', 'DRAW_CALLS', 'Draw Call'],
38
- ['textureVRAM', 'TEXTURE_VRAM', '纹理显存估算'],
39
- ['maxTextureDimension', 'TEXTURE_DIMENSION', '最大纹理边长'],
40
- ['animationKeyframes', 'ANIMATION_KEYFRAMES', '动画关键帧数']
41
- ];
42
- for (const [key, code, label] of checks) {
43
- const value = metrics[key];
44
- const limit = RESOURCE_BUDGET[key];
45
- if (value > limit.hard) hard.push({ code: `BUDGET_${code}_HARD`, message: `${label} ${value} 超过硬上限 ${limit.hard}。` });
46
- else if (value > limit.advisory) advisory.push({ code: `BUDGET_${code}`, message: `${label} ${value} 超过建议上限 ${limit.advisory}。` });
47
- }
48
-
49
- return {
50
- ...context,
51
- inspection: { ...context.inspection, report, stats: { ...context.inspection.stats, ...metrics } },
52
- resources: { metrics, hard, advisory }
53
- };
54
- }
55
- }
@@ -1,203 +0,0 @@
1
- import { Primitive } from '@gltf-transform/core';
2
-
3
- const slug = (value) => String(value).trim().replace(/[^a-zA-Z0-9_-]+/g, '_').replace(/^_+|_+$/g, '');
4
- const labelsArray = (value) => Array.isArray(value) || ArrayBuffer.isView(value) ? Array.from(value, (item) => String(item)) : null;
5
-
6
- const makeIndices = (document, sourcePrimitive, faceLabels, segmentId) => {
7
- const sourceIndices = sourcePrimitive.getIndices()?.getArray() || null;
8
- const positions = sourcePrimitive.getAttribute('POSITION');
9
- const vertexCount = positions?.getCount() || 0;
10
- const faceCount = sourceIndices ? sourceIndices.length / 3 : vertexCount / 3;
11
- if (!Number.isInteger(faceCount)) throw new Error('Primitive triangle count is not integral.');
12
- if (faceLabels.length !== faceCount) throw new Error(`Face label count ${faceLabels.length} does not match primitive face count ${faceCount}.`);
13
-
14
- const selected = [];
15
- for (let face = 0; face < faceCount; face++) {
16
- if (faceLabels[face] !== segmentId) continue;
17
- const offset = face * 3;
18
- selected.push(
19
- sourceIndices ? sourceIndices[offset] : offset,
20
- sourceIndices ? sourceIndices[offset + 1] : offset + 1,
21
- sourceIndices ? sourceIndices[offset + 2] : offset + 2
22
- );
23
- }
24
- if (!selected.length) return null;
25
- let max = 0;
26
- for (const index of selected) if (index > max) max = index;
27
- const array = max <= 65535 ? new Uint16Array(selected) : new Uint32Array(selected);
28
- return document.createAccessor().setType('SCALAR').setArray(array);
29
- };
30
-
31
- const clonePrimitiveView = (document, source, indices) => {
32
- const primitive = document.createPrimitive().setMode(source.getMode()).setIndices(indices).setMaterial(source.getMaterial());
33
- for (const semantic of source.listSemantics()) primitive.setAttribute(semantic, source.getAttribute(semantic));
34
- primitive.setExtras(structuredClone(source.getExtras()));
35
- return primitive;
36
- };
37
-
38
- export class SegmentMaterializePass {
39
- async run(context) {
40
- const evidence = context.partSegmentation;
41
- const spec = evidence?.materialization;
42
- if (!spec) return context;
43
- const issues = [];
44
- const fail = (code, message, details = {}) => ({
45
- ...context,
46
- partSegmentation: {
47
- ...evidence,
48
- materialization: { status:'rejected', sourceNode:spec.sourceNode || null, issues:[...issues, { code, message, ...details }] }
49
- }
50
- });
51
-
52
- if (evidence.version !== 1 || !evidence.source || !Number.isInteger(evidence.faceCount) || evidence.faceCount <= 0 || !Array.isArray(evidence.segments)) {
53
- return fail('MATERIALIZATION_EVIDENCE_INVALID', 'Materialization requires valid Segmentation Evidence v1 metadata.');
54
- }
55
- if (!spec.sourceNode || !Array.isArray(spec.primitives)) return fail('MATERIALIZATION_FORMAT', 'Materialization requires sourceNode and primitives[].');
56
- const nodes = context.document.getRoot().listNodes().filter((node) => node.getName() === spec.sourceNode);
57
- if (nodes.length !== 1) return fail(nodes.length ? 'MATERIALIZATION_NODE_AMBIGUOUS' : 'MATERIALIZATION_NODE_MISSING', `Source node must resolve uniquely: ${spec.sourceNode}`);
58
- const sourceNode = nodes[0];
59
- const sourceMesh = sourceNode.getMesh();
60
- if (!sourceMesh) return fail('MATERIALIZATION_MESH_MISSING', `Source node has no mesh: ${spec.sourceNode}`);
61
- if (sourceNode.getSkin()) return fail('MATERIALIZATION_SKIN_UNSUPPORTED', 'Skinned nodes are not materialized automatically.');
62
- if (sourceNode.getWeights().length || sourceMesh.getWeights().length) return fail('MATERIALIZATION_MORPH_UNSUPPORTED', 'Morph-target meshes are not materialized automatically.');
63
- if (sourceNode.listExtensions().length || sourceMesh.listExtensions().length) return fail('MATERIALIZATION_EXTENSION_UNSUPPORTED', 'Node or mesh extensions require provider-side materialization.');
64
-
65
- const primitives = sourceMesh.listPrimitives();
66
- if (spec.primitives.length !== primitives.length) return fail('MATERIALIZATION_PRIMITIVE_COVERAGE', 'Every source primitive must have one face-label entry.');
67
- const byPrimitive = new Map();
68
- for (const entry of spec.primitives) {
69
- if (!Number.isInteger(entry.primitive) || entry.primitive < 0 || entry.primitive >= primitives.length || byPrimitive.has(entry.primitive)) {
70
- return fail('MATERIALIZATION_PRIMITIVE_INDEX', `Invalid or duplicate primitive index: ${entry.primitive}`);
71
- }
72
- const labels = labelsArray(entry.faceLabels);
73
- if (!labels) return fail('MATERIALIZATION_LABELS_MISSING', `Primitive ${entry.primitive} requires faceLabels[].`);
74
- byPrimitive.set(entry.primitive, labels);
75
- }
76
-
77
- const segmentDefs = new Map();
78
- const generatedNames = new Set(context.document.getRoot().listNodes().map((node) => node.getName()).filter(Boolean));
79
- for (const segment of evidence.segments || []) {
80
- const id = String(segment.id ?? '');
81
- if (!id || segmentDefs.has(id) || !Number.isInteger(segment.faceCount) || segment.faceCount <= 0) return fail('MATERIALIZATION_SEGMENT_INVALID', `Segment ids must be unique and faceCount must be positive: ${id || '<missing>'}`);
82
- const safe = slug(id);
83
- if (!safe) return fail('MATERIALIZATION_SEGMENT_ID', `Segment id cannot form a stable node name: ${id}`);
84
- const nodeName = `${spec.sourceNode}__part_${safe}`;
85
- if (generatedNames.has(nodeName)) return fail('MATERIALIZATION_NODE_COLLISION', `Generated node already exists: ${nodeName}`);
86
- if ([...segmentDefs.values()].some((item) => item.nodeName === nodeName)) return fail('MATERIALIZATION_SEGMENT_ID_COLLISION', `Segment ids collide after normalization: ${id}`);
87
- segmentDefs.set(id, { id, nodeName, segment });
88
- }
89
- if (!segmentDefs.size) return fail('MATERIALIZATION_SEGMENTS_MISSING', 'No segmentation definitions are available.');
90
-
91
- const proposalParts = new Map((context.partProposal?.parts || []).map((part) => [String(part.id), part]));
92
- if (context.partProposal) {
93
- const nodeById = new Map([...segmentDefs.values()].map((def) => [def.id, def.nodeName]));
94
- for (const [id, def] of segmentDefs) {
95
- const part = proposalParts.get(id);
96
- if (!part) continue;
97
- if (part.node && part.node !== def.nodeName) return fail('MATERIALIZATION_PROPOSAL_NODE_CONFLICT', `Part Proposal node conflicts with materialized segment ${id}.`, { part:id, expected:def.nodeName, actual:part.node });
98
- const parent = part.parent || '$root';
99
- if (parent !== '$root' && !segmentDefs.has(String(parent))) return fail('MATERIALIZATION_EXTERNAL_PARENT_UNSUPPORTED', `Materialized Part ${id} references a parent outside this segmentation batch: ${parent}.`, { part:id, parent });
100
- }
101
- for (const id of segmentDefs.keys()) {
102
- const seen = new Set([id]);
103
- for (let parent = proposalParts.get(id)?.parent; parent && parent !== '$root'; parent = proposalParts.get(String(parent))?.parent) {
104
- parent = String(parent);
105
- if (seen.has(parent)) return fail('MATERIALIZATION_PART_HIERARCHY_CYCLE', `Materialized Part hierarchy contains a cycle at ${parent}.`);
106
- seen.add(parent);
107
- }
108
- }
109
- }
110
-
111
- const actualCounts = new Map([...segmentDefs.keys()].map((id) => [id, 0]));
112
- let totalFaces = 0;
113
- for (let primitiveIndex = 0; primitiveIndex < primitives.length; primitiveIndex++) {
114
- const primitive = primitives[primitiveIndex];
115
- if (primitive.getMode() !== Primitive.Mode.TRIANGLES) return fail('MATERIALIZATION_MODE_UNSUPPORTED', `Primitive ${primitiveIndex} is not TRIANGLES.`);
116
- if (primitive.listTargets().length || primitive.listExtensions().length) return fail('MATERIALIZATION_PRIMITIVE_UNSUPPORTED', `Primitive ${primitiveIndex} has morph targets or extensions.`);
117
- const labels = byPrimitive.get(primitiveIndex);
118
- const indices = primitive.getIndices()?.getArray();
119
- const faceCount = indices ? indices.length / 3 : (primitive.getAttribute('POSITION')?.getCount() || 0) / 3;
120
- if (!Number.isInteger(faceCount) || labels.length !== faceCount) return fail('MATERIALIZATION_FACE_COUNT', `Primitive ${primitiveIndex} face labels do not exactly match its triangles.`);
121
- totalFaces += faceCount;
122
- for (const label of labels) {
123
- if (!segmentDefs.has(label)) return fail('MATERIALIZATION_UNKNOWN_SEGMENT', `Face label references unknown segment: ${label}`);
124
- actualCounts.set(label, actualCounts.get(label) + 1);
125
- }
126
- }
127
- if (Number.isInteger(evidence.faceCount) && evidence.faceCount !== totalFaces) return fail('MATERIALIZATION_SOURCE_FACE_COUNT_MISMATCH', `Evidence faceCount ${evidence.faceCount} does not match source mesh face count ${totalFaces}.`);
128
- for (const [id, def] of segmentDefs) {
129
- if (!actualCounts.get(id)) return fail('MATERIALIZATION_EMPTY_SEGMENT', `Segment has no faces: ${id}`);
130
- if (Number.isInteger(def.segment.faceCount) && def.segment.faceCount !== actualCounts.get(id)) {
131
- return fail('MATERIALIZATION_SEGMENT_COUNT_MISMATCH', `Segment ${id} faceCount does not match labels.`);
132
- }
133
- }
134
-
135
- const materializedParts = [];
136
- const materializedNodes = new Map();
137
- for (const [id, def] of segmentDefs) {
138
- const mesh = context.document.createMesh(`${def.nodeName}Mesh`).setWeights(sourceMesh.getWeights()).setExtras(structuredClone(sourceMesh.getExtras()));
139
- for (let primitiveIndex = 0; primitiveIndex < primitives.length; primitiveIndex++) {
140
- const indices = makeIndices(context.document, primitives[primitiveIndex], byPrimitive.get(primitiveIndex), id);
141
- if (indices) mesh.addPrimitive(clonePrimitiveView(context.document, primitives[primitiveIndex], indices));
142
- }
143
- const node = context.document.createNode(def.nodeName).setMesh(mesh).setExtras({ agentscape:{ segmentId:id, source:evidence.source } });
144
- sourceNode.addChild(node);
145
- materializedNodes.set(id, node);
146
- materializedParts.push({
147
- id,
148
- node:def.nodeName,
149
- ...(def.segment.semantic ? { semantic:def.segment.semantic } : {}),
150
- ...(Number.isFinite(def.segment.confidence) ? { confidence:def.segment.confidence } : {})
151
- });
152
- }
153
- for (const [id, node] of materializedNodes) {
154
- const parentId = String(proposalParts.get(id)?.parent || '$root');
155
- if (parentId !== '$root') materializedNodes.get(parentId).addChild(node);
156
- }
157
- sourceNode.setMesh(null);
158
-
159
- let partProposal = context.partProposal;
160
- if (!partProposal) {
161
- const confidences = materializedParts.map((part) => part.confidence).filter(Number.isFinite);
162
- const confidence = Number.isFinite(evidence.confidence)
163
- ? evidence.confidence
164
- : confidences.length === materializedParts.length
165
- ? confidences.reduce((min, value) => Math.min(min, value), 1)
166
- : 0;
167
- partProposal = { version:1, source:`segmentation/${evidence.source}`, confidence, parts:materializedParts };
168
- } else {
169
- const materializedById = new Map(materializedParts.map((part) => [part.id, part]));
170
- partProposal = structuredClone(partProposal);
171
- partProposal.parts ||= [];
172
- const existingIds = new Set();
173
- for (const part of partProposal.parts) {
174
- const id = String(part.id);
175
- existingIds.add(id);
176
- const materialized = materializedById.get(id);
177
- if (materialized && !part.node) part.node = materialized.node;
178
- if (materialized?.semantic && !part.semantic) part.semantic = materialized.semantic;
179
- if (Number.isFinite(materialized?.confidence) && !Number.isFinite(part.confidence)) part.confidence = materialized.confidence;
180
- }
181
- for (const materialized of materializedParts) {
182
- if (!existingIds.has(materialized.id)) partProposal.parts.push(structuredClone(materialized));
183
- }
184
- }
185
-
186
- return {
187
- ...context,
188
- partProposal,
189
- partSegmentation: {
190
- ...evidence,
191
- materialization: {
192
- status:issues.length ? 'partial' : 'materialized',
193
- strategy:'shared-accessor-index-split',
194
- completeFacePartition:true,
195
- sourceNodeOriginPreserved:true,
196
- sourceNode:spec.sourceNode,
197
- nodes:materializedParts.map((part) => ({ id:part.id, node:part.node })),
198
- issues
199
- }
200
- }
201
- };
202
- }
203
- }
@@ -1,43 +0,0 @@
1
- const finiteBounds = (bounds) => bounds && ['min','max'].every((key) => Array.isArray(bounds[key]) && bounds[key].length === 3 && bounds[key].every(Number.isFinite));
2
-
3
- export class SegmentationEvidencePass {
4
- async run(context) {
5
- const evidence = context.partSegmentation;
6
- if (!evidence) return context;
7
- const issues = [];
8
- const faceCount = Number(evidence.faceCount);
9
- if (evidence.version !== 1 || !evidence.source || !Number.isInteger(faceCount) || faceCount <= 0 || !Array.isArray(evidence.segments)) {
10
- issues.push({ code:'SEGMENTATION_FORMAT', message:'Segmentation evidence requires version=1, source, faceCount and segments[].' });
11
- }
12
- const ids = new Set();
13
- let labeledFaces = 0;
14
- for (const segment of evidence.segments || []) {
15
- const id = String(segment.id ?? '');
16
- if (!id || ids.has(id)) { issues.push({ code:'SEGMENTATION_ID_INVALID', segment:id || null }); continue; }
17
- ids.add(id);
18
- if (!Number.isInteger(segment.faceCount) || segment.faceCount <= 0) issues.push({ code:'SEGMENTATION_FACE_COUNT_INVALID', segment:id });
19
- else labeledFaces += segment.faceCount;
20
- if (segment.bounds && !finiteBounds(segment.bounds)) issues.push({ code:'SEGMENTATION_BOUNDS_INVALID', segment:id });
21
- }
22
- if (Number.isFinite(faceCount) && labeledFaces > faceCount) issues.push({ code:'SEGMENTATION_COVERAGE_INVALID', message:'Segment face counts exceed source face count.' });
23
-
24
- const summary = {
25
- version:evidence.version,
26
- source:evidence.source,
27
- faceCount,
28
- labeledFaces,
29
- coverage:faceCount > 0 ? labeledFaces / faceCount : 0,
30
- segments:(evidence.segments || []).map((segment) => ({
31
- id:String(segment.id),
32
- faceCount:segment.faceCount,
33
- ...(Number.isFinite(segment.confidence) ? { confidence:segment.confidence } : {}),
34
- ...(segment.semantic ? { semantic:segment.semantic } : {}),
35
- ...(segment.bounds ? { bounds:structuredClone(segment.bounds) } : {})
36
- })),
37
- ...(evidence.artifact ? { artifact:structuredClone(evidence.artifact) } : {}),
38
- ...(evidence.materialization ? { materialization:structuredClone(evidence.materialization) } : {}),
39
- issues
40
- };
41
- return { ...context, partSegmentation:summary };
42
- }
43
- }
@@ -1,33 +0,0 @@
1
- const RULES = [
2
- { type: 'cabinet', words: ['cabinet','cupboard','wardrobe','柜','橱'], tags: ['storage','furniture'] },
3
- { type: 'drawer', words: ['drawer','抽屉'], tags: ['storage'] },
4
- { type: 'door', words: ['door','门'], tags: ['door'] },
5
- { type: 'cup', words: ['cup','mug','杯'], tags: ['drinkware','graspable'] },
6
- { type: 'apple', words: ['apple','苹果'], tags: ['fruit','food','round','graspable'] },
7
- { type: 'vase', words: ['vase','flower vase','花瓶'], tags: ['decor','container','graspable'] },
8
- { type: 'chair', words: ['chair','seat','椅'], tags: ['furniture','seat'] },
9
- { type: 'table', words: ['table','desk','桌'], tags: ['furniture','surface'] }
10
- ];
11
-
12
- export class SemanticHeuristicPass {
13
- async run(context) {
14
- const text = [context.label, context.sourceName, ...context.geometry.namedNodes].filter(Boolean).join(' ').toLowerCase();
15
- const hits = RULES
16
- .map((rule) => ({ rule, score: rule.words.filter((word) => text.includes(word)).length }))
17
- .filter((item) => item.score > 0)
18
- .sort((a, b) => b.score - a.score);
19
- const best = hits[0];
20
- const base = best?.rule || { type: 'object', tags: [] };
21
- return {
22
- ...context,
23
- semantics: {
24
- type: base.type,
25
- label: context.label || context.sourceName.replace(/\.(glb|gltf)$/i, ''),
26
- tags: base.tags,
27
- actions: base.actions || ['move'],
28
- confidence: best ? Math.min(0.85, 0.45 + best.score * 0.2) : 0.2,
29
- source: 'heuristic'
30
- }
31
- };
32
- }
33
- }
@@ -1,60 +0,0 @@
1
- const EPS = 1e-6;
2
- const isIdentityRotation = ([x, y, z, w]) => Math.abs(x) < EPS && Math.abs(y) < EPS && Math.abs(z) < EPS && Math.abs(w - 1) < EPS;
3
- const isUnitScale = (scale) => scale.every((value) => Math.abs(value - 1) < EPS);
4
-
5
- export class StructurePass {
6
- async run(context) {
7
- const root = context.document.getRoot();
8
- const scenes = root.listScenes();
9
- const defaultScene = root.getDefaultScene() || scenes[0] || null;
10
- const rootNodes = defaultScene?.listChildren() || [];
11
- let maxDepth = 0;
12
- const visit = (node, depth) => {
13
- maxDepth = Math.max(maxDepth, depth);
14
- for (const child of node.listChildren()) visit(child, depth + 1);
15
- };
16
- rootNodes.forEach((node) => visit(node, 1));
17
-
18
- const negativeScaleNodes = [];
19
- const transformedRoots = [];
20
- const nonUniformScaleNodes = [];
21
- for (const node of root.listNodes()) {
22
- const scale = node.getScale();
23
- if (scale[0] * scale[1] * scale[2] < 0) negativeScaleNodes.push(node.getName() || '(unnamed)');
24
- if (Math.max(...scale) - Math.min(...scale) > EPS) nonUniformScaleNodes.push(node.getName() || '(unnamed)');
25
- }
26
- for (const node of rootNodes) {
27
- if (node.getTranslation().some((value) => Math.abs(value) > EPS) || !isIdentityRotation(node.getRotation()) || !isUnitScale(node.getScale())) {
28
- transformedRoots.push(node.getName() || '(unnamed)');
29
- }
30
- }
31
-
32
- const warnings = [];
33
- if (scenes.length > 1) warnings.push({ code: 'MULTIPLE_SCENES', severity: 'advisory', message: `GLB 包含 ${scenes.length} 个 Scene;运行时只实例化默认 Scene。` });
34
- if (!root.getDefaultScene() && scenes.length > 1) warnings.push({ code: 'DEFAULT_SCENE_MISSING', severity: 'advisory', message: '多 Scene GLB 未声明默认 Scene,将使用第一个 Scene。' });
35
- if (negativeScaleNodes.length) warnings.push({ code: 'NEGATIVE_SCALE', severity: 'advisory', message: `检测到 ${negativeScaleNodes.length} 个负缩放节点;碰撞和法线需要额外验证。` });
36
- if (root.listSkins().length) warnings.push({ code: 'SKINNED_ASSET', severity: 'advisory', message: '资产包含 Skin;禁止自动 flatten 节点层级。' });
37
- if (root.listAnimations().length) warnings.push({ code: 'ANIMATED_ASSET', severity: 'advisory', message: '资产包含动画;禁止自动 bake 层级变换。' });
38
-
39
- return {
40
- ...context,
41
- structure: {
42
- scenes: scenes.length,
43
- defaultSceneIndex: defaultScene ? scenes.indexOf(defaultScene) : -1,
44
- rootNodes: rootNodes.length,
45
- maxDepth,
46
- skins: root.listSkins().length,
47
- animations: root.listAnimations().length,
48
- transformedRoots,
49
- negativeScaleNodes,
50
- nonUniformScaleNodes,
51
- warnings,
52
- policy: {
53
- centerBelow: Boolean(defaultScene),
54
- flatten: false,
55
- inferAxisRotation: false
56
- }
57
- }
58
- };
59
- }
60
- }
@@ -1,23 +0,0 @@
1
- import { JsonGateway } from '../../../../../foundation/JsonGateway.js';
2
-
3
- export class HttpCompilerProvider extends JsonGateway {
4
- constructor(options = {}) { super({ timeoutMs: 120000, label: 'Compiler provider', ...options }); }
5
- async run(stage, payload) { return this.post({ stage, ...payload }); }
6
-
7
- async runPartGeometry(bytes, parts) {
8
- const form = new FormData();
9
- form.set('stage', 'part-geometry');
10
- form.set('metadata', JSON.stringify({ parts }));
11
- form.set('asset', new Blob([bytes], { type:'model/gltf-binary' }), 'asset.glb');
12
- return this.postForm(form);
13
- }
14
-
15
- async runUrdfProposal(bytes) {
16
- const data = bytes instanceof Uint8Array ? bytes : bytes instanceof ArrayBuffer ? new Uint8Array(bytes) : null;
17
- if (!data?.byteLength) throw new Error('URDF proposal requires non-empty bytes');
18
- const form = new FormData();
19
- form.set('stage', 'urdf-proposal');
20
- form.set('asset', new Blob([data], { type:'application/xml' }), 'asset.urdf');
21
- return this.postForm(form);
22
- }
23
- }