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,115 +0,0 @@
1
- import { compileRuleGraph, evaluateRuleGraph, executeRuleEffects } from './RuleGraph.js';
2
-
3
- export class RuleRuntime {
4
- constructor(runtime, { maxCascadeDepth = 16 } = {}) {
5
- this.runtime = runtime;
6
- this.events = runtime.events;
7
- this.maxCascadeDepth = maxCascadeDepth;
8
- this.graph = compileRuleGraph([]);
9
- this.generation = 0;
10
- this.unsubscribe = null;
11
- this.queue = Promise.resolve();
12
- this.active = false;
13
- this.transactionEvents = null;
14
- this.transactionDepth = 0;
15
- this.waitingEvents = [];
16
- this.eventSuspensions = 0;
17
- }
18
-
19
- load(rulesOrGraph = []) {
20
- const rules = rulesOrGraph?.schema === 'agentscape.rule-graph' ? rulesOrGraph.rules : rulesOrGraph;
21
- const graph = compileRuleGraph(rules);
22
- this.graph = graph;
23
- this.generation += 1;
24
- return structuredClone(graph);
25
- }
26
-
27
- start() {
28
- if (this.unsubscribe) return;
29
- this.active = true;
30
- this.unsubscribe = this.events.on('*', (event) => {
31
- if (!this.active || this.eventSuspensions || event.type === 'rule.error' || !this.graph.rules.some((rule) => rule.event === event.type)) return;
32
- // Rules currently consume only the event type and cascade metadata, not mutable payloads.
33
- const depth = Math.max(this.transactionDepth, Number(event.meta?.ruleCascadeDepth) || 0);
34
- const entry = { generation:this.generation, event:{ type:event.type, meta:{ ruleCascadeDepth:depth } } };
35
- if (this.transactionEvents) this.transactionEvents.push(entry);
36
- else this.enqueue(entry);
37
- });
38
- }
39
-
40
- stop() {
41
- this.active = false;
42
- this.generation += 1;
43
- this.unsubscribe?.();
44
- this.unsubscribe = null;
45
- this.transactionEvents = null;
46
- this.transactionDepth = 0;
47
- this.waitingEvents.length = 0;
48
- }
49
-
50
- beginTransaction(depth = 0) {
51
- this.transactionEvents = [];
52
- this.transactionDepth = Math.max(0, Number(depth) || 0);
53
- }
54
-
55
- endTransaction(committed) {
56
- const events = committed ? this.transactionEvents || [] : [];
57
- this.transactionEvents = null;
58
- this.transactionDepth = 0;
59
- const waiting = this.waitingEvents.splice(0);
60
- for (const entry of [...waiting, ...events]) this.enqueue(entry);
61
- }
62
-
63
- suspendEvents() { this.eventSuspensions += 1; }
64
- resumeEvents() { this.eventSuspensions = Math.max(0, this.eventSuspensions - 1); }
65
-
66
- enqueue(entry) {
67
- this.queue = this.queue.then(() => {
68
- if (!this.active || entry.generation !== this.generation || this.eventSuspensions) return;
69
- // An event queued before a new write must wait without occupying the world lock.
70
- if (this.runtime.mutationOwner) {
71
- this.waitingEvents.push(entry);
72
- return;
73
- }
74
- return this.dispatchEvent(entry.event, { cascadeDepth:entry.event.meta.ruleCascadeDepth });
75
- }).catch((error) => {
76
- this.events.emit('rule.error', {
77
- error:{ code:error.code || 'RULE_RUNTIME_ERROR', message:error.message },
78
- sourceEvent:entry.event.type,
79
- meta:{ ruleCascadeDepth:entry.event.meta.ruleCascadeDepth + 1 }
80
- });
81
- });
82
- }
83
-
84
- readState(targetId, stateKey) {
85
- return this.runtime.store?.get?.(targetId)?.state?.[stateKey];
86
- }
87
-
88
- async dispatchEvent(event, { cascadeDepth = 0 } = {}) {
89
- if (!event?.type) return { status:'no-rule-event' };
90
- if (cascadeDepth >= this.maxCascadeDepth) {
91
- const error = new Error(`Rule cascade depth exceeded: ${event.type}`);
92
- error.code = 'RULE_CASCADE_DEPTH_EXCEEDED';
93
- throw error;
94
- }
95
- const effects = evaluateRuleGraph(this.graph, event.type, (id, key) => this.readState(id, key));
96
- const seen = new Set();
97
- const uniqueEffects = effects.filter((effect) => {
98
- const key = JSON.stringify([effect.targetId, effect.stateKey, effect.value]);
99
- if (seen.has(key)) return false;
100
- seen.add(key);
101
- return true;
102
- });
103
- if (!uniqueEffects.length) return { status:'no-rule-match', event:event.type, effects:[] };
104
- const result = await executeRuleEffects(this.runtime, uniqueEffects, {
105
- source:'rule-runtime', eventId:event.type, ruleCascadeDepth:cascadeDepth + 1
106
- });
107
- if (result.effects?.every((effect) => effect.changed === false)) {
108
- return { status:'no-rule-match', event:event.type, effects:[] };
109
- }
110
- this.events.emit('rule.effects-applied', {
111
- eventType:event.type, count:uniqueEffects.length, meta:{ ruleCascadeDepth:cascadeDepth + 1 }, result
112
- });
113
- return { status:'rules-applied', event:event.type, effects:uniqueEffects, result };
114
- }
115
- }
@@ -1,216 +0,0 @@
1
- // Broad-phase only: the SpatialSystem remains the source of truth for exact
2
- // ON / INSIDE geometry. Reject only pairs that cannot possibly match.
3
- const mayRestOn = (subjectBox, surface) => {
4
- const halfX=surface.size[0]/2+0.05;
5
- const halfZ=surface.size[1]/2+0.05;
6
- return subjectBox.min.x <= surface.center.x+halfX &&
7
- subjectBox.max.x >= surface.center.x-halfX &&
8
- subjectBox.min.z <= surface.center.z+halfZ &&
9
- subjectBox.max.z >= surface.center.z-halfZ &&
10
- subjectBox.min.y >= surface.center.y-0.03 &&
11
- subjectBox.min.y <= surface.center.y+0.12;
12
- };
13
-
14
- export class SceneGraph {
15
- constructor({ store, spatial, events = null } = {}) {
16
- this.store = store;
17
- this.spatial = spatial;
18
- this.events = events;
19
- this.edges = new Map();
20
- this.environmentFacts = [];
21
- this.batchDepth = 0;
22
- this.dirty = true;
23
- }
24
-
25
- key(subject, predicate, object) { return `${subject}|${predicate}|${object}`; }
26
-
27
- set(subject, predicate, object, meta = {}) {
28
- const edge = { subject, predicate, object, meta: { ...meta } };
29
- this.edges.set(this.key(subject, predicate, object), edge);
30
- return edge;
31
- }
32
-
33
- delete(subject, predicate, object) { return this.edges.delete(this.key(subject, predicate, object)); }
34
- clear() { this.edges.clear(); }
35
- reset() { this.edges.clear(); this.environmentFacts = []; this.dirty = false; this.batchDepth = 0; }
36
-
37
-
38
- setEnvironmentSemantics(environmentId, value = null) {
39
- this.environmentFacts = environmentSemanticFacts(environmentId, value);
40
- this.changed();
41
- return this.environmentFacts.map((fact) => ({ ...fact, meta:{...fact.meta} }));
42
- }
43
-
44
- removeObject(id) {
45
- for (const [key, edge] of this.edges) {
46
- if (edge.subject === id || edge.object === id) this.edges.delete(key);
47
- }
48
- }
49
-
50
- list({ subject, predicate, object } = {}) {
51
- return [...this.edges.values()].filter((edge) =>
52
- (!subject || edge.subject === subject) &&
53
- (!predicate || edge.predicate === predicate) &&
54
- (!object || edge.object === object)
55
- ).map((edge) => ({ ...edge, meta: { ...edge.meta } }));
56
- }
57
-
58
- invalidate() { this.dirty = true; }
59
-
60
- changed() {
61
- this.invalidate();
62
- if (this.batchDepth === 0) this.update();
63
- }
64
-
65
- async batch(operation) {
66
- this.batchDepth += 1;
67
- try {
68
- return await operation();
69
- } finally {
70
- this.batchDepth -= 1;
71
- if (this.batchDepth === 0) this.update();
72
- }
73
- }
74
-
75
- // update() means callers need a current graph. It may rebuild even inside a batch.
76
- update(snapshot = null) {
77
- if (this.dirty) this.rebuild(snapshot);
78
- }
79
-
80
- rebuild(snapshot = null) {
81
- const previous = JSON.stringify([...this.edges.values()]);
82
- this.clear();
83
- for (const fact of this.environmentFacts) this.set(fact.subject, fact.predicate, fact.object, fact.meta);
84
- const records = this.store.list().filter(([, record]) => record.active !== false);
85
- const spatialSnapshot = snapshot || this.spatial.snapshot();
86
- const surfaces = new Map();
87
- const containmentBounds = new Map();
88
-
89
- for (const [id, record] of records) {
90
- surfaces.set(id, (record.manifest.surfaces || [])
91
- .map((surface) => this.spatial.getSupportSurface(id, surface.id, spatialSnapshot))
92
- .filter(Boolean));
93
- const receptacles=record.manifest.receptacles||[];
94
- const zones=receptacles.length
95
- ? receptacles.map((entry)=>this.spatial.getReceptacle(id,entry.id,spatialSnapshot)?.box)
96
- : [spatialSnapshot.get(id).box];
97
- containmentBounds.set(id,zones.filter(Boolean).map((box)=>box.clone().expandByScalar(0.02)));
98
- }
99
-
100
- const deriveDirected = (subjectId, subject, targetId, target) => {
101
- for (const support of surfaces.get(targetId)) {
102
- if (!mayRestOn(subject.box,support)) continue;
103
- const status = this.spatial.supportGeometry(subjectId,targetId,{surfaceId:support.id,snapshot:spatialSnapshot});
104
- if (status.supported) {
105
- const meta = { surfaceId:support.id, gap:Number(status.gap.toFixed(3)), evidence:'spatial-geometry' };
106
- this.set(subjectId, 'ON', targetId, meta);
107
- this.set(targetId, 'SUPPORTS', subjectId, meta);
108
- }
109
- }
110
- if (containmentBounds.get(targetId).some((box)=>box.containsBox(subject.box))) {
111
- const containment = this.spatial.containmentGeometry(subjectId,targetId,{snapshot:spatialSnapshot});
112
- if (containment.inside) {
113
- const meta = { ...(containment.receptacleId ? { receptacleId:containment.receptacleId } : {}), evidence:'spatial-geometry' };
114
- this.set(subjectId, 'INSIDE', targetId, meta);
115
- this.set(targetId, 'CONTAINS', subjectId, meta);
116
- }
117
- }
118
- };
119
-
120
- for (let i = 0; i < records.length; i++) {
121
- const [id] = records[i];
122
- const a = spatialSnapshot.get(id);
123
- for (let j = i + 1; j < records.length; j++) {
124
- const [otherId] = records[j];
125
- const b = spatialSnapshot.get(otherId);
126
- const distance = a.center.distanceTo(b.center);
127
- if (distance <= 2) {
128
- const meta = { distance: Number(distance.toFixed(3)) };
129
- this.set(id, 'NEAR', otherId, meta);
130
- this.set(otherId, 'NEAR', id, meta);
131
- }
132
- deriveDirected(id, a, otherId, b);
133
- deriveDirected(otherId, b, id, a);
134
- }
135
- }
136
-
137
- this.dirty = false;
138
- const next = JSON.stringify([...this.edges.values()]);
139
- if (next !== previous) this.events?.emit('sceneGraph.updated', { edges: this.edges.size });
140
- }
141
-
142
- describe(id) {
143
- return {
144
- outgoing: this.list({ subject: id }),
145
- incoming: this.list({ object: id })
146
- };
147
- }
148
- }
149
-
150
- const semanticKey = (label) => encodeURIComponent(String(label).trim().toLocaleLowerCase());
151
- const instanceKey = (id) => encodeURIComponent(String(id).trim());
152
- const finiteVec3 = (value) => Array.isArray(value) && value.length === 3 && value.every(Number.isFinite);
153
-
154
- function semanticPayload(value) {
155
- if (Array.isArray(value)) return { categories:value, instances:[], granularity:'category', sourceKind:'category-list', provenance:null };
156
- if ([1,2].includes(value?.schemaVersion) && Array.isArray(value.categories) && Array.isArray(value.instances)) {
157
- return {
158
- categories:value.categories, instances:value.instances,
159
- granularity:value.instances.length ? 'instance' : 'category',
160
- sourceKind:`runtime-semantics-v${value.schemaVersion}`,
161
- schemaVersion:value.schemaVersion,
162
- provenance:value.provenance && typeof value.provenance==='object' ? structuredClone(value.provenance) : null
163
- };
164
- }
165
- return { categories:[], instances:[], granularity:'none', sourceKind:value == null ? 'none' : 'unsupported', provenance:null };
166
- }
167
-
168
- function environmentSemanticFacts(environmentId, value) {
169
- const {categories,instances,granularity,sourceKind,provenance}=semanticPayload(value);
170
- const subject=`environment:${String(environmentId || 'environment')}`;
171
- const seenCategories=new Set();
172
- const facts=[];
173
- const addCategory=(rawLabel) => {
174
- if (typeof rawLabel !== 'string') return null;
175
- const label=rawLabel.trim();
176
- if (!label) return null;
177
- const key=label.toLocaleLowerCase();
178
- const categoryId=`semantic-category:${semanticKey(label)}`;
179
- if (!seenCategories.has(key)) {
180
- seenCategories.add(key);
181
- facts.push({
182
- subject,predicate:'HAS_CATEGORY',object:categoryId,
183
- meta:{label,granularity,sourceKind,...(provenance?{provenance:structuredClone(provenance)}:{})}
184
- });
185
- }
186
- return categoryId;
187
- };
188
- for (const item of categories) addCategory(item);
189
-
190
- const seenInstances=new Set();
191
- for (const item of instances) {
192
- if (!item || typeof item !== 'object' || Array.isArray(item)) continue;
193
- const id=typeof item.id === 'string' ? item.id.trim() : '';
194
- const label=typeof item.label === 'string' ? item.label.trim() : '';
195
- if (!id || !label) continue;
196
- let spatialMeta=null;
197
- if (finiteVec3(item.center) && finiteVec3(item.bbox?.min) && finiteVec3(item.bbox?.max)) {
198
- spatialMeta={center:[...item.center],bbox:{min:[...item.bbox.min],max:[...item.bbox.max]}};
199
- } else if (item.localization?.kind==='point-scale' && finiteVec3(item.localization.center) && Number.isFinite(item.localization.scale) && item.localization.scale>0) {
200
- spatialMeta={localization:structuredClone(item.localization)};
201
- } else continue;
202
- const instanceId=`semantic-instance:${instanceKey(id)}`;
203
- if (seenInstances.has(instanceId)) continue;
204
- seenInstances.add(instanceId);
205
- const categoryId=addCategory(label);
206
- const meta={
207
- id,label,...spatialMeta,
208
- ...(Number.isFinite(item.confidence)?{confidence:item.confidence}:{}),
209
- ...(item.evidence && typeof item.evidence==='object'?{evidence:structuredClone(item.evidence)}:{}),
210
- sourceKind,...(provenance?{provenance:structuredClone(provenance)}:{})
211
- };
212
- facts.push({subject,predicate:'HAS_INSTANCE',object:instanceId,meta});
213
- facts.push({subject:instanceId,predicate:'INSTANCE_OF',object:categoryId,meta:{label,sourceKind}});
214
- }
215
- return facts;
216
- }
@@ -1,214 +0,0 @@
1
- import * as THREE from 'three';
2
- import { Errors } from '../../errors.js';
3
- import { getInteractionContract } from './InteractionContract.js';
4
-
5
- export class ArticulationRuntime {
6
- constructor({ store, physics, events, assertSupports }) {
7
- this.store = store;
8
- this.physics = physics;
9
- this.events = events;
10
- this.assertSupports = assertSupports;
11
- this.tasks = new Map();
12
- this.results = new Map();
13
- }
14
-
15
- key(id, partName) { return `${id}:${partName}`; }
16
-
17
- findPartForAction(record, action, partName = null) {
18
- const parts = Object.entries(record.manifest.parts || {}).filter(([name, part]) =>
19
- (!partName || name === partName) && part.actions?.includes(action) && Number.isFinite(part.targets?.[action])
20
- );
21
- if (parts.length !== 1) throw Errors.actionUnsupported(record.id, partName ? `${action}:${partName}` : action);
22
- return parts[0];
23
- }
24
-
25
- actionSweepBounds(targetId, action, partName = null, samples = 9) {
26
- const record = this.store.get(targetId);
27
- const [name, part] = this.findPartForAction(record, action, partName);
28
- const node = record.object.getObjectByName(part.node);
29
- const rest = this.physics.getPartRestPose(targetId, name);
30
- if (!node || !node.parent || !rest) return { checked:false, reason:'PART_REST_POSE_UNAVAILABLE', partName:name };
31
- if (part.joint.type === 'revolute' && Math.hypot(...(part.joint.childAnchor || [0,0,0])) > 1e-5) {
32
- return { checked:false, reason:'REVOLUTE_CHILD_ANCHOR_UNSUPPORTED', partName:name };
33
- }
34
- const target = part.targets[action];
35
- const live = this.physics.getArticulationState(targetId,name,{target});
36
- if (!live) return { checked:false, reason:'JOINT_COORDINATE_UNAVAILABLE', partName:name };
37
- const axis = new THREE.Vector3(...live.localAxis);
38
- const currentCoordinate = live.coordinate;
39
- const restPosition = new THREE.Vector3(...rest.position);
40
- const restRotation = new THREE.Quaternion(...rest.rotation);
41
- const originalPosition = node.position.clone();
42
- const originalRotation = node.quaternion.clone();
43
- const swept = new THREE.Box3();
44
- try {
45
- for (let i = 0; i < samples; i++) {
46
- const alpha = samples === 1 ? 1 : i / (samples - 1);
47
- const coordinate = currentCoordinate + (target - currentCoordinate) * alpha;
48
- if (part.joint.type === 'prismatic') {
49
- node.position.copy(restPosition).addScaledVector(axis, coordinate);
50
- node.quaternion.copy(restRotation);
51
- } else {
52
- node.position.copy(restPosition);
53
- node.quaternion.setFromAxisAngle(axis, coordinate).multiply(restRotation);
54
- }
55
- node.updateMatrixWorld(true);
56
- swept.union(new THREE.Box3().setFromObject(node));
57
- }
58
- } finally {
59
- node.position.copy(originalPosition);
60
- node.quaternion.copy(originalRotation);
61
- node.updateMatrixWorld(true);
62
- }
63
- if (swept.isEmpty()) return { checked:false, reason:'PART_SWEEP_EMPTY', partName:name };
64
- swept.expandByScalar(.02);
65
- return { checked:true, partName:name, action, currentCoordinate, target, bounds:{ min:swept.min.toArray(), max:swept.max.toArray() }, box:swept };
66
- }
67
-
68
- finish(task, result) {
69
- const key = this.key(task.id, task.partName);
70
- if (this.tasks.get(key) !== task) return;
71
- this.tasks.delete(key);
72
- const report = { ...result, id:task.id, partName:task.partName, action:task.action, target:task.target };
73
- this.results.set(key, report);
74
- this.events.emit('interaction', { ...report, action:'articulation-completion', articulationAction:report.action });
75
- task.resolve(report);
76
- }
77
-
78
- wait(id, partName, action, target, { timeout = 4, stableDuration = .18, stallWindow = .5, stallTolerance = .004 } = {}) {
79
- const key = this.key(id, partName);
80
- const existing = this.tasks.get(key);
81
- if (existing && existing.action === action && Math.abs(existing.target-target) <= 1e-9) return existing.promise;
82
- if (existing) this.finish(existing, { status:'action-unverified', reason:'SUPERSEDED', targetReached:false, settled:false, elapsed:Number(existing.elapsed.toFixed(3)) });
83
- const state = this.physics.getArticulationState(id, partName, { target });
84
- if (!state) return Promise.resolve({ status:'action-unverified', reason:'JOINT_STATE_UNAVAILABLE', id, partName, action, target, targetReached:false, settled:false, elapsed:0 });
85
- let resolveTask;
86
- const task = { id, partName, action, target, timeout, stableDuration, stallWindow, stallTolerance, elapsed:0, stable:0, initialCoordinate:state.coordinate, samples:[{ time:0, coordinate:state.coordinate }], resolve:null, promise:null };
87
- task.promise = new Promise((resolve) => { resolveTask = resolve; });
88
- task.resolve = resolveTask;
89
- this.tasks.set(key, task);
90
- return task.promise;
91
- }
92
-
93
- promoteCompletion(report) {
94
- if (report?.status !== 'action-completed' || !report.targetReached || !this.store.has(report.id)) return false;
95
- const record = this.store.get(report.id);
96
- if (record.state.partTargets?.[report.partName] !== report.action) return false;
97
- record.state.parts ||= {};
98
- record.state.parts[report.partName] = report.action;
99
- delete record.state.partTargets[report.partName];
100
- if (!Object.keys(record.state.partTargets).length) delete record.state.partTargets;
101
- return true;
102
- }
103
-
104
- finalizeAttempt(report) {
105
- if (!report || !['action-failed','action-unverified'].includes(report.status) || !this.store.has(report.id)) return false;
106
- const record = this.store.get(report.id);
107
- if (record.state.partTargets?.[report.partName] !== report.action) return false;
108
- this.physics.holdArticulationCurrent?.(report.id,report.partName);
109
- delete record.state.partTargets[report.partName];
110
- if (!Object.keys(record.state.partTargets).length) delete record.state.partTargets;
111
- return true;
112
- }
113
-
114
- status(id, partName = null) {
115
- const record = this.store.get(id);
116
- const entries = Object.entries(record.manifest.parts || {}).filter(([name,part]) =>
117
- (!partName || name === partName) && part.joint && part.physics && part.joint.type !== 'fixed'
118
- );
119
- if (!entries.length) throw Errors.actionUnsupported(id, partName ? `status:${partName}` : 'articulation-status');
120
- const parts = entries.map(([name,part]) => {
121
- const key = this.key(id,name);
122
- const pending = this.tasks.get(key);
123
- const last = this.results.get(key) || null;
124
- const requestedAction = record.state.partTargets?.[name] || null;
125
- const verifiedAction = record.state.parts?.[name] || null;
126
- const targetAction = pending?.action || requestedAction || verifiedAction;
127
- const target = targetAction && Number.isFinite(part.targets?.[targetAction]) ? part.targets[targetAction] : null;
128
- const live = this.physics.getArticulationState(id,name,{target});
129
- return {
130
- partName:name,
131
- status:pending ? 'moving' : (last?.status || (verifiedAction ? 'verified-state' : 'idle')),
132
- requestedAction,verifiedAction,
133
- ...(pending ? { pending:{action:pending.action,target:pending.target,elapsed:Number(pending.elapsed.toFixed(3))} } : {}),
134
- ...(last ? { last:structuredClone(last) } : {}),
135
- ...(live ? { live:{coordinate:live.coordinate,target:live.target,error:live.error,tolerance:live.tolerance,coordinateReference:live.coordinateReference} } : {})
136
- };
137
- });
138
- return { id, parts };
139
- }
140
-
141
- failureAttribution(id, partName) {
142
- const contacts=(this.physics.articulationContacts?.(id,partName) || []).filter((item)=>item.external);
143
- const blockerMap=new Map();
144
- for (const item of contacts) {
145
- const target=item.target || {};
146
- if (!['object','environment'].includes(target.kind)) continue;
147
- const key=target.kind==='object' ? `object:${target.objectId}:${target.partName || '$root'}` : `environment:${target.environmentId}:${target.colliderIndex ?? -1}`;
148
- if (!blockerMap.has(key)) blockerMap.set(key,structuredClone(target));
149
- }
150
- return { status:contacts.length ? 'contact-evidence' : 'unattributed', evidence:'current-contact-at-failure', contactEvidence:contacts, blockerCandidates:[...blockerMap.values()] };
151
- }
152
-
153
- execute(id, action, { partName = null } = {}) {
154
- const record = this.assertSupports(id, action);
155
- const [name, part] = this.findPartForAction(record, action, partName);
156
- const contract = getInteractionContract(record.manifest, name, action);
157
- if (contract.effects[0]?.kind !== 'set-articulation-target' || contract.verifierTarget.target !== part.targets[action]) throw Errors.actionUnsupported(id, action);
158
- if (!this.physics.setArticulationTarget(id, name, part.targets[action])) throw Errors.actionUnsupported(id, action);
159
- record.state.partTargets ||= {};
160
- record.state.partTargets[name] = action;
161
- this.results.delete(this.key(id,name));
162
- this.wait(id,name,action,part.targets[action]);
163
- this.events.emit('interaction', { action, id, part:name, target:part.targets[action] });
164
- return { id, part:name, action, capability:contract.capability, target:part.targets[action], requested:true, interactionContractId:contract.id, verifierTarget:structuredClone(contract.verifierTarget) };
165
- }
166
-
167
- update(dt) {
168
- const wrap = (jointType, value) => jointType === 'revolute' ? Math.atan2(Math.sin(value), Math.cos(value)) : value;
169
- for (const task of [...this.tasks.values()]) {
170
- task.elapsed += dt;
171
- const guarded = task.guard?.();
172
- if (guarded) {
173
- this.physics.holdArticulationCurrent(task.id, task.partName);
174
- this.finish(task, { status:'action-unverified', reason:guarded, targetReached:false, settled:false });
175
- continue;
176
- }
177
- const state = this.physics.getArticulationState(task.id, task.partName, { target:task.target });
178
- if (!state || !Number.isFinite(state.coordinate) || !Number.isFinite(state.error)) {
179
- this.finish(task, { status:'action-unverified', reason:'JOINT_STATE_UNAVAILABLE', targetReached:false, settled:false, elapsed:Number(task.elapsed.toFixed(3)) });
180
- continue;
181
- }
182
- const limits = state.limits;
183
- if (limits?.length === 2 && (state.coordinate < limits[0]-state.tolerance || state.coordinate > limits[1]+state.tolerance)) {
184
- this.finish(task, { status:'action-failed', reason:'LIMIT_VIOLATION', targetReached:false, settled:false, coordinate:state.coordinate, error:state.error, tolerance:state.tolerance, limits, elapsed:Number(task.elapsed.toFixed(3)) });
185
- continue;
186
- }
187
- const reached = state.error <= state.tolerance;
188
- task.stable = reached ? task.stable + dt : 0;
189
- task.samples.push({ time:task.elapsed, coordinate:state.coordinate });
190
- const cutoff = task.elapsed - task.stallWindow;
191
- while (task.samples.length > 2 && task.samples[1].time <= cutoff) task.samples.shift();
192
- const oldest = task.samples[0];
193
- const recentMovement = Math.abs(wrap(state.jointType, state.coordinate-oldest.coordinate));
194
- const observedWindow = task.elapsed-oldest.time;
195
- const stableCutoff = task.elapsed-task.stableDuration;
196
- const stableReference = task.samples.find((sample) => sample.time >= stableCutoff) || oldest;
197
- const settleMovement = Math.abs(wrap(state.jointType, state.coordinate-stableReference.coordinate));
198
- const settleTolerance = state.tolerance*.25;
199
- const progress = Math.abs(wrap(state.jointType, task.initialCoordinate-task.target)) - state.error;
200
- if (task.stable >= task.stableDuration && settleMovement <= settleTolerance) {
201
- this.finish(task, { status:'action-completed', targetReached:true, settled:true, coordinate:state.coordinate, error:state.error, tolerance:state.tolerance, settleMovement:Number(settleMovement.toFixed(6)), settleTolerance:Number(settleTolerance.toFixed(6)), progress:Number(progress.toFixed(6)), elapsed:Number(task.elapsed.toFixed(3)), coordinateReference:state.coordinateReference });
202
- continue;
203
- }
204
- if (!reached && task.elapsed >= task.stallWindow && observedWindow >= task.stallWindow*.8 && recentMovement < task.stallTolerance) {
205
- const attribution = this.failureAttribution(task.id, task.partName);
206
- this.finish(task, { status:'action-failed', reason:'STALL', targetReached:false, settled:false, coordinate:state.coordinate, error:state.error, tolerance:state.tolerance, recentMovement:Number(recentMovement.toFixed(6)), stallWindow:task.stallWindow, progress:Number(progress.toFixed(6)), elapsed:Number(task.elapsed.toFixed(3)), coordinateReference:state.coordinateReference, attribution });
207
- continue;
208
- }
209
- if (task.elapsed >= task.timeout) {
210
- this.finish(task, { status:'action-unverified', reason:'TIMEOUT', targetReached:false, settled:false, coordinate:state.coordinate, error:state.error, tolerance:state.tolerance, recentMovement:Number(recentMovement.toFixed(6)), progress:Number(progress.toFixed(6)), elapsed:Number(task.elapsed.toFixed(3)), coordinateReference:state.coordinateReference });
211
- }
212
- }
213
- }
214
- }
@@ -1,65 +0,0 @@
1
- import { assetAdmission } from '../../../asset/model/admission.js';
2
-
3
- // Kinematic-anchor carrying is not force-verified grasping. These conservative
4
- // defaults describe the existing single-anchor humanoid, not every robot.
5
- export const DEFAULT_CARRY_LIMITS = Object.freeze({ mass: 15, span: 1.25, colliderCount: 16 });
6
- const shapes = new Set(['box', 'cylinder', 'capsule']);
7
- const deny = reason => ({ eligible: false, reason, mode: 'kinematic-anchor', graspVerified: false });
8
- const positive = n => Number.isFinite(n) && n > 0;
9
-
10
- function colliderExtents(collider) {
11
- if (collider.shape === 'box' && collider.halfExtents?.length === 3
12
- && collider.halfExtents.every(positive)) return collider.halfExtents;
13
- if (collider.shape === 'cylinder' && positive(collider.radius) && positive(collider.halfHeight))
14
- return [collider.radius, collider.halfHeight, collider.radius];
15
- if (collider.shape === 'capsule' && positive(collider.radius) && positive(collider.halfHeight))
16
- return [collider.radius, collider.halfHeight + collider.radius, collider.radius];
17
- return null;
18
- }
19
-
20
- /** Physical eligibility only; reach, occupied hands, and motion sweeps are live checks. */
21
- export function inferCarryCapability(manifest, { scale = 1, limits = DEFAULT_CARRY_LIMITS, allowProvisional = false } = {}) {
22
- const physics = manifest?.physics;
23
- if (physics?.carryable === false) return deny('CARRY_DISABLED');
24
- if (manifest?.capabilityLevel === 'visual') return deny('TARGET_PHYSICS_UNAVAILABLE');
25
- if (physics?.body !== 'dynamic') return deny('TARGET_NOT_DYNAMIC');
26
- if (physics.sensor === true) return deny('CARRY_SENSOR_UNSUPPORTED');
27
- if (physics.lockTranslation?.some(Boolean)) return deny('CARRY_TRANSLATION_LOCKED');
28
- if (Object.keys(manifest.parts || {}).length) return deny('ARTICULATED_TARGET_UNSUPPORTED');
29
- if (!positive(physics.mass)) return deny('CARRY_MASS_UNDECLARED');
30
- if (!positive(scale)) return deny('CARRY_SCALE_INVALID');
31
- if (physics.mass * scale ** 3 > limits.mass) return deny('CARRY_MASS_EXCEEDED');
32
- const colliders = physics.colliders || [];
33
- if (!colliders.length || colliders.length > limits.colliderCount || colliders.some(c => !shapes.has(c.shape)))
34
- return deny('CARRY_COLLIDER_UNSUPPORTED');
35
- const low = [Infinity, Infinity, Infinity], high = [-Infinity, -Infinity, -Infinity];
36
- for (const collider of colliders) {
37
- const extents = colliderExtents(collider);
38
- if (!extents) return deny('CARRY_COLLIDER_UNSUPPORTED');
39
- const rotation = collider.rotation || [0, 0, 0, 1];
40
- if (!Array.isArray(rotation) || rotation.length !== 4 || !rotation.every(Number.isFinite)
41
- || Math.abs(rotation[0]) > 1e-6 || Math.abs(rotation[2]) > 1e-6)
42
- return deny('CARRY_COLLIDER_ROTATION_UNSUPPORTED');
43
- const t = collider.translation || [0, 0, 0];
44
- if (t.length !== 3 || !t.every(Number.isFinite)) return deny('CARRY_COLLIDER_UNSUPPORTED');
45
- // A yaw-rotated collider is bounded conservatively by its horizontal radius.
46
- const horizontal = Math.hypot(extents[0], extents[2]);
47
- for (let axis = 0; axis < 3; axis++) {
48
- const extent = axis === 1 ? extents[1] : horizontal;
49
- low[axis] = Math.min(low[axis], (t[axis] - extent) * scale);
50
- high[axis] = Math.max(high[axis], (t[axis] + extent) * scale);
51
- }
52
- }
53
- const span = high.map((value, axis) => value - low[axis]);
54
- if (span.some(value => value > limits.span)) return deny('CARRY_SIZE_EXCEEDED');
55
- if (manifest.source?.kind === 'compiled') {
56
- const admission = assetAdmission(manifest);
57
- const approvedEditing = allowProvisional && admission.status === 'provisional'
58
- && manifest.provenance?.authoringIntent?.usage === 'movable';
59
- if (admission.status !== 'ready' && !approvedEditing) return deny('CARRY_ASSET_UNVERIFIED');
60
- }
61
- return { eligible: true, reason: null, source: 'physical-geometry', mode: 'kinematic-anchor',
62
- graspVerified: false, mass: physics.mass, span: span.map(value => Number(value.toFixed(4))) };
63
- }
64
-
65
- export const isCarryOperation = action => ['pickup', 'drop', 'place'].includes(action);