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,245 +0,0 @@
1
- /* 水体:湖面 / 喷池 / 跌水水帘 / 抛物线喷泉粒子与水流 */
2
- import * as THREE from 'three';
3
- import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js';
4
- import { R } from './core.js';
5
-
6
- const WATER_VERT = `
7
- uniform float uTime;
8
- uniform float uWave;
9
- varying vec3 vWorld;
10
- varying vec2 vUv;
11
- void main() {
12
- vec3 p = position;
13
- p.y += (sin(p.x * 0.75 + uTime * 1.35) * 0.038 + sin(p.z * 1.05 - uTime * 1.75) * 0.026) * uWave;
14
- vec4 wp = modelMatrix * vec4(p, 1.0);
15
- vWorld = wp.xyz;
16
- vUv = uv;
17
- gl_Position = projectionMatrix * viewMatrix * wp;
18
- }`;
19
-
20
- const WATER_FRAG = `
21
- precision highp float;
22
- uniform float uTime;
23
- uniform float uMode;
24
- uniform vec3 uSunDir;
25
- uniform vec3 uSunColor;
26
- uniform vec3 uZenith;
27
- uniform vec3 uHorizon;
28
- uniform vec3 uDeep;
29
- uniform vec3 uFogColor;
30
- uniform float uFogDensity;
31
- uniform vec2 uLakeCenter;
32
- uniform vec2 uLakeRadii;
33
- varying vec3 vWorld;
34
- varying vec2 vUv;
35
-
36
- void main() {
37
- vec2 p = vWorld.xz;
38
- float t = uTime;
39
- vec3 n = normalize(vec3(
40
- sin(p.x * 1.15 + t * 1.35) * 0.052 + sin(p.y * 2.1 - t * 1.1) * 0.028,
41
- 1.0,
42
- cos(p.y * 1.35 + t * 1.2) * 0.052 + cos(p.x * 2.4 + t * 0.85) * 0.024));
43
- vec3 V = normalize(cameraPosition - vWorld);
44
- float fres = pow(1.0 - clamp(dot(n, V), 0.0, 1.0), 3.0);
45
- vec3 R = reflect(-V, n);
46
- vec3 sky = mix(mix(uHorizon, uZenith, 0.48), uZenith, pow(clamp(R.y, 0.0, 1.0), 0.6));
47
- vec3 col = mix(uDeep, sky, clamp(0.06 + fres * 0.48, 0.0, 1.0));
48
- // 稀疏的高频波光,避免大面积规则棋盘状高光
49
- float micro = sin(p.x * 21.0 + t * 2.7) * sin(p.y * 17.0 - t * 2.1);
50
- float glint = pow(max(dot(reflect(-normalize(uSunDir), n), V), 0.0), 820.0);
51
- col += uSunColor * (pow(max(micro, 0.0), 14.0) * 0.055 + glint * 0.45);
52
-
53
- if (uMode < 0.5) {
54
- vec2 q = (vWorld.xz - uLakeCenter) / uLakeRadii;
55
- float a = atan(q.y, q.x);
56
- float edge = 1.0 + 0.10 * sin(a * 3.0 + 1.3) + 0.06 * sin(a * 7.0 + 0.4)
57
- + 0.025 * sin(a * 13.0 + 2.1);
58
- float d = length(q);
59
- if (d > edge) discard;
60
- float foam = smoothstep(edge - 0.028, edge, d);
61
- col = mix(col, vec3(0.74, 0.80, 0.78), foam * 0.30);
62
- col = mix(col, uDeep * 1.05, smoothstep(0.0, 0.7, d) * 0.25);
63
- } else {
64
- float d = length(vUv - 0.5) * 2.0;
65
- float rings = sin(d * 26.0 - t * 3.4) * 0.5 + 0.5;
66
- col += vec3(0.10, 0.14, 0.15) * rings * (1.0 - d) * 0.35;
67
- float rim = smoothstep(0.86, 1.0, d);
68
- col = mix(col, vec3(0.84, 0.90, 0.90), rim * 0.3);
69
- }
70
- float dist = length(cameraPosition - vWorld);
71
- float f = 1.0 - exp(-uFogDensity * uFogDensity * dist * dist);
72
- col = mix(col, uFogColor, clamp(f, 0.0, 1.0));
73
- gl_FragColor = vec4(col, 1.0);
74
- #include <tonemapping_fragment>
75
- #include <colorspace_fragment>
76
- }`;
77
-
78
- const DROP_VERT = `
79
- attribute vec3 aOrigin;
80
- attribute vec3 aVel;
81
- attribute float aSeed;
82
- attribute float aSize;
83
- attribute float aLife;
84
- uniform float uTime;
85
- uniform float uPixelRatio;
86
- varying float vAlpha;
87
- void main() {
88
- float t = mod(uTime * 0.82 + aSeed, aLife);
89
- vec3 p = aOrigin + aVel * t - vec3(0.0, 2.45 * t * t, 0.0);
90
- vec4 mv = modelViewMatrix * vec4(p, 1.0);
91
- gl_Position = projectionMatrix * mv;
92
- gl_PointSize = aSize * uPixelRatio * (330.0 / max(-mv.z, 1.0));
93
- vAlpha = (1.0 - t / aLife) * smoothstep(0.0, 0.10, t);
94
- }`;
95
- const DROP_FRAG = `
96
- precision mediump float;
97
- varying float vAlpha;
98
- void main() {
99
- vec2 q = gl_PointCoord - 0.5;
100
- float d = length(q);
101
- float a = smoothstep(0.5, 0.04, d) * vAlpha * 0.8;
102
- if (a < 0.01) discard;
103
- gl_FragColor = vec4(mix(vec3(0.66, 0.83, 0.94), vec3(1.0), 1.0 - d * 1.8), a);
104
- }`;
105
-
106
- const FLOW_VERT = `
107
- varying vec2 vUvF;
108
- void main(){ vUvF = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); }`;
109
- const FLOW_FRAG = `
110
- precision mediump float;
111
- uniform float uTime;
112
- uniform float uOpacity;
113
- varying vec2 vUvF;
114
- void main() {
115
- float band = sin(vUvF.y * 42.0 - uTime * 9.0) * 0.5 + 0.5;
116
- float streak = sin(vUvF.x * 26.0 + uTime * 1.4) * 0.5 + 0.5;
117
- float a = (0.12 + band * 0.28 + streak * 0.12) * uOpacity;
118
- gl_FragColor = vec4(vec3(0.78, 0.90, 0.97), a);
119
- }`;
120
-
121
- export function createWater(scene, skyApi, ctx) {
122
- const shared = {
123
- uTime: { value: 0 },
124
- uSunDir: skyApi.uniforms.uSunDir,
125
- uSunColor: skyApi.uniforms.uSunColor,
126
- uZenith: skyApi.uniforms.uZenith,
127
- uHorizon: skyApi.uniforms.uHorizon,
128
- uFogColor: { value: new THREE.Color() },
129
- uFogDensity: { value: 0.0015 },
130
- uLakeCenter: { value: new THREE.Vector2(18, 112) },
131
- uLakeRadii: { value: new THREE.Vector2(128, 42) },
132
- };
133
- const makeMat = (mode, wave, deep) => new THREE.ShaderMaterial({
134
- uniforms: Object.assign({}, shared, {
135
- uMode: { value: mode }, uWave: { value: wave }, uDeep: { value: new THREE.Color(deep) },
136
- }),
137
- vertexShader: WATER_VERT, fragmentShader: WATER_FRAG,
138
- side: THREE.DoubleSide, transparent: false, depthWrite: true,
139
- });
140
- const lakeMat = makeMat(0, 1.0, '#274145');
141
- const basinMat = makeMat(1, 0.45, '#315451');
142
-
143
- // 园湖(不规则岸线由片元着色器裁剪)
144
- const lake = new THREE.Mesh(new THREE.PlaneGeometry(330, 150, 72, 36), lakeMat);
145
- lake.rotation.x = -Math.PI / 2;
146
- lake.position.set(18, -0.58, 112);
147
- lake.receiveShadow = false;
148
- scene.add(lake);
149
-
150
- // 各喷池水面
151
- const circle = new THREE.CircleGeometry(1, 56);
152
- ctx.waters.forEach(w => {
153
- const m = new THREE.Mesh(circle, basinMat);
154
- m.rotation.x = -Math.PI / 2;
155
- m.position.set(w.x, w.y, w.z);
156
- m.scale.set(w.rx, w.rz, 1);
157
- m.renderOrder = 1;
158
- scene.add(m);
159
- });
160
-
161
- // 喷泉粒子
162
- const origins = [], vels = [], seeds = [], sizes = [], lifes = [];
163
- const ribbonGeos = [];
164
- ctx.jets.forEach(j => {
165
- const life = 1.05 + R() * 0.45;
166
- const count = j.n * 7;
167
- for (let i = 0; i < count; i++) {
168
- origins.push(j.pos[0], j.pos[1], j.pos[2]);
169
- const spread = 0.2;
170
- vels.push(
171
- j.vel[0] + (R() - 0.5) * spread * (Math.abs(j.vel[0]) + 1),
172
- j.vel[1] + (R() - 0.5) * spread * 2,
173
- j.vel[2] + (R() - 0.5) * spread * (Math.abs(j.vel[2]) + 1)
174
- );
175
- seeds.push(R() * 12);
176
- sizes.push(j.size * (0.55 + R() * 0.9) * 10);
177
- lifes.push(life);
178
- }
179
- // 主水柱:抛物线水流带
180
- const pts = [];
181
- for (let i = 0; i <= 12; i++) {
182
- const t = (i / 12) * life;
183
- pts.push(new THREE.Vector3(
184
- j.pos[0] + j.vel[0] * t,
185
- j.pos[1] + j.vel[1] * t - 2.45 * t * t,
186
- j.pos[2] + j.vel[2] * t
187
- ));
188
- }
189
- const curve = new THREE.CatmullRomCurve3(pts);
190
- ribbonGeos.push(new THREE.TubeGeometry(curve, 16, j.size * 0.62, 5, false));
191
- });
192
- const pg = new THREE.BufferGeometry();
193
- pg.setAttribute('position', new THREE.Float32BufferAttribute(origins.map(() => 0), 3));
194
- pg.setAttribute('aOrigin', new THREE.Float32BufferAttribute(origins, 3));
195
- pg.setAttribute('aVel', new THREE.Float32BufferAttribute(vels, 3));
196
- pg.setAttribute('aSeed', new THREE.Float32BufferAttribute(seeds, 1));
197
- pg.setAttribute('aSize', new THREE.Float32BufferAttribute(sizes, 1));
198
- pg.setAttribute('aLife', new THREE.Float32BufferAttribute(lifes, 1));
199
- const dropUniforms = { uTime: { value: 0 }, uPixelRatio: { value: 1 } };
200
- const drops = new THREE.Points(pg, new THREE.ShaderMaterial({
201
- uniforms: dropUniforms, vertexShader: DROP_VERT, fragmentShader: DROP_FRAG,
202
- transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
203
- }));
204
- drops.frustumCulled = false;
205
- drops.renderOrder = 6;
206
- scene.add(drops);
207
-
208
- const flowUniforms = { uTime: { value: 0 }, uOpacity: { value: 1 } };
209
- const flowMat = new THREE.ShaderMaterial({
210
- uniforms: flowUniforms, vertexShader: FLOW_VERT, fragmentShader: FLOW_FRAG,
211
- transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide,
212
- });
213
- const ribbons = new THREE.Mesh(mergeGeometries(ribbonGeos.map(g => g.toNonIndexed()), false), flowMat);
214
- ribbons.frustumCulled = false;
215
- ribbons.renderOrder = 5;
216
- scene.add(ribbons);
217
- ribbonGeos.forEach(g => g.dispose());
218
-
219
- // 跌水水帘(大水法三级石阶 + 海晏堂跑梯)
220
- const curtains = [];
221
- for (let l = 0; l < 3; l++) {
222
- curtains.push({ x: 40, y: 0.72 - l * 0.14, z: -4.25 + l * 2.4, w: 24 - l * 1.2, h: 0.75 });
223
- }
224
- const curtainMeshes = [];
225
- curtains.forEach(c => {
226
- const m = new THREE.Mesh(new THREE.PlaneGeometry(c.w, c.h, 12, 2), flowMat);
227
- m.position.set(c.x, c.y + c.h / 2, c.z + 1.15);
228
- m.renderOrder = 5;
229
- scene.add(m);
230
- curtainMeshes.push(m);
231
- });
232
-
233
- return {
234
- lake, basinMat, lakeMat, drops, ribbons, flowMat, curtains: curtainMeshes,
235
- uniforms: shared, dropUniforms, flowUniforms,
236
- setPixelRatio(p) { dropUniforms.uPixelRatio.value = p; },
237
- update(dt, sky) {
238
- shared.uTime.value += dt;
239
- dropUniforms.uTime.value = shared.uTime.value;
240
- flowUniforms.uTime.value = shared.uTime.value;
241
- shared.uFogColor.value.copy(sky.fog.color);
242
- shared.uFogDensity.value = sky.fog.density;
243
- },
244
- };
245
- }
@@ -1,9 +0,0 @@
1
- import { AgentScapeError } from '../../foundation/errors.js';
2
-
3
- export const Errors = {
4
- objectNotFound: (id) => new AgentScapeError('OBJECT_NOT_FOUND', 'Object not found: ' + id, { id }),
5
- actionUnsupported: (id, action) => new AgentScapeError('ACTION_UNSUPPORTED', id + ' does not support ' + action, { id, action }),
6
- interactionUnavailable: (actorId, targetId, reason, details = {}) => new AgentScapeError('INTERACTION_UNAVAILABLE', actorId + ' cannot interact with ' + targetId + ': ' + reason, { actorId, targetId, reason, ...details }),
7
- carryUnavailable: (actorId, targetId, reason, details = {}) => new AgentScapeError('CARRY_UNAVAILABLE', actorId + ' cannot carry ' + targetId + ': ' + reason, { actorId, targetId, reason, ...details }),
8
- placeUnavailable: (actorId, targetId, reason, details = {}) => new AgentScapeError('PLACE_UNAVAILABLE', actorId + ' cannot place on ' + targetId + ': ' + reason, { actorId, targetId, reason, ...details })
9
- };
@@ -1,50 +0,0 @@
1
- import * as THREE from 'three';
2
-
3
- const SUPPORTED_GENERATED_WORLD_COORDINATES = new Set(['y-up', 'z-up']);
4
-
5
- export function validateGeneratedWorldCoordinates(coordinateSystem = 'y-up', metersPerUnit = 1) {
6
- if (!SUPPORTED_GENERATED_WORLD_COORDINATES.has(coordinateSystem)) {
7
- throw new TypeError('coordinateSystem must be y-up or z-up');
8
- }
9
- if (!Number.isFinite(metersPerUnit) || metersPerUnit <= 0) {
10
- throw new TypeError('metersPerUnit must be a positive finite number');
11
- }
12
- return { coordinateSystem, metersPerUnit };
13
- }
14
-
15
- export function generatedWorldTransformMatrix(coordinateSystem = 'y-up', metersPerUnit = 1) {
16
- validateGeneratedWorldCoordinates(coordinateSystem, metersPerUnit);
17
- const matrix = new THREE.Matrix4();
18
- if (coordinateSystem === 'z-up') matrix.makeRotationX(-Math.PI / 2);
19
- if (metersPerUnit !== 1) matrix.premultiply(new THREE.Matrix4().makeScale(metersPerUnit, metersPerUnit, metersPerUnit));
20
- return matrix;
21
- }
22
-
23
- export function applyGeneratedWorldGeometryTransform(geometry, coordinateSystem = 'y-up', metersPerUnit = 1) {
24
- if (!geometry?.applyMatrix4) throw new TypeError('Generated world geometry must support applyMatrix4');
25
- geometry.applyMatrix4(generatedWorldTransformMatrix(coordinateSystem, metersPerUnit));
26
- return geometry;
27
- }
28
-
29
- export function applyGeneratedWorldObjectTransform(object, coordinateSystem = 'y-up', metersPerUnit = 1) {
30
- if (!object?.applyMatrix4) throw new TypeError('Generated world visual must be an Object3D');
31
- object.applyMatrix4(generatedWorldTransformMatrix(coordinateSystem, metersPerUnit));
32
- object.updateMatrixWorld?.(true);
33
- return object;
34
- }
35
- export function transformGeneratedWorldPoint(point, coordinateSystem = 'y-up', metersPerUnit = 1) {
36
- if (!Array.isArray(point) || point.length !== 3 || !point.every(Number.isFinite)) {
37
- throw new TypeError('Generated world point must contain 3 finite numbers');
38
- }
39
- return new THREE.Vector3(...point).applyMatrix4(generatedWorldTransformMatrix(coordinateSystem, metersPerUnit)).toArray();
40
- }
41
-
42
- export function transformGeneratedWorldBounds(bounds, coordinateSystem = 'y-up', metersPerUnit = 1) {
43
- if (!bounds || !Array.isArray(bounds.min) || !Array.isArray(bounds.max) || bounds.min.length !== 3 || bounds.max.length !== 3
44
- || !bounds.min.every(Number.isFinite) || !bounds.max.every(Number.isFinite)) {
45
- throw new TypeError('Generated world bounds require finite min/max vec3 values');
46
- }
47
- const box = new THREE.Box3(new THREE.Vector3(...bounds.min), new THREE.Vector3(...bounds.max));
48
- box.applyMatrix4(generatedWorldTransformMatrix(coordinateSystem, metersPerUnit));
49
- return { min:box.min.toArray(), max:box.max.toArray() };
50
- }
@@ -1,297 +0,0 @@
1
- import * as THREE from 'three';
2
- import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
3
- import { PLYLoader } from 'three/examples/jsm/loaders/PLYLoader.js';
4
- import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
5
- import { applyGeneratedWorldGeometryTransform, transformGeneratedWorldBounds, transformGeneratedWorldPoint, validateGeneratedWorldCoordinates } from './GeneratedWorldCoordinates.js';
6
-
7
- const SUPPORTED_MESH_FORMATS = new Set(['glb', 'ply']);
8
-
9
- const asBytes = (value) => {
10
- if (value instanceof Uint8Array) return value;
11
- if (value instanceof ArrayBuffer) return new Uint8Array(value);
12
- if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
13
- return null;
14
- };
15
-
16
- const asSource = (value, name) => {
17
- if (value == null) return null;
18
- if (typeof value === 'string' && value.trim()) return { url:value.trim() };
19
- if (typeof value !== 'object') throw new TypeError(`${name} must be a URL string, { url }, or { data, format }`);
20
- if (typeof value.url === 'string' && value.url.trim()) return { ...value, url:value.url.trim() };
21
- const data = asBytes(value.data);
22
- if (data && typeof value.format === 'string' && value.format.trim()) return { ...value, data, format:value.format.trim().toLowerCase() };
23
- throw new TypeError(`${name} must be a URL string, { url }, or { data, format }`);
24
- };
25
-
26
- const sourceFormat = (source) => {
27
- const explicit = source.format?.toLowerCase();
28
- if (explicit) return explicit;
29
- const path = source.url?.split(/[?#]/, 1)[0] || '';
30
- return path.slice(path.lastIndexOf('.') + 1).toLowerCase();
31
- };
32
-
33
- const sourceDescriptor = (source) => {
34
- if (!source) return null;
35
- const format = sourceFormat(source);
36
- return {
37
- ...(source.url ? { url:source.url } : {}),
38
- ...(format ? { format } : {}),
39
- ...(source.data ? { bytes:source.data.byteLength } : {})
40
- };
41
- };
42
-
43
- const glbGeometry = (scene) => {
44
- const geometries = [];
45
- scene.updateWorldMatrix(true, true);
46
- scene.traverse((node) => {
47
- if (!node.isMesh || !node.geometry?.getAttribute?.('position')) return;
48
- const geometry = node.geometry.clone();
49
- geometry.applyMatrix4(node.matrixWorld);
50
- geometries.push(geometry);
51
- });
52
- if (!geometries.length) throw new TypeError('Generated world GLB contains no triangle mesh');
53
- const geometry = geometries.length === 1 ? geometries[0] : mergeGeometries(geometries, false);
54
- if (!geometry) throw new TypeError('Generated world GLB meshes could not be merged');
55
- geometries.forEach((item) => { if (item !== geometry) item.dispose(); });
56
- return geometry;
57
- };
58
-
59
- const loadSemantics = async (source, coordinateSystem, metersPerUnit) => {
60
- if (!source) return null;
61
- const value = source.data
62
- ? JSON.parse(new TextDecoder().decode(source.data))
63
- : await (async () => {
64
- const response = await fetch(source.url);
65
- if (!response.ok) throw new Error(`Failed to load generated world semantics: ${response.status}`);
66
- return response.json();
67
- })();
68
- if (Array.isArray(value)) return value; // legacy category-only payload
69
- if (![1,2].includes(value?.schemaVersion) || !Array.isArray(value.categories) || !Array.isArray(value.instances)) return value;
70
- const instances = value.instances.map((instance) => {
71
- if (!instance || typeof instance !== 'object' || Array.isArray(instance)) return instance;
72
- if (value.schemaVersion === 1) {
73
- if (!Array.isArray(instance.center) || !instance.bbox) return structuredClone(instance);
74
- return {
75
- ...structuredClone(instance),
76
- center:transformGeneratedWorldPoint(instance.center, coordinateSystem, metersPerUnit),
77
- bbox:transformGeneratedWorldBounds(instance.bbox, coordinateSystem, metersPerUnit)
78
- };
79
- }
80
- const localization=instance.localization;
81
- if (localization?.kind !== 'point-scale' || !Array.isArray(localization.center)) return structuredClone(instance);
82
- return {
83
- ...structuredClone(instance),
84
- localization:{
85
- ...structuredClone(localization),
86
- center:transformGeneratedWorldPoint(localization.center, coordinateSystem, metersPerUnit),
87
- scale:Number(localization.scale) * metersPerUnit,
88
- ...(Array.isArray(localization.leftPoint)?{leftPoint:transformGeneratedWorldPoint(localization.leftPoint,coordinateSystem,metersPerUnit)}:{}),
89
- ...(Array.isArray(localization.rightPoint)?{rightPoint:transformGeneratedWorldPoint(localization.rightPoint,coordinateSystem,metersPerUnit)}:{})
90
- }
91
- };
92
- });
93
- return { ...structuredClone(value), instances };
94
- };
95
-
96
- const resolveRelativeUrl = (path, baseUrl) => {
97
- if (!path) return null;
98
- if (!baseUrl) return path;
99
- return new URL(path, baseUrl).href;
100
- };
101
-
102
- const deriveCameraFromGeometry = (geometry) => {
103
- geometry.computeBoundingBox();
104
- const bounds = geometry.boundingBox;
105
- if (!bounds || bounds.isEmpty()) return { position:[8,5,8], target:[0,1,0], far:120 };
106
- const center = bounds.getCenter(new THREE.Vector3());
107
- const size = bounds.getSize(new THREE.Vector3());
108
- const radius = Math.max(size.length() * 0.5, 1);
109
- const distance = Math.max(radius * 2.2, 6);
110
- const offset = new THREE.Vector3(1, 0.65, 1).normalize().multiplyScalar(distance);
111
- return {
112
- position:center.clone().add(offset).toArray(),
113
- target:center.toArray(),
114
- far:Math.max(120, distance * 6)
115
- };
116
- };
117
-
118
- const loadJsonSource = async (value, name) => {
119
- const source = asSource(value, name);
120
- if (!source) throw new TypeError(`${name} is required`);
121
- if (source.data) return { data:JSON.parse(new TextDecoder().decode(source.data)), source, baseUrl:source.baseUrl || null };
122
- const response = await fetch(source.url);
123
- if (!response.ok) throw new Error(`Failed to load ${name}: ${response.status}`);
124
- return { data:await response.json(), source, baseUrl:response.url || source.url };
125
- };
126
-
127
- const ensureGpuCompatibleAttributes = (geometry) => {
128
- for (const [name, attribute] of Object.entries(geometry.attributes || {})) {
129
- if (!(attribute?.array instanceof Float64Array)) continue;
130
- const replacement = new THREE.BufferAttribute(
131
- Float32Array.from(attribute.array),
132
- attribute.itemSize,
133
- attribute.normalized
134
- );
135
- replacement.name = attribute.name;
136
- replacement.setUsage(attribute.usage);
137
- geometry.setAttribute(name, replacement);
138
- }
139
- return geometry;
140
- };
141
-
142
- export function geometryToTrimeshCollider(geometry) {
143
- const position = geometry?.getAttribute?.('position');
144
- if (!position || position.itemSize !== 3 || position.count < 3) throw new TypeError('Generated world mesh requires triangle positions');
145
- const vertices = Array.from(position.array);
146
- if (!vertices.every(Number.isFinite)) throw new TypeError('Generated world mesh contains non-finite vertices');
147
-
148
- const sourceIndex = geometry.getIndex();
149
- const indices = sourceIndex ? Array.from(sourceIndex.array) : Array.from({ length:position.count }, (_, index) => index);
150
- if (indices.length < 3 || indices.length % 3 !== 0 || !indices.every((value) => Number.isInteger(value) && value >= 0 && value < position.count)) {
151
- throw new TypeError('Generated world mesh requires valid triangle indices');
152
- }
153
- return { shape:'trimesh', vertices, indices };
154
- }
155
-
156
- async function loadMesh(source, coordinateSystem, metersPerUnit) {
157
- const format = sourceFormat(source);
158
- if (!SUPPORTED_MESH_FORMATS.has(format)) throw new TypeError(`Unsupported generated world mesh format: ${format || 'unknown'}`);
159
- let geometry;
160
- if (format === 'ply') {
161
- const loader = new PLYLoader();
162
- geometry = source.data
163
- ? loader.parse(source.data.buffer.slice(source.data.byteOffset, source.data.byteOffset + source.data.byteLength))
164
- : await loader.loadAsync(source.url);
165
- } else {
166
- const loader = new GLTFLoader();
167
- const gltf = source.data
168
- ? await loader.parseAsync(source.data.buffer.slice(source.data.byteOffset, source.data.byteOffset + source.data.byteLength), '')
169
- : await loader.loadAsync(source.url);
170
- geometry = glbGeometry(gltf.scene);
171
- }
172
- applyGeneratedWorldGeometryTransform(geometry, coordinateSystem, metersPerUnit);
173
- if (!geometry.getAttribute('normal')) geometry.computeVertexNormals();
174
- ensureGpuCompatibleAttributes(geometry);
175
- return geometry;
176
- }
177
-
178
- /**
179
- * Load externally generated world files into AgentScape's existing runtime.
180
- * Generation stays outside AgentScape; this function only turns artifacts into
181
- * the Environment shape already consumed by Rendering, Physics and Navigation.
182
- */
183
- export async function loadGeneratedWorld({
184
- id = 'generated-world',
185
- mesh,
186
- visual = null,
187
- semantics = null,
188
- navigation = null,
189
- coordinateSystem = 'y-up',
190
- metersPerUnit = 1,
191
- layout = null,
192
- camera = null,
193
- rendering = null
194
- } = {}) {
195
- const meshSource = asSource(mesh, 'mesh');
196
- if (!meshSource) throw new TypeError('loadGeneratedWorld requires mesh');
197
- validateGeneratedWorldCoordinates(coordinateSystem, metersPerUnit);
198
-
199
- const visualSource = asSource(visual, 'visual');
200
- const semanticsSource = asSource(semantics, 'semantics');
201
- const navigationSource = asSource(navigation, 'navigation');
202
- const [geometry, semanticData, navigationGeometry] = await Promise.all([
203
- loadMesh(meshSource, coordinateSystem, metersPerUnit),
204
- loadSemantics(semanticsSource, coordinateSystem, metersPerUnit),
205
- navigationSource ? loadMesh(navigationSource, coordinateSystem, metersPerUnit) : Promise.resolve(null)
206
- ]);
207
-
208
- const collider = geometryToTrimeshCollider(geometry);
209
- const root = new THREE.Group();
210
- root.name = 'GeneratedWorld';
211
- root.userData.generatedSemantics = semanticData;
212
-
213
- const hasVertexColors=Boolean(geometry.getAttribute('color'));
214
- const floor = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({
215
- color:hasVertexColors ? 0xffffff : 0x8f98a3,
216
- vertexColors:hasVertexColors,
217
- side:THREE.DoubleSide
218
- }));
219
- floor.name = 'GeneratedWorldMesh';
220
- floor.receiveShadow = true;
221
- root.add(floor);
222
-
223
- let navigationRoot = null;
224
- if (navigationGeometry) {
225
- navigationRoot = new THREE.Group();
226
- navigationRoot.name = 'GeneratedWorldNavigation';
227
- const navigationMesh = new THREE.Mesh(navigationGeometry, new THREE.MeshBasicMaterial({ visible:false }));
228
- navigationMesh.name = 'GeneratedWorldNavigationMesh';
229
- navigationRoot.add(navigationMesh);
230
- }
231
-
232
- return {
233
- id,
234
- root,
235
- floor,
236
- ...(navigationRoot ? { navigationRoot } : {}),
237
- colliders:[collider],
238
- ...(layout ? { layout:structuredClone(layout) } : {}),
239
- camera:camera ? structuredClone(camera) : deriveCameraFromGeometry(geometry),
240
- ...(rendering ? { rendering:structuredClone(rendering) } : {}),
241
- semantics:semanticData,
242
- generated:{
243
- mesh:sourceDescriptor(meshSource),
244
- visual:visualSource ? { ...sourceDescriptor(visualSource), source:visualSource, status:'deferred' } : null,
245
- semantics:semanticsSource ? { ...sourceDescriptor(semanticsSource), data:semanticData } : null,
246
- navigation:navigationSource ? { ...sourceDescriptor(navigationSource), locomotionGround:true } : null,
247
- collisionGeometry:'environment',
248
- coordinateSystem,
249
- metersPerUnit
250
- },
251
- dispose(){
252
- floor.geometry?.dispose?.();
253
- floor.material?.dispose?.();
254
- navigationRoot?.traverse?.((node) => { node.geometry?.dispose?.(); node.material?.dispose?.(); });
255
- }
256
- };
257
- }
258
-
259
- /**
260
- * Load the compact runtime/world.json emitted by modal-world. Artifact paths in
261
- * the manifest are resolved relative to the manifest URL before crossing the
262
- * existing generated-world Environment boundary.
263
- */
264
- export async function loadGeneratedWorldManifest(manifest) {
265
- const { data, source, baseUrl } = await loadJsonSource(manifest, 'generated world manifest');
266
- if (!data || typeof data !== 'object' || Array.isArray(data)) throw new TypeError('Generated world manifest must be an object');
267
- if (data.schemaVersion !== 1) throw new TypeError(`Unsupported generated world manifest version: ${data.schemaVersion}`);
268
- const artifacts = data.artifacts;
269
- if (!artifacts || typeof artifacts !== 'object' || Array.isArray(artifacts)) throw new TypeError('Generated world manifest requires artifacts');
270
- const environment = artifacts.environment;
271
- if (!environment?.path) throw new TypeError('Generated world manifest requires artifacts.environment.path');
272
-
273
- const artifactSource = (artifact) => artifact?.path ? {
274
- url:resolveRelativeUrl(artifact.path, baseUrl),
275
- ...(artifact.format ? { format:artifact.format } : {})
276
- } : null;
277
-
278
- const loaded = await loadGeneratedWorld({
279
- id:data.id || 'generated-world',
280
- mesh:artifactSource(environment),
281
- visual:artifactSource(artifacts.visual),
282
- semantics:artifactSource(artifacts.semantics),
283
- navigation:artifactSource(artifacts.navigation),
284
- coordinateSystem:data.coordinateSystem || 'y-up',
285
- metersPerUnit:data.metersPerUnit ?? 1,
286
- layout:data.layout || null,
287
- camera:data.camera || null,
288
- rendering:data.rendering || null
289
- });
290
- loaded.generated.manifest = {
291
- ...sourceDescriptor(source),
292
- schemaVersion:data.schemaVersion,
293
- mesh:data.mesh ? structuredClone(data.mesh) : null,
294
- compiler:data.compiler ? structuredClone(data.compiler) : null
295
- };
296
- return loaded;
297
- }
@@ -1,80 +0,0 @@
1
- export class CommandHistory {
2
- constructor({ apply, runExclusive = (operation) => operation(), limit = 100, events = null } = {}) {
3
- this.apply = apply;
4
- this.runExclusive = runExclusive;
5
- this.limit = limit;
6
- this.events = events;
7
- this.undoStack = [];
8
- this.redoStack = [];
9
- this.pending = null;
10
- this.suspended = false;
11
- this.applying = false;
12
- }
13
-
14
- begin(label, before) {
15
- if (this.suspended || this.pending) return false;
16
- this.pending = { label, before };
17
- return true;
18
- }
19
-
20
- commit(after, meta = {}) {
21
- if (this.suspended || !this.pending) return false;
22
- const command = { ...this.pending, after, meta, at: Date.now() };
23
- this.pending = null;
24
- if (JSON.stringify(command.before) === JSON.stringify(command.after)) return false;
25
- this.undoStack.push(command);
26
- if (this.undoStack.length > this.limit) this.undoStack.shift();
27
- this.redoStack.length = 0;
28
- this.events?.emit('history.changed', this.status());
29
- this.events?.emit('history.recorded', { label: command.label, meta });
30
- return true;
31
- }
32
-
33
- cancel() { this.pending = null; }
34
- canUndo() { return this.undoStack.length > 0; }
35
- canRedo() { return this.redoStack.length > 0; }
36
- status() { return { undo: this.undoStack.length, redo: this.redoStack.length, canUndo: this.canUndo(), canRedo: this.canRedo() }; }
37
-
38
- async undo() { return this.step('undo'); }
39
- async redo() { return this.step('redo'); }
40
-
41
- // 恢复成功后才转移历史栈:apply 抛错时命令留在原栈,历史记录不会丢失。
42
- // applying 同时阻止重入,避免 UI 连点让两次恢复交错执行。
43
- async step(direction) {
44
- if (this.applying) return false;
45
- if (this.pending) {
46
- const error = new Error('Cannot restore history during an unfinished mutation');
47
- error.code = 'WORLD_MUTATION_BUSY';
48
- throw error;
49
- }
50
- return this.runExclusive(() => this.applyStep(direction));
51
- }
52
-
53
- async applyStep(direction) {
54
- const undoing = direction === 'undo';
55
- const from = undoing ? this.undoStack : this.redoStack;
56
- const to = undoing ? this.redoStack : this.undoStack;
57
- if (!from.length) return false;
58
- const command = from[from.length - 1];
59
- this.applying = true;
60
- this.suspended = true;
61
- try {
62
- await this.apply(undoing ? command.before : command.after);
63
- } finally {
64
- this.suspended = false;
65
- this.applying = false;
66
- }
67
- from.pop();
68
- to.push(command);
69
- this.events?.emit('history.changed', this.status());
70
- this.events?.emit('history.applied', { direction, label: command.label });
71
- return command;
72
- }
73
-
74
- clear() {
75
- this.undoStack.length = 0;
76
- this.redoStack.length = 0;
77
- this.pending = null;
78
- this.events?.emit('history.changed', this.status());
79
- }
80
- }