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,229 +0,0 @@
1
- import { recordInteractionEvidence } from '../../modules/world/verification/InteractionEvidence.js';
2
- import { sceneError, sceneInteractionSchema, diagnostic } from './SceneContracts.js';
3
- import { resolveCapability } from './CapabilityResolver.js';
4
- import { legacyPhysicalRequest } from './SceneInteractionAdapters.js';
5
- import { verifyInteractionResult } from '../../modules/world/runtime/interaction/InteractionContract.js';
6
-
7
- /** Manages asynchronous Scene actions through one cancellable Job lifecycle. */
8
- export function createSceneJobController(world, { tools, assertIdle, assertOpen, setBusy, actors, onProjectAction = () => {}, result }) {
9
- const jobs = new Map();
10
- // Historical Scene commands remain supported; capability invocation is
11
- // dispatched by executor, with arbitrary articulated names read from manifests.
12
- const physicalActions = new Set(['push', 'drag', 'rotate', 'slide', 'rotateJoint']);
13
- const cancelPending = () => {
14
- if ([...jobs.values()].some(job => job.status === 'running' && job.cancelled && !job.controller)) {
15
- world.interactions.cancelPending('SCENE_CANCELLED');
16
- world.locomotion.cancelAll('SCENE_CANCELLED');
17
- world.affordances.cancel('SCENE_CANCELLED');
18
- }
19
- };
20
-
21
- const controller = {
22
- interact(input) {
23
- const args = sceneInteractionSchema.parse(input);
24
- assertIdle();
25
- if (args.action === 'custom') return startProjectAction(args);
26
- if (args.action === 'invoke') return startInvocation(args);
27
- return startLegacyAction(args);
28
- },
29
- getJob(key) {
30
- assertOpen();
31
- const job = getJob(key);
32
- return structuredClone({ id: job.id, status: job.status, result: job.result });
33
- },
34
- async waitJob(key) {
35
- assertOpen();
36
- const job = getJob(key);
37
- await job.promise;
38
- return controller.getJob(key);
39
- },
40
- cancelJob(key) {
41
- assertOpen();
42
- const job = getJob(key);
43
- if (job.status === 'running') {
44
- job.cancelled = true;
45
- job.controller?.abort();
46
- if (!job.controller) cancelPending();
47
- }
48
- return { id: job.id, status: job.status, cancellationRequested: Boolean(job.cancelled) };
49
- }
50
- };
51
-
52
- // The historical intent-based API continues to use its existing runtime
53
- // commands, actor checks, policy and verification semantics unchanged.
54
- function startLegacyAction(args) {
55
- const nativeAction = args.action === 'activate';
56
- if (nativeAction && !actors().agents.some(agent => agent.id === args.actor)) throw sceneError('ACTOR_NOT_AGENT');
57
- if (nativeAction && !world.environment?.interactions?.some(item =>
58
- item.id === args.target && typeof item.activate === 'function')) throw sceneError('INTERACTION_UNAVAILABLE');
59
- const contract = 'target' in args ? world.affordances?.get?.(args.target) : null;
60
- const worldAction = Boolean(contract) && !nativeAction;
61
- if (worldAction && !contract.actions.includes(args.action)) throw sceneError('ACTION_UNSUPPORTED');
62
- if (!contract && ['turn_on', 'turn_off', 'pull_out', 'return', 'write'].includes(args.action)) throw sceneError('ACTION_UNSUPPORTED');
63
-
64
- const [skill, params] = args.action === 'navigate' ? ['navigateTo', { id:args.actor, end:args.position }]
65
- : args.action === 'pickup' ? ['approachAndPickup', { actorId:args.actor, targetId:args.target }]
66
- : args.action === 'place' ? ['approachAndPlace', { actorId:args.actor, supportId:args.target, surfaceId:args.surfaceId }]
67
- : ['approachAndInteract', { actorId:args.actor, targetId:args.target, action:args.action, partName:args.partName }];
68
- const physical = physicalActions.has(args.action);
69
-
70
- return startJob({
71
- immediate: true, // Keep legacy tools.call synchronous for existing integrations.
72
- execute: job => nativeAction ? world.mutate('scene:native-activate', () =>
73
- world.commands.activateEnvironmentInteraction(args.target, { actorId:args.actor, requireReach:true }))
74
- : worldAction ? world.mutate('scene:world-action:' + args.action, () =>
75
- world.commands.executeAffordance({
76
- targetId:args.target, actorId:args.actor, action:args.action, args:args.args || {}
77
- }, { approach:true }))
78
- : physical ? world.mutate('scene:' + args.action, async () => {
79
- const value = await world.interactions.manipulate(args.actor, args.target, args.action, args.args);
80
- recordInteractionEvidence(world, {
81
- targetId:args.target, capability:args.action.toUpperCase(), verified:value.verified,
82
- source:'scene-api', commandId:job.id, result:value
83
- });
84
- return value;
85
- }) : tools.call(skill, params),
86
- settle: (value, job) => {
87
- const activated = nativeAction && value.status === 'environment-interaction-activated';
88
- const outcome = nativeAction
89
- ? { state:value.verified === true ? 'verified' : activated ? 'unverified' : 'failed', verified:value.verified === true, physicsVerified:false }
90
- : worldAction
91
- ? { state:value.status === 'world-action-completed' && value.verified === true ? 'verified' : 'failed', verified:value.status === 'world-action-completed' && value.verified === true, physicsVerified:false }
92
- : physical ? { state:value.verified ? 'verified' : 'failed', verified:value.verified === true }
93
- : tools.executionPolicy(skill, value).outcome;
94
- return {
95
- status:outcome.verified || activated ? 'succeeded' : 'failed',
96
- verification:{ status:!job.cancelled && outcome.verified ? 'verified' : 'unverified', evidence:value },
97
- outcome
98
- };
99
- }
100
- });
101
- }
102
-
103
- // Each capability declares an executor; only the legacy adapter translates
104
- // historical action names. New Code Project, environment and joint names
105
- // never need a new branch in the Scene dispatcher.
106
- const invocationExecutors = new Map([
107
- ['project-action', request => startProjectAction(request)],
108
- ['world-action', request => {
109
- if (!request.actor) throw sceneError('ACTOR_REQUIRED');
110
- return startRuntimeCapability({ ...request, source:'environment' }, () =>
111
- world.commands.executeAffordance({
112
- targetId:request.target, actorId:request.actor, action:request.name, args:request.args
113
- }, { approach:true }),
114
- value => value?.status === 'world-action-completed' && value.verified === true);
115
- }],
116
- ['interaction', (request, capability) => startPhysicalCapability(request, capability)]
117
- ]);
118
-
119
- function startInvocation(request) {
120
- const { capability } = resolveCapability(world, request);
121
- const executor = invocationExecutors.get(capability.executor);
122
- if (!executor) throw sceneError('ACTION_EXECUTOR_UNAVAILABLE');
123
- return executor(request, capability);
124
- }
125
-
126
- function startPhysicalCapability(request, capability) {
127
- const { target, name, actor, args = {} } = request;
128
- if (!actor) throw sceneError('ACTOR_REQUIRED');
129
- const record = world.store.get(target);
130
- // Contract membership, not the verb, identifies a physically articulated
131
- // action. This includes open/close and previously unknown semantic verbs.
132
- const contract = capability.partName && world.interactions.interactionContracts(record).contracts.find(item =>
133
- item.action === name && item.target.partName === capability.partName);
134
- if (!contract) return controller.interact(legacyPhysicalRequest(request));
135
- if (Object.keys(args).length) throw sceneError('ACTION_ARGUMENTS_UNSUPPORTED');
136
- return startRuntimeCapability({ ...request, source:'asset' }, async () => {
137
- const value = await world.commands.approachAndInteract(actor, target, name, { partName:capability.partName });
138
- const verified = verifyInteractionResult(contract, { ...value, part:value.partName }).verified;
139
- return { ...value, verified, physicsVerified:verified, evidenceKind:'joint-motor' };
140
- }, value => value?.verified === true);
141
- }
142
-
143
- function startRuntimeCapability({ target, name, source }, execute, verify) {
144
- return startJob({
145
- execute: () => world.mutate('scene:invoke:' + name, execute),
146
- settle: (value, job) => {
147
- const verified = !job.cancelled && verify(value) === true;
148
- if (verified) recordInteractionEvidence(world, {
149
- targetId:target, capability:name.toUpperCase(), verified:true,
150
- source: source === 'asset' ? 'physical-articulation' : 'environment',
151
- commandId:job.id, result:value
152
- });
153
- return {
154
- status:verified ? 'succeeded' : 'failed',
155
- verification:{ status:verified ? 'verified' : 'unverified', evidence:value },
156
- outcome:{ state:verified ? 'verified' : 'failed', verified,
157
- physicsVerified:source === 'asset' && verified && value.physicsVerified === true }
158
- };
159
- }
160
- });
161
- }
162
-
163
- function startProjectAction(args) {
164
- return startJob({
165
- abortable:true,
166
- timeoutMs:world.projectCapabilities.timeoutFor(args.target, args.name),
167
- execute:job => world.projectCapabilities.execute(args, { signal:job.controller.signal }),
168
- settle:(value, job) => {
169
- const verified = !job.cancelled && value.verified;
170
- if (verified) recordInteractionEvidence(world, {
171
- targetId:args.target, capability:args.name.toUpperCase(), verified:true,
172
- source:'project-defined', commandId:job.id, result:value
173
- });
174
- onProjectAction();
175
- return {
176
- status:'succeeded',
177
- verification:{ status:verified ? 'verified' : 'unverified', evidence:value.evidence },
178
- outcome:{ state:job.cancelled ? 'unverified' : verified ? 'verified' : value.verificationRequested ? 'unverified' : 'accepted',
179
- verified, physicsVerified:false }
180
- };
181
- }
182
- });
183
- }
184
-
185
- function startJob({ execute, settle, timeoutMs = 60_000, abortable = false, immediate = false }) {
186
- if (jobs.size >= 128) {
187
- const terminal = [...jobs].find(([, item]) => item.status !== 'running');
188
- if (terminal) jobs.delete(terminal[0]);
189
- else throw sceneError('JOB_LIMIT');
190
- }
191
- const job = { id:'job_' + crypto.randomUUID(), status:'running', result:null };
192
- if (abortable) job.controller = new AbortController();
193
- jobs.set(job.id, job);
194
- setBusy(true);
195
- let pending;
196
- try {
197
- pending = immediate ? Promise.resolve(execute(job)) : Promise.resolve().then(() => execute(job));
198
- } catch (error) {
199
- pending = Promise.reject(error);
200
- }
201
- job.promise = pending.then(value => {
202
- const completion = settle(value, job);
203
- job.status = job.cancelled ? 'cancelled' : completion.status;
204
- job.result = result('interact', value, { ...completion, status:job.status });
205
- }).catch(error => {
206
- job.status = job.cancelled ? 'cancelled' : 'failed';
207
- job.result = result('interact', null, {
208
- status:job.status,
209
- ...(abortable ? { verification:{ status:'unverified', evidence:null } } : {}),
210
- diagnostics:[diagnostic(error)]
211
- });
212
- }).finally(() => {
213
- clearTimeout(job.timer);
214
- setBusy(false);
215
- });
216
- if (timeoutMs != null) {
217
- job.timer = setTimeout(() => controller.cancelJob(job.id), timeoutMs);
218
- job.timer.unref?.();
219
- }
220
- return { id:job.id, status:job.status };
221
- }
222
-
223
- function getJob(key) {
224
- const job = jobs.get(key);
225
- if (!job) throw sceneError('JOB_NOT_FOUND');
226
- return job;
227
- }
228
- return { ...controller, cancelPending };
229
- }
@@ -1,162 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { parseSceneProject } from './SceneProject.js';
3
- import { assetDigest, canonicalAssetJson, assertEmbeddedGLB } from '../../modules/asset/model/AssetInputContracts.js';
4
- import { assetManifests } from '../../modules/asset/registry/manifests/index.js';
5
- import { createAssetModule } from '../../modules/asset/AssetModule.js';
6
- import { stylePackSchema } from '../../modules/rendering/style/StylePack.js';
7
- import { RUNTIME_VERSION } from '../../foundation/version.js';
8
- import { ArticulationVerifier } from '../../modules/world/verification/ArticulationVerifier.js';
9
- import { SceneObjectForge } from '../object-forge/SceneObjectForge.js';
10
-
11
- const hash = z.string().regex(/^[a-f0-9]{64}$/);
12
- const descriptor = z.object({ id: z.string().min(1).max(100), sha256: hash, bytes: z.string().max(45 * 1024 * 1024), definition: z.record(z.string(), z.unknown()) }).strict();
13
- const schema = z.object({ schema: z.literal('agentscape.project-bundle'), schemaVersion: z.literal(1),
14
- project: z.unknown(), snapshot: z.unknown(),
15
- lock: z.object({ engine: z.enum(['1.34.2', RUNTIME_VERSION]), builtins: hash, content: hash }).strict(),
16
- assets: z.array(descriptor).max(32),
17
- editable: z.array(z.object({id:z.string(),assetId:z.string(),revision:z.number().int(),definition:z.unknown(),originAssetId:z.string().optional()}).strict()).max(64).optional(),
18
- style: stylePackSchema.optional()
19
- }).strict();
20
- const builtinHash = () => assetDigest(new TextEncoder().encode(canonicalAssetJson(assetManifests)));
21
- const encode = bytes => { let text = ''; for (let i = 0; i < bytes.length; i += 8192) text += String.fromCharCode(...bytes.subarray(i, i + 8192)); return btoa(text); };
22
- const decode = text => {
23
- if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(text)) throw new Error('INVALID_RESOURCE_ENCODING');
24
- return Uint8Array.from(atob(text), c => c.charCodeAt(0));
25
- };
26
- const digestContent = value => assetDigest(new TextEncoder().encode(canonicalAssetJson(value)));
27
- const definitionOf = manifest => Object.fromEntries(['type', 'label', 'actions', 'physics', 'parts', 'surfaces', 'receptacles', 'requiredNodes', 'interactionContract', 'capabilityLevel'].filter(key => manifest[key] != null).map(key => [key, structuredClone(manifest[key])]));
28
-
29
- /** JSON transport for scene.json, lock, runtime snapshot and embedded resources.
30
- * Directory/ZIP adapters can encode these same bytes without executing sources.
31
- */
32
- export async function exportRuntimeState(world, { name = 'Untitled World', readResource = null } = {}) {
33
- if (world.mutationOwner) throw new Error('SCENE_BUSY');
34
- const snapshot = world.serialize({ name }), assets = [], assetAliases = {};
35
- let total = 0;
36
- for (const manifest of snapshot.assets) {
37
- let bytes;
38
- if (manifest.source.kind === 'compiled') bytes = (await world.assetModule.compiledStore.get(manifest.source.key))?.bytes;
39
- else if (readResource) bytes = await readResource(manifest.source.url, manifest.id);
40
- else if (manifest.source.kind === 'glb') bytes = await world.assetModule.readAssetBytes(manifest.id);
41
- if (!(bytes instanceof Uint8Array)) throw new Error('RESOURCE_UNAVAILABLE');
42
- bytes = bytes.slice(); assertEmbeddedGLB(bytes);
43
- total += bytes.length; if (total > 64 * 1024 * 1024) throw new Error('RESOURCE_LIMIT');
44
- const sha256=await assetDigest(bytes),definition=definitionOf(manifest);
45
- // Portable bundles own the compiled bytes; never write into immutable owner-global pa_ storage.
46
- const portableId=/^pa_[a-f0-9]{64}$/.test(manifest.id)
47
- ? 'asset_'+await assetDigest(new TextEncoder().encode(canonicalAssetJson({globalId:manifest.id,sha256,definition})))
48
- : manifest.id;
49
- assetAliases[manifest.id]=portableId;
50
- assets.push({ id:portableId, sha256, bytes: encode(bytes), definition });
51
- }
52
- snapshot.objects=snapshot.objects.map(object=>({
53
- ...object,assetId:assetAliases[object.assetId]||object.assetId
54
- }));
55
- snapshot.assets = [];
56
- return { snapshot, assets, assetAliases };
57
- }
58
-
59
- /** Restore into a newly created code-project Runtime, retaining its native environment. */
60
- export async function restoreRuntimeState(world, { snapshot, assets }) {
61
- world.serializer.validate(snapshot);
62
- if (snapshot.assets.length || snapshot.metadata?.environment !== world.environment.id || !Array.isArray(assets)) throw new Error('PROJECT_SNAPSHOT_MISMATCH');
63
- const ids = new Set(), prepared = []; let total = 0;
64
- for (const item of assets) {
65
- if (ids.has(item.id) || assetManifests[item.id]?.source.kind === 'builtin') throw new Error('ASSET_ID_CONFLICT');
66
- ids.add(item.id);
67
- const bytes = decode(item.bytes); total += bytes.length;
68
- if (total > 64 * 1024 * 1024 || await assetDigest(bytes) !== item.sha256) throw new Error('RESOURCE_INTEGRITY_MISMATCH');
69
- assertEmbeddedGLB(bytes); prepared.push({ ...item, bytes });
70
- }
71
- for (const item of prepared) await world.assetModule.importPackageAsset(item);
72
- await world.restore(snapshot);
73
- }
74
-
75
- export async function exportScenePackage(world, { name = 'Untitled World', readResource = null, style = null, editable = undefined } = {}) {
76
- const { snapshot, assets, assetAliases } = await exportRuntimeState(world, { name, readResource });
77
- const project = parseSceneProject({ schema: 'agentscape.scene-project', schemaVersion: 1, name,
78
- environment: { type: 'builtin', id: world.environment.id },
79
- ...(style ? { style: './styles/current/style.json' } : {}),
80
- objects: snapshot.objects.map(object => ({ id: object.id,
81
- asset: assets.some(a=>a.id===object.assetId) ? `./assets/${assets.findIndex(a => a.id === object.assetId)}/model.glb` : `builtin://${object.assetId}`,
82
- level: assets.find(a=>a.id===object.assetId)?.definition.capabilityLevel
83
- || (assets.some(a=>a.id===object.assetId) ? 'physical' : world.assetModule.getManifest(object.assetId).capabilityLevel || 'physical'),
84
- transform: { ...object.transform, scale: object.transform.scale[0] } })) });
85
- const localEditable=editable?.map(entry=>({...entry,assetId:assetAliases[entry.assetId]||entry.assetId}));
86
- const checked = editable === undefined ? undefined : SceneObjectForge.validateTransfer(snapshot,localEditable);
87
- const payload = { project, snapshot, assets, ...(style ? { style: stylePackSchema.parse(style) } : {}),
88
- ...(checked !== undefined ? { editable:checked } : {}) };
89
- const content = await digestContent(payload);
90
- return { schema: 'agentscape.project-bundle', schemaVersion: 1, ...payload,
91
- lock: { engine: RUNTIME_VERSION, builtins: await builtinHash(), content } };
92
- }
93
-
94
- /** Prepare entirely in a fresh Runtime. Failure never mutates the caller's world. */
95
- /** @param {any} input @param {{container?: HTMLElement|null, assetModule?: any, codeExecutor?: any, codeGLTFLoader?: any}} options */
96
- export async function openScenePackage(input, { container = null, assetModule = null, codeExecutor = null, codeGLTFLoader } = {}) {
97
- if (typeof input === 'string') {
98
- if (input.length > 96 * 1024 * 1024) throw new Error('DOCUMENT_LIMIT');
99
- input = JSON.parse(input);
100
- }
101
- const bundle = schema.parse(structuredClone(input)), project = parseSceneProject(bundle.project);
102
- if (bundle.lock.builtins !== await builtinHash() || bundle.lock.content !== await digestContent({ project: bundle.project, snapshot: bundle.snapshot, assets: bundle.assets, ...(bundle.style ? { style: bundle.style } : {}),...(bundle.editable !== undefined ? {editable:bundle.editable}: {}) })) throw new Error('PROJECT_INTEGRITY_MISMATCH');
103
- if (Boolean(project.style) !== Boolean(bundle.style)) throw new Error('STYLE_DEPENDENCY_MISSING');
104
- if (bundle.snapshot?.metadata?.stylePack && canonicalAssetJson(bundle.snapshot.metadata.stylePack) !== canonicalAssetJson(bundle.style)) throw new Error('STYLE_DEPENDENCY_MISMATCH');
105
- if (!Array.isArray(bundle.snapshot?.objects) || bundle.snapshot.objects.length !== project.objects.length) throw new Error('PROJECT_SNAPSHOT_MISMATCH');
106
- for (let index = 0; index < project.objects.length; index++) {
107
- const object = project.objects[index], saved = bundle.snapshot.objects[index];
108
- const assetIndex = bundle.assets.findIndex(asset => asset.id === saved.assetId);
109
- const reference = assetIndex < 0 ? `builtin://${saved.assetId}` : `./assets/${assetIndex}/model.glb`;
110
- if (object.id !== saved.id || object.asset !== reference || canonicalAssetJson(object.transform) !== canonicalAssetJson({ ...saved.transform, scale: saved.transform?.scale?.[0] })) throw new Error('PROJECT_SNAPSHOT_MISMATCH');
111
- }
112
- SceneObjectForge.validateTransfer(bundle.snapshot,bundle.editable || []);
113
- const ids = new Set(); let total = 0;
114
- const prepared = [];
115
- for (const item of bundle.assets) {
116
- if (ids.has(item.id) || assetManifests[item.id]?.source.kind === 'builtin') throw new Error('ASSET_ID_CONFLICT');
117
- ids.add(item.id);
118
- const bytes = decode(item.bytes); total += bytes.length;
119
- if (total > 64 * 1024 * 1024 || await assetDigest(bytes) !== item.sha256) throw new Error('RESOURCE_INTEGRITY_MISMATCH');
120
- assertEmbeddedGLB(bytes); prepared.push({ ...item, bytes });
121
- }
122
- const assets = assetModule || createAssetModule({ volatile: true, manifests: Object.fromEntries(Object.entries(assetManifests).filter(([id]) => !ids.has(id))), manifestStore: null, libraryStore: null });
123
- assets.configureVerification({articulationVerifier:new ArticulationVerifier({assetRegistry:assets.registry,assetLoader:assets.loader})});
124
- for (const item of prepared) {
125
- await assets.importPackageAsset(item);
126
- }
127
- const { openScene } = await import('./SceneFacade.js');
128
- const scene = await openScene({ container, assetModule: assets, codeExecutor, codeGLTFLoader, project: { ...project, objects: [], style: undefined } });
129
- try { await scene.restoreSnapshot(bundle.snapshot, { prepared: true }); if (bundle.style) await scene.setStyle(bundle.style); return scene; }
130
- catch (error) { scene.close(); throw error; }
131
- }
132
-
133
- /** Validate in an isolated session, then reuse Runtime's own transactional restore. */
134
- export async function importScenePackageInto(world, input, { applyStyle, getStyle } = {}) {
135
- const bundle = schema.parse(structuredClone(typeof input === 'string' ? JSON.parse(input) : input));
136
- const ids = new Set(bundle.assets.map(asset => asset.id));
137
- const assets = createAssetModule({ volatile: true, manifests: Object.fromEntries(Object.entries(assetManifests).filter(([id]) => !ids.has(id))), manifestStore: null, libraryStore: null });
138
- if (world.rendering?.renderer) assets.configureRenderer(world.rendering.renderer);
139
- let staged;
140
- try {
141
- staged = await openScenePackage(bundle, { assetModule: assets });
142
- if (bundle.project.environment.id !== world.environment.id) throw new Error('ENVIRONMENT_MISMATCH');
143
- SceneObjectForge.validateTransfer(bundle.snapshot,bundle.editable||[]);
144
- const snapshot = staged.snapshot(), entries = [];
145
- if (bundle.snapshot.camera) snapshot.camera = structuredClone(bundle.snapshot.camera);
146
- for (const asset of bundle.assets) {
147
- const manifest = assets.getManifest(asset.id), stored = await assets.compiledStore.get(manifest.source.key);
148
- entries.push({ manifest, bytes: stored.bytes, expectedSourceHash: asset.sha256, expectedDefinition: asset.definition });
149
- }
150
- const previousStyle = getStyle?.() || null;
151
- return await world.assetModule.installPreparedAssets(entries, async () => {
152
- snapshot.assets = snapshot.assets.map(manifest => world.assetModule.getManifest(manifest.id));
153
- try {
154
- return await world.mutate('scene:import-project', async () => {
155
- await world.restoreSnapshot(snapshot);
156
- await applyStyle?.(bundle.style || null);
157
- return { status: 'project-imported', objects: snapshot.objects.length, editable:bundle.editable||[] };
158
- });
159
- } catch (error) { await applyStyle?.(previousStyle); throw error; }
160
- });
161
- } finally { staged?.close(); assets.loader.gltfLoader.dispose?.(); }
162
- }
@@ -1,50 +0,0 @@
1
- import { sceneObjectIdSchema as id } from './SceneProject.js';
2
- import { sceneError } from './SceneContracts.js';
3
-
4
- /** Scene snapshots, project packages and content-addressed world archives. */
5
- export function createScenePersistence(world, { name, styles, assertIdle, exclusive, result }) {
6
- return {
7
- snapshot() { assertIdle(); return world.serialize({ name }); },
8
- async save(options = {}) {
9
- return exclusive(async () => {
10
- const { exportScenePackage } = await import('./ScenePackage.js');
11
- return result('save', await exportScenePackage(world, { ...options, name, style: styles.export() }));
12
- });
13
- },
14
- /** Bounded streaming world archive; storage is an injected hash-block backend. */
15
- async exportWorld(storage, writer, options = {}) {
16
- return exclusive(async () => {
17
- const { exportWorld } = await import('./WorldIO.js');
18
- return result('exportWorld', await exportWorld(world, storage, writer, { name, ...options }));
19
- });
20
- },
21
- async prepareWorld(storage, root, options = {}) {
22
- assertIdle();
23
- const { prepareWorld } = await import('./WorldIO.js');
24
- const prepared = await prepareWorld(storage, root, { active:'bounded', ...options });
25
- // Never expose the private Runtime simply to commit a validated world.
26
- return { summary:prepared.summary, commit:()=>exclusive(()=>prepared.commit(world)), dispose:()=>prepared.dispose() };
27
- },
28
- async importWorld(storage, source, options = {}) {
29
- return exclusive(async () => {
30
- const { importWorld } = await import('./WorldIO.js');
31
- return result('importWorld', await importWorld(world, storage, source, { active:'bounded', ...options }));
32
- });
33
- },
34
- async restoreSnapshot(snapshot, { prepared = false } = {}) {
35
- return exclusive(async () => {
36
- const copy = structuredClone(snapshot); world.serializer.validate(copy);
37
- if (copy.assets.length || (!prepared && (copy.configuration?.behaviorBundle || copy.configuration?.physicsRequirements || copy.metadata?.environmentState || copy.metadata?.worldRevision))) throw sceneError('UNSUPPORTED_SAVE');
38
- for (const object of copy.objects) { id.parse(object.id); if (!world.assetModule.hasAsset(object.assetId)) throw sceneError('ASSET_UNAVAILABLE'); }
39
- await world.restore(copy); return result('restore', { objects: copy.objects.length });
40
- });
41
- },
42
- async setStyle(input, options = {}) { return exclusive(async () => result('setStyle', await styles.set(input, options))); },
43
- async importProject(input) {
44
- return exclusive(async () => {
45
- const { importScenePackageInto } = await import('./ScenePackage.js');
46
- return result('importProject', await importScenePackageInto(world, input, { getStyle: () => styles.export(), applyStyle: pack => pack ? styles.set(pack) : styles.clear() }));
47
- });
48
- },
49
- };
50
- }
@@ -1,95 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { BUILTIN_ENVIRONMENT_IDS } from '../../modules/world/content/environments.js';
3
-
4
- export const sceneObjectIdSchema = z.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/);
5
- export const sceneVector3Schema = z.tuple([z.number().finite().min(-10000).max(10000), z.number().finite().min(-10000).max(10000), z.number().finite().min(-10000).max(10000)]);
6
- const quaternionSchema = z.tuple([z.number().finite(), z.number().finite(), z.number().finite(), z.number().finite()])
7
- .refine(value => Math.abs(Math.hypot(...value) - 1) < 0.0001, 'Quaternion must be normalized');
8
- const scaleSchema = z.number().finite().min(0.05).max(20);
9
- export const sceneTransformSchema = z.object({
10
- position: sceneVector3Schema.default(() => [0, 0, 0]),
11
- quaternion: quaternionSchema.default(() => [0, 0, 0, 1]),
12
- scale: scaleSchema.default(1)
13
- }).strict();
14
- const builtinAssetSchema = z.string().regex(/^builtin:\/\/[a-zA-Z][a-zA-Z0-9_-]{0,63}$/);
15
- // Portable package paths only. No URL decoding, drive paths, ADS or traversal.
16
- export const sceneResourcePathSchema = z.string().max(240).refine(value => {
17
- if (!value.startsWith('./')) return false;
18
- return value.slice(2).split('/').every(part =>
19
- /^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$/.test(part) && !part.endsWith('.') &&
20
- !/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(part));
21
- }, 'Expected a portable project-relative resource path');
22
- export const sceneAssetRefSchema = z.union([builtinAssetSchema, z.string().regex(/^asset:\/\/sha256\/[a-f0-9]{64}$/), sceneResourcePathSchema]);
23
- const sceneObjectSchema = z.object({
24
- id: sceneObjectIdSchema,
25
- asset: sceneAssetRefSchema,
26
- level: z.enum(['visual', 'physical', 'interactive']),
27
- transform: sceneTransformSchema.default(() => ({ position: [0, 0, 0], quaternion: [0, 0, 0, 1], scale: 1 }))
28
- }).strict();
29
- export const sceneProjectSchema = z.object({
30
- schema: z.literal('agentscape.scene-project'),
31
- schemaVersion: z.literal(1),
32
- name: z.string().trim().min(1).max(100),
33
- environment: z.object({ type: z.literal('builtin'), id: z.enum(BUILTIN_ENVIRONMENT_IDS) }).strict(),
34
- style: sceneAssetRefSchema.optional(),
35
- objects: z.array(sceneObjectSchema)
36
- }).strict().superRefine((project, ctx) => {
37
- const used = new Set();
38
- for (let index = 0; index < project.objects.length; index++) {
39
- const id = project.objects[index].id;
40
- if (used.has(id)) ctx.addIssue({ code: 'custom', path: ['objects', index, 'id'], message: 'Duplicate scene object ID' });
41
- used.add(id);
42
- }
43
- });
44
-
45
- export function parseSceneProject(input) {
46
- if (typeof input === 'string') {
47
- if (new TextEncoder().encode(input).byteLength > 256 * 1024) throw projectError('DOCUMENT_LIMIT');
48
- try { input = JSON.parse(input); } catch { throw projectError('INVALID_DOCUMENT'); }
49
- }
50
- if (input?.schema === 'agentscape.scene-project' && input.schemaVersion !== 1) throw projectError('UNSUPPORTED_VERSION');
51
- const result = sceneProjectSchema.safeParse(input);
52
- if (!result.success) throw projectError('INVALID_DOCUMENT', result.error.issues.map(issue => ({ path: issue.path, message: issue.message })));
53
- return result.data;
54
- }
55
-
56
- function projectError(code, diagnostics = []) {
57
- return Object.assign(new Error(code), { code, diagnostics });
58
- }
59
-
60
- /** Resolve an already extracted, bounded package of bytes. Never opens host files or URLs.
61
- * Filesystem/archive adapters must reject links before constructing this Map.
62
- * This is dependency resolution only, not asset admission or Runtime installation.
63
- */
64
- export async function resolveSceneProject(input, { resources = new Map(), builtins = new Map() } = {}) {
65
- const project = parseSceneProject(input);
66
- if (!(resources instanceof Map) || !(builtins instanceof Map) || resources.size > 128) throw projectError('INVALID_RESOURCES');
67
- let total = 0;
68
- const names = new Set();
69
- const bytes = new Map();
70
- for (const [path, value] of resources) {
71
- if (!sceneResourcePathSchema.safeParse(path).success || names.has(path.toLowerCase())) throw projectError('INVALID_RESOURCE_PATH');
72
- names.add(path.toLowerCase());
73
- if (!(value instanceof Uint8Array)) throw projectError('INVALID_RESOURCES');
74
- total += value.byteLength;
75
- if (value.byteLength > 32 * 1024 * 1024 || total > 64 * 1024 * 1024) throw projectError('RESOURCE_LIMIT');
76
- bytes.set(path, value.slice());
77
- }
78
- const refs = new Set([`builtin://${project.environment.id}`, ...project.objects.map(object => object.asset), ...(project.style ? [project.style] : [])]);
79
- const dependencies = [];
80
- for (const ref of refs) {
81
- let sha256;
82
- if (ref.startsWith('builtin://') || ref.startsWith('asset://')) {
83
- // The host supplies hashes from its versioned built-in resource catalog.
84
- sha256 = builtins.get(ref);
85
- if (!/^[a-f0-9]{64}$/.test(sha256 ?? '')) throw projectError('RESOURCE_UNAVAILABLE');
86
- } else {
87
- const data = bytes.get(ref);
88
- if (!data) throw projectError('RESOURCE_UNAVAILABLE');
89
- const digest = await globalThis.crypto.subtle.digest('SHA-256', data);
90
- sha256 = Array.from(new Uint8Array(digest), value => value.toString(16).padStart(2, '0')).join('');
91
- }
92
- dependencies.push({ ref, sha256 });
93
- }
94
- return { project, dependencies };
95
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * The Scene API skills kept for the existing Studio tool surface.
3
- * Keep names independent of SceneFacade construction and the runtime systems.
4
- */
5
- export const SCENE_LEGACY_SKILLS = Object.freeze(['spawnAsset', 'moveObject', 'rotateObject', 'scaleObject', 'transformObject', 'removeObject', 'duplicateObject', 'replaceAsset', 'navigateTo', 'approachAndInteract', 'approachAndPickup', 'approachAndPlace', 'evaluateWorldAcceptance', 'pickup', 'drop', 'place', 'open', 'close', 'dropHeld']);
@@ -1,56 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { openScene } from './SceneFacade.js';
3
-
4
- // Experimental, local-only entry. It deliberately does not implement the whole v1 RFC.
5
- const id = z.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/);
6
- const position = z.tuple([z.number().finite().min(-12).max(12), z.number().finite().min(0).max(8), z.number().finite().min(-10).max(10)]);
7
- const asset = z.enum(['agent', 'cup', 'table', 'chair']);
8
- const object = z.object({ id, asset, position }).strict();
9
- export const starterProjectSchema = z.object({
10
- schema: z.literal('agentscape.starter-project'),
11
- schemaVersion: z.literal(1),
12
- name: z.string().min(1).max(100),
13
- objects: z.array(object)
14
- }).strict().refine(p => new Set(p.objects.map(o => o.id)).size === p.objects.length, 'Duplicate object ID');
15
- const interaction = z.discriminatedUnion('action', [
16
- z.object({ action: z.literal('pickup'), actorId: id, targetId: id }).strict(),
17
- z.object({ action: z.literal('place'), actorId: id, targetId: id, surfaceId: id.optional() }).strict(),
18
- z.object({ action: z.literal('navigate'), actorId: id, position }).strict()
19
- ]);
20
- const fail = (code, message = code) => Object.assign(new Error(message), { code });
21
-
22
- /** Legacy Starter adapter. All state and operations belong to SceneFacade. */
23
- export async function openStarterScene({ project, container = null } = {}) {
24
- const definition = starterProjectSchema.parse(project);
25
- const scene = await openScene({ container, project: {
26
- schema: 'agentscape.scene-project', schemaVersion: 1, name: definition.name,
27
- environment: { type: 'builtin', id: 'monument-hall' },
28
- objects: definition.objects.map(entry => ({ id: entry.id, asset: 'builtin://' + entry.asset, level: 'physical', transform: { position: entry.position } }))
29
- } });
30
- return {
31
- observe: () => scene.observe(),
32
- async add(input) { const entry = object.parse(input); return scene.addModel({ ...entry, asset: 'builtin://' + entry.asset }); },
33
- async move(input) { const args = z.object({ id, position }).strict().parse(input); return scene.setTransform({ id: args.id, transform: { position: args.position } }); },
34
- async interact(input) {
35
- const args = interaction.parse(input);
36
- const job = scene.interact({ action: args.action, actor: args.actorId,
37
- ...(args.action === 'navigate' ? { position: args.position } : { target: args.targetId }),
38
- ...(args.surfaceId ? { surfaceId: args.surfaceId } : {}) });
39
- const { result } = await scene.waitJob(job.id);
40
- if (result.diagnostics.length) throw fail(result.diagnostics[0].code);
41
- return { ...result.outcome, verified: result.verification.status === 'verified', result: result.value };
42
- },
43
- save: () => scene.snapshot(),
44
- async load(snapshot) {
45
- const copy = structuredClone(snapshot);
46
- if (JSON.stringify(copy).length > 256 * 1024) throw fail('SAVE_LIMIT');
47
- if (copy.camera) {
48
- const vector = z.tuple([z.number().finite(), z.number().finite(), z.number().finite()]);
49
- z.object({ position: vector, target: vector }).strict().parse(copy.camera);
50
- }
51
- for (const entry of copy.objects || []) { id.parse(entry.id); asset.parse(entry.assetId); }
52
- return (await scene.restoreSnapshot(copy)).value;
53
- },
54
- frame: timestamp => scene.frame(timestamp), step: () => scene.step(), close: () => scene.close()
55
- };
56
- }