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,189 @@
1
+ // Return bounded schema issues to the model, never rejected raw input values.
2
+ function validationDetails(error) {
3
+ if (!Array.isArray(error?.issues)) return [];
4
+ const flatten = issues => issues.flatMap(issue => {
5
+ if (issue.code !== 'invalid_union' || !Array.isArray(issue.errors)) return [issue];
6
+ const branches = issue.errors.filter(Array.isArray);
7
+ if (!branches.length) return [issue];
8
+ const ranked = branches.map(items => ({
9
+ items, depth:Math.max(0, ...items.map(item => item.path?.length || 0))
10
+ })).sort((a, b) => b.depth - a.depth || a.items.length - b.items.length);
11
+ return flatten(ranked[0].items);
12
+ });
13
+ return flatten(error.issues).slice(0, 12).map(issue => ({
14
+ path:Array.isArray(issue.path) ? issue.path.join('.') : '',
15
+ code:issue.code || 'invalid_input',
16
+ message:String(issue.message || 'Invalid input').slice(0, 240)
17
+ }));
18
+ }
19
+ const objectSchema = (skill) => ({
20
+ type: 'object',
21
+ properties: skill.properties || {},
22
+ required: skill.required || [],
23
+ additionalProperties: false
24
+ });
25
+
26
+ const VERIFIED_STATUSES = new Set(['action-completed', 'arrived', 'held', 'placed', 'dropped', 'recovery-cleaned', 'repair-applied']);
27
+ const BLOCKED_STATUSES = new Set(['blocked', 'unreachable', 'interaction-blocked', 'pickup-blocked', 'place-blocked']);
28
+ const FAILED_STATUSES = new Set(['action-failed', 'place-failed']);
29
+ const UNVERIFIED_STATUSES = new Set(['action-unverified', 'place-unverified', 'cancelled']);
30
+ const REQUESTED_STATUSES = new Set(['moving', 'interaction-requested']);
31
+ BLOCKED_STATUSES.add("connection-required");
32
+ for (const status of ["generation-failed","generation-cancelled","generation-expired"]) FAILED_STATUSES.add(status);
33
+ for (const status of ["provider-succeeded","artifact-imported"]) UNVERIFIED_STATUSES.add(status);
34
+ for (const status of ["generation-pending","generation-cancelling"]) REQUESTED_STATUSES.add(status);
35
+
36
+ function classifyResult(result) {
37
+ if (result && typeof result === 'object' && !Array.isArray(result)) {
38
+ if(result.schema==='agentscape.scene-result' && result.operation==='interact') {
39
+ const verified=result.status==='succeeded' && result.verification?.status==='verified';
40
+ if (result.status === 'succeeded' && result.value?.status === 'project-action-completed' && !verified)
41
+ return { state:result.value.verificationRequested ? 'unverified' : 'accepted', verified:false, status:result.status, reason:'PROJECT_ACTION_UNVERIFIED' };
42
+ return {state:verified?'verified':result.status==='cancelled'?'unverified':'failed',verified,status:result.status,
43
+ reason:verified?null:result.value?.reason || result.diagnostics?.[0]?.code || 'SCENE_INTERACTION_UNVERIFIED'};
44
+ }
45
+ const toolError = typeof result.error === 'string'
46
+ || (result.error && typeof result.error === 'object' && (result.error.code || result.code));
47
+ if (toolError) return { state:'error', verified:false, reason:result.code || result.error?.code || 'TOOL_ERROR' };
48
+ if (result.committed === false || result.rolledBack === true) return { state:'failed', verified:false, reason:result.reason || 'BATCH_NOT_COMMITTED' };
49
+ if (result.accepted === false) return { state:'failed', verified:false, reason:result.reason || 'RESULT_NOT_ACCEPTED' };
50
+ if (result.committed === true && result.rolledBack === false) return { state:'verified', verified:true, status:'committed' };
51
+ const status = typeof result.status === 'string' ? result.status : null;
52
+ if (status) {
53
+ if (status === 'authoring-provisional') return { state:'unverified', verified:false, status, reason:'ASSET_PROVISIONAL' };
54
+ if (status === 'authoring-code-applied') return { state:'accepted', verified:null, status };
55
+ if (status === 'authoring-code-rejected') return { state:'failed', verified:false, status, reason:result.reason || 'AUTHORING_CODE_REJECTED' };
56
+ if (status === 'authoring-code-empty') return { state:'noop', verified:false, status, reason:'AUTHORING_CODE_NO_CHANGE' };
57
+ if (status === 'authoring-verified') {
58
+ const evidence = result.verification;
59
+ const verified = evidence?.physics?.registered === true && evidence.physics.placement?.checked === true
60
+ && evidence.physics.placement.clear === true && evidence.navigation?.success === true
61
+ && ['verified', 'not-applicable'].includes(evidence.interaction?.status);
62
+ return { state:verified ? 'verified' : 'unverified', verified, status };
63
+ }
64
+ if(status==='world-action-completed') return result.verified===true && typeof result.evidenceKind==='string' && result.after
65
+ ? {state:'verified',verified:true,status} : {state:'unverified',verified:false,status,reason:'POST_CONDITION_NOT_VERIFIED'};
66
+ if (VERIFIED_STATUSES.has(status)) {
67
+ const contractVerified = status === 'action-completed'
68
+ ? result.targetReached === true && result.settled === true
69
+ : status === 'placed'
70
+ ? result.supportVerified === true && result.settled === true
71
+ : status === 'dropped'
72
+ ? result.released === true && result.settled === true && result.stillHeld === false
73
+ : status === 'recovery-cleaned'
74
+ ? result.released === true && result.settled === true && result.sweepClear === true && result.contactClear === true
75
+ : true;
76
+ return contractVerified
77
+ ? { state:'verified', verified:true, status }
78
+ : { state:'unverified', verified:false, status, reason:'POST_CONDITION_NOT_VERIFIED' };
79
+ }
80
+ if (BLOCKED_STATUSES.has(status) || status.endsWith('-blocked')) return { state:'blocked', verified:false, status, reason:result.reason || null };
81
+ if (FAILED_STATUSES.has(status) || status.endsWith('-failed')) return { state:'failed', verified:false, status, reason:result.reason || null };
82
+ if (UNVERIFIED_STATUSES.has(status) || status.endsWith('-unverified')) return { state:'unverified', verified:false, status, reason:result.reason || null };
83
+ if (REQUESTED_STATUSES.has(status) || status.endsWith('-requested')) return { state:'requested', verified:false, status, reason:result.reason || null };
84
+ if (status === 'asset-ready') return { state:'verified', verified:true, status };
85
+ if (status === 'asset-provisional') return { state:'unverified', verified:false, status, reason:'ASSET_PROVISIONAL' };
86
+ if (status === 'asset-rejected') return { state:'failed', verified:false, status, reason:'ASSET_REJECTED' };
87
+ if (status === 'world-accepted') return { state:'verified', verified:true, status };
88
+ if (status === 'world-incomplete') return { state:'unverified', verified:false, status, reason:result.reason || result.replay?.reason || 'WORLD_ACCEPTANCE_INCOMPLETE' };
89
+ if (status === 'world-ready') return { state:'verified', verified:true, status };
90
+ if (status === 'world-provisional') return { state:'unverified', verified:false, status, reason:'WORLD_PROVISIONAL' };
91
+ if (status === 'world-rejected') return { state:'failed', verified:false, status, reason:result.reason || 'WORLD_REJECTED' };
92
+ if (status === 'empty') return { state:'noop', verified:false, status, reason:'NO_ACTIVE_OBJECT' };
93
+ if (status === 'recovery-stale') return { state:'noop', verified:false, status, reason:result.reason || 'RECOVERY_STALE' };
94
+ }
95
+ if (result.requested === true) return { state:'requested', verified:false, reason:'REQUEST_ONLY' };
96
+ if (result.ok === false) return { state:'failed', verified:false, reason:result.reason || 'RESULT_NOT_OK' };
97
+ }
98
+ return { state:'accepted', verified:null };
99
+ }
100
+
101
+ const BATCH_REJECT_STATES = new Set(['blocked', 'failed', 'unverified', 'requested', 'error', 'noop']);
102
+
103
+ export class SkillRegistry {
104
+ constructor({ policy, trace, runtime } = {}) {
105
+ this.policy = policy;
106
+ this.trace = trace;
107
+ this.runtime = runtime;
108
+ this.skills = new Map();
109
+ }
110
+
111
+ register(skill) {
112
+ if (!skill?.name || typeof skill.handler !== 'function') throw new Error('Skill requires name and handler');
113
+ if (this.skills.has(skill.name)) throw new Error(`Skill already registered: ${skill.name}`);
114
+ this.skills.set(skill.name, { version:'1.0.0', permissions:[], required:[], properties:{}, mutates:false, history:true, manualMutation:false, batchable:true, auxiliary:false, agent:true, ...skill });
115
+ return this;
116
+ }
117
+
118
+ unregister(name) { return this.skills.delete(name); }
119
+
120
+ get(name) { return this.skills.get(name); }
121
+
122
+ definitions() {
123
+ return [...this.skills.values()]
124
+ .filter((skill) => skill.agent)
125
+ .map((skill) => ({ name:skill.name, description:skill.description, parameters:objectSchema(skill) }));
126
+ }
127
+
128
+ authorization(name, context = {}) {
129
+ const skill=this.skills.get(name);
130
+ if (!skill) return {allow:false,profile:context.profile || 'builder',missing:[],required:[],reason:'SKILL_NOT_FOUND'};
131
+ const profile=context.profile || 'builder';
132
+ const decision=this.policy?.evaluate({profile,required:skill.permissions}) ?? {allow:true,profile,missing:[]};
133
+ return { ...decision, required:[...skill.permissions] };
134
+ }
135
+
136
+ executionPolicy(name, result) {
137
+ const skill = this.skills.get(name);
138
+ const outcome = classifyResult(result);
139
+ const mutates = Boolean(skill?.mutates);
140
+ return {
141
+ mutates,
142
+ history:skill?.history !== false,
143
+ barrier:mutates,
144
+ auxiliary:Boolean(skill?.auxiliary),
145
+ tracksUnresolved:!skill?.auxiliary,
146
+ batchable:skill?.batchable !== false,
147
+ batchAcceptable:!BATCH_REJECT_STATES.has(outcome.state),
148
+ outcome
149
+ };
150
+ }
151
+
152
+ async invoke(name, input = {}, context = {}) {
153
+ const skill = this.skills.get(name);
154
+ if (!skill) return { success:false, error:{ code:'not_found', message:`Unknown skill: ${name}` } };
155
+
156
+ const missing = skill.required.filter((key) => input?.[key] == null);
157
+ if (missing.length) return { success:false, error:{ code:'invalid_input', message:`Missing required fields: ${missing.join(', ')}` } };
158
+ const validation = skill.validate?.(input);
159
+ if (validation?.ok === false) return { success:false, error:{ code:'invalid_input', message:validation.message } };
160
+
161
+ const actor = context.actor || 'agent';
162
+ const decision = this.authorization(name,context);
163
+ const policyEvent = this.trace?.emit('policy.decision', { skill:name, allow:decision.allow, missing:decision.missing }, { actor });
164
+ if (!decision.allow) return { success:false, error:{ code:'forbidden', message:`Missing permissions: ${decision.missing.join(', ')}` } };
165
+
166
+ const execute = () => skill.handler(input, { runtime:this.runtime, registry:this, context });
167
+ try {
168
+ let result;
169
+ if (skill.mutates && !skill.manualMutation && !context.skipHistory) {
170
+ if (skill.history === false && this.runtime?.exclusiveMutation) result=await this.runtime.exclusiveMutation(`skill:${name}`,execute);
171
+ else if (this.runtime?.mutate) result=await this.runtime.mutate(`skill:${name}`, execute, { source:actor, skill:name, input });
172
+ else result=await execute();
173
+ } else result=await execute();
174
+ this.trace?.emit('skill.executed', { skill:name, version:skill.version, input, result:result ?? { ok:true } }, { actor, causedBy:policyEvent ? [policyEvent.seq] : [] });
175
+ return { success:true, result:result ?? { ok:true } };
176
+ } catch (error) {
177
+ const details = validationDetails(error);
178
+ const code = details.length ? 'invalid_input' : error.code || 'handler_error';
179
+ // Zod's formatted error includes every branch of an invalid union. The
180
+ // bounded field diagnostics below are more actionable and cheaper to send.
181
+ const message = details.length
182
+ ? `Invalid input at ${details[0].path || 'root'}: ${details[0].message}`
183
+ : error.message;
184
+ this.trace?.emit('skill.failed', { skill:name, input, error:message, code }, { actor });
185
+ return { success:false, error:{ code, message,
186
+ ...(details.length ? { details } : {}) } };
187
+ }
188
+ }
189
+ }
@@ -0,0 +1,32 @@
1
+ import { buildAcceptanceEvidenceBundle, compileWorldAcceptance, evaluateWorldAcceptance, replayAcceptanceEvidence } from '../../../modules/world/verification/WorldAcceptance.js';
2
+ import { meta } from '../skillPrimitives.js';
3
+
4
+ export function registerAcceptanceSkills(add,runtime) {
5
+ add('evaluateWorldAcceptance', { ...meta('对当前世界执行显式 world-level acceptance criteria。只读;返回逐项证据和最终 world-accepted/world-incomplete。', ['world.read','physics.read'], ['criteria'], { criteria:{type:'array'} }), batchable:true, mutates:false }, async (a) => {
6
+ const graph=compileWorldAcceptance(a.criteria || []);
7
+ const task=runtime.lastTaskObservation || {};
8
+ const result=evaluateWorldAcceptance(runtime,graph,{unresolvedMutations:Array.isArray(task.unresolvedMutations)?task.unresolvedMutations:undefined});
9
+ const revision=runtime.currentWorldRevision;
10
+ const bundle=buildAcceptanceEvidenceBundle(graph,result,{source:'agent-tool',worldRevisionId:revision?.revision?.id || null,provenance:revision?.provenance || null});
11
+ runtime.lastAcceptanceBundle=structuredClone(bundle);
12
+ runtime.trace?.emit?.('world.acceptance',{bundle:structuredClone(bundle)},{actor:'agent'});
13
+ return {...result,acceptanceBundle:bundle};
14
+ });
15
+ add('replayWorldAcceptance', { ...meta('重新验证已保存的 acceptance evidence。restore 后的 evidence 仅是 historical;只有 revision 绑定一致且当前 Runtime 重跑 criteria 后仍为 world-accepted,才会生成新的 current acceptance bundle。', ['world.read','physics.read'], [], { evidence:{type:'object'} }), batchable:true, mutates:false }, async (a) => {
16
+ const source=a.evidence || runtime.restoredAcceptanceEvidence || runtime.lastAcceptanceBundle;
17
+ const task=runtime.lastTaskObservation || {};
18
+ let replay;
19
+ if(source){
20
+ replay=replayAcceptanceEvidence(runtime,source,{unresolvedMutations:Array.isArray(task.unresolvedMutations)?task.unresolvedMutations:undefined});
21
+ } else {
22
+ const graph=compileWorldAcceptance([]);
23
+ const result={schema:'agentscape.world-acceptance',schemaVersion:1,status:'world-incomplete',checks:[{id:'acceptance-evidence',kind:'evidence',verified:false,reason:'ACCEPTANCE_EVIDENCE_MISSING'}],verifiedCount:0,failedCount:1};
24
+ const revision=runtime.currentWorldRevision;
25
+ const bundle=buildAcceptanceEvidenceBundle(graph,result,{source:'acceptance-replay',worldRevisionId:revision?.revision?.id || null,provenance:revision?.provenance || null});
26
+ replay={...result,replay:{status:'unavailable',reason:'ACCEPTANCE_EVIDENCE_MISSING',evidenceRevisionId:null,currentRevisionId:revision?.revision?.id || null,previousStatus:null,changedCriteria:['acceptance-evidence']},acceptanceBundle:bundle};
27
+ }
28
+ runtime.lastAcceptanceBundle=structuredClone(replay.acceptanceBundle);
29
+ runtime.trace?.emit?.('world.acceptance-replayed',{replay:structuredClone(replay.replay),bundle:structuredClone(replay.acceptanceBundle)},{actor:'agent'});
30
+ return replay;
31
+ });
32
+ }
@@ -0,0 +1,36 @@
1
+ import { meta,string } from '../skillPrimitives.js';
2
+
3
+ import { WorldCommands } from '../../../modules/world/runtime/WorldCommands.js';
4
+
5
+ export function registerAffordanceSkills(add,runtime) {
6
+ const queries = runtime.queries;
7
+ const commands = runtime.commands ||= new WorldCommands(runtime);
8
+ if (!queries) throw new TypeError('registerAffordanceSkills requires runtime.queries');
9
+ if (!commands) throw new TypeError('registerAffordanceSkills requires runtime.commands');
10
+ add('listWorldAffordances',meta('发现世界交互契约:门窗、灯、抽屉、书与文字的稳定 ID、状态、动作、距离/遮挡限制。环境里还有更多原生 Three.js 交互(座椅、摆件、魔镜等),用 listInteractablesNearMe 或 listEnvironmentInteractables 查看;未列出且无 contractId 的原生交互仅为 provisional 场景能力。', ['world.read'],[],{query:string,actorId:string,limit:{type:'integer',minimum:1,maximum:100}}),(args,execution)=>queries.listAffordances({...args,actorId:args.actorId || execution.context.actor}));
11
+ add('listEnvironmentInteractables', meta('列出当前环境的原生 Three.js 交互目录(如魔女小屋的门/窗/座椅/摆件),含 label、contractId、距离与执行入口。用于“这个场景里还能摸什么”。大世界请把 radius 调到 8–20。', ['world.read','spatial.read'], [], { actorId:string, radius:{type:'number',exclusiveMinimum:0,maximum:20} }), (args, execution) => queries.listEnvironmentInteractables({
12
+ actorId: args.actorId || execution?.context?.actor || null,
13
+ radius: args.radius
14
+ }));
15
+ add('activateEnvironmentInteract', {
16
+ ...meta('激活环境原生 Three.js 交互(魔女小屋等场景自带物件)。interactionId 来自 listInteractablesNearMe.nativeInteractables 或 listEnvironmentInteractables。必须已在 1.5m 内;若距离不够请改用 approachAndActivateEnvironmentInteract。有 contractId 的会尽量走 WorldAffordances 验证;无契约的原生交互返回 environment-interaction-activated + provisional,不得当作力/关节物理已验证。', ['world.write','physics.read','world.read'], ['interactionId'], { interactionId:string, actorId:string }),
17
+ mutates:true, batchable:false
18
+ }, (args, execution) => commands.activateEnvironmentInteraction(args.interactionId, {
19
+ actorId: args.actorId || execution?.context?.actor || null
20
+ }));
21
+ add('approachAndActivateEnvironmentInteract', {
22
+ ...meta('具身操作环境原生 Three.js 交互的首选单一工具:Runtime 在 interactionId 周围采样多个可站立 approach 点(不把门轴/物件中心当终点)→ Recast 寻路 → locomotion → 1.5m 内激活/契约验证。返回 phase=activated 后若 navigationInvalidated=true,必须 fresh replan 再 navigateTo/findPath 进屋或上楼。不要手工拼 navigateTo 坐标,也不要 navigate 到 agent 自身 id。', ['world.write','spatial.read','physics.read','world.read'], ['interactionId'], { interactionId:string, actorId:string, speed:{type:'number',exclusiveMinimum:0,maximum:8} }),
23
+ mutates:true, batchable:false
24
+ }, (args, execution) => commands.approachAndActivateEnvironmentInteract(args.interactionId, {
25
+ actorId: args.actorId || execution?.context?.actor || null,
26
+ speed: args.speed
27
+ }));
28
+ add('findEnvironmentInteractApproach', meta('只读诊断:为环境原生交互计算可达的可站立 approach 点(门外/楼梯口等),不移动也不激活。当 approachAndActivate 报 unreachable,或需要先确认能否进屋上楼时使用。', ['world.read','spatial.read','physics.read'], ['interactionId'], { interactionId:string, actorId:string }), (args, execution) => commands.findEnvironmentInteractApproach(args.interactionId, {
29
+ actorId: args.actorId || execution?.context?.actor || null
30
+ }));
31
+ add('inspectWorldAffordance',meta('读取物件状态、动作条件和验证类型。状态验证与物理验证分别报告。', ['world.read'],['targetId'],{targetId:string,actorId:string}),(args,execution)=>queries.inspectAffordance(args.targetId,{actorId:args.actorId || execution.context.actor}));
32
+ add('executeWorldAction',{
33
+ ...meta('执行已发现的世界交互,必须在 1.5 米内且无遮挡。OUT_OF_REACH 时先 navigateTo 到目标附近可站立位置。write 必须传 text。等待实际状态稳定或返回未验证;verified 不等于 physicsVerified。', ['world.write','physics.read'],['targetId','action'],{targetId:string,actorId:string,action:{type:'string',enum:['open','close','turn_on','turn_off','read','write','pull_out','return']},text:{type:'string',maxLength:100}}),
34
+ mutates:true,batchable:false
35
+ },(args,execution)=>commands.executeAffordance({...args,actorId:args.actorId || execution.context.actor,args:{text:args.text}}));
36
+ }
@@ -0,0 +1,46 @@
1
+ import { assetAdmission } from '../../../modules/asset/model/admission.js';
2
+ import { WorldCommands } from '../../../modules/world/runtime/WorldCommands.js';
3
+ import { meta, string } from '../skillPrimitives.js';
4
+ import { verifyAndUpdateAssetArticulation } from '../../../modules/asset/AssetModule.js';
5
+
6
+ const registerManifest = async (runtime, manifest, options = {}) => {
7
+ if (typeof runtime.assetModule?.registerManifest !== 'function') throw new TypeError('Asset skills require AssetModule.registerManifest');
8
+ return runtime.assetModule.registerManifest(manifest, options);
9
+ };
10
+
11
+ export function registerAssetSkills(add,runtime) {
12
+ const commands = runtime.commands ||= new WorldCommands(runtime);
13
+ if (!commands) throw new TypeError('registerAssetSkills requires runtime.commands');
14
+ add('replaceAsset',{...meta('显式升级实体引用的资产版本,保留实体标识和变换,重置交互状态;失败恢复原实体。',['world.write','asset.read','physics.read'],['id','assetId'],{id:string,assetId:string}),mutates:true,manualMutation:true,batchable:false},a=>commands.replaceAsset(a.id,a.assetId));
15
+ add('compileAsset', {
16
+ ...meta('把 GLB 编译为可运行的 Agent 资产。', ['asset.write'], [], { url:string, sourceName:string, assetId:string, label:string, partProposal:{type:'object'}, partSegmentation:{type:'object'} }),
17
+ validate: (input) => input?.url || input?.bytes ? { ok: true } : { ok: false, message: 'url or bytes required' }
18
+ }, async (input) => {
19
+ const compiler = await runtime.generation?.getAssetCompiler?.();
20
+ if (!compiler) throw Object.assign(new Error('Asset Compiler is not configured'), { code:'ASSET_COMPILER_UNAVAILABLE' });
21
+ const result = await compiler.compile(input);
22
+ await registerManifest(runtime, result.manifest);
23
+ runtime.events.emit('asset.compiled', { assetId: result.manifest.id, report: result });
24
+ return result;
25
+ });
26
+ add('verifyAssetArticulation', { ...meta('在隔离的已配置 physics backend 中执行 Part/Joint 运动轨迹验证(目标、碰撞、停滞、回程),并把结果写回 Manifest;backend 缺少所需 capability 时验证应失败关闭。', ['asset.write', 'physics.read'], ['assetId'], { assetId: string }), mutates: false }, async (a) => {
27
+ const report = await verifyAndUpdateAssetArticulation(runtime.assetModule,a.assetId);
28
+ const manifest = structuredClone(runtime.assetModule.getManifest(a.assetId));
29
+ commands.syncAssetVerification(a.assetId, manifest);
30
+ const admission=assetAdmission(manifest);
31
+ runtime.events.emit('asset.verified', { assetId: a.assetId, articulation: report, admission:admission.status });
32
+ return { ...report, readiness: admission.status, admission };
33
+ });
34
+ add('inspectCompiledAsset', meta('读取已编译资产的编译报告。', ['asset.read'], ['assetId'], { assetId: string }), (a) => runtime.assetModule.getManifest(a.assetId).compiler || null);
35
+ add('listAssets', meta('列出资产库。', ['asset.read']), () => runtime.assetModule.catalog.list());
36
+ add('searchAssets', meta('按名称、类型、标签或别名搜索可复用资产。', ['asset.read'], ['query'], { query: string, limit: { type: 'integer', minimum: 1, maximum: 20 } }), (a) => runtime.assetModule.catalog.search(a.query, { limit: a.limit ?? 8 }));
37
+ add('generateAsset', meta('使用已配置的生成后端创建并注册缺失资产;调用前应先搜索。生成结果可能是 asset-provisional,不能因此假定世界已验证。', ['asset.write'], ['prompt'], { prompt: string }), async (a) => {
38
+ if(typeof runtime.generation?.generateAsset!=='function'){
39
+ return {status:'generator_not_configured',prompt:a.prompt,hint:'Generation runtime is not configured.'};
40
+ }
41
+ const result=await runtime.generation.generateAsset(a.prompt);
42
+ if (result.status==='image_input_required') return result;
43
+ const status=result.admission?.status || (result.status==='generator_not_configured'?'not-configured':'provisional');
44
+ return { ...result, status:result.status==='generator_not_configured'?result.status:`asset-${status}` };
45
+ });
46
+ }
@@ -0,0 +1,16 @@
1
+ import { meta, string } from '../skillPrimitives.js';
2
+
3
+ export function registerAuthoringSkills(add, promotion) {
4
+ const usage = { type:'string', enum:['static', 'movable', 'interactive'] };
5
+ const options = { nodeId:string, usage, allowProvisional:{ type:'boolean' } };
6
+ add('listAuthoringNodes', meta('列出创作对象、晋升状态、待更新状态及运行验证结果。', ['world.read']), () => promotion.list());
7
+ add('prepareAuthoringAsset', { ...meta('把创作节点或分组准备成正式 Asset;保留原稿,准备成功不代表世界行为验证成功。', ['world.read', 'asset.read', 'asset.write'], ['nodeId'], { nodeId:string, usage }), batchable:false }, a => promotion.prepare(a.nodeId, a));
8
+ for (const [name, update] of [['promoteAuthoringNode', false], ['updateAuthoringEntity', true]]) {
9
+ add(name, { ...meta(update ? '显式更新已晋升实体;失败恢复旧实体,原稿撤销不会触发此操作。' : '把创作节点晋升到当前 World;执行资产准入、放置预检和运行时检查。allowProvisional 仅允许编辑态,不宣称行为已验证。',
10
+ ['world.write', 'asset.read', 'asset.write', 'physics.read'], ['nodeId'], options),
11
+ mutates:true, manualMutation:true, batchable:false }, a => promotion.promote(a.nodeId, { ...a, update }));
12
+ }
13
+ add('restoreAuthoringEntities', { ...meta('恢复当前创作存档关联且缺失的正式实体;不覆盖冲突 ID,不跨世界恢复。', ['world.write', 'asset.read', 'physics.read'], [], { allowProvisional:{ type:'boolean' } }), mutates:true, manualMutation:true, batchable:false }, a => promotion.restore(a));
14
+ add('detachAuthoringEntity', { ...meta('解除原稿与正式实体的关联,保留正式实体,并重新显示独立原稿。', ['world.write'], ['nodeId'], { nodeId:string }), mutates:true, manualMutation:true, batchable:false }, a => promotion.detach(a.nodeId));
15
+ add('verifyAuthoringEntity', { ...meta('检查已晋升实体的物理位置与导航,并可显式执行 Agent 交互验证;验证不会提升 Asset 准入状态。', ['world.write', 'physics.read', 'spatial.read'], ['nodeId'], { nodeId:string, exerciseInteraction:{ type:'boolean' } }), mutates:true, manualMutation:true, batchable:false }, a => promotion.verifyEntity(a.nodeId, a));
16
+ }
@@ -0,0 +1,22 @@
1
+ import { meta } from '../skillPrimitives.js';
2
+
3
+ export function registerBatchSkills(add,runtime,registry) {
4
+ add('executeBatch', { ...meta('把可同步回滚的 scene/world edits 作为一个原子批次执行;具身长动作、导航和 request-only articulation 不允许进入 batch。任一调用失败或返回 blocked/failed/unverified/requested 则回滚。', ['world.write'], ['calls'], { calls: { type: 'array', items: { type: 'object' } } }), batchable:false, mutates:true }, async (a, { context }) => {
5
+ for (const call of a.calls) {
6
+ const policy = registry.executionPolicy(call.name);
7
+ if (!policy.batchable) return { committed:false, rolledBack:false, reason:'UNBATCHABLE_SKILL', skill:call.name, results:[] };
8
+ }
9
+ const before = runtime.snapshot();
10
+ const results = [];
11
+ for (const call of a.calls) {
12
+ const result = await registry.invoke(call.name, call.args || {}, { ...context, skipHistory: true });
13
+ const policy = registry.executionPolicy(call.name, result.result);
14
+ results.push({ name:call.name, ...result, outcome:policy.outcome });
15
+ if (!result.success || !policy.batchAcceptable) {
16
+ await runtime.restoreSnapshot(before);
17
+ return { committed:false, rolledBack:true, reason:result.success ? 'SEMANTIC_STEP_NOT_VERIFIED' : 'SKILL_ERROR', results };
18
+ }
19
+ }
20
+ return { committed:true, rolledBack:false, results };
21
+ });
22
+ }
@@ -0,0 +1,106 @@
1
+ import { meta, string } from '../skillPrimitives.js';
2
+
3
+ import { diffAuthoringDocuments } from '../../world-authoring/AuthoringDiff.js';
4
+
5
+ const MAX_AUTHORING_CODE_LENGTH = 131072;
6
+ const MAX_DIFF_NODE_SUMMARY = 64;
7
+
8
+ // Supported-syntax guard, not a security sandbox. Isolation is enforced by the
9
+ // execution host; trusted local execution is never exposed to Agents by default.
10
+ const FORBIDDEN_API_PATTERN = new RegExp(
11
+ [
12
+ '\\b(?:fetch|XMLHttpRequest|WebSocket|EventSource|Worker|SharedWorker|importScripts|postMessage',
13
+ '|localStorage|sessionStorage|indexedDB|caches',
14
+ '|navigator|location|window|document|globalThis',
15
+ '|eval|Function|process|require)\\b',
16
+ '|\\bimport\\s*\\('
17
+ ].join(''),
18
+ 'g'
19
+ );
20
+
21
+ export function validateAuthoringCode(code) {
22
+ if (typeof code !== 'string' || !code.trim()) {
23
+ return { ok:false, code:'AUTHORING_CODE_REQUIRED', message:'Authoring code must be a non-empty string.' };
24
+ }
25
+ if (code.length > MAX_AUTHORING_CODE_LENGTH) {
26
+ return { ok:false, code:'AUTHORING_CODE_TOO_LARGE', message:`Authoring code exceeds ${MAX_AUTHORING_CODE_LENGTH} characters.` };
27
+ }
28
+ FORBIDDEN_API_PATTERN.lastIndex = 0;
29
+ const match = FORBIDDEN_API_PATTERN.exec(code);
30
+ if (match) {
31
+ return {
32
+ ok:false,
33
+ code:'AUTHORING_CODE_FORBIDDEN_API',
34
+ message:`Authoring code must not reference ambient capabilities (${match[0].trim()}). Only THREE, scene, clear, onFrame and modelRef are available in the sandbox.`
35
+ };
36
+ }
37
+ return { ok:true };
38
+ }
39
+
40
+ const summarizeNodes = (entries) => entries
41
+ .slice(0, MAX_DIFF_NODE_SUMMARY)
42
+ .map((entry) => ({
43
+ id:entry.id,
44
+ ...(entry.node?.name ? { name:entry.node.name } : {}),
45
+ ...(entry.node?.type ? { type:entry.node.type } : {})
46
+ }));
47
+
48
+ export function summarizeAuthoringDiff(diff) {
49
+ return {
50
+ empty:diff.empty === true,
51
+ nodes:{
52
+ added:summarizeNodes(diff.nodes?.added || []),
53
+ removed:(diff.nodes?.removed || []).slice(0, MAX_DIFF_NODE_SUMMARY).map((entry)=>entry.id),
54
+ updated:(diff.nodes?.updated || []).slice(0, MAX_DIFF_NODE_SUMMARY).map((entry)=>entry.id),
55
+ moved:(diff.nodes?.moved || []).slice(0, MAX_DIFF_NODE_SUMMARY).map((entry)=>entry.id)
56
+ },
57
+ resources:{
58
+ added:{
59
+ geometries:(diff.resources?.geometries?.added || []).length,
60
+ materials:(diff.resources?.materials?.added || []).length,
61
+ textures:(diff.resources?.textures?.added || []).length
62
+ }
63
+ }
64
+ };
65
+ }
66
+
67
+ export function registerCodeSkills(add, authoring, { allowTrustedLocal = false } = {}) {
68
+ if (!authoring || typeof authoring.run !== 'function' || typeof authoring.export !== 'function' || typeof authoring.restore !== 'function') {
69
+ throw new TypeError('registerCodeSkills requires a World authoring context');
70
+ }
71
+ const enabled = authoring.codeIsolation === 'external-executor' || allowTrustedLocal;
72
+ add('runAuthoringCode', {
73
+ ...meta('用纯 Three.js 代码在创作层(draft layer)构建或修改世界内容。沙箱只注入 THREE、scene、clear、onFrame、modelRef。执行前静态拒绝危险 API;执行失败会自动恢复到执行前的创作文档并把错误原样返回,修正代码后可重新提交。代码产出只是草稿:正式世界实体必须再经 prepareAuthoringAsset / promoteAuthoringNode 晋升并验证。',
74
+ ['world.write'], ['code'],
75
+ { code:string, label:string }),
76
+ mutates:true, manualMutation:true, batchable:false, agent:enabled
77
+ }, async (a) => {
78
+ if (!enabled) return { status:'authoring-code-rejected', reason:'ISOLATED_EXECUTOR_REQUIRED', message:'Agent source execution requires an isolated executor. Use Scene commands or Asset Recipe.' };
79
+ const validation = validateAuthoringCode(a.code);
80
+ if (!validation.ok) return { status:'authoring-code-rejected', reason:validation.code, message:validation.message };
81
+ const label = typeof a.label === 'string' && a.label.trim() ? a.label.trim() : 'Authoring code';
82
+ const baseline = authoring.export();
83
+ let value;
84
+ try {
85
+ value = await authoring.run(a.code);
86
+ } catch (error) {
87
+ authoring.restore(baseline);
88
+ return {
89
+ status:'authoring-code-failed',
90
+ reason:'AUTHORING_CODE_EXECUTION_ERROR',
91
+ message:String(error?.message || error),
92
+ instruction:'The draft was restored to its previous revision. Fix the code and submit it again.'
93
+ };
94
+ }
95
+ const diff = diffAuthoringDocuments(baseline, authoring.export());
96
+ if (diff.empty) return { status:'authoring-code-empty', reason:'AUTHORING_CODE_NO_CHANGE' };
97
+ const revision = authoring.commit({ label, source:'agent-code' });
98
+ return {
99
+ status:'authoring-code-applied',
100
+ label,
101
+ revision,
102
+ diff:summarizeAuthoringDiff(diff),
103
+ ...(value !== undefined && ['string','number','boolean'].includes(typeof value) ? { value } : {})
104
+ };
105
+ });
106
+ }
@@ -0,0 +1,45 @@
1
+ import { PROMPT_HYBRID_WORLD_REQUEST_SCHEMA, PromptHybridWorldOrchestrator } from '../../generation/PromptHybridWorldOrchestrator.js';
2
+ import { meta, string } from '../skillPrimitives.js';
3
+
4
+ export function registerGenerationSkills(add,runtime,{promptHybridWorldOrchestrator = new PromptHybridWorldOrchestrator(runtime)} = {}) {
5
+ const requireGeneration=()=>{
6
+ if (!runtime.generation) {
7
+ const error=new Error("Generation orchestration is unavailable");
8
+ error.code="CONNECTION_REQUIRED";
9
+ throw error;
10
+ }
11
+ return runtime.generation;
12
+ };
13
+ const isAssetGenerationRequest = (request={}) => {
14
+ const operation=String(request.operation || '').trim();
15
+ if (!operation) return false;
16
+ const capabilities=runtime.generation?.listGenerationCapabilities?.({availableOnly:false})?.capabilities || [];
17
+ const capability=capabilities.find((item)=>item.operation===operation);
18
+ return String(capability?.category || '').includes('asset-generation') || /\.asset\./i.test(operation);
19
+ };
20
+ const requireApprovedAssetInput = (request={}) => {
21
+ if (runtime.generation?.assetInputPolicy !== 'approved-image' || !isAssetGenerationRequest(request)) return;
22
+ throw Object.assign(
23
+ new Error('请先在图片资产工作台确认物体并生成入库;Agent 使用已发布资产。'),
24
+ {code:'IMAGE_INPUT_REQUIRED'}
25
+ );
26
+ };
27
+ const validateGenerationPayload=(a,requireTarget=false)=>{
28
+ const generation=runtime.generation;
29
+ return generation?.validateRequestPayload
30
+ ? generation.validateRequestPayload(a,{requireTarget})
31
+ : {ok:true};
32
+ };
33
+ add("listGenerationProviders", meta("列出可用于异步生成的 Provider;只返回安全的规范化能力摘要。", ["generation.read"], [], { availableOnly:{type:"boolean"} }), (a)=>requireGeneration().listGenerationProviders(a));
34
+ add("listGenerationCapabilities", meta("列出规范化生成能力;不会暴露 Provider 私有 API、凭据或签名 URL。", ["generation.read"], [], { provider:string, category:string, availableOnly:{type:"boolean"} }), (a)=>requireGeneration().listGenerationCapabilities(a));
35
+ add("submitGenerationJob", { ...meta("提交可能计费的异步生成 Job;立即返回本地 jobId/pending 状态,不等待 Provider 完成。", ["generation.submit"], ["provider","operation"], { provider:string, operation:string, inputs:{type:"object"}, profile:string, options:{type:"object"}, outputRoles:{type:"array",items:string}, parent:{type:"object"}, retention:{type:"object"}, metadata:{type:"object"}, idempotencyKey:string, requestHash:string }), batchable:false, validate:(a)=>validateGenerationPayload(a) }, (a)=>{ requireApprovedAssetInput(a); return requireGeneration().submitGenerationJob(a); });
36
+ add("getGenerationJob", meta("读取并恢复异步生成 Job;provider-succeeded 只表示结果可导入,不等于 asset-ready。", ["generation.read"], ["jobId"], { jobId:string, cachedOnly:{type:"boolean"} }), (a)=>requireGeneration().getGenerationJob(a.jobId,{cachedOnly:a.cachedOnly===true}));
37
+ add("cancelGenerationJob", { ...meta("请求取消外部生成 Job;不会回滚 Scene,也不会删除已经导入的 Artifact。", ["generation.cancel"], ["jobId"], { jobId:string }), batchable:false }, (a)=>requireGeneration().cancelGenerationJob(a.jobId));
38
+ add("importGenerationResult", { ...meta("把 provider-succeeded Job 的 Artifact 经 hash/MIME/bytes 校验导入本地;artifact-imported 仍不等于 asset-ready。", ["generation.read","artifact.import"], ["jobId"], { jobId:string, artifactId:string, role:string }), batchable:false }, (a)=>requireGeneration().importGenerationResult(a.jobId,{artifactId:a.artifactId,role:a.role}));
39
+ add("generateAndCompileAsset", { ...meta("异步生成资产的高层编排:可提交或恢复 Job;pending 时立即返回,结果可用后才导入 Artifact、Compiler 编译并经过 Admission。需要可移动物体时需显式 authoringIntent:{usage:'movable'},不再根据名称推导物理动作。", ["generation.read","generation.submit","artifact.import","asset.write"], ["assetId"], { assetId:string, label:string, jobId:string, provider:string, operation:string, inputs:{type:"object"}, profile:string, options:{type:"object"}, outputRoles:{type:"array",items:string}, artifactId:string, artifactRole:string, idempotencyKey:string, requestHash:string,
40
+ authoringIntent:{type:'object',properties:{usage:{type:'string',enum:['static','movable','interactive']}},required:['usage'],additionalProperties:false} }), batchable:false, validate:(a)=>validateGenerationPayload(a,true) }, (a)=>{ if (!a.jobId && runtime.generation?.assetInputPolicy === 'approved-image') throw Object.assign(new Error('请先在图片资产工作台确认物体并生成入库;Agent 只能恢复已有资产任务或使用已发布资产。'),{code:'IMAGE_INPUT_REQUIRED'}); return requireGeneration().generateAndCompileAsset(a); });
41
+ add('buildGeneratedHybridWorld', {
42
+ ...meta('产品级 Generated Hybrid World 入口:用 environmentPrompt 经现有 Connector capability 自动走文生图→图生世界并导入 verified artifacts,再把 proposal 封装成 Runtime-owned WorldIR,在生成背景的 observation anchor 上通过 canonical WorldBuilder 组合 executable assets。模型不能提供 revision/provenance、Job 成功状态、Artifact bytes/hash 或 spawn 结果;整个世界替换失败会恢复调用前 Environment 与 Scene。若返回 status 为 world-rejected,世界已回滚到调用前状态:根据 admission.reasons 与 attempts 的诊断修正 proposal 后可再次调用本工具,不要在未修正诊断问题时原样重试。', ['generation.read','generation.submit','artifact.import','world.write','asset.read','asset.write','physics.read'], ['request'], {request:PROMPT_HYBRID_WORLD_REQUEST_SCHEMA}),
43
+ batchable:false,mutates:true,history:false,manualMutation:true
44
+ }, (a)=>promptHybridWorldOrchestrator.run(a.request));
45
+ }
@@ -0,0 +1,46 @@
1
+ import { compileInteractionIntent, executeBehaviorCommand, verifyBehaviorCommand } from '../../../modules/world/runtime/behavior/BehaviorCompiler.js';
2
+ import { recordInteractionEvidence } from '../../../modules/world/verification/InteractionEvidence.js';
3
+ import { meta, string } from '../skillPrimitives.js';
4
+
5
+ const recordBehaviorEvidence = (runtime, command, result, source) => {
6
+ const verification=verifyBehaviorCommand(command,result);
7
+ const targetId=command.capability==='PLACE' ? command.supportId : command.targetId;
8
+ recordInteractionEvidence(runtime,{targetId,capability:command.capability,verified:verification.verified===true,source,commandId:command.commandId,result});
9
+ return verification;
10
+ };
11
+
12
+ import { WorldCommands } from '../../../modules/world/runtime/WorldCommands.js';
13
+
14
+ export function registerInteractionSkills(add,runtime) {
15
+ const queries = runtime.queries;
16
+ const commands = runtime.commands ||= new WorldCommands(runtime);
17
+ if (!queries) throw new TypeError('registerInteractionSkills requires runtime.queries');
18
+ if (!commands) throw new TypeError('registerInteractionSkills requires runtime.commands');
19
+ add('approachAndInteract', { ...meta('具身 open/close 的首选单一工具:若 actorId/targetId/action 已知,应直接调用本工具,不要先调用 listObjects/findInteractionPose/navigateTo。内部完成交互位搜索、真实 navigate、距离/物理视线/action-sweep 二次验证,再请求 motor target 并等待 live joint completion。只有 status=action-completed 且 targetReached=true/settled=true 才表示动作最终完成;STALL 返回 action-failed,TIMEOUT 返回 action-unverified。整个任务是一个 mutation。', ['world.write','spatial.read','physics.read'], ['actorId','targetId','action'], { actorId:string, targetId:string, action:{type:'string',enum:['open','close']}, partName:string, speed:{type:'number',exclusiveMinimum:0,maximum:8} }), batchable:false, mutates:true }, async (a) => {
20
+ const command=compileInteractionIntent({id:`direct-${a.action}`,actorId:a.actorId,targetId:a.targetId,capability:a.action},{worldRevisionId:runtime.currentWorldRevision?.revision?.id});
21
+ const result=await commands.approachAndInteract(a.actorId,a.targetId,a.action,{partName:a.partName,speed:a.speed});
22
+ recordBehaviorEvidence(runtime,command,result,'approachAndInteract');
23
+ return result;
24
+ });
25
+ add('executeBehaviorCommand', { ...meta('执行由 BehaviorCompiler 编译出的 typed RuntimeCommand。当前纵向切片只允许 OPEN/CLOSE interaction;命令必须包含 actorId/targetId,并且最终结果仍需 action-completed + targetReached + settled 才算验证完成。', ['world.write','spatial.read','physics.read'], ['command'], { command:{type:'object'} }), batchable:false, mutates:true }, async (a) => {
26
+ const command=compileInteractionIntent(a.command?.source ? { id:a.command.source.interactionId, actorId:a.command.actorId, targetId:a.command.targetId, capability:a.command.capability } : a.command?.intent || a.command, { worldRevisionId:a.command?.source?.worldRevisionId });
27
+ const result=await executeBehaviorCommand(runtime,command);
28
+ const verification=recordBehaviorEvidence(runtime,command,result,'executeBehaviorCommand');
29
+ return {...result,behaviorCommand:command,verification};
30
+ });
31
+ add('getArticulationStatus', meta('读取 articulated object 的 live joint 状态:当前 coordinate、requestedAction、verifiedAction,以及 moving/completed/failed/unverified observer 结果。STALL 若当前 physics backend 提供 contact evidence,会附 blockerCandidates;它表示失败时正在接触,不证明唯一因果。不会把 motor request 当成完成。', ['world.read','physics.read'], ['id'], { id:string, partName:string }), (a) => queries.articulationStatus(a.id,a.partName));
32
+ add('approachAndPickup', { ...meta('具身 pickup:若 actorId/targetId 已知,应直接调用本工具,不要先调用 listObjects/findInteractionPose/navigateTo。Agent 先走到固定 1.5m 交互位并复核当前 physics scene-query LOS,再对对象到 hold anchor 做 shape-sweep;成功后记录 heldBy 并以 kinematic anchor 携带。不是 grasp force verification。', ['world.write','spatial.read','physics.read'], ['actorId','targetId'], { actorId:string, targetId:string, speed:{type:'number',exclusiveMinimum:0,maximum:8} }), batchable:false, mutates:true }, async (a) => {
33
+ const command=compileInteractionIntent({id:'direct-pickup',actorId:a.actorId,targetId:a.targetId,capability:'PICKUP'},{worldRevisionId:runtime.currentWorldRevision?.revision?.id});
34
+ const result=await commands.approachAndPickup(a.actorId,a.targetId,{speed:a.speed});
35
+ recordBehaviorEvidence(runtime,command,result,'approachAndPickup');
36
+ return result;
37
+ });
38
+ add('approachAndPlace', { ...meta('具身 place 的首选单一工具:若 actorId/supportId 已知且 Agent 已持物,应直接调用本工具,不要先调用 listObjects/findInteractionPose/navigateTo。被放置物由 actor 当前 held ownership 自动推导,不要传 held object id。supportId 是接收物体的支撑对象 ID(例如 table_01);surfaceId 只是该支撑对象 Manifest 中可选的 surface 名(例如 top),绝不是对象 ID。内部完成 carry-aware approach、当前 physics backend 的 shape-cast release、Dynamic settle 与 ON/SUPPORTS post-condition。只有 status=placed 且 supportVerified=true 才表示最终放置成功。', ['world.write','spatial.read','physics.read'], ['actorId','supportId'], { actorId:{type:'string',description:'持有物体的 Agent ID,例如 agent_01'}, supportId:{type:'string',description:'接收放置物的支撑对象 ID,例如 table_01;不要填 cup_01'}, surfaceId:{type:'string',description:'可选 surface 名,例如 top;不要填对象 ID'}, speed:{type:'number',exclusiveMinimum:0,maximum:8} }), batchable:false, mutates:true }, async (a) => {
39
+ const command=compileInteractionIntent({id:'direct-place',actorId:a.actorId,supportId:a.supportId,capability:'PLACE'},{worldRevisionId:runtime.currentWorldRevision?.revision?.id});
40
+ const result=await commands.approachAndPlace(a.actorId,a.supportId,{surfaceId:a.surfaceId,speed:a.speed});
41
+ recordBehaviorEvidence(runtime,command,result,'approachAndPlace');
42
+ return result;
43
+ });
44
+ add('dropHeld', { ...meta('释放 Agent 当前 kinematic-anchor held object,恢复其原始 Physics body type。', ['world.write','physics.read'], ['actorId'], { actorId:string }), batchable:false, mutates:true }, (a) => commands.dropHeld(a.actorId));
45
+ add('getCarryStatus', meta('读取 Agent 当前 held-object ownership;held 只表示 kinematic-anchor attachment,不等于 graspVerified。', ['world.read','physics.read'], ['actorId'], { actorId:string }), (a) => queries.carryStatus(a.actorId));
46
+ }