agentscape3d-engine 0.0.0-stage → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +19 -2
- package/cli.mjs +53 -0
- package/dist/ArticulationVerifier-BfGxXY8V.js +337 -0
- package/dist/ArticulationVerifier-BfGxXY8V.js.map +1 -0
- package/dist/AssetCompiler-BLj09iu1.js +2424 -0
- package/dist/AssetCompiler-BLj09iu1.js.map +1 -0
- package/dist/AssetModule-DME-XaFS.js +2637 -0
- package/dist/AssetModule-DME-XaFS.js.map +1 -0
- package/dist/AssetRecipe-g8dZBhgJ.js +298 -0
- package/dist/AssetRecipe-g8dZBhgJ.js.map +1 -0
- package/dist/BrowserCodeWorker.js +53856 -0
- package/dist/BrowserCodeWorker.js.map +1 -0
- package/dist/CarryCapability-CXwHU5ay.js +104 -0
- package/dist/CarryCapability-CXwHU5ay.js.map +1 -0
- package/dist/KinematicHypothesisScreen-C3TKiuYR.js +241 -0
- package/dist/KinematicHypothesisScreen-C3TKiuYR.js.map +1 -0
- package/dist/ObjectTransform-BlQUNK7c.js +61 -0
- package/dist/ObjectTransform-BlQUNK7c.js.map +1 -0
- package/dist/RapierPhysicsBackend-B2wQe_Vl.js +3259 -0
- package/dist/RapierPhysicsBackend-B2wQe_Vl.js.map +1 -0
- package/dist/RenderingSystem-WIr1ZuGu.js +1042 -0
- package/dist/RenderingSystem-WIr1ZuGu.js.map +1 -0
- package/dist/ScenePresentation-LsYiDxbm.js +152 -0
- package/dist/ScenePresentation-LsYiDxbm.js.map +1 -0
- package/dist/SceneProject-K7HH1s8o.js +2687 -0
- package/dist/SceneProject-K7HH1s8o.js.map +1 -0
- package/dist/SceneSerializer-zOzbX4jZ.js +932 -0
- package/dist/SceneSerializer-zOzbX4jZ.js.map +1 -0
- package/dist/SimulationProfile-DSYZbBLQ.js +165 -0
- package/dist/SimulationProfile-DSYZbBLQ.js.map +1 -0
- package/dist/StylePack-DcRa_kU0.js +88 -0
- package/dist/StylePack-DcRa_kU0.js.map +1 -0
- package/dist/WorldArchive-BiFGLt--.js +451 -0
- package/dist/WorldArchive-BiFGLt--.js.map +1 -0
- package/dist/WorldCommands-Debj7V4L.js +2207 -0
- package/dist/WorldCommands-Debj7V4L.js.map +1 -0
- package/dist/WorldIO-Ch8QBfKY.js +151 -0
- package/dist/WorldIO-Ch8QBfKY.js.map +1 -0
- package/dist/admission-CVEvsrdz.js +121 -0
- package/dist/admission-CVEvsrdz.js.map +1 -0
- package/dist/blankWorld-B0MW6g7q.js +75 -0
- package/dist/blankWorld-B0MW6g7q.js.map +1 -0
- package/dist/core.d.ts +68 -0
- package/dist/core.js +209 -0
- package/dist/core.js.map +1 -0
- package/dist/disposeObject3D-DIMzy0FA.js +128 -0
- package/dist/disposeObject3D-DIMzy0FA.js.map +1 -0
- package/dist/environments-HOe3sJXH.js +567 -0
- package/dist/environments-HOe3sJXH.js.map +1 -0
- package/dist/gltfIO-BzVKLyaL.js +339 -0
- package/dist/gltfIO-BzVKLyaL.js.map +1 -0
- package/dist/grandUrbanBlock-DRndRZjF.js +515 -0
- package/dist/grandUrbanBlock-DRndRZjF.js.map +1 -0
- package/dist/index.d.ts +345 -0
- package/dist/index.js +16952 -0
- package/dist/index.js.map +1 -0
- package/dist/magicCabin-CfBZjx2Q.js +11019 -0
- package/dist/magicCabin-CfBZjx2Q.js.map +1 -0
- package/dist/manifests-D0LwbJ36.js +866 -0
- package/dist/manifests-D0LwbJ36.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +1 -0
- package/dist/monumentHall-awZiGtda.js +403 -0
- package/dist/monumentHall-awZiGtda.js.map +1 -0
- package/dist/node.d.ts +16 -0
- package/dist/node.js +26 -0
- package/dist/parts-DrEcfJRl.js +37 -0
- package/dist/parts-DrEcfJRl.js.map +1 -0
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/ruinedCourtyard-DuF7NmUU.js +696 -0
- package/dist/ruinedCourtyard-DuF7NmUU.js.map +1 -0
- package/dist/runtime/application/AgentTools.js +28 -0
- package/dist/runtime/application/README.md +14 -0
- package/dist/runtime/application/agent/ProgressiveAgentTools.js +92 -0
- package/dist/runtime/application/agent/StudioMcpAllowlist.js +10 -0
- package/dist/runtime/application/agent/StudioProjectTools.js +18 -0
- package/dist/runtime/application/agent/TaskEvidence.js +199 -0
- package/dist/runtime/application/buildTaskObservation.js +117 -0
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +50 -0
- package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +35 -0
- package/dist/runtime/application/code-execution/BrowserCodeWorker.js +17 -0
- package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +82 -0
- package/dist/runtime/application/createSession.js +66 -0
- package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
- package/dist/runtime/application/generation/GenerationOrchestrator.js +630 -0
- package/dist/runtime/application/generation/GenerationRuntime.js +215 -0
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +289 -0
- package/dist/runtime/application/native-scene/CodeProject.js +215 -0
- package/dist/runtime/application/native-scene/CodeProjectModules.js +143 -0
- package/dist/runtime/application/native-scene/ExampleWorldCatalog.js +35 -0
- package/dist/runtime/application/native-scene/NativeArticulation.js +53 -0
- package/dist/runtime/application/native-scene/NativeEditableRegistry.js +150 -0
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +85 -0
- package/dist/runtime/application/native-scene/NativeLightingInspection.js +33 -0
- package/dist/runtime/application/native-scene/NativeMaterialInspection.js +52 -0
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
- package/dist/runtime/application/native-scene/NativePhysicsGeometry.js +64 -0
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
- package/dist/runtime/application/native-scene/NativeSceneHost.js +406 -0
- package/dist/runtime/application/native-scene/NativeSceneInspection.js +203 -0
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
- package/dist/runtime/application/native-scene/NativeSceneQuery.js +123 -0
- package/dist/runtime/application/native-scene/NativeSceneReview.js +132 -0
- package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
- package/dist/runtime/application/native-scene/SceneObserver.js +97 -0
- package/dist/runtime/application/native-scene/VisualCapturePolicy.js +4 -0
- package/dist/runtime/application/object-forge/SceneObjectForge.js +263 -0
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +59 -0
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +22 -0
- package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +40 -0
- package/dist/runtime/application/scene/CapabilityResolver.js +90 -0
- package/dist/runtime/application/scene/NativeEditableContracts.js +18 -0
- package/dist/runtime/application/scene/RequestWindow.js +54 -0
- package/dist/runtime/application/scene/SceneAgentTools.js +21 -0
- package/dist/runtime/application/scene/SceneContracts.js +49 -0
- package/dist/runtime/application/scene/SceneEditService.js +154 -0
- package/dist/runtime/application/scene/SceneFacade.js +356 -0
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +41 -0
- package/dist/runtime/application/scene/SceneJobController.js +320 -0
- package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
- package/dist/runtime/application/scene/ScenePackage.js +173 -0
- package/dist/runtime/application/scene/ScenePersistence.js +50 -0
- package/dist/runtime/application/scene/SceneProject.js +95 -0
- package/dist/runtime/application/scene/SceneSkillNames.js +5 -0
- package/dist/runtime/application/scene/StarterScene.js +56 -0
- package/dist/runtime/application/scene/WorldArchive.js +89 -0
- package/dist/runtime/application/scene/WorldDirectory.js +20 -0
- package/dist/runtime/application/scene/WorldDocument.js +76 -0
- package/dist/runtime/application/scene/WorldIO.js +103 -0
- package/dist/runtime/application/scene/WorldStorage.js +155 -0
- package/dist/runtime/application/skills/SkillRegistry.js +193 -0
- package/dist/runtime/application/skills/packs/acceptanceSkills.js +32 -0
- package/dist/runtime/application/skills/packs/affordanceSkills.js +36 -0
- package/dist/runtime/application/skills/packs/assetSkills.js +46 -0
- package/dist/runtime/application/skills/packs/authoringSkills.js +16 -0
- package/dist/runtime/application/skills/packs/batchSkills.js +22 -0
- package/dist/runtime/application/skills/packs/codeSkills.js +106 -0
- package/dist/runtime/application/skills/packs/generationSkills.js +45 -0
- package/dist/runtime/application/skills/packs/interactionSkills.js +46 -0
- package/dist/runtime/application/skills/packs/recoverySkills.js +80 -0
- package/dist/runtime/application/skills/packs/sceneSkills.js +24 -0
- package/dist/runtime/application/skills/packs/spatialSkills.js +35 -0
- package/dist/runtime/application/skills/packs/verificationSkills.js +14 -0
- package/dist/runtime/application/skills/packs/worldSkills.js +45 -0
- package/dist/runtime/application/skills/registerCoreSkills.js +31 -0
- package/dist/runtime/application/skills/skillPrimitives.js +4 -0
- package/dist/runtime/application/tasks/CabinetCupTask.js +76 -0
- package/dist/runtime/application/tasks.jsonl +67 -0
- package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +42 -0
- package/dist/runtime/application/world-authoring/AuthoringDiff.js +149 -0
- package/dist/runtime/application/world-authoring/AuthoringDocument.js +825 -0
- package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +109 -0
- package/dist/runtime/application/world-authoring/AuthoringIdentity.js +17 -0
- package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +29 -0
- package/dist/runtime/application/world-authoring/AuthoringPatch.js +118 -0
- package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +334 -0
- package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +126 -0
- package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +144 -0
- package/dist/runtime/application/world-authoring/HeadlessImageExport.js +92 -0
- package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
- package/dist/runtime/application/world-authoring/SceneGLBExport.js +88 -0
- package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
- package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +68 -0
- package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +1 -0
- package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +30 -0
- package/dist/runtime/apps/mcp-server/BuildEnvironment.js +17 -0
- package/dist/runtime/apps/mcp-server/CodeExecutor.js +71 -0
- package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +42 -0
- package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +66 -0
- package/dist/runtime/apps/mcp-server/FileAssetRepository.js +159 -0
- package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +8 -0
- package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +47 -0
- package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +157 -0
- package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +6 -0
- package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +116 -0
- package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +60 -0
- package/dist/runtime/apps/mcp-server/README.md +269 -0
- package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +1 -0
- package/dist/runtime/apps/mcp-server/SandboxBundle.js +13 -0
- package/dist/runtime/apps/mcp-server/SessionManager.js +148 -0
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +75 -0
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +246 -0
- package/dist/runtime/apps/mcp-server/StudioProjectToolContracts.js +58 -0
- package/dist/runtime/apps/mcp-server/TransferHttp.js +47 -0
- package/dist/runtime/apps/mcp-server/TransferLimits.js +6 -0
- package/dist/runtime/apps/mcp-server/TransferStore.js +134 -0
- package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +16 -0
- package/dist/runtime/apps/mcp-server/VALIDATION.md +45 -0
- package/dist/runtime/apps/mcp-server/acceptance-evidence.json +332 -0
- package/dist/runtime/apps/mcp-server/errorDiagnostics.js +32 -0
- package/dist/runtime/apps/mcp-server/examples/code-house.js +24 -0
- package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +85 -0
- package/dist/runtime/apps/mcp-server/main.mjs +82 -0
- package/dist/runtime/apps/mcp-server/registerTools.js +274 -0
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
- package/dist/runtime/apps/mcp-server/security.js +23 -0
- package/dist/runtime/apps/mcp-server/tasks.jsonl +9 -0
- package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +157 -0
- package/dist/runtime/apps/server/README.md +7 -0
- package/dist/runtime/apps/server/WorldRepository.js +338 -0
- package/dist/runtime/apps/server/WorldRepositoryHttp.js +96 -0
- package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +278 -0
- package/dist/runtime/apps/server/tasks.jsonl +10 -0
- package/dist/runtime/apps/shared/node/WorldDiskStorage.js +62 -0
- package/dist/runtime/foundation/EventBus.js +26 -0
- package/dist/runtime/foundation/JsonGateway.js +47 -0
- package/dist/runtime/foundation/PngRgba.js +99 -0
- package/dist/runtime/foundation/PolicyEngine.js +21 -0
- package/dist/runtime/foundation/README.md +7 -0
- package/dist/runtime/foundation/TraceRecorder.js +76 -0
- package/dist/runtime/foundation/errors.js +8 -0
- package/dist/runtime/foundation/simulation/SimulationProfile.js +143 -0
- package/dist/runtime/foundation/version.js +2 -0
- package/dist/runtime/modules/agent/README.md +11 -0
- package/dist/runtime/modules/agent/ToolCallingAgent.js +19 -0
- package/dist/runtime/modules/agent/bootstrapWorld.js +10 -0
- package/dist/runtime/modules/agent/buildRecoveryProposals.js +533 -0
- package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +128 -0
- package/dist/runtime/modules/agent/execution/AgentRunResults.js +55 -0
- package/dist/runtime/modules/agent/execution/AgentRunSession.js +393 -0
- package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +40 -0
- package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +19 -0
- package/dist/runtime/modules/agent/prompt/index.js +52 -0
- package/dist/runtime/modules/agent/tasks.jsonl +94 -0
- package/dist/runtime/modules/artifact/ArtifactContentGate.js +144 -0
- package/dist/runtime/modules/artifact/ArtifactDescriptor.js +280 -0
- package/dist/runtime/modules/artifact/ArtifactImporter.js +185 -0
- package/dist/runtime/modules/artifact/ArtifactModule.js +111 -0
- package/dist/runtime/modules/artifact/ArtifactRegistry.js +197 -0
- package/dist/runtime/modules/artifact/IncrementalSha256.js +129 -0
- package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +115 -0
- package/dist/runtime/modules/artifact/README.md +7 -0
- package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +67 -0
- package/dist/runtime/modules/artifact/tasks.jsonl +31 -0
- package/dist/runtime/modules/asset/AssetModule.js +416 -0
- package/dist/runtime/modules/asset/README.md +67 -0
- package/dist/runtime/modules/asset/loading/AssetLoader.js +157 -0
- package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +61 -0
- package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +95 -0
- package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +33 -0
- package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +103 -0
- package/dist/runtime/modules/asset/model/AssetInputContracts.js +139 -0
- package/dist/runtime/modules/asset/model/AssetRef.js +12 -0
- package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +172 -0
- package/dist/runtime/modules/asset/model/ProceduralTextureContract.js +24 -0
- package/dist/runtime/modules/asset/model/admission.js +117 -0
- package/dist/runtime/modules/asset/model/errors.js +6 -0
- package/dist/runtime/modules/asset/model/parts.js +27 -0
- package/dist/runtime/modules/asset/model/resourceBudget.js +10 -0
- package/dist/runtime/modules/asset/model/schema.js +150 -0
- package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +78 -0
- package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +84 -0
- package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +86 -0
- package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +81 -0
- package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +272 -0
- package/dist/runtime/modules/asset/production/AssetRecipe.js +91 -0
- package/dist/runtime/modules/asset/production/ProceduralTexture.js +85 -0
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +45 -0
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +590 -0
- package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +173 -0
- package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +124 -0
- package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +56 -0
- package/dist/runtime/modules/asset/production/compiler/gltfIO.js +6 -0
- package/dist/runtime/modules/asset/production/compiler/partGeometry.js +74 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +63 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +48 -0
- package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +16 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +30 -0
- package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +75 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +20 -0
- package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +34 -0
- package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +32 -0
- package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +116 -0
- package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +84 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +63 -0
- package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +16 -0
- package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +23 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +50 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +60 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +93 -0
- package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +32 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +55 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +203 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +43 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +33 -0
- package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +60 -0
- package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +23 -0
- package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +198 -0
- package/dist/runtime/modules/asset/registry/AssetCatalog.js +72 -0
- package/dist/runtime/modules/asset/registry/AssetRegistry.js +51 -0
- package/dist/runtime/modules/asset/registry/manifests/index.js +173 -0
- package/dist/runtime/modules/asset/tasks.jsonl +87 -0
- package/dist/runtime/modules/generation/README.md +9 -0
- package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +45 -0
- package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +169 -0
- package/dist/runtime/modules/generation/connector/ConnectorClient.js +192 -0
- package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +167 -0
- package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +179 -0
- package/dist/runtime/modules/generation/connector/ConnectorSession.js +202 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +239 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +99 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +91 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +50 -0
- package/dist/runtime/modules/generation/providers/ProviderRegistry.js +304 -0
- package/dist/runtime/modules/generation/tasks.jsonl +35 -0
- package/dist/runtime/modules/navigation/NavigationBackend.js +17 -0
- package/dist/runtime/modules/navigation/RecastNavigationBackend.js +263 -0
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +660 -0
- package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +414 -0
- package/dist/runtime/modules/rendering/README.md +7 -0
- package/dist/runtime/modules/rendering/RendererProbe.js +153 -0
- package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +140 -0
- package/dist/runtime/modules/rendering/captureStill.js +54 -0
- package/dist/runtime/modules/rendering/createRenderer.js +76 -0
- package/dist/runtime/modules/rendering/disposeObject3D.js +37 -0
- package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +74 -0
- package/dist/runtime/modules/rendering/spatial/ThreeBvhRuntime.js +107 -0
- package/dist/runtime/modules/rendering/style/StylePack.js +34 -0
- package/dist/runtime/modules/rendering/style/StyleSystem.js +173 -0
- package/dist/runtime/modules/rendering/tasks.jsonl +7 -0
- package/dist/runtime/modules/world/README.md +13 -0
- package/dist/runtime/modules/world/build/WorldBuilder.js +170 -0
- package/dist/runtime/modules/world/compiler/PipelineEngine.js +32 -0
- package/dist/runtime/modules/world/compiler/WorldAdmission.js +43 -0
- package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +68 -0
- package/dist/runtime/modules/world/compiler/WorldCompilation.js +157 -0
- package/dist/runtime/modules/world/compiler/WorldComposer.js +201 -0
- package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +76 -0
- package/dist/runtime/modules/world/compiler/WorldRecompiler.js +356 -0
- package/dist/runtime/modules/world/compiler/WorldRetry.js +75 -0
- package/dist/runtime/modules/world/compiler/createWorldPipeline.js +379 -0
- package/dist/runtime/modules/world/content/blankWorld.js +35 -0
- package/dist/runtime/modules/world/content/environments.js +84 -0
- package/dist/runtime/modules/world/content/grandUrbanBlock.js +189 -0
- package/dist/runtime/modules/world/content/magic-cabin/README.md +28 -0
- package/dist/runtime/modules/world/content/magic-cabin/affordances.js +64 -0
- package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +7078 -0
- package/dist/runtime/modules/world/content/magic-cabin/lighting.js +26 -0
- package/dist/runtime/modules/world/content/magic-cabin/materials.js +20 -0
- package/dist/runtime/modules/world/content/magicCabin.js +190 -0
- package/dist/runtime/modules/world/content/monumentHall.js +154 -0
- package/dist/runtime/modules/world/content/ruinedCourtyard.js +196 -0
- package/dist/runtime/modules/world/content/suzhouGarden/README.md +141 -0
- package/dist/runtime/modules/world/content/suzhouGarden/index.js +137 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +491 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +670 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +578 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +127 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +642 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +650 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +280 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +242 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +215 -0
- package/dist/runtime/modules/world/content/woodlandWorkshop.js +192 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/README.md +36 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +351 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +490 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/core.js +505 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/index.js +101 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +435 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +169 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/water.js +245 -0
- package/dist/runtime/modules/world/errors.js +9 -0
- package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +50 -0
- package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +297 -0
- package/dist/runtime/modules/world/runtime/CommandHistory.js +111 -0
- package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +165 -0
- package/dist/runtime/modules/world/runtime/NativeNavigationGeometry.js +84 -0
- package/dist/runtime/modules/world/runtime/NativePhysicsSnapshot.js +245 -0
- package/dist/runtime/modules/world/runtime/ObjectStore.js +31 -0
- package/dist/runtime/modules/world/runtime/ObjectTransform.js +62 -0
- package/dist/runtime/modules/world/runtime/ObservedEntity.js +37 -0
- package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +240 -0
- package/dist/runtime/modules/world/runtime/SceneExtensions.js +36 -0
- package/dist/runtime/modules/world/runtime/ScenePresentation.js +101 -0
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +281 -0
- package/dist/runtime/modules/world/runtime/WorldAuthority.js +41 -0
- package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +14 -0
- package/dist/runtime/modules/world/runtime/WorldCommands.js +503 -0
- package/dist/runtime/modules/world/runtime/WorldObservation.js +71 -0
- package/dist/runtime/modules/world/runtime/WorldQueries.js +340 -0
- package/dist/runtime/modules/world/runtime/WorldRecovery.js +78 -0
- package/dist/runtime/modules/world/runtime/WorldRuntime.js +806 -0
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +110 -0
- package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +130 -0
- package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +79 -0
- package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +195 -0
- package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +70 -0
- package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +115 -0
- package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +390 -0
- package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +214 -0
- package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +65 -0
- package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +244 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +147 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
- package/dist/runtime/modules/world/runtime/interaction/ManipulationActions.js +7 -0
- package/dist/runtime/modules/world/runtime/interaction/NativePhysicalTarget.js +31 -0
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +134 -0
- package/dist/runtime/modules/world/runtime/semantic/NativePhysicsState.js +89 -0
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +129 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +104 -0
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
- package/dist/runtime/modules/world/runtime/simulation/WorldTimeline.js +110 -0
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
- package/dist/runtime/modules/world/runtime/spatial/VisualMeshBounds.js +41 -0
- package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +306 -0
- package/dist/runtime/modules/world/runtime/systems/Instrument.js +39 -0
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +806 -0
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +281 -0
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +561 -0
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1752 -0
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +527 -0
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +402 -0
- package/dist/runtime/modules/world/spec/WorldIR.js +165 -0
- package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +86 -0
- package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +51 -0
- package/dist/runtime/modules/world/spec/WorldRevision.js +231 -0
- package/dist/runtime/modules/world/spec/WorldSpec.js +86 -0
- package/dist/runtime/modules/world/tasks.jsonl +530 -0
- package/dist/runtime/modules/world/verification/ArticulationVerifier.js +254 -0
- package/dist/runtime/modules/world/verification/Finding.js +105 -0
- package/dist/runtime/modules/world/verification/InteractionEvidence.js +73 -0
- package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
- package/dist/runtime/modules/world/verification/VisualLayoutAcceptance.js +58 -0
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +176 -0
- package/dist/runtime/modules/world/verification/WorldValidator.js +67 -0
- package/dist/runtime/package-lock.json +16071 -0
- package/dist/runtime/package.json +106 -0
- package/dist/runtime/public/assets/cabinet.glb +0 -0
- package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
- package/dist/schema-DT7K9NjP.js +165 -0
- package/dist/schema-DT7K9NjP.js.map +1 -0
- package/dist/suzhouGarden-Y3hny8j6.js +6150 -0
- package/dist/suzhouGarden-Y3hny8j6.js.map +1 -0
- package/dist/version-CHc-i8ch.js +5 -0
- package/dist/version-CHc-i8ch.js.map +1 -0
- package/dist/woodlandWorkshop-DsScU-cx.js +483 -0
- package/dist/woodlandWorkshop-DsScU-cx.js.map +1 -0
- package/dist/yuanmingyuan-DsFnPzzR.js +4955 -0
- package/dist/yuanmingyuan-DsFnPzzR.js.map +1 -0
- package/package.json +75 -4
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { i as IncrementalSha256 } from "./environments-HOe3sJXH.js";
|
|
2
|
+
// 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
|
+
function hashBytes(bytes, createDigest = () => new IncrementalSha256()) {
|
|
12
|
+
const digest = createDigest();
|
|
13
|
+
digest.update(bytes);
|
|
14
|
+
return digest.digestHex();
|
|
15
|
+
}
|
|
16
|
+
function checkCancelled(signal) {
|
|
17
|
+
if (signal?.aborted) throw worldStorageError("WORLD_CANCELLED");
|
|
18
|
+
}
|
|
19
|
+
/** Immutable content-addressed blocks. Backend owns durable bytes, never a world/entity cache. */
|
|
20
|
+
var WorldStorage = class {
|
|
21
|
+
constructor(backend) {
|
|
22
|
+
if (!backend?.read || !backend?.write) throw new TypeError("WorldStorage requires a block backend");
|
|
23
|
+
this.backend = backend;
|
|
24
|
+
this.createDigest = () => backend.createDigest?.() ?? new IncrementalSha256();
|
|
25
|
+
}
|
|
26
|
+
hashBytes(bytes) {
|
|
27
|
+
return hashBytes(bytes, this.createDigest);
|
|
28
|
+
}
|
|
29
|
+
async put(bytes, { signal, expectedHash } = {}) {
|
|
30
|
+
checkCancelled(signal);
|
|
31
|
+
if (!(bytes instanceof Uint8Array) || bytes.length > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
|
|
32
|
+
const hash = this.hashBytes(bytes);
|
|
33
|
+
if (expectedHash !== void 0 && hash !== checkHash(expectedHash)) throw worldStorageError("WORLD_INTEGRITY_MISMATCH");
|
|
34
|
+
await this.backend.write(hash, bytes);
|
|
35
|
+
checkCancelled(signal);
|
|
36
|
+
return {
|
|
37
|
+
hash,
|
|
38
|
+
bytes: bytes.length
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async read(ref, { signal } = {}) {
|
|
42
|
+
checkCancelled(signal);
|
|
43
|
+
checkHash(ref?.hash);
|
|
44
|
+
if (!Number.isSafeInteger(ref.bytes) || ref.bytes < 0 || ref.bytes > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
|
|
45
|
+
const bytes = await this.backend.read(ref.hash, ref.bytes);
|
|
46
|
+
checkCancelled(signal);
|
|
47
|
+
if (!(bytes instanceof Uint8Array) || bytes.length !== ref.bytes || this.hashBytes(bytes) !== ref.hash) throw worldStorageError("WORLD_INTEGRITY_MISMATCH");
|
|
48
|
+
return bytes;
|
|
49
|
+
}
|
|
50
|
+
async putNode(kind, data, refs = [], options = {}) {
|
|
51
|
+
return {
|
|
52
|
+
...await this.put(encoder$1.encode(JSON.stringify({
|
|
53
|
+
kind,
|
|
54
|
+
data,
|
|
55
|
+
refs
|
|
56
|
+
})), options),
|
|
57
|
+
kind
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async node(ref, options = {}) {
|
|
61
|
+
return (await this.readNode(ref, options)).node;
|
|
62
|
+
}
|
|
63
|
+
/** Return verified bytes and their validated node in one backend read. */
|
|
64
|
+
async readNode(ref, options = {}) {
|
|
65
|
+
let bytes, node;
|
|
66
|
+
try {
|
|
67
|
+
bytes = await this.read(ref, options);
|
|
68
|
+
node = JSON.parse(decoder$1.decode(bytes));
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (error.code) throw error;
|
|
71
|
+
throw worldStorageError("WORLD_NODE_INVALID");
|
|
72
|
+
}
|
|
73
|
+
if (!node || node.kind !== ref.kind || !Array.isArray(node.refs) || node.refs.length > 2048) throw worldStorageError("WORLD_NODE_INVALID");
|
|
74
|
+
for (const link of node.refs) {
|
|
75
|
+
checkHash(link?.hash);
|
|
76
|
+
if (!Number.isSafeInteger(link.bytes) || link.bytes < 0 || link.bytes > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
bytes,
|
|
80
|
+
node
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** Page list is immutable; newest page points to its predecessor. No unbounded root index. */
|
|
84
|
+
async writePages(kind, items, { pageSize = 128, signal } = {}) {
|
|
85
|
+
if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > 1024) throw worldStorageError("WORLD_PAGE_BUDGET");
|
|
86
|
+
let previous = null, count = 0, page = [];
|
|
87
|
+
const flush = async () => {
|
|
88
|
+
const refs = [...page.flatMap((item) => item.resource ? [item.resource] : []), ...previous ? [previous] : []];
|
|
89
|
+
previous = await this.putNode(kind, {
|
|
90
|
+
items: page,
|
|
91
|
+
previous,
|
|
92
|
+
count
|
|
93
|
+
}, refs, { signal });
|
|
94
|
+
page = [];
|
|
95
|
+
};
|
|
96
|
+
for await (const item of items) {
|
|
97
|
+
checkCancelled(signal);
|
|
98
|
+
page.push(item);
|
|
99
|
+
count++;
|
|
100
|
+
if (page.length === pageSize) await flush();
|
|
101
|
+
}
|
|
102
|
+
if (page.length) await flush();
|
|
103
|
+
return previous;
|
|
104
|
+
}
|
|
105
|
+
async *pages(ref, kind, options = {}) {
|
|
106
|
+
const visited = /* @__PURE__ */ new Set();
|
|
107
|
+
while (ref) {
|
|
108
|
+
if (ref.kind !== kind || visited.has(ref.hash)) throw worldStorageError("WORLD_PAGE_INVALID");
|
|
109
|
+
visited.add(ref.hash);
|
|
110
|
+
const node = await this.node(ref, options), { items, previous } = node.data || {};
|
|
111
|
+
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");
|
|
112
|
+
yield items;
|
|
113
|
+
ref = previous;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Consumes bounded chunks with backpressure. Large producer chunks are rejected before copying. */
|
|
117
|
+
async putResource(source, { format = "application/octet-stream", signal } = {}) {
|
|
118
|
+
const digest = this.createDigest();
|
|
119
|
+
let size = 0, previous = null, blocks = [], buffer = new Uint8Array(WORLD_BLOCK_BYTES), used = 0;
|
|
120
|
+
const flushIndex = async () => {
|
|
121
|
+
const refs = [...blocks, ...previous ? [previous] : []];
|
|
122
|
+
previous = await this.putNode("resource-blocks", {
|
|
123
|
+
blocks,
|
|
124
|
+
previous
|
|
125
|
+
}, refs, { signal });
|
|
126
|
+
blocks = [];
|
|
127
|
+
};
|
|
128
|
+
const flushBlock = async () => {
|
|
129
|
+
blocks.push(await this.put(buffer.subarray(0, used), { signal }));
|
|
130
|
+
used = 0;
|
|
131
|
+
if (blocks.length === 128) await flushIndex();
|
|
132
|
+
};
|
|
133
|
+
for await (const chunk of source) {
|
|
134
|
+
checkCancelled(signal);
|
|
135
|
+
if (!(chunk instanceof Uint8Array) || chunk.length > 1048576) throw worldStorageError("WORLD_SOURCE_CHUNK_BUDGET");
|
|
136
|
+
digest.update(chunk);
|
|
137
|
+
size += chunk.length;
|
|
138
|
+
if (!Number.isSafeInteger(size)) throw worldStorageError("WORLD_SIZE_INVALID");
|
|
139
|
+
let offset = 0;
|
|
140
|
+
while (offset < chunk.length) {
|
|
141
|
+
const take = Math.min(chunk.length - offset, buffer.length - used);
|
|
142
|
+
buffer.set(chunk.subarray(offset, offset + take), used);
|
|
143
|
+
used += take;
|
|
144
|
+
offset += take;
|
|
145
|
+
if (used === buffer.length) await flushBlock();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (used) await flushBlock();
|
|
149
|
+
if (blocks.length) await flushIndex();
|
|
150
|
+
return this.putNode("resource", {
|
|
151
|
+
sha256: digest.digestHex(),
|
|
152
|
+
size,
|
|
153
|
+
format,
|
|
154
|
+
blocks: previous
|
|
155
|
+
}, previous ? [previous] : [], { signal });
|
|
156
|
+
}
|
|
157
|
+
async describeResource(ref, options = {}) {
|
|
158
|
+
if (ref?.kind !== "resource") throw worldStorageError("WORLD_RESOURCE_INVALID");
|
|
159
|
+
const { data } = await this.node(ref, options);
|
|
160
|
+
checkHash(data.sha256);
|
|
161
|
+
if (!Number.isSafeInteger(data.size) || data.size < 0 || typeof data.format !== "string" || !data.format) throw worldStorageError("WORLD_RESOURCE_INVALID");
|
|
162
|
+
return {
|
|
163
|
+
sha256: data.sha256,
|
|
164
|
+
byteLength: data.size,
|
|
165
|
+
mediaType: data.format
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
async *resource(ref, options = {}) {
|
|
169
|
+
if (ref?.kind !== "resource") throw worldStorageError("WORLD_RESOURCE_INVALID");
|
|
170
|
+
const { data, refs } = await this.node(ref, options);
|
|
171
|
+
if (JSON.stringify(refs) !== JSON.stringify(data.blocks ? [data.blocks] : [])) throw worldStorageError("WORLD_RESOURCE_INVALID");
|
|
172
|
+
checkHash(data.sha256);
|
|
173
|
+
if (!Number.isSafeInteger(data.size) || data.size < 0) throw worldStorageError("WORLD_SIZE_INVALID");
|
|
174
|
+
const pages = [], seen = /* @__PURE__ */ new Set();
|
|
175
|
+
let index = data.blocks;
|
|
176
|
+
while (index) {
|
|
177
|
+
if (index.kind !== "resource-blocks" || seen.has(index.hash)) throw worldStorageError("WORLD_RESOURCE_INVALID");
|
|
178
|
+
seen.add(index.hash);
|
|
179
|
+
const node = await this.node(index, options);
|
|
180
|
+
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");
|
|
181
|
+
pages.push(index);
|
|
182
|
+
index = node.data.previous;
|
|
183
|
+
}
|
|
184
|
+
let size = 0;
|
|
185
|
+
const digest = this.createDigest();
|
|
186
|
+
for (const page of pages.reverse()) {
|
|
187
|
+
const node = await this.node(page, options);
|
|
188
|
+
for (const block of node.data.blocks) {
|
|
189
|
+
const bytes = await this.read(block, options);
|
|
190
|
+
size += bytes.length;
|
|
191
|
+
if (size > data.size) throw worldStorageError("WORLD_SIZE_MISMATCH");
|
|
192
|
+
digest.update(bytes);
|
|
193
|
+
yield bytes;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (size !== data.size || digest.digestHex() !== data.sha256) throw worldStorageError("WORLD_RESOURCE_INTEGRITY");
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
/** File/Blob input, never file.arrayBuffer() on an entire world. */
|
|
200
|
+
async function* blobChunks(blob, { signal } = {}) {
|
|
201
|
+
for (let offset = 0; offset < blob.size; offset += WORLD_BLOCK_BYTES) {
|
|
202
|
+
checkCancelled(signal);
|
|
203
|
+
yield new Uint8Array(await blob.slice(offset, offset + WORLD_BLOCK_BYTES).arrayBuffer());
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// application/scene/WorldDocument.js
|
|
207
|
+
const WORLD_SCHEMA = "agentscape.world";
|
|
208
|
+
/** Only small metadata is in the root. Entity and asset pages are content-addressed chains. */
|
|
209
|
+
async function writeWorldDocument(runtime, storage, { name = "Untitled World", signal, includeCamera = true, includeStyle = true, includeEnvironmentState = true } = {}) {
|
|
210
|
+
if (runtime.mutationOwner) throw worldStorageError("WORLD_BUSY");
|
|
211
|
+
return runtime.exclusiveMutation("world:save", () => writeLocked(runtime, storage, {
|
|
212
|
+
name,
|
|
213
|
+
signal,
|
|
214
|
+
includeCamera,
|
|
215
|
+
includeStyle,
|
|
216
|
+
includeEnvironmentState
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
async function writeLocked(runtime, storage, { name, signal, includeCamera, includeStyle, includeEnvironmentState }) {
|
|
220
|
+
const header = structuredClone(runtime.serializer.serialize(runtime, {
|
|
221
|
+
name,
|
|
222
|
+
includeRelations: false,
|
|
223
|
+
includeObjects: false
|
|
224
|
+
}));
|
|
225
|
+
delete header.objects;
|
|
226
|
+
delete header.assets;
|
|
227
|
+
if (!includeCamera) delete header.camera;
|
|
228
|
+
if (!includeStyle && header.metadata) delete header.metadata.stylePack;
|
|
229
|
+
if (!includeEnvironmentState && header.metadata) delete header.metadata.environmentState;
|
|
230
|
+
const capturedEntities = Array.from(runtime.serializer.objects(runtime), (entity) => structuredClone(entity));
|
|
231
|
+
const assets = /* @__PURE__ */ new Set();
|
|
232
|
+
async function* entities() {
|
|
233
|
+
let ordinal = 0;
|
|
234
|
+
for (const entity of capturedEntities) {
|
|
235
|
+
assets.add(entity.assetId);
|
|
236
|
+
yield {
|
|
237
|
+
...entity,
|
|
238
|
+
ordinal: ordinal++
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const entitiesRef = await storage.writePages("entities", entities(), { signal });
|
|
243
|
+
async function* assetEntries() {
|
|
244
|
+
for (const id of assets) {
|
|
245
|
+
checkCancelled(signal);
|
|
246
|
+
const manifest = runtime.assetModule.getManifest(id);
|
|
247
|
+
if (manifest.source.kind === "builtin") {
|
|
248
|
+
yield {
|
|
249
|
+
id,
|
|
250
|
+
builtin: true
|
|
251
|
+
};
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
const bytes = await runtime.assetModule.readAssetBytes(id);
|
|
255
|
+
async function* chunks() {
|
|
256
|
+
for (let offset = 0; offset < bytes.length; offset += WORLD_BLOCK_BYTES) yield bytes.subarray(offset, offset + WORLD_BLOCK_BYTES);
|
|
257
|
+
}
|
|
258
|
+
const resource = await storage.putResource(chunks(), {
|
|
259
|
+
format: "model/gltf-binary",
|
|
260
|
+
signal
|
|
261
|
+
});
|
|
262
|
+
const definition = structuredClone(manifest);
|
|
263
|
+
delete definition.source;
|
|
264
|
+
delete definition.compiler;
|
|
265
|
+
delete definition.verification;
|
|
266
|
+
yield {
|
|
267
|
+
id,
|
|
268
|
+
resource,
|
|
269
|
+
definition
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const assetsRef = await storage.writePages("assets", assetEntries(), { signal });
|
|
274
|
+
return storage.putNode("world", {
|
|
275
|
+
schema: WORLD_SCHEMA,
|
|
276
|
+
version: 1,
|
|
277
|
+
header,
|
|
278
|
+
environment: {
|
|
279
|
+
plugin: runtime.environment.id,
|
|
280
|
+
version: 1
|
|
281
|
+
},
|
|
282
|
+
entities: entitiesRef,
|
|
283
|
+
assets: assetsRef
|
|
284
|
+
}, [entitiesRef, assetsRef].filter(Boolean), { signal });
|
|
285
|
+
}
|
|
286
|
+
async function inspectWorldDocument(storage, root, { plugins, signal } = {}) {
|
|
287
|
+
if (root?.kind !== "world") throw worldStorageError("WORLD_FORMAT_UNSUPPORTED");
|
|
288
|
+
const { data, refs } = await storage.node(root, { signal });
|
|
289
|
+
if (data.schema !== "agentscape.world" || data.version !== 1) throw worldStorageError("WORLD_VERSION_UNSUPPORTED");
|
|
290
|
+
if (JSON.stringify(refs) !== JSON.stringify([data.entities, data.assets].filter(Boolean))) throw worldStorageError("WORLD_DEPENDENCY_INVALID");
|
|
291
|
+
if (!data.environment || data.environment.version !== 1 || !plugins?.has(data.environment.plugin)) throw worldStorageError("WORLD_PLUGIN_UNAVAILABLE");
|
|
292
|
+
if (data.header?.metadata?.environment !== data.environment.plugin) throw worldStorageError("WORLD_ENVIRONMENT_MISMATCH");
|
|
293
|
+
return data;
|
|
294
|
+
}
|
|
295
|
+
/** Host explicitly registers trusted implementations. Package data never supplies executable source. */
|
|
296
|
+
var EnvironmentPlugins = class {
|
|
297
|
+
constructor() {
|
|
298
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
299
|
+
}
|
|
300
|
+
register(id, { version = 1, create }) {
|
|
301
|
+
if (!id || version !== 1 || typeof create !== "function" || this.entries.has(id)) throw worldStorageError("WORLD_PLUGIN_INVALID");
|
|
302
|
+
this.entries.set(id, {
|
|
303
|
+
version,
|
|
304
|
+
create
|
|
305
|
+
});
|
|
306
|
+
return this;
|
|
307
|
+
}
|
|
308
|
+
has(id) {
|
|
309
|
+
return this.entries.has(id);
|
|
310
|
+
}
|
|
311
|
+
async create(descriptor, options) {
|
|
312
|
+
const plugin = this.entries.get(descriptor.plugin);
|
|
313
|
+
if (!plugin || plugin.version !== descriptor.version) throw worldStorageError("WORLD_PLUGIN_UNAVAILABLE");
|
|
314
|
+
return plugin.create(options);
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
// application/scene/WorldArchive.js
|
|
318
|
+
const encoder = new TextEncoder();
|
|
319
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
320
|
+
const MAGIC = encoder.encode("ASWORLD1");
|
|
321
|
+
const u32 = (value) => {
|
|
322
|
+
const bytes = /* @__PURE__ */ new Uint8Array(4);
|
|
323
|
+
new DataView(bytes.buffer).setUint32(0, value);
|
|
324
|
+
return bytes;
|
|
325
|
+
};
|
|
326
|
+
/** Uncompressed framed content blocks. No filenames, links, executable code or decompression. */
|
|
327
|
+
async function exportWorldArchive(storage, root, writer, { linked = false, signal } = {}) {
|
|
328
|
+
if (!writer?.write) throw new TypeError("A backpressured binary writer is required");
|
|
329
|
+
const header = encoder.encode(JSON.stringify({
|
|
330
|
+
schema: "agentscape.world-package",
|
|
331
|
+
version: 1,
|
|
332
|
+
root,
|
|
333
|
+
linked
|
|
334
|
+
}));
|
|
335
|
+
if (header.length > 4096) throw worldStorageError("WORLD_HEADER_BUDGET");
|
|
336
|
+
const write = async (bytes) => {
|
|
337
|
+
checkCancelled(signal);
|
|
338
|
+
await writer.write(bytes);
|
|
339
|
+
};
|
|
340
|
+
await write(MAGIC);
|
|
341
|
+
await write(u32(header.length));
|
|
342
|
+
await write(header);
|
|
343
|
+
const pending = [root], visited = /* @__PURE__ */ new Set();
|
|
344
|
+
while (!linked && pending.length) {
|
|
345
|
+
const ref = pending.pop();
|
|
346
|
+
if (visited.has(ref.hash)) continue;
|
|
347
|
+
visited.add(ref.hash);
|
|
348
|
+
const { bytes, node } = ref.kind ? await storage.readNode(ref, { signal }) : {
|
|
349
|
+
bytes: await storage.read(ref, { signal }),
|
|
350
|
+
node: null
|
|
351
|
+
};
|
|
352
|
+
const descriptor = encoder.encode(JSON.stringify(ref));
|
|
353
|
+
if (descriptor.length > 4096) throw worldStorageError("WORLD_HEADER_BUDGET");
|
|
354
|
+
await write(u32(descriptor.length));
|
|
355
|
+
await write(descriptor);
|
|
356
|
+
await write(bytes);
|
|
357
|
+
if (node) pending.push(...node.refs);
|
|
358
|
+
}
|
|
359
|
+
await write(u32(0));
|
|
360
|
+
return {
|
|
361
|
+
root,
|
|
362
|
+
blocks: visited.size,
|
|
363
|
+
linked
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
var Reader = class {
|
|
367
|
+
constructor(source, signal) {
|
|
368
|
+
this.source = source[Symbol.asyncIterator]();
|
|
369
|
+
this.signal = signal;
|
|
370
|
+
this.chunk = /* @__PURE__ */ new Uint8Array();
|
|
371
|
+
this.offset = 0;
|
|
372
|
+
}
|
|
373
|
+
async take(length) {
|
|
374
|
+
if (length > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
|
|
375
|
+
const result = new Uint8Array(length);
|
|
376
|
+
let written = 0;
|
|
377
|
+
while (written < length) {
|
|
378
|
+
checkCancelled(this.signal);
|
|
379
|
+
if (this.offset === this.chunk.length) {
|
|
380
|
+
const item = await this.source.next();
|
|
381
|
+
if (item.done) throw worldStorageError("WORLD_TRUNCATED");
|
|
382
|
+
if (!(item.value instanceof Uint8Array) || item.value.length > 1048576 || !item.value.length) throw worldStorageError("WORLD_SOURCE_CHUNK_BUDGET");
|
|
383
|
+
this.chunk = item.value;
|
|
384
|
+
this.offset = 0;
|
|
385
|
+
}
|
|
386
|
+
const take = Math.min(length - written, this.chunk.length - this.offset);
|
|
387
|
+
result.set(this.chunk.subarray(this.offset, this.offset + take), written);
|
|
388
|
+
written += take;
|
|
389
|
+
this.offset += take;
|
|
390
|
+
}
|
|
391
|
+
return result;
|
|
392
|
+
}
|
|
393
|
+
async number() {
|
|
394
|
+
return new DataView((await this.take(4)).buffer).getUint32(0);
|
|
395
|
+
}
|
|
396
|
+
async json(length) {
|
|
397
|
+
if (!length || length > 4096) throw worldStorageError("WORLD_HEADER_BUDGET");
|
|
398
|
+
try {
|
|
399
|
+
return JSON.parse(decoder.decode(await this.take(length)));
|
|
400
|
+
} catch (error) {
|
|
401
|
+
if (error.code) throw error;
|
|
402
|
+
throw worldStorageError("WORLD_HEADER_INVALID");
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
async end() {
|
|
406
|
+
if (this.offset !== this.chunk.length || !(await this.source.next()).done) throw worldStorageError("WORLD_TRAILING_BYTES");
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
/** Writes immutable blocks only. Caller publishes the returned root after semantic validation/commit. */
|
|
410
|
+
async function importWorldArchive(storage, source, { signal } = {}) {
|
|
411
|
+
const reader = new Reader(source, signal);
|
|
412
|
+
try {
|
|
413
|
+
if (decoder.decode(await reader.take(8)) !== "ASWORLD1") throw worldStorageError("WORLD_FORMAT_UNSUPPORTED");
|
|
414
|
+
const header = await reader.json(await reader.number());
|
|
415
|
+
if (header.schema !== "agentscape.world-package" || header.version !== 1 || typeof header.linked !== "boolean") throw worldStorageError("WORLD_VERSION_UNSUPPORTED");
|
|
416
|
+
checkHash(header.root?.hash);
|
|
417
|
+
const visited = /* @__PURE__ */ new Set();
|
|
418
|
+
while (true) {
|
|
419
|
+
const length = await reader.number();
|
|
420
|
+
if (!length) break;
|
|
421
|
+
if (header.linked) throw worldStorageError("WORLD_LINKED_PAYLOAD");
|
|
422
|
+
const ref = await reader.json(length);
|
|
423
|
+
checkHash(ref?.hash);
|
|
424
|
+
if (visited.has(ref.hash)) throw worldStorageError("WORLD_DUPLICATE_BLOCK");
|
|
425
|
+
if (!Number.isSafeInteger(ref.bytes) || ref.bytes < 0 || ref.bytes > 1048576) throw worldStorageError("WORLD_BLOCK_BUDGET");
|
|
426
|
+
const bytes = await reader.take(ref.bytes);
|
|
427
|
+
await storage.put(bytes, {
|
|
428
|
+
signal,
|
|
429
|
+
expectedHash: ref.hash
|
|
430
|
+
});
|
|
431
|
+
visited.add(ref.hash);
|
|
432
|
+
}
|
|
433
|
+
await reader.end();
|
|
434
|
+
const pending = [header.root], checked = /* @__PURE__ */ new Set();
|
|
435
|
+
while (pending.length) {
|
|
436
|
+
const ref = pending.pop();
|
|
437
|
+
if (checked.has(ref.hash)) continue;
|
|
438
|
+
if (!header.linked && !visited.has(ref.hash)) throw worldStorageError("WORLD_DEPENDENCY_MISSING");
|
|
439
|
+
checked.add(ref.hash);
|
|
440
|
+
if (ref.kind) pending.push(...(await storage.node(ref, { signal })).refs);
|
|
441
|
+
else await storage.read(ref, { signal });
|
|
442
|
+
}
|
|
443
|
+
if (!header.linked && checked.size !== visited.size) throw worldStorageError("WORLD_UNREFERENCED_BLOCK");
|
|
444
|
+
return header;
|
|
445
|
+
} finally {
|
|
446
|
+
await reader.source.return?.();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
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 };
|
|
450
|
+
|
|
451
|
+
//# sourceMappingURL=WorldArchive-BiFGLt--.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorldArchive-BiFGLt--.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 function hashBytes(bytes, createDigest = () => new IncrementalSha256()) {\n const digest = createDigest();\n digest.update(bytes);\n return digest.digestHex();\n}\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 // Node backends can supply native incremental SHA-256 without pulling\n // node:crypto into the browser or changing the content-address format.\n this.createDigest = () => backend.createDigest?.() ?? new IncrementalSha256();\n }\n hashBytes(bytes) { return hashBytes(bytes, this.createDigest); }\n async put(bytes, { signal, expectedHash } = {}) {\n checkCancelled(signal);\n if (!(bytes instanceof Uint8Array) || bytes.length > WORLD_BLOCK_BYTES) throw worldStorageError('WORLD_BLOCK_BUDGET');\n const hash = this.hashBytes(bytes);\n if (expectedHash !== undefined && hash !== checkHash(expectedHash)) throw worldStorageError('WORLD_INTEGRITY_MISMATCH');\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 || this.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 = {}) { return (await this.readNode(ref, options)).node; }\n /** Return verified bytes and their validated node in one backend read. */\n async readNode(ref, options = {}) {\n let bytes, node;\n try { bytes = await this.read(ref, options); node = JSON.parse(decoder.decode(bytes)); }\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 { bytes, 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 = this.createDigest();\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 describeResource(ref,options={}) {\n if (ref?.kind!=='resource') throw worldStorageError('WORLD_RESOURCE_INVALID');\n const {data}=await this.node(ref,options);\n checkHash(data.sha256);\n if (!Number.isSafeInteger(data.size) || data.size<0 || typeof data.format!=='string' || !data.format) throw worldStorageError('WORLD_RESOURCE_INVALID');\n return {sha256:data.sha256,byteLength:data.size,mediaType:data.format};\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 = this.createDigest();\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 = structuredClone(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 // Sample managed anchors in the same synchronous turn as native bodies.\n const capturedEntities=Array.from(runtime.serializer.objects(runtime),entity=>structuredClone(entity));\n const assets = new Set();\n async function* entities() {\n let ordinal = 0;\n for (const entity of capturedEntities) {\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, 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, node } = ref.kind\n ? await storage.readNode(ref, { signal })\n : { bytes: await storage.read(ref, { signal }), node: null };\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 (node) pending.push(...node.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 await storage.put(bytes, { signal, expectedHash: ref.hash }); 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);\n if (ref.kind) pending.push(...(await storage.node(ref, { signal })).refs);\n else await storage.read(ref, { signal });\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;AAChF,SAAgB,UAAU,MAAM;CAC9B,IAAI,CAAC,iBAAiB,KAAK,IAAI,GAAG,MAAM,kBAAkB,oBAAoB;CAC9E,OAAO;AACT;AACA,SAAgB,UAAU,OAAO,qBAAqB,IAAI,kBAAkB,GAAG;CAC7E,MAAM,SAAS,aAAa;CAC5B,OAAO,OAAO,KAAK;CACnB,OAAO,OAAO,UAAU;AAC1B;AACA,SAAgB,eAAe,QAAQ;CAAE,IAAI,QAAQ,SAAS,MAAM,kBAAkB,iBAAiB;AAAG;;AAG1G,IAAa,eAAb,MAA0B;CACxB,YAAY,SAAS;EACnB,IAAI,CAAC,SAAS,QAAQ,CAAC,SAAS,OAAO,MAAM,IAAI,UAAU,uCAAuC;EAClG,KAAK,UAAU;EAGf,KAAK,qBAAqB,QAAQ,eAAe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