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,71 +0,0 @@
1
- import { Worker } from 'node:worker_threads';
2
- import { sandboxBundle } from './SandboxBundle.js';
3
- import { pipelineDigest } from './BuildEnvironment.js';
4
- import { validateRemoteAuthoringDocument } from './RemoteAuthoringDocument.js';
5
- import { DockerBuildRunner } from './DockerBuildRunner.js';
6
-
7
- /** Execution contract: environment(), run(request, {signal}), execute(), close().
8
- * Worker resource limits are reliability controls, NOT OS isolation.
9
- */
10
- export function createCodeExecutor({ mode = 'worker-wasm', authorized = false, remote = false, timeoutMs = 1500,
11
- wallTimeoutMs = 12000, memoryBytes = 96 * 1024 * 1024, ...options } = {}) {
12
- if (!['disabled', 'worker-wasm', 'trusted-local', 'os-isolated'].includes(mode)) throw new Error('CODE_EXECUTION_MODE_INVALID');
13
- if (remote && !['disabled', 'os-isolated'].includes(mode)) throw new Error('OS_ISOLATION_REQUIRED');
14
- if (mode === 'trusted-local' && authorized !== true) throw new Error('CODE_EXECUTION_AUTHORIZATION_REQUIRED');
15
- if (mode === 'os-isolated') return new DockerBuildRunner(options);
16
- const active = new Set();
17
- let closed = false;
18
- const check = () => {
19
- if (closed) throw new Error('AUTHORING_EXECUTOR_CLOSED');
20
- if (mode === 'disabled') throw new Error('CODE_EXECUTION_DISABLED');
21
- };
22
- const executor = {
23
- async environment() {
24
- check();
25
- return { engine: mode, builderVersion: '2', threeVersion: '0.186.0',
26
- digest: (await sandboxBundle()).digest, pipelineDigest: await pipelineDigest() };
27
- },
28
- async run(request, { signal } = {}) {
29
- check();
30
- if (signal?.aborted) throw new Error('BUILD_CANCELLED');
31
- if (!['authoring', 'procedural'].includes(request.mode)) throw new Error('BUILD_MODE_INVALID');
32
- const source = request.mode === 'procedural' ? request.source : request.code;
33
- if (typeof source !== 'string' || Buffer.byteLength(source) > 32768) throw new Error('BUILD_SOURCE_LIMIT');
34
- if (request.mode === 'authoring') validateRemoteAuthoringDocument(request.document);
35
- const environment = await executor.environment();
36
- const bundle = mode === 'worker-wasm' ? (await sandboxBundle()).code : undefined;
37
- check();
38
- if (signal?.aborted) throw new Error('BUILD_CANCELLED');
39
- return new Promise((resolve, reject) => {
40
- const worker = new Worker(new URL(mode === 'worker-wasm' ? './AuthoringSandboxWorker.mjs' : './TrustedAuthoringWorker.mjs', import.meta.url), {
41
- workerData: { ...request, bundle, timeoutMs, memoryBytes }, resourceLimits: { maxOldGenerationSizeMb: Math.ceil(memoryBytes / 1048576) }, execArgv: []
42
- });
43
- let finished = false;
44
- const finish = (error, value) => {
45
- if (finished) return;
46
- finished = true; clearTimeout(timer); signal?.removeEventListener('abort', abort);
47
- active.delete(cancel); void worker.terminate();
48
- if (error) reject(error); else resolve(value);
49
- };
50
- const abort = () => finish(new Error('BUILD_CANCELLED'));
51
- const cancel = () => finish(new Error('AUTHORING_EXECUTOR_CLOSED'));
52
- const timer = setTimeout(() => finish(new Error('AUTHORING_CODE_TIMEOUT')), wallTimeoutMs);
53
- active.add(cancel); signal?.addEventListener('abort', abort, { once: true });
54
- if (signal?.aborted) abort();
55
- worker.once('message', message => {
56
- if (message.error) return finish(Object.assign(new Error('BUILD_EXECUTION_FAILED'), { details: { message: message.error } }));
57
- try {
58
- if (typeof message.json !== 'string' || message.json.length > 2097152) throw new Error('BUILD_OUTPUT_LIMIT');
59
- finish(null, { document: validateRemoteAuthoringDocument(JSON.parse(message.json)), environment,
60
- security: { mode, osIsolation: false, trusted: mode === 'trusted-local', memoryBytes, wallTimeoutMs } });
61
- } catch (error) { finish(error); }
62
- });
63
- worker.once('error', error => finish(Object.assign(new Error('AUTHORING_SANDBOX_FAILED'), { details: { message: error.message } })));
64
- worker.once('exit', () => finish(new Error('AUTHORING_SANDBOX_STOPPED')));
65
- });
66
- },
67
- async execute(request, options) { return (await executor.run({ ...request, mode: 'authoring' }, options)).document; },
68
- close() { closed = true; for (const cancel of active) cancel(); }
69
- };
70
- return executor;
71
- }
@@ -1,42 +0,0 @@
1
- # PC2 AgentDock deployment
2
-
3
- Validated on 2026-11-04 on PC2 (`RANRAN4060`). MCP is merged into
4
- `feat/ui-design-system-unify` at merge commit `a607445`.
5
-
6
- - Source: `D:\a_programming_list\A-Python-Project\wk08\AgentScape`
7
- - Application: `apps/mcp-server/main.mjs`; Studio starts independently.
8
- - AgentDock dynamic server: `agentscape-world`, Streamable HTTP,
9
- `http://127.0.0.1:39015/mcp`, 24 tools after the v0.3 programmatic asset upgrade.
10
- - Authorization header references the server's isolated environment variable
11
- `AGENTSCAPE_WORLD_AUTHORIZATION`, configured through `mcp_manage`.
12
- - Windows task `AgentScape-World-MCP` starts a hidden supervisor at the current
13
- user's logon. It is running now; Node restarts after exit with a five-second delay.
14
- This is a user logon task, not a system service before logon.
15
- - Supervisor and private runtime files live in
16
- `C:\Users\yuminghui\.agentdock\agentscape-world`.
17
- `start.ps1` loads an independent Windows-user-protected credential from
18
- `credential.clixml`. Do not publish these private files or credential values.
19
- - Exported scenes live in the source checkout's ignored `.mcp-sessions` directory.
20
- Worlds are in memory and do not survive process restart.
21
-
22
- v0.3 additionally stores published assets, source versions and explicitly saved worlds
23
- under `D:\AgentScapeData\mcp-assets`. `world_restore` resolves server save IDs after
24
- restart. Programmatic builds require Docker Desktop Linux and a provisioned
25
- `sandbox.json`; unavailable isolation fails closed. See `PROGRAMMATIC-ASSETS.md`.
26
-
27
- The official SDK unified HTTP handler serves both 2026-07-28 request envelopes
28
- and legacy clients. The original legacy-only transport failed AgentDock discovery.
29
- `tests/mcp/modern-protocol.test.js` covers discovery and tool listing without
30
- a legacy handshake; existing HTTP tests cover the complete physics workflow.
31
-
32
- Real AgentDock acceptance created a private world, observed four objects, opened
33
- the cabinet, picked up the cup and placed it on the table. All three actions
34
- returned `verified`; final verification passed six checks and reported empty hands.
35
- Export returned four objects (9140 bytes), and the session was closed.
36
- Full call evidence is saved privately in the runtime directory's `acceptance.json`.
37
-
38
- Use `mcp_manage inspect/refresh` for connection health and `mcp_tool_search`,
39
- `mcp_tool_inspect`, `mcp_tool_call` to discover and invoke tools.
40
- To stop maintenance, stop the Windows task and its Node child; stopping only Node
41
- causes the supervisor to restart it. Future Node installations may require updating
42
- the explicit executable path in `start.ps1`.
@@ -1,66 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { readFile } from 'node:fs/promises';
3
- import { randomUUID } from 'node:crypto';
4
- import { validateRemoteAuthoringDocument } from './RemoteAuthoringDocument.js';
5
- import { pipelineDigest } from './BuildEnvironment.js';
6
- import { sandboxBundle } from './SandboxBundle.js';
7
-
8
- export function runCommand(command,args,{input='',timeoutMs=15000,maxBytes=4194304,signal}={}) {
9
- return new Promise((resolve,reject)=>{
10
- const child=spawn(command,args,{windowsHide:true,stdio:['pipe','pipe','pipe']});
11
- const output=[],errors=[];let size=0,problem;
12
- const stop=code=>{problem ||= new Error(code);child.kill();};
13
- const timer=setTimeout(()=>stop('BUILD_TIMEOUT'),timeoutMs);
14
- const abort=()=>stop('BUILD_CANCELLED');signal?.addEventListener('abort',abort,{once:true});if(signal?.aborted)abort();
15
- child.stdout.on('data',chunk=>{size+=chunk.length;if(size>maxBytes)stop('BUILD_OUTPUT_LIMIT');else output.push(chunk);});
16
- child.stderr.on('data',chunk=>{if(errors.reduce((n,b)=>n+b.length,0)<4096)errors.push(chunk);});
17
- child.on('error',()=>{clearTimeout(timer);signal?.removeEventListener('abort',abort);reject(new Error('SANDBOX_UNAVAILABLE'));});
18
- child.on('close',code=>{clearTimeout(timer);signal?.removeEventListener('abort',abort);if(problem)reject(problem);else resolve({code,stdout:Buffer.concat(output).toString('utf8'),stderr:Buffer.concat(errors).toString('utf8')});});
19
- child.stdin.on('error',()=>{});child.stdin.end(input);
20
- });
21
- }
22
-
23
- export class DockerBuildRunner {
24
- constructor({configPath,command='docker',timeoutMs=15000}={}) {Object.assign(this,{configPath,command,timeoutMs});this.controllers=new Set();this.id=randomUUID();}
25
- async environment() {
26
- if(this.closed)throw new Error('AUTHORING_EXECUTOR_CLOSED');
27
- try {
28
- const config=JSON.parse(await readFile(this.configPath,'utf8'));
29
- if(config.digest!==(await sandboxBundle()).digest)throw Error();
30
- if(!/^sha256:[a-f0-9]{64}$/.test(config.image))throw Error();
31
- const image=await runCommand(this.command,['image','inspect',config.image],{timeoutMs:5000});
32
- if(image.code!==0)throw Error();
33
- const metadata=JSON.parse(image.stdout)[0];
34
- if(metadata.Os!=='linux'||metadata.Config?.Labels?.['agentscape.sandbox.version']!=='1'||metadata.Config?.Labels?.['agentscape.sandbox.digest']!==config.digest)throw Error();
35
- return {...config,engine:'docker-linux',builderVersion:'1',threeVersion:'0.186.0',pipelineDigest:await pipelineDigest()};
36
- }catch{throw new Error('SANDBOX_UNAVAILABLE');}
37
- }
38
- async run(request,{signal}={}) {
39
- const environment=await this.environment();
40
- const controller=new AbortController();this.controllers.add(controller);
41
- const abort=()=>controller.abort();signal?.addEventListener('abort',abort,{once:true});if(signal?.aborted)abort();
42
- const name=`agentscape-build-${randomUUID()}`;
43
- let container=name;
44
- try {
45
- const created=await runCommand(this.command,['create','--name',name,'--label',`agentscape.runner=${this.id}`,'--interactive','--network','none','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges','--pids-limit','64','--memory','256m','--memory-swap','256m','--cpus','1','--user','65534:65534','--tmpfs','/tmp:rw,noexec,nosuid,size=16m','--init','--pull','never',environment.image],{timeoutMs:5000,signal:controller.signal});
46
- if(created.code!==0)throw new Error('SANDBOX_UNAVAILABLE');
47
- container=created.stdout.trim();if(!/^[a-f0-9]{64}$/.test(container))throw new Error('SANDBOX_UNAVAILABLE');
48
- const inspected=await runCommand(this.command,['inspect',container],{timeoutMs:5000});
49
- const info=JSON.parse(inspected.stdout)[0],h=info.HostConfig;
50
- if(info.Image!==environment.image||info.Config.User!=='65534:65534'||!h.ReadonlyRootfs||h.NetworkMode!=='none'||h.Privileged||h.PidsLimit!==64||h.Memory!==268435456||h.MemorySwap!==268435456||h.NanoCpus!==1e9||!h.CapDrop.includes('ALL')||!h.SecurityOpt.some(s=>s.startsWith('no-new-privileges'))||info.Mounts.some(m=>m.Type!=='tmpfs'))throw new Error('SANDBOX_POLICY_MISMATCH');
51
- const result=await runCommand(this.command,['start','--attach','--interactive',container],{input:JSON.stringify(request),timeoutMs:this.timeoutMs,signal:controller.signal});
52
- let data;try{data=JSON.parse(result.stdout);}catch{throw new Error(result.code===137?'BUILD_MEMORY_LIMIT':'BUILD_EXECUTION_FAILED');}
53
- if(result.code!==0||data.error)throw new Error(/^[A-Z_]+$/.test(data.error||'')?data.error:'BUILD_EXECUTION_FAILED');
54
- return {document:validateRemoteAuthoringDocument(data.document),environment,security:{network:'none',readOnly:true,user:'65534:65534',memoryBytes:h.Memory,pids:h.PidsLimit,cpus:1,noNewPrivileges:true,capabilities:[],mounts:[]}};
55
- } finally {
56
- signal?.removeEventListener('abort',abort);this.controllers.delete(controller);
57
- const cleaned=await runCommand(this.command,['rm','--force',container],{timeoutMs:5000}).catch(()=>null);
58
- if(!cleaned||cleaned.code!==0){
59
- const remaining=await runCommand(this.command,['inspect',container],{timeoutMs:5000}).catch(()=>null);
60
- if(!remaining||remaining.code===0||!remaining.stderr.includes('No such'))throw new Error('SANDBOX_CLEANUP_FAILED');
61
- }
62
- }
63
- }
64
- async execute(request,options) {return (await this.run({...request,mode:'authoring'},options)).document;}
65
- close() {this.closed=true;for(const controller of this.controllers)controller.abort();this.controllers.clear();}
66
- }
@@ -1,159 +0,0 @@
1
- import { createHash, randomUUID } from 'node:crypto';
2
- import { mkdir, readFile, writeFile, rename, rm, readdir, lstat } from 'node:fs/promises';
3
- import path from 'node:path';
4
- import { parseDefinition, canonical, proceduralContract } from '../../application/programmatic-assets/ProgrammaticAssetContract.js';
5
- import { validateAssetManifest } from '../../modules/asset/model/schema.js';
6
- import { assetAdmission } from '../../modules/asset/model/admission.js';
7
- import { SceneObjectForge } from '../../application/object-forge/SceneObjectForge.js';
8
-
9
- export const hash=value=>createHash('sha256').update(value).digest('hex');
10
- export const assetVersion=(source,definition,environment)=>hash(canonical({contract:proceduralContract,source,definition,environment}));
11
- const assetPattern=/^pa_[a-f0-9]{64}$/;
12
- const projectContract='agentscape.project-asset.v1';
13
- const projectVersion=(definition,template,bytes)=>hash(canonical({contract:projectContract,definition,template,glbHash:hash(bytes)}));
14
- const uuidPattern=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
15
- export class FileAssetRepository {
16
- constructor(root) {this.root=path.resolve(root);}
17
- ownerRoot(owner) {return path.join(this.root,'owners',hash(owner));}
18
- target(owner,kind,id) {
19
- if(!['assets','builds','requests','worlds'].includes(kind)||!(kind==='assets'?assetPattern:uuidPattern).test(id))throw new Error('STORAGE_ID_INVALID');
20
- return path.join(this.ownerRoot(owner),kind,id);
21
- }
22
- async read(file,max=4194304) {
23
- const stat=await lstat(file);if(!stat.isFile()||stat.isSymbolicLink()||stat.size>max)throw new Error('STORAGE_INTEGRITY_FAILED');
24
- return readFile(file);
25
- }
26
- async json(file) {return JSON.parse((await this.read(file)).toString('utf8'));}
27
- async atomic(file,value) {
28
- await mkdir(path.dirname(file),{recursive:true});const temp=`${file}.${randomUUID()}.tmp`;
29
- try{await writeFile(temp,JSON.stringify(value),{flag:'wx'});await rename(temp,file);}finally{await rm(temp,{force:true});}
30
- }
31
- async ids(owner,kind) {try{return(await readdir(path.join(this.ownerRoot(owner),kind))).filter(id=>(kind==='assets'?assetPattern:uuidPattern).test(id));}catch(e){if(e.code==='ENOENT')return [];throw e;}}
32
- async save(owner,{source,definition,environment,...result}) {
33
- const version=assetVersion(source,definition,environment),assetId=`pa_${version}`;
34
- const target=this.target(owner,'assets',assetId);
35
- const manifestJSON=JSON.stringify(result.manifest);
36
- const hashes={source:hash(source),definition:hash(canonical(definition)),glb:hash(result.bytes),manifest:hash(manifestJSON)};
37
- try{const previous=await this.get(owner,assetId);if(previous.build.hashes.glb!==hashes.glb)throw new Error('BUILD_NONDETERMINISTIC');return previous;}catch(e){if(e.code!=='ENOENT')throw e;}
38
- if((await this.ids(owner,'assets')).length>=128)throw new Error('ASSET_STORAGE_QUOTA');
39
- const build={schema:proceduralContract,assetId,logicalId:definition?.id || 'visual',version,owner:hash(owner),definition,environment,hashes,admission:result.admission,validation:result.validation,security:result.security,createdAt:new Date().toISOString()};
40
- if(Buffer.byteLength(JSON.stringify(build))>1048576||Buffer.byteLength(manifestJSON)>262144)throw new Error('BUILD_METADATA_LIMIT');
41
- await mkdir(path.dirname(target),{recursive:true});const staging=path.join(path.dirname(target),`.tmp-${randomUUID()}`);
42
- try{
43
- await mkdir(staging);await writeFile(path.join(staging,'source.js'),source);await writeFile(path.join(staging,'asset.glb'),result.bytes);await writeFile(path.join(staging,'manifest.json'),manifestJSON);await writeFile(path.join(staging,'build.json'),JSON.stringify(build));
44
- if(hash(await this.read(path.join(staging,'asset.glb')))!==hashes.glb)throw new Error('STORAGE_INTEGRITY_FAILED');
45
- try{await rename(staging,target);}catch(error){
46
- if(!['EEXIST','ENOTEMPTY','EPERM'].includes(error.code))throw error;
47
- const previous=await this.get(owner,assetId);if(previous.build.hashes.glb!==hashes.glb)throw new Error('BUILD_NONDETERMINISTIC');
48
- }
49
- }finally{await rm(staging,{recursive:true,force:true});}
50
- return this.get(owner,assetId);
51
- }
52
-
53
- /** Promote a locally compiled, ready project asset into an immutable owner-owned version. */
54
- async saveProjectAsset(owner,{definition,manifest,bytes}) {
55
- const source=SceneObjectForge.validateTransfer({objects:[{id:'source',assetId:manifest.id}]},
56
- [{id:'source',assetId:manifest.id,revision:1,definition}])[0].definition;
57
- if(!(bytes instanceof Uint8Array)||!bytes.length||bytes.length>4194304)throw new Error('ASSET_STORAGE_QUOTA');
58
- const admission=assetAdmission(manifest);
59
- if(admission.status!=='ready')throw new Error('ASSET_NOT_READY');
60
- const template=JSON.parse(JSON.stringify(manifest));
61
- delete template.id;delete template.source;
62
- const version=projectVersion(source,template,bytes),assetId='pa_'+version;
63
- const publishedManifest={...template,id:assetId,source:{kind:'compiled',key:assetId}};
64
- validateAssetManifest(publishedManifest);
65
- const sourceText=JSON.stringify(source),manifestJSON=JSON.stringify(publishedManifest);
66
- const hashes={source:hash(sourceText),definition:hash(canonical(source)),glb:hash(bytes),manifest:hash(manifestJSON)};
67
- const build={schema:projectContract,assetId,logicalId:source.type||source.definition?.id||source.id||'project-asset',
68
- version,owner:hash(owner),definition:source,compilerDefinition:template,
69
- environment:{threeVersion:'0.186.0'},hashes,admission,
70
- validation:{status:'compiled-and-admitted',runtimeActionVerification:'not-run'},
71
- security:{scope:'owner',sourceKind:'editable-definition',executedDuringPublish:false},
72
- createdAt:new Date().toISOString()};
73
- if(Buffer.byteLength(JSON.stringify(build))>1048576 || Buffer.byteLength(manifestJSON)>262144)throw new Error('BUILD_METADATA_LIMIT');
74
- const target=this.target(owner,'assets',assetId);
75
- try{
76
- const existing=await this.get(owner,assetId);
77
- if(existing.build.hashes.glb!==hashes.glb)throw new Error('BUILD_NONDETERMINISTIC');
78
- return existing;
79
- }catch(error){if(error.code!=='ENOENT')throw error;}
80
- if((await this.ids(owner,'assets')).length>=128)throw new Error('ASSET_STORAGE_QUOTA');
81
- await mkdir(path.dirname(target),{recursive:true});
82
- const staging=path.join(path.dirname(target),'.tmp-'+randomUUID());
83
- try{
84
- await mkdir(staging);
85
- await writeFile(path.join(staging,'source.json'),sourceText);
86
- await writeFile(path.join(staging,'asset.glb'),bytes);
87
- await writeFile(path.join(staging,'manifest.json'),manifestJSON);
88
- await writeFile(path.join(staging,'build.json'),JSON.stringify(build));
89
- if(hash(await this.read(path.join(staging,'asset.glb')))!==hashes.glb)throw new Error('STORAGE_INTEGRITY_FAILED');
90
- try{await rename(staging,target);}
91
- catch(error){
92
- if(!['EEXIST','ENOTEMPTY','EPERM'].includes(error.code))throw error;
93
- const previous=await this.get(owner,assetId);
94
- if(previous.build.hashes.glb!==hashes.glb)throw new Error('BUILD_NONDETERMINISTIC');
95
- }
96
- }finally{await rm(staging,{recursive:true,force:true});}
97
- return this.get(owner,assetId);
98
- }
99
- async get(owner,assetId,{published=false}={}) {
100
- const directory=this.target(owner,'assets',assetId);
101
- const build=await this.json(path.join(directory,'build.json'));
102
- const [source,bytes,manifestBytes]=await Promise.all([
103
- this.read(path.join(directory,build.schema===projectContract?'source.json':'source.js'),131072),
104
- this.read(path.join(directory,'asset.glb')),this.read(path.join(directory,'manifest.json'),262144)
105
- ]);
106
- const isProject=build.schema===projectContract;
107
- const validVersion=isProject
108
- ? projectVersion(build.definition,build.compilerDefinition,bytes)===build.version
109
- && source.toString('utf8')===JSON.stringify(build.definition)
110
- : build.schema===proceduralContract
111
- && assetVersion(source.toString('utf8'),(build.definition==null?null:parseDefinition(build.definition)),build.environment)===build.version;
112
- if(build.owner!==hash(owner)||build.assetId!==assetId||build.environment?.threeVersion!=='0.186.0'
113
- ||!validVersion||assetId!==('pa_'+build.version)
114
- ||hash(source)!==build.hashes.source||hash(canonical(build.definition))!==build.hashes.definition
115
- ||hash(bytes)!==build.hashes.glb||hash(manifestBytes)!==build.hashes.manifest)throw new Error('STORAGE_INTEGRITY_FAILED');
116
- const manifest=JSON.parse(manifestBytes.toString('utf8'));validateAssetManifest(manifest);
117
- if(manifest.id!==assetId||manifest.source.kind!=='compiled'||manifest.source.key!==assetId||manifest.source.fallbackUrl)throw new Error('STORAGE_INTEGRITY_FAILED');
118
- if(isProject && canonical((({id,source,...rest})=>rest)(manifest))!==canonical(build.compilerDefinition))throw new Error('STORAGE_INTEGRITY_FAILED');
119
- let isPublished=false;try{const marker=await this.json(path.join(directory,'published.json'));if(marker.assetId!==assetId||marker.owner!==hash(owner))throw new Error('STORAGE_INTEGRITY_FAILED');isPublished=true;}catch(e){if(e.code!=='ENOENT')throw e;}
120
- if(published&&!isPublished)throw new Error('ASSET_NOT_PUBLISHED');
121
- return {build,manifest,source:source.toString('utf8'),bytes,published:isPublished};
122
- }
123
- async publish(owner,assetId) {const asset=await this.get(owner,assetId);await this.atomic(path.join(this.target(owner,'assets',assetId),'published.json'),{assetId,owner:hash(owner)});return asset;}
124
- async list(owner) {
125
- const result=[];for(const id of await this.ids(owner,'assets')){const asset=await this.get(owner,id);if(asset.published)result.push({assetId:id,logicalId:asset.build.logicalId,version:asset.build.version,label:asset.manifest.label,admission:asset.build.admission});}return result;
126
- }
127
- compiledStore(owner) {
128
- const memory=new Map();return {
129
- put:async(key,bytes,metadata)=>{if(assetPattern.test(key))throw new Error('ASSET_VERSION_IMMUTABLE');memory.set(key,{bytes,metadata});return key;},
130
- get:async key=>assetPattern.test(key)?{bytes:(await this.get(owner,key,{published:true})).bytes}:memory.get(key),
131
- has:async key=>assetPattern.test(key)?Boolean(await this.get(owner,key,{published:true})):memory.has(key)
132
- };
133
- }
134
- async attach(owner,assets,ids=null) {
135
- for(const assetId of ids || (await this.list(owner)).map(a=>a.assetId)){const asset=await this.get(owner,assetId,{published:true});await assets.registerManifest(asset.manifest);}
136
- }
137
- async saveWorld(owner,snapshot) {
138
- if((await this.ids(owner,'worlds')).length>=128)throw new Error('WORLD_STORAGE_QUOTA');
139
- const dependencies=[];
140
- for(const assetId of new Set(snapshot.objects.map(o=>o.assetId))){
141
- if(assetPattern.test(assetId)){const a=await this.get(owner,assetId,{published:true});dependencies.push({assetId,manifestHash:a.build.hashes.manifest});}
142
- else if(!['agent','cabinet','cup','table'].includes(assetId))throw new Error('WORLD_ASSET_NOT_PUBLISHED');
143
- }
144
- const saveId=randomUUID(),snapshotText=JSON.stringify(snapshot);
145
- if(Buffer.byteLength(snapshotText)>4194304)throw new Error('EXPORT_LIMIT');
146
- const record={schema:'agentscape.saved-world.v1',owner:hash(owner),hash:hash(snapshotText),snapshot,dependencies,createdAt:new Date().toISOString()};
147
- if(Buffer.byteLength(JSON.stringify(record))>4194304)throw new Error('EXPORT_LIMIT');
148
- await this.atomic(this.target(owner,'worlds',saveId),record);
149
- return {saveId,dependencies,objects:snapshot.objects.length};
150
- }
151
- async loadWorld(owner,saveId) {
152
- const data=await this.json(this.target(owner,'worlds',saveId));
153
- if(data.schema!=='agentscape.saved-world.v1'||data.owner!==hash(owner)||hash(JSON.stringify(data.snapshot))!==data.hash)throw new Error('STORAGE_INTEGRITY_FAILED');
154
- for(const dependency of data.dependencies){const asset=await this.get(owner,dependency.assetId,{published:true});if(asset.build.hashes.manifest!==dependency.manifestHash)throw new Error('STORAGE_INTEGRITY_FAILED');}
155
- const resolved=new Set(data.dependencies.map(d=>d.assetId));
156
- if(data.snapshot.objects.some(o=>assetPattern.test(o.assetId)&&!resolved.has(o.assetId)))throw new Error('STORAGE_INTEGRITY_FAILED');
157
- return data;
158
- }
159
- }
@@ -1,8 +0,0 @@
1
- // Node has Blob but no FileReader; GLTFExporter needs these two asynchronous reads.
2
- export function installHeadlessAssetIO() {
3
- globalThis.ProgressEvent ||= class ProgressEvent { constructor(type,init={}) { this.type=type; Object.assign(this,init); } };
4
- globalThis.FileReader ||= class FileReader {
5
- readAsArrayBuffer(blob) { blob.arrayBuffer().then(result=>{this.result=result;this.onloadend?.();},error=>{this.error=error;this.onerror?.(error);}); }
6
- readAsDataURL(blob) { blob.arrayBuffer().then(bytes=>{this.result=`data:${blob.type};base64,${Buffer.from(bytes).toString('base64')}`;this.onloadend?.();},error=>{this.error=error;this.onerror?.(error);}); }
7
- };
8
- }
@@ -1,47 +0,0 @@
1
- import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
2
- import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
3
- import { DataTexture, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, LinearFilter, NearestMipmapNearestFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter } from 'three';
4
- import sharp from 'sharp';
5
-
6
- const filters={9728:NearestFilter,9729:LinearFilter,9984:NearestMipmapNearestFilter,9985:LinearMipmapNearestFilter,9986:NearestMipmapLinearFilter,9987:LinearMipmapLinearFilter};
7
- const wrapping={33071:ClampToEdgeWrapping,33648:MirroredRepeatWrapping,10497:RepeatWrapping};
8
- // Headless GLTFLoader cannot use DOM Image/ImageBitmap. Decode trusted embedded bytes
9
- // to real DataTextures; never drop a missing texture or fetch an external URI.
10
- export function createHeadlessGLTFLoader() {
11
- const loader=new GLTFLoader().setMeshoptDecoder(MeshoptDecoder).register(parser=>({
12
- name:'AGENTSCAPE_headless_texture',
13
- async loadTexture(index) {
14
- const definition=parser.json.textures[index];
15
- const source=parser.json.images?.[definition.source];
16
- if (!Number.isInteger(source?.bufferView) || source.uri) throw new Error('AUTHORING_EXTERNAL_TEXTURE_UNSUPPORTED');
17
- const bytes=await parser.getDependency('bufferView',source.bufferView);
18
- const {data,info}=await sharp(Buffer.from(bytes),{limitInputPixels:65536}).ensureAlpha().raw().toBuffer({resolveWithObject:true});
19
- const texture=new DataTexture(new Uint8Array(data),info.width,info.height);
20
- const sampler=parser.json.samplers?.[definition.sampler] || {};
21
- texture.magFilter=filters[sampler.magFilter] || LinearFilter;
22
- texture.minFilter=filters[sampler.minFilter] || LinearMipmapLinearFilter;
23
- texture.wrapS=wrapping[sampler.wrapS] || RepeatWrapping;
24
- texture.wrapT=wrapping[sampler.wrapT] || RepeatWrapping;
25
- texture.flipY=false;
26
- texture.name=definition.name || source.name || '';
27
- texture.needsUpdate=true;
28
- parser.associations.set(texture,{textures:index});
29
- return texture;
30
- }
31
- }));
32
- return {
33
- async loadBytes(bytes) {
34
- const buffer=bytes.buffer.slice(bytes.byteOffset,bytes.byteOffset+bytes.byteLength);
35
- const gltf=await loader.parseAsync(buffer,'');
36
- if(!gltf.scene)throw new Error('ASSET_SCENE_MISSING');
37
- gltf.scene.animations=[...(gltf.animations || [])];
38
- return gltf.scene;
39
- },
40
- async loadScene(url) {
41
- const gltf=await loader.loadAsync(url);
42
- if(!gltf.scene) throw new Error('ASSET_SCENE_MISSING');
43
- gltf.scene.animations=[...(gltf.animations || [])];
44
- return gltf.scene;
45
- }
46
- };
47
- }
@@ -1,132 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { setImmediate as yieldLoop } from 'node:timers/promises';
3
- import { createSession } from '../../application/createSession.js';
4
- import { AgentTools } from '../../application/AgentTools.js';
5
- import { createAssetModule } from '../../modules/asset/AssetModule.js';
6
- import { assetManifests } from '../../modules/asset/registry/manifests/index.js';
7
- import { createMonumentHall } from '../../modules/world/content/monumentHall.js';
8
- import { WorldBuilder } from '../../modules/world/build/WorldBuilder.js';
9
- import { createCodeExecutor } from './CodeExecutor.js';
10
- import { installHeadlessAssetIO } from './HeadlessAssetIO.js';
11
- import { createHeadlessGLTFLoader } from './HeadlessGLTFLoader.js';
12
- export const authoringSkills = ['runAuthoringCode','listAuthoringNodes','prepareAuthoringAsset','promoteAuthoringNode','updateAuthoringEntity','verifyAuthoringEntity'];
13
- export const allowedSkills = ['spawnAsset','moveObject','approachAndInteract','approachAndPickup','approachAndPlace','navigateTo','replaceAsset'];
14
- export const criteria = [
15
- {id:'valid',kind:'world-valid'},
16
- {id:'open',kind:'interaction-verified',targetId:'cabinet_01',capability:'OPEN'},
17
- {id:'pickup',kind:'interaction-verified',targetId:'cup_01',capability:'PICKUP'},
18
- {id:'place',kind:'interaction-verified',targetId:'table_01',capability:'PLACE'},
19
- {id:'support',kind:'relation-exists',subject:'cup_01',predicate:'ON',object:'table_01',surfaceId:'top'},
20
- {id:'unresolved',kind:'no-unresolved'}
21
- ];
22
- export class HeadlessWorldHost {
23
- static async create(options = {}) {
24
- installHeadlessAssetIO();
25
- const manifests=structuredClone(assetManifests);
26
- const bytes=await readFile(new URL('../../public/assets/cabinet.glb',import.meta.url));
27
- manifests.cabinet.source={kind:'glb',url:`data:model/gltf-binary;base64,${bytes.toString('base64')}`};
28
- // Start with trusted template assets; later assets are compiled within this session.
29
- const local=Object.fromEntries(['agent','cabinet','cup','table'].map(id=>[id,manifests[id]]));
30
- const executor=options.executorFactory ? options.executorFactory() : createCodeExecutor({...options.codeExecution,configPath:options.sandboxConfig || 'D:/AgentScapeData/mcp-assets/sandbox.json'});
31
- const session=createSession(null,{codeExecutor:executor,codeGLTFLoader:createHeadlessGLTFLoader(),authoringOptions:{executeCode:request=>executor.execute(request)},assetModule:createAssetModule({manifests:local,compiledStore:options.repository?.compiledStore(options.owner),manifestStore:null,libraryStore:null,gltfLoader:createHeadlessGLTFLoader()}),environmentFactory:o=>createMonumentHall({...o,loadAssets:false})});
32
- const {world}=session;
33
- const host=new HeadlessWorldHost(world,{...options,session,executor});
34
- try { if(options.repository&&options.assetIds?.length)await options.repository.attach(options.owner,world.assetModule,options.assetIds);await world.init(); await host.prepare(); return host; }
35
- catch(error) { host.close(); throw error; }
36
- }
37
- constructor(world,{maxSteps=12000,timeoutMs=30000,maxObjects=64,session,executor}={}) {
38
- this.world=world; this.maxSteps=maxSteps; this.timeoutMs=timeoutMs; this.maxObjects=maxObjects;
39
- this.session=session; this.executor=executor;
40
- this.authoringSources=[];
41
- world.policy.profiles.set('remote',new Set(['world.read','world.write','spatial.read','physics.read','asset.read','asset.write']));
42
- this.actionCount=0; this.unresolved=new Map();
43
- world.lastTaskObservation={unresolvedMutations:[]};
44
- this.tools=new AgentTools(world,{profile:'remote',actor:'agent_01',source:'remote-mcp'});
45
- }
46
- async prepare() {
47
- const ir={schema:'agentscape.world-ir',schemaVersion:1,revision:{id:'remote-monument-r1',reason:'trusted offline template'},provenance:{source:'remote-mcp',createdBy:'AgentScape',evidenceRefs:[]},intent:{name:'Remote Monument Hall',description:'Open cabinet, pick up cup, place on table'},policy:{generation:{generate:false},physics:{fallbackPolicy:'deny'}},entities:[
48
- {id:'agent_01',asset:{assetId:'agent'},transform:{position:[0,0,9]},capabilityIntent:[],initialState:{}},
49
- {id:'cabinet_01',asset:{assetId:'cabinet'},transform:{position:[-5.2,0,3.9]},capabilityIntent:['OPEN'],initialState:{}},
50
- {id:'cup_01',asset:{assetId:'cup'},capabilityIntent:['PICKUP'],initialState:{}},
51
- {id:'table_01',asset:{assetId:'table'},transform:{position:[5.2,0,4.2]},capabilityIntent:[],initialState:{}}
52
- ],spatial:{relations:[{subject:'cup_01',predicate:'INSIDE',object:'cabinet_01',receptacleId:'interior'}],constraints:[]},interactions:[],rules:[],acceptance:[]};
53
- const result=await new WorldBuilder(this.world).run(ir);
54
- if(result.pipeline.state.reports.worldAdmission.status==='rejected') throw new Error('TEMPLATE_REJECTED');
55
- }
56
- async execute(skill,args,signal) {
57
- if(this.closed) throw new Error('HOST_CLOSED');
58
- if(signal?.aborted)throw new Error('ACTION_CANCELLED');
59
- if(![...allowedSkills,...authoringSkills].includes(skill)) throw new Error('SKILL_FORBIDDEN');
60
- if(++this.actionCount>256) throw new Error('ACTION_BUDGET_EXHAUSTED');
61
- if(['spawnAsset','promoteAuthoringNode'].includes(skill) && this.world.store.list().length>=this.maxObjects) throw new Error('OBJECT_LIMIT');
62
- if(['prepareAuthoringAsset','promoteAuthoringNode','updateAuthoringEntity'].includes(skill) && this.world.assetModule.registry.size>=32) throw new Error('ASSET_LIMIT');
63
- if (skill==='runAuthoringCode' && this.authoringSources.reduce((n,s)=>n+s.code.length,0)+args.code.length>262144) throw new Error('AUTHORING_SOURCE_LIMIT');
64
- if (authoringSkills.includes(skill)) {
65
- if (signal?.aborted) throw new Error('ACTION_CANCELLED');
66
- const cancel=()=>this.executor?.close();
67
- signal?.addEventListener('abort',cancel,{once:true});
68
- try {
69
- const result=await this.tools.call(skill,args);
70
- if (skill==='runAuthoringCode' && result.status==='authoring-code-applied') this.authoringSources.push({code:args.code,label:args.label,revision:result.revision});
71
- // Authored asset admission and behavior evidence remain distinct from transport success.
72
- return {state:this.tools.executionPolicy(skill,result).outcome.state,result,tick:this.world.simulation.tick};
73
- } finally { signal?.removeEventListener('abort',cancel); }
74
- }
75
- let done=false,result,error;
76
- const pending=this.scene.executeSkill(skill,args).then(v=>{done=true;result=v;},e=>{done=true;error=e;});
77
- // 资源替换是异步结构事务,不需要推进物理帧;避免回滚时并发更新 World。
78
- if(skill==='replaceAsset') await pending;
79
- const start=performance.now();
80
- let steps=0;
81
- let termination=null,cleanupSteps=0;
82
- while(!done) {
83
- if(signal?.aborted || steps>=this.maxSteps || performance.now()-start>this.timeoutMs) termination ||= signal?.aborted?'ACTION_CANCELLED':'ACTION_TIMEOUT';
84
- if(termination) {
85
- this.world.interactions.cancelPending('REMOTE_CANCELLED'); this.world.locomotion.cancelAll('REMOTE_CANCELLED');
86
- this.executor?.close();
87
- if(++cleanupSteps>240) { this.close(); break; }
88
- }
89
- this.world.simulation.step(); steps++;
90
- if(steps%12===0) await yieldLoop(); else await Promise.resolve();
91
- }
92
- if(termination) {
93
- this.unresolved.set(JSON.stringify([skill,args]),{tool:skill,args,state:'failed',reason:termination});
94
- this.world.lastTaskObservation={unresolvedMutations:[...this.unresolved.values()]};
95
- throw new Error(termination);
96
- }
97
- const outcome=error?{state:'failed'}:this.tools.executionPolicy(skill,result).outcome;
98
- const key=JSON.stringify([skill,args]);
99
- if(outcome.state==='verified') this.unresolved.delete(key); else this.unresolved.set(key,{tool:skill,args,state:outcome.state});
100
- this.world.lastTaskObservation={unresolvedMutations:[...this.unresolved.values()]};
101
- if(error) throw error;
102
- return {state:outcome.state,result,steps,tick:this.world.simulation.tick};
103
- }
104
- observe(offset=0,limit=25) {
105
- const ids=this.scene.observe().objects.map(object=>object.id),page=ids.slice(offset,offset+limit);
106
- return {environmentId:this.world.environment.id,tick:this.world.simulation.tick,objects:page.map(id=>this.world.queries.getObjectInfo(id)),agent:this.world.observation.actor('agent_01'),relations:this.world.observation.relations(page,{limit:100}),total:ids.length,nextOffset:offset+limit<ids.length?offset+limit:null};
107
- }
108
- inspect(id) { if(!this.world.queries.hasObject(id)) throw new Error('OBJECT_NOT_FOUND'); return {object:this.world.queries.getObjectInfo(id),articulation:this.world.observation.articulation(id),relations:this.world.observation.relations([id],{limit:100})}; }
109
- async verify(checks=criteria) {
110
- const evidence=await this.scene.executeSkill('evaluateWorldAcceptance',{criteria:checks});
111
- const carry=this.world.queries.carryStatus('agent_01');
112
- return {state:evidence.status==='world-accepted' && (checks!==criteria || carry.status==='empty')?'verified':'unverified',evidence,carry};
113
- }
114
- close() { if(!this.closed) {this.closed=true; this.executor?.close(); this.session?.promotion?.dispose(); this.session?.authoring?.dispose(); this.world.dispose();} }
115
- get scene() { if(this.closed) throw new Error('HOST_CLOSED'); return this.session.scene; }
116
- startSceneInteraction(input) {
117
- const job=this.scene.interact(input);
118
- this.pumpSceneJob(job.id).catch(()=>this.close());
119
- return job;
120
- }
121
- async pumpSceneJob(id) {
122
- const start=performance.now(); let steps=0,cleanup=0;
123
- while(!this.closed && this.scene.getJob(id).status==='running') {
124
- if(steps>=this.maxSteps || performance.now()-start>this.timeoutMs) {
125
- this.scene.cancelJob(id);
126
- if(++cleanup>240) { this.close(); return; }
127
- }
128
- this.scene.step(); steps++;
129
- if(steps%12===0) await yieldLoop(); else await Promise.resolve();
130
- }
131
- }
132
- }
@@ -1,6 +0,0 @@
1
- import { createCodeExecutor } from './CodeExecutor.js';
2
-
3
- // Compatibility name; WASM/Worker isolation is not OS isolation.
4
- export function createIsolatedAuthoringExecutor(options = {}) {
5
- return createCodeExecutor({ ...options, mode: 'worker-wasm' });
6
- }