agentscape3d-engine 0.0.0-stage → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/cli.mjs +53 -0
  4. package/dist/AssetCompiler-A99wKf7H.js +2424 -0
  5. package/dist/AssetCompiler-A99wKf7H.js.map +1 -0
  6. package/dist/AssetInputContracts-uKYeQu-X.js +245 -0
  7. package/dist/AssetInputContracts-uKYeQu-X.js.map +1 -0
  8. package/dist/AssetRecipe-DCaLLXvG.js +67 -0
  9. package/dist/AssetRecipe-DCaLLXvG.js.map +1 -0
  10. package/dist/BrowserCodeWorker.js +53850 -0
  11. package/dist/BrowserCodeWorker.js.map +1 -0
  12. package/dist/KinematicHypothesisScreen-4v7GBwdv.js +241 -0
  13. package/dist/KinematicHypothesisScreen-4v7GBwdv.js.map +1 -0
  14. package/dist/SceneSerializer-CLCzQjL_.js +350 -0
  15. package/dist/SceneSerializer-CLCzQjL_.js.map +1 -0
  16. package/dist/StylePack-CD_BC-Mv.js +6317 -0
  17. package/dist/StylePack-CD_BC-Mv.js.map +1 -0
  18. package/dist/WorldArchive-dYf1OpSe.js +417 -0
  19. package/dist/WorldArchive-dYf1OpSe.js.map +1 -0
  20. package/dist/WorldIO-Dqz4MqTQ.js +149 -0
  21. package/dist/WorldIO-Dqz4MqTQ.js.map +1 -0
  22. package/dist/blankWorld-OoOvN_IK.js +75 -0
  23. package/dist/blankWorld-OoOvN_IK.js.map +1 -0
  24. package/dist/core.d.ts +68 -0
  25. package/dist/core.js +209 -0
  26. package/dist/core.js.map +1 -0
  27. package/dist/disposeObject3D-B3HCflvO.js +128 -0
  28. package/dist/disposeObject3D-B3HCflvO.js.map +1 -0
  29. package/dist/environments-B1WaICAN.js +4197 -0
  30. package/dist/environments-B1WaICAN.js.map +1 -0
  31. package/dist/gltfIO-BMK1hc2D.js +9 -0
  32. package/dist/gltfIO-BMK1hc2D.js.map +1 -0
  33. package/dist/grandUrbanBlock-Bdjgc6ZT.js +515 -0
  34. package/dist/grandUrbanBlock-Bdjgc6ZT.js.map +1 -0
  35. package/dist/index.d.ts +275 -0
  36. package/dist/index.js +16239 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/magicCabin-DPQi_jh-.js +11019 -0
  39. package/dist/magicCabin-DPQi_jh-.js.map +1 -0
  40. package/dist/mcp.d.ts +2 -0
  41. package/dist/mcp.js +1 -0
  42. package/dist/monumentHall-IOLbRZQC.js +403 -0
  43. package/dist/monumentHall-IOLbRZQC.js.map +1 -0
  44. package/dist/node.d.ts +16 -0
  45. package/dist/node.js +26 -0
  46. package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
  47. package/dist/ruinedCourtyard-BtaF_aOi.js +696 -0
  48. package/dist/ruinedCourtyard-BtaF_aOi.js.map +1 -0
  49. package/dist/runtime/application/AgentTools.js +28 -0
  50. package/dist/runtime/application/README.md +14 -0
  51. package/dist/runtime/application/agent/ProgressiveAgentTools.js +92 -0
  52. package/dist/runtime/application/agent/StudioMcpAllowlist.js +8 -0
  53. package/dist/runtime/application/buildTaskObservation.js +117 -0
  54. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +46 -0
  55. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +35 -0
  56. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +17 -0
  57. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +72 -0
  58. package/dist/runtime/application/createSession.js +66 -0
  59. package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
  60. package/dist/runtime/application/generation/GenerationOrchestrator.js +629 -0
  61. package/dist/runtime/application/generation/GenerationRuntime.js +214 -0
  62. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +285 -0
  63. package/dist/runtime/application/native-scene/CodeProject.js +119 -0
  64. package/dist/runtime/application/native-scene/CodeProjectModules.js +128 -0
  65. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +62 -0
  66. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
  67. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
  68. package/dist/runtime/application/native-scene/NativeSceneHost.js +319 -0
  69. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
  70. package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
  71. package/dist/runtime/application/object-forge/SceneObjectForge.js +232 -0
  72. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +59 -0
  73. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +22 -0
  74. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +40 -0
  75. package/dist/runtime/application/scene/CapabilityResolver.js +79 -0
  76. package/dist/runtime/application/scene/RequestWindow.js +54 -0
  77. package/dist/runtime/application/scene/SceneAgentTools.js +21 -0
  78. package/dist/runtime/application/scene/SceneContracts.js +45 -0
  79. package/dist/runtime/application/scene/SceneEditService.js +144 -0
  80. package/dist/runtime/application/scene/SceneFacade.js +261 -0
  81. package/dist/runtime/application/scene/SceneInteractionAdapters.js +40 -0
  82. package/dist/runtime/application/scene/SceneJobController.js +229 -0
  83. package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
  84. package/dist/runtime/application/scene/ScenePackage.js +162 -0
  85. package/dist/runtime/application/scene/ScenePersistence.js +50 -0
  86. package/dist/runtime/application/scene/SceneProject.js +95 -0
  87. package/dist/runtime/application/scene/SceneSkillNames.js +5 -0
  88. package/dist/runtime/application/scene/StarterScene.js +56 -0
  89. package/dist/runtime/application/scene/WorldArchive.js +87 -0
  90. package/dist/runtime/application/scene/WorldDirectory.js +20 -0
  91. package/dist/runtime/application/scene/WorldDocument.js +74 -0
  92. package/dist/runtime/application/scene/WorldIO.js +103 -0
  93. package/dist/runtime/application/scene/WorldStorage.js +137 -0
  94. package/dist/runtime/application/skills/SkillRegistry.js +189 -0
  95. package/dist/runtime/application/skills/packs/acceptanceSkills.js +32 -0
  96. package/dist/runtime/application/skills/packs/affordanceSkills.js +36 -0
  97. package/dist/runtime/application/skills/packs/assetSkills.js +46 -0
  98. package/dist/runtime/application/skills/packs/authoringSkills.js +16 -0
  99. package/dist/runtime/application/skills/packs/batchSkills.js +22 -0
  100. package/dist/runtime/application/skills/packs/codeSkills.js +106 -0
  101. package/dist/runtime/application/skills/packs/generationSkills.js +45 -0
  102. package/dist/runtime/application/skills/packs/interactionSkills.js +46 -0
  103. package/dist/runtime/application/skills/packs/recoverySkills.js +80 -0
  104. package/dist/runtime/application/skills/packs/sceneSkills.js +24 -0
  105. package/dist/runtime/application/skills/packs/spatialSkills.js +35 -0
  106. package/dist/runtime/application/skills/packs/verificationSkills.js +14 -0
  107. package/dist/runtime/application/skills/packs/worldSkills.js +45 -0
  108. package/dist/runtime/application/skills/registerCoreSkills.js +31 -0
  109. package/dist/runtime/application/skills/skillPrimitives.js +4 -0
  110. package/dist/runtime/application/tasks/CabinetCupTask.js +76 -0
  111. package/dist/runtime/application/tasks.jsonl +67 -0
  112. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +42 -0
  113. package/dist/runtime/application/world-authoring/AuthoringDiff.js +149 -0
  114. package/dist/runtime/application/world-authoring/AuthoringDocument.js +825 -0
  115. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +109 -0
  116. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +17 -0
  117. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +29 -0
  118. package/dist/runtime/application/world-authoring/AuthoringPatch.js +118 -0
  119. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +334 -0
  120. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +126 -0
  121. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +144 -0
  122. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +174 -0
  123. package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
  124. package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
  125. package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +77 -0
  126. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +1 -0
  127. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +30 -0
  128. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +17 -0
  129. package/dist/runtime/apps/mcp-server/CodeExecutor.js +71 -0
  130. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +42 -0
  131. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +66 -0
  132. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +159 -0
  133. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +8 -0
  134. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +47 -0
  135. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +132 -0
  136. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +6 -0
  137. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +116 -0
  138. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +60 -0
  139. package/dist/runtime/apps/mcp-server/README.md +150 -0
  140. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +1 -0
  141. package/dist/runtime/apps/mcp-server/SandboxBundle.js +13 -0
  142. package/dist/runtime/apps/mcp-server/SessionManager.js +80 -0
  143. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +58 -0
  144. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +190 -0
  145. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +16 -0
  146. package/dist/runtime/apps/mcp-server/VALIDATION.md +45 -0
  147. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +332 -0
  148. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +32 -0
  149. package/dist/runtime/apps/mcp-server/examples/code-house.js +24 -0
  150. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +85 -0
  151. package/dist/runtime/apps/mcp-server/main.mjs +65 -0
  152. package/dist/runtime/apps/mcp-server/registerTools.js +225 -0
  153. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
  154. package/dist/runtime/apps/mcp-server/security.js +21 -0
  155. package/dist/runtime/apps/mcp-server/tasks.jsonl +9 -0
  156. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +157 -0
  157. package/dist/runtime/apps/server/README.md +7 -0
  158. package/dist/runtime/apps/server/WorldDiskStorage.js +51 -0
  159. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +278 -0
  160. package/dist/runtime/apps/server/tasks.jsonl +10 -0
  161. package/dist/runtime/foundation/EventBus.js +18 -0
  162. package/dist/runtime/foundation/JsonGateway.js +47 -0
  163. package/dist/runtime/foundation/PolicyEngine.js +21 -0
  164. package/dist/runtime/foundation/README.md +7 -0
  165. package/dist/runtime/foundation/TraceRecorder.js +76 -0
  166. package/dist/runtime/foundation/errors.js +8 -0
  167. package/dist/runtime/foundation/simulation/SimulationProfile.js +143 -0
  168. package/dist/runtime/foundation/version.js +2 -0
  169. package/dist/runtime/modules/agent/README.md +11 -0
  170. package/dist/runtime/modules/agent/ToolCallingAgent.js +19 -0
  171. package/dist/runtime/modules/agent/bootstrapWorld.js +10 -0
  172. package/dist/runtime/modules/agent/buildRecoveryProposals.js +533 -0
  173. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +128 -0
  174. package/dist/runtime/modules/agent/execution/AgentRunResults.js +55 -0
  175. package/dist/runtime/modules/agent/execution/AgentRunSession.js +393 -0
  176. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +40 -0
  177. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +19 -0
  178. package/dist/runtime/modules/agent/prompt/index.js +52 -0
  179. package/dist/runtime/modules/agent/tasks.jsonl +94 -0
  180. package/dist/runtime/modules/artifact/ArtifactContentGate.js +144 -0
  181. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +280 -0
  182. package/dist/runtime/modules/artifact/ArtifactImporter.js +185 -0
  183. package/dist/runtime/modules/artifact/ArtifactModule.js +111 -0
  184. package/dist/runtime/modules/artifact/ArtifactRegistry.js +197 -0
  185. package/dist/runtime/modules/artifact/IncrementalSha256.js +129 -0
  186. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +115 -0
  187. package/dist/runtime/modules/artifact/README.md +7 -0
  188. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +67 -0
  189. package/dist/runtime/modules/artifact/tasks.jsonl +31 -0
  190. package/dist/runtime/modules/asset/AssetModule.js +399 -0
  191. package/dist/runtime/modules/asset/README.md +54 -0
  192. package/dist/runtime/modules/asset/loading/AssetLoader.js +157 -0
  193. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +61 -0
  194. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +95 -0
  195. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +33 -0
  196. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +103 -0
  197. package/dist/runtime/modules/asset/model/AssetInputContracts.js +100 -0
  198. package/dist/runtime/modules/asset/model/AssetRef.js +12 -0
  199. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +172 -0
  200. package/dist/runtime/modules/asset/model/admission.js +117 -0
  201. package/dist/runtime/modules/asset/model/errors.js +6 -0
  202. package/dist/runtime/modules/asset/model/parts.js +27 -0
  203. package/dist/runtime/modules/asset/model/resourceBudget.js +10 -0
  204. package/dist/runtime/modules/asset/model/schema.js +150 -0
  205. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +78 -0
  206. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +84 -0
  207. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +86 -0
  208. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +81 -0
  209. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +272 -0
  210. package/dist/runtime/modules/asset/production/AssetRecipe.js +47 -0
  211. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +45 -0
  212. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +590 -0
  213. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +173 -0
  214. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +124 -0
  215. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +56 -0
  216. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +6 -0
  217. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +74 -0
  218. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +63 -0
  219. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +48 -0
  220. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +16 -0
  221. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +30 -0
  222. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +75 -0
  223. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +20 -0
  224. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +34 -0
  225. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +32 -0
  226. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +116 -0
  227. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +84 -0
  228. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +63 -0
  229. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +16 -0
  230. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +23 -0
  231. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +50 -0
  232. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +60 -0
  233. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +93 -0
  234. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +32 -0
  235. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +55 -0
  236. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +203 -0
  237. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +43 -0
  238. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +33 -0
  239. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +60 -0
  240. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +23 -0
  241. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +198 -0
  242. package/dist/runtime/modules/asset/registry/AssetCatalog.js +72 -0
  243. package/dist/runtime/modules/asset/registry/AssetRegistry.js +51 -0
  244. package/dist/runtime/modules/asset/registry/manifests/index.js +173 -0
  245. package/dist/runtime/modules/asset/tasks.jsonl +87 -0
  246. package/dist/runtime/modules/generation/README.md +9 -0
  247. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +45 -0
  248. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +169 -0
  249. package/dist/runtime/modules/generation/connector/ConnectorClient.js +192 -0
  250. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +167 -0
  251. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +179 -0
  252. package/dist/runtime/modules/generation/connector/ConnectorSession.js +202 -0
  253. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +239 -0
  254. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +99 -0
  255. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +91 -0
  256. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +50 -0
  257. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +304 -0
  258. package/dist/runtime/modules/generation/tasks.jsonl +35 -0
  259. package/dist/runtime/modules/navigation/NavigationBackend.js +17 -0
  260. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +245 -0
  261. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
  262. package/dist/runtime/modules/physics/PhysicsApiSurface.js +651 -0
  263. package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
  264. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +410 -0
  265. package/dist/runtime/modules/rendering/README.md +7 -0
  266. package/dist/runtime/modules/rendering/RendererProbe.js +153 -0
  267. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +140 -0
  268. package/dist/runtime/modules/rendering/createRenderer.js +76 -0
  269. package/dist/runtime/modules/rendering/disposeObject3D.js +37 -0
  270. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +74 -0
  271. package/dist/runtime/modules/rendering/spatial/ThreeBvhRuntime.js +107 -0
  272. package/dist/runtime/modules/rendering/style/StylePack.js +34 -0
  273. package/dist/runtime/modules/rendering/style/StyleSystem.js +173 -0
  274. package/dist/runtime/modules/rendering/tasks.jsonl +7 -0
  275. package/dist/runtime/modules/world/README.md +13 -0
  276. package/dist/runtime/modules/world/build/WorldBuilder.js +170 -0
  277. package/dist/runtime/modules/world/compiler/PipelineEngine.js +32 -0
  278. package/dist/runtime/modules/world/compiler/WorldAdmission.js +43 -0
  279. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +68 -0
  280. package/dist/runtime/modules/world/compiler/WorldCompilation.js +157 -0
  281. package/dist/runtime/modules/world/compiler/WorldComposer.js +201 -0
  282. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +76 -0
  283. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +356 -0
  284. package/dist/runtime/modules/world/compiler/WorldRetry.js +75 -0
  285. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +379 -0
  286. package/dist/runtime/modules/world/content/blankWorld.js +35 -0
  287. package/dist/runtime/modules/world/content/environments.js +84 -0
  288. package/dist/runtime/modules/world/content/grandUrbanBlock.js +189 -0
  289. package/dist/runtime/modules/world/content/magic-cabin/README.md +28 -0
  290. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +64 -0
  291. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +7078 -0
  292. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +26 -0
  293. package/dist/runtime/modules/world/content/magic-cabin/materials.js +20 -0
  294. package/dist/runtime/modules/world/content/magicCabin.js +190 -0
  295. package/dist/runtime/modules/world/content/monumentHall.js +154 -0
  296. package/dist/runtime/modules/world/content/ruinedCourtyard.js +196 -0
  297. package/dist/runtime/modules/world/content/suzhouGarden/README.md +141 -0
  298. package/dist/runtime/modules/world/content/suzhouGarden/index.js +137 -0
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +491 -0
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +670 -0
  301. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +578 -0
  302. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +127 -0
  303. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +642 -0
  304. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +650 -0
  305. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +280 -0
  306. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +242 -0
  307. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +215 -0
  308. package/dist/runtime/modules/world/content/woodlandWorkshop.js +192 -0
  309. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +36 -0
  310. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +351 -0
  311. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +490 -0
  312. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +505 -0
  313. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +101 -0
  314. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +435 -0
  315. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +169 -0
  316. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +245 -0
  317. package/dist/runtime/modules/world/errors.js +9 -0
  318. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +50 -0
  319. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +297 -0
  320. package/dist/runtime/modules/world/runtime/CommandHistory.js +80 -0
  321. package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +150 -0
  322. package/dist/runtime/modules/world/runtime/ObjectStore.js +31 -0
  323. package/dist/runtime/modules/world/runtime/ObjectTransform.js +62 -0
  324. package/dist/runtime/modules/world/runtime/ObservedEntity.js +37 -0
  325. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +207 -0
  326. package/dist/runtime/modules/world/runtime/SceneSerializer.js +246 -0
  327. package/dist/runtime/modules/world/runtime/WorldAuthority.js +41 -0
  328. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +14 -0
  329. package/dist/runtime/modules/world/runtime/WorldCommands.js +502 -0
  330. package/dist/runtime/modules/world/runtime/WorldObservation.js +71 -0
  331. package/dist/runtime/modules/world/runtime/WorldQueries.js +340 -0
  332. package/dist/runtime/modules/world/runtime/WorldRecovery.js +78 -0
  333. package/dist/runtime/modules/world/runtime/WorldRuntime.js +665 -0
  334. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +107 -0
  335. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +130 -0
  336. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +79 -0
  337. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +195 -0
  338. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +70 -0
  339. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +115 -0
  340. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +305 -0
  341. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +214 -0
  342. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +65 -0
  343. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +222 -0
  344. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +130 -0
  345. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
  346. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
  347. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +120 -0
  348. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +102 -0
  349. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
  350. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +99 -0
  351. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
  352. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
  353. package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +125 -0
  354. package/dist/runtime/modules/world/runtime/systems/Instrument.js +38 -0
  355. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +728 -0
  356. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +269 -0
  357. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +469 -0
  358. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1673 -0
  359. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +457 -0
  360. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +284 -0
  361. package/dist/runtime/modules/world/spec/WorldIR.js +165 -0
  362. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +86 -0
  363. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +51 -0
  364. package/dist/runtime/modules/world/spec/WorldRevision.js +231 -0
  365. package/dist/runtime/modules/world/spec/WorldSpec.js +86 -0
  366. package/dist/runtime/modules/world/tasks.jsonl +530 -0
  367. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +254 -0
  368. package/dist/runtime/modules/world/verification/Finding.js +105 -0
  369. package/dist/runtime/modules/world/verification/InteractionEvidence.js +69 -0
  370. package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
  371. package/dist/runtime/modules/world/verification/WorldAcceptance.js +158 -0
  372. package/dist/runtime/modules/world/verification/WorldValidator.js +65 -0
  373. package/dist/runtime/package-lock.json +16048 -0
  374. package/dist/runtime/package.json +105 -0
  375. package/dist/runtime/public/assets/cabinet.glb +0 -0
  376. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  377. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  379. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  380. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  381. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  382. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  383. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  384. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  385. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  386. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  387. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  388. package/dist/schema-BWpTl0Wj.js +359 -0
  389. package/dist/schema-BWpTl0Wj.js.map +1 -0
  390. package/dist/suzhouGarden-H9tiPgxq.js +6150 -0
  391. package/dist/suzhouGarden-H9tiPgxq.js.map +1 -0
  392. package/dist/woodlandWorkshop-D6zzSbHr.js +483 -0
  393. package/dist/woodlandWorkshop-D6zzSbHr.js.map +1 -0
  394. package/dist/yuanmingyuan-D6IHqjZ-.js +4955 -0
  395. package/dist/yuanmingyuan-D6IHqjZ-.js.map +1 -0
  396. package/package.json +70 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ruinedCourtyard-BtaF_aOi.js","names":[],"sources":["../../../modules/world/content/ruinedCourtyard.js"],"sourcesContent":["import * as THREE from 'three';\r\n\r\nexport const RUINED_COURTYARD_ASSETS = Object.freeze({\r\n hdri: '/assets/ruined-courtyard/courtyard_1k.hdr',\r\n groundDiffuse: '/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg',\r\n groundNormal: '/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg',\r\n wallDiffuse: '/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg'\r\n});\r\n\r\nconst box = (halfExtents, translation, rotation = null) => ({ shape:'box', halfExtents, translation, ...(rotation ? { rotation } : {}) });\r\nconst cylinder = (radius, halfHeight, translation, rotation = null) => ({ shape:'cylinder', radius, halfHeight, translation, ...(rotation ? { rotation } : {}) });\r\nconst qx = (a) => [Math.sin(a / 2), 0, 0, Math.cos(a / 2)];\r\nconst qy = (a) => [0, Math.sin(a / 2), 0, Math.cos(a / 2)];\r\nconst qz = (a) => [0, 0, Math.sin(a / 2), Math.cos(a / 2)];\r\nconst rotateXZ = (x, z, a) => [Math.cos(a) * x + Math.sin(a) * z, -Math.sin(a) * x + Math.cos(a) * z];\r\nconst archColliders = (x, z, angle = 0) => {\r\n const rotation = qy(angle);\r\n const at = (lx, y, lz) => {\r\n const [dx, dz] = rotateXZ(lx, lz, angle);\r\n return [x + dx, y, z + dz];\r\n };\r\n return [\r\n box([.55, 2.4, .375], at(-2.45, 2.4, 0), rotation),\r\n box([.55, 2.4, .375], at(2.45, 2.4, 0), rotation),\r\n box([3, .5, .375], at(0, 5, 0), rotation)\r\n ];\r\n};\r\n\r\nconst EAST_STEPS = Array.from({ length:6 }, (_, i) => box([.25, (i + 1) * .1, 2.1], [4.25 + i * .5, (i + 1) * .1, 4.8]));\r\nconst WEST_STEPS = Array.from({ length:4 }, (_, i) => box([.25, (i + 1) * .1, 1.8], [-5.95 - i * .5, (i + 1) * .1, -6.2]));\r\n\r\nexport const RUINED_COURTYARD_COLLIDERS = Object.freeze([\r\n box([18, .15, 15], [0, -.15, 0]),\r\n box([5.2, .6, 5.4], [12.2, .6, 4.8]),\r\n box([4.5, .4, 4.6], [-12.2, .4, -6.2]),\r\n ...EAST_STEPS,\r\n ...WEST_STEPS,\r\n box([5.8, 2.4, .28], [-11.9, 2.4, -14.6]),\r\n box([5.8, 2.4, .28], [11.9, 2.4, -14.6]),\r\n box([2.2, .75, .28], [0, 4.05, -14.6]),\r\n box([.28, 2.7, 5.2], [-17.6, 2.7, -7.8]),\r\n box([.28, 1.9, 3.1], [-17.6, 1.9, 7.8]),\r\n box([.28, 2.2, 4.4], [17.6, 2.2, -8.4]),\r\n box([.28, 1.5, 2.6], [17.6, 1.5, 8.8]),\r\n ...archColliders(0, -14.25),\r\n ...archColliders(-17.25, 1.3, Math.PI / 2),\r\n ...archColliders(17.25, 1.0, -Math.PI / 2),\r\n cylinder(2.0, .42, [0, .42, -1.8]),\r\n cylinder(.42, 3.2, [-6.2, .55, 3.7], qz(Math.PI / 2)),\r\n cylinder(.38, 2.5, [7.2, .5, -8.0], qx(Math.PI / 2)),\r\n box([2.1, .45, .55], [-3.8, .45, 9.6], qz(-.18)),\r\n box([1.7, .35, .5], [4.6, .35, 10.4], qz(.13))\r\n]);\r\n\r\nconst mesh = (geometry, material, { position, rotation, name, castShadow = true, receiveShadow = true, navigationIgnore = false } = {}) => {\r\n const value = new THREE.Mesh(geometry, material);\r\n if (position) value.position.set(...position);\r\n if (rotation) value.rotation.set(...rotation);\r\n value.name = name || '';\r\n value.castShadow = castShadow;\r\n value.receiveShadow = receiveShadow;\r\n if (navigationIgnore) value.userData.navigationIgnore = true;\r\n return value;\r\n};\r\n\r\nconst tile = (texture, repeat, color = false) => {\r\n texture.wrapS = texture.wrapT = THREE.RepeatWrapping;\r\n texture.repeat.set(...repeat);\r\n texture.anisotropy = 4;\r\n if (color) texture.colorSpace = THREE.SRGBColorSpace;\r\n return texture;\r\n};\r\n\r\nconst addArch = (root, material, x, z, rotationY = 0, name = 'Arch') => {\r\n const group = new THREE.Group();\r\n group.name = name;\r\n group.position.set(x, 0, z);\r\n group.rotation.y = rotationY;\r\n group.add(\r\n mesh(new THREE.BoxGeometry(1.1, 4.8, .75), material, { position:[-2.45, 2.4, 0] }),\r\n mesh(new THREE.BoxGeometry(1.1, 4.8, .75), material, { position:[2.45, 2.4, 0] }),\r\n mesh(new THREE.BoxGeometry(6, 1.0, .75), material, { position:[0, 5.0, 0] }),\r\n mesh(new THREE.TorusGeometry(2.45, .28, 10, 48, Math.PI), material, { position:[0, 4.25, 0], rotation:[0, 0, Math.PI], navigationIgnore:true })\r\n );\r\n root.add(group);\r\n};\r\n\r\nconst addGrass = (root) => {\r\n const geometry = new THREE.ConeGeometry(.08, .55, 5);\r\n const material = new THREE.MeshStandardMaterial({ color:0x405d31, roughness:.9 });\r\n const patches = [[-14,0,11],[-11,0,7],[-7,0,12],[-3,0,11],[3,0,12],[8,0,11],[12,1.2,5],[14,1.2,2],[-13,.8,-5],[-11,.8,-9],[14,0,-10],[8,0,-12]];\r\n const instanced = new THREE.InstancedMesh(geometry, material, patches.length * 9);\r\n instanced.name = 'CourtyardGrass';\r\n instanced.userData.navigationIgnore = true;\r\n instanced.castShadow = true;\r\n instanced.receiveShadow = true;\r\n const matrix = new THREE.Matrix4();\r\n let index = 0;\r\n for (const [x, y, z] of patches) {\r\n for (let i = 0; i < 9; i++) {\r\n const px = x + ((i * 37) % 7 - 3) * .16;\r\n const pz = z + ((i * 53) % 7 - 3) * .15;\r\n const scale = .55 + ((i * 29) % 5) * .12;\r\n matrix.compose(new THREE.Vector3(px, y + .25 * scale, pz), new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), i * .77), new THREE.Vector3(scale, scale, scale));\r\n instanced.setMatrixAt(index++, matrix);\r\n }\r\n }\r\n instanced.instanceMatrix.needsUpdate = true;\r\n root.add(instanced);\r\n};\r\n\r\nexport function createRuinedCourtyard({ loadAssets = true } = {}) {\r\n const root = new THREE.Group();\r\n root.name = 'RuinedCourtyard';\r\n root.userData.environment = 'ruined-courtyard';\r\n\r\n const ground = new THREE.MeshStandardMaterial({ color:0x66655a, roughness:.94, metalness:0 });\r\n const sandstone = new THREE.MeshStandardMaterial({ color:0x777568, roughness:.92 });\r\n const darkStone = new THREE.MeshStandardMaterial({ color:0x343932, roughness:.98 });\r\n const water = new THREE.MeshPhysicalMaterial({ color:0x203f43, roughness:.2, transmission:.08, transparent:true, opacity:.72 });\r\n\r\n const floor = mesh(new THREE.BoxGeometry(36, .3, 30), ground, { position:[0, -.15, 0], name:'CourtyardFloor', castShadow:false });\r\n root.add(floor);\r\n root.add(\r\n mesh(new THREE.BoxGeometry(10.4, 1.2, 10.8), darkStone, { position:[12.2, .6, 4.8], name:'EastTerrace' }),\r\n mesh(new THREE.BoxGeometry(9, .8, 9.2), darkStone, { position:[-12.2, .4, -6.2], name:'WestTerrace' })\r\n );\r\n\r\n for (let i = 0; i < 6; i++) root.add(mesh(new THREE.BoxGeometry(.5, (i + 1) * .2, 4.2), ground, { position:[4.25 + i * .5, (i + 1) * .1, 4.8], name:`EastStep_${i}` }));\r\n for (let i = 0; i < 4; i++) root.add(mesh(new THREE.BoxGeometry(.5, (i + 1) * .2, 3.6), ground, { position:[-5.95 - i * .5, (i + 1) * .1, -6.2], name:`WestStep_${i}` }));\r\n\r\n const wall = (size, position, name) => root.add(mesh(new THREE.BoxGeometry(...size), sandstone, { position, name, castShadow:false }));\r\n wall([11.6, 4.8, .56], [-11.9, 2.4, -14.6], 'NorthWallWest');\r\n wall([11.6, 4.8, .56], [11.9, 2.4, -14.6], 'NorthWallEast');\r\n wall([4.4, 1.5, .56], [0, 4.05, -14.6], 'NorthLintel');\r\n wall([.56, 5.4, 10.4], [-17.6, 2.7, -7.8], 'WestWallNorth');\r\n wall([.56, 3.8, 6.2], [-17.6, 1.9, 7.8], 'WestWallSouth');\r\n wall([.56, 4.4, 8.8], [17.6, 2.2, -8.4], 'EastWallNorth');\r\n wall([.56, 3.0, 5.2], [17.6, 1.5, 8.8], 'EastWallSouth');\r\n\r\n addArch(root, sandstone, 0, -14.25, 0, 'NorthGate');\r\n addArch(root, sandstone, -17.25, 1.3, Math.PI / 2, 'WestArcade');\r\n addArch(root, sandstone, 17.25, 1.0, -Math.PI / 2, 'EastArcade');\r\n\r\n root.add(\r\n mesh(new THREE.CylinderGeometry(2, 2.25, .84, 40), darkStone, { position:[0, .42, -1.8], name:'DryFountain' }),\r\n mesh(new THREE.CylinderGeometry(1.55, 1.55, .06, 40), water, { position:[0, .87, -1.8], name:'FountainWater', castShadow:false, receiveShadow:false, navigationIgnore:true }),\r\n mesh(new THREE.CylinderGeometry(.42, .46, 6.4, 18), sandstone, { position:[-6.2, .55, 3.7], rotation:[0, 0, Math.PI / 2], name:'FallenColumnWest' }),\r\n mesh(new THREE.CylinderGeometry(.38, .42, 5, 18), sandstone, { position:[7.2, .5, -8], rotation:[Math.PI / 2, 0, 0], name:'FallenColumnEast' }),\r\n mesh(new THREE.BoxGeometry(4.2, .9, 1.1), sandstone, { position:[-3.8, .45, 9.6], rotation:[0, 0, -.18], name:'CollapsedBeamWest' }),\r\n mesh(new THREE.BoxGeometry(3.4, .7, 1), sandstone, { position:[4.6, .35, 10.4], rotation:[0, 0, .13], name:'CollapsedBeamEast' })\r\n );\r\n\r\n for (const [x, y, z, s] of [[-14,.82,9,.65],[-9,.2,10,.45],[-3,.2,12,.5],[5,.2,12,.4],[13,1.35,7,.5],[-13,1.0,-10,.55],[12,.2,-11,.5]]) {\r\n const rock = mesh(new THREE.DodecahedronGeometry(s, 0), darkStone, { position:[x, y, z], name:'Rubble', navigationIgnore:true });\r\n rock.rotation.set(.2 + x * .01, .4 + z * .02, .15);\r\n root.add(rock);\r\n }\r\n addGrass(root);\r\n\r\n const hemi = new THREE.HemisphereLight(0xc8d6c2, 0x263127, 1.9);\r\n const sun = new THREE.DirectionalLight(0xffe0ad, 4.1);\r\n sun.position.set(-11, 17, 10);\r\n sun.castShadow = true;\r\n sun.shadow.mapSize.set(2048, 2048);\r\n Object.assign(sun.shadow.camera, { left:-24, right:24, top:20, bottom:-20, near:1, far:55 });\r\n const fill = new THREE.DirectionalLight(0x91aec4, .8);\r\n fill.position.set(12, 8, -14);\r\n root.add(hemi, sun, fill);\r\n\r\n let active = true;\r\n const loader = loadAssets ? new THREE.TextureLoader() : null;\r\n const loadTexture = (url, configure, apply) => loader?.load(url, (texture) => {\r\n if (!active) { texture.dispose(); return; }\r\n configure?.(texture);\r\n apply(texture);\r\n });\r\n if (loadAssets) {\r\n loadTexture(RUINED_COURTYARD_ASSETS.groundDiffuse, (t) => tile(t, [12, 10], true), (t) => { ground.map = t; ground.needsUpdate = true; });\r\n loadTexture(RUINED_COURTYARD_ASSETS.groundNormal, (t) => tile(t, [12, 10]), (t) => { ground.normalMap = t; ground.normalScale.set(.42, .42); ground.needsUpdate = true; });\r\n loadTexture(RUINED_COURTYARD_ASSETS.wallDiffuse, (t) => tile(t, [5, 3], true), (t) => { sandstone.map = t; sandstone.needsUpdate = true; });\r\n }\r\n\r\n return {\r\n id:'ruined-courtyard',\r\n root,\r\n floor,\r\n colliders:RUINED_COURTYARD_COLLIDERS.map((value) => structuredClone(value)),\r\n layout:{bounds:{min:[-17,-14],max:[17,14]},groundY:0,margin:1},\r\n camera:{ position:[16.8, 8.8, 19.5], target:[0, 1.2, -2.6] },\r\n rendering:{ background:0x667160, fog:{ color:0x667160, near:24, far:72 }, exposure:1.08 , ibl:loadAssets?{url:RUINED_COURTYARD_ASSETS.hdri,intensity:1}:null },\r\n dispose() {\r\n active = false;\r\n }\r\n };\r\n}\r\n"],"mappings":";;AAEA,MAAa,0BAA0B,OAAO,OAAO;CACnD,MAAM;CACN,eAAe;CACf,cAAc;CACd,aAAa;AACf,CAAC;AAED,MAAM,OAAO,aAAa,aAAa,WAAW,UAAU;CAAE,OAAM;CAAO;CAAa;CAAa,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;AAAG;AACvI,MAAM,YAAY,QAAQ,YAAY,aAAa,WAAW,UAAU;CAAE,OAAM;CAAY;CAAQ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AAK,GAAG,CAAC,IAAI,EAAE,GAAG,IAAI,IAAI,MAAM;GAAE,OAAO,MAAM;GAAG,OAAO,cAAc;EAAM,CAAC;EACxI,YAAY,wBAAwB,eAAe,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,MAAM;GAAE,OAAO,YAAY;GAAG,OAAO,YAAY,IAAI,KAAK,GAAG;GAAG,OAAO,cAAc;EAAM,CAAC;EACzK,YAAY,wBAAwB,cAAc,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,MAAM;GAAE,UAAU,MAAM;GAAG,UAAU,cAAc;EAAM,CAAC;CAC5I;CAEA,OAAO;EACL,IAAG;EACH;EACA;EACA,WAAU,2BAA2B,KAAK,UAAU,gBAAgB,KAAK,CAAC;EAC1E,QAAO;GAAC,QAAO;IAAC,KAAI,CAAC,KAAI,GAAG;IAAE,KAAI,CAAC,IAAG,EAAE;GAAC;GAAE,SAAQ;GAAE,QAAO;EAAC;EAC7D,QAAO;GAAE,UAAS;IAAC;IAAM;IAAK;GAAI;GAAG,QAAO;IAAC;IAAG;IAAK;GAAI;EAAE;EAC3D,WAAU;GAAE,YAAW;GAAU,KAAI;IAAE,OAAM;IAAU,MAAK;IAAI,KAAI;GAAG;GAAG,UAAS;GAAO,KAAI,aAAW;IAAC,KAAI,wBAAwB;IAAK,WAAU;GAAC,IAAE;EAAK;EAC7J,UAAU;GACR,SAAS;EACX;CACF;AACF"}
@@ -0,0 +1,28 @@
1
+ import { buildTaskObservation } from './buildTaskObservation.js';
2
+
3
+ export class AgentTools {
4
+ constructor(runtime, { profile = 'builder', actor = 'agent', source = null } = {}) {
5
+ this.runtime = runtime;
6
+ this.profile = profile;
7
+ this.actor = actor;
8
+ this.source = source;
9
+ }
10
+
11
+ definitions() { return this.runtime.skills.definitions(); }
12
+ executionPolicy(name, result) { return this.runtime.skills.executionPolicy(name, result); }
13
+ taskObservation(state = {}) { return buildTaskObservation(this.runtime,{ actor:this.actor,...state }); }
14
+ recordSequence(payload) {
15
+ const event={...payload,...(this.source?{source:this.source}:{})};
16
+ this.runtime.events.emit('agent.sequence', event);
17
+ this.runtime.trace?.emit('agent.sequence', event, { actor:this.actor });
18
+ }
19
+ async call(name, args = {}, internalContext = {}) {
20
+ this.runtime.events.emit('tool.called', { name, args, ...(this.source?{source:this.source}:{}) });
21
+ const response = await this.runtime.skills.invoke(name, args, { ...internalContext, profile:this.profile, actor:this.actor });
22
+ if (!response.success) throw Object.assign(new Error(response.error.message), {
23
+ code:response.error.code,
24
+ ...(response.error.details ? { diagnostics:response.error.details } : {})
25
+ });
26
+ return response.result;
27
+ }
28
+ }
@@ -0,0 +1,14 @@
1
+ # Application
2
+
3
+ 自由代码世界入口:`native-scene/CodeProject.js`。它承载持续项目模块并通过既有 SceneFacade 暴露动态能力,复用 Runtime 与资产迁移;契约见 `docs/modules/code-project.md`,示例在 `examples/code-project/`。
4
+
5
+ 跨域工作现场:装配模块、注册产品 Skills、组装 Agent 观察,协调生成到资产再到世界的流程。
6
+
7
+ 入口:createSession.js、skills/registerCoreSkills.js、generation/GenerationRuntime.js。
8
+ Studio 使用 createSession 创建 World、Asset、Generation 与 Skills;初始化顺序和宿主帧循环仍由 Studio 控制。
9
+ AgentTools 和 buildTaskObservation 放在这里,Agent 执行循环不需要知道各模块的内部装配。
10
+
11
+ generation/ 保留已有协调文件,不再属于 modules/generation。此处不拥有第二份资产或世界事实。
12
+ 当前仍通过 world.generation/world.skills 连接既有代码;进一步缩小接口应按具体任务进行,不能仅靠搬文件宣称解耦完成。
13
+
14
+ 任务见 tasks.jsonl。验证:npm run world:viability 与 npm run test。
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Studio-only progressive disclosure for the large runtime tool catalog.
3
+ * Discovery changes LLM visibility, not Runtime permissions or capabilities.
4
+ */
5
+ const INITIAL_TOOLS = Object.freeze([
6
+ 'listObjects', 'observeScene', 'verifyScene', 'planSceneTask', 'interactScene',
7
+ 'searchAssets', 'generateAsset', 'addSceneModel',
8
+ 'approachAndInteract', 'approachAndPickup', 'approachAndPlace',
9
+ 'navigateTo', 'listInteractablesNearMe',
10
+ 'readStudioProject', 'writeStudioProject', 'readStudioFile', 'editStudioFile',
11
+ 'previewStudioProjectBatch', 'applyStudioProjectBatch', 'runStudioProject', 'saveStudioProject'
12
+ ]);
13
+
14
+ const DISCOVER = Object.freeze({
15
+ name:'discoverAgentTools',
16
+ description:'List additional available tool names and short descriptions, or activate up to 20 named tools for the next planning round. Call with {} to inspect the catalog; then call with names:[...] to expose full JSON schemas. This changes only tool visibility, never world state.',
17
+ parameters:{
18
+ type:'object',
19
+ properties:{
20
+ query:{type:'string',description:'Optional name/description search; omit to list every available tool.'},
21
+ names:{type:'array',items:{type:'string'},minItems:1,maxItems:20,description:'Existing tool names to expose in subsequent planning rounds.'}
22
+ },
23
+ additionalProperties:false
24
+ }
25
+ });
26
+
27
+ function invalidCatalogRequest(message) {
28
+ const error = new Error(message);
29
+ error.code = 'TOOL_DISCOVERY_INVALID';
30
+ return error;
31
+ }
32
+
33
+ /** Wrap only the LLM-facing Studio tools. Direct Studio/MCP invocations remain unchanged. */
34
+ export function createProgressiveAgentTools(base, { initialNames = INITIAL_TOOLS } = {}) {
35
+ if (!base || typeof base.definitions !== 'function' || typeof base.call !== 'function')
36
+ throw new TypeError('Progressive tools require AgentTools');
37
+ let exposed = new Set(initialNames);
38
+ const fullDefinitions = () => base.definitions();
39
+
40
+ return {
41
+ get runtime() { return base.runtime; },
42
+ get actor() { return base.actor; },
43
+ beginTask(text) {
44
+ exposed = new Set(initialNames);
45
+ base.beginTask?.(text);
46
+ },
47
+ fullDefinitions,
48
+ definitions() {
49
+ return [...fullDefinitions().filter(tool => exposed.has(tool.name)), DISCOVER];
50
+ },
51
+ executionPolicy(name, result) {
52
+ if (name === DISCOVER.name) return {
53
+ mutates:false, history:false, barrier:false, auxiliary:true,
54
+ tracksUnresolved:false, batchable:false, batchAcceptable:true,
55
+ outcome:{state:'accepted',verified:null}
56
+ };
57
+ return base.executionPolicy(name,result);
58
+ },
59
+ taskObservation(state) { return base.taskObservation?.(state) || null; },
60
+ recordSequence(payload) { return base.recordSequence?.(payload); },
61
+ async call(name, args = {}, context = {}) {
62
+ if (name !== DISCOVER.name) return base.call(name,args,context);
63
+ const catalog = fullDefinitions();
64
+ const byName = new Map(catalog.map(tool => [tool.name,tool]));
65
+ base.runtime?.events?.emit?.('tool.called',{name,args,source:'studio-agent-discovery'});
66
+ if (args.names !== undefined) {
67
+ if (!Array.isArray(args.names) || args.names.length < 1 || args.names.length > 20)
68
+ throw invalidCatalogRequest('names must contain 1-20 available tool names');
69
+ const names = [...new Set(args.names)];
70
+ const unknown = names.filter(value => typeof value !== 'string' || !byName.has(value));
71
+ if (unknown.length) throw invalidCatalogRequest('Unknown tool names: ' + unknown.map(String).join(', '));
72
+ for (const value of names) exposed.add(value);
73
+ return {status:'tool-catalog-updated',exposed:names,
74
+ totalExposed:catalog.filter(tool=>exposed.has(tool.name)).length,
75
+ instruction:'The named tool schemas will appear in the next planning round.'};
76
+ }
77
+ if (args.query !== undefined && typeof args.query !== 'string')
78
+ throw invalidCatalogRequest('query must be a string');
79
+ const query=(args.query || '').trim().toLowerCase();
80
+ const remaining=catalog.filter(tool=>!exposed.has(tool.name));
81
+ const matched=query
82
+ ? remaining.filter(tool=>(tool.name+' '+(tool.description||'')).toLowerCase().includes(query))
83
+ : remaining;
84
+ return {
85
+ status:'tool-catalog',totalAvailable:catalog.length,totalHidden:remaining.length,
86
+ query:query || null,
87
+ tools:matched.map(tool=>({name:tool.name,description:String(tool.description || '').slice(0,125)})),
88
+ instruction:'Call discoverAgentTools with names:[...] to expose selected tool schemas.'
89
+ };
90
+ }
91
+ };
92
+ }
@@ -0,0 +1,8 @@
1
+ /** Tools available to external Pi and DSH agents. Never expose host-code execution. */
2
+ export const AGENT_STUDIO_MCP_TOOLS = Object.freeze([
3
+ 'session_attach','studio_session_status',
4
+ 'scene_observe','scene_verify','scene_add_model','scene_apply',
5
+ 'scene_interact','scene_job','scene_cancel','studio_project',
6
+ 'asset_build_submit','asset_build_status','asset_publish','asset_inspect'
7
+ ]);
8
+ export const AGENT_STUDIO_MCP_SET = new Set(AGENT_STUDIO_MCP_TOOLS);
@@ -0,0 +1,117 @@
1
+ const round = (value, digits = 3) => Number.isFinite(value) ? Number(value.toFixed(digits)) : value;
2
+ const roundVec = (value) => Array.isArray(value) ? value.map((item) => round(item)) : value;
3
+
4
+ const relevantIds = (actor, lastMutation, unresolved = []) => {
5
+ const ids = new Set(actor ? [actor] : []);
6
+ const addArgs = (args = {}) => {
7
+ for (const key of ['actorId','id','targetId','supportId','instanceId']) if (typeof args[key] === 'string') ids.add(args[key]);
8
+ for(const key of ['actor','target'])if(typeof args.interaction?.[key]==='string')ids.add(args.interaction[key]);
9
+ };
10
+ addArgs(lastMutation?.args);
11
+ for (const entry of unresolved) addArgs(entry?.args);
12
+ return [...ids];
13
+ };
14
+
15
+ const recoveryHints = (focusMutation) => {
16
+ const outcome = focusMutation?.outcome;
17
+ if (!outcome || ['verified','accepted'].includes(outcome.state)) return [];
18
+ const reason = outcome.reason || outcome.status || outcome.state;
19
+ const hint = (tool, purpose) => ({ tool,purpose,status:'provisional',basedOn:reason });
20
+ if (['STALL','LIMIT_VIOLATION','TIMEOUT','JOINT_STATE_UNAVAILABLE'].includes(reason)) {
21
+ return [{ action:'report-incomplete-or-retry-after-world-change', purpose:'Live articulation evidence is already embedded in this task observation; do not repeat articulation reads unless the world changes.', status:'provisional', basedOn:reason }];
22
+ }
23
+ if (['CARRIED_OBJECT_BLOCKED','APPROACH_FAILED','NO_INTERACTION_POSE'].includes(reason)) {
24
+ return [{ action:'replan-from-current-pose', purpose:'Current locomotion and carry state are already embedded; choose a different verified route/action or report blocked.', status:'provisional', basedOn:reason }];
25
+ }
26
+ if (['PLACE_TRANSFER_BLOCKED','CARRY_REORIENT_BLOCKED','RELEASE_OUT_OF_RANGE','NO_FREE_SURFACE_SPACE_AFTER_APPROACH'].includes(reason)) {
27
+ return [hint('findFreeSpace','Re-evaluate support-surface free space; any subsequent place attempt must still pass embodied reach and collision checks.')];
28
+ }
29
+ if (['SUPPORT_NOT_REACHED','SETTLE_TIMEOUT'].includes(reason)) {
30
+ return [{ action:'report-unverified-or-retry-place', purpose:'Relevant support relations are already embedded when available; do not claim success without a new verified place outcome.', status:'provisional', basedOn:reason }];
31
+ }
32
+ if (String(reason).includes('PATH') || String(reason).includes('NAVIGATION')) {
33
+ return [hint('suggestNavigationActions','Request provisional action-aware navigation diagnosis, then re-query the real path after any world change.')];
34
+ }
35
+ return [{ purpose:'Re-observe the failed semantic step before any dependent mutation.', status:'provisional', basedOn:reason }];
36
+ };
37
+
38
+ export function buildTaskObservation(runtime, {
39
+ actor = 'agent_01',
40
+ lastMutation = null,
41
+ unresolvedMutations = [],
42
+ maxRelations = 8
43
+ } = {}) {
44
+ const view = runtime.observation;
45
+ if (!view?.object || !view?.relations || !view?.actor || !view?.articulation) {
46
+ throw new TypeError('buildTaskObservation requires WorldRuntime.observation');
47
+ }
48
+ const ids = relevantIds(actor,lastMutation,unresolvedMutations);
49
+ const objects = ids.map((id)=>view.object(id)).filter(Boolean).map((item)=>({
50
+ id:item.id,asset:item.asset,type:item.type,...(item.position ? {position:roundVec(item.position)} : {})
51
+ }));
52
+
53
+ const focusMutation=(lastMutation && !['verified','accepted'].includes(lastMutation.outcome?.state)) ? lastMutation : unresolvedMutations.at(-1);
54
+ const observation = {
55
+ schema:'agentscape.task-observation.v1',
56
+ actor:{ id:actor },
57
+ lastMutation:lastMutation ? structuredClone(lastMutation) : null,
58
+ unresolvedMutations:unresolvedMutations.map((entry)=>structuredClone(entry)),
59
+ objects,
60
+ relations:view.relations(ids,{limit:maxRelations}).map((edge)=>({
61
+ subject:edge.subject,predicate:edge.predicate,object:edge.object,
62
+ ...(edge.meta?.distance != null ? {distance:round(edge.meta.distance)} : {}),
63
+ ...(edge.meta?.surfaceId ? {surfaceId:edge.meta.surfaceId} : {})
64
+ })),
65
+ recoveryHints:recoveryHints(focusMutation)
66
+ };
67
+
68
+ const actorState=view.actor(actor);
69
+ if (actorState?.position) observation.actor.position=roundVec(actorState.position);
70
+ if (actorState?.navigation) observation.actor.navigation=actorState.navigation;
71
+ if (actorState?.carry) observation.actor.carry=actorState.carry;
72
+
73
+ const articulation = [];
74
+ const affordances=view.affordances?.(ids,{actorId:actor}) || null;
75
+ if(affordances) observation.worldAffordances={count:affordances.count,discoverWith:'listWorldAffordances',lastResult:affordances.lastResult,focus:affordances.focus};
76
+ for (const id of ids) {
77
+ const status=view.articulation(id);
78
+ if (!status) continue;
79
+ articulation.push({
80
+ id:status.id,
81
+ parts:(status.parts || []).map((part)=>({
82
+ partName:part.partName,status:part.status,
83
+ requestedAction:part.requestedAction ?? null,verifiedAction:part.verifiedAction ?? null,
84
+ ...(part.live ? { live:{
85
+ coordinate:round(part.live.coordinate),target:round(part.live.target),error:round(part.live.error),tolerance:round(part.live.tolerance),coordinateReference:part.live.coordinateReference
86
+ } } : {}),
87
+ ...(part.last ? { last:{
88
+ status:part.last.status,reason:part.last.reason || null,targetReached:part.last.targetReached ?? null,settled:part.last.settled ?? null,
89
+ ...(part.last.attribution ? { attribution:{
90
+ status:part.last.attribution.status,
91
+ evidence:part.last.attribution.evidence,
92
+ blockerCandidates:(part.last.attribution.blockerCandidates || []).map((item)=>structuredClone(item)),
93
+ contactEvidence:(part.last.attribution.contactEvidence || []).slice(0,4).map((item)=>({
94
+ source:structuredClone(item.source),target:structuredClone(item.target),
95
+ contactCount:item.contactCount,activeContactCount:item.activeContactCount,minDistance:round(item.minDistance),totalImpulse:round(item.totalImpulse),
96
+ evidenceKind:item.evidenceKind || 'contact',impulseAvailable:item.impulseAvailable===true,normal:roundVec(item.normal)
97
+ }))
98
+ } } : {})
99
+ } } : {})
100
+ }))
101
+ });
102
+ }
103
+ if (articulation.length) observation.articulation=articulation;
104
+ const focusTargetId=focusMutation?.args?.targetId || focusMutation?.args?.id || null;
105
+ const focusPartName=focusMutation?.args?.partName || null;
106
+ const focusReason=focusMutation?.outcome?.reason || focusMutation?.outcome?.status || null;
107
+ const attributedFailure=focusReason==='STALL' ? articulation.flatMap((entry)=>entry.parts.map((part)=>({id:entry.id,part})))
108
+ .find(({id,part})=>id===focusTargetId && (!focusPartName || part.partName===focusPartName) && part.last?.reason==='STALL' && part.last?.attribution?.status==='contact-evidence' && part.last.attribution.blockerCandidates?.length) : null;
109
+ if (attributedFailure) observation.recoveryHints=[{
110
+ tool:'suggestRecoveryActions',
111
+ args:{actorId:actor,targetId:attributedFailure.id,partName:attributedFailure.part.partName},
112
+ purpose:'Evaluate current contact blocker candidates against embodied capability and Policy before any recovery mutation.',
113
+ status:'provisional',basedOn:'current-contact-at-failure'
114
+ }];
115
+
116
+ return observation;
117
+ }
@@ -0,0 +1,46 @@
1
+ import * as THREE from 'three';
2
+ import { captureAuthoringState, exportAuthoringDocument, hydrateAuthoringState, parseAuthoringDocument } from '../world-authoring/AuthoringDocument.js';
3
+ import { validateRemoteAuthoringDocument } from './RemoteAuthoringDocument.js';
4
+ const defaultBeforeRender=THREE.Object3D.prototype.onBeforeRender;
5
+ const defaultAfterRender=THREE.Object3D.prototype.onAfterRender;
6
+ const defaultCompile=THREE.Material.prototype.onBeforeCompile;
7
+
8
+ export function execute(code, document) {
9
+ const scene=hydrateAuthoringState(parseAuthoringDocument(validateRemoteAuthoringDocument(document)));
10
+ const clear=()=>{ for(const child of [...scene.children]) scene.remove(child); };
11
+ const unsupported=()=>{ throw new Error('AUTHORING_RUNTIME_CALLBACK_UNSUPPORTED'); };
12
+ // This Function belongs to the WASM QuickJS VM, never to the Node host.
13
+ const result=new Function('THREE','scene','clear','onFrame','modelRef',`"use strict";\n${code}`)(THREE,scene,clear,unsupported,unsupported);
14
+ if (result && typeof result.then==='function') throw new Error('AUTHORING_ASYNC_UNSUPPORTED');
15
+ return serialize(scene);
16
+ }
17
+ function serialize(scene) {
18
+ scene.traverse(node=>{
19
+ if (node!==scene && !['Mesh','Group','Object3D'].includes(node.type)) throw new Error('AUTHORING_NODE_UNSUPPORTED');
20
+ if (node.animations?.length || node.onBeforeRender!==defaultBeforeRender || node.onAfterRender!==defaultAfterRender) throw new Error('AUTHORING_RUNTIME_CALLBACK_UNSUPPORTED');
21
+ if (node.isMesh) {
22
+ if (Array.isArray(node.material) || !['MeshBasicMaterial','MeshStandardMaterial','MeshPhysicalMaterial'].includes(node.material.type) || node.material.onBeforeCompile!==defaultCompile) throw new Error('AUTHORING_MATERIAL_UNSUPPORTED');
23
+ // Materialize real buffers before crossing the boundary; never trust allocation parameters.
24
+ delete node.geometry.parameters;
25
+ node.geometry.type='BufferGeometry';
26
+ }
27
+ });
28
+ const output=exportAuthoringDocument(captureAuthoringState(scene));
29
+ validateRemoteAuthoringDocument(output);
30
+ return output;
31
+ }
32
+
33
+ export function build(source) {
34
+ if (!/^\s*export\s+function\s+createAsset\s*\(/m.test(source)) throw new Error('PROCEDURAL_ENTRY_REQUIRED');
35
+ const code=source.replace(/\bexport\s+function\s+createAsset\s*\(/,'function createAsset(');
36
+ const root=new Function('THREE',`"use strict";\n${code}\nreturn createAsset(THREE);`)(THREE);
37
+ return serializeAsset(root);
38
+ }
39
+
40
+ export function serializeAsset(root) {
41
+ if (!root?.isObject3D || root.isScene) throw new Error('PROCEDURAL_ROOT_INVALID');
42
+ if (root.position.length()>1e-8 || root.scale.distanceTo(new THREE.Vector3(1,1,1))>1e-8 || Math.abs(root.quaternion.w)<1-1e-8) throw new Error('PROCEDURAL_ROOT_TRANSFORM_UNSUPPORTED');
43
+ const scene=new THREE.Scene();root.userData.authoringId='asset-root';scene.add(root);
44
+ return serialize(scene);
45
+ }
46
+
@@ -0,0 +1,35 @@
1
+ import { validateRemoteAuthoringDocument } from './RemoteAuthoringDocument.js';
2
+
3
+ /** Trusted browser Worker. No OS isolation; never execute source on the UI thread. */
4
+ export function createBrowserCodeExecutor({ mode='disabled', authorized=false, wallTimeoutMs=30000 } = {}) {
5
+ if (mode === 'disabled') return null;
6
+ if (mode !== 'trusted-local') throw new Error('BROWSER_CODE_MODE_UNSUPPORTED');
7
+ if (authorized !== true) throw new Error('CODE_EXECUTION_AUTHORIZATION_REQUIRED');
8
+ let closed=false;
9
+ const active=new Set();
10
+ const executor={
11
+ async environment() { return {engine:'browser-trusted-worker',builderVersion:'1',threeVersion:'0.186.0'}; },
12
+ async run(request,{signal}={}) {
13
+ if(closed)throw new Error('AUTHORING_EXECUTOR_CLOSED');
14
+ if(signal?.aborted)throw new Error('BUILD_CANCELLED');
15
+ return new Promise((resolve,reject)=>{
16
+ const worker=new Worker(new URL('./BrowserCodeWorker.js',import.meta.url),{type:'module'});
17
+ let done=false;
18
+ const finish=(error,value)=>{if(done)return;done=true;clearTimeout(timer);worker.terminate();active.delete(cancel);signal?.removeEventListener('abort',abort);error?reject(error):resolve(value);};
19
+ const abort=()=>finish(new Error('BUILD_CANCELLED'));
20
+ const cancel=()=>finish(new Error('AUTHORING_EXECUTOR_CLOSED'));
21
+ const timer=setTimeout(()=>finish(new Error('AUTHORING_CODE_TIMEOUT')),wallTimeoutMs);
22
+ active.add(cancel);signal?.addEventListener('abort',abort,{once:true});
23
+ worker.onmessage=async({data})=>{
24
+ try { if(data.error)throw new Error(data.error);finish(null,{document:validateRemoteAuthoringDocument(data.document),environment:await executor.environment(),security:{osIsolation:false,trusted:true}}); }
25
+ catch(error){finish(error);}
26
+ };
27
+ worker.onerror=()=>finish(new Error('AUTHORING_SANDBOX_FAILED'));
28
+ worker.postMessage(request);
29
+ });
30
+ },
31
+ async execute(request,options){return(await executor.run({...request,mode:'authoring'},options)).document;},
32
+ close(){closed=true;for(const cancel of active)cancel();}
33
+ };
34
+ return executor;
35
+ }
@@ -0,0 +1,17 @@
1
+ import * as THREE from 'three';
2
+ import { serializeAsset, execute } from './AuthoringSandboxEntry.js';
3
+ self.onmessage = async ({ data }) => {
4
+ let url;
5
+ try {
6
+ let document;
7
+ if(data.mode === 'procedural') {
8
+ url=URL.createObjectURL(new Blob([data.source],{type:'text/javascript'}));
9
+ const module=await import(/* @vite-ignore */ url);
10
+ if(typeof module.createAsset !== 'function')throw new Error('PROCEDURAL_ENTRY_REQUIRED');
11
+ document=serializeAsset(await module.createAsset(THREE));
12
+ } else document=execute(data.code,data.document);
13
+ self.postMessage({document});
14
+ }
15
+ catch (error) { self.postMessage({ error:String(error.message).slice(0,500) }); }
16
+ finally {if(url)URL.revokeObjectURL(url);}
17
+ };
@@ -0,0 +1,72 @@
1
+ // Validate all data crossing the code-runtime boundary before Three.js allocates it.
2
+ export const remoteAuthoringLimits = Object.freeze({ maxBytes:2097152, maxNodes:128, maxDepth:16, maxVertices:20000, maxIndices:120000 });
3
+ const fail = () => { throw new Error('AUTHORING_DOCUMENT_UNSUPPORTED'); };
4
+ const safeId = value => typeof value === 'string' && /^[a-zA-Z0-9_-]{1,100}$/.test(value) && !['__proto__','constructor','prototype'].includes(value);
5
+ const types = new Set(['Float32Array','Uint32Array','Uint16Array','Uint8Array','Int32Array','Int16Array','Int8Array']);
6
+ const materials = new Set(['MeshBasicMaterial','MeshStandardMaterial','MeshPhysicalMaterial']);
7
+ export function validateRemoteAuthoringDocument(document) {
8
+ if (JSON.stringify(document).length > remoteAuthoringLimits.maxBytes) fail();
9
+ const scan = (value, depth=0) => {
10
+ if (depth > 40) fail();
11
+ if (typeof value === 'number' && !Number.isFinite(value)) fail();
12
+ if (!value || typeof value !== 'object') return;
13
+ for (const [key,item] of Object.entries(value)) {
14
+ if (['__proto__','constructor','prototype'].includes(key)) fail();
15
+ scan(item,depth+1);
16
+ }
17
+ };
18
+ scan(document);
19
+ if (document?.format !== 'agentscape-world-authoring' || document.version !== 1 || document.root?.id !== 'root') fail();
20
+ for (const key of ['geometries','materials','textures']) {
21
+ const entries=Object.entries(document[key] || {});
22
+ if (entries.length > 128 || entries.some(([id])=>!safeId(id))) fail();
23
+ }
24
+ let vertices=0,indices=0;
25
+ for (const definition of Object.values(document.geometries || {})) {
26
+ // Primitive parameters can request enormous allocations despite a tiny JSON payload.
27
+ if (definition.type !== 'BufferGeometry' || !definition.json?.data?.attributes?.position) fail();
28
+ const data=definition.json.data;
29
+ if (data.morphAttributes && Object.keys(data.morphAttributes).length) fail();
30
+ for (const attribute of Object.values(data.attributes)) {
31
+ if (!types.has(attribute.type) || !Number.isInteger(attribute.itemSize) || attribute.itemSize<1 || attribute.itemSize>4 || !Array.isArray(attribute.array) || attribute.array.length>remoteAuthoringLimits.maxVertices*4 || attribute.array.some(v=>typeof v!=='number'||!Number.isFinite(v)) || attribute.isInterleavedBufferAttribute) fail();
32
+ }
33
+ const count=data.attributes.position.array.length/3;
34
+ if (data.attributes.position.itemSize !== 3 || !Number.isInteger(count)) fail();
35
+ if (data.attributes.position.array.some(v=>Math.abs(v)>100)) fail();
36
+ vertices+=count;
37
+ if (data.index) {
38
+ if (!['Uint16Array','Uint32Array'].includes(data.index.type) || !Array.isArray(data.index.array) || data.index.array.some(i=>!Number.isInteger(i)||i<0||i>=count)) fail();
39
+ indices+=data.index.array.length;
40
+ }
41
+ if (data.groups) {
42
+ if (!Array.isArray(data.groups) || data.groups.length>128) fail();
43
+ const available=data.index?.array.length ?? count;
44
+ for (const group of data.groups) if (!Number.isInteger(group.start) || !Number.isInteger(group.count) || group.start<0 || group.count<0 || group.start+group.count>available) fail();
45
+ }
46
+ }
47
+ if (vertices>remoteAuthoringLimits.maxVertices || indices>remoteAuthoringLimits.maxIndices) fail();
48
+ const textureSlots=new Set(['map','normalMap','roughnessMap','metalnessMap','emissiveMap','alphaMap','aoMap']);
49
+ for (const material of Object.values(document.materials || {})) {
50
+ if (!materials.has(material.type)) fail();
51
+ for (const [key,value] of Object.entries(material)) if ((key==='map'||key.endsWith('Map')) && value!=null && (!textureSlots.has(key) || !Object.hasOwn(document.textures||{},value))) fail();
52
+ }
53
+ for (const texture of Object.values(document.textures || {})) {
54
+ const s=texture.source;
55
+ if (s?.type!=='data' || s.dataType!=='Uint8Array' || !Number.isInteger(s.width) || !Number.isInteger(s.height) || s.width<1 || s.height<1 || s.width>256 || s.height>256 || !Array.isArray(s.data) || s.data.length!==s.width*s.height*4 || s.data.some(n=>!Number.isInteger(n)||n<0||n>255)) fail();
56
+ }
57
+ const ids=new Set();
58
+ const visit=(node,depth=0)=>{
59
+ if (depth>remoteAuthoringLimits.maxDepth || !safeId(node.id) || ids.has(node.id) || ids.size>=remoteAuthoringLimits.maxNodes) fail();
60
+ ids.add(node.id);
61
+ const c=node.components;
62
+ if (!c || Object.keys(c).some(k=>!['transform','mesh','geometry','material','scene'].includes(k)) || (depth && c.scene)) fail();
63
+ const t=c.transform?.properties;
64
+ for (const [key,length] of [['position',3],['quaternion',4],['scale',3]]) if (!Array.isArray(t?.[key]) || t[key].length!==length || t[key].some(v=>typeof v!=='number'||!Number.isFinite(v)||Math.abs(v)>100)) fail();
65
+ if (t.scale.some(v=>v<=0) || Math.hypot(...t.quaternion)<1e-6) fail();
66
+ if (c.mesh && (!Object.hasOwn(document.geometries||{},c.geometry?.properties?.geometryId) || !Object.hasOwn(document.materials||{},c.material?.properties?.materialId))) fail();
67
+ if (node.children && !Array.isArray(node.children)) fail();
68
+ for (const child of node.children || []) visit(child,depth+1);
69
+ };
70
+ visit(document.root);
71
+ return document;
72
+ }
@@ -0,0 +1,66 @@
1
+ import { WorldRuntime } from '../modules/world/runtime/WorldRuntime.js';
2
+ import { RenderingSystem } from '../modules/world/runtime/systems/RenderingSystem.js';
3
+ import { createAssetModule } from '../modules/asset/AssetModule.js';
4
+ import { attachGenerationRuntime } from './generation/GenerationRuntime.js';
5
+ import { SkillRegistry } from './skills/SkillRegistry.js';
6
+ import { registerCoreSkills } from './skills/registerCoreSkills.js';
7
+ import { createWorldAuthoringContext } from './createWorldAuthoringContext.js';
8
+ import { ArticulationVerifier } from '../modules/world/verification/ArticulationVerifier.js';
9
+ import { AuthoringPromotionController } from './world-authoring/AuthoringPromotionController.js';
10
+ import { createAuthoringAssetProducer } from './world-authoring/AuthoringAssetProducer.js';
11
+ import { registerAuthoringSkills } from './skills/packs/authoringSkills.js';
12
+ import { registerCodeSkills } from './skills/packs/codeSkills.js';
13
+ import { createSceneFacade, sceneAgentModelSchema } from './scene/SceneFacade.js';
14
+ import * as z from 'zod/v4';
15
+
16
+ // Composition only. DOM rendering is attached here; frame scheduling and input stay with the host.
17
+ export function createSession(container, {
18
+ generation: generationOptions = {},
19
+ rendererFactory = null,
20
+ rendererMode = 'auto',
21
+ rendererTiming = false,
22
+ rendererPixelRatioScale = 1,
23
+ articulationVerifier = null,
24
+ authoringOptions = null,
25
+ codeExecutor = null,
26
+ codeGLTFLoader = undefined,
27
+ ...worldOptions
28
+ } = {}) {
29
+ const assetModule = worldOptions.assetModule || createAssetModule();
30
+ assetModule.configureVerification({
31
+ articulationVerifier:articulationVerifier || new ArticulationVerifier({
32
+ assetRegistry:assetModule.registry,
33
+ assetLoader:assetModule.loader,
34
+ ...(worldOptions.physicsFactory ? { physicsFactory:worldOptions.physicsFactory } : {})
35
+ })
36
+ });
37
+ const world = new WorldRuntime({
38
+ ...worldOptions,
39
+ assetModule
40
+ });
41
+ if (container) {
42
+ const renderingOptions = {
43
+ container,
44
+ scene:world.scene,
45
+ events:world.events,
46
+ rendererMode,
47
+ rendererTiming,
48
+ pixelRatioScale:rendererPixelRatioScale
49
+ };
50
+ if (rendererFactory) renderingOptions.rendererFactory = rendererFactory;
51
+ world.attachRendering(new RenderingSystem(renderingOptions));
52
+ }
53
+ const generation = attachGenerationRuntime(world, generationOptions);
54
+ world.skills = registerCoreSkills(new SkillRegistry({
55
+ policy: world.policy, trace: world.trace, runtime: world
56
+ }), world);
57
+ const authoring = world.rendering || authoringOptions ? createWorldAuthoringContext(world, authoringOptions || {}) : null;
58
+ const promotion = authoring ? new AuthoringPromotionController({ authoring, world,
59
+ produceAsset:createAuthoringAssetProducer({ assets:assetModule, artifacts:generation.artifacts }) }) : null;
60
+ if (promotion) registerAuthoringSkills((name, options, handler) => world.skills.register({ name, ...options, handler }), promotion);
61
+ if (authoring) registerCodeSkills((name, options, handler) => world.skills.register({ name, ...options, handler }), authoring);
62
+ const scene = createSceneFacade(world, { codeExecutor, codeGLTFLoader });
63
+ world.skills.register({ name:'addSceneModel', description:'通过 Scene API 添加已有 AssetRef 或低多边形声明式 Asset Recipe(最多64个部件,支持 box/sphere/ellipsoid/cylinder/tapered-cylinder/segment)。适合简单物体和占位;复杂自然造型、繁密树叶和动画请使用 Studio 代码项目。Recipe 不执行 JavaScript,物理/交互能力需显式声明。返回添加、准入和验证三个独立结果。', permissions:['world.write','asset.write'], required:['model'], properties:{model:z.toJSONSchema(sceneAgentModelSchema)}, mutates:true, manualMutation:true, batchable:false,
64
+ handler:({model})=>scene.addModel(sceneAgentModelSchema.parse(model)) });
65
+ return { world, generation, authoring, promotion, scene };
66
+ }