agentscape3d 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/README.md +23 -48
  2. package/dist/core.d.ts +68 -0
  3. package/dist/core.js +209 -0
  4. package/dist/core.js.map +1 -0
  5. package/dist/index.d.ts +10 -229
  6. package/dist/index.js +192 -15462
  7. package/dist/index.js.map +1 -1
  8. package/package.json +11 -40
  9. package/cli.mjs +0 -27
  10. package/dist/AssetCompiler-CDFiElji.js +0 -2451
  11. package/dist/AssetCompiler-CDFiElji.js.map +0 -1
  12. package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
  13. package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
  14. package/dist/AssetRecipe-DmFpzxr-.js +0 -55
  15. package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
  16. package/dist/BrowserCodeWorker.js +0 -53615
  17. package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
  18. package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
  19. package/dist/SceneSerializer-DPVOyeRk.js +0 -353
  20. package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
  21. package/dist/StylePack-DNrdLeGI.js +0 -6314
  22. package/dist/StylePack-DNrdLeGI.js.map +0 -1
  23. package/dist/WorldArchive-pSBIGxLa.js +0 -420
  24. package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
  25. package/dist/WorldIO-wsDfZGM4.js +0 -150
  26. package/dist/WorldIO-wsDfZGM4.js.map +0 -1
  27. package/dist/blankWorld-CBWbwJGj.js +0 -76
  28. package/dist/blankWorld-CBWbwJGj.js.map +0 -1
  29. package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
  30. package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
  31. package/dist/environments-DgH66NqV.js +0 -4220
  32. package/dist/environments-DgH66NqV.js.map +0 -1
  33. package/dist/gltfIO-B87nJaat.js +0 -10
  34. package/dist/gltfIO-B87nJaat.js.map +0 -1
  35. package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
  36. package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
  37. package/dist/magicCabin-D64fD1E2.js +0 -11024
  38. package/dist/magicCabin-D64fD1E2.js.map +0 -1
  39. package/dist/mcp.d.ts +0 -2
  40. package/dist/mcp.js +0 -1
  41. package/dist/monumentHall-BKbs0UOQ.js +0 -404
  42. package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
  43. package/dist/node.d.ts +0 -16
  44. package/dist/node.js +0 -25
  45. package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
  46. package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
  47. package/dist/runtime/application/AgentTools.js +0 -25
  48. package/dist/runtime/application/README.md +0 -14
  49. package/dist/runtime/application/buildTaskObservation.js +0 -117
  50. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
  51. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
  52. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
  53. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
  54. package/dist/runtime/application/createSession.js +0 -66
  55. package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
  56. package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
  57. package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
  58. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
  59. package/dist/runtime/application/native-scene/CodeProject.js +0 -119
  60. package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
  61. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
  62. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
  63. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
  64. package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
  65. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
  66. package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
  67. package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
  68. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
  69. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
  70. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
  71. package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
  72. package/dist/runtime/application/scene/RequestWindow.js +0 -54
  73. package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
  74. package/dist/runtime/application/scene/SceneContracts.js +0 -45
  75. package/dist/runtime/application/scene/SceneEditService.js +0 -144
  76. package/dist/runtime/application/scene/SceneFacade.js +0 -267
  77. package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
  78. package/dist/runtime/application/scene/SceneJobController.js +0 -229
  79. package/dist/runtime/application/scene/ScenePackage.js +0 -162
  80. package/dist/runtime/application/scene/ScenePersistence.js +0 -50
  81. package/dist/runtime/application/scene/SceneProject.js +0 -95
  82. package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
  83. package/dist/runtime/application/scene/StarterScene.js +0 -56
  84. package/dist/runtime/application/scene/WorldArchive.js +0 -87
  85. package/dist/runtime/application/scene/WorldDirectory.js +0 -20
  86. package/dist/runtime/application/scene/WorldDocument.js +0 -74
  87. package/dist/runtime/application/scene/WorldIO.js +0 -103
  88. package/dist/runtime/application/scene/WorldStorage.js +0 -137
  89. package/dist/runtime/application/skills/SkillRegistry.js +0 -163
  90. package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
  91. package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
  92. package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
  93. package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
  94. package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
  95. package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
  96. package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
  97. package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
  98. package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
  99. package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
  100. package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
  101. package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
  102. package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
  103. package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
  104. package/dist/runtime/application/skills/skillPrimitives.js +0 -4
  105. package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
  106. package/dist/runtime/application/tasks.jsonl +0 -67
  107. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
  108. package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
  109. package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
  110. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
  111. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
  112. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
  113. package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
  114. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
  115. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
  116. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
  117. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
  118. package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
  119. package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
  120. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
  121. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
  122. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
  123. package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
  124. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
  125. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
  126. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
  127. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
  128. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
  129. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
  130. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
  131. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
  132. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
  133. package/dist/runtime/apps/mcp-server/README.md +0 -150
  134. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
  135. package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
  136. package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
  137. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
  138. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
  139. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
  140. package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
  141. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
  142. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
  143. package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
  144. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
  145. package/dist/runtime/apps/mcp-server/main.mjs +0 -56
  146. package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
  147. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
  148. package/dist/runtime/apps/mcp-server/security.js +0 -21
  149. package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
  150. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
  151. package/dist/runtime/apps/server/README.md +0 -7
  152. package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
  153. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
  154. package/dist/runtime/apps/server/tasks.jsonl +0 -10
  155. package/dist/runtime/foundation/EventBus.js +0 -18
  156. package/dist/runtime/foundation/JsonGateway.js +0 -47
  157. package/dist/runtime/foundation/PolicyEngine.js +0 -21
  158. package/dist/runtime/foundation/README.md +0 -7
  159. package/dist/runtime/foundation/TraceRecorder.js +0 -76
  160. package/dist/runtime/foundation/errors.js +0 -8
  161. package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
  162. package/dist/runtime/foundation/version.js +0 -2
  163. package/dist/runtime/modules/agent/README.md +0 -11
  164. package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
  165. package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
  166. package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
  167. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
  168. package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
  169. package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
  170. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
  171. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
  172. package/dist/runtime/modules/agent/prompt/index.js +0 -46
  173. package/dist/runtime/modules/agent/tasks.jsonl +0 -94
  174. package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
  175. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
  176. package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
  177. package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
  178. package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
  179. package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
  180. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
  181. package/dist/runtime/modules/artifact/README.md +0 -7
  182. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
  183. package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
  184. package/dist/runtime/modules/asset/AssetModule.js +0 -399
  185. package/dist/runtime/modules/asset/README.md +0 -54
  186. package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
  187. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
  188. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
  189. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
  190. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
  191. package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
  192. package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
  193. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
  194. package/dist/runtime/modules/asset/model/admission.js +0 -117
  195. package/dist/runtime/modules/asset/model/errors.js +0 -6
  196. package/dist/runtime/modules/asset/model/parts.js +0 -27
  197. package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
  198. package/dist/runtime/modules/asset/model/schema.js +0 -150
  199. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
  200. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
  201. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
  202. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
  203. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
  204. package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
  205. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
  206. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
  207. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
  208. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
  209. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
  210. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
  211. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
  212. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
  213. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
  214. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
  215. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
  216. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
  217. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
  218. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
  219. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
  220. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
  221. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
  222. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
  223. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
  224. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
  225. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
  226. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
  227. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
  228. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
  229. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
  230. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
  231. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
  232. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
  233. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
  234. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
  235. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
  236. package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
  237. package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
  238. package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
  239. package/dist/runtime/modules/asset/tasks.jsonl +0 -87
  240. package/dist/runtime/modules/generation/README.md +0 -9
  241. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
  242. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
  243. package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
  244. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
  245. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
  246. package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
  247. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
  248. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
  249. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
  250. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
  251. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
  252. package/dist/runtime/modules/generation/tasks.jsonl +0 -35
  253. package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
  254. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
  255. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
  256. package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
  257. package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
  258. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
  259. package/dist/runtime/modules/rendering/README.md +0 -7
  260. package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
  261. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
  262. package/dist/runtime/modules/rendering/createRenderer.js +0 -76
  263. package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
  264. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
  265. package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
  266. package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
  267. package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
  268. package/dist/runtime/modules/world/README.md +0 -13
  269. package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
  270. package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
  271. package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
  272. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
  273. package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
  274. package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
  275. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
  276. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
  277. package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
  278. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
  279. package/dist/runtime/modules/world/content/blankWorld.js +0 -35
  280. package/dist/runtime/modules/world/content/environments.js +0 -84
  281. package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
  282. package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
  283. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
  284. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
  285. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
  286. package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
  287. package/dist/runtime/modules/world/content/magicCabin.js +0 -190
  288. package/dist/runtime/modules/world/content/monumentHall.js +0 -154
  289. package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
  290. package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
  291. package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
  292. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
  293. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
  294. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
  295. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
  296. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
  297. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
  298. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
  301. package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
  302. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
  303. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
  304. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
  305. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
  306. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
  307. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
  308. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
  309. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
  310. package/dist/runtime/modules/world/errors.js +0 -9
  311. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
  312. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
  313. package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
  314. package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
  315. package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
  316. package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
  317. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
  318. package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
  319. package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
  320. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
  321. package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
  322. package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
  323. package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
  324. package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
  325. package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
  326. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
  327. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
  328. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
  329. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
  330. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
  331. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
  332. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
  333. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
  334. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
  335. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
  336. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
  337. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
  338. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
  339. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
  340. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
  341. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
  342. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
  343. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
  344. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
  345. package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
  346. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
  347. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
  348. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
  349. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
  350. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
  351. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
  352. package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
  353. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
  354. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
  355. package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
  356. package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
  357. package/dist/runtime/modules/world/tasks.jsonl +0 -530
  358. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
  359. package/dist/runtime/modules/world/verification/Finding.js +0 -105
  360. package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
  361. package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
  362. package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
  363. package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
  364. package/dist/runtime/package-lock.json +0 -6245
  365. package/dist/runtime/package.json +0 -91
  366. package/dist/runtime/public/assets/cabinet.glb +0 -0
  367. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  368. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  369. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  370. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  371. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  372. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  373. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  374. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  375. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  376. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  377. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  379. package/dist/schema-Dudvovhu.js +0 -364
  380. package/dist/schema-Dudvovhu.js.map +0 -1
  381. package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
  382. package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
  383. package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
  384. package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
  385. package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
  386. package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
package/README.md CHANGED
@@ -1,55 +1,30 @@
1
- # AgentScape TypeScript SDK
1
+ # AgentScape 3D Core
2
2
 
3
- 自由代码世界新增 `AgentScape.openProject({project,container,authorized:true})`,支持持续 Three.js 逻辑、Shader、自定义动作和项目代码/状态保存。生命周期与示例见 [Code Project](../../docs/modules/code-project.md)。本地示例为 `/examples/code-project/`,可直接导入 [多文件代码世界 JSON](../../examples/code-project/multifile-studio.json)。多文件项目使用 `entry` 指定入口,`source` 保存入口源码,`files` 保存其他 JS/GLSL/JSON/TXT 源码;相对 ESM 导入会在浏览器与 Node 中解析,`three` 导入共享宿主实例。动态 import 和 npm 裸导入请使用原有外部打包工具。
3
+ **agentscape3d** is a small, unrestricted semantic and action extension for host-owned Three.js scenes. It does not require Studio, a renderer, WorldRuntime, MCP, an AI provider, an approval workflow, a sandbox or a physics engine.
4
4
 
5
- Beta package for the AgentScape 3D world engine. After publication, install with `npm install agentscape3d@beta`. This prerelease is published under the `beta` dist-tag, so the unqualified installation command is reserved for future stable releases. Before publication, build with `node dev/build-sdk.mjs`, then verify the resulting `npm pack` tarball.
5
+ ~~~js
6
+ import * as THREE from 'three';
7
+ import { attach } from 'agentscape3d';
6
8
 
7
- ```js
8
- import { AgentScape } from 'agentscape3d';
9
- const world = await AgentScape.open({ canvas: '#app' });
10
- await world.addModel({ id: 'cup', asset: 'builtin://cup', position: [0, 0, 2] });
11
- const saved = await world.save();
12
- const reopened = await AgentScape.open({ bundle: saved.value });
13
- reopened.close();
14
- world.close();
15
- ```
9
+ const scene = new THREE.Scene();
10
+ const door = new THREE.Group();
11
+ scene.add(door);
12
+ const world = attach(scene);
13
+ world.register(door, {
14
+ id: 'door', type: 'custom-door',
15
+ read: () => ({ angle: door.rotation.y }),
16
+ actions: { open: () => { door.rotation.y = -Math.PI / 2; } }
17
+ });
18
+ await world.invoke('door', 'open');
19
+ world.dispose(); // Does not dispose the scene or door
20
+ ~~~
16
21
 
17
- `#app` is an HTML container with an explicit width and height. Rendering schedules automatically when a container is supplied. Headless hosts advance `step()` themselves. Interactions return jobs; query or await them with `getJob` / `waitJob`, and inspect their verification evidence separately.
22
+ The same API works on objects imported through GLTFLoader or created in JavaScript. Use world.use(plugin) for optional extensions; there are no automatically installed plugins.
18
23
 
19
- ## Embedding in an existing Three.js scene
24
+ Optional npm packages:
25
+ - **agentscape3d-engine**: legacy full WorldRuntime, physics, assets and the explicit MCP integration
26
+ - **agentscape3d-studio**: standalone Studio and static website
20
27
 
21
- Use `AgentScape.attach({scene,camera,renderer,walkableMesh,hostProjectId,hostRevision})` to mount a self-owned Runtime subtree without taking over the host renderer or loop. Call `session.scene.frame(timestamp)` in the host frame callback and `session.close()` to detach. Save only the AgentScape overlay with `session.scene.saveOverlay(storage)`; prepare and commit it with `prepareOverlay(storage,root)`. Use `WorldStorage` with `WorldDirectory` for durable content-addressed blocks. The host project remains responsible for its own source and rendering state. For reload-safe browser checkpoints, pair `WorldStorage(new WorldDirectory(await navigator.storage.getDirectory()))` with `IndexedDBNativeOverlayHeadStore({key})`; then `await openNativeOverlayCheckpoint(session.scene, storage, heads)` restores the latest verified overlay automatically, and `await checkpoint.saveLatest()` publishes a new head only after validation. See [the native integration guide](../../docs/native-threejs-integration.md).
28
+ See docs/sdk-packages.md and docs/semantic-core.md in the repository.
22
29
 
23
- The SDK defaults to `monument-hall`; other built-in IDs are resolved through the shared Studio catalog. Some environments require a browser DOM and reject headless Node. Studio preset furniture is not implicitly inserted into Scene Projects. Bundled assets include agent, cup, table and chair. Use await world.setStyle(ref) with builtin://realistic, builtin://toon or builtin://low-poly. Headless hosts validate and defer rendering. This SDK shares the application Scene service and does not maintain another object store.
24
-
25
- `npx agentscape3d starter new-directory` (or `agentscape starter new-directory`) scaffolds an empty destination. Install this SDK tarball and Vite in that directory, then `npm run dev`. No provider key or paid service is needed for built-in worlds. Python Connector SDK usage is unchanged.
26
-
27
- Code assets require an explicit execution configuration. Node selects the Node entry automatically; `agentscape3d/node` is also available. Docker is not an installation prerequisite.
28
-
29
- ```js
30
- const world = await AgentScape.open({codeExecution:{mode:'worker-wasm'}});
31
- await world.addModel({id:'cube',asset:{kind:'three-code',source:`
32
- export function createAsset(THREE) {
33
- const root = new THREE.Group();
34
- root.add(new THREE.Mesh(new THREE.BoxGeometry(1,1,1),
35
- new THREE.MeshStandardMaterial({color:'#ee8844'})));
36
- return root;
37
- }
38
- `}});
39
- const bundle = (await world.save()).value;
40
- world.close();
41
- ```
42
-
43
- Node `worker-wasm` runs synchronous source in QuickJS without host filesystem/network bindings. `trusted-local` requires `{mode:'trusted-local',authorized:true}` and runs ESM factories (including async factories) in a dedicated Worker. It has the host's privileges. Browser code execution currently supports this explicitly authorized trusted Worker mode; browser `worker-wasm` and `os-isolated` are rejected. Worker time/memory controls are reliability protection, not OS security isolation. `disabled` rejects code. Public services must use `os-isolated` (configured Docker backend) or `disabled`; no fallback occurs.
44
-
45
- An optional `definition` provides the existing programmatic Manifest contract (`id`, `type`, `label`, `actions`, `physics`, named `parts`, joints and interaction targets). Omit it for visual-only assets. Physical assets undergo compiler admission and runtime registration/actuation verification before insertion. Serializable Mesh/Group/Object3D, buffer geometry and Basic/Standard/Physical materials are supported; runtime callbacks, animations, material arrays and external texture references are not transported. Root transforms must be identity; place assets through `position`/`transform`.
46
-
47
- Use `addModel(input,{signal})` to cancel. Saved bundles embed versioned compiled assets and their physical definitions and restore without executing source. Build execution, admission and live interaction verification are separate results.
48
-
49
- `agentscape3d mcp` (or `agentscape mcp`) starts the local authenticated loopback MCP server. Set `AGENTSCAPE_MCP_TOKENS` to a JSON array such as `[{"identity":"local","token":"a-random-secret-at-least-32-characters"}]` using a freshly generated secret. The default backend is `worker-wasm`. Trusted execution additionally requires `AGENTSCAPE_CODE_EXECUTION=trusted-local` and `AGENTSCAPE_TRUSTED_CODE=1`. Public deployments set `AGENTSCAPE_PUBLIC_SERVICE=1` and configure `os-isolated`; the server rejects unsafe modes. The programmatic entry is `import {startServer} from 'agentscape3d/mcp'`.
50
-
51
- ## npm 发布门槛(维护者)
52
-
53
- 当前准备发布 `1.0.0-beta.1`,发布前不得假定 npm 已上线。正式发布前必须在项目根目录通过 `npm run check`、`npm run test:browser` 和 `npm run sdk:verify`,并确认 `git status` 干净、发布版本号未被占用、许可证及依赖清单完整。浏览器测试必须覆盖自动 Studio MCP 连接、手动配对、复杂物理资产创建和跨进程保存/恢复。
54
-
55
- 发布目标固定为官方 npm Registry (`https://registry.npmjs.org/`) 的公开 npm 包,避免将镜像缓存结果当作发布状态。维护者需拥有 `agentscape3d` 的发布权限,通过 `npm whoami --registry=https://registry.npmjs.org/` 检查认证,再从 `sdk/typescript` 目录使用 `npm pack --dry-run` 审阅归档。`npm publish --tag beta --access public --registry=https://registry.npmjs.org/` 仅在版本确定、全部验收通过且获得发布授权后执行;不要在自动测试中发布。初次发布后验证 `npm view agentscape3d dist-tags --json --registry=https://registry.npmjs.org/`,确认 `beta` 指向 `1.0.0-beta.1`,再在全新项目验证 `npm install agentscape3d@beta`。
30
+ Beta 2 changes the default package entry: the former all-in-one runtime moves to agentscape3d-engine. Install explicitly with npm install agentscape3d@beta three. Code executes with the permissions of the host JavaScript environment; Core does not impose or claim a security boundary.
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
+ // 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":["../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":"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"}
package/dist/index.d.ts CHANGED
@@ -1,229 +1,10 @@
1
- export type Vec3 = [number, number, number];
2
- export type Quaternion = [number, number, number, number];
3
- export type CapabilityLevel = 'visual' | 'physical' | 'interactive';
4
- export interface CodeExecutionOptions { mode: 'disabled' | 'worker-wasm' | 'trusted-local' | 'os-isolated'; authorized?: boolean; remote?: boolean; wallTimeoutMs?: number; timeoutMs?: number; memoryBytes?: number; configPath?: string }
5
- export interface ThreeCodeInput { kind:'three-code'; source:string; definition?:Record<string,unknown> }
6
- export interface Transform { position?: Vec3; quaternion?: Quaternion; scale?: number }
7
- export interface AssetRecipe { schema: 'agentscape.asset-recipe'; schemaVersion: 1; id: string; parts: unknown[]; capabilities?: { level: CapabilityLevel; physics?: unknown; actions?: string[]; surfaces?: unknown[] } }
8
- export interface MechanicalComponent {
9
- id:string;parent:string|null;shape:'group'|'box'|'sphere'|'cylinder';position:Vec3;size:Vec3;color:string;collision:boolean;
10
- }
11
- export interface MechanicalMotion {
12
- id:string;node:string;type:'revolute'|'prismatic';axis:Vec3;limits:[number,number];open:number;
13
- mass:number;friction:number;stiffness:number;damping:number;
14
- }
15
- export interface MechanicalDraft {
16
- schema:'agentscape.mechanical-draft';schemaVersion:1;name:string;type:string;
17
- components:MechanicalComponent[];motions:MechanicalMotion[];
18
- }
19
- export interface ReviewPhysics { body: 'fixed' | 'dynamic'; mass: number; friction: number; colliders?: Array<{shape:'box';halfExtents:Vec3;translation?:Vec3}> }
20
- export interface InteractionReview { proposalId:string; confirmed:true; physics:ReviewPhysics; parts?: Array<{id:string;node:string;parent?:string;physics:ReviewPhysics;
21
- joint:{type:'prismatic'|'revolute';axis:Vec3;parentAnchor:Vec3;childAnchor:Vec3;limits:[number,number];motor?:{stiffness:number;damping:number}}}> }
22
- export interface GLBInput { kind:'glb';bytes:Uint8Array;name?:string;urdfBytes?:Uint8Array;review?:InteractionReview }
23
- export interface KinematicHypothesis { id:string;source:'gltf-animation'|'static-geometry';node:string|null;nodeIndex:number;jointType:'revolute'|'prismatic';axisWorld:Vec3;pivotWorld:Vec3;limits:[number,number]|null;evidence:Record<string,unknown>;missing:string[];status:'candidate';executable:false;physicsVerified:false;functionVerified:false }
24
- export interface KinematicEvidence { schema:'agentscape.kinematic-evidence';schemaVersion:1;hypotheses:KinematicHypothesis[];issues:Array<{code:string;[key:string]:unknown}>;limitations:string[];truncated?:boolean;evidenceSources:string[] }
25
- export interface KinematicScreenResult { id:string;source:string;jointType:string;status:'simulation-passed'|'simulation-failed'|'blocked';mechanicalFeasible:boolean;physicsVerified:false;functionVerified:false;admission:'not-granted';assumptions?:Record<string,unknown>|null;trials?:Array<{target:number|null;status:'simulation-passed'|'simulation-failed'|'blocked';mechanicalFeasible:boolean;assumptions?:Record<string,unknown>;evidence?:Record<string,unknown>;diagnostics?:Array<{code:string}>}>;evidence?:Record<string,unknown>;diagnostics?:Array<{code:string}> }
26
- export interface KinematicScreen { schema:'agentscape.kinematic-screen';schemaVersion:1;proposalId:string;sourceHash:string;results:KinematicScreenResult[];admission:'not-granted';interpretation:string }
27
- export interface CapabilityProposal { schema:'agentscape.capability-proposal';schemaVersion:1;proposalId:string;sourceHash:string;urdfHash:string|null;compilerVersion:string;
28
- physics:{body:null;mass:null;friction:null;colliders:unknown[]};kinematics:KinematicEvidence;
29
- parts:Array<{id:string;node:string;parent?:string;joint:Record<string,unknown>;physics?:Record<string,unknown>;confidence?:number;executable:false;physicsVerified:false;missing:string[]}>;
30
- operations:Array<{action:string;part?:string;executable:false;physicsVerified:false;requires:string}>;missing:string[];evidence:Record<string,unknown> }
31
- export interface ModelInput { id: string; asset: string | AssetRecipe | MechanicalDraft | GLBInput | ThreeCodeInput; level?: CapabilityLevel; transform?: Transform; position?: Vec3 }
32
- export interface Diagnostic { code: string; message: string; stage: string; retryable: boolean }
33
- export type AdmissionStatus = 'ready' | 'provisional' | 'rejected';
34
- export interface AdmissionLayer { status: AdmissionStatus; reasons: string[]; required: boolean }
35
- export interface AssetAdmission { status: AdmissionStatus; reasons: string[]; layers: { provider: AdmissionLayer; compiler: AdmissionLayer; runtime: AdmissionLayer } }
36
- export interface SceneResult<T = unknown> { schema: 'agentscape.scene-result'; schemaVersion: 1; operation: string; status: 'succeeded' | 'failed' | 'cancelled'; revision: number; id?: string; admission: AssetAdmission | null; verification: { status: 'not-requested' | 'verified' | 'unverified'; evidence: unknown }; diagnostics: Diagnostic[]; value: T }
37
- export interface JobRef { id: string; status: 'running' | 'succeeded' | 'failed' | 'cancelled' }
38
- export interface AffordancePhysics { registered: boolean; body: 'fixed' | 'dynamic' | 'kinematic' | null; currentBody: 'fixed' | 'dynamic' | 'kinematic' | null; mass: number | null; friction: number | null; colliderCount: number }
39
- export interface AffordanceJoint { type: 'fixed' | 'revolute' | 'prismatic'; axis?: Vec3; limits?: [number, number]; parentAnchor?: Vec3; childAnchor?: Vec3; [key: string]: unknown }
40
- export interface ArticulationState { id: string; partName: string; jointType: string; coordinate: number; target: number | null; error: number | null; tolerance: number; limits: [number, number] | null; localAxis: Vec3; coordinateReference: 'rest-zero-pose' }
41
- export interface AffordanceAction {
42
- action: string; parameters: Record<string, unknown>; execution: 'query' | 'editor' | 'interaction' | 'world-action' | 'project-action';
43
- available: boolean | null; canApproach?:boolean; reason?: string | null; partName?: string; distance?: number; maxDistance?: number;
44
- targetPosition?: Vec3; blocker?: Record<string, unknown>; joint?: AffordanceJoint; state?: ArticulationState | null;
45
- contract?: { id: string; capability: string; action: string; target: { entityId: string; partName: string }; preconditions: unknown[]; effects: unknown[]; stateTransition: Record<string, unknown>; verifierTarget: Record<string, unknown> };
46
- }
47
- export interface SemanticCapability {
48
- id:string; target:string; name:string; action:'invoke'; source:'asset'|'environment'|'project';
49
- executor:'query'|'editor'|'interaction'|'world-action'|'project-action';
50
- description:string; parameters:Record<string,unknown>; available:boolean|null;
51
- partName?:string; reason?:string; canApproach?:boolean; verification:string;
52
- capabilitySource?:'declared'|'physical-inference'; graspVerified?:false;
53
- }
54
- export interface ObjectAffordances {
55
- schema: 'agentscape.object-affordances'; schemaVersion: 1; id: string; source: 'asset' | 'environment' | 'composite';
56
- label: string; kind: string; position: Vec3; state: Record<string, unknown>;
57
- physics?: AffordancePhysics;
58
- actions: AffordanceAction[]; capabilities?:SemanticCapability[];
59
- providers?:string[];stateProviders?:Record<string,Record<string,unknown>>;stateConflicts?:string[];
60
- capabilityCandidates?:Array<{action:string;executable:false;reason:string;source:string}>;
61
- evidenceKind: string; physicsVerified: false; pending: boolean;
62
- }
63
- export interface AffordanceListing { schema: string; total: number; entities: ObjectAffordances[] }
64
- export type Edit = { type: 'add'; model: Omit<ModelInput, 'asset'> & { asset: string } } | { type: 'setTransform'; id: string; transform: Transform } | { type: 'remove'; id: string } | { type: 'replaceAsset'; id: string; asset: string; level?: CapabilityLevel };
65
- export type PhysicalInteraction = { action: 'push' | 'drag'; actor: string; target: string; args: { direction: Vec3; distance: number; maxForce?: number } }
66
- | { action: 'rotate'; actor: string; target: string; args: { axis: Vec3; angle: number; maxTorque?: number } }
67
- | { action: 'slide'; actor: string; target: string; args: { part: string } & ({ target: number; distance?: never } | { distance: number; target?: never }) }
68
- | { action: 'rotateJoint'; actor: string; target: string; args: { part: string } & ({ target: number; angle?: never } | { angle: number; target?: never }) };
69
- export type Interaction = { action: 'invoke'; target: string; name: string; actor?: string; partName?: string; source?:'asset'|'environment'|'project'; args?: Record<string, unknown> } | { action: 'custom'; target: string; name: string; args?: Record<string, unknown>; actor?: string } | PhysicalInteraction | { action: 'navigate'; actor: string; position: Vec3 } | { action: 'pickup'; actor: string; target: string } | { action: 'place'; actor: string; target: string; surfaceId?: string } | { action: 'open' | 'close'; actor: string; target: string; partName?: string }
70
- | { action: 'turn_on' | 'turn_off' | 'pull_out' | 'return'; actor: string; target: string }
71
- | { action: 'write'; actor: string; target: string; args: { text: string } };
72
- export interface SceneHandle {
73
- registerEntity(definition: ProjectEntityDefinition): () => void;
74
- registerAction(definition: ProjectActionDefinition): () => void;
75
- registerStateMachine(definition: ProjectStateMachineDefinition): ProjectStateMachineHandle;
76
- actors():{agents:Array<{id:string;position:Vec3|null}>;selected:string|null};
77
- selectActor(actor:string):{agents:Array<{id:string;position:Vec3|null}>;selected:string|null};
78
- prepareAsset(input:Omit<GLBInput,'review'>):Promise<CapabilityProposal>;
79
- /** Temporary Rapier tests of source-bound hypotheses; never authorizes actions. */
80
- screenAsset(input:Omit<GLBInput,'review'> & {proposalId:string;hypothesisIds?:string[]}):Promise<KinematicScreen>;
81
- inspect(target: string, options?: { actor?: string }): ObjectAffordances | ProjectEntityObservation;
82
- /** Object-only page in live insertion order. Restart after mutations; no global graph work. */
83
- observe(options: { actor?: string; offset?: number; limit: number }): { schema: 'agentscape.scene-object-page'; schemaVersion: 1; revision: number; total: number; offset: number; nextOffset: number | null; objects: Array<{ id: string; type: string; asset: string; position: Vec3; state: Record<string, unknown>; transform: Transform; physicsRegistered: boolean }> };
84
- observe(options?: { actor?: string }): { schema: string; schemaVersion: 1; revision: number; actors: ReturnType<SceneHandle['actors']>; style: Record<string, unknown> | null; affordances: AffordanceListing; project: { total: number; entities: ProjectEntityObservation[] }; objects: Array<{ id: string; type: string; asset: string; position: Vec3; state: Record<string, unknown>; transform: Transform; physicsRegistered: boolean }>; relations: unknown[] };
85
- addModel(input: ModelInput, options?:{signal?:AbortSignal}): Promise<SceneResult>;
86
- setTransform(input: { id: string; transform: Transform }): Promise<SceneResult>;
87
- remove(input: { id: string }): Promise<SceneResult>;
88
- replaceAsset(input: { id: string; asset: string; level?: CapabilityLevel }): Promise<SceneResult>;
89
- apply(input: { requestId?: string; expectedRevision?: number; operations: Edit[] }): Promise<SceneResult>;
90
- interact(input: Interaction): JobRef;
91
- getJob(id: string): JobRef & { result: SceneResult | null };
92
- waitJob(id: string): Promise<JobRef & { result: SceneResult | null }>;
93
- cancelJob(id: string): JobRef & { cancellationRequested: boolean };
94
- verify(criteria?: unknown[]): SceneResult;
95
- save(): Promise<SceneResult>;
96
- exportWorld(storage:WorldStorage,writer?:{write(data:Uint8Array):Promise<unknown>},options?:{name?:string;linked?:boolean;signal?:AbortSignal}):Promise<SceneResult<WorldBlockRef>>;
97
- prepareWorld(storage:WorldStorage,root:WorldBlockRef,options?:{active?:'none'|'saved'|'bounded';maxActiveEntities?:number;signal?:AbortSignal}):Promise<PreparedWorld>;
98
- importWorld(storage:WorldStorage,source:AsyncIterable<Uint8Array>,options?:{active?:'none'|'saved'|'bounded';maxActiveEntities?:number;signal?:AbortSignal}):Promise<SceneResult>;
99
- setStyle(style: string | Record<string, unknown>, options?: { fallback?: 'reject' | 'declared' }): Promise<SceneResult>;
100
- frame(timestamp: number): void; step(): unknown; close(): void;
101
- }
102
- export interface NativeSceneOptions {
103
- scene: any; camera: any; renderer: any; three?: any; name?: string;
104
- environmentId?: string; colliders?: Record<string, unknown>[]; navigationRoot?: any;
105
- staticMeshes?: any[]; walkableMesh?: any; hostProjectId?: string; hostRevision?: string;
106
- assetModule?: any; autoStart?: boolean; codeExecutor?: any; codeGLTFLoader?: any; assetBaseUrl?: string | null;
107
- }
108
- export interface NativeOverlayPrepared {
109
- summary: unknown;
110
- commit(): Promise<unknown>;
111
- dispose(): void;
112
- }
113
- export interface NativeSceneHandle extends SceneHandle {
114
- saveOverlay(storage: WorldStorage, options?: { name?: string; signal?: AbortSignal }): Promise<WorldBlockRef & {kind:'native-overlay'}>;
115
- prepareOverlay(storage: WorldStorage, root: WorldBlockRef & {kind:'native-overlay'}, options?: {signal?:AbortSignal;active?:'saved'|'none'|'bounded';maxActiveEntities?:number}): Promise<NativeOverlayPrepared>;
116
- restoreOverlay(storage: WorldStorage, root: WorldBlockRef & {kind:'native-overlay'}, options?: {signal?:AbortSignal;active?:'saved'|'none'|'bounded';maxActiveEntities?:number}): Promise<unknown>;
117
- exportOverlay(storage: WorldStorage, root: WorldBlockRef & {kind:'native-overlay'}, writer: {write(bytes:Uint8Array):Promise<unknown>}, options?: {signal?:AbortSignal}): Promise<unknown>;
118
- importOverlay(storage: WorldStorage, source: AsyncIterable<Uint8Array>, options?: {signal?:AbortSignal}): Promise<WorldBlockRef & {kind:'native-overlay'}>;
119
- }
120
- export interface NativeSceneSession {
121
- scene: NativeSceneHandle & { native: { scene: any; renderer: any; camera: any; root: any };
122
- capabilities: { mode: 'native-scene'; threeRevision: string; sourceConversion: false;
123
- ownsRenderer: false; nativeProjectSave: false; nativeOverlayPersistence: boolean; environmentColliders: number; navigationRegistered: boolean } };
124
- world: any;
125
- close(): void;
126
- }
127
- /** Bind a trusted native scene. Save/import/style takeover are explicitly unsupported. */
128
- export declare function attachNativeScene(options: NativeSceneOptions): Promise<NativeSceneSession>;
129
- export interface NativeSceneCandidate { id: string; scene: any; camera: any; renderer: any; renders: number }
130
- export declare function observeNativeRenderer(renderer: any): () => void;
131
- export declare function listNativeScenes(): NativeSceneCandidate[];
132
- export declare function subscribeNativeScenes(listener: (candidate: NativeSceneCandidate) => void): () => void;
133
- export declare const AgentScape: { attach: typeof attachNativeScene; openProject: typeof openCodeProject; open(options?: { canvas?: string | HTMLElement; project?: unknown; bundle?: unknown; environment?: string; autoStart?: boolean; codeExecution?:CodeExecutionOptions }): Promise<SceneHandle> };
134
-
135
- export interface ProjectEntityDefinition { id: string; label?: string; description?: string; object?: any; attachTo?:'runtime'; read?: () => Record<string, unknown> }
136
- export interface ProjectActionContext { actor?: string; target: string; object: any; signal?: AbortSignal }
137
- export interface ProjectActionDefinition {
138
- target: string; name: string; description?: string; parameters?: Record<string, unknown>;
139
- /** Default 60s; null disables automatic cancellation for long-running project actions. */
140
- timeoutMs?:number|null;
141
- execute(args: any, context: ProjectActionContext): unknown | Promise<unknown>;
142
- available?(context: ProjectActionContext): boolean;
143
- verify?(evidence: {args:any;before:Record<string,unknown>;after:Record<string,unknown>;value:unknown}, context:ProjectActionContext): boolean | {verified:boolean;[key:string]:unknown} | Promise<boolean | {verified:boolean;[key:string]:unknown}>;
144
- }
145
- export type MachineValue = string | number | boolean | null;
146
- export interface MachineCondition {
147
- field:string;op:'eq'|'ne'|'lt'|'lte'|'gt'|'gte';value?:MachineValue;other?:string;
148
- }
149
- export interface MachineEffect {field:string;op:'set'|'add';value:MachineValue}
150
- export interface ProjectMachineTransition {
151
- name:string;description?:string;expose?:boolean;when?:MachineCondition[];effects:MachineEffect[];
152
- }
153
- export interface ProjectMachineTimer {
154
- field:string;rate:number;max:number;when?:MachineCondition[];onComplete?:string;
155
- }
156
- export interface ProjectStateMachineDefinition {
157
- id:string;label?:string;description?:string;object?:any;attachTo?:'runtime';
158
- initialState:Record<string,MachineValue>;transitions:ProjectMachineTransition[];
159
- ranges?:Record<string,{min:number;max:number}>;timers?:ProjectMachineTimer[];
160
- onChange?(next:Record<string,MachineValue>,previous:Record<string,MachineValue>,meta:{kind:string;name?:string;seconds?:number;completed?:string[]}):void;
161
- verifyVisual?(state:Record<string,MachineValue>,context:{object:any;kind:string}):boolean;
162
- }
163
- export interface ProjectStateMachineHandle {
164
- read():Record<string,MachineValue>;
165
- advance(seconds:number):{changed:boolean;state:Record<string,MachineValue>;completed?:string[]};
166
- dispose():void;
167
- }
168
- export interface CodeProjectMachineSnapshot {
169
- schema:'agentscape.project-machine-state';schemaVersion:1;entities:Record<string,Record<string,MachineValue>>;
170
- }
171
- export interface ProjectEntityObservation {
172
- schema:'agentscape.project-entity';schemaVersion:1;source:'project';id:string;label:string;description:string;state:Record<string,unknown>;physicsVerified:false;
173
- actions:Array<{action:'custom';name:string;description:string;parameters:Record<string,unknown>;execution:'project-action';available:boolean;verification:'project-defined'|'unverified'}>;
174
- capabilities?:SemanticCapability[];attachedTo?:'runtime';providers?:string[];stateProviders?:Record<string,Record<string,unknown>>;stateConflicts?:string[];
175
- }
176
- export interface CodeProject {
177
- schema:'agentscape.code-project';schemaVersion:1;id:string;name:string;source:string;
178
- resources?:Record<string,{mime:string;base64:string}>;state?:unknown;runtime?:unknown;
179
- machines?:CodeProjectMachineSnapshot;integrity?:string;
180
- }
181
- export interface CodeProjectSession {
182
- scene:SceneHandle & {native:NativeSceneSession['scene']['native'];capabilities:Record<string,unknown>};world:any;
183
- frame(timestamp:number):void;save():Promise<SceneResult<CodeProject>>;close():void;
184
- }
185
- export declare function parseCodeProject(input:unknown,options?:{maxBytes?:number}):Promise<CodeProject>;
186
- export declare function openCodeProject(options:{project:CodeProject|string;container?:HTMLElement|null;authorized?:boolean;autoStart?:boolean;maxBytes?:number;assetBaseUrl?:string}):Promise<CodeProjectSession>;
187
- export declare function parseSceneProject(input: unknown): unknown;
188
- export declare const recipeSchema: { parse(input: unknown): unknown };
189
- export declare const assetPackageSchema: { parse(input: unknown): unknown };
190
- export declare const stylePackSchema: { parse(input: unknown): unknown };
191
- export declare const officialStylePacks: Readonly<Record<'realistic' | 'toon' | 'low-poly', Record<string, unknown>>>;
192
-
193
- export interface WorldBlockRef { hash:string;bytes:number;kind?:string }
194
- export interface WorldBlockBackend { read(hash:string,expectedBytes:number):Promise<Uint8Array>;write(hash:string,bytes:Uint8Array):Promise<void> }
195
- export interface PreparedWorld { summary:{entities:number;assets:number;activeEntities:number;dormantEntities:number;environment:string};commit():Promise<unknown>;dispose():void }
196
- export declare class WorldStorage {
197
- constructor(backend:WorldBlockBackend);
198
- put(bytes:Uint8Array,options?:{signal?:AbortSignal}):Promise<WorldBlockRef>;
199
- read(ref:WorldBlockRef,options?:{signal?:AbortSignal}):Promise<Uint8Array>;
200
- resource(ref:WorldBlockRef,options?:{signal?:AbortSignal}):AsyncIterable<Uint8Array>;
201
- }
202
- export declare class WorldDirectory implements WorldBlockBackend {
203
- constructor(directory:FileSystemDirectoryHandle);
204
- read(hash:string,expectedBytes:number):Promise<Uint8Array>;
205
- write(hash:string,bytes:Uint8Array):Promise<void>;
206
- }
207
- export declare function blobChunks(blob:Blob,options?:{signal?:AbortSignal}):AsyncIterable<Uint8Array>;
208
-
209
- export interface NativeOverlayHeadStore {
210
- read():Promise<WorldBlockRef | null>;
211
- publish(expected:WorldBlockRef | null,root:WorldBlockRef):Promise<WorldBlockRef>;
212
- }
213
- export declare class MemoryNativeOverlayHeadStore implements NativeOverlayHeadStore {
214
- constructor();
215
- read():Promise<WorldBlockRef | null>;
216
- publish(expected:WorldBlockRef | null,root:WorldBlockRef):Promise<WorldBlockRef>;
217
- }
218
- export declare class IndexedDBNativeOverlayHeadStore implements NativeOverlayHeadStore {
219
- constructor(options:{key:string;databaseName?:string});
220
- read():Promise<WorldBlockRef | null>;
221
- publish(expected:WorldBlockRef | null,root:WorldBlockRef):Promise<WorldBlockRef>;
222
- }
223
- export interface NativeOverlayCheckpoint {
224
- readLatest():Promise<WorldBlockRef | null>;
225
- saveLatest(options?:{name?:string;signal?:AbortSignal}):Promise<WorldBlockRef>;
226
- restoreLatest(options?:{signal?:AbortSignal;active?:'saved'|'none'|'bounded';maxActiveEntities?:number}):Promise<WorldBlockRef | null>;
227
- }
228
- export declare function createNativeOverlayCheckpoint(scene:NativeSceneHandle,storage:WorldStorage,heads:NativeOverlayHeadStore):NativeOverlayCheckpoint;
229
- export declare function openNativeOverlayCheckpoint(scene:NativeSceneHandle,storage:WorldStorage,heads:NativeOverlayHeadStore,options?:{restore?:boolean}):Promise<NativeOverlayCheckpoint>;
1
+ export { attach } from './core.js';
2
+ export type {
3
+ SemanticWorld, SemanticScene, SemanticObject3D, SemanticTarget,
4
+ SemanticAction, SemanticActionFn, SemanticActionContext, SemanticDefinition,
5
+ SemanticEntity, SemanticEvent, SemanticPlugin
6
+ } from './core.js';
7
+ export declare const AgentScape: {
8
+ readonly attach: typeof import('./core.js').attach;
9
+ readonly extend: typeof import('./core.js').attach;
10
+ };