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,55 +0,0 @@
1
- import { COMPLETE_OUTCOMES } from './AgentExecutionRules.js';
2
-
3
- /** Finalize only from observed/verifiable state, never the model's prose alone. */
4
- export function finalizeModelResponse({
5
- response, step, taskAcceptanceBundle, lastMutation, sceneTaskPlan,
6
- sceneGoalEvidence, unresolvedMutations, execution, log
7
- }) {
8
- const proposedFinal = response.message || '任务完成。';
9
- const unresolved = [...unresolvedMutations.values()].map((entry)=>structuredClone(entry));
10
- const acceptanceBundle=taskAcceptanceBundle ? structuredClone(taskAcceptanceBundle) : null;
11
- const acceptanceRequired=acceptanceBundle?.required===true;
12
- const acceptanceAccepted=!acceptanceRequired || acceptanceBundle?.result?.status==='world-accepted';
13
- const lastComplete = lastMutation && COMPLETE_OUTCOMES.has(lastMutation.outcome.state);
14
- const sceneGoalsAccepted=!sceneTaskPlan || sceneGoalEvidence?.status==='world-accepted';
15
- const taskStatus = sceneTaskPlan ? sceneGoalsAccepted && !unresolved.length && acceptanceAccepted ? 'completed' : 'incomplete'
16
- : !lastMutation ? 'no-mutation' : lastComplete && !unresolved.length && acceptanceAccepted ? 'completed' : 'incomplete';
17
- const final = !sceneGoalsAccepted ? `任务未完成:${sceneGoalEvidence?.failedCount ?? sceneTaskPlan.criteria.length} 个目标尚未通过当前世界验证。`
18
- : sceneTaskPlan && unresolved.length ? `任务未完成:仍有 ${unresolved.length} 项操作失败需要处理。`
19
- : acceptanceRequired && !acceptanceAccepted
20
- ? `Task incomplete: world acceptance is ${acceptanceBundle?.result?.status || 'missing'}.`
21
- : proposedFinal;
22
- if (taskStatus === 'incomplete') {
23
- const detail = !sceneGoalsAccepted ? `${sceneGoalEvidence?.failedCount || 0} unsatisfied goal(s)` : !acceptanceAccepted ? `world acceptance → ${acceptanceBundle?.result?.status || 'missing'}` : unresolved.length ? `${unresolved.length} unresolved mutation(s)` : `${lastMutation?.tool || 'task'} → ${lastMutation?.outcome.state || 'incomplete'}`;
24
- log(`sequence: task incomplete · ${detail}`, 'error');
25
- }
26
- log(final, 'result');
27
- return { message:final, steps:step + 1, taskStatus, lastMutation:lastMutation ? structuredClone(lastMutation) : null, unresolvedMutations:unresolved, execution:structuredClone(execution), ...(sceneTaskPlan?{taskPlan:structuredClone(sceneTaskPlan),goalVerification:structuredClone(sceneGoalEvidence)}:{}),...(acceptanceBundle?{acceptanceBundle}:{}) };
28
- }
29
-
30
- /** Enforce the planning budget without silently dropping unresolved world changes. */
31
- export function finalizePlanningLimit({
32
- maxSteps, taskAcceptanceBundle, lastMutation, sceneTaskPlan,
33
- sceneGoalEvidence, unresolvedMutations, execution, log, recordSequence
34
- }) {
35
- if(sceneTaskPlan && sceneGoalEvidence?.status==='world-accepted' && !unresolvedMutations.size && (!taskAcceptanceBundle?.required || taskAcceptanceBundle.result?.status==='world-accepted'))return {
36
- message:'任务目标已通过当前世界验证。',steps:maxSteps,taskStatus:'completed',taskPlan:structuredClone(sceneTaskPlan),goalVerification:structuredClone(sceneGoalEvidence),
37
- lastMutation:lastMutation?structuredClone(lastMutation):null,unresolvedMutations:[],execution:structuredClone(execution)
38
- };
39
- const unresolved = [...unresolvedMutations.values()].map((entry)=>structuredClone(entry));
40
- if (unresolved.length || sceneTaskPlan) {
41
- const message = `Task incomplete: planning limit reached with ${unresolved.length} unresolved world mutation(s).`;
42
- log(`sequence: ${message}`, 'error');
43
- recordSequence?.({
44
- planningStep:maxSteps, executed:false, termination:'planning-limit',
45
- unresolved:unresolved.length,
46
- lastMutation:lastMutation ? structuredClone(lastMutation) : null
47
- });
48
- return {
49
- message, steps:maxSteps, taskStatus:'incomplete', termination:'planning-limit',
50
- lastMutation:lastMutation ? structuredClone(lastMutation) : null,
51
- unresolvedMutations:unresolved, execution:structuredClone(execution),...(sceneTaskPlan?{taskPlan:structuredClone(sceneTaskPlan),goalVerification:structuredClone(sceneGoalEvidence)}:{})
52
- };
53
- }
54
- throw new Error(`Agent exceeded ${maxSteps} planning steps`);
55
- }
@@ -1,390 +0,0 @@
1
- import { buildAgentSystemPrompt } from '../prompt/index.js';
2
- import { invokeAgentTool } from './AgentToolInvoker.js';
3
- import { finalizeModelResponse, finalizePlanningLimit } from './AgentRunResults.js';
4
- import {
5
- COMPLETE_OUTCOMES, stableValue, normalizeModelToolCall, mutationIdentity,
6
- worldMutationRevisionId, worldPlanIdentity, worldProposalLineageFromExecution,
7
- worldRevisionRepairFromExecution, recoveryOriginIdentity, recoveryMutationIdentity,
8
- replanInstruction, annotateResult
9
- } from './AgentExecutionRules.js';
10
-
11
- /** One execution context per run. Tool and world authority remain in the injected AgentTools. */
12
- export async function executeAgentRun(agent, text, { signal, actor = agent.tools.actor } = {}) {
13
- const { tools, gateway:configuredGateway, maxSteps, maxRecoveryReadRounds, maxUnchangedFailures } = agent;
14
- // Preserve the public logger callback's original Agent receiver.
15
- const log = (...args) => agent.log(...args);
16
- log(`goal: ${text}`, 'goal');
17
- let toolDefinitions=tools.definitions();
18
- const messages = [
19
- { role:'system', content:buildAgentSystemPrompt(toolDefinitions) },
20
- { role:'user', content:text }
21
- ];
22
- const gateway = configuredGateway?.isConfigured() ? configuredGateway : null;
23
- if (!gateway) { const error=new Error('智能体能力不可用'); error.code='AGENT_CAPABILITY_UNAVAILABLE'; throw error; }
24
-
25
- const execution = [];
26
- let taskAcceptanceBundle=null;
27
- const unresolvedMutations = new Map();
28
- const appliedAuxiliaryRecoveries = new Map();
29
- const attemptedWorldPlans = new Set();
30
- const proposalGateEnabled=toolDefinitions.some((tool)=>tool.name==='proposeWorldIR');
31
- const revisionProposalGateEnabled=toolDefinitions.some((tool)=>tool.name==='proposeWorldRevision');
32
- const issuedWorldRevisions=new Set();
33
- const issuedWorldRevisionProposals=new Map();
34
- let pendingWorldProposalLineage=null;
35
- let pendingWorldRevisionRepair=null;
36
- let lastMutation = null;
37
- let recoveryReadRounds = 0;
38
- let sceneTaskPlan=null,sceneGoalEvidence=null;
39
- const failedSceneAttempts=new Map();
40
- const hasSceneObservation=toolDefinitions.some(tool=>tool.name==='observeScene');
41
- const refreshSceneGoals=async()=>{
42
- if(!sceneTaskPlan)return;
43
- sceneGoalEvidence=await tools.call('verifyScene',{criteria:sceneTaskPlan.criteria});
44
- const satisfied=new Set(sceneGoalEvidence.checks.filter(check=>check.verified).map(check=>check.id));
45
- for(const [identity,pending] of unresolvedMutations)if(pending.tool==='interactScene' && satisfied.has(pending.args.goalId))unresolvedMutations.delete(identity);
46
- };
47
- const cancelled = (steps) => ({
48
- message:'任务已停止;已完成的世界变化已保留。重试将重新观察当前世界。',
49
- taskStatus:'cancelled', termination:'user-cancelled', steps,
50
- lastMutation:lastMutation ? structuredClone(lastMutation) : null,
51
- unresolvedMutations:[...unresolvedMutations.values()].map((entry)=>structuredClone(entry)),
52
- execution:structuredClone(execution),
53
- ...(taskAcceptanceBundle ? { acceptanceBundle:structuredClone(taskAcceptanceBundle) } : {})
54
- });
55
-
56
- // OBSERVE -> PLAN: prepare fresh context, then ask the model for a decision.
57
- async function preparePlanningRound(step) {
58
- toolDefinitions=tools.definitions();
59
- messages[0]={role:'system',content:buildAgentSystemPrompt(toolDefinitions)};
60
- if (signal?.aborted) return { cancelled:cancelled(step) };
61
- const world = await tools.call('listObjects');
62
- if (signal?.aborted) return { cancelled:cancelled(step) };
63
- const scene=hasSceneObservation ? await tools.call('observeScene',actor?{actor}:{}) : null;
64
- await refreshSceneGoals();
65
- const unresolved = [...unresolvedMutations.values()].map((entry)=>structuredClone(entry));
66
- const task = tools.taskObservation?.({ actor,lastMutation:lastMutation ? structuredClone(lastMutation) : null, unresolvedMutations:unresolved }) || null;
67
- if(task && sceneTaskPlan)task.plan={...structuredClone(sceneTaskPlan),verification:structuredClone(sceneGoalEvidence)};
68
- if (tools.runtime) tools.runtime.lastTaskObservation = task ? structuredClone(task) : null;
69
- let response;
70
- try { response = await gateway.complete({
71
- messages,
72
- tools:toolDefinitions,
73
- context:{
74
- world:lastMutation ? { count:world.length, index:world.map(({id,asset})=>({id,asset})) } : world,
75
- ...(scene?{scene}:{}),
76
- ...(task ? { task } : {}),
77
- ...(unresolved.length ? { recovery:{
78
- readOnlyRoundsUsed:recoveryReadRounds,
79
- readOnlyRoundsRemaining:Math.max(0,maxRecoveryReadRounds-recoveryReadRounds)
80
- } } : {})
81
- }
82
- }, { signal }); }
83
- catch (error) {
84
- if (signal?.aborted) return { cancelled:cancelled(step + 1) };
85
- throw error;
86
- }
87
- if (signal?.aborted) return { cancelled:cancelled(step + 1) };
88
- response.toolCalls = response.toolCalls.map(normalizeModelToolCall);
89
- return { response, scene, unresolved };
90
- }
91
-
92
- // COMPLETE: re-check declared goals; the model response alone is not proof.
93
- // COMPLETE: a model reply is not proof of the requested world state.
94
- async function finishModelResponse(response, step) {
95
- await refreshSceneGoals();
96
- if (signal?.aborted) return cancelled(step + 1);
97
- return finalizeModelResponse({
98
- response, step, taskAcceptanceBundle, lastMutation, sceneTaskPlan,
99
- sceneGoalEvidence, unresolvedMutations, execution, log
100
- });
101
- }
102
-
103
- // EXECUTE -> REPLAN: enforce tool sequencing, verification and recovery barriers.
104
- async function executeToolBatch(response, step, scene) {
105
- let barrier = null;
106
- let executedTool = false;
107
- let mutationExecuted = false;
108
- for (const call of response.toolCalls) {
109
- // A running world tool finishes at its own safe boundary. Never drop a
110
- // held object or roll back a completed action merely to stop planning.
111
- if (signal?.aborted) return cancelled(step + 1);
112
- if (barrier) {
113
- const skipped = {
114
- status:'not-executed',
115
- reason:barrier.skipReason || 'REPLAN_REQUIRED_AFTER_WORLD_CHANGE',
116
- afterTool:barrier.tool,
117
- afterOutcome:barrier.outcome.state,
118
- instruction:barrier.instruction || replanInstruction(barrier.outcome),
119
- _sequence:{ outcome:{state:'skipped',verified:false}, barrier:false, replanRequired:true }
120
- };
121
- messages.push({ role:'tool', toolCallId:call.id, name:call.name, content:JSON.stringify(skipped) });
122
- execution.push({ planningStep:step + 1, tool:call.name, args:structuredClone(call.args || {}), executed:false, outcome:{state:'skipped',verified:false}, reason:skipped.reason });
123
- tools.recordSequence?.({ planningStep:step + 1, tool:call.name, executed:false, reason:skipped.reason, afterTool:barrier.tool, afterOutcome:barrier.outcome.state });
124
- log(`skip: ${call.name} · replan after ${barrier.tool}`, 'plan');
125
- continue;
126
- }
127
-
128
- const previewPolicy=tools.executionPolicy?.(call.name,undefined) || {};
129
- let sceneCallFingerprint=null;
130
- if(call.name==='planSceneTask' || call.name==='interactScene') {
131
- if(call.name==='interactScene')await refreshSceneGoals();
132
- const goal=sceneTaskPlan?.criteria.find(check=>check.id===call.args?.goalId);
133
- const satisfied=new Set((sceneGoalEvidence?.checks || []).filter(check=>check.verified).map(check=>check.id));
134
- const identity=mutationIdentity(call),previous=failedSceneAttempts.get(identity);
135
- const custom = call.args?.interaction?.action === 'custom';
136
- const fingerprint=scene ? stableValue({objects:scene.objects.map(object=>({id:object.id,state:object.state,transform:{...object.transform,position:object.transform.position.map(value=>Math.round(value*100)/100)}})),environment:scene.affordances.entities.filter(entry=>entry.source==='environment').map(entry=>({id:entry.id,state:entry.state})),project:scene.project?.entities.map(entry=>({id:entry.id,state:entry.state,actions:entry.actions}))}) : null;
137
- const reason=call.name==='planSceneTask' ? sceneTaskPlan?'TASK_PLAN_IMMUTABLE':null
138
- : !sceneTaskPlan?'TASK_PLAN_REQUIRED':!goal?'TASK_GOAL_UNKNOWN':!custom&&!actor?'ACTOR_SELECTION_REQUIRED':!custom&&call.args?.interaction?.actor!==actor?'TASK_ACTOR_MISMATCH'
139
- : (sceneTaskPlan.dependencies[goal.id] || []).some(parent=>!satisfied.has(parent))?'TASK_DEPENDENCY_UNSATISFIED'
140
- : satisfied.has(goal.id)?'TASK_GOAL_ALREADY_VERIFIED'
141
- : previous?.fingerprint===fingerprint && previous.count>=maxUnchangedFailures?'UNCHANGED_FAILURE_LIMIT':null;
142
- if(reason) {
143
- const skipped={status:'not-executed',reason,instruction:'Choose an unsatisfied goal, inspect fresh affordances, and change the route/action or report incomplete. Do not weaken or replace declared goals.'};
144
- messages.push({role:'tool',toolCallId:call.id,name:call.name,content:JSON.stringify(skipped)});
145
- execution.push({planningStep:step+1,tool:call.name,args:structuredClone(call.args || {}),executed:false,outcome:{state:'skipped',verified:false},reason});
146
- barrier={tool:call.name,outcome:{state:'skipped',verified:false},skipReason:reason};continue;
147
- }
148
- sceneCallFingerprint=fingerprint;
149
- }
150
- if(proposalGateEnabled && call.name==='runWorldPipeline'){
151
- const revisionId=call.args?.plan?.revision?.id;
152
- if(!revisionId || !issuedWorldRevisions.has(revisionId)){
153
- const skipped={
154
- status:'not-executed',reason:'WORLD_PIPELINE_PROPOSAL_REQUIRED',
155
- instruction:'Call proposeWorldIR first, observe the compiled Runtime-issued worldIR in a fresh planning round, then submit that exact revision to runWorldPipeline.',
156
- _sequence:{outcome:{state:'skipped',verified:false},barrier:false,replanRequired:true}
157
- };
158
- messages.push({role:'tool',toolCallId:call.id,name:call.name,content:JSON.stringify(skipped)});
159
- execution.push({planningStep:step+1,tool:call.name,args:structuredClone(call.args || {}),executed:false,outcome:{state:'skipped',verified:false},reason:skipped.reason});
160
- tools.recordSequence?.({planningStep:step+1,tool:call.name,executed:false,reason:skipped.reason,replanRequired:true});
161
- log(`skip: ${call.name} · compiled World IR proposal required`,'plan');
162
- barrier={tool:call.name,outcome:{state:'skipped',verified:false},skipReason:'REPLAN_REQUIRED_AFTER_WORLD_PROPOSAL_GATE',instruction:skipped.instruction};
163
- continue;
164
- }
165
- }
166
- if(revisionProposalGateEnabled && call.name==='proposeWorldRevision' && !pendingWorldRevisionRepair){
167
- const skipped={status:'not-executed',reason:'WORLD_REVISION_CONTEXT_REQUIRED',instruction:'No bounded Runtime revision context is available. Use proposeWorldIR for a full semantic revision, or report the task incomplete.',_sequence:{outcome:{state:'skipped',verified:false},barrier:false,replanRequired:true}};
168
- messages.push({role:'tool',toolCallId:call.id,name:call.name,content:JSON.stringify(skipped)});
169
- execution.push({planningStep:step+1,tool:call.name,args:structuredClone(call.args||{}),executed:false,outcome:{state:'skipped',verified:false},reason:skipped.reason});
170
- tools.recordSequence?.({planningStep:step+1,tool:call.name,executed:false,reason:skipped.reason,replanRequired:true});
171
- barrier={tool:call.name,outcome:{state:'skipped',verified:false},skipReason:'REPLAN_REQUIRED_AFTER_WORLD_REVISION_CONTEXT_GATE',instruction:skipped.instruction};
172
- continue;
173
- }
174
- if(revisionProposalGateEnabled && call.name==='recompileWorldRevision'){
175
- const proposal=call.args?.proposal;
176
- const nextRevisionId=proposal?.nextRevisionId;
177
- const issued=nextRevisionId?issuedWorldRevisionProposals.get(nextRevisionId):null;
178
- const reason=!issued?'WORLD_REVISION_PROPOSAL_REQUIRED':stableValue(proposal)!==issued.signature?'WORLD_REVISION_PROPOSAL_TAMPERED':null;
179
- if(reason){
180
- const skipped={status:'not-executed',reason,instruction:'Call proposeWorldRevision first and submit the returned proposal unchanged in a fresh planning round.',_sequence:{outcome:{state:'skipped',verified:false},barrier:false,replanRequired:true}};
181
- messages.push({role:'tool',toolCallId:call.id,name:call.name,content:JSON.stringify(skipped)});
182
- execution.push({planningStep:step+1,tool:call.name,args:structuredClone(call.args||{}),executed:false,outcome:{state:'skipped',verified:false},reason});
183
- tools.recordSequence?.({planningStep:step+1,tool:call.name,executed:false,reason,replanRequired:true});
184
- barrier={tool:call.name,outcome:{state:'skipped',verified:false},skipReason:'REPLAN_REQUIRED_AFTER_WORLD_REVISION_PROPOSAL_GATE',instruction:skipped.instruction};
185
- continue;
186
- }
187
- }
188
- const planIdentity=worldPlanIdentity(call);
189
- if (planIdentity && attemptedWorldPlans.has(planIdentity)) {
190
- const skipped={
191
- status:'not-executed',reason:'WORLD_PIPELINE_PLAN_ALREADY_ATTEMPTED',planIdentity,
192
- instruction:'This exact World IR semantic plan already ran in the current task. Revise the proposal from the returned rejection findings, or report the task incomplete; do not resubmit unchanged semantics under a new revision.',
193
- _sequence:{outcome:{state:'skipped',verified:false},barrier:false,replanRequired:true}
194
- };
195
- messages.push({role:'tool',toolCallId:call.id,name:call.name,content:JSON.stringify(skipped)});
196
- execution.push({planningStep:step+1,tool:call.name,args:structuredClone(call.args || {}),executed:false,outcome:{state:'skipped',verified:false},reason:skipped.reason,planIdentity});
197
- tools.recordSequence?.({planningStep:step+1,tool:call.name,executed:false,reason:skipped.reason,planIdentity,replanRequired:true});
198
- log(`skip: ${call.name} · exact World IR semantics already attempted`, 'plan');
199
- barrier={tool:call.name,outcome:{state:'skipped',verified:false},skipReason:'REPLAN_REQUIRED_AFTER_WORLD_PLAN_GATE'};
200
- continue;
201
- }
202
- const recoveryOf=previewPolicy.auxiliary ? recoveryOriginIdentity(call,unresolvedMutations) : null;
203
- const recoveryIdentity=previewPolicy.auxiliary ? recoveryMutationIdentity(call,recoveryOf) : null;
204
- if (recoveryOf && appliedAuxiliaryRecoveries.get(recoveryOf)?.has(recoveryIdentity)) {
205
- const skipped={
206
- status:'not-executed',reason:'RECOVERY_ALREADY_APPLIED',
207
- recoveryOf,recoveryIdentity,
208
- instruction:'This recovery already verified against the current failure evidence. Retry the original failed mutation before applying the same recovery again.',
209
- _sequence:{outcome:{state:'skipped',verified:false},barrier:false,replanRequired:true}
210
- };
211
- messages.push({role:'tool',toolCallId:call.id,name:call.name,content:JSON.stringify(skipped)});
212
- execution.push({
213
- planningStep:step+1,tool:call.name,args:structuredClone(call.args || {}),executed:false,
214
- outcome:{state:'skipped',verified:false},reason:skipped.reason,auxiliary:true,recoveryOf
215
- });
216
- tools.recordSequence?.({
217
- planningStep:step+1,tool:call.name,executed:false,reason:skipped.reason,
218
- auxiliary:true,recoveryOf,recoveryIdentity,replanRequired:true
219
- });
220
- log(`skip: ${call.name} · recovery already applied; retry original mutation`, 'plan');
221
- barrier={
222
- tool:call.name,outcome:{state:'skipped',verified:false},
223
- skipReason:'REPLAN_REQUIRED_AFTER_RECOVERY_GATE'
224
- };
225
- continue;
226
- }
227
-
228
- log(`plan: ${call.name} ${JSON.stringify(call.args)}`, 'plan');
229
- if (signal?.aborted) return cancelled(step + 1);
230
- executedTool = true;
231
- const invocation = await invokeAgentTool(tools, call, {
232
- signal, pendingWorldProposalLineage, pendingWorldRevisionRepair, issuedWorldRevisionProposals
233
- });
234
- const { safeResult, policy, invocationFailed } = invocation;
235
- if (invocation.acceptanceChanged) taskAcceptanceBundle = invocation.acceptanceBundle;
236
- if(call.name==='planSceneTask' && safeResult.status==='scene-task-plan') {
237
- sceneTaskPlan={criteria:structuredClone(safeResult.criteria),dependencies:structuredClone(safeResult.dependencies)};
238
- barrier={tool:call.name,outcome:{state:'accepted',verified:null},skipReason:'REPLAN_REQUIRED_AFTER_TASK_PLAN'};
239
- }
240
- if(call.name==='interactScene') {
241
- const identity=mutationIdentity(call),previous=failedSceneAttempts.get(identity);
242
- if(policy.outcome.verified)failedSceneAttempts.delete(identity);
243
- else failedSceneAttempts.set(identity,{fingerprint:sceneCallFingerprint,count:previous?.fingerprint===sceneCallFingerprint?previous.count+1:1});
244
- }
245
- const proposalRevisionId=call.name==='proposeWorldIR' && safeResult?.status==='world-proposal-ready' ? safeResult.worldIR?.revision?.id : null;
246
- const boundedRevisionId=call.name==='proposeWorldRevision' && safeResult?.status==='world-revision-proposal-ready' ? safeResult.proposal?.nextRevisionId : null;
247
- const proposalBarrier=Boolean(proposalRevisionId||boundedRevisionId);
248
- if(proposalRevisionId){
249
- issuedWorldRevisionProposals.clear();
250
- issuedWorldRevisions.add(proposalRevisionId);
251
- pendingWorldProposalLineage={parentRevisionId:proposalRevisionId};
252
- pendingWorldRevisionRepair=null;
253
- }
254
- if(boundedRevisionId && pendingWorldRevisionRepair){
255
- issuedWorldRevisionProposals.clear();
256
- issuedWorldRevisionProposals.set(boundedRevisionId,{signature:stableValue(safeResult.proposal),baseWorldIR:structuredClone(pendingWorldRevisionRepair.baseWorldIR)});
257
- }
258
- if(call.name==='runWorldPipeline'){
259
- issuedWorldRevisionProposals.clear();
260
- pendingWorldProposalLineage=worldProposalLineageFromExecution(call,safeResult) || pendingWorldProposalLineage;
261
- pendingWorldRevisionRepair=worldRevisionRepairFromExecution(safeResult);
262
- }
263
- if(call.name==='recompileWorldRevision'){
264
- issuedWorldRevisionProposals.delete(call.args?.proposal?.nextRevisionId);
265
- pendingWorldRevisionRepair=worldRevisionRepairFromExecution(safeResult);
266
- }
267
- const proposalInstruction=boundedRevisionId
268
- ? 'Bounded WorldRevision proposal compiled without mutating Runtime. Replan and submit this exact proposal to recompileWorldRevision.'
269
- : 'World IR proposal compiled without mutating Runtime. Replan from this issued revision before runWorldPipeline.';
270
- const sequence = policy.barrier || proposalBarrier ? {
271
- outcome:policy.outcome,
272
- barrier:Boolean(policy.barrier),
273
- ...(proposalBarrier?{planningBarrier:true}:{}),
274
- replanRequired:true,
275
- instruction:proposalBarrier
276
- ? proposalInstruction
277
- : replanInstruction(policy.outcome)
278
- } : null;
279
- const content = sequence ? annotateResult(safeResult, sequence) : safeResult;
280
- messages.push({ role:'tool', toolCallId:call.id, name:call.name, content:JSON.stringify(content) });
281
- const entry = {
282
- planningStep:step + 1, tool:call.name, args:structuredClone(call.args || {}), executed:true,
283
- outcome:structuredClone(policy.outcome), mutates:Boolean(policy.mutates), auxiliary:Boolean(policy.auxiliary),
284
- ...(recoveryOf ? { recoveryOf } : {})
285
- };
286
- execution.push(entry);
287
- log(`result: ${call.name} ${JSON.stringify(safeResult)}`, safeResult?.error ? 'error' : 'tool');
288
- if (planIdentity) attemptedWorldPlans.add(planIdentity);
289
- if(proposalBarrier){
290
- barrier={
291
- tool:call.name,outcome:structuredClone(policy.outcome),
292
- skipReason:boundedRevisionId?'REPLAN_REQUIRED_AFTER_WORLD_REVISION_PROPOSAL':'REPLAN_REQUIRED_AFTER_WORLD_PROPOSAL',
293
- instruction:proposalInstruction
294
- };
295
- tools.recordSequence?.({...entry,planningBarrier:true,replanRequired:true,...(proposalRevisionId?{worldRevisionId:proposalRevisionId}:{}),...(boundedRevisionId?{worldRevisionProposalId:boundedRevisionId}:{})});
296
- log(`sequence: ${call.name} → ${proposalRevisionId||boundedRevisionId} · fresh planning round required`,'tool');
297
- }
298
-
299
- if (policy.barrier) {
300
- mutationExecuted = true;
301
- const identity = policy.auxiliary && recoveryOf ? recoveryMutationIdentity(call,recoveryOf) : mutationIdentity(call,safeResult);
302
- barrier = { tool:call.name, outcome:structuredClone(policy.outcome) };
303
- lastMutation = { planningStep:step + 1, tool:call.name, identity, args:structuredClone(call.args || {}), outcome:structuredClone(policy.outcome) };
304
- if (policy.tracksUnresolved !== false && (!invocationFailed || call.name==='interactScene')) {
305
- // Any retry of the original semantic mutation starts a new evidence epoch.
306
- appliedAuxiliaryRecoveries.delete(identity);
307
- if (COMPLETE_OUTCOMES.has(policy.outcome.state)) {
308
- unresolvedMutations.delete(identity);
309
- if(call.name==='recompileWorldRevision'){
310
- const baseRevisionId=call.args?.proposal?.baseRevisionId;
311
- for(const [pendingIdentity,pending] of unresolvedMutations){
312
- if(baseRevisionId && worldMutationRevisionId(pending)===baseRevisionId) unresolvedMutations.delete(pendingIdentity);
313
- }
314
- }
315
- } else unresolvedMutations.set(identity,{ planningStep:step + 1, tool:call.name, identity, args:structuredClone(call.args || {}), outcome:structuredClone(policy.outcome) });
316
- } else if (policy.auxiliary && recoveryOf && COMPLETE_OUTCOMES.has(policy.outcome.state)) {
317
- if (!appliedAuxiliaryRecoveries.has(recoveryOf)) appliedAuxiliaryRecoveries.set(recoveryOf,new Set());
318
- appliedAuxiliaryRecoveries.get(recoveryOf).add(identity);
319
- }
320
- tools.recordSequence?.({ ...entry, identity, barrier:true, replanRequired:true, unresolved:unresolvedMutations.size });
321
- log(`sequence: ${call.name} → ${policy.outcome.state} · replan required`, COMPLETE_OUTCOMES.has(policy.outcome.state) ? 'tool' : 'error');
322
- }
323
- }
324
-
325
- if (!unresolvedMutations.size || mutationExecuted) recoveryReadRounds=0;
326
- else if (executedTool) recoveryReadRounds += 1;
327
- }
328
-
329
- // EXHAUST: do not declare success when the plan still has pending evidence.
330
- // EXHAUST: budget exhaustion is not proof of completion.
331
- async function finishAtLimit() {
332
- if (signal?.aborted) return cancelled(maxSteps);
333
- await refreshSceneGoals();
334
- return finalizePlanningLimit({
335
- maxSteps, taskAcceptanceBundle, lastMutation, sceneTaskPlan,
336
- sceneGoalEvidence, unresolvedMutations, execution, log,
337
- recordSequence:tools.recordSequence?.bind(tools)
338
- });
339
- }
340
-
341
- for (let step = 0; step < maxSteps; step++) {
342
- const planningRound = await preparePlanningRound(step);
343
- if (planningRound.cancelled) return planningRound.cancelled;
344
- const { response, scene, unresolved } = planningRound;
345
- if (!response.toolCalls.length) return finishModelResponse(response, step);
346
- const worldBuildVerified=lastMutation
347
- && ['runWorldPipeline','recompileWorldRevision'].includes(lastMutation.tool)
348
- && COMPLETE_OUTCOMES.has(lastMutation.outcome?.state)
349
- && !unresolved.length;
350
- const redundantPostWorldReads=worldBuildVerified
351
- && response.toolCalls.every((call)=>!tools.executionPolicy?.(call.name,undefined)?.mutates);
352
- if(redundantPostWorldReads){
353
- messages.push({role:'assistant',content:response.message || '',toolCalls:response.toolCalls});
354
- const instruction='The world build is already Runtime-verified and current task context is fresh. Do not issue read-only confirmation calls. Either perform the next required world mutation from current context or finalize.';
355
- for(const call of response.toolCalls){
356
- const skipped={status:'not-executed',reason:'WORLD_READY_REDUNDANT_READ',instruction,_sequence:{outcome:{state:'skipped',verified:false},barrier:false,replanRequired:true}};
357
- messages.push({role:'tool',toolCallId:call.id,name:call.name,content:JSON.stringify(skipped)});
358
- execution.push({planningStep:step+1,tool:call.name,args:structuredClone(call.args || {}),executed:false,outcome:{state:'skipped',verified:false},reason:skipped.reason});
359
- tools.recordSequence?.({planningStep:step+1,tool:call.name,executed:false,reason:skipped.reason,replanRequired:true});
360
- }
361
- log('skip: redundant read-only confirmation after verified world build','plan');
362
- continue;
363
- }
364
- const readOnlyRecovery = unresolved.length && recoveryReadRounds >= maxRecoveryReadRounds
365
- && response.toolCalls.every((call)=>!tools.executionPolicy?.(call.name,undefined)?.mutates);
366
- if (readOnlyRecovery) {
367
- const message=`Task incomplete: recovery observation limit reached with ${unresolved.length} unresolved world mutation(s).`;
368
- log(`sequence: ${message}`,'error');
369
- for (const call of response.toolCalls) execution.push({
370
- planningStep:step+1,tool:call.name,args:structuredClone(call.args || {}),executed:false,
371
- outcome:{state:'skipped',verified:false},reason:'RECOVERY_OBSERVATION_LIMIT'
372
- });
373
- tools.recordSequence?.({
374
- planningStep:step+1,executed:false,termination:'recovery-observation-limit',
375
- recoveryReadRounds,unresolved:unresolved.length,
376
- lastMutation:lastMutation ? structuredClone(lastMutation) : null
377
- });
378
- return {
379
- message,steps:step+1,taskStatus:'incomplete',termination:'recovery-observation-limit',
380
- lastMutation:lastMutation ? structuredClone(lastMutation) : null,
381
- unresolvedMutations:unresolved,execution:structuredClone(execution)
382
- };
383
- }
384
- messages.push({ role:'assistant', content:response.message || '', toolCalls:response.toolCalls });
385
-
386
- const batchOutcome = await executeToolBatch(response, step, scene);
387
- if (batchOutcome) return batchOutcome;
388
- }
389
- return finishAtLimit();
390
- }
@@ -1,39 +0,0 @@
1
- /* Runs a single model-selected tool with the original trusted internal context. */
2
- export async function invokeAgentTool(tools, call, {
3
- signal, pendingWorldProposalLineage = null, pendingWorldRevisionRepair = null,
4
- issuedWorldRevisionProposals = new Map()
5
- } = {}) {
6
- const acceptanceBefore = tools.runtime?.lastAcceptanceBundle || null;
7
- let result;
8
- let invocationFailed = false;
9
- try {
10
- let internalContext = call.name === 'interactScene' ? { signal } : null;
11
- if (call.name === 'proposeWorldIR' && pendingWorldProposalLineage)
12
- internalContext = { worldProposalLineage: structuredClone(pendingWorldProposalLineage) };
13
- if (call.name === 'proposeWorldRevision' && pendingWorldRevisionRepair)
14
- internalContext = { worldRevisionRepair: structuredClone(pendingWorldRevisionRepair) };
15
- if (call.name === 'recompileWorldRevision') {
16
- const issued = issuedWorldRevisionProposals.get(call.args?.proposal?.nextRevisionId);
17
- if (issued) internalContext = { worldRevisionBaseIR: structuredClone(issued.baseWorldIR) };
18
- }
19
- result = internalContext
20
- ? await tools.call(call.name, call.args, internalContext)
21
- : await tools.call(call.name, call.args);
22
- } catch (error) {
23
- invocationFailed = true;
24
- result = { error:error.message, code:error.code || 'TOOL_ERROR' };
25
- }
26
- const acceptanceAfter = tools.runtime?.lastAcceptanceBundle || null;
27
- const acceptanceChanged = acceptanceAfter !== acceptanceBefore;
28
- const safeResult = result === undefined ? { ok:true } : result;
29
- const policy = tools.executionPolicy?.(call.name, safeResult) || {
30
- mutates:false, barrier:false, batchable:true, batchAcceptable:true,
31
- outcome:safeResult?.error
32
- ? {state:'error',verified:false,reason:safeResult.code || 'TOOL_ERROR'}
33
- : {state:'accepted',verified:null}
34
- };
35
- return {
36
- safeResult, policy, invocationFailed, acceptanceChanged,
37
- acceptanceBundle:acceptanceChanged && acceptanceAfter ? structuredClone(acceptanceAfter) : null
38
- };
39
- }
@@ -1,19 +0,0 @@
1
- import { JsonGateway } from '../../../foundation/JsonGateway.js';
2
-
3
- export class HttpLLMGateway extends JsonGateway {
4
- constructor(options = {}) { super({ timeoutMs: 180000, label: 'agent capability adapter', ...options }); }
5
- async complete(request, options) { return normalizeGatewayResponse(await this.post(request, options)); }
6
- }
7
-
8
- export function normalizeGatewayResponse(payload = {}) {
9
- const toolCalls = Array.isArray(payload.toolCalls) ? payload.toolCalls.map((call, index) => ({
10
- id: call.id || `call_${index}`,
11
- name: call.name,
12
- args: call.args || call.arguments || {}
13
- })) : [];
14
- return {
15
- message: payload.message || payload.content || '',
16
- final: Boolean(payload.final || (!toolCalls.length && (payload.message || payload.content))),
17
- toolCalls
18
- };
19
- }
@@ -1,46 +0,0 @@
1
- const BASE_POLICY = `You are AgentScape, a spatial agent controlling an interactive 3D world.
2
- Use tools instead of inventing world state. Runtime observations, tool results, tool JSON schemas, and tool descriptions are authoritative. Never invent parameters, unsupported fields, provider topology, object state, verification evidence, or world truth that the current tool contracts do not expose.
3
- Inspect only when current task context is insufficient. Prefer semantic relations over raw coordinates when relations answer the question. Do not issue read tools merely to reproduce evidence already present in the compact task observation.`;
4
-
5
- const MUTATION_POLICY = `Treat every world-changing tool as a transaction boundary. AgentScape forces a fresh planning round after each mutation, so never assume multiple mutations from one assistant turn will execute in sequence.
6
- A mutation is complete only when its tool outcome is verified/accepted according to the tool contract. blocked, failed, unverified, request-only, provisional, or error outcomes do not authorize a dependent mutation. Diagnose, recover, retry, or report the task incomplete.
7
- Never repeat an identical semantic mutation after its latest authoritative outcome is already verified/accepted unless the task observation explicitly marks it unresolved again or later world evidence invalidates it. After a verified mutation satisfies the user's final remaining goal, the next fresh planning round must return the final answer with no tool calls. Do not re-run the final action merely to reconfirm evidence already present in the compact task observation.
8
- Use executeBatch only for genuinely atomic, synchronously rollback-safe scene edits. Embodied actions, navigation, pickup/drop, articulation, generation jobs, and other long-running actions are not batchable.`;
9
-
10
- const RECOVERY_POLICY = `Recovery evidence is Runtime-issued and provisional. Contact-at-failure is contact evidence, not proof of unique causality. Never select an alternate articulated action yourself when Runtime has not selected it.
11
- Use suggestRecoveryActions and the returned eligibility/ranking exactly as scoped by the current failure evidence epoch. Physics counterfactual evidence is trustworthy only at the strength Runtime reports; never upgrade fallback geometry into Physics verification or ignore a third-object/environment veto.
12
- Execute at most one recovery mutation from the current failure epoch, then fresh-replan and retry the original failed mutation. A successful recovery or cleanup mutation never clears the original unresolved task. Cleanup is housekeeping and must not be reported as completion of the original task.`;
13
-
14
- const WORLD_POLICY = `For assets, searchAssets before generateAsset. Generation capabilities are discovered through AgentScape Generation/Connector contracts; never assume a particular remote Provider exists. Generated/imported assets may remain provisional and do not prove world validity.
15
- For a request that explicitly requires a new generated background/world plus interactive assets, prefer buildGeneratedHybridWorld: provide only environmentPrompt and the planner proposal body, and let Runtime own text→image→world generation, verified Artifact import, Environment replacement, revision/provenance, observation-anchor resolution, canonical composition, and rollback. Never manually chain low-level generation jobs, artifact import, environment loading, and spawn to imitate this product path. For multi-object composition in the current Environment, use proposeWorldIR first and submit only the Runtime-issued World IR to runWorldPipeline after a fresh planning round. Revision/provenance lineage is Runtime-owned. Tool schemas are the sole authority for World IR fields; never invent unsupported constraints or state evidence.
16
- runWorldPipeline is the canonical mutation/admission boundary. world-ready is verified; world-provisional remains unverified; world-rejected is failure. The Runtime may perform its own bounded missing-asset generation retry. Do not bypass canonical world admission by manually chaining low-level generation and spawn operations and then claiming completion.
17
- Persisted acceptance evidence is historical after restore. Use replayWorldAcceptance before relying on it. For a bounded rejected revision, use Runtime-issued proposeWorldRevision/recompileWorldRevision contracts rather than authoring base revision identity or Finding scope yourself.`;
18
-
19
- const EMBODIED_POLICY = `Prefer Runtime placement/navigation/interaction tools over guessed coordinates. For ObjectStore assets, use navigateTo for embodied movement to an explicit world coordinate, moveForward for relative movement such as "walk forward a little", approachAndInteract for open/close, approachAndPickup for pickup and approachAndPlace for placing a held object. Never invent absolute coordinates for relative movement and never navigate an agent to its own id; if moveForward is unavailable, report that relative movement is unsupported instead of fabricating a target. For "what interactive objects are near you", call listInteractablesNearMe once instead of manually chaining canReach/listObjects. These high-level tools own interaction-pose search, navigation, Physics checks, live completion, settle, and post-condition verification as documented by their tool contracts.
20
- When the task already names the actor and an ObjectStore asset target, call the matching high-level embodied tool directly. For open/close, do not call listObjects, findInteractionPose, or navigateTo first; call approachAndInteract directly. For pickup, call approachAndPickup directly. For placing a currently held object onto a named support, call approachAndPlace directly. Use listObjects or diagnostic spatial tools only when an id/target is genuinely unknown, or after a high-level embodied action fails and diagnosis/recovery is required. Do not duplicate navigation already owned by a high-level embodied tool.
21
- Do not reinterpret request-only articulation as completion. Do not confuse held ownership with grasp-force verification. Do not confuse supportId with the held object or surfaceId with an object id. Use low-level scene primitives only when the task actually requires low-level editing rather than embodied execution.`;
22
-
23
- const AFFORDANCE_POLICY = `An environment can also expose worldAffordances in the task observation. listWorldAffordances and inspectWorldAffordance discover both ObjectStore assets (source=asset) and environment contracts (source=environment). Use source and each action execution field to choose the executor: asset interaction actions use the existing approachAndPickup/approachAndPlace/approachAndInteract tools; world-action uses executeWorldAction. Editor actions are scene edits, not embodied physics. available=null means actor reach was not checked; EXECUTOR_UNAVAILABLE actions cannot be executed. These objects are discovered with listWorldAffordances and inspected with inspectWorldAffordance; listObjects is only the ObjectStore asset index. For an environment affordance such as cabin:front-door, use executeWorldAction with its discovered action, not approachAndInteract or other asset-only tools. Native Three.js scene interactives (chairs, ornaments, mirror, etc. in magic cabin) appear in listInteractablesNearMe.nativeInteractables / listEnvironmentInteractables: for a named interactionId use approachAndActivateEnvironmentInteract as the single embodied tool (Runtime owns pathfinding + reach + activation). If already within 1.5m, activateEnvironmentInteract is allowed. When contractId exists the activation may route through executeWorldAction verification; native-provisional activations are not force-verified articulation. After a door/path-changing activation returns navigationInvalidated=true, you MUST fresh-replan and call navigateTo/findPath again before entering the house or going upstairs; do not reuse an old path. navigateTo end must be a world-coordinate array like [-2, 3.12, 0] for cabin second floor — never pass the agent id as the destination. If approach reports unreachable, call findEnvironmentInteractApproach for diagnostics instead of inventing coordinates. Never navigate an agent to its own id. Respect reach and occlusion conditions. navigateTo may approach a reachable floor position near the observed target; the target's own position is not necessarily a standable floor point. Do not teleport to bypass blocked access. Report unsupported cross-floor access instead of inventing a route.
24
- Only world-action-completed with verified=true confirms this contract's state post-condition. physicsVerified=false and evidenceKind=animated-transform/device-state/text-state never mean force-verified articulation, pickup, support, or containment. Decorative click animations are not Agent capabilities. Discover actual ids and actions instead of guessing capability from appearance.`;
25
-
26
- export const AGENT_POLICIES = Object.freeze([
27
- BASE_POLICY,
28
- MUTATION_POLICY,
29
- RECOVERY_POLICY,
30
- WORLD_POLICY,
31
- EMBODIED_POLICY,
32
- AFFORDANCE_POLICY
33
- ]);
34
-
35
- export function buildAgentSystemPrompt(toolDefinitions=[]) {
36
- const tools=toolDefinitions.map((tool)=>tool.name).filter(Boolean);
37
- const sceneTasks=tools.includes('planSceneTask') ? `For a multi-object goal such as tidying a room, use the fresh context.scene as the authoritative current world, relations, selected Agent and affordances. Declare planSceneTask with one verifiable relation/state criterion per intended object outcome and optional dependencies, not a fixed action sequence. Discover IDs from this observation; never assume demo IDs or add objects to make the task appear complete. Use objectAnyOf only for observed supports that are genuinely equivalent under the user's goal. Keep these declared goals immutable.
38
- Use interactScene with goalId and the selected actor for each embodied action. It shares Scene API jobs with Studio and MCP and awaits verification. After each action, choose the next unsatisfied goal from fresh context.task.plan.verification and current carry/relations. OUT_OF_REACH/OCCLUDED with canApproach allows the high-level operation to plan an approach; it never permits teleporting. Environment contracts also approach automatically. A navigation-invalidating action requires fresh path planning.
39
- On collision, unreachable or failed placement, inspect the returned evidence and choose an eligible recovery, another route or an equivalent declared support. Retry only after meaningful new evidence; unchanged failures are bounded. Do not replay a stale batch, clear failed outcomes yourself, weaken goals, or claim task completion merely because the last action succeeded. Completion requires every declared goal to pass current Runtime verification. If ambiguity or missing capabilities prevent a justified plan, report the unresolved scope honestly. Read-only questions do not need a task plan.` : '';
40
- const availability=tools.length
41
- ? `Available tools for this run are supplied as structured contracts: ${tools.join(', ')}. Do not assume any tool not in this list exists.`
42
- : 'Available tools are supplied separately as structured contracts.';
43
- const projects = `A code project may expose context.scene.project.entities with source=project. These are native project-owned objects, not necessarily physical Agent assets. Discover their custom action names, JSON parameter schemas and availability from observeScene/inspect; invoke through interactScene with interaction={action:'custom',target,name,args} and a declared goalId. Actor is optional for project actions; the project defines its own access policy. A project may explicitly implement teleportation or other nonphysical behavior; do not use that as evidence of physical walking or use editor transforms to bypass embodied restrictions. A succeeded project action without a verifier is accepted execution, not verified success. Verification marked project-defined is a project callback's verdict, never physics verification. Check declared goals against fresh state before claiming task completion.`;
44
- const studioProjects=tools.includes('readStudioProject') ? `Studio supports full executable code worlds. For creative coding, custom shaders, animation, games or new behaviors, use readStudioProject for the entry-source preview, file manifest and createProject guide. For multi-file worlds use readStudioFile to inspect paths. Prefer previewStudioProjectBatch({expectedRevision,operations:[{kind:'file',action:'create|write|patch|rename|delete',path,...}]}) to stage all related modifications, inspect bounded diffs, then applyStudioProjectBatch({previewId,expectedRevision}) to commit one atomic revision. discardStudioProjectBatch cancels a pending preview; undoStudioProjectBatch reverts the latest applied batch before any subsequent edits. Individual editStudioFile and editStudioResource remain for isolated changes. writeStudioProject can create/edit the main draft and patchStudioProject changes a unique source fragment. Always runStudioProject to activate and saveStudioProject to persist. These tools are a separate complete-code workflow from asset/world admission; do not force code projects through World IR or the static authoring executor. Read the current revision before editing and pass expectedRevision. Source edits are not live until run. Report compilation/setup errors and repair the draft; the previous running world stays active. Save after the requested runtime changes, not before. These are trusted scripts with arbitrary JS and optional verification; do not claim physics guarantees from successful execution.` : '';
45
- return [...AGENT_POLICIES,availability,sceneTasks,projects,studioProjects,'Keep the final response concise.'].filter(Boolean).join('\n\n');
46
- }