agentscape3d-engine 0.0.0-stage → 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 (457) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/cli.mjs +53 -0
  4. package/dist/ArticulationVerifier-BfGxXY8V.js +337 -0
  5. package/dist/ArticulationVerifier-BfGxXY8V.js.map +1 -0
  6. package/dist/AssetCompiler-BLj09iu1.js +2424 -0
  7. package/dist/AssetCompiler-BLj09iu1.js.map +1 -0
  8. package/dist/AssetModule-DME-XaFS.js +2637 -0
  9. package/dist/AssetModule-DME-XaFS.js.map +1 -0
  10. package/dist/AssetRecipe-g8dZBhgJ.js +298 -0
  11. package/dist/AssetRecipe-g8dZBhgJ.js.map +1 -0
  12. package/dist/BrowserCodeWorker.js +53856 -0
  13. package/dist/BrowserCodeWorker.js.map +1 -0
  14. package/dist/CarryCapability-CXwHU5ay.js +104 -0
  15. package/dist/CarryCapability-CXwHU5ay.js.map +1 -0
  16. package/dist/KinematicHypothesisScreen-C3TKiuYR.js +241 -0
  17. package/dist/KinematicHypothesisScreen-C3TKiuYR.js.map +1 -0
  18. package/dist/ObjectTransform-BlQUNK7c.js +61 -0
  19. package/dist/ObjectTransform-BlQUNK7c.js.map +1 -0
  20. package/dist/RapierPhysicsBackend-B2wQe_Vl.js +3259 -0
  21. package/dist/RapierPhysicsBackend-B2wQe_Vl.js.map +1 -0
  22. package/dist/RenderingSystem-WIr1ZuGu.js +1042 -0
  23. package/dist/RenderingSystem-WIr1ZuGu.js.map +1 -0
  24. package/dist/ScenePresentation-LsYiDxbm.js +152 -0
  25. package/dist/ScenePresentation-LsYiDxbm.js.map +1 -0
  26. package/dist/SceneProject-K7HH1s8o.js +2687 -0
  27. package/dist/SceneProject-K7HH1s8o.js.map +1 -0
  28. package/dist/SceneSerializer-zOzbX4jZ.js +932 -0
  29. package/dist/SceneSerializer-zOzbX4jZ.js.map +1 -0
  30. package/dist/SimulationProfile-DSYZbBLQ.js +165 -0
  31. package/dist/SimulationProfile-DSYZbBLQ.js.map +1 -0
  32. package/dist/StylePack-DcRa_kU0.js +88 -0
  33. package/dist/StylePack-DcRa_kU0.js.map +1 -0
  34. package/dist/WorldArchive-BiFGLt--.js +451 -0
  35. package/dist/WorldArchive-BiFGLt--.js.map +1 -0
  36. package/dist/WorldCommands-Debj7V4L.js +2207 -0
  37. package/dist/WorldCommands-Debj7V4L.js.map +1 -0
  38. package/dist/WorldIO-Ch8QBfKY.js +151 -0
  39. package/dist/WorldIO-Ch8QBfKY.js.map +1 -0
  40. package/dist/admission-CVEvsrdz.js +121 -0
  41. package/dist/admission-CVEvsrdz.js.map +1 -0
  42. package/dist/blankWorld-B0MW6g7q.js +75 -0
  43. package/dist/blankWorld-B0MW6g7q.js.map +1 -0
  44. package/dist/core.d.ts +68 -0
  45. package/dist/core.js +209 -0
  46. package/dist/core.js.map +1 -0
  47. package/dist/disposeObject3D-DIMzy0FA.js +128 -0
  48. package/dist/disposeObject3D-DIMzy0FA.js.map +1 -0
  49. package/dist/environments-HOe3sJXH.js +567 -0
  50. package/dist/environments-HOe3sJXH.js.map +1 -0
  51. package/dist/gltfIO-BzVKLyaL.js +339 -0
  52. package/dist/gltfIO-BzVKLyaL.js.map +1 -0
  53. package/dist/grandUrbanBlock-DRndRZjF.js +515 -0
  54. package/dist/grandUrbanBlock-DRndRZjF.js.map +1 -0
  55. package/dist/index.d.ts +345 -0
  56. package/dist/index.js +16952 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/magicCabin-CfBZjx2Q.js +11019 -0
  59. package/dist/magicCabin-CfBZjx2Q.js.map +1 -0
  60. package/dist/manifests-D0LwbJ36.js +866 -0
  61. package/dist/manifests-D0LwbJ36.js.map +1 -0
  62. package/dist/mcp.d.ts +2 -0
  63. package/dist/mcp.js +1 -0
  64. package/dist/monumentHall-awZiGtda.js +403 -0
  65. package/dist/monumentHall-awZiGtda.js.map +1 -0
  66. package/dist/node.d.ts +16 -0
  67. package/dist/node.js +26 -0
  68. package/dist/parts-DrEcfJRl.js +37 -0
  69. package/dist/parts-DrEcfJRl.js.map +1 -0
  70. package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
  71. package/dist/ruinedCourtyard-DuF7NmUU.js +696 -0
  72. package/dist/ruinedCourtyard-DuF7NmUU.js.map +1 -0
  73. package/dist/runtime/application/AgentTools.js +28 -0
  74. package/dist/runtime/application/README.md +14 -0
  75. package/dist/runtime/application/agent/ProgressiveAgentTools.js +92 -0
  76. package/dist/runtime/application/agent/StudioMcpAllowlist.js +10 -0
  77. package/dist/runtime/application/agent/StudioProjectTools.js +18 -0
  78. package/dist/runtime/application/agent/TaskEvidence.js +199 -0
  79. package/dist/runtime/application/buildTaskObservation.js +117 -0
  80. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +50 -0
  81. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +35 -0
  82. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +17 -0
  83. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +82 -0
  84. package/dist/runtime/application/createSession.js +66 -0
  85. package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
  86. package/dist/runtime/application/generation/GenerationOrchestrator.js +630 -0
  87. package/dist/runtime/application/generation/GenerationRuntime.js +215 -0
  88. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +289 -0
  89. package/dist/runtime/application/native-scene/CodeProject.js +215 -0
  90. package/dist/runtime/application/native-scene/CodeProjectModules.js +143 -0
  91. package/dist/runtime/application/native-scene/ExampleWorldCatalog.js +35 -0
  92. package/dist/runtime/application/native-scene/NativeArticulation.js +53 -0
  93. package/dist/runtime/application/native-scene/NativeEditableRegistry.js +150 -0
  94. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +85 -0
  95. package/dist/runtime/application/native-scene/NativeLightingInspection.js +33 -0
  96. package/dist/runtime/application/native-scene/NativeMaterialInspection.js +52 -0
  97. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
  98. package/dist/runtime/application/native-scene/NativePhysicsGeometry.js +64 -0
  99. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
  100. package/dist/runtime/application/native-scene/NativeSceneHost.js +406 -0
  101. package/dist/runtime/application/native-scene/NativeSceneInspection.js +203 -0
  102. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
  103. package/dist/runtime/application/native-scene/NativeSceneQuery.js +123 -0
  104. package/dist/runtime/application/native-scene/NativeSceneReview.js +132 -0
  105. package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
  106. package/dist/runtime/application/native-scene/SceneObserver.js +97 -0
  107. package/dist/runtime/application/native-scene/VisualCapturePolicy.js +4 -0
  108. package/dist/runtime/application/object-forge/SceneObjectForge.js +263 -0
  109. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +59 -0
  110. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +22 -0
  111. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +40 -0
  112. package/dist/runtime/application/scene/CapabilityResolver.js +90 -0
  113. package/dist/runtime/application/scene/NativeEditableContracts.js +18 -0
  114. package/dist/runtime/application/scene/RequestWindow.js +54 -0
  115. package/dist/runtime/application/scene/SceneAgentTools.js +21 -0
  116. package/dist/runtime/application/scene/SceneContracts.js +49 -0
  117. package/dist/runtime/application/scene/SceneEditService.js +154 -0
  118. package/dist/runtime/application/scene/SceneFacade.js +356 -0
  119. package/dist/runtime/application/scene/SceneInteractionAdapters.js +41 -0
  120. package/dist/runtime/application/scene/SceneJobController.js +320 -0
  121. package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
  122. package/dist/runtime/application/scene/ScenePackage.js +173 -0
  123. package/dist/runtime/application/scene/ScenePersistence.js +50 -0
  124. package/dist/runtime/application/scene/SceneProject.js +95 -0
  125. package/dist/runtime/application/scene/SceneSkillNames.js +5 -0
  126. package/dist/runtime/application/scene/StarterScene.js +56 -0
  127. package/dist/runtime/application/scene/WorldArchive.js +89 -0
  128. package/dist/runtime/application/scene/WorldDirectory.js +20 -0
  129. package/dist/runtime/application/scene/WorldDocument.js +76 -0
  130. package/dist/runtime/application/scene/WorldIO.js +103 -0
  131. package/dist/runtime/application/scene/WorldStorage.js +155 -0
  132. package/dist/runtime/application/skills/SkillRegistry.js +193 -0
  133. package/dist/runtime/application/skills/packs/acceptanceSkills.js +32 -0
  134. package/dist/runtime/application/skills/packs/affordanceSkills.js +36 -0
  135. package/dist/runtime/application/skills/packs/assetSkills.js +46 -0
  136. package/dist/runtime/application/skills/packs/authoringSkills.js +16 -0
  137. package/dist/runtime/application/skills/packs/batchSkills.js +22 -0
  138. package/dist/runtime/application/skills/packs/codeSkills.js +106 -0
  139. package/dist/runtime/application/skills/packs/generationSkills.js +45 -0
  140. package/dist/runtime/application/skills/packs/interactionSkills.js +46 -0
  141. package/dist/runtime/application/skills/packs/recoverySkills.js +80 -0
  142. package/dist/runtime/application/skills/packs/sceneSkills.js +24 -0
  143. package/dist/runtime/application/skills/packs/spatialSkills.js +35 -0
  144. package/dist/runtime/application/skills/packs/verificationSkills.js +14 -0
  145. package/dist/runtime/application/skills/packs/worldSkills.js +45 -0
  146. package/dist/runtime/application/skills/registerCoreSkills.js +31 -0
  147. package/dist/runtime/application/skills/skillPrimitives.js +4 -0
  148. package/dist/runtime/application/tasks/CabinetCupTask.js +76 -0
  149. package/dist/runtime/application/tasks.jsonl +67 -0
  150. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +42 -0
  151. package/dist/runtime/application/world-authoring/AuthoringDiff.js +149 -0
  152. package/dist/runtime/application/world-authoring/AuthoringDocument.js +825 -0
  153. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +109 -0
  154. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +17 -0
  155. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +29 -0
  156. package/dist/runtime/application/world-authoring/AuthoringPatch.js +118 -0
  157. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +334 -0
  158. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +126 -0
  159. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +144 -0
  160. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +92 -0
  161. package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
  162. package/dist/runtime/application/world-authoring/SceneGLBExport.js +88 -0
  163. package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
  164. package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +68 -0
  165. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +1 -0
  166. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +30 -0
  167. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +17 -0
  168. package/dist/runtime/apps/mcp-server/CodeExecutor.js +71 -0
  169. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +42 -0
  170. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +66 -0
  171. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +159 -0
  172. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +8 -0
  173. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +47 -0
  174. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +157 -0
  175. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +6 -0
  176. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +116 -0
  177. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +60 -0
  178. package/dist/runtime/apps/mcp-server/README.md +269 -0
  179. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +1 -0
  180. package/dist/runtime/apps/mcp-server/SandboxBundle.js +13 -0
  181. package/dist/runtime/apps/mcp-server/SessionManager.js +148 -0
  182. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +75 -0
  183. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +246 -0
  184. package/dist/runtime/apps/mcp-server/StudioProjectToolContracts.js +58 -0
  185. package/dist/runtime/apps/mcp-server/TransferHttp.js +47 -0
  186. package/dist/runtime/apps/mcp-server/TransferLimits.js +6 -0
  187. package/dist/runtime/apps/mcp-server/TransferStore.js +134 -0
  188. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +16 -0
  189. package/dist/runtime/apps/mcp-server/VALIDATION.md +45 -0
  190. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +332 -0
  191. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +32 -0
  192. package/dist/runtime/apps/mcp-server/examples/code-house.js +24 -0
  193. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +85 -0
  194. package/dist/runtime/apps/mcp-server/main.mjs +82 -0
  195. package/dist/runtime/apps/mcp-server/registerTools.js +274 -0
  196. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
  197. package/dist/runtime/apps/mcp-server/security.js +23 -0
  198. package/dist/runtime/apps/mcp-server/tasks.jsonl +9 -0
  199. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +157 -0
  200. package/dist/runtime/apps/server/README.md +7 -0
  201. package/dist/runtime/apps/server/WorldRepository.js +338 -0
  202. package/dist/runtime/apps/server/WorldRepositoryHttp.js +96 -0
  203. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +278 -0
  204. package/dist/runtime/apps/server/tasks.jsonl +10 -0
  205. package/dist/runtime/apps/shared/node/WorldDiskStorage.js +62 -0
  206. package/dist/runtime/foundation/EventBus.js +26 -0
  207. package/dist/runtime/foundation/JsonGateway.js +47 -0
  208. package/dist/runtime/foundation/PngRgba.js +99 -0
  209. package/dist/runtime/foundation/PolicyEngine.js +21 -0
  210. package/dist/runtime/foundation/README.md +7 -0
  211. package/dist/runtime/foundation/TraceRecorder.js +76 -0
  212. package/dist/runtime/foundation/errors.js +8 -0
  213. package/dist/runtime/foundation/simulation/SimulationProfile.js +143 -0
  214. package/dist/runtime/foundation/version.js +2 -0
  215. package/dist/runtime/modules/agent/README.md +11 -0
  216. package/dist/runtime/modules/agent/ToolCallingAgent.js +19 -0
  217. package/dist/runtime/modules/agent/bootstrapWorld.js +10 -0
  218. package/dist/runtime/modules/agent/buildRecoveryProposals.js +533 -0
  219. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +128 -0
  220. package/dist/runtime/modules/agent/execution/AgentRunResults.js +55 -0
  221. package/dist/runtime/modules/agent/execution/AgentRunSession.js +393 -0
  222. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +40 -0
  223. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +19 -0
  224. package/dist/runtime/modules/agent/prompt/index.js +52 -0
  225. package/dist/runtime/modules/agent/tasks.jsonl +94 -0
  226. package/dist/runtime/modules/artifact/ArtifactContentGate.js +144 -0
  227. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +280 -0
  228. package/dist/runtime/modules/artifact/ArtifactImporter.js +185 -0
  229. package/dist/runtime/modules/artifact/ArtifactModule.js +111 -0
  230. package/dist/runtime/modules/artifact/ArtifactRegistry.js +197 -0
  231. package/dist/runtime/modules/artifact/IncrementalSha256.js +129 -0
  232. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +115 -0
  233. package/dist/runtime/modules/artifact/README.md +7 -0
  234. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +67 -0
  235. package/dist/runtime/modules/artifact/tasks.jsonl +31 -0
  236. package/dist/runtime/modules/asset/AssetModule.js +416 -0
  237. package/dist/runtime/modules/asset/README.md +67 -0
  238. package/dist/runtime/modules/asset/loading/AssetLoader.js +157 -0
  239. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +61 -0
  240. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +95 -0
  241. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +33 -0
  242. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +103 -0
  243. package/dist/runtime/modules/asset/model/AssetInputContracts.js +139 -0
  244. package/dist/runtime/modules/asset/model/AssetRef.js +12 -0
  245. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +172 -0
  246. package/dist/runtime/modules/asset/model/ProceduralTextureContract.js +24 -0
  247. package/dist/runtime/modules/asset/model/admission.js +117 -0
  248. package/dist/runtime/modules/asset/model/errors.js +6 -0
  249. package/dist/runtime/modules/asset/model/parts.js +27 -0
  250. package/dist/runtime/modules/asset/model/resourceBudget.js +10 -0
  251. package/dist/runtime/modules/asset/model/schema.js +150 -0
  252. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +78 -0
  253. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +84 -0
  254. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +86 -0
  255. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +81 -0
  256. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +272 -0
  257. package/dist/runtime/modules/asset/production/AssetRecipe.js +91 -0
  258. package/dist/runtime/modules/asset/production/ProceduralTexture.js +85 -0
  259. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +45 -0
  260. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +590 -0
  261. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +173 -0
  262. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +124 -0
  263. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +56 -0
  264. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +6 -0
  265. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +74 -0
  266. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +63 -0
  267. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +48 -0
  268. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +16 -0
  269. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +30 -0
  270. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +75 -0
  271. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +20 -0
  272. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +34 -0
  273. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +32 -0
  274. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +116 -0
  275. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +84 -0
  276. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +63 -0
  277. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +16 -0
  278. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +23 -0
  279. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +50 -0
  280. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +60 -0
  281. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +93 -0
  282. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +32 -0
  283. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +55 -0
  284. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +203 -0
  285. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +43 -0
  286. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +33 -0
  287. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +60 -0
  288. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +23 -0
  289. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +198 -0
  290. package/dist/runtime/modules/asset/registry/AssetCatalog.js +72 -0
  291. package/dist/runtime/modules/asset/registry/AssetRegistry.js +51 -0
  292. package/dist/runtime/modules/asset/registry/manifests/index.js +173 -0
  293. package/dist/runtime/modules/asset/tasks.jsonl +87 -0
  294. package/dist/runtime/modules/generation/README.md +9 -0
  295. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +45 -0
  296. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +169 -0
  297. package/dist/runtime/modules/generation/connector/ConnectorClient.js +192 -0
  298. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +167 -0
  299. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +179 -0
  300. package/dist/runtime/modules/generation/connector/ConnectorSession.js +202 -0
  301. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +239 -0
  302. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +99 -0
  303. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +91 -0
  304. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +50 -0
  305. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +304 -0
  306. package/dist/runtime/modules/generation/tasks.jsonl +35 -0
  307. package/dist/runtime/modules/navigation/NavigationBackend.js +17 -0
  308. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +263 -0
  309. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
  310. package/dist/runtime/modules/physics/PhysicsApiSurface.js +660 -0
  311. package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
  312. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +414 -0
  313. package/dist/runtime/modules/rendering/README.md +7 -0
  314. package/dist/runtime/modules/rendering/RendererProbe.js +153 -0
  315. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +140 -0
  316. package/dist/runtime/modules/rendering/captureStill.js +54 -0
  317. package/dist/runtime/modules/rendering/createRenderer.js +76 -0
  318. package/dist/runtime/modules/rendering/disposeObject3D.js +37 -0
  319. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +74 -0
  320. package/dist/runtime/modules/rendering/spatial/ThreeBvhRuntime.js +107 -0
  321. package/dist/runtime/modules/rendering/style/StylePack.js +34 -0
  322. package/dist/runtime/modules/rendering/style/StyleSystem.js +173 -0
  323. package/dist/runtime/modules/rendering/tasks.jsonl +7 -0
  324. package/dist/runtime/modules/world/README.md +13 -0
  325. package/dist/runtime/modules/world/build/WorldBuilder.js +170 -0
  326. package/dist/runtime/modules/world/compiler/PipelineEngine.js +32 -0
  327. package/dist/runtime/modules/world/compiler/WorldAdmission.js +43 -0
  328. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +68 -0
  329. package/dist/runtime/modules/world/compiler/WorldCompilation.js +157 -0
  330. package/dist/runtime/modules/world/compiler/WorldComposer.js +201 -0
  331. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +76 -0
  332. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +356 -0
  333. package/dist/runtime/modules/world/compiler/WorldRetry.js +75 -0
  334. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +379 -0
  335. package/dist/runtime/modules/world/content/blankWorld.js +35 -0
  336. package/dist/runtime/modules/world/content/environments.js +84 -0
  337. package/dist/runtime/modules/world/content/grandUrbanBlock.js +189 -0
  338. package/dist/runtime/modules/world/content/magic-cabin/README.md +28 -0
  339. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +64 -0
  340. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +7078 -0
  341. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +26 -0
  342. package/dist/runtime/modules/world/content/magic-cabin/materials.js +20 -0
  343. package/dist/runtime/modules/world/content/magicCabin.js +190 -0
  344. package/dist/runtime/modules/world/content/monumentHall.js +154 -0
  345. package/dist/runtime/modules/world/content/ruinedCourtyard.js +196 -0
  346. package/dist/runtime/modules/world/content/suzhouGarden/README.md +141 -0
  347. package/dist/runtime/modules/world/content/suzhouGarden/index.js +137 -0
  348. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +491 -0
  349. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +670 -0
  350. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +578 -0
  351. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +127 -0
  352. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +642 -0
  353. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +650 -0
  354. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +280 -0
  355. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +242 -0
  356. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +215 -0
  357. package/dist/runtime/modules/world/content/woodlandWorkshop.js +192 -0
  358. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +36 -0
  359. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +351 -0
  360. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +490 -0
  361. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +505 -0
  362. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +101 -0
  363. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +435 -0
  364. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +169 -0
  365. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +245 -0
  366. package/dist/runtime/modules/world/errors.js +9 -0
  367. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +50 -0
  368. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +297 -0
  369. package/dist/runtime/modules/world/runtime/CommandHistory.js +111 -0
  370. package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +165 -0
  371. package/dist/runtime/modules/world/runtime/NativeNavigationGeometry.js +84 -0
  372. package/dist/runtime/modules/world/runtime/NativePhysicsSnapshot.js +245 -0
  373. package/dist/runtime/modules/world/runtime/ObjectStore.js +31 -0
  374. package/dist/runtime/modules/world/runtime/ObjectTransform.js +62 -0
  375. package/dist/runtime/modules/world/runtime/ObservedEntity.js +37 -0
  376. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +240 -0
  377. package/dist/runtime/modules/world/runtime/SceneExtensions.js +36 -0
  378. package/dist/runtime/modules/world/runtime/ScenePresentation.js +101 -0
  379. package/dist/runtime/modules/world/runtime/SceneSerializer.js +281 -0
  380. package/dist/runtime/modules/world/runtime/WorldAuthority.js +41 -0
  381. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +14 -0
  382. package/dist/runtime/modules/world/runtime/WorldCommands.js +503 -0
  383. package/dist/runtime/modules/world/runtime/WorldObservation.js +71 -0
  384. package/dist/runtime/modules/world/runtime/WorldQueries.js +340 -0
  385. package/dist/runtime/modules/world/runtime/WorldRecovery.js +78 -0
  386. package/dist/runtime/modules/world/runtime/WorldRuntime.js +806 -0
  387. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +110 -0
  388. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +130 -0
  389. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +79 -0
  390. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +195 -0
  391. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +70 -0
  392. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +115 -0
  393. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +390 -0
  394. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +214 -0
  395. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +65 -0
  396. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +244 -0
  397. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +147 -0
  398. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
  399. package/dist/runtime/modules/world/runtime/interaction/ManipulationActions.js +7 -0
  400. package/dist/runtime/modules/world/runtime/interaction/NativePhysicalTarget.js +31 -0
  401. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
  402. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +134 -0
  403. package/dist/runtime/modules/world/runtime/semantic/NativePhysicsState.js +89 -0
  404. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +129 -0
  405. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
  406. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +104 -0
  407. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
  408. package/dist/runtime/modules/world/runtime/simulation/WorldTimeline.js +110 -0
  409. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
  410. package/dist/runtime/modules/world/runtime/spatial/VisualMeshBounds.js +41 -0
  411. package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +306 -0
  412. package/dist/runtime/modules/world/runtime/systems/Instrument.js +39 -0
  413. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +806 -0
  414. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +281 -0
  415. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +561 -0
  416. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1752 -0
  417. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +527 -0
  418. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +402 -0
  419. package/dist/runtime/modules/world/spec/WorldIR.js +165 -0
  420. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +86 -0
  421. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +51 -0
  422. package/dist/runtime/modules/world/spec/WorldRevision.js +231 -0
  423. package/dist/runtime/modules/world/spec/WorldSpec.js +86 -0
  424. package/dist/runtime/modules/world/tasks.jsonl +530 -0
  425. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +254 -0
  426. package/dist/runtime/modules/world/verification/Finding.js +105 -0
  427. package/dist/runtime/modules/world/verification/InteractionEvidence.js +73 -0
  428. package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
  429. package/dist/runtime/modules/world/verification/VisualLayoutAcceptance.js +58 -0
  430. package/dist/runtime/modules/world/verification/WorldAcceptance.js +176 -0
  431. package/dist/runtime/modules/world/verification/WorldValidator.js +67 -0
  432. package/dist/runtime/package-lock.json +16071 -0
  433. package/dist/runtime/package.json +106 -0
  434. package/dist/runtime/public/assets/cabinet.glb +0 -0
  435. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  436. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  437. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  438. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  439. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  440. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  441. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  442. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  443. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  444. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  445. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  446. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  447. package/dist/schema-DT7K9NjP.js +165 -0
  448. package/dist/schema-DT7K9NjP.js.map +1 -0
  449. package/dist/suzhouGarden-Y3hny8j6.js +6150 -0
  450. package/dist/suzhouGarden-Y3hny8j6.js.map +1 -0
  451. package/dist/version-CHc-i8ch.js +5 -0
  452. package/dist/version-CHc-i8ch.js.map +1 -0
  453. package/dist/woodlandWorkshop-DsScU-cx.js +483 -0
  454. package/dist/woodlandWorkshop-DsScU-cx.js.map +1 -0
  455. package/dist/yuanmingyuan-DsFnPzzR.js +4955 -0
  456. package/dist/yuanmingyuan-DsFnPzzR.js.map +1 -0
  457. package/package.json +75 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission-CVEvsrdz.js","names":[],"sources":["../../../modules/asset/model/admission.js"],"sourcesContent":["const STATUS_ORDER=Object.freeze({ready:0,provisional:1,rejected:2});\nconst VALID_STATUS=new Set(Object.keys(STATUS_ORDER));\nconst REASON_RE=/^[A-Z0-9][A-Z0-9._:-]{0,127}$/;\n\nconst clone=(value)=>value==null?value:structuredClone(value);\nconst unique=(values)=>[...new Set(values.filter(Boolean))];\nconst reasonCodes=(items=[])=>unique((items||[]).map((item)=>typeof item==='string'?item:item?.code).filter((code)=>typeof code==='string'&&REASON_RE.test(code)));\nconst normalizeReasons=(reasons=[])=>unique((Array.isArray(reasons)?reasons:[]).map((code)=>String(code||'').trim()).filter((code)=>REASON_RE.test(code)));\nconst worse=(a,b)=>STATUS_ORDER[a]>=STATUS_ORDER[b]?a:b;\nconst layer=(status='ready',reasons=[],required=false)=>({status,reasons:unique(reasons),required:Boolean(required)});\n\nconst isProviderReason=(code)=>code==='PART_SEMANTICS_UNVERIFIED'||code.startsWith('PROVIDER_')||code==='FALLBACK_BOX_COLLIDER'||code==='UNVERIFIED_PROVIDER_SEMANTICS';\nconst isRuntimeReason=(code)=>code.startsWith('ARTICULATION_')||code.startsWith('RUNTIME_');\n\nfunction sameAdmissionSnapshot(a,b) {\n if (!a||!b||a.status!==b.status) return false;\n const ar=normalizeReasons(a.reasons),br=normalizeReasons(b.reasons);\n return ar.length===br.length&&ar.every((code,index)=>code===br[index]);\n}\n\nfunction providerAdmissionEvidence(manifest) {\n const provenance=manifest?.provenance||{};\n if (provenance.providerAdmission) return provenance.providerAdmission;\n const legacy=provenance.admission;\n if (!legacy) return null;\n // AS-05 before AS-08 wrote the aggregate result to both provenance.admission\n // and provenance.assetProduction.admission. That value is a stale aggregate\n // snapshot, not provider-layer authority, so ignore it here.\n if (sameAdmissionSnapshot(legacy,provenance.assetProduction?.admission)) return null;\n return legacy;\n}\n\nfunction providerEvidenceReasons(manifest) {\n const levels=manifest?.provenance?.providerEvidence?.levels;\n if (!levels) return [];\n const reasons=[];\n if (levels.partSemantics==='provider-unverified') reasons.push('PART_SEMANTICS_UNVERIFIED');\n if (levels.grasps==='raw-provider-unverified'||levels.grasps==='sapien-provider-unverified') reasons.push('PROVIDER_GRASP_UNVERIFIED');\n if (levels.grasps==='raw-provider-only') reasons.push('PROVIDER_GRASP_RAW_ONLY');\n if (levels.grasps==='sapien-validated-provider-only') reasons.push('PROVIDER_GRASP_SAPIEN_ONLY');\n return unique(reasons);\n}\n\nfunction providerLayer(manifest,allQualityCodes) {\n const explicit=providerAdmissionEvidence(manifest);\n const evidenceReasons=providerEvidenceReasons(manifest);\n const qualityReasons=allQualityCodes.filter(isProviderReason);\n const reasons=unique([...normalizeReasons(explicit?.reasons),...qualityReasons,...evidenceReasons]);\n const required=Boolean(explicit||manifest?.provenance?.providerEvidence||manifest?.provenance?.provider);\n let status='ready';\n if (explicit) {\n const requested=String(explicit.status||'').trim();\n if (!VALID_STATUS.has(requested)) return layer('provisional',unique([...reasons,'PROVIDER_ADMISSION_INVALID']),true);\n status=requested;\n }\n if (qualityReasons.length||evidenceReasons.length) status=worse(status,'provisional');\n if (status==='rejected'&&!reasons.length) reasons.push('PROVIDER_REJECTED');\n if (status==='provisional'&&!reasons.length) reasons.push('PROVIDER_PROVISIONAL');\n return layer(status,reasons,required);\n}\n\nfunction compilerLayer(manifest,{generated,hardCodes,advisoryCodes}) {\n const quality=manifest?.compiler?.quality;\n const required=Boolean(generated||quality);\n if (!quality) return generated?layer('provisional',['COMPILER_UNVERIFIED'],true):layer('ready',[],false);\n const compilerHard=hardCodes.filter((code)=>!isProviderReason(code)&&!isRuntimeReason(code));\n const compilerAdvisory=advisoryCodes.filter((code)=>!isProviderReason(code)&&!isRuntimeReason(code));\n const declared=String(quality.status||'').trim();\n if (hardCodes.length||declared==='rejected') {\n return layer('rejected',unique(['COMPILER_REJECTED',...compilerHard]),true);\n }\n if (!VALID_STATUS.has(declared)) return layer('provisional',['COMPILER_UNVERIFIED'],true);\n if (compilerAdvisory.length) return layer('provisional',compilerAdvisory,true);\n if (declared==='provisional' && !advisoryCodes.length) return layer('provisional',['COMPILER_PROVISIONAL'],true);\n // A provisional quality status caused only by provider/runtime advisories means\n // the compiler layer itself is ready; those blockers belong to their own layers.\n return layer('ready',[],required);\n}\n\nfunction executableArticulation(manifest) {\n return Object.values(manifest?.parts||{}).some((part)=>part?.joint&&part.joint.type!=='fixed'&&(Object.keys(part.targets||{}).length>0 || manifest.source?.kind==='compiled'));\n}\n\nfunction runtimeLayer(manifest,{advisoryCodes,hardCodes}) {\n const verification=manifest?.verification?.articulation;\n const qualityRuntimeReasons=unique([...hardCodes,...advisoryCodes].filter(isRuntimeReason));\n const required=Boolean(verification||qualityRuntimeReasons.length||executableArticulation(manifest)||manifest?.provenance?.interactionReview);\n if (!required) return layer('ready',[],false);\n if (verification?.ok===true) return layer('ready',[],true);\n if (verification?.ok===false) {\n return layer('provisional',unique([...qualityRuntimeReasons.filter((code)=>code!=='ARTICULATION_UNVERIFIED'),'ARTICULATION_VERIFICATION_FAILED']),true);\n }\n return layer('provisional',qualityRuntimeReasons.length?qualityRuntimeReasons:['ARTICULATION_UNVERIFIED'],true);\n}\n\nexport function assetAdmission(manifest,{generated=false}={}) {\n const quality=manifest?.compiler?.quality;\n const hardCodes=reasonCodes(quality?.hard);\n const advisoryCodes=reasonCodes(quality?.advisory);\n const allQualityCodes=unique([...hardCodes,...advisoryCodes]);\n\n const layers={\n provider:providerLayer(manifest,allQualityCodes),\n compiler:compilerLayer(manifest,{generated,hardCodes,advisoryCodes}),\n runtime:runtimeLayer(manifest,{advisoryCodes,hardCodes})\n };\n\n let status='ready';\n for (const current of Object.values(layers)) status=worse(status,current.status);\n const reasons=unique(Object.values(layers).flatMap((current)=>current.status==='ready'?[]:current.reasons));\n\n // Preserve repo/builtin legacy readiness when no admission layer is required.\n if (!generated&&!layers.provider.required&&!layers.compiler.required&&!layers.runtime.required) {\n return {status:'ready',reasons:[],layers:clone(layers)};\n }\n return {status,reasons,layers:clone(layers)};\n}\n"],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WAAS,UAAQ,CAAC,IAAE,QAAQ,OAAO,CAAC;CAG1G,IAAI,CAAC,aAAW,CAAC,OAAO,SAAS,YAAU,CAAC,OAAO,SAAS,YAAU,CAAC,OAAO,QAAQ,UACpF,OAAO;EAAC,QAAO;EAAQ,SAAQ,CAAC;EAAE,QAAO,MAAM,MAAM;CAAC;CAExD,OAAO;EAAC;EAAO;EAAQ,QAAO,MAAM,MAAM;CAAC;AAC7C"}
@@ -0,0 +1,75 @@
1
+ import * as THREE from "three";
2
+ // modules/world/content/blankWorld.js
3
+ function createBlankWorld({ id = "blank-world" } = {}) {
4
+ const root = new THREE.Group();
5
+ root.name = "BlankWorld";
6
+ root.userData.environment = id;
7
+ const floor = new THREE.Mesh(new THREE.BoxGeometry(24, .24, 24), new THREE.MeshStandardMaterial({
8
+ color: 9018764,
9
+ roughness: .92
10
+ }));
11
+ floor.name = "Ground";
12
+ floor.position.y = -.12;
13
+ floor.receiveShadow = true;
14
+ root.add(floor);
15
+ root.add(new THREE.HemisphereLight(16777215, 6450038, 2));
16
+ const sun = new THREE.DirectionalLight(16777215, 2.4);
17
+ sun.position.set(-6, 12, 8);
18
+ sun.castShadow = true;
19
+ sun.shadow.mapSize.set(1024, 1024);
20
+ Object.assign(sun.shadow.camera, {
21
+ left: -14,
22
+ right: 14,
23
+ top: 14,
24
+ bottom: -14,
25
+ near: .5,
26
+ far: 32
27
+ });
28
+ root.add(sun);
29
+ return {
30
+ id,
31
+ root,
32
+ floor,
33
+ colliders: [{
34
+ shape: "box",
35
+ halfExtents: [
36
+ 12,
37
+ .12,
38
+ 12
39
+ ],
40
+ translation: [
41
+ 0,
42
+ -.12,
43
+ 0
44
+ ]
45
+ }],
46
+ layout: {
47
+ bounds: {
48
+ min: [-11, -11],
49
+ max: [11, 11]
50
+ },
51
+ groundY: 0,
52
+ margin: 1
53
+ },
54
+ camera: {
55
+ position: [
56
+ 7,
57
+ 5.5,
58
+ 9
59
+ ],
60
+ target: [
61
+ 0,
62
+ 0,
63
+ -1
64
+ ]
65
+ },
66
+ rendering: {
67
+ background: 11126230,
68
+ exposure: 1.05
69
+ },
70
+ dispose() {}
71
+ };
72
+ }
73
+ export { createBlankWorld };
74
+
75
+ //# sourceMappingURL=blankWorld-B0MW6g7q.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blankWorld-B0MW6g7q.js","names":[],"sources":["../../../modules/world/content/blankWorld.js"],"sourcesContent":["import * as THREE from 'three';\n\n// A minimal physical environment: no architecture or pre-existing furniture.\n// Furniture and the Agent are spawned separately through the world bootstrap API.\nexport function createBlankWorld({ id = 'blank-world' } = {}) {\n const root = new THREE.Group();\n root.name = 'BlankWorld';\n root.userData.environment = id;\n\n const floor = new THREE.Mesh(\n new THREE.BoxGeometry(24, 0.24, 24),\n new THREE.MeshStandardMaterial({ color:0x899d8c, roughness:0.92 })\n );\n floor.name = 'Ground';\n floor.position.y = -0.12;\n floor.receiveShadow = true;\n root.add(floor);\n\n root.add(new THREE.HemisphereLight(0xffffff, 0x626b76, 2));\n const sun = new THREE.DirectionalLight(0xffffff, 2.4);\n sun.position.set(-6, 12, 8);\n sun.castShadow = true;\n sun.shadow.mapSize.set(1024, 1024);\n Object.assign(sun.shadow.camera, { left:-14, right:14, top:14, bottom:-14, near:0.5, far:32 });\n root.add(sun);\n\n return {\n id, root, floor,\n colliders:[{ shape:'box', halfExtents:[12,0.12,12], translation:[0,-0.12,0] }],\n layout:{ bounds:{min:[-11,-11],max:[11,11]}, groundY:0, margin:1 },\n camera:{ position:[7,5.5,9], target:[0,0,-1] },\n rendering:{ background:0xa9c5d6, exposure:1.05 },\n dispose() {}\n };\n}\n"],"mappings":";;AAIA,SAAgB,iBAAiB,EAAE,KAAK,kBAAkB,CAAC,GAAG;CAC5D,MAAM,OAAO,IAAI,MAAM,MAAM;CAC7B,KAAK,OAAO;CACZ,KAAK,SAAS,cAAc;CAE5B,MAAM,QAAQ,IAAI,MAAM,KACtB,IAAI,MAAM,YAAY,IAAI,KAAM,EAAE,GAClC,IAAI,MAAM,qBAAqB;EAAE,OAAM;EAAU,WAAU;CAAK,CAAC,CACnE;CACA,MAAM,OAAO;CACb,MAAM,SAAS,IAAI;CACnB,MAAM,gBAAgB;CACtB,KAAK,IAAI,KAAK;CAEd,KAAK,IAAI,IAAI,MAAM,gBAAgB,UAAU,SAAU,CAAC,CAAC;CACzD,MAAM,MAAM,IAAI,MAAM,iBAAiB,UAAU,GAAG;CACpD,IAAI,SAAS,IAAI,IAAI,IAAI,CAAC;CAC1B,IAAI,aAAa;CACjB,IAAI,OAAO,QAAQ,IAAI,MAAM,IAAI;CACjC,OAAO,OAAO,IAAI,OAAO,QAAQ;EAAE,MAAK;EAAK,OAAM;EAAI,KAAI;EAAI,QAAO;EAAK,MAAK;EAAK,KAAI;CAAG,CAAC;CAC7F,KAAK,IAAI,GAAG;CAEZ,OAAO;EACL;EAAI;EAAM;EACV,WAAU,CAAC;GAAE,OAAM;GAAO,aAAY;IAAC;IAAG;IAAK;GAAE;GAAG,aAAY;IAAC;IAAE;IAAM;GAAC;EAAE,CAAC;EAC7E,QAAO;GAAE,QAAO;IAAC,KAAI,CAAC,KAAI,GAAG;IAAE,KAAI,CAAC,IAAG,EAAE;GAAC;GAAG,SAAQ;GAAG,QAAO;EAAE;EACjE,QAAO;GAAE,UAAS;IAAC;IAAE;IAAI;GAAC;GAAG,QAAO;IAAC;IAAE;IAAE;GAAE;EAAE;EAC7C,WAAU;GAAE,YAAW;GAAU,UAAS;EAAK;EAC/C,UAAU,CAAC;CACb;AACF"}
package/dist/core.d.ts ADDED
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Framework-independent Three.js semantics. The scene and Object3D remain
3
+ * owned and rendered by the host application.
4
+ */
5
+ export interface SemanticObject3D {
6
+ readonly isObject3D: boolean;
7
+ readonly uuid?: string;
8
+ readonly name?: string;
9
+ readonly parent?: SemanticObject3D | null;
10
+ }
11
+ export interface SemanticScene extends SemanticObject3D {
12
+ readonly isScene: boolean;
13
+ }
14
+ export type SemanticTarget = string | SemanticObject3D;
15
+ export interface SemanticActionContext {
16
+ readonly object: SemanticObject3D;
17
+ readonly world: SemanticWorld;
18
+ readonly signal?: AbortSignal;
19
+ }
20
+ export type SemanticActionFn = (args: unknown, context: SemanticActionContext) => unknown | Promise<unknown>;
21
+ export type SemanticAction = SemanticActionFn | {
22
+ execute: SemanticActionFn;
23
+ description?: string;
24
+ available?: (context: SemanticActionContext) => boolean;
25
+ };
26
+ export interface SemanticDefinition {
27
+ id?: string;
28
+ type?: string;
29
+ label?: string;
30
+ description?: string;
31
+ properties?: unknown;
32
+ read?: () => unknown;
33
+ actions?: Record<string, SemanticAction>;
34
+ }
35
+ export interface SemanticEntity {
36
+ id: string;
37
+ name: string;
38
+ type: string;
39
+ label: string;
40
+ description: string;
41
+ properties: unknown;
42
+ attached: boolean;
43
+ state: unknown;
44
+ actions: Array<{ name: string; description: string; available: boolean }>;
45
+ }
46
+ export interface SemanticEvent {
47
+ type: 'entity.registered' | 'entity.unregistered' | 'action.registered' | 'action.unregistered' | 'action.invoked' | 'disposed';
48
+ id: string | null;
49
+ world: SemanticWorld;
50
+ }
51
+ export interface SemanticPlugin {
52
+ install(world: SemanticWorld, options?: unknown): void | (() => void) | { dispose(): void };
53
+ }
54
+ export interface SemanticWorld {
55
+ readonly scene: SemanticScene;
56
+ register(object: SemanticObject3D, definition?: SemanticDefinition): () => boolean;
57
+ unregister(target: SemanticTarget): boolean;
58
+ registerAction(target: SemanticTarget, name: string, action: SemanticAction): () => boolean;
59
+ getObject(target: SemanticTarget): SemanticObject3D | null;
60
+ inspect(target: SemanticTarget): SemanticEntity | null;
61
+ list(options?: { attachedOnly?: boolean }): SemanticEntity[];
62
+ invoke(target: SemanticTarget, name: string, args?: unknown, options?: { signal?: AbortSignal }): Promise<unknown>;
63
+ subscribe(listener: (event: SemanticEvent) => void): () => boolean;
64
+ use(plugin: SemanticPlugin | ((world: SemanticWorld, options?: unknown) => ReturnType<SemanticPlugin['install']>), options?: unknown): () => boolean;
65
+ dispose(): void;
66
+ }
67
+ /** Attach without renderer takeover, Studio, task compiler, MCP, permissions or sandbox. */
68
+ export declare function attach(scene: SemanticScene): SemanticWorld;
package/dist/core.js ADDED
@@ -0,0 +1,209 @@
1
+ // sdk/typescript/src/core.js
2
+ /**
3
+ * A framework-agnostic semantic extension for a user-owned Three.js scene.
4
+ * It never creates a renderer, starts a loop, rewrites Object3D or executes code.
5
+ * Policies, transports, persistence, physics and agent tooling belong to plugins.
6
+ */
7
+ const isObject = (object) => object?.isObject3D === true;
8
+ const fail = (message) => {
9
+ throw new TypeError(message);
10
+ };
11
+ function actionOf(value) {
12
+ if (typeof value === "function") return {
13
+ execute: value,
14
+ description: "",
15
+ available: null
16
+ };
17
+ if (!value || typeof value.execute !== "function") fail("Action requires a function or { execute }");
18
+ if (value.available != null && typeof value.available !== "function") fail("Action available must be a function");
19
+ return {
20
+ execute: value.execute,
21
+ description: value.description || "",
22
+ available: value.available || null
23
+ };
24
+ }
25
+ function parseActions(actions) {
26
+ if (actions == null) return /* @__PURE__ */ new Map();
27
+ if (typeof actions !== "object" || Array.isArray(actions)) fail("Actions must be a name-to-handler object");
28
+ const result = /* @__PURE__ */ new Map();
29
+ for (const [name, action] of Object.entries(actions)) {
30
+ if (!name.trim()) fail("Action name must be non-empty");
31
+ result.set(name, actionOf(action));
32
+ }
33
+ return result;
34
+ }
35
+ function inside(root, object) {
36
+ for (let current = object; current; current = current.parent) if (current === root) return true;
37
+ return false;
38
+ }
39
+ /**
40
+ * Attach semantic metadata and callable actions to an existing THREE.Scene.
41
+ * Native Three.js behavior and ownership remain entirely with the caller.
42
+ *
43
+ * @param {import('./core.d.ts').SemanticScene} scene
44
+ * @returns {import('./core.d.ts').SemanticWorld}
45
+ */
46
+ function attach(scene) {
47
+ if (!isObject(scene) || scene.isScene !== true) fail("attach(scene) requires a THREE.Scene");
48
+ const entries = /* @__PURE__ */ new Map();
49
+ const objects = /* @__PURE__ */ new WeakMap();
50
+ const listeners = /* @__PURE__ */ new Set();
51
+ const plugins = [];
52
+ let disposed = false;
53
+ const ensureOpen = () => {
54
+ if (disposed) throw new Error("SEMANTIC_WORLD_DISPOSED");
55
+ };
56
+ let world;
57
+ const find = (value) => typeof value === "string" ? entries.get(value) : objects.get(value);
58
+ const emit = (type, id) => {
59
+ for (const listener of [...listeners]) try {
60
+ listener({
61
+ type,
62
+ id,
63
+ world
64
+ });
65
+ } catch {}
66
+ };
67
+ const describe = (entry) => ({
68
+ id: entry.id,
69
+ name: entry.object.name || "",
70
+ type: entry.type,
71
+ label: entry.label,
72
+ description: entry.description,
73
+ properties: entry.properties,
74
+ attached: inside(scene, entry.object),
75
+ state: entry.read ? entry.read() : {},
76
+ actions: [...entry.actions].map(([name, action]) => ({
77
+ name,
78
+ description: action.description,
79
+ available: action.available ? Boolean(action.available({
80
+ object: entry.object,
81
+ world
82
+ })) : true
83
+ }))
84
+ });
85
+ function unregister(target) {
86
+ ensureOpen();
87
+ const entry = find(target);
88
+ if (!entry) return false;
89
+ entries.delete(entry.id);
90
+ objects.delete(entry.object);
91
+ emit("entity.unregistered", entry.id);
92
+ return true;
93
+ }
94
+ function register(object, definition = {}) {
95
+ ensureOpen();
96
+ if (!isObject(object)) fail("register(object) requires a THREE.Object3D");
97
+ if (!definition || typeof definition !== "object" || Array.isArray(definition)) fail("Invalid semantic definition");
98
+ const id = definition.id ?? object.uuid;
99
+ if (typeof id !== "string" || !id.trim()) fail("Entity id must be a non-empty string");
100
+ if (entries.has(id) || objects.has(object)) fail("SEMANTIC_ENTITY_CONFLICT");
101
+ if (definition.read != null && typeof definition.read !== "function") fail("Entity read must be a function");
102
+ const actions = parseActions(definition.actions);
103
+ const entry = {
104
+ id,
105
+ object,
106
+ type: definition.type || "",
107
+ label: definition.label || object.name || id,
108
+ description: definition.description || "",
109
+ properties: definition.properties ?? {},
110
+ read: definition.read || null,
111
+ actions
112
+ };
113
+ entries.set(id, entry);
114
+ objects.set(object, entry);
115
+ emit("entity.registered", id);
116
+ return () => entries.get(id) === entry && unregister(id);
117
+ }
118
+ function registerAction(target, name, value) {
119
+ ensureOpen();
120
+ const entry = find(target);
121
+ if (!entry) fail("SEMANTIC_ENTITY_NOT_FOUND");
122
+ if (typeof name !== "string" || !name.trim()) fail("Action name must be non-empty");
123
+ if (entry.actions.has(name)) fail("SEMANTIC_ACTION_CONFLICT");
124
+ const action = actionOf(value);
125
+ entry.actions.set(name, action);
126
+ emit("action.registered", entry.id);
127
+ return () => {
128
+ if (entries.get(entry.id) !== entry || entry.actions.get(name) !== action) return false;
129
+ entry.actions.delete(name);
130
+ emit("action.unregistered", entry.id);
131
+ return true;
132
+ };
133
+ }
134
+ async function invoke(target, name, args = {}, options = {}) {
135
+ ensureOpen();
136
+ const entry = find(target);
137
+ if (!entry) fail("SEMANTIC_ENTITY_NOT_FOUND");
138
+ const action = entry.actions.get(name);
139
+ if (!action) fail("SEMANTIC_ACTION_NOT_FOUND");
140
+ const context = {
141
+ object: entry.object,
142
+ world,
143
+ signal: options.signal
144
+ };
145
+ if (action.available && !action.available(context)) fail("SEMANTIC_ACTION_UNAVAILABLE");
146
+ const value = await action.execute(args, context);
147
+ emit("action.invoked", entry.id);
148
+ return value;
149
+ }
150
+ function uninstall(pluginEntry) {
151
+ if (!pluginEntry.active) return false;
152
+ pluginEntry.active = false;
153
+ plugins.splice(plugins.indexOf(pluginEntry), 1);
154
+ pluginEntry.teardown?.();
155
+ return true;
156
+ }
157
+ world = {
158
+ scene,
159
+ register,
160
+ unregister,
161
+ registerAction,
162
+ getObject(target) {
163
+ ensureOpen();
164
+ return find(target)?.object || null;
165
+ },
166
+ inspect(target) {
167
+ ensureOpen();
168
+ const entry = find(target);
169
+ return entry ? describe(entry) : null;
170
+ },
171
+ list({ attachedOnly = false } = {}) {
172
+ ensureOpen();
173
+ return [...entries.values()].filter((entry) => !attachedOnly || inside(scene, entry.object)).map(describe);
174
+ },
175
+ invoke,
176
+ subscribe(listener) {
177
+ ensureOpen();
178
+ if (typeof listener !== "function") fail("Listener must be a function");
179
+ listeners.add(listener);
180
+ return () => listeners.delete(listener);
181
+ },
182
+ use(plugin, options) {
183
+ ensureOpen();
184
+ const install = typeof plugin === "function" ? plugin : plugin?.install?.bind(plugin);
185
+ if (typeof install !== "function") fail("Plugin requires an install(world, options) function");
186
+ const result = install(world, options);
187
+ const entry = {
188
+ active: true,
189
+ teardown: typeof result === "function" ? result : result?.dispose?.bind(result)
190
+ };
191
+ plugins.push(entry);
192
+ return () => uninstall(entry);
193
+ },
194
+ dispose() {
195
+ if (disposed) return;
196
+ for (const entry of [...plugins].reverse()) try {
197
+ uninstall(entry);
198
+ } catch {}
199
+ for (const id of [...entries.keys()]) unregister(id);
200
+ disposed = true;
201
+ emit("disposed", null);
202
+ listeners.clear();
203
+ }
204
+ };
205
+ return world;
206
+ }
207
+ export { attach };
208
+
209
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","names":[],"sources":["../../typescript/src/core.js"],"sourcesContent":["/**\n * A framework-agnostic semantic extension for a user-owned Three.js scene.\n * It never creates a renderer, starts a loop, rewrites Object3D or executes code.\n * Policies, transports, persistence, physics and agent tooling belong to plugins.\n */\nconst isObject = object => object?.isObject3D === true;\nconst fail = message => { throw new TypeError(message); };\n\nfunction actionOf(value) {\n if (typeof value === 'function') return { execute: value, description: '', available: null };\n if (!value || typeof value.execute !== 'function') fail('Action requires a function or { execute }');\n if (value.available != null && typeof value.available !== 'function') fail('Action available must be a function');\n return { execute: value.execute, description: value.description || '', available: value.available || null };\n}\n\nfunction parseActions(actions) {\n if (actions == null) return new Map();\n if (typeof actions !== 'object' || Array.isArray(actions)) fail('Actions must be a name-to-handler object');\n const result = new Map();\n for (const [name, action] of Object.entries(actions)) {\n if (!name.trim()) fail('Action name must be non-empty');\n result.set(name, actionOf(action));\n }\n return result;\n}\n\nfunction inside(root, object) {\n for (let current = object; current; current = current.parent) {\n if (current === root) return true;\n }\n return false;\n}\n\n/**\n * Attach semantic metadata and callable actions to an existing THREE.Scene.\n * Native Three.js behavior and ownership remain entirely with the caller.\n *\n * @param {import('./core.d.ts').SemanticScene} scene\n * @returns {import('./core.d.ts').SemanticWorld}\n */\nexport function attach(scene) {\n if (!isObject(scene) || scene.isScene !== true) fail('attach(scene) requires a THREE.Scene');\n const entries = new Map();\n const objects = new WeakMap();\n const listeners = new Set();\n const plugins = [];\n let disposed = false;\n const ensureOpen = () => { if (disposed) throw new Error('SEMANTIC_WORLD_DISPOSED'); };\n let world;\n\n const find = value => typeof value === 'string' ? entries.get(value) : objects.get(value);\n const emit = (type, id) => {\n for (const listener of [...listeners]) {\n try { listener({ type, id, world }); }\n catch { /* A plugin must not break its host scene. */ }\n }\n };\n const describe = entry => ({\n id: entry.id,\n name: entry.object.name || '',\n type: entry.type,\n label: entry.label,\n description: entry.description,\n properties: entry.properties,\n attached: inside(scene, entry.object),\n state: entry.read ? entry.read() : {},\n actions: [...entry.actions].map(([name, action]) => ({\n name,\n description: action.description,\n available: action.available ? Boolean(action.available({ object: entry.object, world })) : true\n }))\n });\n\n function unregister(target) {\n ensureOpen();\n const entry = find(target);\n if (!entry) return false;\n entries.delete(entry.id);\n objects.delete(entry.object);\n emit('entity.unregistered', entry.id);\n return true;\n }\n\n function register(object, definition = {}) {\n ensureOpen();\n if (!isObject(object)) fail('register(object) requires a THREE.Object3D');\n if (!definition || typeof definition !== 'object' || Array.isArray(definition)) fail('Invalid semantic definition');\n const id = definition.id ?? object.uuid;\n if (typeof id !== 'string' || !id.trim()) fail('Entity id must be a non-empty string');\n if (entries.has(id) || objects.has(object)) fail('SEMANTIC_ENTITY_CONFLICT');\n if (definition.read != null && typeof definition.read !== 'function') fail('Entity read must be a function');\n const actions = parseActions(definition.actions);\n const entry = {\n id, object,\n type: definition.type || '',\n label: definition.label || object.name || id,\n description: definition.description || '',\n properties: definition.properties ?? {},\n read: definition.read || null,\n actions\n };\n entries.set(id, entry);\n objects.set(object, entry);\n emit('entity.registered', id);\n return () => entries.get(id) === entry && unregister(id);\n }\n\n function registerAction(target, name, value) {\n ensureOpen();\n const entry = find(target);\n if (!entry) fail('SEMANTIC_ENTITY_NOT_FOUND');\n if (typeof name !== 'string' || !name.trim()) fail('Action name must be non-empty');\n if (entry.actions.has(name)) fail('SEMANTIC_ACTION_CONFLICT');\n const action = actionOf(value);\n entry.actions.set(name, action);\n emit('action.registered', entry.id);\n return () => {\n if (entries.get(entry.id) !== entry || entry.actions.get(name) !== action) return false;\n entry.actions.delete(name);\n emit('action.unregistered', entry.id);\n return true;\n };\n }\n\n async function invoke(target, name, args = {}, options = {}) {\n ensureOpen();\n const entry = find(target);\n if (!entry) fail('SEMANTIC_ENTITY_NOT_FOUND');\n const action = entry.actions.get(name);\n if (!action) fail('SEMANTIC_ACTION_NOT_FOUND');\n const context = { object: entry.object, world, signal: options.signal };\n if (action.available && !action.available(context)) fail('SEMANTIC_ACTION_UNAVAILABLE');\n const value = await action.execute(args, context);\n emit('action.invoked', entry.id);\n return value;\n }\n\n function uninstall(pluginEntry) {\n if (!pluginEntry.active) return false;\n pluginEntry.active = false;\n plugins.splice(plugins.indexOf(pluginEntry), 1);\n pluginEntry.teardown?.();\n return true;\n }\n\n world = {\n scene,\n register,\n unregister,\n registerAction,\n getObject(target) {\n ensureOpen();\n return find(target)?.object || null;\n },\n inspect(target) {\n ensureOpen();\n const entry = find(target);\n return entry ? describe(entry) : null;\n },\n list({ attachedOnly = false } = {}) {\n ensureOpen();\n return [...entries.values()].filter(entry => !attachedOnly || inside(scene, entry.object)).map(describe);\n },\n invoke,\n subscribe(listener) {\n ensureOpen();\n if (typeof listener !== 'function') fail('Listener must be a function');\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n use(plugin, options) {\n ensureOpen();\n const install = typeof plugin === 'function' ? plugin : plugin?.install?.bind(plugin);\n if (typeof install !== 'function') fail('Plugin requires an install(world, options) function');\n const result = install(world, options);\n const teardown = typeof result === 'function' ? result : result?.dispose?.bind(result);\n const entry = { active: true, teardown };\n plugins.push(entry);\n return () => uninstall(entry);\n },\n dispose() {\n if (disposed) return;\n for (const entry of [...plugins].reverse()) {\n try { uninstall(entry); } catch { /* Host scene disposal must remain reliable. */ }\n }\n for (const id of [...entries.keys()]) unregister(id);\n disposed = true;\n emit('disposed', null);\n listeners.clear();\n }\n };\n return world;\n}\n"],"mappings":";;;;;;AAKA,MAAM,YAAW,WAAU,QAAQ,eAAe;AAClD,MAAM,QAAO,YAAW;CAAE,MAAM,IAAI,UAAU,OAAO;AAAG;AAExD,SAAS,SAAS,OAAO;CACvB,IAAI,OAAO,UAAU,YAAY,OAAO;EAAE,SAAS;EAAO,aAAa;EAAI,WAAW;CAAK;CAC3F,IAAI,CAAC,SAAS,OAAO,MAAM,YAAY,YAAY,KAAK,2CAA2C;CACnG,IAAI,MAAM,aAAa,QAAQ,OAAO,MAAM,cAAc,YAAY,KAAK,qCAAqC;CAChH,OAAO;EAAE,SAAS,MAAM;EAAS,aAAa,MAAM,eAAe;EAAI,WAAW,MAAM,aAAa;CAAK;AAC5G;AAEA,SAAS,aAAa,SAAS;CAC7B,IAAI,WAAW,MAAM,uBAAO,IAAI,IAAI;CACpC,IAAI,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG,KAAK,0CAA0C;CAC1G,MAAM,yBAAS,IAAI,IAAI;CACvB,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,OAAO,GAAG;EACpD,IAAI,CAAC,KAAK,KAAK,GAAG,KAAK,+BAA+B;EACtD,OAAO,IAAI,MAAM,SAAS,MAAM,CAAC;CACnC;CACA,OAAO;AACT;AAEA,SAAS,OAAO,MAAM,QAAQ;CAC5B,KAAK,IAAI,UAAU,QAAQ,SAAS,UAAU,QAAQ,QACpD,IAAI,YAAY,MAAM,OAAO;CAE/B,OAAO;AACT;;;;;;;;AASA,SAAgB,OAAO,OAAO;CAC5B,IAAI,CAAC,SAAS,KAAK,KAAK,MAAM,YAAY,MAAM,KAAK,sCAAsC;CAC3F,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AM,UAAU,OAAO,WAAW,aAAa,SAAS,QAAQ,SAAS,KAAK,MAAM;GACpF,IAAI,OAAO,YAAY,YAAY,KAAK,qDAAqD;GAC7F,MAAM,SAAS,QAAQ,OAAO,OAAO;GAErC,MAAM,QAAQ;IAAE,QAAQ;IAAM,UADb,OAAO,WAAW,aAAa,SAAS,QAAQ,SAAS,KAAK,MAAM;GAC9C;GACvC,QAAQ,KAAK,KAAK;GAClB,aAAa,UAAU,KAAK;EAC9B;EACA,UAAU;GACR,IAAI,UAAU;GACd,KAAK,MAAM,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,QAAQ,GACvC,IAAI;IAAE,UAAU,KAAK;GAAG,QAAQ,CAAkD;GAEpF,KAAK,MAAM,MAAM,CAAC,GAAG,QAAQ,KAAK,CAAC,GAAG,WAAW,EAAE;GACnD,WAAW;GACX,KAAK,YAAY,IAAI;GACrB,UAAU,MAAM;EAClB;CACF;CACA,OAAO;AACT"}
@@ -0,0 +1,128 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.js";
2
+ import * as THREE from "three";
3
+ import { acceleratedRaycast, computeBoundsTree, disposeBoundsTree } from "three-mesh-bvh";
4
+ // modules/rendering/spatial/ThreeBvhRuntime.js
5
+ const acceleratedObjects = /* @__PURE__ */ new WeakMap();
6
+ const registeredGeometryByObject = /* @__PURE__ */ new WeakMap();
7
+ const geometryReferenceCounts = /* @__PURE__ */ new WeakMap();
8
+ const ownedBoundsTrees = /* @__PURE__ */ new WeakSet();
9
+ let acceleratedObjectCount = 0;
10
+ function canAccelerateMesh(node) {
11
+ return node?.isMesh && node.geometry && !Object.prototype.hasOwnProperty.call(node, "raycast") && node.raycast === THREE.Mesh.prototype.raycast;
12
+ }
13
+ function enableAcceleratedRaycast(node) {
14
+ if (!canAccelerateMesh(node) || acceleratedObjects.has(node)) return false;
15
+ acceleratedObjects.set(node, true);
16
+ node.raycast = acceleratedRaycast;
17
+ acceleratedObjectCount += 1;
18
+ return true;
19
+ }
20
+ function restoreAcceleratedRaycast(node) {
21
+ if (!acceleratedObjects.has(node)) return false;
22
+ if (node.raycast === acceleratedRaycast) delete node.raycast;
23
+ acceleratedObjects.delete(node);
24
+ acceleratedObjectCount = Math.max(0, acceleratedObjectCount - 1);
25
+ return true;
26
+ }
27
+ function releaseGeometry(geometry) {
28
+ if (!geometry) return false;
29
+ const referenceCount = geometryReferenceCounts.get(geometry) || 0;
30
+ if (referenceCount > 1) {
31
+ geometryReferenceCounts.set(geometry, referenceCount - 1);
32
+ return false;
33
+ }
34
+ geometryReferenceCounts.delete(geometry);
35
+ return disposeBoundsTreeForGeometry(geometry);
36
+ }
37
+ function computeBoundsTreeForGeometry(geometry, options) {
38
+ if (!geometry || geometry.boundsTree) return false;
39
+ computeBoundsTree.call(geometry, options);
40
+ if (!geometry.boundsTree) return false;
41
+ ownedBoundsTrees.add(geometry);
42
+ return true;
43
+ }
44
+ function disposeBoundsTreeForGeometry(geometry) {
45
+ if (!geometry?.boundsTree || !ownedBoundsTrees.has(geometry)) return false;
46
+ disposeBoundsTree.call(geometry);
47
+ ownedBoundsTrees.delete(geometry);
48
+ geometryReferenceCounts.delete(geometry);
49
+ return true;
50
+ }
51
+ function ensureBoundsTrees(root, { accelerateRaycast = true } = {}) {
52
+ let meshCount = 0;
53
+ let builtCount = 0;
54
+ let acceleratedCount = 0;
55
+ root?.traverse?.((node) => {
56
+ if (!node.isMesh || !node.geometry) return;
57
+ meshCount += 1;
58
+ const previousGeometry = registeredGeometryByObject.get(node);
59
+ if (previousGeometry !== node.geometry) {
60
+ releaseGeometry(previousGeometry);
61
+ registeredGeometryByObject.set(node, node.geometry);
62
+ geometryReferenceCounts.set(node.geometry, (geometryReferenceCounts.get(node.geometry) || 0) + 1);
63
+ }
64
+ if (!node.geometry.boundsTree && computeBoundsTreeForGeometry(node.geometry)) builtCount += 1;
65
+ if (accelerateRaycast && enableAcceleratedRaycast(node)) acceleratedCount += 1;
66
+ });
67
+ return {
68
+ meshCount,
69
+ builtCount,
70
+ acceleratedCount
71
+ };
72
+ }
73
+ function disposeBoundsTrees(root) {
74
+ let disposedCount = 0;
75
+ let restoredCount = 0;
76
+ root?.traverse?.((node) => {
77
+ if (!node.isMesh || !node.geometry) return;
78
+ const geometry = registeredGeometryByObject.get(node);
79
+ if (geometry) {
80
+ registeredGeometryByObject.delete(node);
81
+ if (releaseGeometry(geometry)) disposedCount += 1;
82
+ }
83
+ if (restoreAcceleratedRaycast(node)) restoredCount += 1;
84
+ });
85
+ return {
86
+ disposedCount,
87
+ restoredCount
88
+ };
89
+ }
90
+ // modules/rendering/disposeObject3D.js
91
+ var disposeObject3D_exports = /* @__PURE__ */ __exportAll({ disposeObject3D: () => disposeObject3D });
92
+ const disposeTextureValue = (value, textures) => {
93
+ if (value?.isTexture && !textures.has(value)) {
94
+ textures.add(value);
95
+ value.dispose();
96
+ }
97
+ };
98
+ const RELEASE_RESOURCE = Symbol("agentscape.release-resource");
99
+ function disposeObject3D(root) {
100
+ if (root?.[RELEASE_RESOURCE]) return root[RELEASE_RESOURCE]();
101
+ disposeBoundsTrees(root);
102
+ const geometries = /* @__PURE__ */ new Set();
103
+ const materials = /* @__PURE__ */ new Set();
104
+ const textures = /* @__PURE__ */ new Set();
105
+ root?.traverse?.((node) => {
106
+ const geometry = node.geometry;
107
+ if (geometry && !geometries.has(geometry)) {
108
+ geometries.add(geometry);
109
+ geometry.disposeBoundsTree?.();
110
+ geometry.dispose?.();
111
+ }
112
+ const list = Array.isArray(node.material) ? node.material : [node.material];
113
+ for (const material of list) {
114
+ if (!material || materials.has(material)) continue;
115
+ materials.add(material);
116
+ for (const value of Object.values(material)) disposeTextureValue(value, textures);
117
+ material.dispose?.();
118
+ }
119
+ });
120
+ return {
121
+ geometries: geometries.size,
122
+ materials: materials.size,
123
+ textures: textures.size
124
+ };
125
+ }
126
+ export { ensureBoundsTrees as i, disposeObject3D as n, disposeObject3D_exports as r, RELEASE_RESOURCE as t };
127
+
128
+ //# sourceMappingURL=disposeObject3D-DIMzy0FA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disposeObject3D-DIMzy0FA.js","names":[],"sources":["../../../modules/rendering/spatial/ThreeBvhRuntime.js","../../../modules/rendering/disposeObject3D.js"],"sourcesContent":["import * as THREE from \"three\";\nimport { acceleratedRaycast, computeBoundsTree, disposeBoundsTree } from \"three-mesh-bvh\";\n\nconst acceleratedObjects = new WeakMap();\nconst registeredGeometryByObject = new WeakMap();\nconst geometryReferenceCounts = new WeakMap();\nconst ownedBoundsTrees = new WeakSet();\nlet acceleratedObjectCount = 0;\n\nfunction canAccelerateMesh(node) {\n return node?.isMesh\n && node.geometry\n && !Object.prototype.hasOwnProperty.call(node, \"raycast\")\n && node.raycast === THREE.Mesh.prototype.raycast;\n}\n\nfunction enableAcceleratedRaycast(node) {\n if (!canAccelerateMesh(node) || acceleratedObjects.has(node)) return false;\n acceleratedObjects.set(node, true);\n node.raycast = acceleratedRaycast;\n acceleratedObjectCount += 1;\n return true;\n}\n\nfunction restoreAcceleratedRaycast(node) {\n if (!acceleratedObjects.has(node)) return false;\n if (node.raycast === acceleratedRaycast) delete node.raycast;\n acceleratedObjects.delete(node);\n acceleratedObjectCount = Math.max(0, acceleratedObjectCount - 1);\n return true;\n}\n\nfunction releaseGeometry(geometry) {\n if (!geometry) return false;\n const referenceCount = geometryReferenceCounts.get(geometry) || 0;\n if (referenceCount > 1) {\n geometryReferenceCounts.set(geometry, referenceCount - 1);\n return false;\n }\n geometryReferenceCounts.delete(geometry);\n return disposeBoundsTreeForGeometry(geometry);\n}\n\nexport function installThreeBvhRuntime() {\n return bvhRuntimeStatus();\n}\n\nexport function bvhRuntimeStatus() {\n return {\n installed: false,\n scope: \"object-instance\",\n acceleratedObjectCount,\n raycast: acceleratedObjectCount > 0 ? \"three-mesh-bvh\" : \"three-default\"\n };\n}\n\nexport function computeBoundsTreeForGeometry(geometry, options) {\n if (!geometry || geometry.boundsTree) return false;\n computeBoundsTree.call(geometry, options);\n if (!geometry.boundsTree) return false;\n ownedBoundsTrees.add(geometry);\n return true;\n}\n\nexport function disposeBoundsTreeForGeometry(geometry) {\n if (!geometry?.boundsTree || !ownedBoundsTrees.has(geometry)) return false;\n disposeBoundsTree.call(geometry);\n ownedBoundsTrees.delete(geometry);\n geometryReferenceCounts.delete(geometry);\n return true;\n}\n\nexport function ensureBoundsTrees(root, { accelerateRaycast = true } = {}) {\n let meshCount = 0;\n let builtCount = 0;\n let acceleratedCount = 0;\n root?.traverse?.((node) => {\n if (!node.isMesh || !node.geometry) return;\n meshCount += 1;\n\n const previousGeometry = registeredGeometryByObject.get(node);\n if (previousGeometry !== node.geometry) {\n releaseGeometry(previousGeometry);\n registeredGeometryByObject.set(node, node.geometry);\n geometryReferenceCounts.set(node.geometry, (geometryReferenceCounts.get(node.geometry) || 0) + 1);\n }\n\n if (!node.geometry.boundsTree && computeBoundsTreeForGeometry(node.geometry)) builtCount += 1;\n if (accelerateRaycast && enableAcceleratedRaycast(node)) acceleratedCount += 1;\n });\n return { meshCount, builtCount, acceleratedCount };\n}\n\nexport function disposeBoundsTrees(root) {\n let disposedCount = 0;\n let restoredCount = 0;\n root?.traverse?.((node) => {\n if (!node.isMesh || !node.geometry) return;\n const geometry = registeredGeometryByObject.get(node);\n if (geometry) {\n registeredGeometryByObject.delete(node);\n if (releaseGeometry(geometry)) disposedCount += 1;\n }\n if (restoreAcceleratedRaycast(node)) restoredCount += 1;\n });\n return { disposedCount, restoredCount };\n}","import { disposeBoundsTrees } from './spatial/ThreeBvhRuntime.js';\n\nconst disposeTextureValue = (value, textures) => {\n if (value?.isTexture && !textures.has(value)) {\n textures.add(value);\n value.dispose();\n }\n};\n\nexport const RELEASE_RESOURCE = Symbol('agentscape.release-resource');\n\nexport function disposeObject3D(root) {\n if (root?.[RELEASE_RESOURCE]) return root[RELEASE_RESOURCE]();\n disposeBoundsTrees(root);\n const geometries = new Set();\n const materials = new Set();\n const textures = new Set();\n\n root?.traverse?.((node) => {\n const geometry = node.geometry;\n if (geometry && !geometries.has(geometry)) {\n geometries.add(geometry);\n geometry.disposeBoundsTree?.();\n geometry.dispose?.();\n }\n\n const list = Array.isArray(node.material) ? node.material : [node.material];\n for (const material of list) {\n if (!material || materials.has(material)) continue;\n materials.add(material);\n for (const value of Object.values(material)) disposeTextureValue(value, textures);\n material.dispose?.();\n }\n });\n\n return { geometries: geometries.size, materials: materials.size, textures: textures.size };\n}\n"],"mappings":";;;;AAGA,MAAM,qCAAqB,IAAI,QAAQ;AACvC,MAAM,6CAA6B,IAAI,QAAQ;AAC/C,MAAM,0CAA0B,IAAI,QAAQ;AAC5C,MAAM,mCAAmB,IAAI,QAAQ;AACrC,IAAI,yBAAyB;AAE7B,SAAS,kBAAkB,MAAM;CAC/B,OAAO,MAAM,UACR,KAAK,YACL,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,SAAS,KACrD,KAAK,YAAY,MAAM,KAAK,UAAU;AAC7C;AAEA,SAAS,yBAAyB,MAAM;CACtC,IAAI,CAAC,kBAAkB,IAAI,KAAK,mBAAmB,IAAI,IAAI,GAAG,OAAO;CACrE,mBAAmB,IAAI,MAAM,IAAI;CACjC,KAAK,UAAU;CACf,0BAA0B;CAC1B,OAAO;AACT;AAEA,SAAS,0BAA0B,MAAM;CACvC,IAAI,CAAC,mBAAmB,IAAI,IAAI,GAAG,OAAO;CAC1C,IAAI,KAAK,YAAY,oBAAoB,OAAO,KAAK;CACrD,mBAAmB,OAAO,IAAI;CAC9B,yBAAyB,KAAK,IAAI,GAAG,yBAAyB,CAAC;CAC/D,OAAO;AACT;AAEA,SAAS,gBAAgB,UAAU;CACjC,IAAI,CAAC,UAAU,OAAO;CACtB,MAAM,iBAAiB,wBAAwB,IAAI,QAAQ,KAAK;CAChE,IAAI,iBAAiB,GAAG;EACtB,wBAAwB,IAAI,UAAU,iBAAiB,CAAC;EACxD,OAAO;CACT;CACA,wBAAwB,OAAO,QAAQ;CACvC,OAAO,6BAA6B,QAAQ;AAC9C;AAeA,S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