agentscape3d 1.0.0-beta.1 → 1.0.0-beta.3

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 (387) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +23 -48
  3. package/dist/core.d.ts +68 -0
  4. package/dist/core.js +209 -0
  5. package/dist/core.js.map +1 -0
  6. package/dist/index.d.ts +10 -229
  7. package/dist/index.js +192 -15462
  8. package/dist/index.js.map +1 -1
  9. package/package.json +16 -40
  10. package/cli.mjs +0 -27
  11. package/dist/AssetCompiler-CDFiElji.js +0 -2451
  12. package/dist/AssetCompiler-CDFiElji.js.map +0 -1
  13. package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
  14. package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
  15. package/dist/AssetRecipe-DmFpzxr-.js +0 -55
  16. package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
  17. package/dist/BrowserCodeWorker.js +0 -53615
  18. package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
  19. package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
  20. package/dist/SceneSerializer-DPVOyeRk.js +0 -353
  21. package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
  22. package/dist/StylePack-DNrdLeGI.js +0 -6314
  23. package/dist/StylePack-DNrdLeGI.js.map +0 -1
  24. package/dist/WorldArchive-pSBIGxLa.js +0 -420
  25. package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
  26. package/dist/WorldIO-wsDfZGM4.js +0 -150
  27. package/dist/WorldIO-wsDfZGM4.js.map +0 -1
  28. package/dist/blankWorld-CBWbwJGj.js +0 -76
  29. package/dist/blankWorld-CBWbwJGj.js.map +0 -1
  30. package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
  31. package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
  32. package/dist/environments-DgH66NqV.js +0 -4220
  33. package/dist/environments-DgH66NqV.js.map +0 -1
  34. package/dist/gltfIO-B87nJaat.js +0 -10
  35. package/dist/gltfIO-B87nJaat.js.map +0 -1
  36. package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
  37. package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
  38. package/dist/magicCabin-D64fD1E2.js +0 -11024
  39. package/dist/magicCabin-D64fD1E2.js.map +0 -1
  40. package/dist/mcp.d.ts +0 -2
  41. package/dist/mcp.js +0 -1
  42. package/dist/monumentHall-BKbs0UOQ.js +0 -404
  43. package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
  44. package/dist/node.d.ts +0 -16
  45. package/dist/node.js +0 -25
  46. package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
  47. package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
  48. package/dist/runtime/application/AgentTools.js +0 -25
  49. package/dist/runtime/application/README.md +0 -14
  50. package/dist/runtime/application/buildTaskObservation.js +0 -117
  51. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
  52. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
  53. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
  54. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
  55. package/dist/runtime/application/createSession.js +0 -66
  56. package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
  57. package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
  58. package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
  59. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
  60. package/dist/runtime/application/native-scene/CodeProject.js +0 -119
  61. package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
  62. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
  63. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
  64. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
  65. package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
  66. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
  67. package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
  68. package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
  69. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
  70. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
  71. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
  72. package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
  73. package/dist/runtime/application/scene/RequestWindow.js +0 -54
  74. package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
  75. package/dist/runtime/application/scene/SceneContracts.js +0 -45
  76. package/dist/runtime/application/scene/SceneEditService.js +0 -144
  77. package/dist/runtime/application/scene/SceneFacade.js +0 -267
  78. package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
  79. package/dist/runtime/application/scene/SceneJobController.js +0 -229
  80. package/dist/runtime/application/scene/ScenePackage.js +0 -162
  81. package/dist/runtime/application/scene/ScenePersistence.js +0 -50
  82. package/dist/runtime/application/scene/SceneProject.js +0 -95
  83. package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
  84. package/dist/runtime/application/scene/StarterScene.js +0 -56
  85. package/dist/runtime/application/scene/WorldArchive.js +0 -87
  86. package/dist/runtime/application/scene/WorldDirectory.js +0 -20
  87. package/dist/runtime/application/scene/WorldDocument.js +0 -74
  88. package/dist/runtime/application/scene/WorldIO.js +0 -103
  89. package/dist/runtime/application/scene/WorldStorage.js +0 -137
  90. package/dist/runtime/application/skills/SkillRegistry.js +0 -163
  91. package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
  92. package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
  93. package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
  94. package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
  95. package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
  96. package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
  97. package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
  98. package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
  99. package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
  100. package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
  101. package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
  102. package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
  103. package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
  104. package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
  105. package/dist/runtime/application/skills/skillPrimitives.js +0 -4
  106. package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
  107. package/dist/runtime/application/tasks.jsonl +0 -67
  108. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
  109. package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
  110. package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
  111. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
  112. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
  113. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
  114. package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
  115. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
  116. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
  117. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
  118. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
  119. package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
  120. package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
  121. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
  122. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
  123. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
  124. package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
  125. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
  126. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
  127. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
  128. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
  129. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
  130. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
  131. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
  132. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
  133. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
  134. package/dist/runtime/apps/mcp-server/README.md +0 -150
  135. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
  136. package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
  137. package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
  138. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
  139. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
  140. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
  141. package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
  142. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
  143. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
  144. package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
  145. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
  146. package/dist/runtime/apps/mcp-server/main.mjs +0 -56
  147. package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
  148. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
  149. package/dist/runtime/apps/mcp-server/security.js +0 -21
  150. package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
  151. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
  152. package/dist/runtime/apps/server/README.md +0 -7
  153. package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
  154. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
  155. package/dist/runtime/apps/server/tasks.jsonl +0 -10
  156. package/dist/runtime/foundation/EventBus.js +0 -18
  157. package/dist/runtime/foundation/JsonGateway.js +0 -47
  158. package/dist/runtime/foundation/PolicyEngine.js +0 -21
  159. package/dist/runtime/foundation/README.md +0 -7
  160. package/dist/runtime/foundation/TraceRecorder.js +0 -76
  161. package/dist/runtime/foundation/errors.js +0 -8
  162. package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
  163. package/dist/runtime/foundation/version.js +0 -2
  164. package/dist/runtime/modules/agent/README.md +0 -11
  165. package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
  166. package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
  167. package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
  168. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
  169. package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
  170. package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
  171. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
  172. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
  173. package/dist/runtime/modules/agent/prompt/index.js +0 -46
  174. package/dist/runtime/modules/agent/tasks.jsonl +0 -94
  175. package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
  176. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
  177. package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
  178. package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
  179. package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
  180. package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
  181. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
  182. package/dist/runtime/modules/artifact/README.md +0 -7
  183. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
  184. package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
  185. package/dist/runtime/modules/asset/AssetModule.js +0 -399
  186. package/dist/runtime/modules/asset/README.md +0 -54
  187. package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
  188. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
  189. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
  190. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
  191. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
  192. package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
  193. package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
  194. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
  195. package/dist/runtime/modules/asset/model/admission.js +0 -117
  196. package/dist/runtime/modules/asset/model/errors.js +0 -6
  197. package/dist/runtime/modules/asset/model/parts.js +0 -27
  198. package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
  199. package/dist/runtime/modules/asset/model/schema.js +0 -150
  200. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
  201. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
  202. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
  203. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
  204. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
  205. package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
  206. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
  207. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
  208. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
  209. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
  210. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
  211. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
  212. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
  213. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
  214. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
  215. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
  216. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
  217. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
  218. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
  219. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
  220. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
  221. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
  222. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
  223. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
  224. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
  225. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
  226. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
  227. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
  228. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
  229. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
  230. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
  231. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
  232. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
  233. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
  234. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
  235. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
  236. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
  237. package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
  238. package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
  239. package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
  240. package/dist/runtime/modules/asset/tasks.jsonl +0 -87
  241. package/dist/runtime/modules/generation/README.md +0 -9
  242. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
  243. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
  244. package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
  245. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
  246. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
  247. package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
  248. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
  249. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
  250. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
  251. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
  252. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
  253. package/dist/runtime/modules/generation/tasks.jsonl +0 -35
  254. package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
  255. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
  256. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
  257. package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
  258. package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
  259. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
  260. package/dist/runtime/modules/rendering/README.md +0 -7
  261. package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
  262. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
  263. package/dist/runtime/modules/rendering/createRenderer.js +0 -76
  264. package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
  265. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
  266. package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
  267. package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
  268. package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
  269. package/dist/runtime/modules/world/README.md +0 -13
  270. package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
  271. package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
  272. package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
  273. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
  274. package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
  275. package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
  276. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
  277. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
  278. package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
  279. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
  280. package/dist/runtime/modules/world/content/blankWorld.js +0 -35
  281. package/dist/runtime/modules/world/content/environments.js +0 -84
  282. package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
  283. package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
  284. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
  285. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
  286. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
  287. package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
  288. package/dist/runtime/modules/world/content/magicCabin.js +0 -190
  289. package/dist/runtime/modules/world/content/monumentHall.js +0 -154
  290. package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
  291. package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
  292. package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
  293. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
  294. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
  295. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
  296. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
  297. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
  298. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
  301. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
  302. package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
  303. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
  304. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
  305. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
  306. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
  307. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
  308. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
  309. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
  310. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
  311. package/dist/runtime/modules/world/errors.js +0 -9
  312. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
  313. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
  314. package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
  315. package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
  316. package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
  317. package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
  318. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
  319. package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
  320. package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
  321. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
  322. package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
  323. package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
  324. package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
  325. package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
  326. package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
  327. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
  328. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
  329. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
  330. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
  331. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
  332. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
  333. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
  334. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
  335. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
  336. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
  337. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
  338. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
  339. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
  340. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
  341. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
  342. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
  343. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
  344. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
  345. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
  346. package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
  347. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
  348. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
  349. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
  350. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
  351. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
  352. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
  353. package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
  354. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
  355. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
  356. package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
  357. package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
  358. package/dist/runtime/modules/world/tasks.jsonl +0 -530
  359. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
  360. package/dist/runtime/modules/world/verification/Finding.js +0 -105
  361. package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
  362. package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
  363. package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
  364. package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
  365. package/dist/runtime/package-lock.json +0 -6245
  366. package/dist/runtime/package.json +0 -91
  367. package/dist/runtime/public/assets/cabinet.glb +0 -0
  368. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  369. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  370. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  371. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  372. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  373. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  374. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  375. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  376. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  377. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  379. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  380. package/dist/schema-Dudvovhu.js +0 -364
  381. package/dist/schema-Dudvovhu.js.map +0 -1
  382. package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
  383. package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
  384. package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
  385. package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
  386. package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
  387. package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
@@ -1,109 +0,0 @@
1
- import * as THREE from 'three';
2
- import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
3
- import { markAuthoringModelRef } from './ModelRef.js';
4
-
5
- function createThreeNamespace(GLTFLoaderClass) {
6
- class AuthoringGLTFLoader extends GLTFLoaderClass {
7
- async loadAsync(url, onProgress) {
8
- const gltf = await super.loadAsync(url, onProgress);
9
- if (gltf?.scene) markAuthoringModelRef(gltf.scene, { uri:String(url) });
10
- return gltf;
11
- }
12
-
13
- load(url, onLoad, onProgress, onError) {
14
- return super.load(url, (gltf) => {
15
- if (gltf?.scene) markAuthoringModelRef(gltf.scene, { uri:String(url) });
16
- onLoad?.(gltf);
17
- }, onProgress, onError);
18
- }
19
- }
20
-
21
- return Object.freeze({
22
- ...THREE,
23
- GLTFLoader:AuthoringGLTFLoader
24
- });
25
- }
26
-
27
- export function createAuthoringExecutionHost({
28
- gltfLoaderClass = GLTFLoader,
29
- requestFrame = globalThis.requestAnimationFrame?.bind(globalThis),
30
- cancelFrame = globalThis.cancelAnimationFrame?.bind(globalThis),
31
- setTimeoutImpl = globalThis.setTimeout?.bind(globalThis),
32
- clearTimeoutImpl = globalThis.clearTimeout?.bind(globalThis),
33
- setIntervalImpl = globalThis.setInterval?.bind(globalThis),
34
- clearIntervalImpl = globalThis.clearInterval?.bind(globalThis)
35
- } = {}) {
36
- const frames = new Set();
37
- const timeouts = new Set();
38
- const intervals = new Set();
39
- const authoringThree = createThreeNamespace(gltfLoaderClass);
40
-
41
- const requestAnimationFrame = (callback) => {
42
- if (typeof requestFrame !== 'function') throw new TypeError('requestAnimationFrame is unavailable');
43
- let id = null;
44
- id = requestFrame((time) => {
45
- frames.delete(id);
46
- callback(time);
47
- });
48
- frames.add(id);
49
- return id;
50
- };
51
-
52
- const cancelAnimationFrame = (id) => {
53
- frames.delete(id);
54
- cancelFrame?.(id);
55
- };
56
-
57
- const setTimeout = (callback, delay = 0, ...args) => {
58
- if (typeof setTimeoutImpl !== 'function') throw new TypeError('setTimeout is unavailable');
59
- let id = null;
60
- id = setTimeoutImpl((...values) => {
61
- timeouts.delete(id);
62
- callback(...values);
63
- }, delay, ...args);
64
- timeouts.add(id);
65
- return id;
66
- };
67
-
68
- const clearTimeout = (id) => {
69
- timeouts.delete(id);
70
- clearTimeoutImpl?.(id);
71
- };
72
-
73
- const setInterval = (callback, delay = 0, ...args) => {
74
- if (typeof setIntervalImpl !== 'function') throw new TypeError('setInterval is unavailable');
75
- const id = setIntervalImpl(callback, delay, ...args);
76
- intervals.add(id);
77
- return id;
78
- };
79
-
80
- const clearInterval = (id) => {
81
- intervals.delete(id);
82
- clearIntervalImpl?.(id);
83
- };
84
-
85
- const clear = () => {
86
- for (const id of frames) cancelFrame?.(id);
87
- for (const id of timeouts) clearTimeoutImpl?.(id);
88
- for (const id of intervals) clearIntervalImpl?.(id);
89
- frames.clear();
90
- timeouts.clear();
91
- intervals.clear();
92
- };
93
-
94
- return {
95
- THREE:authoringThree,
96
- requestAnimationFrame,
97
- cancelAnimationFrame,
98
- setTimeout,
99
- clearTimeout,
100
- setInterval,
101
- clearInterval,
102
- clear,
103
- diagnostics:()=>({
104
- frames:frames.size,
105
- timeouts:timeouts.size,
106
- intervals:intervals.size
107
- })
108
- };
109
- }
@@ -1,17 +0,0 @@
1
- const objectIds = new WeakMap();
2
-
3
- export function getAuthoringObjectId(object) {
4
- if (!object?.isObject3D) return null;
5
- const sidecarId = objectIds.get(object);
6
- if (sidecarId) return sidecarId;
7
- const legacyId = object.userData?.authoringId;
8
- return typeof legacyId === 'string' && legacyId.trim() ? legacyId : null;
9
- }
10
-
11
- export function setAuthoringObjectId(object, id) {
12
- if (!object?.isObject3D) throw new TypeError('World Authoring identity target must be an Object3D');
13
- const value = String(id || '').trim();
14
- if (!value) throw new TypeError('World Authoring identity requires a non-empty id');
15
- objectIds.set(object, value);
16
- return value;
17
- }
@@ -1,29 +0,0 @@
1
- import { normalizeAuthoringModelRef } from './ModelRef.js';
2
-
3
- export function createAuthoringModelResolver({
4
- assetLoader = null,
5
- gltfLoader = null
6
- } = {}) {
7
- return async function resolveAuthoringModel(reference) {
8
- const normalized = normalizeAuthoringModelRef(reference);
9
- const source = normalized.source;
10
-
11
- if (source.type === 'url') {
12
- if (!gltfLoader || typeof gltfLoader.loadScene !== 'function') {
13
- throw new TypeError('World Authoring URL ModelRef resolution requires a GLTF scene loader');
14
- }
15
- return gltfLoader.loadScene(source.uri);
16
- }
17
-
18
- if (!assetLoader || typeof assetLoader.instantiate !== 'function') {
19
- throw new TypeError('World Authoring AssetRef resolution requires AssetLoader');
20
- }
21
-
22
- const assetId = source.assetRef.assetId;
23
- const result = await assetLoader.instantiate(assetId);
24
- if (!result?.object?.isObject3D) {
25
- throw new TypeError(`World Authoring AssetRef resolver returned no Object3D: ${assetId}`);
26
- }
27
- return result.object;
28
- };
29
- }
@@ -1,118 +0,0 @@
1
- import {
2
- exportAuthoringDocument,
3
- parseAuthoringDocument
4
- } from './AuthoringDocument.js';
5
-
6
- function clone(value) {
7
- return JSON.parse(JSON.stringify(value));
8
- }
9
-
10
- function mergeObject(base, patch) {
11
- if (!patch || typeof patch !== 'object' || Array.isArray(patch)) return clone(patch);
12
- const result = { ...(base || {}) };
13
- for (const [key, value] of Object.entries(patch)) {
14
- if (value === undefined) continue;
15
- if (
16
- value
17
- && typeof value === 'object'
18
- && !Array.isArray(value)
19
- && result[key]
20
- && typeof result[key] === 'object'
21
- && !Array.isArray(result[key])
22
- ) {
23
- result[key] = mergeObject(result[key], value);
24
- } else {
25
- result[key] = clone(value);
26
- }
27
- }
28
- return result;
29
- }
30
-
31
- function removeSubtree(state, id) {
32
- if (id === state.rootId) throw new TypeError('World Authoring patch cannot remove the root');
33
- const node = state.nodesById[id];
34
- if (!node) throw new TypeError(`World Authoring patch node not found: ${id}`);
35
-
36
- for (const childId of [...(state.childIdsById[id] || [])]) {
37
- removeSubtree(state, childId);
38
- }
39
-
40
- const parentId = state.parentIdById[id];
41
- if (parentId && state.childIdsById[parentId]) {
42
- state.childIdsById[parentId] = state.childIdsById[parentId].filter(childId => childId !== id);
43
- }
44
-
45
- delete state.nodesById[id];
46
- delete state.childIdsById[id];
47
- delete state.parentIdById[id];
48
- }
49
-
50
- function insertNode(state, node, parentId, index) {
51
- if (!state.nodesById[parentId]) {
52
- throw new TypeError(`World Authoring patch parent not found: ${parentId}`);
53
- }
54
- if (state.nodesById[parentId].components?.modelRef) {
55
- throw new TypeError('World Authoring patch cannot add authored children to ModelRef');
56
- }
57
- if (!node || typeof node.id !== 'string' || !node.id) {
58
- throw new TypeError('World Authoring patch added node requires an id');
59
- }
60
- if (state.nodesById[node.id]) {
61
- throw new TypeError(`World Authoring patch duplicate node id: ${node.id}`);
62
- }
63
-
64
- const { children = [], ...record } = clone(node);
65
- state.nodesById[node.id] = record;
66
- state.parentIdById[node.id] = parentId;
67
- state.childIdsById[node.id] = [];
68
-
69
- const siblings = state.childIdsById[parentId];
70
- const insertAt = Number.isInteger(index) ? Math.max(0, Math.min(index, siblings.length)) : siblings.length;
71
- siblings.splice(insertAt, 0, node.id);
72
-
73
- for (const child of children) {
74
- insertNode(state, child, node.id);
75
- }
76
- }
77
-
78
- function mergeResources(target, additions, label) {
79
- for (const [id, definition] of Object.entries(additions || {})) {
80
- if (target[id] && JSON.stringify(target[id]) !== JSON.stringify(definition)) {
81
- throw new TypeError(`World Authoring patch ${label} id conflict: ${id}`);
82
- }
83
- target[id] = clone(definition);
84
- }
85
- }
86
-
87
- export function patchAuthoringDocument(document, patch = {}) {
88
- const state = parseAuthoringDocument(document);
89
-
90
- mergeResources(state.geometries, patch.geometries, 'geometry');
91
- mergeResources(state.materials, patch.materials, 'material');
92
- mergeResources(state.textures, patch.textures, 'texture');
93
-
94
- for (const change of patch.update || []) {
95
- if (!change || typeof change.id !== 'string') {
96
- throw new TypeError('World Authoring patch update requires an id');
97
- }
98
- const node = state.nodesById[change.id];
99
- if (!node) throw new TypeError(`World Authoring patch node not found: ${change.id}`);
100
-
101
- const { id, ...updates } = change;
102
- state.nodesById[id] = mergeObject(node, updates);
103
- state.nodesById[id].id = id;
104
- }
105
-
106
- for (const id of patch.remove || []) {
107
- removeSubtree(state, id);
108
- }
109
-
110
- for (const addition of patch.add || []) {
111
- if (!addition || typeof addition.parentId !== 'string' || !addition.node) {
112
- throw new TypeError('World Authoring patch add requires parentId and node');
113
- }
114
- insertNode(state, addition.node, addition.parentId, addition.index);
115
- }
116
-
117
- return exportAuthoringDocument(state);
118
- }
@@ -1,334 +0,0 @@
1
- import { assetAdmission } from '../../modules/asset/model/admission.js';
2
- import { physicsManifestForUniformScale, uniformScaleValue } from '../../modules/world/runtime/ObjectTransform.js';
3
- import { capturePromotionSource, promotionError } from './AuthoringPromotionSource.js';
4
-
5
- const clone = value => structuredClone(value);
6
- const uid = prefix => `${prefix}_${globalThis.crypto.randomUUID()}`;
7
- const USAGES = ['static', 'movable', 'interactive'];
8
- const ACTIONS = ['pickup', 'open', 'close', 'read', 'write', 'toggle', 'turn_on', 'turn_off', 'push', 'pull'];
9
- const portableState = state => {
10
- const result = clone(state);
11
- delete result.heldBy;
12
- delete result.navigation;
13
- return result;
14
- };
15
-
16
- export class AuthoringPromotionController {
17
- constructor({ authoring, world, produceAsset, verify = null, verifyBehavior = null }) {
18
- if (!authoring?.export || !world?.mutate || !world?.commands) throw new TypeError('Promotion requires Authoring and WorldRuntime');
19
- Object.assign(this, { authoring, world, produceAsset, verify, verifyBehavior });
20
- this.documentId = uid('authoring');
21
- this.entries = new Map();
22
- this.busy = false;
23
- this.stops = [
24
- world.events.on('object.removed', () => this.reconcile()),
25
- world.events.on('scene.restored', () => { this.invalidateVerification(); this.reconcile(); }),
26
- world.events.on('environment.replaced', () => { this.invalidateVerification(); this.reconcile(); }),
27
- world.events.on('history.changed', () => this.reconcile()),
28
- world.events.on('object.transformed', ({ id } = {}) => {
29
- this.invalidateVerification(entry => entry.entityId === id);
30
- this.reconcile();
31
- })
32
- ];
33
- }
34
-
35
- invalidateVerification(predicate = null) {
36
- for (const entry of this.entries.values()) {
37
- if (entry.verification && (!predicate || predicate(entry))) entry.verification = null;
38
- }
39
- }
40
-
41
- exportState() {
42
- // Store only our instances, and keep their latest runtime pose/state for reopening.
43
- const entries = [...this.entries.values()].map(entry => {
44
- const saved = clone(entry);
45
- const record = this.linkedRecord(entry);
46
- if (record) saved.instance = {
47
- position:record.object.position.toArray(), quaternion:record.object.quaternion.toArray(),
48
- scale:record.physicsScale || 1,
49
- // Held ownership and running navigation cannot be transferred into a partial world file.
50
- initialState:portableState(record.state)
51
- };
52
- return saved;
53
- });
54
- return { version:1, documentId:this.documentId, entries };
55
- }
56
-
57
- validateState(state) {
58
- if (state == null) return;
59
- if (state.version !== 1 || typeof state.documentId !== 'string' || !Array.isArray(state.entries)) throw promotionError('AUTHORING_PROMOTION_STATE_INVALID', '晋升记录格式无效');
60
- const nodes = new Set(), entities = new Set();
61
- for (const entry of state.entries) {
62
- if (!entry.nodeId || nodes.has(entry.nodeId) || !USAGES.includes(entry.usage) || !entry.assetId || !entry.sourceHash || !entry.contentHash) throw promotionError('AUTHORING_PROMOTION_STATE_INVALID', '晋升记录缺少身份或存在重复节点');
63
- nodes.add(entry.nodeId);
64
- if (entry.entityId) {
65
- if (entities.has(entry.entityId) || !entry.linkId || !entry.instance) throw promotionError('AUTHORING_PROMOTION_STATE_INVALID', '晋升实体记录无效');
66
- entities.add(entry.entityId);
67
- const transform = entry.instance;
68
- const finite = (value, size) => Array.isArray(value) && value.length === size && value.every(Number.isFinite);
69
- if (!finite(transform.position, 3) || !finite(transform.quaternion, 4) || Math.hypot(...transform.quaternion) < 1e-6) throw promotionError('AUTHORING_PROMOTION_STATE_INVALID', '晋升实体变换无效');
70
- uniformScaleValue(transform.scale);
71
- const link = transform.initialState?.authoringPromotion;
72
- if (link?.documentId !== state.documentId || link?.nodeId !== entry.nodeId || link?.linkId !== entry.linkId) throw promotionError('AUTHORING_PROMOTION_STATE_INVALID', '晋升实体来源关联无效');
73
- if ('heldBy' in transform.initialState || 'navigation' in transform.initialState) throw promotionError('AUTHORING_PROMOTION_STATE_INVALID', '创作存档不能恢复持有关系或运行中的导航');
74
- }
75
- }
76
- }
77
-
78
- loadState(state = null) {
79
- if (this.busy) throw promotionError('AUTHORING_PROMOTION_BUSY', '晋升操作尚未完成');
80
- this.validateState(state);
81
- this.documentId = state?.documentId || uid('authoring');
82
- this.entries = new Map((state?.entries || []).map(entry => [entry.nodeId, clone(entry)]));
83
- this.reconcile();
84
- }
85
-
86
- linkedRecord(entry) {
87
- if (!entry?.entityId || entry.worldId !== (this.world.environment?.id || null) || !this.world.store.has(entry.entityId)) return null;
88
- const record = this.world.store.get(entry.entityId);
89
- const link = record.state?.authoringPromotion;
90
- return record.assetId === entry.assetId && link?.documentId === this.documentId && link?.linkId === entry.linkId ? record : null;
91
- }
92
-
93
- reconcile() {
94
- // World undo/redo can restore an older installed revision. Adopt its provenance,
95
- // not the latest editor record, without issuing another World command.
96
- for (const [, record] of this.world.store.list()) {
97
- const link = record.state?.authoringPromotion;
98
- const entry = link && this.entries.get(link.nodeId);
99
- if (entry?.entityId === record.id && link.documentId === this.documentId
100
- && entry.worldId === (this.world.environment?.id || null) && link.contentHash) {
101
- if (entry.linkId !== link.linkId) entry.verification = null;
102
- Object.assign(entry, { assetId:record.assetId, linkId:link.linkId, sourceHash:link.sourceHash,
103
- contentHash:link.contentHash, usage:link.usage, revisionId:link.revisionId });
104
- }
105
- }
106
- this.authoring.setPromotedNodes([...this.entries.values()].filter(entry => this.linkedRecord(entry)).map(entry => entry.nodeId));
107
- }
108
-
109
- list() {
110
- this.reconcile();
111
- const document = this.authoring.export();
112
- const nodes = [];
113
- const visit = (node, depth = 0) => {
114
- if (node.id !== document.root.id) {
115
- const entry = this.entries.get(node.id);
116
- let source = null, reason = null;
117
- try { source = capturePromotionSource(this.authoring, node.id); } catch (error) { reason = error.message; }
118
- const linked = this.linkedRecord(entry);
119
- let status = entry ? (entry.entityId ? (linked ? 'promoted' : 'missing') : 'prepared') : 'draft';
120
- if (entry && source && source.sourceHash !== entry.sourceHash) status = linked ? 'outdated' : 'changed';
121
- const admission = entry && this.world.assetModule.hasAsset(entry.assetId) ? assetAdmission(this.world.assetModule.getManifest(entry.assetId)) : null;
122
- if (status === 'promoted' && admission?.status !== 'ready') status = 'editing';
123
- nodes.push({ nodeId:node.id, name:node.name || node.id, depth, status, reason, usage:entry?.usage || 'static',
124
- assetId:entry?.assetId || null, entityId:entry?.entityId || null,
125
- admission,
126
- verification:entry?.verification || null });
127
- }
128
- for (const child of node.children || []) visit(child, depth + 1);
129
- };
130
- visit(document.root, -1);
131
- return nodes;
132
- }
133
-
134
- async runExclusive(operation) {
135
- if (this.busy || this.fileBusy) throw promotionError('AUTHORING_PROMOTION_BUSY', '创作存档或晋升操作尚未完成');
136
- this.busy = true;
137
- try { return await operation(); }
138
- finally { this.busy = false; this.reconcile(); this.world.events.emit('authoring.promotion.changed', {}); }
139
- }
140
-
141
- assertSource(source, worldId) {
142
- if (worldId !== (this.world.environment?.id || null)
143
- || capturePromotionSource(this.authoring, source.nodeId).sourceHash !== source.sourceHash) {
144
- throw promotionError('AUTHORING_PROMOTION_STALE', '创作对象或当前世界已改变,请重新准备');
145
- }
146
- }
147
-
148
- checkSelection(source) {
149
- for (const entry of this.entries.values()) {
150
- if (entry.nodeId === source.nodeId || !entry.entityId) continue;
151
- const other = this.authoring.get(entry.nodeId);
152
- if (!other) continue;
153
- let node = source.object;
154
- while (node) {
155
- if (node === other) throw promotionError('AUTHORING_PROMOTION_OVERLAP', '该对象属于已晋升分组,请更新该分组');
156
- node = node.parent;
157
- }
158
- if (source.ids.includes(entry.nodeId)) throw promotionError('AUTHORING_PROMOTION_OVERLAP', '该分组包含已晋升对象,请先解除已有晋升关联');
159
- }
160
- }
161
-
162
- async prepare(nodeId, { usage = 'static' } = {}) {
163
- return this.runExclusive(async () => {
164
- const source = capturePromotionSource(this.authoring, nodeId);
165
- const worldId = this.world.environment?.id || null;
166
- const prepared = await this.prepareSource(source, usage);
167
- this.assertSource(source, worldId);
168
- // Preparing a changed source must not overwrite the currently installed version.
169
- const previous = this.entries.get(nodeId);
170
- if (previous?.entityId) this.entries.set(nodeId, { ...previous, pending:prepared });
171
- else this.entries.set(nodeId, prepared);
172
- return { status:'authoring-prepared', ...clone(prepared) };
173
- });
174
- }
175
-
176
- async prepareSource(source, usage) {
177
- if (!USAGES.includes(usage)) throw promotionError('AUTHORING_USAGE_INVALID', '未知的对象用途');
178
- this.checkSelection(source);
179
- const existing = this.entries.get(source.nodeId);
180
- const cached = existing?.pending || existing;
181
- let assetId;
182
- if (source.reference?.source?.type === 'asset') assetId = source.reference.source.assetRef.assetId;
183
- else if (cached?.contentHash === source.contentHash && cached.usage === usage) assetId = cached.assetId;
184
- else {
185
- if (!this.produceAsset) throw promotionError('AUTHORING_PRODUCTION_UNAVAILABLE', '创作资产生产尚未配置');
186
- const produced = await this.produceAsset(source, { usage });
187
- if (produced.status === 'asset-rejected') throw promotionError('AUTHORING_ASSET_REJECTED', `资产被拒绝:${produced.admission?.reasons?.join(', ') || '编译失败'}`);
188
- assetId = produced.assetId;
189
- }
190
- if (!this.world.assetModule.hasAsset(assetId)) throw promotionError('AUTHORING_ASSET_MISSING', '正式资产不存在,请重新准备');
191
- const manifest = this.world.assetModule.getManifest(assetId);
192
- const admission = assetAdmission(manifest);
193
- if (admission.status === 'rejected') throw promotionError('AUTHORING_ASSET_REJECTED', admission.reasons.join(', '));
194
- if (usage === 'static' && manifest.physics?.body !== 'fixed') throw promotionError('AUTHORING_USAGE_MISMATCH', '该资产不是静态物件,请选择匹配的用途');
195
- if (usage === 'movable' && (manifest.physics?.body !== 'dynamic' || !manifest.actions?.includes('pickup'))) throw promotionError('AUTHORING_USAGE_MISMATCH', '该资产没有动态刚体和拾取能力');
196
- if (usage === 'interactive' && !manifest.actions?.some(action => ACTIONS.includes(action))) throw promotionError('AUTHORING_USAGE_MISMATCH', '该资产尚未具备可执行交互,请先完善资产能力');
197
- physicsManifestForUniformScale(manifest, source.transform.scale);
198
- return { nodeId:source.nodeId, name:source.name, assetId, usage, sourceHash:source.sourceHash,
199
- contentHash:source.contentHash, revisionId:source.revisionId, transform:source.transform, admission };
200
- }
201
-
202
- async promote(nodeId, { usage = null, allowProvisional = false, update = false } = {}) {
203
- return this.runExclusive(async () => {
204
- const source = capturePromotionSource(this.authoring, nodeId);
205
- const worldId = this.world.environment?.id || null;
206
- const previous = this.entries.get(nodeId);
207
- const linked = this.linkedRecord(previous);
208
- if (linked && source.sourceHash === previous.sourceHash && (!usage || usage === previous.usage)) return {
209
- status:assetAdmission(this.world.assetModule.getManifest(previous.assetId)).status === 'ready' ? 'authoring-promoted' : 'authoring-provisional', reused:true, ...clone(previous)
210
- };
211
- if (previous?.entityId && !update) throw promotionError('AUTHORING_UPDATE_REQUIRED', '该对象已有晋升记录,请使用更新或恢复操作');
212
- if (previous?.entityId && previous.worldId !== worldId) throw promotionError('AUTHORING_WORLD_MISMATCH', '请在原目标世界中更新此对象');
213
- const prepared = await this.prepareSource(source, usage || previous?.usage || 'static');
214
- this.assertSource(source, worldId);
215
- if (prepared.admission.status !== 'ready' && !allowProvisional) throw promotionError('AUTHORING_ASSET_PROVISIONAL', `资产仅可用于编辑态:${prepared.admission.reasons.join(', ')}`);
216
- const entry = { ...prepared, worldId, entityId:previous?.entityId || uid('entity'),
217
- linkId:uid('promotion'), instance:{ ...prepared.transform } };
218
- entry.instance.initialState = { authoringPromotion:{ documentId:this.documentId, nodeId, linkId:entry.linkId,
219
- sourceHash:source.sourceHash, contentHash:source.contentHash, usage:entry.usage, revisionId:source.revisionId } };
220
- if (linked?.assetId === entry.assetId) entry.instance.initialState = {
221
- ...portableState(linked.state), ...entry.instance.initialState
222
- };
223
- const result = await this.install(entry, { previous, source, allowProvisional });
224
- this.entries.set(nodeId, entry);
225
- return result;
226
- });
227
- }
228
-
229
- async install(entry, { previous = null, source = null, allowProvisional = false } = {}) {
230
- const manifest = this.world.assetModule.getManifest(entry.assetId);
231
- if (!manifest) throw promotionError('AUTHORING_ASSET_MISSING', '恢复所需的资产不存在');
232
- const admission = assetAdmission(manifest);
233
- if (admission.status === 'rejected' || (admission.status !== 'ready' && !allowProvisional)) throw promotionError('AUTHORING_ASSET_NOT_READY', '资产当前未通过正式准入');
234
- const old = previous && this.linkedRecord(previous);
235
- if (this.world.store.has(entry.entityId) && !old) throw promotionError('AUTHORING_ENTITY_CONFLICT', '目标实体 ID 已被其他对象占用');
236
- if (old?.state?.heldBy) throw promotionError('AUTHORING_ENTITY_HELD', '请先放下正在持有的对象');
237
- return this.world.mutate('authoring:promote', async () => {
238
- if (entry.worldId !== (this.world.environment?.id || null)) throw promotionError('AUTHORING_WORLD_MISMATCH', '晋升的目标世界不匹配');
239
- if (source) this.assertSource(source, entry.worldId);
240
- const scaled = physicsManifestForUniformScale(manifest, entry.instance.scale);
241
- let pose = this.world.physics.checkManifestPose(scaled, entry.instance.position, {
242
- quaternion:entry.instance.quaternion, excludeIds:old ? [entry.entityId] : []
243
- });
244
- // A dynamic body authored flush with the ground is routinely reported
245
- // as blocked by the environment collider alone (touching counts as a
246
- // collision, and built-in objects spawn slightly above the floor).
247
- // Retry once with a small lift; physics settles the body onto the
248
- // ground. Static placements keep the strict check.
249
- let groundLift = 0;
250
- if (pose.checked && !pose.clear && entry.usage === 'movable'
251
- && pose.blockedBy?.length && pose.blockedBy.every(id => String(id).startsWith('environment:'))) {
252
- const lifted = [entry.instance.position[0], entry.instance.position[1] + 0.05, entry.instance.position[2]];
253
- const retry = this.world.physics.checkManifestPose(scaled, lifted, {
254
- quaternion:entry.instance.quaternion, excludeIds:old ? [entry.entityId] : []
255
- });
256
- if (retry.checked && retry.clear) { pose = retry; groundLift = 0.05; entry.instance.position = lifted; }
257
- }
258
- if (pose.checked && !pose.clear) {
259
- const error = promotionError('AUTHORING_PLACEMENT_BLOCKED', `放置位置发生碰撞:${pose.blockedBy?.join(', ')}`);
260
- error.details = { blockedBy:(pose.blockedBy || []).slice(0, 8).map(id => String(id).slice(0, 64)) };
261
- throw error;
262
- }
263
- if (!pose.checked && !allowProvisional) throw promotionError('AUTHORING_PLACEMENT_UNVERIFIED', '当前物理后端无法验证该位置');
264
- if (old) this.world.commands.remove(entry.entityId);
265
- const spawned = await this.world.commands.spawn(entry.assetId, { id:entry.entityId, ...entry.instance });
266
- if (spawned?.status === 'asset-rejected') throw promotionError('AUTHORING_ASSET_REJECTED', '资产在实例化时被拒绝');
267
- if (!this.world.store.has(entry.entityId)) throw promotionError('AUTHORING_SPAWN_FAILED', '世界没有创建目标实体');
268
- const physicsPosition = this.world.physics.getPosition(entry.entityId);
269
- if (!physicsPosition) throw promotionError('AUTHORING_PHYSICS_FAILED', '世界实体没有物理刚体');
270
- const navigation = this.world.navigation?.ensureCurrent
271
- ? await this.world.navigation.ensureCurrent() : { success:false, code:'NAVIGATION_UNAVAILABLE' };
272
- entry.verification = { physics:{ registered:true, placement:{ ...clone(pose), ...(groundLift ? { groundLift } : {}) } },
273
- navigation:clone(navigation), interaction:{ status:'not-exercised', actions:manifest.actions.filter(action => ACTIONS.includes(action)) },
274
- admission:clone(admission), checkedAt:new Date().toISOString() };
275
- if (this.verify) {
276
- const verification = await this.verify(entry, this.world);
277
- if (verification?.ok === false) throw promotionError('AUTHORING_VERIFICATION_FAILED', verification.reason || '世界行为验证失败');
278
- entry.verification.behavior = clone(verification);
279
- }
280
- if (source) this.assertSource(source, entry.worldId);
281
- return { status:admission.status === 'ready' ? 'authoring-promoted' : 'authoring-provisional', ...clone(entry) };
282
- }, { source:'authoring', nodeId:entry.nodeId, documentId:this.documentId });
283
- }
284
-
285
- async restore({ allowProvisional = false } = {}) {
286
- return this.runExclusive(async () => {
287
- const results = [];
288
- for (const entry of this.entries.values()) {
289
- if (!entry.entityId || this.linkedRecord(entry)) continue;
290
- try {
291
- const result = await this.install(entry, { allowProvisional });
292
- results.push({ nodeId:entry.nodeId, ...result });
293
- } catch (error) { results.push({ nodeId:entry.nodeId, status:'authoring-restore-failed', code:error.code, reason:error.message }); }
294
- }
295
- return { status:results.some(result => result.status === 'authoring-restore-failed') ? 'authoring-restore-failed' : 'authoring-restored', results };
296
- });
297
- }
298
-
299
- async detach(nodeId) {
300
- return this.runExclusive(async () => {
301
- // Detaching leaves the formal entity intact; it explicitly makes the draft independent again.
302
- const entry = this.entries.get(nodeId);
303
- this.entries.delete(nodeId);
304
- return { status:'authoring-detached', nodeId, entityId:entry?.entityId || null };
305
- });
306
- }
307
-
308
- async verifyEntity(nodeId, { exerciseInteraction = false } = {}) {
309
- return this.runExclusive(async () => {
310
- const entry = this.entries.get(nodeId);
311
- const record = this.linkedRecord(entry);
312
- if (!record) throw promotionError('AUTHORING_ENTITY_MISSING', '请先恢复或晋升该对象');
313
- const manifest = this.world.assetModule.getManifest(entry.assetId);
314
- const actions = manifest.actions.filter(action => ACTIONS.includes(action));
315
- let interaction = { status:actions.length ? 'not-exercised' : 'not-applicable', actions };
316
- if (exerciseInteraction && actions.length) {
317
- if (!this.verifyBehavior) throw promotionError('AUTHORING_VERIFIER_UNAVAILABLE', '当前宿主没有配置行为验证器');
318
- try { interaction = { ...interaction, ...await this.verifyBehavior(entry, this.world) }; }
319
- catch (error) { interaction = { ...interaction, status:'failed', reason:error.code || error.message }; }
320
- }
321
- if (!this.linkedRecord(entry)) throw promotionError('AUTHORING_VERIFICATION_STALE', '验证过程中目标实体发生变化');
322
- const pose = this.world.physics.checkManifestPose(physicsManifestForUniformScale(manifest, record.physicsScale || 1), record.object.position.toArray(), {
323
- quaternion:record.object.quaternion.toArray(), excludeIds:[entry.entityId]
324
- });
325
- const navigation = await this.world.navigation?.ensureCurrent?.() || { success:false, code:'NAVIGATION_UNAVAILABLE' };
326
- entry.verification = { physics:{ registered:Boolean(this.world.physics.getPosition(entry.entityId)), placement:pose },
327
- navigation:clone(navigation), interaction:clone(interaction), admission:assetAdmission(manifest), checkedAt:new Date().toISOString() };
328
- const verified = pose.checked && pose.clear && navigation.success && ['verified', 'not-applicable'].includes(interaction.status);
329
- return { status:verified ? 'authoring-verified' : 'authoring-unverified', nodeId, entityId:entry.entityId, verification:clone(entry.verification) };
330
- });
331
- }
332
-
333
- dispose() { for (const stop of this.stops) stop(); this.authoring.setPromotedNodes([]); }
334
- }