agentscape3d-engine 0.0.0-stage → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/cli.mjs +53 -0
  4. package/dist/AssetCompiler-A99wKf7H.js +2424 -0
  5. package/dist/AssetCompiler-A99wKf7H.js.map +1 -0
  6. package/dist/AssetInputContracts-uKYeQu-X.js +245 -0
  7. package/dist/AssetInputContracts-uKYeQu-X.js.map +1 -0
  8. package/dist/AssetRecipe-DCaLLXvG.js +67 -0
  9. package/dist/AssetRecipe-DCaLLXvG.js.map +1 -0
  10. package/dist/BrowserCodeWorker.js +53850 -0
  11. package/dist/BrowserCodeWorker.js.map +1 -0
  12. package/dist/KinematicHypothesisScreen-4v7GBwdv.js +241 -0
  13. package/dist/KinematicHypothesisScreen-4v7GBwdv.js.map +1 -0
  14. package/dist/SceneSerializer-CLCzQjL_.js +350 -0
  15. package/dist/SceneSerializer-CLCzQjL_.js.map +1 -0
  16. package/dist/StylePack-CD_BC-Mv.js +6317 -0
  17. package/dist/StylePack-CD_BC-Mv.js.map +1 -0
  18. package/dist/WorldArchive-dYf1OpSe.js +417 -0
  19. package/dist/WorldArchive-dYf1OpSe.js.map +1 -0
  20. package/dist/WorldIO-Dqz4MqTQ.js +149 -0
  21. package/dist/WorldIO-Dqz4MqTQ.js.map +1 -0
  22. package/dist/blankWorld-OoOvN_IK.js +75 -0
  23. package/dist/blankWorld-OoOvN_IK.js.map +1 -0
  24. package/dist/core.d.ts +68 -0
  25. package/dist/core.js +209 -0
  26. package/dist/core.js.map +1 -0
  27. package/dist/disposeObject3D-B3HCflvO.js +128 -0
  28. package/dist/disposeObject3D-B3HCflvO.js.map +1 -0
  29. package/dist/environments-B1WaICAN.js +4197 -0
  30. package/dist/environments-B1WaICAN.js.map +1 -0
  31. package/dist/gltfIO-BMK1hc2D.js +9 -0
  32. package/dist/gltfIO-BMK1hc2D.js.map +1 -0
  33. package/dist/grandUrbanBlock-Bdjgc6ZT.js +515 -0
  34. package/dist/grandUrbanBlock-Bdjgc6ZT.js.map +1 -0
  35. package/dist/index.d.ts +275 -0
  36. package/dist/index.js +16239 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/magicCabin-DPQi_jh-.js +11019 -0
  39. package/dist/magicCabin-DPQi_jh-.js.map +1 -0
  40. package/dist/mcp.d.ts +2 -0
  41. package/dist/mcp.js +1 -0
  42. package/dist/monumentHall-IOLbRZQC.js +403 -0
  43. package/dist/monumentHall-IOLbRZQC.js.map +1 -0
  44. package/dist/node.d.ts +16 -0
  45. package/dist/node.js +26 -0
  46. package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
  47. package/dist/ruinedCourtyard-BtaF_aOi.js +696 -0
  48. package/dist/ruinedCourtyard-BtaF_aOi.js.map +1 -0
  49. package/dist/runtime/application/AgentTools.js +28 -0
  50. package/dist/runtime/application/README.md +14 -0
  51. package/dist/runtime/application/agent/ProgressiveAgentTools.js +92 -0
  52. package/dist/runtime/application/agent/StudioMcpAllowlist.js +8 -0
  53. package/dist/runtime/application/buildTaskObservation.js +117 -0
  54. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +46 -0
  55. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +35 -0
  56. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +17 -0
  57. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +72 -0
  58. package/dist/runtime/application/createSession.js +66 -0
  59. package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
  60. package/dist/runtime/application/generation/GenerationOrchestrator.js +629 -0
  61. package/dist/runtime/application/generation/GenerationRuntime.js +214 -0
  62. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +285 -0
  63. package/dist/runtime/application/native-scene/CodeProject.js +119 -0
  64. package/dist/runtime/application/native-scene/CodeProjectModules.js +128 -0
  65. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +62 -0
  66. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
  67. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
  68. package/dist/runtime/application/native-scene/NativeSceneHost.js +319 -0
  69. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
  70. package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
  71. package/dist/runtime/application/object-forge/SceneObjectForge.js +232 -0
  72. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +59 -0
  73. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +22 -0
  74. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +40 -0
  75. package/dist/runtime/application/scene/CapabilityResolver.js +79 -0
  76. package/dist/runtime/application/scene/RequestWindow.js +54 -0
  77. package/dist/runtime/application/scene/SceneAgentTools.js +21 -0
  78. package/dist/runtime/application/scene/SceneContracts.js +45 -0
  79. package/dist/runtime/application/scene/SceneEditService.js +144 -0
  80. package/dist/runtime/application/scene/SceneFacade.js +261 -0
  81. package/dist/runtime/application/scene/SceneInteractionAdapters.js +40 -0
  82. package/dist/runtime/application/scene/SceneJobController.js +229 -0
  83. package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
  84. package/dist/runtime/application/scene/ScenePackage.js +162 -0
  85. package/dist/runtime/application/scene/ScenePersistence.js +50 -0
  86. package/dist/runtime/application/scene/SceneProject.js +95 -0
  87. package/dist/runtime/application/scene/SceneSkillNames.js +5 -0
  88. package/dist/runtime/application/scene/StarterScene.js +56 -0
  89. package/dist/runtime/application/scene/WorldArchive.js +87 -0
  90. package/dist/runtime/application/scene/WorldDirectory.js +20 -0
  91. package/dist/runtime/application/scene/WorldDocument.js +74 -0
  92. package/dist/runtime/application/scene/WorldIO.js +103 -0
  93. package/dist/runtime/application/scene/WorldStorage.js +137 -0
  94. package/dist/runtime/application/skills/SkillRegistry.js +189 -0
  95. package/dist/runtime/application/skills/packs/acceptanceSkills.js +32 -0
  96. package/dist/runtime/application/skills/packs/affordanceSkills.js +36 -0
  97. package/dist/runtime/application/skills/packs/assetSkills.js +46 -0
  98. package/dist/runtime/application/skills/packs/authoringSkills.js +16 -0
  99. package/dist/runtime/application/skills/packs/batchSkills.js +22 -0
  100. package/dist/runtime/application/skills/packs/codeSkills.js +106 -0
  101. package/dist/runtime/application/skills/packs/generationSkills.js +45 -0
  102. package/dist/runtime/application/skills/packs/interactionSkills.js +46 -0
  103. package/dist/runtime/application/skills/packs/recoverySkills.js +80 -0
  104. package/dist/runtime/application/skills/packs/sceneSkills.js +24 -0
  105. package/dist/runtime/application/skills/packs/spatialSkills.js +35 -0
  106. package/dist/runtime/application/skills/packs/verificationSkills.js +14 -0
  107. package/dist/runtime/application/skills/packs/worldSkills.js +45 -0
  108. package/dist/runtime/application/skills/registerCoreSkills.js +31 -0
  109. package/dist/runtime/application/skills/skillPrimitives.js +4 -0
  110. package/dist/runtime/application/tasks/CabinetCupTask.js +76 -0
  111. package/dist/runtime/application/tasks.jsonl +67 -0
  112. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +42 -0
  113. package/dist/runtime/application/world-authoring/AuthoringDiff.js +149 -0
  114. package/dist/runtime/application/world-authoring/AuthoringDocument.js +825 -0
  115. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +109 -0
  116. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +17 -0
  117. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +29 -0
  118. package/dist/runtime/application/world-authoring/AuthoringPatch.js +118 -0
  119. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +334 -0
  120. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +126 -0
  121. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +144 -0
  122. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +174 -0
  123. package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
  124. package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
  125. package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +77 -0
  126. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +1 -0
  127. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +30 -0
  128. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +17 -0
  129. package/dist/runtime/apps/mcp-server/CodeExecutor.js +71 -0
  130. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +42 -0
  131. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +66 -0
  132. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +159 -0
  133. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +8 -0
  134. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +47 -0
  135. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +132 -0
  136. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +6 -0
  137. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +116 -0
  138. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +60 -0
  139. package/dist/runtime/apps/mcp-server/README.md +150 -0
  140. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +1 -0
  141. package/dist/runtime/apps/mcp-server/SandboxBundle.js +13 -0
  142. package/dist/runtime/apps/mcp-server/SessionManager.js +80 -0
  143. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +58 -0
  144. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +190 -0
  145. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +16 -0
  146. package/dist/runtime/apps/mcp-server/VALIDATION.md +45 -0
  147. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +332 -0
  148. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +32 -0
  149. package/dist/runtime/apps/mcp-server/examples/code-house.js +24 -0
  150. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +85 -0
  151. package/dist/runtime/apps/mcp-server/main.mjs +65 -0
  152. package/dist/runtime/apps/mcp-server/registerTools.js +225 -0
  153. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
  154. package/dist/runtime/apps/mcp-server/security.js +21 -0
  155. package/dist/runtime/apps/mcp-server/tasks.jsonl +9 -0
  156. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +157 -0
  157. package/dist/runtime/apps/server/README.md +7 -0
  158. package/dist/runtime/apps/server/WorldDiskStorage.js +51 -0
  159. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +278 -0
  160. package/dist/runtime/apps/server/tasks.jsonl +10 -0
  161. package/dist/runtime/foundation/EventBus.js +18 -0
  162. package/dist/runtime/foundation/JsonGateway.js +47 -0
  163. package/dist/runtime/foundation/PolicyEngine.js +21 -0
  164. package/dist/runtime/foundation/README.md +7 -0
  165. package/dist/runtime/foundation/TraceRecorder.js +76 -0
  166. package/dist/runtime/foundation/errors.js +8 -0
  167. package/dist/runtime/foundation/simulation/SimulationProfile.js +143 -0
  168. package/dist/runtime/foundation/version.js +2 -0
  169. package/dist/runtime/modules/agent/README.md +11 -0
  170. package/dist/runtime/modules/agent/ToolCallingAgent.js +19 -0
  171. package/dist/runtime/modules/agent/bootstrapWorld.js +10 -0
  172. package/dist/runtime/modules/agent/buildRecoveryProposals.js +533 -0
  173. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +128 -0
  174. package/dist/runtime/modules/agent/execution/AgentRunResults.js +55 -0
  175. package/dist/runtime/modules/agent/execution/AgentRunSession.js +393 -0
  176. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +40 -0
  177. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +19 -0
  178. package/dist/runtime/modules/agent/prompt/index.js +52 -0
  179. package/dist/runtime/modules/agent/tasks.jsonl +94 -0
  180. package/dist/runtime/modules/artifact/ArtifactContentGate.js +144 -0
  181. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +280 -0
  182. package/dist/runtime/modules/artifact/ArtifactImporter.js +185 -0
  183. package/dist/runtime/modules/artifact/ArtifactModule.js +111 -0
  184. package/dist/runtime/modules/artifact/ArtifactRegistry.js +197 -0
  185. package/dist/runtime/modules/artifact/IncrementalSha256.js +129 -0
  186. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +115 -0
  187. package/dist/runtime/modules/artifact/README.md +7 -0
  188. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +67 -0
  189. package/dist/runtime/modules/artifact/tasks.jsonl +31 -0
  190. package/dist/runtime/modules/asset/AssetModule.js +399 -0
  191. package/dist/runtime/modules/asset/README.md +54 -0
  192. package/dist/runtime/modules/asset/loading/AssetLoader.js +157 -0
  193. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +61 -0
  194. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +95 -0
  195. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +33 -0
  196. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +103 -0
  197. package/dist/runtime/modules/asset/model/AssetInputContracts.js +100 -0
  198. package/dist/runtime/modules/asset/model/AssetRef.js +12 -0
  199. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +172 -0
  200. package/dist/runtime/modules/asset/model/admission.js +117 -0
  201. package/dist/runtime/modules/asset/model/errors.js +6 -0
  202. package/dist/runtime/modules/asset/model/parts.js +27 -0
  203. package/dist/runtime/modules/asset/model/resourceBudget.js +10 -0
  204. package/dist/runtime/modules/asset/model/schema.js +150 -0
  205. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +78 -0
  206. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +84 -0
  207. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +86 -0
  208. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +81 -0
  209. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +272 -0
  210. package/dist/runtime/modules/asset/production/AssetRecipe.js +47 -0
  211. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +45 -0
  212. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +590 -0
  213. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +173 -0
  214. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +124 -0
  215. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +56 -0
  216. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +6 -0
  217. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +74 -0
  218. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +63 -0
  219. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +48 -0
  220. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +16 -0
  221. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +30 -0
  222. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +75 -0
  223. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +20 -0
  224. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +34 -0
  225. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +32 -0
  226. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +116 -0
  227. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +84 -0
  228. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +63 -0
  229. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +16 -0
  230. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +23 -0
  231. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +50 -0
  232. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +60 -0
  233. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +93 -0
  234. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +32 -0
  235. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +55 -0
  236. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +203 -0
  237. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +43 -0
  238. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +33 -0
  239. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +60 -0
  240. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +23 -0
  241. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +198 -0
  242. package/dist/runtime/modules/asset/registry/AssetCatalog.js +72 -0
  243. package/dist/runtime/modules/asset/registry/AssetRegistry.js +51 -0
  244. package/dist/runtime/modules/asset/registry/manifests/index.js +173 -0
  245. package/dist/runtime/modules/asset/tasks.jsonl +87 -0
  246. package/dist/runtime/modules/generation/README.md +9 -0
  247. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +45 -0
  248. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +169 -0
  249. package/dist/runtime/modules/generation/connector/ConnectorClient.js +192 -0
  250. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +167 -0
  251. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +179 -0
  252. package/dist/runtime/modules/generation/connector/ConnectorSession.js +202 -0
  253. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +239 -0
  254. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +99 -0
  255. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +91 -0
  256. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +50 -0
  257. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +304 -0
  258. package/dist/runtime/modules/generation/tasks.jsonl +35 -0
  259. package/dist/runtime/modules/navigation/NavigationBackend.js +17 -0
  260. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +245 -0
  261. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
  262. package/dist/runtime/modules/physics/PhysicsApiSurface.js +651 -0
  263. package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
  264. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +410 -0
  265. package/dist/runtime/modules/rendering/README.md +7 -0
  266. package/dist/runtime/modules/rendering/RendererProbe.js +153 -0
  267. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +140 -0
  268. package/dist/runtime/modules/rendering/createRenderer.js +76 -0
  269. package/dist/runtime/modules/rendering/disposeObject3D.js +37 -0
  270. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +74 -0
  271. package/dist/runtime/modules/rendering/spatial/ThreeBvhRuntime.js +107 -0
  272. package/dist/runtime/modules/rendering/style/StylePack.js +34 -0
  273. package/dist/runtime/modules/rendering/style/StyleSystem.js +173 -0
  274. package/dist/runtime/modules/rendering/tasks.jsonl +7 -0
  275. package/dist/runtime/modules/world/README.md +13 -0
  276. package/dist/runtime/modules/world/build/WorldBuilder.js +170 -0
  277. package/dist/runtime/modules/world/compiler/PipelineEngine.js +32 -0
  278. package/dist/runtime/modules/world/compiler/WorldAdmission.js +43 -0
  279. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +68 -0
  280. package/dist/runtime/modules/world/compiler/WorldCompilation.js +157 -0
  281. package/dist/runtime/modules/world/compiler/WorldComposer.js +201 -0
  282. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +76 -0
  283. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +356 -0
  284. package/dist/runtime/modules/world/compiler/WorldRetry.js +75 -0
  285. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +379 -0
  286. package/dist/runtime/modules/world/content/blankWorld.js +35 -0
  287. package/dist/runtime/modules/world/content/environments.js +84 -0
  288. package/dist/runtime/modules/world/content/grandUrbanBlock.js +189 -0
  289. package/dist/runtime/modules/world/content/magic-cabin/README.md +28 -0
  290. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +64 -0
  291. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +7078 -0
  292. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +26 -0
  293. package/dist/runtime/modules/world/content/magic-cabin/materials.js +20 -0
  294. package/dist/runtime/modules/world/content/magicCabin.js +190 -0
  295. package/dist/runtime/modules/world/content/monumentHall.js +154 -0
  296. package/dist/runtime/modules/world/content/ruinedCourtyard.js +196 -0
  297. package/dist/runtime/modules/world/content/suzhouGarden/README.md +141 -0
  298. package/dist/runtime/modules/world/content/suzhouGarden/index.js +137 -0
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +491 -0
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +670 -0
  301. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +578 -0
  302. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +127 -0
  303. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +642 -0
  304. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +650 -0
  305. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +280 -0
  306. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +242 -0
  307. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +215 -0
  308. package/dist/runtime/modules/world/content/woodlandWorkshop.js +192 -0
  309. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +36 -0
  310. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +351 -0
  311. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +490 -0
  312. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +505 -0
  313. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +101 -0
  314. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +435 -0
  315. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +169 -0
  316. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +245 -0
  317. package/dist/runtime/modules/world/errors.js +9 -0
  318. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +50 -0
  319. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +297 -0
  320. package/dist/runtime/modules/world/runtime/CommandHistory.js +80 -0
  321. package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +150 -0
  322. package/dist/runtime/modules/world/runtime/ObjectStore.js +31 -0
  323. package/dist/runtime/modules/world/runtime/ObjectTransform.js +62 -0
  324. package/dist/runtime/modules/world/runtime/ObservedEntity.js +37 -0
  325. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +207 -0
  326. package/dist/runtime/modules/world/runtime/SceneSerializer.js +246 -0
  327. package/dist/runtime/modules/world/runtime/WorldAuthority.js +41 -0
  328. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +14 -0
  329. package/dist/runtime/modules/world/runtime/WorldCommands.js +502 -0
  330. package/dist/runtime/modules/world/runtime/WorldObservation.js +71 -0
  331. package/dist/runtime/modules/world/runtime/WorldQueries.js +340 -0
  332. package/dist/runtime/modules/world/runtime/WorldRecovery.js +78 -0
  333. package/dist/runtime/modules/world/runtime/WorldRuntime.js +665 -0
  334. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +107 -0
  335. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +130 -0
  336. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +79 -0
  337. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +195 -0
  338. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +70 -0
  339. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +115 -0
  340. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +305 -0
  341. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +214 -0
  342. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +65 -0
  343. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +222 -0
  344. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +130 -0
  345. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
  346. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
  347. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +120 -0
  348. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +102 -0
  349. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
  350. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +99 -0
  351. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
  352. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
  353. package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +125 -0
  354. package/dist/runtime/modules/world/runtime/systems/Instrument.js +38 -0
  355. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +728 -0
  356. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +269 -0
  357. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +469 -0
  358. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1673 -0
  359. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +457 -0
  360. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +284 -0
  361. package/dist/runtime/modules/world/spec/WorldIR.js +165 -0
  362. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +86 -0
  363. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +51 -0
  364. package/dist/runtime/modules/world/spec/WorldRevision.js +231 -0
  365. package/dist/runtime/modules/world/spec/WorldSpec.js +86 -0
  366. package/dist/runtime/modules/world/tasks.jsonl +530 -0
  367. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +254 -0
  368. package/dist/runtime/modules/world/verification/Finding.js +105 -0
  369. package/dist/runtime/modules/world/verification/InteractionEvidence.js +69 -0
  370. package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
  371. package/dist/runtime/modules/world/verification/WorldAcceptance.js +158 -0
  372. package/dist/runtime/modules/world/verification/WorldValidator.js +65 -0
  373. package/dist/runtime/package-lock.json +16048 -0
  374. package/dist/runtime/package.json +105 -0
  375. package/dist/runtime/public/assets/cabinet.glb +0 -0
  376. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  377. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  379. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  380. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  381. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  382. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  383. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  384. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  385. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  386. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  387. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  388. package/dist/schema-BWpTl0Wj.js +359 -0
  389. package/dist/schema-BWpTl0Wj.js.map +1 -0
  390. package/dist/suzhouGarden-H9tiPgxq.js +6150 -0
  391. package/dist/suzhouGarden-H9tiPgxq.js.map +1 -0
  392. package/dist/woodlandWorkshop-D6zzSbHr.js +483 -0
  393. package/dist/woodlandWorkshop-D6zzSbHr.js.map +1 -0
  394. package/dist/yuanmingyuan-D6IHqjZ-.js +4955 -0
  395. package/dist/yuanmingyuan-D6IHqjZ-.js.map +1 -0
  396. package/package.json +70 -4
@@ -0,0 +1,173 @@
1
+ import { validateAssetManifest } from '../../model/schema.js';
2
+ import { createAssetGLTFIO } from './gltfIO.js';
3
+ import { GLTFInspectPass } from './passes/GLTFInspectPass.js';
4
+ import { JointFramePass } from './passes/JointFramePass.js';
5
+ import { SegmentMaterializePass } from './passes/SegmentMaterializePass.js';
6
+ import { SegmentationEvidencePass } from './passes/SegmentationEvidencePass.js';
7
+ import { PartColliderPass } from './passes/PartColliderPass.js';
8
+ import { PartProposalPass } from './passes/PartProposalPass.js';
9
+ import { PartGeometryEnrichmentPass } from './passes/PartGeometryEnrichmentPass.js';
10
+ import { ArticulatedCollisionPass } from './passes/ArticulatedCollisionPass.js';
11
+ import { OptimizeGLBPass } from './passes/OptimizeGLBPass.js';
12
+ import { StructurePass } from './passes/StructurePass.js';
13
+ import { NormalizeTransformPass } from './passes/NormalizeTransformPass.js';
14
+ import { GeometryPass } from './passes/GeometryPass.js';
15
+ import { SemanticHeuristicPass } from './passes/SemanticHeuristicPass.js';
16
+ import { ArticulationCandidatePass } from './passes/ArticulationCandidatePass.js';
17
+ import { KinematicEvidencePass } from './passes/KinematicEvidencePass.js';
18
+ import { ColliderFallbackPass } from './passes/ColliderFallbackPass.js';
19
+ import { RemoteEnrichmentPass } from './passes/RemoteEnrichmentPass.js';
20
+ import { ResourceBudgetPass } from './passes/ResourceBudgetPass.js';
21
+ import { RESOURCE_BUDGET } from '../../model/resourceBudget.js';
22
+ import { CompileQualityPass } from './passes/CompileQualityPass.js';
23
+ import { ManifestPass } from './passes/ManifestPass.js';
24
+ import { AuthoringIntentPass } from './passes/AuthoringIntentPass.js';
25
+ import { ExplicitDefinitionPass } from './passes/ExplicitDefinitionPass.js';
26
+ import { assertEmbeddedGLB, interactionReviewSchema, assetDigest, canonicalAssetJson } from '../../model/AssetInputContracts.js';
27
+
28
+ export class AssetCompiler {
29
+ async compileVisual({ bytes, assetId, label = 'Imported model', persist = true }) {
30
+ assertEmbeddedGLB(bytes);
31
+ let context = { bytes, assetId, authoringIntent: { usage: 'static' }, compilerVersion: this.version };
32
+ for (const pass of [new GLTFInspectPass({ io: this.io }), new StructurePass(), new GeometryPass(), new OptimizeGLBPass({ io: this.io }), new ResourceBudgetPass()]) context = await pass.run(context);
33
+ const hard = [...context.geometry.warnings.filter(w => w.severity === 'hard'), ...context.resources.hard];
34
+ const advisory = [...context.geometry.warnings.filter(w => w.severity !== 'hard'), ...context.resources.advisory];
35
+ const quality = { status: hard.length ? 'rejected' : advisory.length ? 'provisional' : 'ready', hard, advisory };
36
+ if (hard.length) throw Object.assign(new Error('Visual asset rejected'), { code: 'ASSET_COMPILE_REJECTED', details: quality });
37
+ const manifest = { id: assetId, type: 'visual', label, capabilityLevel: 'visual', actions: [], source: { kind: 'compiled', key: assetId }, compiler: { version: this.version, quality, resources: context.resources } };
38
+ validateAssetManifest(manifest);
39
+ if (persist) await this.store.put(assetId, context.optimizedBytes, { manifestId: assetId, quality: quality.status });
40
+ return { manifest, quality, resources: context.resources, optimizedBytes: context.optimizedBytes };
41
+ }
42
+ constructor({ store, provider = null, events = null, version = 'dev' } = {}) {
43
+ this.store = store; this.provider = provider; this.events = events; this.version = version;
44
+ this.io = createAssetGLTFIO();
45
+ this.passes = [
46
+ new GLTFInspectPass({ io: this.io }),
47
+ new StructurePass(),
48
+ new NormalizeTransformPass(),
49
+ new GeometryPass(),
50
+ new KinematicEvidencePass(),
51
+ new SemanticHeuristicPass(),
52
+ new AuthoringIntentPass(),
53
+ new ArticulationCandidatePass(),
54
+ new ColliderFallbackPass(),
55
+ new RemoteEnrichmentPass({ provider }),
56
+ new SegmentMaterializePass(),
57
+ new SegmentationEvidencePass(),
58
+ new JointFramePass(),
59
+ new PartColliderPass(),
60
+ new PartProposalPass(),
61
+ new PartGeometryEnrichmentPass({ provider, io:this.io }),
62
+ new ArticulatedCollisionPass(),
63
+ new OptimizeGLBPass({ io: this.io }),
64
+ new ExplicitDefinitionPass(),
65
+ new ResourceBudgetPass(),
66
+ new CompileQualityPass(),
67
+ new ManifestPass()
68
+ ];
69
+ }
70
+
71
+ async fetchBytes(url) {
72
+ const response = await fetch(url);
73
+ if (!response.ok) throw new Error(`Failed to fetch GLB: HTTP ${response.status}`);
74
+ const declared = Number(response.headers.get('content-length') || 0);
75
+ if (declared > RESOURCE_BUDGET.maxInputBytes) throw Object.assign(new Error(`GLB exceeds input limit: ${declared}`), { code: 'ASSET_INPUT_TOO_LARGE' });
76
+ if (!response.body) return new Uint8Array(await response.arrayBuffer());
77
+
78
+ const reader = response.body.getReader();
79
+ const chunks = [];
80
+ let total = 0;
81
+ while (true) {
82
+ const { done, value } = await reader.read();
83
+ if (done) break;
84
+ total += value.byteLength;
85
+ if (total > RESOURCE_BUDGET.maxInputBytes) {
86
+ await reader.cancel();
87
+ throw Object.assign(new Error(`GLB exceeds input limit: ${total}`), { code: 'ASSET_INPUT_TOO_LARGE' });
88
+ }
89
+ chunks.push(value);
90
+ }
91
+ const bytes = new Uint8Array(total);
92
+ let offset = 0;
93
+ for (const chunk of chunks) { bytes.set(chunk, offset); offset += chunk.byteLength; }
94
+ return bytes;
95
+ }
96
+
97
+ async proposeInteraction({bytes,sourceName='import.glb',label,partProposal=null,urdfHash=null}={}) {
98
+ assertEmbeddedGLB(bytes);
99
+ const output=await this.compile({bytes,sourceName,label,assetId:'interaction_candidate',partProposal,interactionProposal:true,
100
+ authoringIntent:{usage:'static'},persist:false});
101
+ const sourceHash=await assetDigest(bytes);
102
+ const parts=(output.partProposal?.parts || []).map(part=>({ ...part, executable:false, physicsVerified:false,
103
+ missing:['mass','friction',...['axis','parentAnchor','childAnchor','limits'].filter(field=>part.joint?.[field]==null).map(field=>`joint.${field}`),'review-confirmation','runtime-verification'] }));
104
+ const proposal={schema:'agentscape.capability-proposal',schemaVersion:1,sourceHash,urdfHash,compilerVersion:this.version,
105
+ physics:{body:null,mass:null,friction:null,colliders:output.manifest.physics.colliders},parts,
106
+ kinematics:output.kinematicEvidence || {schema:'agentscape.kinematic-evidence',schemaVersion:1,hypotheses:[],issues:[]},
107
+ operations:[
108
+ ...(output.geometry.bounds.size.every(size=>Number.isFinite(size)&&size>0&&size<=1.25)
109
+ ? ['pickup','drop','place'].map(action=>({action,executable:false,physicsVerified:false,requires:'reviewed-dynamic-body-mass-and-carry-geometry'})) : []),
110
+ ...['push','drag','rotate'].map(action=>({action,executable:false,physicsVerified:false,requires:'reviewed-dynamic-body'})),
111
+ ...parts.filter(part=>['prismatic','revolute'].includes(part.joint?.type)).map(part=>({action:part.joint.type==='prismatic'?'slide':'rotateJoint',part:part.id,executable:false,physicsVerified:false,requires:'reviewed-and-verified-joint'})),
112
+ ...(output.articulation.candidates||[]).flatMap(candidate=>(candidate.suggestedActions||[])
113
+ .filter(action=>!['slide','rotateJoint'].includes(action))
114
+ .map(action=>({action,part:candidate.partId||candidate.node,executable:false,physicsVerified:false,
115
+ requires:'semantic-review-and-verified-joint-target'})))
116
+ ],
117
+ missing:['physics.body','physics.mass','physics.friction','review-confirmation','runtime-verification'],
118
+ evidence:{geometry:output.geometry.bounds,collisionStrategy:output.collision.strategy,articulationSource:output.partProposal?.source || output.articulation.source,
119
+ confidenceScope:'name-or-source-metadata-only; not physical verification',
120
+ semanticConfidence:output.manifest.compiler.semanticConfidence,jointFrame:output.partProposal?.jointFrame || null,
121
+ issues:output.partProposal?.issues || [],passes:['SemanticHeuristicPass','KinematicEvidencePass','ArticulationCandidatePass','PartColliderPass','JointFramePass']}};
122
+ return {...proposal,proposalId:await assetDigest(new TextEncoder().encode(canonicalAssetJson(proposal)))};
123
+ }
124
+
125
+ async compile({ url, bytes, sourceName, assetId, label, partProposal = null, partSegmentation = null, providerEvidence = null, authoringIntent = null, definition = null,
126
+ interactionProposal=false,interactionReview=null,persist=true } = {}) {
127
+ if(interactionReview) interactionReview=interactionReviewSchema.parse(interactionReview);
128
+ if (!bytes && !url) throw new Error('AssetCompiler requires url or bytes');
129
+ const inputBytes = bytes instanceof Uint8Array ? bytes : bytes ? new Uint8Array(bytes) : await this.fetchBytes(url);
130
+ if (inputBytes.byteLength > RESOURCE_BUDGET.maxInputBytes) {
131
+ const error = new Error(`GLB exceeds input limit: ${inputBytes.byteLength} > ${RESOURCE_BUDGET.maxInputBytes}`);
132
+ error.code = 'ASSET_INPUT_TOO_LARGE';
133
+ throw error;
134
+ }
135
+ const name = sourceName || (url ? new URL(url, globalThis.location?.href || 'http://localhost').pathname.split('/').pop() : 'asset.glb');
136
+ let context = { bytes:inputBytes, sourceUrl:url || null, sourceName:name, assetId, label, partProposal, partSegmentation, providerEvidence, authoringIntent, definition, interactionProposal,interactionReview, compilerVersion:this.version };
137
+ for (const pass of this.passes) {
138
+ const started = performance.now();
139
+ this.events?.emit('assetCompiler.pass.started', { pass: pass.constructor.name, sourceName: name });
140
+ context = await pass.run(context);
141
+ this.events?.emit('assetCompiler.pass.completed', { pass: pass.constructor.name, elapsedMs: Math.round(performance.now()-started) });
142
+ }
143
+ validateAssetManifest(context.manifest);
144
+ if (context.quality.status === 'rejected') {
145
+ const error = new Error('Asset compilation rejected by quality gate');
146
+ error.code = 'ASSET_COMPILE_REJECTED';
147
+ error.details = context.quality;
148
+ throw error;
149
+ }
150
+ const storageKey = context.manifest.source.key;
151
+ if(persist) await this.store.put(storageKey, context.optimizedBytes, { sourceName: name, manifestId: context.manifest.id, quality: context.quality.status });
152
+ return {
153
+ manifest: context.manifest,
154
+ optimizedBytes: context.optimizedBytes,
155
+ inspection: context.inspection,
156
+ structure: context.structure,
157
+ normalization: context.normalization,
158
+ geometry: context.geometry,
159
+ optimization: context.optimization,
160
+ articulation: context.articulation,
161
+ kinematicEvidence: context.kinematicEvidence || null,
162
+ collision: context.collision,
163
+ enrichment: context.enrichment,
164
+ meshQuality: context.meshQuality || null,
165
+ partProposal: context.partProposal || null,
166
+ partSegmentation: context.partSegmentation || null,
167
+ partCollision: context.partCollision || null,
168
+ partGeometry: context.partGeometry || null,
169
+ resources: context.resources,
170
+ quality: context.quality
171
+ };
172
+ }
173
+ }
@@ -0,0 +1,124 @@
1
+ import { Quaternion, Vector3 } from 'three';
2
+
3
+ // Experimental GLB motion-evidence extractor. This reports hypotheses only;
4
+ // it never authorizes or registers a physical interaction.
5
+ const round = value => Number(value.toFixed(6));
6
+ const vec = vector => vector.toArray().map(round);
7
+ const sqDistance = (a, b) => a.reduce((sum, x, i) => sum + (x - b[i]) ** 2, 0);
8
+ const dot = (a, b) => a.reduce((sum, x, i) => sum + x * b[i], 0);
9
+ const norm = value => Math.hypot(...value);
10
+ const sub = (a, b) => a.map((value, index) => value - b[index]);
11
+ const mul = (v, scalar) => v.map(value => value * scalar);
12
+ const hasMesh = node => Boolean(node.getMesh()) || node.listChildren().some(hasMesh);
13
+ const issue = (code, node, clip) => ({ code, node, clip });
14
+
15
+ function readSamples(channel) {
16
+ const sampler = channel.getSampler();
17
+ const path = channel.getTargetPath();
18
+ if (!sampler || sampler.getInterpolation() !== 'LINEAR') return { error:'INTERPOLATION_UNSUPPORTED' };
19
+ const input = sampler.getInput()?.getArray();
20
+ const output = sampler.getOutput()?.getArray();
21
+ const width = path === 'rotation' ? 4 : 3;
22
+ if (!input || !output || input.length < 2 || output.length !== input.length * width
23
+ || [...input, ...output].some(number => !Number.isFinite(number))
24
+ || Array.from(input).some((value, index) => index && value <= input[index - 1])) {
25
+ return { error:'ANIMATION_TRACK_INVALID' };
26
+ }
27
+ const samples = Array.from(input, (_, index) =>
28
+ Array.from(output.slice(index * width, (index + 1) * width)));
29
+ return { samples };
30
+ }
31
+
32
+ function translationMotion(node, samples) {
33
+ const rest = node.getTranslation();
34
+ if (sqDistance(rest, samples[0]) > 1e-6) return { error:'ANIMATION_REST_POSE_MISMATCH' };
35
+ const deltas = samples.map(sample => sub(sample, samples[0]));
36
+ const longest = deltas.reduce((best, value) => norm(value) > norm(best) ? value : best, [0, 0, 0]);
37
+ const span = norm(longest);
38
+ if (span < .03) return null;
39
+ const axis = mul(longest, 1 / span);
40
+ const residual = Math.max(...deltas.map(delta => norm(sub(delta, mul(axis, dot(delta, axis))))));
41
+ if (residual > Math.max(.005, span * .02)) return { error:'TRANSLATION_NONLINEAR' };
42
+ const values = deltas.map(delta => dot(delta, axis));
43
+ return { type:'prismatic', axis:axis.map(round), limits:[round(Math.min(0, ...values)), round(Math.max(0, ...values))],
44
+ residual:round(residual) };
45
+ }
46
+
47
+ function rotationMotion(node, samples) {
48
+ const start = new Quaternion().fromArray(samples[0]).normalize();
49
+ const rest = new Quaternion().fromArray(node.getRotation()).normalize();
50
+ if (Math.abs(start.dot(rest)) < .9999) return { error:'ANIMATION_REST_POSE_MISMATCH' };
51
+ const inverse = start.clone().invert();
52
+ const deltas = samples.map(sample => {
53
+ const delta = new Quaternion().fromArray(sample).normalize().multiply(inverse);
54
+ if (delta.w < 0) delta.set(-delta.x, -delta.y, -delta.z, -delta.w);
55
+ const sinHalf = Math.hypot(delta.x, delta.y, delta.z);
56
+ return { angle:2 * Math.atan2(sinHalf, delta.w),
57
+ axis:sinHalf > 1e-8 ? new Vector3(delta.x / sinHalf, delta.y / sinHalf, delta.z / sinHalf) : null };
58
+ });
59
+ const largest = deltas.reduce((best, value) => value.angle > best.angle ? value : best, deltas[0]);
60
+ if (largest.angle < .1) return null;
61
+ if (largest.angle > Math.PI - .01) return { error:'ROTATION_RANGE_AMBIGUOUS' };
62
+ const axis = largest.axis;
63
+ const signed = [];
64
+ for (const delta of deltas) {
65
+ if (delta.angle < 1e-5) { signed.push(0); continue; }
66
+ const alignment = delta.axis.dot(axis);
67
+ if (Math.abs(alignment) < .995) return { error:'ROTATION_MULTIPLE_AXES' };
68
+ signed.push(delta.angle * Math.sign(alignment));
69
+ }
70
+ const jumps = signed.slice(1).map((value, index) => Math.abs(value - signed[index]));
71
+ if (Math.max(...jumps) > Math.PI - .01) return { error:'ROTATION_UNWRAP_AMBIGUOUS' };
72
+ return { type:'revolute', axis:vec(axis), limits:[round(Math.min(0, ...signed)), round(Math.max(0, ...signed))],
73
+ residual:round(Math.max(...deltas.map(delta => delta.angle < 1e-5 ? 0 : 1 - Math.abs(delta.axis.dot(axis))))) };
74
+ }
75
+
76
+ export function inferAnimationMotion(document) {
77
+ const candidates = [], issues = [];
78
+ const nodes = document.getRoot().listNodes();
79
+ for (const animation of document.getRoot().listAnimations()) {
80
+ const clip = animation.getName() || '(unnamed)';
81
+ const tracks = new Map();
82
+ for (const channel of animation.listChannels()) {
83
+ const node = channel.getTargetNode();
84
+ const path = channel.getTargetPath();
85
+ if (!node || !['translation', 'rotation', 'scale'].includes(path)) continue;
86
+ if (!tracks.has(node)) tracks.set(node, {});
87
+ const group = tracks.get(node);
88
+ if (group[path]) { issues.push(issue('ANIMATION_DUPLICATE_CHANNEL', node.getName(), clip)); group.error = true; continue; }
89
+ group[path] = path === 'scale' ? { error:'SCALE_ANIMATION_UNSUPPORTED' } : readSamples(channel);
90
+ }
91
+ for (const [node, group] of tracks) {
92
+ if (group.error || !hasMesh(node)) continue;
93
+ if (group.scale) { issues.push(issue('SCALE_ANIMATION_UNSUPPORTED', node.getName(), clip)); continue; }
94
+ const translation = group.translation?.error ? group.translation
95
+ : group.translation ? translationMotion(node, group.translation.samples) : null;
96
+ const rotation = group.rotation?.error ? group.rotation
97
+ : group.rotation ? rotationMotion(node, group.rotation.samples) : null;
98
+ const error = translation?.error || rotation?.error
99
+ || (translation && rotation ? 'COMPOUND_MOTION_UNSUPPORTED' : null);
100
+ if (error) { issues.push(issue(error, node.getName(), clip)); continue; }
101
+ const motion = rotation || translation;
102
+ if (!motion) continue;
103
+ candidates.push({
104
+ node:node.getName() || null, nodeIndex:nodes.indexOf(node),
105
+ parent:node.getParentNode()?.getName() || '$root',
106
+ hypothesis:{ type:motion.type, axis:motion.axis,
107
+ parentAnchor:node.getTranslation().map(round), childAnchor:[0,0,0],
108
+ limits:motion.limits },
109
+ evidence:{ type:'gltf-animation', clip, sampleCount:(group.rotation || group.translation).samples.length,
110
+ axisResidual:motion.residual, scope:'observed-local-motion-not-mechanical-truth' },
111
+ status:'candidate', executable:false, physicsVerified:false,
112
+ missing:['geometry-contact-analysis','mass-and-colliders','isolated-physics-verification','task-verification']
113
+ });
114
+ }
115
+ }
116
+ // Multiple animation clips may depict different motions; no automatic merge
117
+ // without a coherence check, even if one axis looks plausible.
118
+ const count = new Map();
119
+ for (const candidate of candidates) count.set(candidate.nodeIndex, (count.get(candidate.nodeIndex) || 0) + 1);
120
+ for (const [nodeIndex, amount] of count) if (amount > 1)
121
+ issues.push({ code:'MULTIPLE_CLIPS_REQUIRE_REVIEW', node:nodes[nodeIndex].getName() });
122
+ return { schema:'agentscape.motion-evidence-experiment', schemaVersion:1,
123
+ candidates:candidates.filter(candidate => count.get(candidate.nodeIndex) === 1), issues };
124
+ }
@@ -0,0 +1,56 @@
1
+ import { getBounds } from '@gltf-transform/core';
2
+
3
+ // Report-only front/back planar-panel hypotheses. A static mesh does not prove
4
+ // a door or a hinge exists: both edge pivots remain unresolved alternatives.
5
+ const round = value => Number(value.toFixed(5));
6
+ const boxOf = node => {
7
+ const { min, max } = getBounds(node);
8
+ const size = min.map((value, index) => max[index] - value);
9
+ return { node, min, max, size, volume:size.reduce((product, value) => product * Math.max(0, value), 1) };
10
+ };
11
+ const overlap = (a, b, index) => Math.max(0, Math.min(a.max[index], b.max[index]) - Math.max(a.min[index], b.min[index]));
12
+
13
+ export function inferStaticPanelHypotheses(document) {
14
+ const nodes = document.getRoot().listNodes().filter(node => node.getMesh()).map(boxOf)
15
+ .filter(item => item.size.every(value => Number.isFinite(value) && value > 1e-5));
16
+ const body = [...nodes].sort((a, b) => b.volume - a.volume)[0];
17
+ const candidates = [];
18
+ if (!body || body.size[0] < .3 || body.size[1] < .3 || body.size[2] < .15) {
19
+ return { schema:'agentscape.static-panel-experiment',schemaVersion:1,candidates,limitations:['BODY_REFERENCE_NOT_AVAILABLE'] };
20
+ }
21
+ for (const part of nodes) {
22
+ if (part === body) continue;
23
+ const [width, height, depth] = part.size;
24
+ const widthCover = width / body.size[0], heightCover = height / body.size[1];
25
+ const thicknessRatio = depth / Math.min(width, height);
26
+ const xyOverlap = Math.min(overlap(part, body, 0) / width, overlap(part, body, 1) / height);
27
+ const positiveFaceGap = Math.abs(part.min[2] - body.max[2]);
28
+ const negativeFaceGap = Math.abs(part.max[2] - body.min[2]);
29
+ const face = positiveFaceGap <= negativeFaceGap ? 'front' : 'back';
30
+ const faceGap = Math.min(positiveFaceGap, negativeFaceGap);
31
+ const faceThreshold = Math.max(.035, body.size[2] * .09);
32
+ if (widthCover < .3 || widthCover > 1.12
33
+ || heightCover < .4 || heightCover > 1.12
34
+ || thicknessRatio > .12 || xyOverlap < .85
35
+ || faceGap > faceThreshold) continue;
36
+ const centerZ = (part.min[2] + part.max[2]) / 2;
37
+ candidates.push({
38
+ node:part.node.getName() || null,
39
+ nodeIndex:document.getRoot().listNodes().indexOf(part.node),
40
+ referenceNode:body.node.getName() || null,
41
+ kind:'planar-panel-near-body-face',
42
+ jointTypeHypothesis:'revolute',
43
+ alternatives:[
44
+ { axis:[0,1,0], worldHingeLinePoint:[round(part.min[0]),round(part.min[1]),round(centerZ)] },
45
+ { axis:[0,1,0], worldHingeLinePoint:[round(part.max[0]),round(part.min[1]),round(centerZ)] }
46
+ ],
47
+ evidence:{ source:'axis-aligned-geometry', face, widthCover:round(widthCover),
48
+ heightCover:round(heightCover), thicknessRatio:round(thicknessRatio),
49
+ surfaceGap:round(faceGap), xyOverlap:round(xyOverlap) },
50
+ status:'hypothesis', executable:false, physicsVerified:false,
51
+ missing:['semantic-function','which-hinge','rest-frame-validation','joint-limits','mass-and-colliders','physics-and-task-verification']
52
+ });
53
+ }
54
+ return { schema:'agentscape.static-panel-experiment',schemaVersion:1,candidates,
55
+ limitations:['ONLY_AXIS_ALIGNED_FRONT_BACK_PANELS','STATIC_GEOMETRY_CANNOT_PROVE_MOBILITY','BOTH_PIVOT_EDGES_AMBIGUOUS'] };
56
+ }
@@ -0,0 +1,6 @@
1
+ import { WebIO } from '@gltf-transform/core';
2
+ import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
3
+
4
+ export function createAssetGLTFIO() {
5
+ return new WebIO().registerExtensions(ALL_EXTENSIONS);
6
+ }
@@ -0,0 +1,74 @@
1
+ import * as THREE from 'three';
2
+
3
+ const ONE = new THREE.Vector3(1, 1, 1);
4
+
5
+ export function rigidInverse(node) {
6
+ if (!node) return new THREE.Matrix4();
7
+ const world = new THREE.Matrix4().fromArray(node.getWorldMatrix());
8
+ const position = new THREE.Vector3();
9
+ const rotation = new THREE.Quaternion();
10
+ const scale = new THREE.Vector3();
11
+ world.decompose(position, rotation, scale);
12
+ return new THREE.Matrix4().compose(position, rotation, ONE).invert();
13
+ }
14
+
15
+ function expandMeshBounds(target, meshNode, ownerInverse) {
16
+ const mesh = meshNode.getMesh();
17
+ if (!mesh) return 0;
18
+ const transform = ownerInverse.clone().multiply(new THREE.Matrix4().fromArray(meshNode.getWorldMatrix()));
19
+ const point = new THREE.Vector3();
20
+ const element = [0, 0, 0];
21
+ let visited = 0;
22
+
23
+ for (const primitive of mesh.listPrimitives()) {
24
+ const position = primitive.getAttribute('POSITION');
25
+ if (!position) continue;
26
+ const indices = primitive.getIndices();
27
+ const count = indices ? indices.getCount() : position.getCount();
28
+ for (let i = 0; i < count; i++) {
29
+ const index = indices ? indices.getScalar(i) : i;
30
+ position.getElement(index, element);
31
+ point.fromArray(element).applyMatrix4(transform);
32
+ target.expandByPoint(point);
33
+ visited += 1;
34
+ }
35
+ }
36
+ return visited;
37
+ }
38
+
39
+ export function boxCollidersForNodes(nodes, ownerNode = null) {
40
+ const ownerInverse = rigidInverse(ownerNode);
41
+ const colliders = [];
42
+ for (const node of nodes) {
43
+ if (!node.getMesh()) continue;
44
+ const box = new THREE.Box3();
45
+ if (!expandMeshBounds(box, node, ownerInverse) || box.isEmpty()) continue;
46
+ const size = new THREE.Vector3();
47
+ const center = new THREE.Vector3();
48
+ box.getSize(size);
49
+ box.getCenter(center);
50
+ colliders.push({
51
+ shape: 'box',
52
+ halfExtents: [Math.max(size.x / 2, 0.005), Math.max(size.y / 2, 0.005), Math.max(size.z / 2, 0.005)],
53
+ translation: center.toArray()
54
+ });
55
+ }
56
+ return colliders;
57
+ }
58
+
59
+ export function sceneMeshOwnership(scene, partNodes) {
60
+ const owners = new Map();
61
+ const partByNode = new Map(Object.entries(partNodes).map(([id, node]) => [node, id]));
62
+ for (const root of scene.listChildren()) {
63
+ root.traverse((node) => {
64
+ if (!node.getMesh()) return;
65
+ let owner = null;
66
+ for (let current = node; current; current = current.getParentNode?.()) {
67
+ if (partByNode.has(current)) { owner = partByNode.get(current); break; }
68
+ }
69
+ if (!owners.has(owner)) owners.set(owner, []);
70
+ owners.get(owner).push(node);
71
+ });
72
+ }
73
+ return owners;
74
+ }
@@ -0,0 +1,63 @@
1
+ import { boxCollidersForNodes, sceneMeshOwnership } from '../partGeometry.js';
2
+
3
+ export class ArticulatedCollisionPass {
4
+ async run(context) {
5
+ const parts = context.articulation.parts || {};
6
+ const ids = Object.keys(parts);
7
+ if (!ids.length) return context;
8
+ const root = context.document.getRoot();
9
+ const scene = root.getDefaultScene() || root.listScenes()[0];
10
+ if (!scene) return context;
11
+ const nodes = new Map(root.listNodes().map((node) => [node.getName(), node]));
12
+ const partNodes = {};
13
+ for (const id of ids) {
14
+ const node = nodes.get(parts[id].node);
15
+ if (node) partNodes[id] = node;
16
+ }
17
+ const ownership = sceneMeshOwnership(scene, partNodes);
18
+ const generated = [];
19
+ const preserved = [];
20
+ const finalParts = structuredClone(parts);
21
+
22
+ for (const id of ids) {
23
+ const part = finalParts[id];
24
+ if (!part.physics?.collider?.generated && part.physics?.colliders?.length) {
25
+ preserved.push({ part:id, colliders:part.physics.colliders.length });
26
+ continue;
27
+ }
28
+ const node = partNodes[id];
29
+ const colliders = boxCollidersForNodes(ownership.get(id) || [], node);
30
+ if (!colliders.length) continue;
31
+ part.physics = {
32
+ body: part.physics?.body || 'dynamic',
33
+ ...part.physics,
34
+ colliders,
35
+ collider: { strategy:'owned-mesh-aabb', quality:'coarse', generated:true }
36
+ };
37
+ generated.push({ part:id, colliders:colliders.length, meshNodes:(ownership.get(id) || []).map((item) => item.getName()) });
38
+ }
39
+
40
+ const rootColliders = boxCollidersForNodes(ownership.get(null) || []);
41
+ const generatedPartColliders = generated.length > 0;
42
+ const wholeAssetMass = Number.isFinite(context.physics?.mass) ? context.physics.mass : null;
43
+ const physics = context.physics ? { ...context.physics } : context.physics;
44
+ if (physics && wholeAssetMass != null) delete physics.mass;
45
+ return {
46
+ ...context,
47
+ physics,
48
+ articulation: { ...context.articulation, parts:finalParts },
49
+ collision: { strategy:'articulated-owned-mesh-aabb', quality:rootColliders.length || generatedPartColliders ? 'coarse' : 'provider-part-colliders', colliders:rootColliders },
50
+ partCollision: {
51
+ ...(context.partCollision || {}),
52
+ final: {
53
+ strategy:'nearest-executable-part-ownership',
54
+ rootColliders:rootColliders.length,
55
+ rootMeshNodes:(ownership.get(null) || []).map((node) => node.getName()),
56
+ generated,
57
+ preserved,
58
+ ...(wholeAssetMass != null ? { mass:{ status:'unpartitioned', wholeAssetMass } } : {})
59
+ }
60
+ }
61
+ };
62
+ }
63
+ }
@@ -0,0 +1,48 @@
1
+ const revoluteWords = ['door','lid','hinge','flap','valve','wheel','page','leaf','cover','knob','dial','门','盖','阀','轮','页','旋钮'];
2
+ const prismaticWords = ['drawer','slider','slide','抽屉','滑轨'];
3
+ const tokenize = name => String(name || '').replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase();
4
+ const includesWord = (name, word) => /^[a-z]+$/.test(word)
5
+ ? (name.match(/[a-z]+/g) || []).includes(word) : name.includes(word);
6
+
7
+ function suggestActions(name, jointType) {
8
+ if (jointType === 'prismatic') return ['slide'];
9
+ if (['page','leaf','页'].some(word => includesWord(name, word))) return ['turnPage'];
10
+ if (['lid','cover','door','hinge','flap','门','盖'].some(word => includesWord(name, word))) return ['open','close'];
11
+ if (['knob','dial','旋钮'].some(word => includesWord(name, word))) return ['adjust'];
12
+ return ['rotateJoint'];
13
+ }
14
+
15
+ /** Name/URDF hints may propose a joint, but never grant an executable action. */
16
+ export class ArticulationCandidatePass {
17
+ async run(context) {
18
+ const candidates = [];
19
+ const proposals = new Map((context.partProposal?.parts || [])
20
+ .filter(part => part.node && ['revolute','prismatic'].includes(part.joint?.type))
21
+ .map(part => [part.node, part]));
22
+ for (const node of context.inspection.nodes) {
23
+ const name = tokenize(node.name);
24
+ if (!name) continue;
25
+ const provider = proposals.get(node.name);
26
+ const revolute = revoluteWords.some(word => includesWord(name, word));
27
+ const prismatic = prismaticWords.some(word => includesWord(name, word));
28
+ const jointType = provider?.joint.type || (revolute ? 'revolute' : prismatic ? 'prismatic' : null);
29
+ if (!jointType) continue;
30
+ candidates.push({
31
+ node:node.name, jointType, ...(provider ? {partId:provider.id} : {}),
32
+ source:provider ? 'joint-metadata' : 'node-name-heuristic',
33
+ confidence:provider ? Math.min(1, Math.max(0, Number(provider.confidence) || 0.75))
34
+ : name.includes('hinge') ? .75 : jointType === 'prismatic' ? .55 : .5,
35
+ suggestedActions:suggestActions(name, jointType),
36
+ executable:false, physicsVerified:false, requiresReview:true
37
+ });
38
+ }
39
+ const partProposal = context.partProposal || (context.interactionProposal && candidates.length ? {
40
+ version:1,source:'node-name-heuristic',parts:candidates.map((candidate,index)=>({
41
+ id:'part_' + (index+1),node:candidate.node,joint:{type:candidate.jointType},
42
+ confidence:candidate.confidence,requiresReview:true
43
+ }))
44
+ } : null);
45
+ return { ...context, ...(partProposal ? {partProposal} : {}),
46
+ articulation: { candidates, source:'structural-candidate-analysis' } };
47
+ }
48
+ }
@@ -0,0 +1,16 @@
1
+ // Explicit authored intent is configuration, never evidence of runtime success.
2
+ export class AuthoringIntentPass {
3
+ async run(context) {
4
+ if (context.interactionReview) return {...context,semantics:{...context.semantics,actions:[]},physics:context.interactionReview.physics};
5
+ const intent = context.authoringIntent;
6
+ if (!intent) return context;
7
+ if (!['static', 'movable', 'interactive'].includes(intent.usage)) throw new TypeError('Invalid authoring usage');
8
+ if (intent.usage === 'interactive') return context;
9
+ const movable = intent.usage === 'movable';
10
+ return {
11
+ ...context,
12
+ semantics:{ ...context.semantics, actions:movable ? ['move', 'pickup', 'drop', 'place'] : ['move'] },
13
+ physics:{ ...context.physics, body:movable ? 'dynamic' : 'fixed' }
14
+ };
15
+ }
16
+ }
@@ -0,0 +1,30 @@
1
+ export class ColliderFallbackPass {
2
+ async run(context) {
3
+ const [x,y,z] = context.geometry.bounds.size;
4
+ const translation = context.geometry.bounds.center;
5
+ if (context.semantics?.tags?.includes('round')) {
6
+ const radius = Math.max(Math.min(x / 2, z / 2, Math.max(y / 2 - 0.005, 0.005)), 0.005);
7
+ const halfHeight = Math.max(y / 2 - radius, 0.005);
8
+ return {
9
+ ...context,
10
+ collision: {
11
+ strategy: 'capsule-fit',
12
+ quality: 'primitive',
13
+ colliders: [{ shape:'capsule', halfHeight, radius, translation }]
14
+ }
15
+ };
16
+ }
17
+ return {
18
+ ...context,
19
+ collision: {
20
+ strategy: 'aabb-fallback',
21
+ quality: 'coarse',
22
+ colliders: [{
23
+ shape: 'box',
24
+ halfExtents: [Math.max(x/2,0.005), Math.max(y/2,0.005), Math.max(z/2,0.005)],
25
+ translation
26
+ }]
27
+ }
28
+ };
29
+ }
30
+ }