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,126 +0,0 @@
1
- import * as THREE from 'three';
2
- import { parseAuthoringDocument } from './AuthoringDocument.js';
3
- import { installHeadlessImageSupport } from './HeadlessImageExport.js';
4
- import { uniformScaleValue } from '../../modules/world/runtime/ObjectTransform.js';
5
- import { sha256ArtifactHash } from '../../modules/artifact/IncrementalSha256.js';
6
-
7
- export const promotionError = (code, message) => Object.assign(new Error(message), { code });
8
- export const promotionHash = (value) => sha256ArtifactHash([new TextEncoder().encode(JSON.stringify(value))]);
9
-
10
- // Capture only the selected subtree and its resources, plus inherited placement.
11
- // An unrelated edit must not invalidate a prepared asset.
12
- export function capturePromotionSource(authoring, nodeId) {
13
- const document = authoring.export();
14
- const state = parseAuthoringDocument(document);
15
- if (!state.nodesById[nodeId] || nodeId === state.rootId) {
16
- throw promotionError('AUTHORING_SELECTION_INVALID', '请选择一个创作对象或分组,不能晋升整个创作根节点');
17
- }
18
- const ids = [];
19
- const visit = id => { ids.push(id); for (const child of state.childIdsById[id] || []) visit(child); };
20
- visit(nodeId);
21
- const geometries = {}, materials = {};
22
- for (const id of ids) {
23
- const components = state.nodesById[id].components;
24
- const geometryId = components.geometry?.properties?.geometryId;
25
- const materialId = components.material?.properties?.materialId;
26
- if (geometryId) geometries[geometryId] = state.geometries[geometryId];
27
- if (materialId) materials[materialId] = state.materials[materialId];
28
- }
29
- const textures = {};
30
- for (const material of Object.values(materials)) {
31
- for (const value of Object.values(material)) {
32
- if (typeof value === 'string' && state.textures[value]) textures[value] = state.textures[value];
33
- }
34
- }
35
- const object = authoring.get(nodeId);
36
- object.updateWorldMatrix(true, true);
37
- const matrix = object.matrixWorld.clone();
38
- const position = new THREE.Vector3(), quaternion = new THREE.Quaternion(), scale = new THREE.Vector3();
39
- matrix.decompose(position, quaternion, scale);
40
- const uniform = uniformScaleValue(scale.toArray());
41
- const reconstructed = new THREE.Matrix4().compose(position, quaternion, scale);
42
- if (matrix.elements.some((v, i) => !Number.isFinite(v) || Math.abs(v - reconstructed.elements[i]) > 1e-6)) {
43
- throw promotionError('AUTHORING_TRANSFORM_UNSUPPORTED', '当前世界不支持带剪切的对象变换');
44
- }
45
- let ancestor = nodeId;
46
- while (ancestor) {
47
- if (state.nodesById[ancestor].visible === false) throw promotionError('AUTHORING_NODE_HIDDEN', '请先显示创作对象及其父分组');
48
- ancestor = state.parentIdById[ancestor];
49
- }
50
- const nodes = ids.map(id => ({ ...state.nodesById[id], childIds:state.childIdsById[id] }));
51
- const content = { nodes, geometries, materials, textures };
52
- // Root placement does not change asset bytes; parent transforms still change sourceHash.
53
- const assetContent = structuredClone(content);
54
- delete assetContent.nodes[0].components.transform;
55
- const transform = { position:position.toArray(), quaternion:quaternion.toArray(), scale:uniform };
56
- return {
57
- nodeId, name:object.name || nodeId, ids, object, transform,
58
- reference:state.nodesById[nodeId].components.modelRef?.properties || null,
59
- contentHash:promotionHash(assetContent), sourceHash:promotionHash({ content, transform }),
60
- revisionId:authoring.currentRevision()?.id || null
61
- };
62
- }
63
-
64
- export async function exportPromotionGLB(source) {
65
- // Lazy load the exporter only when a visual subtree actually needs asset production.
66
- const { GLTFExporter } = await import('three/addons/exporters/GLTFExporter.js');
67
- const object = source.object.clone(true);
68
- object.position.set(0, 0, 0);
69
- object.quaternion.identity();
70
- object.scale.set(1, 1, 1);
71
- object.matrixAutoUpdate = true;
72
- object.updateMatrix();
73
- object.visible = true;
74
- const materials = [];
75
- const expand = node => {
76
- for (const child of [...node.children]) {
77
- if (child.isInstancedMesh) {
78
- const group = new THREE.Group();
79
- group.name = child.name;
80
- group.position.copy(child.position);
81
- group.quaternion.copy(child.quaternion);
82
- group.scale.copy(child.scale);
83
- group.visible = child.visible;
84
- for (let i = 0; i < child.count; i++) {
85
- let material = child.material;
86
- if (child.instanceColor) {
87
- material = material.clone();
88
- material.color.multiply(new THREE.Color().fromBufferAttribute(child.instanceColor, i));
89
- materials.push(material);
90
- }
91
- const mesh = new THREE.Mesh(child.geometry, material);
92
- child.getMatrixAt(i, mesh.matrix);
93
- mesh.matrixAutoUpdate = false;
94
- group.add(mesh);
95
- }
96
- while (child.children.length) group.add(child.children[0]);
97
- node.remove(child);
98
- node.add(group);
99
- expand(group);
100
- } else expand(child);
101
- }
102
- };
103
- const wrapper = new THREE.Group();
104
- wrapper.add(object);
105
- let meshes = 0;
106
- // Headless hosts have no canvas; install a deterministic image encoder so
107
- // Agent-authored DataTextures still compile. Browsers keep their real canvas.
108
- const restoreImageSupport = installHeadlessImageSupport();
109
- try {
110
- expand(wrapper);
111
- wrapper.traverse(node => {
112
- if (node.isLight || node.isCamera || node.isSkinnedMesh || node.animations?.length) {
113
- throw promotionError('AUTHORING_EXPORT_UNSUPPORTED', '请将灯光、相机、蒙皮或动画与待晋升对象分开');
114
- }
115
- if (node.isMesh) meshes++;
116
- // Runtime and authoring IDs do not belong in reusable asset GLB extras.
117
- node.userData = {};
118
- });
119
- if (!meshes) throw promotionError('AUTHORING_MODEL_UNRESOLVED', '对象没有可导出的网格,请先加载模型');
120
- const bytes = await new GLTFExporter().parseAsync(wrapper, { binary:true, onlyVisible:true });
121
- return new Uint8Array(bytes);
122
- } finally {
123
- restoreImageSupport?.();
124
- for (const material of materials) material.dispose();
125
- }
126
- }
@@ -1,144 +0,0 @@
1
- import {
2
- canonicalizeAuthoringDocument,
3
- diffAuthoringDocuments
4
- } from './AuthoringDiff.js';
5
- import { parseAuthoringDocument } from './AuthoringDocument.js';
6
-
7
- function clone(value) {
8
- return value == null ? value : JSON.parse(JSON.stringify(value));
9
- }
10
-
11
- function normalizeLimit(value) {
12
- const limit = Number(value ?? 64);
13
- if (!Number.isInteger(limit) || limit < 2) {
14
- throw new TypeError('World Authoring revision history limit must be an integer >= 2');
15
- }
16
- return limit;
17
- }
18
-
19
- export class AuthoringRevisionHistory {
20
- constructor({ limit = 64, now = () => new Date().toISOString() } = {}) {
21
- this.limit = normalizeLimit(limit);
22
- this.now = now;
23
- this.entries = [];
24
- this.cursor = -1;
25
- this.sequence = 0;
26
- }
27
-
28
- reset(document, { label = 'Loaded world', source = 'load' } = {}) {
29
- parseAuthoringDocument(document);
30
- this.entries = [];
31
- this.cursor = -1;
32
- this.sequence = 0;
33
- return this.commit(document, { label, source, force:true });
34
- }
35
-
36
- commit(document, {
37
- label = '',
38
- source = 'manual',
39
- force = false
40
- } = {}) {
41
- parseAuthoringDocument(document);
42
- const snapshot = clone(document);
43
- const canonical = canonicalizeAuthoringDocument(snapshot);
44
- const current = this.entries[this.cursor];
45
-
46
- if (!force && current && canonicalizeAuthoringDocument(current.document) === canonical) {
47
- return { created:false, revision:this.describe(current) };
48
- }
49
-
50
- if (this.cursor < this.entries.length - 1) {
51
- this.entries.splice(this.cursor + 1);
52
- }
53
-
54
- const entry = {
55
- id:`rev_${String(++this.sequence).padStart(6, '0')}`,
56
- index:this.cursor + 1,
57
- label:String(label || ''),
58
- source:String(source || 'manual'),
59
- createdAt:this.now(),
60
- document:snapshot
61
- };
62
-
63
- this.entries.push(entry);
64
- this.cursor = this.entries.length - 1;
65
-
66
- while (this.entries.length > this.limit) {
67
- this.entries.shift();
68
- this.cursor -= 1;
69
- }
70
-
71
- this.reindex();
72
- return { created:true, revision:this.describe(this.entries[this.cursor]) };
73
- }
74
-
75
- reindex() {
76
- this.entries.forEach((entry, index) => {
77
- entry.index = index;
78
- });
79
- }
80
-
81
- describe(entry) {
82
- if (!entry) return null;
83
- return {
84
- id:entry.id,
85
- index:entry.index,
86
- label:entry.label,
87
- source:entry.source,
88
- createdAt:entry.createdAt
89
- };
90
- }
91
-
92
- list() {
93
- return this.entries.map(entry => ({
94
- ...this.describe(entry),
95
- current:entry === this.entries[this.cursor]
96
- }));
97
- }
98
-
99
- current() {
100
- return this.describe(this.entries[this.cursor]);
101
- }
102
-
103
- currentDocument() {
104
- return clone(this.entries[this.cursor]?.document || null);
105
- }
106
-
107
- getDocument(revisionId) {
108
- const entry = this.entries.find(item => item.id === revisionId);
109
- if (!entry) throw new TypeError(`World Authoring revision not found: ${revisionId}`);
110
- return clone(entry.document);
111
- }
112
-
113
- canUndo() {
114
- return this.cursor > 0;
115
- }
116
-
117
- canRedo() {
118
- return this.cursor >= 0 && this.cursor < this.entries.length - 1;
119
- }
120
-
121
- undo() {
122
- if (!this.canUndo()) return null;
123
- this.cursor -= 1;
124
- return {
125
- revision:this.current(),
126
- document:this.currentDocument()
127
- };
128
- }
129
-
130
- redo() {
131
- if (!this.canRedo()) return null;
132
- this.cursor += 1;
133
- return {
134
- revision:this.current(),
135
- document:this.currentDocument()
136
- };
137
- }
138
-
139
- diff(fromRevisionId, toRevisionId) {
140
- const before = this.getDocument(fromRevisionId);
141
- const after = this.getDocument(toRevisionId);
142
- return diffAuthoringDocuments(before, after);
143
- }
144
- }
@@ -1,174 +0,0 @@
1
- // Deterministic image export for hosts without a DOM canvas.
2
- //
3
- // GLTFExporter encodes every texture through a canvas. Browsers always have one,
4
- // but headless hosts (Node tools, CI) do not, so exporting an Agent-authored
5
- // DataTexture - the only texture an authoring sandbox can create - would fail with
6
- // "document is not defined". This module encodes RGBA pixel data straight to PNG
7
- // bytes and exposes a minimal OffscreenCanvas/ImageData surface that GLTFExporter
8
- // picks up automatically when the real canvas APIs are unavailable.
9
-
10
- const PNG_SIGNATURE = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
11
- const ZLIB_HEADER = new Uint8Array([0x78, 0x01]);
12
- const STORED_BLOCK_MAX = 0xffff;
13
-
14
- const CRC_TABLE = (() => {
15
- const table = new Uint32Array(256);
16
- for (let n = 0; n < 256; n++) {
17
- let c = n;
18
- for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
19
- table[n] = c >>> 0;
20
- }
21
- return table;
22
- })();
23
-
24
- function crc32(bytes, start, end) {
25
- let crc = 0xffffffff;
26
- for (let i = start; i < end; i++) crc = CRC_TABLE[(crc ^ bytes[i]) & 0xff] ^ (crc >>> 8);
27
- return (crc ^ 0xffffffff) >>> 0;
28
- }
29
-
30
- function adler32(bytes) {
31
- let a = 1;
32
- let b = 0;
33
- for (let i = 0; i < bytes.length; i++) {
34
- a = (a + bytes[i]) % 65521;
35
- b = (b + a) % 65521;
36
- }
37
- return ((b << 16) | a) >>> 0;
38
- }
39
-
40
- function concat(parts) {
41
- let length = 0;
42
- for (const part of parts) length += part.length;
43
- const out = new Uint8Array(length);
44
- let offset = 0;
45
- for (const part of parts) { out.set(part, offset); offset += part.length; }
46
- return out;
47
- }
48
-
49
- function pngChunk(type, data) {
50
- const out = new Uint8Array(12 + data.length);
51
- const view = new DataView(out.buffer);
52
- view.setUint32(0, data.length);
53
- for (let i = 0; i < 4; i++) out[4 + i] = type.charCodeAt(i);
54
- out.set(data, 8);
55
- view.setUint32(8 + data.length, crc32(out, 4, 8 + data.length));
56
- return out;
57
- }
58
-
59
- // zlib stream using stored (uncompressed) deflate blocks - no compression library needed.
60
- function zlibStored(raw) {
61
- const parts = [ZLIB_HEADER];
62
- const blocks = Math.max(1, Math.ceil(raw.length / STORED_BLOCK_MAX));
63
- for (let i = 0; i < blocks; i++) {
64
- const start = i * STORED_BLOCK_MAX;
65
- const length = Math.min(STORED_BLOCK_MAX, raw.length - start);
66
- const header = new Uint8Array(5);
67
- header[0] = i === blocks - 1 ? 0x01 : 0x00; // BFINAL | BTYPE=stored
68
- header[1] = length & 0xff;
69
- header[2] = (length >>> 8) & 0xff;
70
- header[3] = ~length & 0xff;
71
- header[4] = (~length >>> 8) & 0xff;
72
- parts.push(header, raw.subarray(start, start + length));
73
- }
74
- const checksum = new Uint8Array(4);
75
- new DataView(checksum.buffer).setUint32(0, adler32(raw));
76
- parts.push(checksum);
77
- return concat(parts);
78
- }
79
-
80
- // Encodes RGBA8 pixels (top-to-bottom, no premultiply) into a PNG image.
81
- export function encodePngRgba(rgba, width, height) {
82
- if (!Number.isInteger(width) || width <= 0 || !Number.isInteger(height) || height <= 0) {
83
- throw new TypeError('PNG dimensions must be positive integers');
84
- }
85
- if (rgba.length !== width * height * 4) {
86
- throw new TypeError(`RGBA buffer must contain ${width * height * 4} bytes`);
87
- }
88
- const stride = width * 4;
89
- const raw = new Uint8Array(height * (stride + 1));
90
- for (let y = 0; y < height; y++) {
91
- raw[y * (stride + 1)] = 0; // filter type: none
92
- raw.set(rgba.subarray(y * stride, (y + 1) * stride), y * (stride + 1) + 1);
93
- }
94
- const ihdr = new Uint8Array(13);
95
- const view = new DataView(ihdr.buffer);
96
- view.setUint32(0, width);
97
- view.setUint32(4, height);
98
- ihdr[8] = 8; // bit depth
99
- ihdr[9] = 6; // color type: RGBA
100
- return concat([
101
- PNG_SIGNATURE,
102
- pngChunk('IHDR', ihdr),
103
- pngChunk('IDAT', zlibStored(raw)),
104
- pngChunk('IEND', new Uint8Array(0))
105
- ]);
106
- }
107
-
108
- class HeadlessImageData {
109
- constructor(dataOrWidth, widthOrHeight, height) {
110
- if (typeof dataOrWidth === 'number') {
111
- this.width = dataOrWidth;
112
- this.height = widthOrHeight;
113
- this.data = new Uint8ClampedArray(this.width * this.height * 4);
114
- return;
115
- }
116
- this.data = dataOrWidth instanceof Uint8ClampedArray ? dataOrWidth : new Uint8ClampedArray(dataOrWidth);
117
- this.width = widthOrHeight;
118
- this.height = height;
119
- }
120
- }
121
-
122
- class HeadlessOffscreenCanvas {
123
- constructor(width = 1, height = 1) {
124
- this.width = width;
125
- this.height = height;
126
- this.pixels = null;
127
- }
128
-
129
- getContext(type) {
130
- if (type !== '2d') return null;
131
- const canvas = this;
132
- return {
133
- canvas,
134
- putImageData(image) {
135
- canvas.pixels = { data: new Uint8ClampedArray(image.data), width: image.width, height: image.height };
136
- },
137
- drawImage(source) {
138
- if (source?.pixels) canvas.pixels = {
139
- data: new Uint8ClampedArray(source.pixels.data),
140
- width: source.pixels.width,
141
- height: source.pixels.height
142
- };
143
- },
144
- scale() {},
145
- translate() {},
146
- clearRect() {},
147
- fillRect() {}
148
- };
149
- }
150
-
151
- convertToBlob({ type = 'image/png' } = {}) {
152
- const image = this.pixels || {
153
- data: new Uint8ClampedArray(this.width * this.height * 4),
154
- width: this.width,
155
- height: this.height
156
- };
157
- return Promise.resolve(new Blob([encodePngRgba(image.data, image.width, image.height)], { type }));
158
- }
159
- }
160
-
161
- // Installs the canvas shim only when the host has no real canvas/image APIs,
162
- // and returns a restore function (null when nothing was changed).
163
- export function installHeadlessImageSupport(scope = globalThis) {
164
- if (typeof scope.OffscreenCanvas !== 'undefined' && typeof scope.ImageData !== 'undefined') return null;
165
- const previous = { OffscreenCanvas:scope.OffscreenCanvas, ImageData:scope.ImageData };
166
- if (typeof scope.OffscreenCanvas === 'undefined') scope.OffscreenCanvas = HeadlessOffscreenCanvas;
167
- if (typeof scope.ImageData === 'undefined') scope.ImageData = HeadlessImageData;
168
- return () => {
169
- if (previous.OffscreenCanvas === undefined) delete scope.OffscreenCanvas;
170
- else scope.OffscreenCanvas = previous.OffscreenCanvas;
171
- if (previous.ImageData === undefined) delete scope.ImageData;
172
- else scope.ImageData = previous.ImageData;
173
- };
174
- }
@@ -1,62 +0,0 @@
1
- function clone(value) {
2
- return JSON.parse(JSON.stringify(value));
3
- }
4
-
5
- const modelRefs = new WeakMap();
6
-
7
- function normalizeAssetRef(assetRef) {
8
- const assetId = String(assetRef?.assetId ?? '').trim();
9
- if (!assetId) throw new TypeError('World Authoring ModelRef requires a valid AssetRef');
10
- return { assetId };
11
- }
12
-
13
- export function normalizeAuthoringModelRef(reference) {
14
- const source = reference?.source || reference;
15
-
16
- if (source?.type === 'url') {
17
- const uri = String(source.uri || '').trim();
18
- if (!uri) throw new TypeError('World Authoring ModelRef URL requires uri');
19
- return { source:{ type:'url', uri } };
20
- }
21
-
22
- if (source?.type === 'asset') {
23
- return {
24
- source:{
25
- type:'asset',
26
- assetRef:normalizeAssetRef(source.assetRef)
27
- }
28
- };
29
- }
30
-
31
- if (reference?.assetRef) {
32
- return {
33
- source:{
34
- type:'asset',
35
- assetRef:normalizeAssetRef(reference.assetRef)
36
- }
37
- };
38
- }
39
-
40
- if (typeof reference?.uri === 'string' && reference.uri.trim()) {
41
- return { source:{ type:'url', uri:reference.uri.trim() } };
42
- }
43
-
44
- throw new TypeError('World Authoring ModelRef requires a url or AssetRef source');
45
- }
46
-
47
- export function markAuthoringModelRef(object, reference) {
48
- if (!object?.isObject3D) throw new TypeError('World Authoring ModelRef target must be an Object3D');
49
- modelRefs.set(object, normalizeAuthoringModelRef(reference));
50
- return object;
51
- }
52
-
53
- export function getAuthoringModelRef(object) {
54
- const reference = object?.isObject3D
55
- ? (modelRefs.get(object) || object.userData?.authoringModelRef)
56
- : null;
57
- return reference ? normalizeAuthoringModelRef(reference) : null;
58
- }
59
-
60
- export function cloneAuthoringModelRef(reference) {
61
- return clone(normalizeAuthoringModelRef(reference));
62
- }
@@ -1,71 +0,0 @@
1
- # MCP 程序化创作 v0.2
2
-
3
- v0.3 更新:这些接口继续保留,但远程执行现已要求 Docker OS 隔离;新增完整程序化资产文件持久化与可信世界恢复接口。下面的 Worker/WASM 描述是 v0.2 的执行基线,最新隔离及保存契约以 [PROGRAMMATIC-ASSETS.md](./PROGRAMMATIC-ASSETS.md) 为准。
4
-
5
- AI 可以通过现有 `agentscape-world` 连接提交 Three.js,生成草稿、编译资产并晋升为当前私有世界中的实体。Studio 与 MCP 共用创作文档、资产编译器、晋升控制器和 WorldRuntime;无头创作不需要打开浏览器。
6
-
7
- ## 接口
8
-
9
- 所有接口要求 `worldSessionId`;写接口还要求 UUID `requestId`。相同请求重试复用原 ID,不同参数不能使用同一个 ID。
10
-
11
- | 工具 | 其他参数 | 结果 |
12
- |---|---|---|
13
- | authoring_execute | code、label(可选)、requestId | 执行、提交草稿版本;失败保持上一个草稿 |
14
- | authoring_observe | 无 | 节点 ID、资产/实体 ID、准入和验证状态 |
15
- | authoring_prepare | nodeId、usage、requestId | 编译为本地资产;不放入世界 |
16
- | authoring_promote | nodeId、usage、allowProvisional=false、requestId | 经放置和物理预检晋升 |
17
- | authoring_update | 与 promote 相同 | 显式更新已晋升实体;失败回滚 |
18
- | authoring_verify | nodeId | 检查物理及导航;未实际执行的交互保持未验证 |
19
- | authoring_export | 无 | 原始成功代码、可编辑文档、晋升关联,原子保存到私有会话目录 |
20
-
21
- `usage` 首版支持 `static`、`movable`。原来的九个工具继续可用,总计十六个。`action_execute.spawnAsset` 可以实例化本会话已注册的资产,不接受外部 URL 或其他会话资产。
22
-
23
- ## 实际工作流
24
-
25
- 先创建 `monument-hall` 会话,向 `authoring_execute.code` 提交:
26
-
27
- ```js
28
- const box = new THREE.Mesh(
29
- new THREE.BoxGeometry(0.3, 0.3, 0.3),
30
- new THREE.MeshStandardMaterial({ color: 0xff8844 })
31
- );
32
- box.name = 'AI Box';
33
- box.userData.authoringId = 'ai-box';
34
- box.position.set(0, 0.2, 5);
35
- scene.add(box);
36
- ```
37
-
38
- 随后执行 `authoring_observe`、`authoring_prepare(nodeId="ai-box",usage="movable")`。默认编译得到粗碰撞代理,准入可能为 `provisional`;默认晋升会拒绝。只有显式选择 `allowProvisional=true` 才允许插入编辑态实体,不会伪称正式准入通过。
39
-
40
- 读取晋升结果中的 `entityId`,通过 `action_execute` 执行 `approachAndPickup(actorId="agent_01",targetId=entityId)`,再执行 `approachAndPlace(actorId="agent_01",supportId="table_01",surfaceId="top")`。盒状、圆柱、胶囊碰撞体均走真实碰撞检测与搬运路径。
41
-
42
- `world_verify` 新增可选 `criteria`,例如:
43
-
44
- ```json
45
- [
46
- {"id":"exists","kind":"object-exists","targetId":"<entityId>"},
47
- {"id":"picked","kind":"interaction-verified","targetId":"<entityId>","capability":"PICKUP"},
48
- {"id":"on-table","kind":"relation-exists","subject":"<entityId>","predicate":"ON","object":"table_01","surfaceId":"top"}
49
- ]
50
- ```
51
-
52
- criteria 省略时保留原开柜取杯和最终空手验收;显式空数组会被拒绝。自定义验收只证明请求中的检查,不自动要求空手,也不提升资产准入。草稿应用的 `accepted`、资产 `provisional` 和真实动作 `verified` 是不同证据。
53
-
54
- ## 执行与支持范围
55
-
56
- 远程代码在 Worker 中的 QuickJS WebAssembly JavaScript 引擎执行。没有把 Node 函数、模块加载器、环境变量、网络或文件接口注入引擎。Worker 提供额外的墙钟超时和终止能力,普通 Node 子进程或正则检查不是隔离保证。
57
-
58
- - 使用本项目固定的 Three.js;代码可使用 `THREE`、`scene`、`clear`。
59
- - 同步构建 Mesh、Group、Object3D;支持 Basic、Standard、Physical 材质及 RGBA Uint8 DataTexture。
60
- - 支持原有草稿继续修改。成功代码经版本提交;失败、超时、内存超限不替换旧草稿。重试不会重复执行或重复记录源码。
61
- - 明确拒绝外部资源、ModelRef、异步执行、定时器、onFrame、渲染回调、ShaderMaterial、相机、灯光、蒙皮、InstancedMesh 和动画;不宣称任意 Three.js 无损执行。
62
- - 代码最多32768字符;默认执行时间1500ms、QuickJS分配预算96MiB、Worker墙钟上限12秒。预算不是整个服务的操作系统级硬内存隔离。
63
- - 文档最多2Mi字符、128节点、16层;几何先物化为 BufferGeometry,再检查最多20000顶点/120000索引;拒绝原始几何参数,防止小文档引发无界分配。
64
- - DataTexture 每边最多256像素,跨运行时只传递数据。Node 使用有像素预算的嵌入图片解码器加载编译纹理,不调用 DOM 或外部图片 URL。
65
- - 每世界累计成功源码最多262144字符,注册资产预算32个,实体及动作仍受原会话预算控制。
66
-
67
- ## 保存边界
68
-
69
- `authoring_export` 是源码与创作文档导出,scope 为 `authoring-source-and-document-only`,包含成功代码、文档和晋升记录;不包含编译资产字节。原 `world_export` 仍只导出场景 JSON。
70
-
71
- 本阶段尚未提供完整项目导入、重启后世界恢复、Studio 实时连接、截图、自定义行为或 Shader 扩展。内存世界重启即释放。完整资产打包与恢复是下一阶段,不能把上述两个导出接口描述为完整项目保存恢复。
@@ -1 +0,0 @@
1
- export { execute, build, serializeAsset } from '../../application/code-execution/AuthoringSandboxEntry.js';
@@ -1,30 +0,0 @@
1
- import { parentPort, workerData } from 'node:worker_threads';
2
- import { getQuickJS } from 'quickjs-emscripten';
3
-
4
- // No host functions, module loader, filesystem, network or credentials are exposed to QuickJS.
5
- const { bundle, code, source, mode='authoring', document, timeoutMs, memoryBytes }=workerData;
6
- const QuickJS=await getQuickJS();
7
- const runtime=QuickJS.newRuntime();
8
- runtime.setMemoryLimit(memoryBytes);
9
- runtime.setMaxStackSize(1024*1024);
10
- const context=runtime.newContext();
11
- let deadline=Date.now()+5000;
12
- runtime.setInterruptHandler(()=>Date.now()>deadline);
13
- try {
14
- const setup=context.evalCode(bundle,'trusted-authoring-bootstrap.js');
15
- if (setup.error) { setup.error.dispose(); throw new Error('AUTHORING_SANDBOX_INIT_FAILED'); }
16
- setup.value.dispose();
17
- deadline=Date.now()+timeoutMs;
18
- const expression=mode==='procedural' ? `AuthoringSandbox.build(${JSON.stringify(source)})` : `AuthoringSandbox.execute(${JSON.stringify(code)},${JSON.stringify(document)})`;
19
- const output=context.evalCode(`JSON.stringify(${expression})`,'agent-authoring.js');
20
- if (output.error) {
21
- const error=context.dump(output.error); output.error.dispose();
22
- const message=Date.now()>deadline?'AUTHORING_CODE_TIMEOUT':String(error?.message || 'AUTHORING_CODE_FAILED').slice(0,500);
23
- parentPort.postMessage({error:message});
24
- } else {
25
- const json=context.getString(output.value); output.value.dispose();
26
- if (json.length>2097152) throw new Error('AUTHORING_DOCUMENT_LIMIT');
27
- parentPort.postMessage({json});
28
- }
29
- } catch(error) { parentPort.postMessage({error:String(error.message).slice(0,500)}); }
30
- finally { context.dispose(); runtime.dispose(); }
@@ -1,17 +0,0 @@
1
- import { readFile,readdir } from 'node:fs/promises';
2
- import { createHash } from 'node:crypto';
3
- import { fileURLToPath } from 'node:url';
4
- import path from 'node:path';
5
- let cached;
6
- // Version the trusted compiler/validation pipeline as well as the container image.
7
- export function pipelineDigest() {
8
- cached ||= (async()=>{
9
- const root=fileURLToPath(new URL('../../',import.meta.url));
10
- const directories=['modules/asset/production','modules/asset/model','modules/world/verification','application/programmatic-assets','application/world-authoring'];
11
- const files=[];const walk=async dir=>{for(const entry of await readdir(path.join(root,dir),{withFileTypes:true})){const relative=path.posix.join(dir,entry.name);if(entry.isDirectory())await walk(relative);else if(/\.[cm]?js$/.test(entry.name))files.push(relative);}};
12
- for(const dir of directories)await walk(dir);
13
- files.push('apps/mcp-server/HeadlessGLTFLoader.js','modules/asset/AssetModule.js','package-lock.json');
14
- const digest=createHash('sha256');for(const file of files.sort())digest.update(file).update(await readFile(path.join(root,file)));
15
- return digest.digest('hex');
16
- })();return cached;
17
- }