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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/README.md +23 -48
  2. package/dist/core.d.ts +68 -0
  3. package/dist/core.js +209 -0
  4. package/dist/core.js.map +1 -0
  5. package/dist/index.d.ts +10 -229
  6. package/dist/index.js +192 -15462
  7. package/dist/index.js.map +1 -1
  8. package/package.json +11 -40
  9. package/cli.mjs +0 -27
  10. package/dist/AssetCompiler-CDFiElji.js +0 -2451
  11. package/dist/AssetCompiler-CDFiElji.js.map +0 -1
  12. package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
  13. package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
  14. package/dist/AssetRecipe-DmFpzxr-.js +0 -55
  15. package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
  16. package/dist/BrowserCodeWorker.js +0 -53615
  17. package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
  18. package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
  19. package/dist/SceneSerializer-DPVOyeRk.js +0 -353
  20. package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
  21. package/dist/StylePack-DNrdLeGI.js +0 -6314
  22. package/dist/StylePack-DNrdLeGI.js.map +0 -1
  23. package/dist/WorldArchive-pSBIGxLa.js +0 -420
  24. package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
  25. package/dist/WorldIO-wsDfZGM4.js +0 -150
  26. package/dist/WorldIO-wsDfZGM4.js.map +0 -1
  27. package/dist/blankWorld-CBWbwJGj.js +0 -76
  28. package/dist/blankWorld-CBWbwJGj.js.map +0 -1
  29. package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
  30. package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
  31. package/dist/environments-DgH66NqV.js +0 -4220
  32. package/dist/environments-DgH66NqV.js.map +0 -1
  33. package/dist/gltfIO-B87nJaat.js +0 -10
  34. package/dist/gltfIO-B87nJaat.js.map +0 -1
  35. package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
  36. package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
  37. package/dist/magicCabin-D64fD1E2.js +0 -11024
  38. package/dist/magicCabin-D64fD1E2.js.map +0 -1
  39. package/dist/mcp.d.ts +0 -2
  40. package/dist/mcp.js +0 -1
  41. package/dist/monumentHall-BKbs0UOQ.js +0 -404
  42. package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
  43. package/dist/node.d.ts +0 -16
  44. package/dist/node.js +0 -25
  45. package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
  46. package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
  47. package/dist/runtime/application/AgentTools.js +0 -25
  48. package/dist/runtime/application/README.md +0 -14
  49. package/dist/runtime/application/buildTaskObservation.js +0 -117
  50. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
  51. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
  52. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
  53. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
  54. package/dist/runtime/application/createSession.js +0 -66
  55. package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
  56. package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
  57. package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
  58. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
  59. package/dist/runtime/application/native-scene/CodeProject.js +0 -119
  60. package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
  61. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
  62. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
  63. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
  64. package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
  65. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
  66. package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
  67. package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
  68. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
  69. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
  70. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
  71. package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
  72. package/dist/runtime/application/scene/RequestWindow.js +0 -54
  73. package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
  74. package/dist/runtime/application/scene/SceneContracts.js +0 -45
  75. package/dist/runtime/application/scene/SceneEditService.js +0 -144
  76. package/dist/runtime/application/scene/SceneFacade.js +0 -267
  77. package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
  78. package/dist/runtime/application/scene/SceneJobController.js +0 -229
  79. package/dist/runtime/application/scene/ScenePackage.js +0 -162
  80. package/dist/runtime/application/scene/ScenePersistence.js +0 -50
  81. package/dist/runtime/application/scene/SceneProject.js +0 -95
  82. package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
  83. package/dist/runtime/application/scene/StarterScene.js +0 -56
  84. package/dist/runtime/application/scene/WorldArchive.js +0 -87
  85. package/dist/runtime/application/scene/WorldDirectory.js +0 -20
  86. package/dist/runtime/application/scene/WorldDocument.js +0 -74
  87. package/dist/runtime/application/scene/WorldIO.js +0 -103
  88. package/dist/runtime/application/scene/WorldStorage.js +0 -137
  89. package/dist/runtime/application/skills/SkillRegistry.js +0 -163
  90. package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
  91. package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
  92. package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
  93. package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
  94. package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
  95. package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
  96. package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
  97. package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
  98. package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
  99. package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
  100. package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
  101. package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
  102. package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
  103. package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
  104. package/dist/runtime/application/skills/skillPrimitives.js +0 -4
  105. package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
  106. package/dist/runtime/application/tasks.jsonl +0 -67
  107. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
  108. package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
  109. package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
  110. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
  111. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
  112. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
  113. package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
  114. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
  115. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
  116. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
  117. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
  118. package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
  119. package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
  120. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
  121. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
  122. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
  123. package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
  124. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
  125. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
  126. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
  127. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
  128. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
  129. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
  130. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
  131. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
  132. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
  133. package/dist/runtime/apps/mcp-server/README.md +0 -150
  134. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
  135. package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
  136. package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
  137. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
  138. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
  139. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
  140. package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
  141. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
  142. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
  143. package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
  144. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
  145. package/dist/runtime/apps/mcp-server/main.mjs +0 -56
  146. package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
  147. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
  148. package/dist/runtime/apps/mcp-server/security.js +0 -21
  149. package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
  150. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
  151. package/dist/runtime/apps/server/README.md +0 -7
  152. package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
  153. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
  154. package/dist/runtime/apps/server/tasks.jsonl +0 -10
  155. package/dist/runtime/foundation/EventBus.js +0 -18
  156. package/dist/runtime/foundation/JsonGateway.js +0 -47
  157. package/dist/runtime/foundation/PolicyEngine.js +0 -21
  158. package/dist/runtime/foundation/README.md +0 -7
  159. package/dist/runtime/foundation/TraceRecorder.js +0 -76
  160. package/dist/runtime/foundation/errors.js +0 -8
  161. package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
  162. package/dist/runtime/foundation/version.js +0 -2
  163. package/dist/runtime/modules/agent/README.md +0 -11
  164. package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
  165. package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
  166. package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
  167. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
  168. package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
  169. package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
  170. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
  171. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
  172. package/dist/runtime/modules/agent/prompt/index.js +0 -46
  173. package/dist/runtime/modules/agent/tasks.jsonl +0 -94
  174. package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
  175. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
  176. package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
  177. package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
  178. package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
  179. package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
  180. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
  181. package/dist/runtime/modules/artifact/README.md +0 -7
  182. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
  183. package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
  184. package/dist/runtime/modules/asset/AssetModule.js +0 -399
  185. package/dist/runtime/modules/asset/README.md +0 -54
  186. package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
  187. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
  188. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
  189. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
  190. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
  191. package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
  192. package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
  193. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
  194. package/dist/runtime/modules/asset/model/admission.js +0 -117
  195. package/dist/runtime/modules/asset/model/errors.js +0 -6
  196. package/dist/runtime/modules/asset/model/parts.js +0 -27
  197. package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
  198. package/dist/runtime/modules/asset/model/schema.js +0 -150
  199. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
  200. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
  201. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
  202. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
  203. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
  204. package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
  205. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
  206. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
  207. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
  208. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
  209. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
  210. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
  211. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
  212. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
  213. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
  214. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
  215. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
  216. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
  217. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
  218. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
  219. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
  220. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
  221. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
  222. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
  223. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
  224. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
  225. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
  226. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
  227. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
  228. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
  229. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
  230. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
  231. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
  232. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
  233. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
  234. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
  235. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
  236. package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
  237. package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
  238. package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
  239. package/dist/runtime/modules/asset/tasks.jsonl +0 -87
  240. package/dist/runtime/modules/generation/README.md +0 -9
  241. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
  242. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
  243. package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
  244. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
  245. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
  246. package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
  247. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
  248. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
  249. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
  250. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
  251. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
  252. package/dist/runtime/modules/generation/tasks.jsonl +0 -35
  253. package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
  254. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
  255. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
  256. package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
  257. package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
  258. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
  259. package/dist/runtime/modules/rendering/README.md +0 -7
  260. package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
  261. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
  262. package/dist/runtime/modules/rendering/createRenderer.js +0 -76
  263. package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
  264. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
  265. package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
  266. package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
  267. package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
  268. package/dist/runtime/modules/world/README.md +0 -13
  269. package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
  270. package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
  271. package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
  272. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
  273. package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
  274. package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
  275. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
  276. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
  277. package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
  278. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
  279. package/dist/runtime/modules/world/content/blankWorld.js +0 -35
  280. package/dist/runtime/modules/world/content/environments.js +0 -84
  281. package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
  282. package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
  283. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
  284. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
  285. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
  286. package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
  287. package/dist/runtime/modules/world/content/magicCabin.js +0 -190
  288. package/dist/runtime/modules/world/content/monumentHall.js +0 -154
  289. package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
  290. package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
  291. package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
  292. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
  293. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
  294. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
  295. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
  296. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
  297. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
  298. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
  301. package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
  302. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
  303. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
  304. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
  305. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
  306. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
  307. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
  308. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
  309. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
  310. package/dist/runtime/modules/world/errors.js +0 -9
  311. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
  312. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
  313. package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
  314. package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
  315. package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
  316. package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
  317. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
  318. package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
  319. package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
  320. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
  321. package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
  322. package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
  323. package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
  324. package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
  325. package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
  326. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
  327. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
  328. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
  329. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
  330. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
  331. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
  332. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
  333. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
  334. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
  335. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
  336. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
  337. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
  338. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
  339. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
  340. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
  341. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
  342. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
  343. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
  344. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
  345. package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
  346. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
  347. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
  348. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
  349. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
  350. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
  351. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
  352. package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
  353. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
  354. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
  355. package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
  356. package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
  357. package/dist/runtime/modules/world/tasks.jsonl +0 -530
  358. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
  359. package/dist/runtime/modules/world/verification/Finding.js +0 -105
  360. package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
  361. package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
  362. package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
  363. package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
  364. package/dist/runtime/package-lock.json +0 -6245
  365. package/dist/runtime/package.json +0 -91
  366. package/dist/runtime/public/assets/cabinet.glb +0 -0
  367. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  368. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  369. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  370. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  371. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  372. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  373. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  374. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  375. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  376. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  377. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  379. package/dist/schema-Dudvovhu.js +0 -364
  380. package/dist/schema-Dudvovhu.js.map +0 -1
  381. package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
  382. package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
  383. package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
  384. package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
  385. package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
  386. package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
@@ -1,420 +0,0 @@
1
- import { s as IncrementalSha256 } from "./environments-DgH66NqV.js";
2
- //#region ../../application/scene/WorldStorage.js
3
- const WORLD_BLOCK_BYTES = 1048576;
4
- const encoder$1 = new TextEncoder();
5
- const decoder$1 = new TextDecoder("utf-8", { fatal: true });
6
- const worldStorageError = (code) => Object.assign(new Error(code), { code });
7
- function checkHash(hash) {
8
- if (!/^[a-f0-9]{64}$/.test(hash)) throw worldStorageError("WORLD_HASH_INVALID");
9
- return hash;
10
- }
11
- const hashBytes = (bytes) => new IncrementalSha256().update(bytes).digestHex();
12
- function checkCancelled(signal) {
13
- if (signal?.aborted) throw worldStorageError("WORLD_CANCELLED");
14
- }
15
- /** Immutable content-addressed blocks. Backend owns durable bytes, never a world/entity cache. */
16
- var WorldStorage = class {
17
- constructor(backend) {
18
- if (!backend?.read || !backend?.write) throw new TypeError("WorldStorage requires a block backend");
19
- this.backend = backend;
20
- }
21
- async put(bytes, { signal } = {}) {
22
- checkCancelled(signal);
23
- if (!(bytes instanceof Uint8Array) || bytes.length > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
24
- const hash = hashBytes(bytes);
25
- await this.backend.write(hash, bytes);
26
- checkCancelled(signal);
27
- return {
28
- hash,
29
- bytes: bytes.length
30
- };
31
- }
32
- async read(ref, { signal } = {}) {
33
- checkCancelled(signal);
34
- checkHash(ref?.hash);
35
- if (!Number.isSafeInteger(ref.bytes) || ref.bytes < 0 || ref.bytes > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
36
- const bytes = await this.backend.read(ref.hash, ref.bytes);
37
- checkCancelled(signal);
38
- if (!(bytes instanceof Uint8Array) || bytes.length !== ref.bytes || hashBytes(bytes) !== ref.hash) throw worldStorageError("WORLD_INTEGRITY_MISMATCH");
39
- return bytes;
40
- }
41
- async putNode(kind, data, refs = [], options = {}) {
42
- return {
43
- ...await this.put(encoder$1.encode(JSON.stringify({
44
- kind,
45
- data,
46
- refs
47
- })), options),
48
- kind
49
- };
50
- }
51
- async node(ref, options = {}) {
52
- let node;
53
- try {
54
- node = JSON.parse(decoder$1.decode(await this.read(ref, options)));
55
- } catch (error) {
56
- if (error.code) throw error;
57
- throw worldStorageError("WORLD_NODE_INVALID");
58
- }
59
- if (!node || node.kind !== ref.kind || !Array.isArray(node.refs) || node.refs.length > 2048) throw worldStorageError("WORLD_NODE_INVALID");
60
- for (const link of node.refs) {
61
- checkHash(link?.hash);
62
- if (!Number.isSafeInteger(link.bytes) || link.bytes < 0 || link.bytes > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
63
- }
64
- return node;
65
- }
66
- /** Page list is immutable; newest page points to its predecessor. No unbounded root index. */
67
- async writePages(kind, items, { pageSize = 128, signal } = {}) {
68
- if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > 1024) throw worldStorageError("WORLD_PAGE_BUDGET");
69
- let previous = null, count = 0, page = [];
70
- const flush = async () => {
71
- const refs = [...page.flatMap((item) => item.resource ? [item.resource] : []), ...previous ? [previous] : []];
72
- previous = await this.putNode(kind, {
73
- items: page,
74
- previous,
75
- count
76
- }, refs, { signal });
77
- page = [];
78
- };
79
- for await (const item of items) {
80
- checkCancelled(signal);
81
- page.push(item);
82
- count++;
83
- if (page.length === pageSize) await flush();
84
- }
85
- if (page.length) await flush();
86
- return previous;
87
- }
88
- async *pages(ref, kind, options = {}) {
89
- const visited = /* @__PURE__ */ new Set();
90
- while (ref) {
91
- if (ref.kind !== kind || visited.has(ref.hash)) throw worldStorageError("WORLD_PAGE_INVALID");
92
- visited.add(ref.hash);
93
- const node = await this.node(ref, options), { items, previous } = node.data || {};
94
- if (!Array.isArray(items) || items.length > 1024 || JSON.stringify(node.refs) !== JSON.stringify([...items.flatMap((item) => item.resource ? [item.resource] : []), ...previous ? [previous] : []])) throw worldStorageError("WORLD_PAGE_INVALID");
95
- yield items;
96
- ref = previous;
97
- }
98
- }
99
- /** Consumes bounded chunks with backpressure. Large producer chunks are rejected before copying. */
100
- async putResource(source, { format = "application/octet-stream", signal } = {}) {
101
- const digest = new IncrementalSha256();
102
- let size = 0, previous = null, blocks = [], buffer = new Uint8Array(WORLD_BLOCK_BYTES), used = 0;
103
- const flushIndex = async () => {
104
- const refs = [...blocks, ...previous ? [previous] : []];
105
- previous = await this.putNode("resource-blocks", {
106
- blocks,
107
- previous
108
- }, refs, { signal });
109
- blocks = [];
110
- };
111
- const flushBlock = async () => {
112
- blocks.push(await this.put(buffer.subarray(0, used), { signal }));
113
- used = 0;
114
- if (blocks.length === 128) await flushIndex();
115
- };
116
- for await (const chunk of source) {
117
- checkCancelled(signal);
118
- if (!(chunk instanceof Uint8Array) || chunk.length > 1048576) throw worldStorageError("WORLD_SOURCE_CHUNK_BUDGET");
119
- digest.update(chunk);
120
- size += chunk.length;
121
- if (!Number.isSafeInteger(size)) throw worldStorageError("WORLD_SIZE_INVALID");
122
- let offset = 0;
123
- while (offset < chunk.length) {
124
- const take = Math.min(chunk.length - offset, buffer.length - used);
125
- buffer.set(chunk.subarray(offset, offset + take), used);
126
- used += take;
127
- offset += take;
128
- if (used === buffer.length) await flushBlock();
129
- }
130
- }
131
- if (used) await flushBlock();
132
- if (blocks.length) await flushIndex();
133
- return this.putNode("resource", {
134
- sha256: digest.digestHex(),
135
- size,
136
- format,
137
- blocks: previous
138
- }, previous ? [previous] : [], { signal });
139
- }
140
- async *resource(ref, options = {}) {
141
- if (ref?.kind !== "resource") throw worldStorageError("WORLD_RESOURCE_INVALID");
142
- const { data, refs } = await this.node(ref, options);
143
- if (JSON.stringify(refs) !== JSON.stringify(data.blocks ? [data.blocks] : [])) throw worldStorageError("WORLD_RESOURCE_INVALID");
144
- checkHash(data.sha256);
145
- if (!Number.isSafeInteger(data.size) || data.size < 0) throw worldStorageError("WORLD_SIZE_INVALID");
146
- const pages = [], seen = /* @__PURE__ */ new Set();
147
- let index = data.blocks;
148
- while (index) {
149
- if (index.kind !== "resource-blocks" || seen.has(index.hash)) throw worldStorageError("WORLD_RESOURCE_INVALID");
150
- seen.add(index.hash);
151
- const node = await this.node(index, options);
152
- if (!Array.isArray(node.data.blocks) || node.data.blocks.length > 128 || JSON.stringify(node.refs) !== JSON.stringify([...node.data.blocks, ...node.data.previous ? [node.data.previous] : []])) throw worldStorageError("WORLD_RESOURCE_INVALID");
153
- pages.push(index);
154
- index = node.data.previous;
155
- }
156
- let size = 0;
157
- const digest = new IncrementalSha256();
158
- for (const page of pages.reverse()) {
159
- const node = await this.node(page, options);
160
- for (const block of node.data.blocks) {
161
- const bytes = await this.read(block, options);
162
- size += bytes.length;
163
- if (size > data.size) throw worldStorageError("WORLD_SIZE_MISMATCH");
164
- digest.update(bytes);
165
- yield bytes;
166
- }
167
- }
168
- if (size !== data.size || digest.digestHex() !== data.sha256) throw worldStorageError("WORLD_RESOURCE_INTEGRITY");
169
- }
170
- };
171
- /** File/Blob input, never file.arrayBuffer() on an entire world. */
172
- async function* blobChunks(blob, { signal } = {}) {
173
- for (let offset = 0; offset < blob.size; offset += WORLD_BLOCK_BYTES) {
174
- checkCancelled(signal);
175
- yield new Uint8Array(await blob.slice(offset, offset + WORLD_BLOCK_BYTES).arrayBuffer());
176
- }
177
- }
178
- //#endregion
179
- //#region ../../application/scene/WorldDocument.js
180
- const WORLD_SCHEMA = "agentscape.world";
181
- /** Only small metadata is in the root. Entity and asset pages are content-addressed chains. */
182
- async function writeWorldDocument(runtime, storage, { name = "Untitled World", signal, includeCamera = true, includeStyle = true, includeEnvironmentState = true } = {}) {
183
- if (runtime.mutationOwner) throw worldStorageError("WORLD_BUSY");
184
- return runtime.exclusiveMutation("world:save", () => writeLocked(runtime, storage, {
185
- name,
186
- signal,
187
- includeCamera,
188
- includeStyle,
189
- includeEnvironmentState
190
- }));
191
- }
192
- async function writeLocked(runtime, storage, { name, signal, includeCamera, includeStyle, includeEnvironmentState }) {
193
- const header = runtime.serializer.serialize(runtime, {
194
- name,
195
- includeRelations: false,
196
- includeObjects: false
197
- });
198
- delete header.objects;
199
- delete header.assets;
200
- if (!includeCamera) delete header.camera;
201
- if (!includeStyle && header.metadata) delete header.metadata.stylePack;
202
- if (!includeEnvironmentState && header.metadata) delete header.metadata.environmentState;
203
- const assets = /* @__PURE__ */ new Set();
204
- async function* entities() {
205
- let ordinal = 0;
206
- for (const entity of runtime.serializer.objects(runtime)) {
207
- assets.add(entity.assetId);
208
- yield {
209
- ...entity,
210
- ordinal: ordinal++
211
- };
212
- }
213
- }
214
- const entitiesRef = await storage.writePages("entities", entities(), { signal });
215
- async function* assetEntries() {
216
- for (const id of assets) {
217
- checkCancelled(signal);
218
- const manifest = runtime.assetModule.getManifest(id);
219
- if (manifest.source.kind === "builtin") {
220
- yield {
221
- id,
222
- builtin: true
223
- };
224
- continue;
225
- }
226
- const bytes = await runtime.assetModule.readAssetBytes(id);
227
- async function* chunks() {
228
- for (let offset = 0; offset < bytes.length; offset += WORLD_BLOCK_BYTES) yield bytes.subarray(offset, offset + WORLD_BLOCK_BYTES);
229
- }
230
- const resource = await storage.putResource(chunks(), {
231
- format: "model/gltf-binary",
232
- signal
233
- });
234
- const definition = structuredClone(manifest);
235
- delete definition.source;
236
- delete definition.compiler;
237
- delete definition.verification;
238
- yield {
239
- id,
240
- resource,
241
- definition
242
- };
243
- }
244
- }
245
- const assetsRef = await storage.writePages("assets", assetEntries(), { signal });
246
- return storage.putNode("world", {
247
- schema: WORLD_SCHEMA,
248
- version: 1,
249
- header,
250
- environment: {
251
- plugin: runtime.environment.id,
252
- version: 1
253
- },
254
- entities: entitiesRef,
255
- assets: assetsRef
256
- }, [entitiesRef, assetsRef].filter(Boolean), { signal });
257
- }
258
- async function inspectWorldDocument(storage, root, { plugins, signal } = {}) {
259
- if (root?.kind !== "world") throw worldStorageError("WORLD_FORMAT_UNSUPPORTED");
260
- const { data, refs } = await storage.node(root, { signal });
261
- if (data.schema !== "agentscape.world" || data.version !== 1) throw worldStorageError("WORLD_VERSION_UNSUPPORTED");
262
- if (JSON.stringify(refs) !== JSON.stringify([data.entities, data.assets].filter(Boolean))) throw worldStorageError("WORLD_DEPENDENCY_INVALID");
263
- if (!data.environment || data.environment.version !== 1 || !plugins?.has(data.environment.plugin)) throw worldStorageError("WORLD_PLUGIN_UNAVAILABLE");
264
- if (data.header?.metadata?.environment !== data.environment.plugin) throw worldStorageError("WORLD_ENVIRONMENT_MISMATCH");
265
- return data;
266
- }
267
- /** Host explicitly registers trusted implementations. Package data never supplies executable source. */
268
- var EnvironmentPlugins = class {
269
- constructor() {
270
- this.entries = /* @__PURE__ */ new Map();
271
- }
272
- register(id, { version = 1, create }) {
273
- if (!id || version !== 1 || typeof create !== "function" || this.entries.has(id)) throw worldStorageError("WORLD_PLUGIN_INVALID");
274
- this.entries.set(id, {
275
- version,
276
- create
277
- });
278
- return this;
279
- }
280
- has(id) {
281
- return this.entries.has(id);
282
- }
283
- async create(descriptor, options) {
284
- const plugin = this.entries.get(descriptor.plugin);
285
- if (!plugin || plugin.version !== descriptor.version) throw worldStorageError("WORLD_PLUGIN_UNAVAILABLE");
286
- return plugin.create(options);
287
- }
288
- };
289
- //#endregion
290
- //#region ../../application/scene/WorldArchive.js
291
- const encoder = new TextEncoder();
292
- const decoder = new TextDecoder("utf-8", { fatal: true });
293
- const MAGIC = encoder.encode("ASWORLD1");
294
- const u32 = (value) => {
295
- const bytes = /* @__PURE__ */ new Uint8Array(4);
296
- new DataView(bytes.buffer).setUint32(0, value);
297
- return bytes;
298
- };
299
- /** Uncompressed framed content blocks. No filenames, links, executable code or decompression. */
300
- async function exportWorldArchive(storage, root, writer, { linked = false, signal } = {}) {
301
- if (!writer?.write) throw new TypeError("A backpressured binary writer is required");
302
- const header = encoder.encode(JSON.stringify({
303
- schema: "agentscape.world-package",
304
- version: 1,
305
- root,
306
- linked
307
- }));
308
- if (header.length > 4096) throw worldStorageError("WORLD_HEADER_BUDGET");
309
- const write = async (bytes) => {
310
- checkCancelled(signal);
311
- await writer.write(bytes);
312
- };
313
- await write(MAGIC);
314
- await write(u32(header.length));
315
- await write(header);
316
- const pending = [root], visited = /* @__PURE__ */ new Set();
317
- while (!linked && pending.length) {
318
- const ref = pending.pop();
319
- if (visited.has(ref.hash)) continue;
320
- visited.add(ref.hash);
321
- const bytes = await storage.read(ref, { signal });
322
- const descriptor = encoder.encode(JSON.stringify(ref));
323
- if (descriptor.length > 4096) throw worldStorageError("WORLD_HEADER_BUDGET");
324
- await write(u32(descriptor.length));
325
- await write(descriptor);
326
- await write(bytes);
327
- if (ref.kind) pending.push(...(await storage.node(ref, { signal })).refs);
328
- }
329
- await write(u32(0));
330
- return {
331
- root,
332
- blocks: visited.size,
333
- linked
334
- };
335
- }
336
- var Reader = class {
337
- constructor(source, signal) {
338
- this.source = source[Symbol.asyncIterator]();
339
- this.signal = signal;
340
- this.chunk = /* @__PURE__ */ new Uint8Array();
341
- this.offset = 0;
342
- }
343
- async take(length) {
344
- if (length > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
345
- const result = new Uint8Array(length);
346
- let written = 0;
347
- while (written < length) {
348
- checkCancelled(this.signal);
349
- if (this.offset === this.chunk.length) {
350
- const item = await this.source.next();
351
- if (item.done) throw worldStorageError("WORLD_TRUNCATED");
352
- if (!(item.value instanceof Uint8Array) || item.value.length > 1048576 || !item.value.length) throw worldStorageError("WORLD_SOURCE_CHUNK_BUDGET");
353
- this.chunk = item.value;
354
- this.offset = 0;
355
- }
356
- const take = Math.min(length - written, this.chunk.length - this.offset);
357
- result.set(this.chunk.subarray(this.offset, this.offset + take), written);
358
- written += take;
359
- this.offset += take;
360
- }
361
- return result;
362
- }
363
- async number() {
364
- return new DataView((await this.take(4)).buffer).getUint32(0);
365
- }
366
- async json(length) {
367
- if (!length || length > 4096) throw worldStorageError("WORLD_HEADER_BUDGET");
368
- try {
369
- return JSON.parse(decoder.decode(await this.take(length)));
370
- } catch (error) {
371
- if (error.code) throw error;
372
- throw worldStorageError("WORLD_HEADER_INVALID");
373
- }
374
- }
375
- async end() {
376
- if (this.offset !== this.chunk.length || !(await this.source.next()).done) throw worldStorageError("WORLD_TRAILING_BYTES");
377
- }
378
- };
379
- /** Writes immutable blocks only. Caller publishes the returned root after semantic validation/commit. */
380
- async function importWorldArchive(storage, source, { signal } = {}) {
381
- const reader = new Reader(source, signal);
382
- try {
383
- if (decoder.decode(await reader.take(8)) !== "ASWORLD1") throw worldStorageError("WORLD_FORMAT_UNSUPPORTED");
384
- const header = await reader.json(await reader.number());
385
- if (header.schema !== "agentscape.world-package" || header.version !== 1 || typeof header.linked !== "boolean") throw worldStorageError("WORLD_VERSION_UNSUPPORTED");
386
- checkHash(header.root?.hash);
387
- const visited = /* @__PURE__ */ new Set();
388
- while (true) {
389
- const length = await reader.number();
390
- if (!length) break;
391
- if (header.linked) throw worldStorageError("WORLD_LINKED_PAYLOAD");
392
- const ref = await reader.json(length);
393
- checkHash(ref?.hash);
394
- if (visited.has(ref.hash)) throw worldStorageError("WORLD_DUPLICATE_BLOCK");
395
- if (!Number.isSafeInteger(ref.bytes) || ref.bytes < 0 || ref.bytes > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
396
- const bytes = await reader.take(ref.bytes);
397
- if (hashBytes(bytes) !== ref.hash) throw worldStorageError("WORLD_INTEGRITY_MISMATCH");
398
- await storage.put(bytes, { signal });
399
- visited.add(ref.hash);
400
- }
401
- await reader.end();
402
- const pending = [header.root], checked = /* @__PURE__ */ new Set();
403
- while (pending.length) {
404
- const ref = pending.pop();
405
- if (checked.has(ref.hash)) continue;
406
- if (!header.linked && !visited.has(ref.hash)) throw worldStorageError("WORLD_DEPENDENCY_MISSING");
407
- checked.add(ref.hash);
408
- await storage.read(ref, { signal });
409
- if (ref.kind) pending.push(...(await storage.node(ref, { signal })).refs);
410
- }
411
- if (!header.linked && checked.size !== visited.size) throw worldStorageError("WORLD_UNREFERENCED_BLOCK");
412
- return header;
413
- } finally {
414
- await reader.source.return?.();
415
- }
416
- }
417
- //#endregion
418
- export { writeWorldDocument as a, blobChunks as c, worldStorageError as d, inspectWorldDocument as i, checkCancelled as l, importWorldArchive as n, WORLD_BLOCK_BYTES as o, EnvironmentPlugins as r, WorldStorage as s, exportWorldArchive as t, checkHash as u };
419
-
420
- //# sourceMappingURL=WorldArchive-pSBIGxLa.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorldArchive-pSBIGxLa.js","names":["encoder","decoder"],"sources":["../../../application/scene/WorldStorage.js","../../../application/scene/WorldDocument.js","../../../application/scene/WorldArchive.js"],"sourcesContent":["import { IncrementalSha256 } from '../../modules/artifact/IncrementalSha256.js';\n\nexport const WORLD_BLOCK_BYTES = 1024 * 1024;\nconst encoder = new TextEncoder(), decoder = new TextDecoder('utf-8', { fatal: true });\nexport const worldStorageError = code => Object.assign(new Error(code), { code });\nexport function checkHash(hash) {\n if (!/^[a-f0-9]{64}$/.test(hash)) throw worldStorageError('WORLD_HASH_INVALID');\n return hash;\n}\nexport const hashBytes = bytes => new IncrementalSha256().update(bytes).digestHex();\nexport function checkCancelled(signal) { if (signal?.aborted) throw worldStorageError('WORLD_CANCELLED'); }\n\n/** Immutable content-addressed blocks. Backend owns durable bytes, never a world/entity cache. */\nexport class WorldStorage {\n constructor(backend) {\n if (!backend?.read || !backend?.write) throw new TypeError('WorldStorage requires a block backend');\n this.backend = backend;\n }\n async put(bytes, { signal } = {}) {\n checkCancelled(signal);\n if (!(bytes instanceof Uint8Array) || bytes.length > WORLD_BLOCK_BYTES) throw worldStorageError('WORLD_BLOCK_BUDGET');\n const hash = hashBytes(bytes);\n await this.backend.write(hash, bytes);\n checkCancelled(signal);\n return { hash, bytes: bytes.length };\n }\n async read(ref, { signal } = {}) {\n checkCancelled(signal); checkHash(ref?.hash);\n if (!Number.isSafeInteger(ref.bytes) || ref.bytes < 0 || ref.bytes > WORLD_BLOCK_BYTES) throw worldStorageError('WORLD_BLOCK_BUDGET');\n const bytes = await this.backend.read(ref.hash, ref.bytes);\n checkCancelled(signal);\n if (!(bytes instanceof Uint8Array) || bytes.length !== ref.bytes || hashBytes(bytes) !== ref.hash) throw worldStorageError('WORLD_INTEGRITY_MISMATCH');\n return bytes;\n }\n async putNode(kind, data, refs = [], options = {}) {\n return { ...await this.put(encoder.encode(JSON.stringify({ kind, data, refs })), options), kind };\n }\n async node(ref, options = {}) {\n let node;\n try { node = JSON.parse(decoder.decode(await this.read(ref, options))); }\n catch (error) { if (error.code) throw error; throw worldStorageError('WORLD_NODE_INVALID'); }\n if (!node || node.kind !== ref.kind || !Array.isArray(node.refs) || node.refs.length > 2048) throw worldStorageError('WORLD_NODE_INVALID');\n for (const link of node.refs) {\n checkHash(link?.hash);\n if (!Number.isSafeInteger(link.bytes) || link.bytes < 0 || link.bytes > WORLD_BLOCK_BYTES) throw worldStorageError('WORLD_BLOCK_BUDGET');\n }\n return node;\n }\n /** Page list is immutable; newest page points to its predecessor. No unbounded root index. */\n async writePages(kind, items, { pageSize = 128, signal } = {}) {\n if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > 1024) throw worldStorageError('WORLD_PAGE_BUDGET');\n let previous = null, count = 0, page = [];\n const flush = async () => {\n const refs = [...page.flatMap(item => item.resource ? [item.resource] : []), ...(previous ? [previous] : [])];\n previous = await this.putNode(kind, { items: page, previous, count }, refs, { signal });\n page = [];\n };\n for await (const item of items) {\n checkCancelled(signal); page.push(item); count++;\n if (page.length === pageSize) await flush();\n }\n if (page.length) await flush();\n return previous;\n }\n async *pages(ref, kind, options = {}) {\n const visited = new Set();\n while (ref) {\n if (ref.kind !== kind || visited.has(ref.hash)) throw worldStorageError('WORLD_PAGE_INVALID');\n visited.add(ref.hash);\n const node = await this.node(ref, options), { items, previous } = node.data || {};\n if (!Array.isArray(items) || items.length > 1024 || JSON.stringify(node.refs) !== JSON.stringify([...items.flatMap(item => item.resource ? [item.resource] : []), ...(previous ? [previous] : [])])) throw worldStorageError('WORLD_PAGE_INVALID');\n yield items; ref = previous;\n }\n }\n /** Consumes bounded chunks with backpressure. Large producer chunks are rejected before copying. */\n async putResource(source, { format = 'application/octet-stream', signal } = {}) {\n const digest = new IncrementalSha256();\n let size = 0, previous = null, blocks = [], buffer = new Uint8Array(WORLD_BLOCK_BYTES), used = 0;\n const flushIndex = async () => {\n const refs = [...blocks, ...(previous ? [previous] : [])];\n previous = await this.putNode('resource-blocks', { blocks, previous }, refs, { signal }); blocks = [];\n };\n const flushBlock = async () => {\n blocks.push(await this.put(buffer.subarray(0, used), { signal })); used = 0;\n if (blocks.length === 128) await flushIndex();\n };\n for await (const chunk of source) {\n checkCancelled(signal);\n if (!(chunk instanceof Uint8Array) || chunk.length > WORLD_BLOCK_BYTES) throw worldStorageError('WORLD_SOURCE_CHUNK_BUDGET');\n digest.update(chunk); size += chunk.length;\n if (!Number.isSafeInteger(size)) throw worldStorageError('WORLD_SIZE_INVALID');\n let offset = 0;\n while (offset < chunk.length) {\n const take = Math.min(chunk.length - offset, buffer.length - used);\n buffer.set(chunk.subarray(offset, offset + take), used); used += take; offset += take;\n if (used === buffer.length) await flushBlock();\n }\n }\n if (used) await flushBlock();\n if (blocks.length) await flushIndex();\n return this.putNode('resource', { sha256: digest.digestHex(), size, format, blocks: previous }, previous ? [previous] : [], { signal });\n }\n async *resource(ref, options = {}) {\n if (ref?.kind !== 'resource') throw worldStorageError('WORLD_RESOURCE_INVALID');\n const { data, refs } = await this.node(ref, options);\n if (JSON.stringify(refs) !== JSON.stringify(data.blocks ? [data.blocks] : [])) throw worldStorageError('WORLD_RESOURCE_INVALID');\n checkHash(data.sha256);\n if (!Number.isSafeInteger(data.size) || data.size < 0) throw worldStorageError('WORLD_SIZE_INVALID');\n // Only small index descriptors are retained, not resource bytes.\n const pages = [], seen = new Set(); let index = data.blocks;\n while (index) {\n if (index.kind !== 'resource-blocks' || seen.has(index.hash)) throw worldStorageError('WORLD_RESOURCE_INVALID');\n seen.add(index.hash);\n const node = await this.node(index, options);\n if (!Array.isArray(node.data.blocks) || node.data.blocks.length > 128 || JSON.stringify(node.refs) !== JSON.stringify([...node.data.blocks, ...(node.data.previous ? [node.data.previous] : [])])) throw worldStorageError('WORLD_RESOURCE_INVALID');\n pages.push(index); index = node.data.previous;\n }\n let size = 0; const digest = new IncrementalSha256();\n for (const page of pages.reverse()) {\n const node = await this.node(page, options);\n for (const block of node.data.blocks) {\n const bytes = await this.read(block, options); size += bytes.length;\n if (size > data.size) throw worldStorageError('WORLD_SIZE_MISMATCH');\n digest.update(bytes); yield bytes;\n }\n }\n if (size !== data.size || digest.digestHex() !== data.sha256) throw worldStorageError('WORLD_RESOURCE_INTEGRITY');\n }\n}\n\n/** File/Blob input, never file.arrayBuffer() on an entire world. */\nexport async function* blobChunks(blob, { signal } = {}) {\n for (let offset = 0; offset < blob.size; offset += WORLD_BLOCK_BYTES) {\n checkCancelled(signal);\n yield new Uint8Array(await blob.slice(offset, offset + WORLD_BLOCK_BYTES).arrayBuffer());\n }\n}\n","import { WORLD_BLOCK_BYTES, checkCancelled, worldStorageError } from './WorldStorage.js';\n\nexport const WORLD_SCHEMA = 'agentscape.world';\nexport const WORLD_VERSION = 1;\n\n/** Only small metadata is in the root. Entity and asset pages are content-addressed chains. */\nexport async function writeWorldDocument(runtime, storage, { name = 'Untitled World', signal, includeCamera = true, includeStyle = true, includeEnvironmentState = true } = {}) {\n if (runtime.mutationOwner) throw worldStorageError('WORLD_BUSY');\n return runtime.exclusiveMutation('world:save', () => writeLocked(runtime, storage, { name, signal, includeCamera, includeStyle, includeEnvironmentState }));\n}\n\nasync function writeLocked(runtime, storage, { name, signal, includeCamera, includeStyle, includeEnvironmentState }) {\n const header = runtime.serializer.serialize(runtime, { name, includeRelations: false, includeObjects: false });\n delete header.objects; delete header.assets;\n if (!includeCamera) delete header.camera;\n if (!includeStyle && header.metadata) delete header.metadata.stylePack;\n if (!includeEnvironmentState && header.metadata) delete header.metadata.environmentState;\n const assets = new Set();\n async function* entities() {\n let ordinal = 0;\n for (const entity of runtime.serializer.objects(runtime)) {\n assets.add(entity.assetId);\n yield { ...entity, ordinal: ordinal++ };\n }\n }\n const entitiesRef = await storage.writePages('entities', entities(), { signal });\n async function* assetEntries() {\n for (const id of assets) {\n checkCancelled(signal);\n const manifest = runtime.assetModule.getManifest(id);\n if (manifest.source.kind === 'builtin') {\n yield { id, builtin: true }; continue;\n }\n // This read is one decode unit, never all world resources. AssetModule must enforce its decode budget.\n const bytes = await runtime.assetModule.readAssetBytes(id);\n async function* chunks() {\n for (let offset = 0; offset < bytes.length; offset += WORLD_BLOCK_BYTES) yield bytes.subarray(offset, offset + WORLD_BLOCK_BYTES);\n }\n const resource = await storage.putResource(chunks(), { format: 'model/gltf-binary', signal });\n const definition = structuredClone(manifest);\n delete definition.source; delete definition.compiler; delete definition.verification;\n yield { id, resource, definition };\n }\n }\n const assetsRef = await storage.writePages('assets', assetEntries(), { signal });\n return storage.putNode('world', { schema: WORLD_SCHEMA, version: WORLD_VERSION, header,\n environment: { plugin: runtime.environment.id, version: 1 }, entities: entitiesRef, assets: assetsRef },\n [entitiesRef, assetsRef].filter(Boolean), { signal });\n}\n\nexport async function inspectWorldDocument(storage, root, { plugins, signal } = {}) {\n if (root?.kind !== 'world') throw worldStorageError('WORLD_FORMAT_UNSUPPORTED');\n const { data, refs } = await storage.node(root, { signal });\n if (data.schema !== WORLD_SCHEMA || data.version !== WORLD_VERSION) throw worldStorageError('WORLD_VERSION_UNSUPPORTED');\n if (JSON.stringify(refs) !== JSON.stringify([data.entities, data.assets].filter(Boolean))) throw worldStorageError('WORLD_DEPENDENCY_INVALID');\n if (!data.environment || data.environment.version !== 1 || !plugins?.has(data.environment.plugin)) throw worldStorageError('WORLD_PLUGIN_UNAVAILABLE');\n if (data.header?.metadata?.environment !== data.environment.plugin) throw worldStorageError('WORLD_ENVIRONMENT_MISMATCH');\n return data;\n}\n\n/** Host explicitly registers trusted implementations. Package data never supplies executable source. */\nexport class EnvironmentPlugins {\n constructor() { this.entries = new Map(); }\n register(id, { version = 1, create }) {\n if (!id || version !== 1 || typeof create !== 'function' || this.entries.has(id)) throw worldStorageError('WORLD_PLUGIN_INVALID');\n this.entries.set(id, { version, create }); return this;\n }\n has(id) { return this.entries.has(id); }\n async create(descriptor, options) {\n const plugin = this.entries.get(descriptor.plugin);\n if (!plugin || plugin.version !== descriptor.version) throw worldStorageError('WORLD_PLUGIN_UNAVAILABLE');\n return plugin.create(options);\n }\n}\n","import { WORLD_BLOCK_BYTES, checkHash, hashBytes, checkCancelled, worldStorageError } from './WorldStorage.js';\n\nconst encoder = new TextEncoder(), decoder = new TextDecoder('utf-8', { fatal: true });\nconst MAGIC = encoder.encode('ASWORLD1');\nconst u32 = value => { const bytes = new Uint8Array(4); new DataView(bytes.buffer).setUint32(0, value); return bytes; };\n\n/** Uncompressed framed content blocks. No filenames, links, executable code or decompression. */\nexport async function exportWorldArchive(storage, root, writer, { linked = false, signal } = {}) {\n if (!writer?.write) throw new TypeError('A backpressured binary writer is required');\n const header = encoder.encode(JSON.stringify({ schema: 'agentscape.world-package', version: 1, root, linked }));\n if (header.length > 4096) throw worldStorageError('WORLD_HEADER_BUDGET');\n const write = async bytes => { checkCancelled(signal); await writer.write(bytes); };\n await write(MAGIC); await write(u32(header.length)); await write(header);\n const pending = [root], visited = new Set();\n while (!linked && pending.length) {\n const ref = pending.pop();\n if (visited.has(ref.hash)) continue;\n visited.add(ref.hash);\n const bytes = await storage.read(ref, { signal });\n const descriptor = encoder.encode(JSON.stringify(ref));\n if (descriptor.length > 4096) throw worldStorageError('WORLD_HEADER_BUDGET');\n await write(u32(descriptor.length)); await write(descriptor); await write(bytes);\n if (ref.kind) pending.push(...(await storage.node(ref, { signal })).refs);\n }\n await write(u32(0));\n return { root, blocks: visited.size, linked };\n}\n\nclass Reader {\n constructor(source, signal) { this.source = source[Symbol.asyncIterator](); this.signal = signal; this.chunk = new Uint8Array(); this.offset = 0; }\n async take(length) {\n if (length > WORLD_BLOCK_BYTES) throw worldStorageError('WORLD_BLOCK_BUDGET');\n const result = new Uint8Array(length); let written = 0;\n while (written < length) {\n checkCancelled(this.signal);\n if (this.offset === this.chunk.length) {\n const item = await this.source.next();\n if (item.done) throw worldStorageError('WORLD_TRUNCATED');\n if (!(item.value instanceof Uint8Array) || item.value.length > WORLD_BLOCK_BYTES || !item.value.length) throw worldStorageError('WORLD_SOURCE_CHUNK_BUDGET');\n this.chunk = item.value; this.offset = 0;\n }\n const take = Math.min(length - written, this.chunk.length - this.offset);\n result.set(this.chunk.subarray(this.offset, this.offset + take), written); written += take; this.offset += take;\n }\n return result;\n }\n async number() { return new DataView((await this.take(4)).buffer).getUint32(0); }\n async json(length) {\n if (!length || length > 4096) throw worldStorageError('WORLD_HEADER_BUDGET');\n try { return JSON.parse(decoder.decode(await this.take(length))); }\n catch (error) { if (error.code) throw error; throw worldStorageError('WORLD_HEADER_INVALID'); }\n }\n async end() { if (this.offset !== this.chunk.length || !(await this.source.next()).done) throw worldStorageError('WORLD_TRAILING_BYTES'); }\n}\n\n/** Writes immutable blocks only. Caller publishes the returned root after semantic validation/commit. */\nexport async function importWorldArchive(storage, source, { signal } = {}) {\n const reader = new Reader(source, signal);\n try {\n if (decoder.decode(await reader.take(8)) !== 'ASWORLD1') throw worldStorageError('WORLD_FORMAT_UNSUPPORTED');\n const header = await reader.json(await reader.number());\n if (header.schema !== 'agentscape.world-package' || header.version !== 1 || typeof header.linked !== 'boolean') throw worldStorageError('WORLD_VERSION_UNSUPPORTED');\n checkHash(header.root?.hash);\n const visited = new Set();\n while (true) {\n const length = await reader.number(); if (!length) break;\n if (header.linked) throw worldStorageError('WORLD_LINKED_PAYLOAD');\n const ref = await reader.json(length); checkHash(ref?.hash);\n if (visited.has(ref.hash)) throw worldStorageError('WORLD_DUPLICATE_BLOCK');\n if (!Number.isSafeInteger(ref.bytes) || ref.bytes < 0 || ref.bytes > WORLD_BLOCK_BYTES) throw worldStorageError('WORLD_BLOCK_BUDGET');\n const bytes = await reader.take(ref.bytes);\n if (hashBytes(bytes) !== ref.hash) throw worldStorageError('WORLD_INTEGRITY_MISMATCH');\n await storage.put(bytes, { signal }); visited.add(ref.hash);\n }\n await reader.end();\n // Validate all declared graph edges, including linked packages, before returning a usable root.\n const pending = [header.root], checked = new Set();\n while (pending.length) {\n const ref = pending.pop(); if (checked.has(ref.hash)) continue;\n if (!header.linked && !visited.has(ref.hash)) throw worldStorageError('WORLD_DEPENDENCY_MISSING');\n checked.add(ref.hash); await storage.read(ref, { signal });\n if (ref.kind) pending.push(...(await storage.node(ref, { signal })).refs);\n }\n if (!header.linked && checked.size !== visited.size) throw worldStorageError('WORLD_UNREFERENCED_BLOCK');\n return header;\n } finally { await reader.source.return?.(); }\n}\n"],"mappings":";;AAEA,MAAa,oBAAoB;AACjC,MAAMA,YAAU,IAAI,YAAY;AAAGC,MAAAA,YAAU,IAAI,YAAY,SAAS,EAAE,OAAO,KAAK,CAAC;AACrF,MAAa,qBAAoB,SAAQ,OAAO,OAAO,IAAI,MAAM,IAAI,GAAG,EAAE,KAAK,CAAC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
1
- import { _ as assetManifests, l as createAssetModule, n as ENVIRONMENTS } from "./environments-DgH66NqV.js";
2
- import { t as SceneSerializer } from "./SceneSerializer-DPVOyeRk.js";
3
- import { a as writeWorldDocument, d as worldStorageError, i as inspectWorldDocument, l as checkCancelled, n as importWorldArchive, r as EnvironmentPlugins, t as exportWorldArchive } from "./WorldArchive-pSBIGxLa.js";
4
- //#region ../../application/scene/WorldIO.js
5
- function builtinEnvironmentPlugins() {
6
- const plugins = new EnvironmentPlugins();
7
- for (const environment of ENVIRONMENTS) plugins.register(environment.id, { create: async (options) => (await environment.load())({
8
- loadAssets: typeof document !== "undefined",
9
- ...options
10
- }) });
11
- return plugins;
12
- }
13
- /** Single data import lifecycle: inspect, prepare isolated resources/state, validate, commit. */
14
- async function prepareWorld(storage, root, { plugins = builtinEnvironmentPlugins(), signal, active = "saved", maxActiveEntities = 256, gltfLoader, onStage = () => {} } = {}) {
15
- onStage("inspect");
16
- const document = await inspectWorldDocument(storage, root, {
17
- plugins,
18
- signal
19
- });
20
- if (![
21
- "saved",
22
- "none",
23
- "bounded"
24
- ].includes(active) || !Number.isSafeInteger(maxActiveEntities) || maxActiveEntities < 0) throw worldStorageError("WORLD_ACTIVATION_BUDGET");
25
- onStage("prepare");
26
- const builtinManifests = Object.fromEntries(Object.entries(assetManifests).filter(([, manifest]) => manifest.source?.kind === "builtin"));
27
- const assets = createAssetModule({
28
- volatile: true,
29
- manifests: builtinManifests,
30
- manifestStore: null,
31
- libraryStore: null,
32
- gltfLoader
33
- });
34
- let environment = null;
35
- try {
36
- const ids = /* @__PURE__ */ new Set(), manifests = [];
37
- for await (const page of storage.pages(document.assets, "assets", { signal })) for (const item of page) {
38
- if (typeof item.id !== "string" || ids.has(item.id)) throw worldStorageError("WORLD_ASSET_ID_CONFLICT");
39
- ids.add(item.id);
40
- if (item.builtin === true) {
41
- if (!assets.hasAsset(item.id) || assets.getManifest(item.id).source.kind !== "builtin") throw worldStorageError("WORLD_ASSET_UNAVAILABLE");
42
- continue;
43
- }
44
- if (assets.hasAsset(item.id) || item.definition?.id !== item.id || item.definition?.source) throw worldStorageError("WORLD_ASSET_ID_CONFLICT");
45
- const resource = await storage.node(item.resource, { signal });
46
- if (resource.data.format !== "model/gltf-binary") throw worldStorageError("WORLD_RESOURCE_FORMAT");
47
- for await (const _chunk of storage.resource(item.resource, { signal })) checkCancelled(signal);
48
- const key = resource.data.sha256;
49
- if (!assets.compiledStore.sources.has(key)) assets.compiledStore.registerSource(key, {
50
- bytes: resource.data.size,
51
- read: () => storage.resource(item.resource)
52
- });
53
- const manifest = {
54
- ...item.definition,
55
- source: {
56
- kind: "compiled",
57
- key
58
- }
59
- };
60
- assets.registry.registerManifest(manifest);
61
- manifests.push(manifest);
62
- }
63
- const objects = [];
64
- let activeCount = 0;
65
- for await (const page of storage.pages(document.entities, "entities", { signal })) for (const object of page) {
66
- if (!ids.has(object.assetId)) throw worldStorageError("WORLD_DEPENDENCY_MISSING");
67
- if (!Number.isSafeInteger(object.ordinal) || object.ordinal < 0) throw worldStorageError("WORLD_ENTITY_ORDINAL");
68
- if (active === "none" || active === "bounded" && activeCount >= maxActiveEntities) object.active = false;
69
- if (object.active !== false && ++activeCount > maxActiveEntities) throw worldStorageError("WORLD_ACTIVATION_BUDGET");
70
- objects.push(object);
71
- }
72
- objects.sort((a, b) => a.ordinal - b.ordinal);
73
- const ordered = objects.map(({ ordinal, ...object }, index) => {
74
- if (ordinal !== index) throw worldStorageError("WORLD_ENTITY_ORDINAL");
75
- return object;
76
- });
77
- onStage("validate");
78
- const snapshot = new SceneSerializer().validate({
79
- ...document.header,
80
- objects: ordered,
81
- assets: manifests
82
- });
83
- checkCancelled(signal);
84
- environment = await plugins.create(document.environment, {});
85
- checkCancelled(signal);
86
- if (environment?.id !== document.environment.plugin) throw worldStorageError("WORLD_PLUGIN_ID_MISMATCH");
87
- let state = "prepared";
88
- return {
89
- summary: {
90
- entities: objects.length,
91
- assets: ids.size,
92
- activeEntities: activeCount,
93
- dormantEntities: objects.length - activeCount,
94
- environment: environment.id
95
- },
96
- async commit(runtime) {
97
- if (state !== "prepared") throw worldStorageError("WORLD_PREPARED_STATE");
98
- checkCancelled(signal);
99
- state = "committing";
100
- onStage("commit");
101
- try {
102
- await runtime.installWorld({
103
- snapshot,
104
- assetModule: assets,
105
- environment
106
- });
107
- state = "committed";
108
- } catch (error) {
109
- state = "failed";
110
- environment.dispose?.();
111
- assets.loader.gltfLoader.dispose?.();
112
- throw error;
113
- }
114
- return {
115
- root,
116
- entities: objects.length
117
- };
118
- },
119
- dispose() {
120
- if (state === "prepared") {
121
- state = "disposed";
122
- environment.dispose?.();
123
- assets.loader.gltfLoader.dispose?.();
124
- }
125
- }
126
- };
127
- } catch (error) {
128
- environment?.dispose?.();
129
- assets.loader.gltfLoader.dispose?.();
130
- throw error;
131
- }
132
- }
133
- async function importWorld(runtime, storage, source, options = {}) {
134
- const { root } = await importWorldArchive(storage, source, options);
135
- const prepared = await prepareWorld(storage, root, options);
136
- try {
137
- return await prepared.commit(runtime);
138
- } finally {
139
- prepared.dispose();
140
- }
141
- }
142
- async function exportWorld(runtime, storage, writer, options = {}) {
143
- const root = await writeWorldDocument(runtime, storage, options);
144
- if (writer) await exportWorldArchive(storage, root, writer, options);
145
- return root;
146
- }
147
- //#endregion
148
- export { exportWorld, importWorld, prepareWorld };
149
-
150
- //# sourceMappingURL=WorldIO-wsDfZGM4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorldIO-wsDfZGM4.js","names":[],"sources":["../../../application/scene/WorldIO.js"],"sourcesContent":["import { createAssetModule } from '../../modules/asset/AssetModule.js';\nimport { assetManifests } from '../../modules/asset/registry/manifests/index.js';\nimport { SceneSerializer } from '../../modules/world/runtime/SceneSerializer.js';\nimport { inspectWorldDocument, writeWorldDocument, EnvironmentPlugins } from './WorldDocument.js';\nimport { importWorldArchive, exportWorldArchive } from './WorldArchive.js';\nimport { checkCancelled, worldStorageError } from './WorldStorage.js';\nimport { ENVIRONMENTS } from '../../modules/world/content/environments.js';\n\nexport function builtinEnvironmentPlugins() {\n const plugins = new EnvironmentPlugins();\n for (const environment of ENVIRONMENTS) plugins.register(environment.id, {\n create: async options => (await environment.load())({ loadAssets: typeof document !== 'undefined', ...options })\n });\n return plugins;\n}\n\n/** Single data import lifecycle: inspect, prepare isolated resources/state, validate, commit. */\nexport async function prepareWorld(storage, root, {\n plugins = builtinEnvironmentPlugins(), signal, active = 'saved', maxActiveEntities = 256, gltfLoader,\n onStage = () => {}\n} = {}) {\n onStage('inspect');\n const document = await inspectWorldDocument(storage, root, { plugins, signal });\n if (!['saved', 'none', 'bounded'].includes(active) || !Number.isSafeInteger(maxActiveEntities) || maxActiveEntities < 0) throw worldStorageError('WORLD_ACTIVATION_BUDGET');\n onStage('prepare');\n const builtinManifests = Object.fromEntries(Object.entries(assetManifests).filter(([, manifest]) => manifest.source?.kind === 'builtin'));\n const assets = createAssetModule({ volatile: true, manifests: builtinManifests, manifestStore: null, libraryStore: null, gltfLoader });\n // A failed pre-commit preparation must release resources that were never installed.\n let environment = null;\n try {\n const ids = new Set(), manifests = [];\n for await (const page of storage.pages(document.assets, 'assets', { signal })) {\n for (const item of page) {\n if (typeof item.id !== 'string' || ids.has(item.id)) throw worldStorageError('WORLD_ASSET_ID_CONFLICT');\n ids.add(item.id);\n if (item.builtin === true) {\n if (!assets.hasAsset(item.id) || assets.getManifest(item.id).source.kind !== 'builtin') throw worldStorageError('WORLD_ASSET_UNAVAILABLE');\n continue;\n }\n if (assets.hasAsset(item.id) || item.definition?.id !== item.id || item.definition?.source) throw worldStorageError('WORLD_ASSET_ID_CONFLICT');\n const resource = await storage.node(item.resource, { signal });\n if (resource.data.format !== 'model/gltf-binary') throw worldStorageError('WORLD_RESOURCE_FORMAT');\n // Fully validate stream before any Runtime mutation, but retain no resource bytes.\n for await (const _chunk of storage.resource(item.resource, { signal })) checkCancelled(signal);\n const key = resource.data.sha256;\n if (!assets.compiledStore.sources.has(key)) assets.compiledStore.registerSource(key, {\n bytes: resource.data.size, read: () => storage.resource(item.resource)\n });\n const manifest = { ...item.definition, source: { kind: 'compiled', key } };\n assets.registry.registerManifest(manifest); manifests.push(manifest);\n }\n }\n const objects = []; let activeCount = 0;\n for await (const page of storage.pages(document.entities, 'entities', { signal })) {\n for (const object of page) {\n if (!ids.has(object.assetId)) throw worldStorageError('WORLD_DEPENDENCY_MISSING');\n if (!Number.isSafeInteger(object.ordinal) || object.ordinal < 0) throw worldStorageError('WORLD_ENTITY_ORDINAL');\n if (active === 'none' || (active === 'bounded' && activeCount >= maxActiveEntities)) object.active = false;\n if (object.active !== false && ++activeCount > maxActiveEntities) throw worldStorageError('WORLD_ACTIVATION_BUDGET');\n objects.push(object);\n }\n }\n objects.sort((a, b) => a.ordinal - b.ordinal);\n const ordered = objects.map(({ ordinal, ...object }, index) => {\n if (ordinal !== index) throw worldStorageError('WORLD_ENTITY_ORDINAL');\n return object;\n });\n onStage('validate');\n const snapshot = new SceneSerializer().validate({ ...document.header, objects: ordered, assets: manifests });\n checkCancelled(signal);\n environment = await plugins.create(document.environment, {});\n checkCancelled(signal);\n if (environment?.id !== document.environment.plugin) throw worldStorageError('WORLD_PLUGIN_ID_MISMATCH');\n let state = 'prepared';\n return {\n summary: { entities: objects.length, assets: ids.size, activeEntities: activeCount, dormantEntities: objects.length - activeCount, environment: environment.id },\n async commit(runtime) {\n if (state !== 'prepared') throw worldStorageError('WORLD_PREPARED_STATE');\n checkCancelled(signal); state = 'committing'; onStage('commit');\n try { await runtime.installWorld({ snapshot, assetModule: assets, environment }); state = 'committed'; }\n catch (error) { state = 'failed'; environment.dispose?.(); assets.loader.gltfLoader.dispose?.(); throw error; }\n return { root, entities: objects.length };\n },\n dispose() { if (state === 'prepared') { state = 'disposed'; environment.dispose?.(); assets.loader.gltfLoader.dispose?.(); } }\n };\n } catch (error) {\n environment?.dispose?.();\n assets.loader.gltfLoader.dispose?.();\n throw error;\n }\n}\n\nexport async function importWorld(runtime, storage, source, options = {}) {\n const { root } = await importWorldArchive(storage, source, options);\n const prepared = await prepareWorld(storage, root, options);\n try { return await prepared.commit(runtime); } finally { prepared.dispose(); }\n}\n\nexport async function exportWorld(runtime, storage, writer, options = {}) {\n const root = await writeWorldDocument(runtime, storage, options);\n if (writer) await exportWorldArchive(storage, root, writer, options);\n return root;\n}\n"],"mappings":";;;;AAQA,SAAgB,4BAA4B;CAC1C,MAAM,UAAU,IAAI,mBAAmB;CACvC,KAAK,MAAM,eAAe,cAAc,QAAQ,SAAS,YAAY,IAAI,EACvE,QAAQ,OAAM,aAAY,MAAM,YAAY,KAAK,EAAA,CAAG;EAAE,YAAY,OAAO,aAAa;EAAa,GAAG;CAAQ,CAAC,EACjH,CAAC;CACD,OAAO;AACT;;AAGA,eAAsB,aAAa,SAAS,MAAM,EAChD,UAAU,0BAA0B,GAAG,QAAQ,SAAS,SAAS,oBAAoB,KAAK,YAC1F,gBAAgB,CAAC,MACf,CAAC,GAAG;CACN,QAAQ,SAAS;CACjB,MAAM,WAAW,MAAM,qBAAqB,SAAS,MAAM;EAAE;EAAS;CAAO,CAAC;CAC9E,IAAI,CAAC;EAAC;EAAS;EAAQ;CAAS,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,OAAO,cAAc,iBAAiB,KAAK,oBAAoB,GAAG,MAAM,kBAAkB,yBAAyB;CAC1K,QAAQ,SAAS;CACjB,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,cAAc,CAAC,CAAC,QAAQ,GAAG,cAAc,SAAS,QAAQ,SAAS,SAAS,CAAC;CACxI,MAAM,SAAS,kBAAkB;EAAE,UAAU;EAAM,WAAW;EAAkB,eAAe;EAAM,cAAc;EAAM;CAAW,CAAC;CAErI,IAAI,cAAc;CAClB,IAAI;EACF,MAAM,sBAAM,IAAI,IAAI,GAAG,YAAY,CAAC;EACpC,WAAW,MAAM,QAAQ,QAAQ,MAAM,SAAS,QAAQ,UAAU,EAAE,OAAO,CAAC,GAC1E,KAAK,MAAM,QAAQ,MA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