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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +23 -48
  3. package/dist/core.d.ts +68 -0
  4. package/dist/core.js +209 -0
  5. package/dist/core.js.map +1 -0
  6. package/dist/index.d.ts +10 -229
  7. package/dist/index.js +192 -15462
  8. package/dist/index.js.map +1 -1
  9. package/package.json +16 -40
  10. package/cli.mjs +0 -27
  11. package/dist/AssetCompiler-CDFiElji.js +0 -2451
  12. package/dist/AssetCompiler-CDFiElji.js.map +0 -1
  13. package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
  14. package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
  15. package/dist/AssetRecipe-DmFpzxr-.js +0 -55
  16. package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
  17. package/dist/BrowserCodeWorker.js +0 -53615
  18. package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
  19. package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
  20. package/dist/SceneSerializer-DPVOyeRk.js +0 -353
  21. package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
  22. package/dist/StylePack-DNrdLeGI.js +0 -6314
  23. package/dist/StylePack-DNrdLeGI.js.map +0 -1
  24. package/dist/WorldArchive-pSBIGxLa.js +0 -420
  25. package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
  26. package/dist/WorldIO-wsDfZGM4.js +0 -150
  27. package/dist/WorldIO-wsDfZGM4.js.map +0 -1
  28. package/dist/blankWorld-CBWbwJGj.js +0 -76
  29. package/dist/blankWorld-CBWbwJGj.js.map +0 -1
  30. package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
  31. package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
  32. package/dist/environments-DgH66NqV.js +0 -4220
  33. package/dist/environments-DgH66NqV.js.map +0 -1
  34. package/dist/gltfIO-B87nJaat.js +0 -10
  35. package/dist/gltfIO-B87nJaat.js.map +0 -1
  36. package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
  37. package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
  38. package/dist/magicCabin-D64fD1E2.js +0 -11024
  39. package/dist/magicCabin-D64fD1E2.js.map +0 -1
  40. package/dist/mcp.d.ts +0 -2
  41. package/dist/mcp.js +0 -1
  42. package/dist/monumentHall-BKbs0UOQ.js +0 -404
  43. package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
  44. package/dist/node.d.ts +0 -16
  45. package/dist/node.js +0 -25
  46. package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
  47. package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
  48. package/dist/runtime/application/AgentTools.js +0 -25
  49. package/dist/runtime/application/README.md +0 -14
  50. package/dist/runtime/application/buildTaskObservation.js +0 -117
  51. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
  52. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
  53. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
  54. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
  55. package/dist/runtime/application/createSession.js +0 -66
  56. package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
  57. package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
  58. package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
  59. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
  60. package/dist/runtime/application/native-scene/CodeProject.js +0 -119
  61. package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
  62. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
  63. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
  64. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
  65. package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
  66. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
  67. package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
  68. package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
  69. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
  70. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
  71. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
  72. package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
  73. package/dist/runtime/application/scene/RequestWindow.js +0 -54
  74. package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
  75. package/dist/runtime/application/scene/SceneContracts.js +0 -45
  76. package/dist/runtime/application/scene/SceneEditService.js +0 -144
  77. package/dist/runtime/application/scene/SceneFacade.js +0 -267
  78. package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
  79. package/dist/runtime/application/scene/SceneJobController.js +0 -229
  80. package/dist/runtime/application/scene/ScenePackage.js +0 -162
  81. package/dist/runtime/application/scene/ScenePersistence.js +0 -50
  82. package/dist/runtime/application/scene/SceneProject.js +0 -95
  83. package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
  84. package/dist/runtime/application/scene/StarterScene.js +0 -56
  85. package/dist/runtime/application/scene/WorldArchive.js +0 -87
  86. package/dist/runtime/application/scene/WorldDirectory.js +0 -20
  87. package/dist/runtime/application/scene/WorldDocument.js +0 -74
  88. package/dist/runtime/application/scene/WorldIO.js +0 -103
  89. package/dist/runtime/application/scene/WorldStorage.js +0 -137
  90. package/dist/runtime/application/skills/SkillRegistry.js +0 -163
  91. package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
  92. package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
  93. package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
  94. package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
  95. package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
  96. package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
  97. package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
  98. package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
  99. package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
  100. package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
  101. package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
  102. package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
  103. package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
  104. package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
  105. package/dist/runtime/application/skills/skillPrimitives.js +0 -4
  106. package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
  107. package/dist/runtime/application/tasks.jsonl +0 -67
  108. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
  109. package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
  110. package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
  111. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
  112. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
  113. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
  114. package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
  115. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
  116. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
  117. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
  118. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
  119. package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
  120. package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
  121. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
  122. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
  123. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
  124. package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
  125. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
  126. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
  127. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
  128. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
  129. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
  130. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
  131. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
  132. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
  133. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
  134. package/dist/runtime/apps/mcp-server/README.md +0 -150
  135. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
  136. package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
  137. package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
  138. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
  139. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
  140. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
  141. package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
  142. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
  143. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
  144. package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
  145. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
  146. package/dist/runtime/apps/mcp-server/main.mjs +0 -56
  147. package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
  148. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
  149. package/dist/runtime/apps/mcp-server/security.js +0 -21
  150. package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
  151. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
  152. package/dist/runtime/apps/server/README.md +0 -7
  153. package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
  154. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
  155. package/dist/runtime/apps/server/tasks.jsonl +0 -10
  156. package/dist/runtime/foundation/EventBus.js +0 -18
  157. package/dist/runtime/foundation/JsonGateway.js +0 -47
  158. package/dist/runtime/foundation/PolicyEngine.js +0 -21
  159. package/dist/runtime/foundation/README.md +0 -7
  160. package/dist/runtime/foundation/TraceRecorder.js +0 -76
  161. package/dist/runtime/foundation/errors.js +0 -8
  162. package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
  163. package/dist/runtime/foundation/version.js +0 -2
  164. package/dist/runtime/modules/agent/README.md +0 -11
  165. package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
  166. package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
  167. package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
  168. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
  169. package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
  170. package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
  171. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
  172. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
  173. package/dist/runtime/modules/agent/prompt/index.js +0 -46
  174. package/dist/runtime/modules/agent/tasks.jsonl +0 -94
  175. package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
  176. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
  177. package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
  178. package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
  179. package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
  180. package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
  181. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
  182. package/dist/runtime/modules/artifact/README.md +0 -7
  183. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
  184. package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
  185. package/dist/runtime/modules/asset/AssetModule.js +0 -399
  186. package/dist/runtime/modules/asset/README.md +0 -54
  187. package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
  188. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
  189. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
  190. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
  191. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
  192. package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
  193. package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
  194. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
  195. package/dist/runtime/modules/asset/model/admission.js +0 -117
  196. package/dist/runtime/modules/asset/model/errors.js +0 -6
  197. package/dist/runtime/modules/asset/model/parts.js +0 -27
  198. package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
  199. package/dist/runtime/modules/asset/model/schema.js +0 -150
  200. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
  201. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
  202. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
  203. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
  204. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
  205. package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
  206. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
  207. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
  208. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
  209. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
  210. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
  211. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
  212. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
  213. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
  214. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
  215. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
  216. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
  217. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
  218. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
  219. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
  220. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
  221. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
  222. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
  223. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
  224. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
  225. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
  226. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
  227. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
  228. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
  229. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
  230. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
  231. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
  232. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
  233. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
  234. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
  235. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
  236. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
  237. package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
  238. package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
  239. package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
  240. package/dist/runtime/modules/asset/tasks.jsonl +0 -87
  241. package/dist/runtime/modules/generation/README.md +0 -9
  242. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
  243. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
  244. package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
  245. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
  246. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
  247. package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
  248. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
  249. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
  250. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
  251. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
  252. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
  253. package/dist/runtime/modules/generation/tasks.jsonl +0 -35
  254. package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
  255. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
  256. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
  257. package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
  258. package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
  259. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
  260. package/dist/runtime/modules/rendering/README.md +0 -7
  261. package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
  262. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
  263. package/dist/runtime/modules/rendering/createRenderer.js +0 -76
  264. package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
  265. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
  266. package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
  267. package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
  268. package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
  269. package/dist/runtime/modules/world/README.md +0 -13
  270. package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
  271. package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
  272. package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
  273. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
  274. package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
  275. package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
  276. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
  277. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
  278. package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
  279. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
  280. package/dist/runtime/modules/world/content/blankWorld.js +0 -35
  281. package/dist/runtime/modules/world/content/environments.js +0 -84
  282. package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
  283. package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
  284. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
  285. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
  286. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
  287. package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
  288. package/dist/runtime/modules/world/content/magicCabin.js +0 -190
  289. package/dist/runtime/modules/world/content/monumentHall.js +0 -154
  290. package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
  291. package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
  292. package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
  293. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
  294. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
  295. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
  296. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
  297. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
  298. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
  301. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
  302. package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
  303. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
  304. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
  305. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
  306. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
  307. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
  308. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
  309. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
  310. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
  311. package/dist/runtime/modules/world/errors.js +0 -9
  312. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
  313. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
  314. package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
  315. package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
  316. package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
  317. package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
  318. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
  319. package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
  320. package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
  321. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
  322. package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
  323. package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
  324. package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
  325. package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
  326. package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
  327. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
  328. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
  329. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
  330. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
  331. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
  332. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
  333. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
  334. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
  335. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
  336. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
  337. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
  338. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
  339. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
  340. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
  341. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
  342. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
  343. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
  344. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
  345. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
  346. package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
  347. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
  348. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
  349. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
  350. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
  351. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
  352. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
  353. package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
  354. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
  355. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
  356. package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
  357. package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
  358. package/dist/runtime/modules/world/tasks.jsonl +0 -530
  359. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
  360. package/dist/runtime/modules/world/verification/Finding.js +0 -105
  361. package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
  362. package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
  363. package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
  364. package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
  365. package/dist/runtime/package-lock.json +0 -6245
  366. package/dist/runtime/package.json +0 -91
  367. package/dist/runtime/public/assets/cabinet.glb +0 -0
  368. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  369. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  370. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  371. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  372. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  373. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  374. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  375. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  376. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  377. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  379. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  380. package/dist/schema-Dudvovhu.js +0 -364
  381. package/dist/schema-Dudvovhu.js.map +0 -1
  382. package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
  383. package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
  384. package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
  385. package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
  386. package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
  387. package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
@@ -1,185 +0,0 @@
1
- import { ArtifactContractError, requireSafeArtifactId } from './ArtifactDescriptor.js';
2
- import { artifactContentNeedsFullBytes, validateArtifactContent } from './ArtifactContentGate.js';
3
- import { IncrementalSha256 } from './IncrementalSha256.js';
4
-
5
- let fallbackId=0;
6
- const defaultIdFactory=(kind)=>{
7
- const uuid=globalThis.crypto?.randomUUID?.();
8
- return `${kind}_${uuid ? uuid.replaceAll('-','') : `${Date.now()}_${++fallbackId}`}`;
9
- };
10
- const nowIso=(now)=>new Date(now()).toISOString();
11
- const header=(response,name)=>response?.headers?.get?.(name) ?? response?.headers?.get?.(name.toLowerCase()) ?? null;
12
- const normalizeContentType=(value)=>String(value||'').split(';',1)[0].trim().toLowerCase();
13
- const concat=(chunks,total)=>{
14
- const out=new Uint8Array(total);
15
- let offset=0;
16
- for (const chunk of chunks) { out.set(chunk,offset); offset+=chunk.byteLength; }
17
- return out;
18
- };
19
- const asChunk=(value)=>{
20
- if (value instanceof Uint8Array) return value;
21
- if (value instanceof ArrayBuffer) return new Uint8Array(value);
22
- if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer,value.byteOffset,value.byteLength);
23
- throw new ArtifactContractError('ARTIFACT_STREAM_INVALID','Artifact response stream yielded a non-byte chunk');
24
- };
25
-
26
- function contentLength(response) {
27
- const raw=header(response,'content-length');
28
- if (raw==null||raw==='') return null;
29
- if (!/^\d+$/.test(String(raw).trim())) throw new ArtifactContractError('ARTIFACT_LENGTH_INVALID','Artifact Content-Length is invalid');
30
- const n=Number(raw);
31
- if (!Number.isSafeInteger(n)||n<0) throw new ArtifactContractError('ARTIFACT_LENGTH_INVALID','Artifact Content-Length is outside safe integer range');
32
- return n;
33
- }
34
-
35
- export class ArtifactImporter {
36
- constructor({
37
- registry,
38
- connectorArtifactClient,
39
- byteStore,
40
- maxBytes=256*1024*1024,
41
- maxStructuredBytes=16*1024*1024,
42
- maxJsonDepth=64,
43
- maxJsonNodes=100000,
44
- maxChunks=65536,
45
- now=()=>Date.now(),
46
- idFactory=defaultIdFactory
47
- }={}) {
48
- if (!registry?.get||!registry?.verifyIntegrity||!registry?.acquireLease) throw new ArtifactContractError('ARTIFACT_IMPORTER_INVALID','ArtifactImporter requires ArtifactRegistry');
49
- if (!connectorArtifactClient?.open) throw new ArtifactContractError('ARTIFACT_IMPORTER_INVALID','ArtifactImporter requires ConnectorArtifactClient');
50
- const limit=Number(maxBytes);
51
- if (!Number.isSafeInteger(limit)||limit<0) throw new ArtifactContractError('ARTIFACT_BYTES_LIMIT','ArtifactImporter maxBytes must be a non-negative safe integer');
52
- const structuredLimit=Number(maxStructuredBytes);
53
- if (!Number.isSafeInteger(structuredLimit)||structuredLimit<0) throw new ArtifactContractError('ARTIFACT_STRUCTURE_LIMIT','ArtifactImporter maxStructuredBytes must be a non-negative safe integer');
54
- this.registry=registry;
55
- this.connectorArtifactClient=connectorArtifactClient;
56
- this.byteStore=byteStore;
57
- const jsonDepth=Number(maxJsonDepth),jsonNodes=Number(maxJsonNodes),chunkLimit=Number(maxChunks);
58
- if (!Number.isSafeInteger(jsonDepth)||jsonDepth<1) throw new ArtifactContractError('ARTIFACT_STRUCTURE_LIMIT','ArtifactImporter maxJsonDepth must be a positive safe integer');
59
- if (!Number.isSafeInteger(jsonNodes)||jsonNodes<1) throw new ArtifactContractError('ARTIFACT_STRUCTURE_LIMIT','ArtifactImporter maxJsonNodes must be a positive safe integer');
60
- if (!Number.isSafeInteger(chunkLimit)||chunkLimit<1) throw new ArtifactContractError('ARTIFACT_STREAM_LIMIT','ArtifactImporter maxChunks must be a positive safe integer');
61
- if (!byteStore?.begin||!byteStore?.remove) throw new ArtifactContractError('ARTIFACT_IMPORTER_INVALID','ArtifactImporter byteStore requires begin/remove transaction APIs');
62
- this.maxBytes=limit;
63
- this.maxStructuredBytes=Math.min(structuredLimit,limit);
64
- this.maxJsonDepth=jsonDepth;
65
- this.maxJsonNodes=jsonNodes;
66
- this.maxChunks=chunkLimit;
67
- this.now=now;
68
- this.idFactory=idFactory;
69
- }
70
-
71
- async import(artifactId) {
72
- const id=requireSafeArtifactId(artifactId);
73
- const descriptor=this.registry.get(id);
74
- if (!descriptor) throw new ArtifactContractError('ARTIFACT_NOT_FOUND','Artifact does not exist',{id});
75
- const source=descriptor.locations.find((location)=>
76
- location.kind==='connector' && location.state==='available' &&
77
- location.access?.kind==='connector-artifact' && location.access.artifactId===id
78
- );
79
- if (!source) throw new ArtifactContractError('ARTIFACT_SOURCE_UNAVAILABLE','Artifact has no available Connector source',{id});
80
- if (descriptor.bytes>this.maxBytes) throw new ArtifactContractError('ARTIFACT_BYTES_LIMIT','Artifact declared bytes exceed importer maxBytes',{bytes:descriptor.bytes,maxBytes:this.maxBytes});
81
- if (artifactContentNeedsFullBytes(descriptor.mime) && descriptor.bytes>this.maxStructuredBytes) {
82
- throw new ArtifactContractError('ARTIFACT_STRUCTURE_LIMIT','Artifact requiring bounded full-byte validation exceeds maxStructuredBytes',{
83
- bytes:descriptor.bytes,maxStructuredBytes:this.maxStructuredBytes,mime:descriptor.mime
84
- });
85
- }
86
-
87
- const leaseId=requireSafeArtifactId(this.idFactory('lease',descriptor),'leaseId');
88
- const cacheKey=requireSafeArtifactId(this.idFactory('cache',descriptor),'cacheKey');
89
- const locationId=requireSafeArtifactId(this.idFactory('loc',descriptor),'locationId');
90
- let writer=null;
91
- let reader=null;
92
- let committed=null;
93
- let locationAdded=false;
94
- let leaseHeld=false;
95
- try {
96
- this.registry.acquireLease(id,{
97
- id:leaseId,holder:{kind:'transfer',id:leaseId},reason:'artifact-import',createdAt:nowIso(this.now)
98
- });
99
- leaseHeld=true;
100
- const response=await this.connectorArtifactClient.open(id,{accept:descriptor.mime,expectedConnector:source.access.connector});
101
- const encoding=String(header(response,'content-encoding')||'').trim().toLowerCase();
102
- if (encoding && encoding!=='identity') throw new ArtifactContractError('ARTIFACT_CONTENT_ENCODING_UNSUPPORTED','Artifact transfer must not use transparent content encoding',{encoding});
103
- const responseType=normalizeContentType(header(response,'content-type'));
104
- if (responseType && responseType!==descriptor.mime) {
105
- throw new ArtifactContractError('ARTIFACT_CONTENT_TYPE_MISMATCH','Artifact Content-Type does not match descriptor MIME',{expected:descriptor.mime,actual:responseType});
106
- }
107
- const declaredLength=contentLength(response);
108
- if (declaredLength!=null) {
109
- if (declaredLength>this.maxBytes) throw new ArtifactContractError('ARTIFACT_BYTES_LIMIT','Artifact Content-Length exceeds importer maxBytes',{bytes:declaredLength,maxBytes:this.maxBytes});
110
- if (declaredLength!==descriptor.bytes) throw new ArtifactContractError('ARTIFACT_LENGTH_MISMATCH','Artifact Content-Length does not match descriptor bytes',{expected:descriptor.bytes,actual:declaredLength});
111
- }
112
- if (!response.body?.getReader) throw new ArtifactContractError('ARTIFACT_STREAM_UNAVAILABLE','Artifact response must provide a readable byte stream');
113
-
114
- writer=this.byteStore.begin({artifactId:id,maxBytes:this.maxBytes});
115
- reader=response.body.getReader();
116
- const hasher=new IncrementalSha256();
117
- const prefix=new Uint8Array(Math.min(64,descriptor.bytes));
118
- let prefixLength=0;
119
- const fullChunks=artifactContentNeedsFullBytes(descriptor.mime)?[]:null;
120
- let total=0;
121
- let chunkCount=0;
122
- try {
123
- while (true) {
124
- const {done,value}=await reader.read();
125
- if (done) break;
126
- chunkCount++;
127
- if (chunkCount>this.maxChunks) throw new ArtifactContractError('ARTIFACT_STREAM_LIMIT','Artifact stream exceeded maxChunks',{maxChunks:this.maxChunks});
128
- const chunk=asChunk(value);
129
- total+=chunk.byteLength;
130
- if (total>this.maxBytes) throw new ArtifactContractError('ARTIFACT_BYTES_LIMIT','Artifact stream exceeded importer maxBytes',{maxBytes:this.maxBytes});
131
- if (total>descriptor.bytes) throw new ArtifactContractError('ARTIFACT_LENGTH_MISMATCH','Artifact stream exceeded descriptor bytes',{expected:descriptor.bytes,actualAtLeast:total});
132
- if (prefixLength<prefix.byteLength) {
133
- const take=Math.min(prefix.byteLength-prefixLength,chunk.byteLength);
134
- prefix.set(chunk.subarray(0,take),prefixLength);
135
- prefixLength+=take;
136
- }
137
- if (fullChunks) fullChunks.push(new Uint8Array(chunk));
138
- hasher.update(chunk);
139
- await writer.write(chunk);
140
- }
141
- } catch (error) {
142
- try { await reader.cancel?.(); } catch {}
143
- if (error instanceof ArtifactContractError) throw error;
144
- throw new ArtifactContractError('ARTIFACT_STREAM_FAILED','Artifact stream failed before integrity verification',{recoverable:true});
145
- } finally {
146
- try { reader.releaseLock?.(); } catch {}
147
- }
148
-
149
- if (total!==descriptor.bytes) throw new ArtifactContractError('ARTIFACT_LENGTH_MISMATCH','Artifact stream length does not match descriptor bytes',{expected:descriptor.bytes,actual:total});
150
- const actualHash=hasher.digestArtifactHash();
151
- if (actualHash!==descriptor.hash) throw new ArtifactContractError('ARTIFACT_HASH_MISMATCH','Artifact SHA-256 does not match descriptor',{expected:descriptor.hash,actual:actualHash});
152
- const fullBytes=fullChunks?concat(fullChunks,total):null;
153
- validateArtifactContent(descriptor,{
154
- prefix:prefix.subarray(0,prefixLength),totalBytes:total,fullBytes,
155
- maxJsonDepth:this.maxJsonDepth,maxJsonNodes:this.maxJsonNodes
156
- });
157
-
158
- committed=await writer.commit({key:cacheKey,hash:actualHash,mime:descriptor.mime,bytes:total});
159
- const verifiedAt=nowIso(this.now);
160
- this.registry.updateLocation(id,{
161
- id:locationId,kind:'local-cache',scope:'application',state:'available',
162
- verifiedAt,access:{kind:'cache-key',key:committed.key}
163
- });
164
- locationAdded=true;
165
- const artifact=this.registry.verifyIntegrity(id,{
166
- hash:actualHash,bytes:total,mime:descriptor.mime,verifiedAt,method:'stream-sha256-v1'
167
- });
168
- return {artifact,cache:{key:committed.key,locationId},hash:actualHash,bytes:total,mime:descriptor.mime};
169
- } catch (error) {
170
- if (writer?.state==='open') await writer.abort();
171
- if (leaseHeld) { this.registry.releaseLease(leaseId); leaseHeld=false; }
172
- if (locationAdded) {
173
- try {
174
- const removed=this.registry.removeLocation(id,locationId);
175
- if (removed.removed && committed) this.byteStore.remove(committed.key);
176
- } catch {}
177
- } else if (committed) {
178
- this.byteStore.remove(committed.key);
179
- }
180
- throw error;
181
- } finally {
182
- if (leaseHeld) this.registry.releaseLease(leaseId);
183
- }
184
- }
185
- }
@@ -1,111 +0,0 @@
1
- import { ArtifactRegistry } from './ArtifactRegistry.js';
2
- import { ArtifactContractError } from './ArtifactDescriptor.js';
3
- import { sha256ArtifactHash } from './IncrementalSha256.js';
4
- import { MemoryArtifactByteStore } from './MemoryArtifactByteStore.js';
5
- import { IndexedDbArtifactStore } from './storage/IndexedDbArtifactStore.js';
6
-
7
- const localCacheLocations = (descriptor) => (descriptor.locations || []).filter((location) =>
8
- location.kind === 'local-cache' &&
9
- location.state === 'available' &&
10
- location.access?.kind === 'cache-key'
11
- );
12
-
13
- const persistedEntryFor = (descriptor, entriesByKey) => {
14
- const locations = localCacheLocations(descriptor);
15
- for (const location of locations) {
16
- const entry = entriesByKey.get(location.access.key);
17
- if (entry) return { location, entry };
18
- }
19
- return null;
20
- };
21
-
22
- const assertVerifiedPersistence = (descriptor, entry) => {
23
- const mismatches = [];
24
- if (!(entry?.data instanceof Uint8Array)) mismatches.push('data');
25
- if (entry?.artifactId !== descriptor.id) mismatches.push('artifactId');
26
- if (entry?.hash !== descriptor.hash) mismatches.push('hash');
27
- if (entry?.mime !== descriptor.mime) mismatches.push('mime');
28
- if (entry?.bytes !== descriptor.bytes || entry?.data?.byteLength !== descriptor.bytes) mismatches.push('bytes');
29
- if (!mismatches.length && sha256ArtifactHash([entry.data]) !== descriptor.hash) mismatches.push('contentHash');
30
- if (mismatches.length) {
31
- throw new ArtifactContractError(
32
- 'ARTIFACT_PERSISTENCE_INTEGRITY_MISMATCH',
33
- 'Persisted Artifact bytes do not match the verified descriptor',
34
- { artifactId: descriptor.id, mismatches }
35
- );
36
- }
37
- };
38
-
39
- export function createArtifactModule({
40
- registry = null,
41
- byteStore = null,
42
- persistentStore = undefined,
43
- now = () => Date.now()
44
- } = {}) {
45
- const artifactRegistry = registry || new ArtifactRegistry({ now });
46
- const artifactByteStore = byteStore || new MemoryArtifactByteStore();
47
- const durableStore = persistentStore === undefined
48
- ? (globalThis.indexedDB ? new IndexedDbArtifactStore() : null)
49
- : persistentStore;
50
- let hydrated = false;
51
-
52
- return Object.freeze({
53
- registry: artifactRegistry,
54
- byteStore: artifactByteStore,
55
- persistentStore: durableStore,
56
-
57
- async hydrate() {
58
- if (hydrated) return { artifacts: artifactRegistry.list().length, restored: false };
59
- if (!durableStore?.load) {
60
- hydrated = true;
61
- return { artifacts: artifactRegistry.list().length, restored: false };
62
- }
63
- const snapshot = await durableStore.load();
64
- const entriesByKey = new Map((snapshot.entries || []).map((entry) => [entry.key, entry]));
65
- for (const descriptor of snapshot.descriptors || []) {
66
- const integrity = descriptor.integrity || { state: 'declared' };
67
- const nonLocalLocations = (descriptor.locations || []).filter((location) => location.kind !== 'local-cache');
68
- let verifiedPersistence = null;
69
- if (integrity.state === 'verified') {
70
- verifiedPersistence = persistedEntryFor(descriptor, entriesByKey);
71
- if (!verifiedPersistence) {
72
- throw new ArtifactContractError(
73
- 'ARTIFACT_PERSISTENCE_INTEGRITY_MISMATCH',
74
- 'Verified persisted Artifact has no matching local byte entry',
75
- { artifactId: descriptor.id }
76
- );
77
- }
78
- assertVerifiedPersistence(descriptor, verifiedPersistence.entry);
79
- }
80
- artifactRegistry.register({
81
- ...descriptor,
82
- locations: nonLocalLocations,
83
- integrity: { state: 'declared' }
84
- });
85
- if (integrity.state === 'verified') {
86
- artifactByteStore.restore(verifiedPersistence.entry);
87
- artifactRegistry.updateLocation(descriptor.id, verifiedPersistence.location);
88
- artifactRegistry.verifyIntegrity(descriptor.id, {
89
- hash: sha256ArtifactHash([verifiedPersistence.entry.data]),
90
- bytes: verifiedPersistence.entry.data.byteLength,
91
- mime: verifiedPersistence.entry.mime,
92
- verifiedAt: new Date(now()).toISOString(),
93
- method: 'persisted-sha256-v1'
94
- });
95
- } else if (integrity.state === 'rejected' && integrity.rejection) {
96
- artifactRegistry.rejectIntegrity(descriptor.id, integrity.rejection);
97
- }
98
- }
99
- hydrated = true;
100
- return { artifacts: (snapshot.descriptors || []).length, entries: (snapshot.entries || []).length, restored: true };
101
- },
102
-
103
- async persistArtifact(artifactId, cacheKey) {
104
- if (!durableStore?.putArtifact) return false;
105
- const descriptor = artifactRegistry.get(artifactId);
106
- const entry = artifactByteStore.get(cacheKey);
107
- if (!descriptor || !entry) return false;
108
- return durableStore.putArtifact(descriptor, entry);
109
- }
110
- });
111
- }
@@ -1,197 +0,0 @@
1
- import {
2
- ARTIFACT_LEASE_HOLDER_KINDS,
3
- ArtifactContractError,
4
- artifactImmutableSignature,
5
- normalizeArtifactDescriptor,
6
- normalizeArtifactHash,
7
- normalizeArtifactLocation,
8
- requireSafeArtifactId
9
- } from './ArtifactDescriptor.js';
10
-
11
- const HOLDER_KIND_SET=new Set(ARTIFACT_LEASE_HOLDER_KINDS);
12
- const SAFE_REASON=/^[A-Za-z0-9][A-Za-z0-9 ._:-]{0,199}$/;
13
- const SAFE_CODE=/^[A-Z0-9][A-Z0-9._:-]{0,119}$/i;
14
- const UNSAFE_REASON_RE=/https?:\/\/|Bearer\s+/i;
15
- const clone=(value)=>value == null ? value : structuredClone(value);
16
-
17
- function normalizeTime(value,field,{required=false}={}) {
18
- if (value==null||value==='') {
19
- if (required) throw new ArtifactContractError('ARTIFACT_LEASE_INVALID',`Artifact lease requires ${field}`,{field});
20
- return null;
21
- }
22
- const time=Date.parse(String(value));
23
- if (!Number.isFinite(time)) throw new ArtifactContractError('ARTIFACT_LEASE_INVALID',`Artifact lease has invalid ${field}`,{field});
24
- return new Date(time).toISOString();
25
- }
26
-
27
- function normalizeLease(value={},artifactId) {
28
- if (!value || typeof value!=='object' || Array.isArray(value)) throw new ArtifactContractError('ARTIFACT_LEASE_INVALID','Artifact lease must be an object');
29
- const holder=value.holder;
30
- if (!holder || typeof holder!=='object' || Array.isArray(holder)) throw new ArtifactContractError('ARTIFACT_LEASE_INVALID','Artifact lease requires holder');
31
- const holderKind=String(holder.kind||'');
32
- if (!HOLDER_KIND_SET.has(holderKind)) throw new ArtifactContractError('ARTIFACT_LEASE_INVALID',`Unsupported artifact lease holder kind: ${holderKind}`);
33
- const reason=String(value.reason||'').trim();
34
- if (!SAFE_REASON.test(reason) || UNSAFE_REASON_RE.test(reason)) throw new ArtifactContractError('ARTIFACT_LEASE_INVALID','Artifact lease reason is invalid');
35
- const createdAt=normalizeTime(value.createdAt,'createdAt',{required:true});
36
- const expiresAt=normalizeTime(value.expiresAt,'expiresAt');
37
- if (expiresAt && Date.parse(expiresAt)<=Date.parse(createdAt)) throw new ArtifactContractError('ARTIFACT_LEASE_INVALID','Artifact lease expiry must be after creation');
38
- return {
39
- id:requireSafeArtifactId(value.id,'lease.id'),
40
- artifactId,
41
- locationId:value.locationId==null?null:requireSafeArtifactId(value.locationId,'lease.locationId'),
42
- holder:{kind:holderKind,id:requireSafeArtifactId(holder.id,'lease.holder.id')},
43
- reason,
44
- createdAt,
45
- expiresAt
46
- };
47
- }
48
-
49
- export class ArtifactRegistry {
50
- #now;
51
- #artifacts=new Map();
52
- #hashIndex=new Map();
53
- #leases=new Map();
54
-
55
- constructor({now=()=>Date.now()}={}) {
56
- this.#now=now;
57
- }
58
-
59
- register(payload) {
60
- const descriptor=normalizeArtifactDescriptor(payload);
61
- const previous=this.#artifacts.get(descriptor.id);
62
- if (previous) {
63
- if (artifactImmutableSignature(previous)!==artifactImmutableSignature(descriptor)) {
64
- throw new ArtifactContractError('ARTIFACT_IDENTITY_CONFLICT','Artifact ID already exists with different immutable identity',{id:descriptor.id});
65
- }
66
- return this.get(descriptor.id);
67
- }
68
- this.#artifacts.set(descriptor.id,descriptor);
69
- if (!this.#hashIndex.has(descriptor.hash)) this.#hashIndex.set(descriptor.hash,new Set());
70
- this.#hashIndex.get(descriptor.hash).add(descriptor.id);
71
- return this.get(descriptor.id);
72
- }
73
-
74
- has(id) { return this.#artifacts.has(id); }
75
-
76
- get(id) {
77
- const artifact=this.#artifacts.get(id);
78
- return artifact?clone(artifact):null;
79
- }
80
-
81
- list() {
82
- return [...this.#artifacts.values()].map(clone).sort((a,b)=>Date.parse(b.createdAt)-Date.parse(a.createdAt)||a.id.localeCompare(b.id));
83
- }
84
-
85
- findByHash(hash) {
86
- const canonical=normalizeArtifactHash(hash);
87
- return [...(this.#hashIndex.get(canonical)||[])].sort();
88
- }
89
-
90
- updateLocation(id,locationPayload) {
91
- const artifactId=requireSafeArtifactId(id);
92
- const artifact=this.#artifacts.get(artifactId);
93
- if (!artifact) throw new ArtifactContractError('ARTIFACT_NOT_FOUND','Artifact does not exist',{id:artifactId});
94
- const location=normalizeArtifactLocation(locationPayload,artifactId);
95
- const next=clone(artifact);
96
- const index=next.locations.findIndex((item)=>item.id===location.id);
97
- if (index===-1) {
98
- next.locations.push(location);
99
- } else {
100
- const previous=next.locations[index];
101
- const accessConflict=previous.access && location.access && JSON.stringify(previous.access)!==JSON.stringify(location.access);
102
- if (previous.kind!==location.kind || previous.scope!==location.scope || accessConflict) {
103
- throw new ArtifactContractError('ARTIFACT_LOCATION_IDENTITY_CONFLICT','Artifact location ID cannot change kind, scope, or active access identity',{
104
- id:artifactId,locationId:location.id
105
- });
106
- }
107
- next.locations[index]=location;
108
- }
109
- this.#artifacts.set(artifactId,next);
110
- return this.get(artifactId);
111
- }
112
-
113
- removeLocation(id,locationId) {
114
- const artifactId=requireSafeArtifactId(id);
115
- const locationKey=requireSafeArtifactId(locationId,'locationId');
116
- const artifact=this.#artifacts.get(artifactId);
117
- if (!artifact) throw new ArtifactContractError('ARTIFACT_NOT_FOUND','Artifact does not exist',{id:artifactId});
118
- if (!artifact.locations.some((item)=>item.id===locationKey)) return {removed:false,artifact:this.get(artifactId)};
119
- if (this.isLeased(artifactId,{locationId:locationKey})) {
120
- throw new ArtifactContractError('ARTIFACT_LOCATION_LEASED','Artifact location is protected by an active lease',{id:artifactId,locationId:locationKey});
121
- }
122
- const next=clone(artifact);
123
- next.locations=next.locations.filter((item)=>item.id!==locationKey);
124
- this.#artifacts.set(artifactId,next);
125
- return {removed:true,artifact:this.get(artifactId)};
126
- }
127
-
128
- verifyIntegrity(id,evidence={}) {
129
- const artifactId=requireSafeArtifactId(id);
130
- const artifact=this.#artifacts.get(artifactId);
131
- if (!artifact) throw new ArtifactContractError('ARTIFACT_NOT_FOUND','Artifact does not exist',{id:artifactId});
132
- const hash=normalizeArtifactHash(evidence.hash,'integrity.hash');
133
- const bytes=Number(evidence.bytes);
134
- if (!Number.isSafeInteger(bytes)||bytes<0) throw new ArtifactContractError('ARTIFACT_INTEGRITY_INVALID','Integrity evidence bytes are invalid');
135
- const mime=String(evidence.mime||'').trim().toLowerCase();
136
- if (hash!==artifact.hash||bytes!==artifact.bytes||mime!==artifact.mime) {
137
- throw new ArtifactContractError('ARTIFACT_INTEGRITY_MISMATCH','Integrity evidence does not match the declared descriptor',{id:artifactId});
138
- }
139
- const verifiedAt=normalizeTime(evidence.verifiedAt,'verifiedAt',{required:true});
140
- const method=String(evidence.method||'').trim();
141
- if (!method || !SAFE_CODE.test(method)) throw new ArtifactContractError('ARTIFACT_INTEGRITY_INVALID','Integrity verification method must be a stable safe identifier');
142
- const next=clone(artifact);
143
- next.integrity={state:'verified',verifiedAt,method,rejection:null};
144
- this.#artifacts.set(artifactId,next);
145
- return this.get(artifactId);
146
- }
147
-
148
- rejectIntegrity(id,evidence={}) {
149
- const artifactId=requireSafeArtifactId(id);
150
- const artifact=this.#artifacts.get(artifactId);
151
- if (!artifact) throw new ArtifactContractError('ARTIFACT_NOT_FOUND','Artifact does not exist',{id:artifactId});
152
- const code=String(evidence.code||'').trim();
153
- if (!code || !SAFE_CODE.test(code)) throw new ArtifactContractError('ARTIFACT_INTEGRITY_INVALID','Integrity rejection code must be a stable safe identifier');
154
- const checkedAt=normalizeTime(evidence.checkedAt,'checkedAt',{required:true});
155
- const next=clone(artifact);
156
- next.integrity={state:'rejected',verifiedAt:null,method:null,rejection:{code,checkedAt}};
157
- this.#artifacts.set(artifactId,next);
158
- return this.get(artifactId);
159
- }
160
-
161
- acquireLease(artifactId,leasePayload) {
162
- const id=requireSafeArtifactId(artifactId);
163
- const artifact=this.#artifacts.get(id);
164
- if (!artifact) throw new ArtifactContractError('ARTIFACT_NOT_FOUND','Artifact does not exist',{id});
165
- const lease=normalizeLease(leasePayload,id);
166
- if (lease.expiresAt && Date.parse(lease.expiresAt)<=this.#now()) {
167
- throw new ArtifactContractError('ARTIFACT_LEASE_INVALID','Artifact lease is already expired',{leaseId:lease.id});
168
- }
169
- if (lease.locationId && !artifact.locations.some((location)=>location.id===lease.locationId)) {
170
- throw new ArtifactContractError('ARTIFACT_LEASE_INVALID','Artifact lease references an unknown location',{id,locationId:lease.locationId});
171
- }
172
- const previous=this.#leases.get(lease.id);
173
- if (previous && JSON.stringify(previous)!==JSON.stringify(lease)) throw new ArtifactContractError('ARTIFACT_LEASE_CONFLICT','Artifact lease ID already exists with different semantics',{leaseId:lease.id});
174
- this.#leases.set(lease.id,lease);
175
- return clone(lease);
176
- }
177
-
178
- releaseLease(leaseId) {
179
- const id=requireSafeArtifactId(leaseId,'leaseId');
180
- return this.#leases.delete(id);
181
- }
182
-
183
- leasesFor(artifactId,{includeExpired=false}={}) {
184
- const id=requireSafeArtifactId(artifactId);
185
- const now=this.#now();
186
- return [...this.#leases.values()]
187
- .filter((lease)=>lease.artifactId===id && (includeExpired || !lease.expiresAt || Date.parse(lease.expiresAt)>now))
188
- .map(clone)
189
- .sort((a,b)=>a.id.localeCompare(b.id));
190
- }
191
-
192
- isLeased(artifactId,{locationId=null}={}) {
193
- const id=requireSafeArtifactId(artifactId);
194
- const location=locationId==null?null:requireSafeArtifactId(locationId,'locationId');
195
- return this.leasesFor(id).some((lease)=>lease.locationId==null || location==null || lease.locationId===location);
196
- }
197
- }
@@ -1,129 +0,0 @@
1
- const K=new Uint32Array([
2
- 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
3
- 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
4
- 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
5
- 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
6
- 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
7
- 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
8
- 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
9
- 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
10
- ]);
11
-
12
- const INITIAL=new Uint32Array([
13
- 0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,
14
- 0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19
15
- ]);
16
- const rotr=(x,n)=>(x>>>n)|(x<<(32-n));
17
- const asBytes=(value)=>{
18
- if (value instanceof Uint8Array) return value;
19
- if (value instanceof ArrayBuffer) return new Uint8Array(value);
20
- if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer,value.byteOffset,value.byteLength);
21
- throw new TypeError('SHA-256 update requires Uint8Array or ArrayBuffer data');
22
- };
23
-
24
- export class IncrementalSha256 {
25
- constructor() {
26
- this.state=new Uint32Array(INITIAL);
27
- this.buffer=new Uint8Array(64);
28
- this.bufferLength=0;
29
- this.bytesHashed=0;
30
- this.finished=false;
31
- this.words=new Uint32Array(64);
32
- }
33
-
34
- update(value) {
35
- if (this.finished) throw new Error('SHA-256 digest is already finalized');
36
- const bytes=asBytes(value);
37
- if (!bytes.byteLength) return this;
38
- if (!Number.isSafeInteger(this.bytesHashed+bytes.byteLength)) throw new Error('SHA-256 input exceeds safe byte count');
39
- this.bytesHashed+=bytes.byteLength;
40
- let offset=0;
41
- if (this.bufferLength) {
42
- const take=Math.min(64-this.bufferLength,bytes.byteLength);
43
- this.buffer.set(bytes.subarray(0,take),this.bufferLength);
44
- this.bufferLength+=take;
45
- offset+=take;
46
- if (this.bufferLength===64) {
47
- this.#process(this.buffer,0);
48
- this.bufferLength=0;
49
- }
50
- }
51
- while (offset+64<=bytes.byteLength) {
52
- this.#process(bytes,offset);
53
- offset+=64;
54
- }
55
- if (offset<bytes.byteLength) {
56
- this.buffer.set(bytes.subarray(offset),0);
57
- this.bufferLength=bytes.byteLength-offset;
58
- }
59
- return this;
60
- }
61
-
62
- digestBytes() {
63
- if (!this.finished) this.#finish();
64
- const out=new Uint8Array(32);
65
- const view=new DataView(out.buffer);
66
- for (let i=0;i<8;i++) view.setUint32(i*4,this.state[i],false);
67
- return out;
68
- }
69
-
70
- digestHex() {
71
- return [...this.digestBytes()].map((byte)=>byte.toString(16).padStart(2,'0')).join('');
72
- }
73
-
74
- digestArtifactHash() { return `sha256:${this.digestHex()}`; }
75
-
76
- #finish() {
77
- const block=new Uint8Array(128);
78
- block.set(this.buffer.subarray(0,this.bufferLength),0);
79
- block[this.bufferLength]=0x80;
80
- const padLength=this.bufferLength<56?64:128;
81
- const high=Math.floor(this.bytesHashed/0x20000000)>>>0;
82
- const low=(this.bytesHashed*8)>>>0;
83
- const view=new DataView(block.buffer);
84
- view.setUint32(padLength-8,high,false);
85
- view.setUint32(padLength-4,low,false);
86
- this.#process(block,0);
87
- if (padLength===128) this.#process(block,64);
88
- this.finished=true;
89
- this.bufferLength=0;
90
- }
91
-
92
- #process(bytes,offset) {
93
- const w=this.words;
94
- for (let i=0;i<16;i++) {
95
- const j=offset+i*4;
96
- w[i]=((bytes[j]<<24)|(bytes[j+1]<<16)|(bytes[j+2]<<8)|bytes[j+3])>>>0;
97
- }
98
- for (let i=16;i<64;i++) {
99
- const x=w[i-15],y=w[i-2];
100
- const s0=(rotr(x,7)^rotr(x,18)^(x>>>3))>>>0;
101
- const s1=(rotr(y,17)^rotr(y,19)^(y>>>10))>>>0;
102
- w[i]=(w[i-16]+s0+w[i-7]+s1)>>>0;
103
- }
104
- let [a,b,c,d,e,f,g,h]=this.state;
105
- for (let i=0;i<64;i++) {
106
- const S1=(rotr(e,6)^rotr(e,11)^rotr(e,25))>>>0;
107
- const ch=((e&f)^((~e)&g))>>>0;
108
- const t1=(h+S1+ch+K[i]+w[i])>>>0;
109
- const S0=(rotr(a,2)^rotr(a,13)^rotr(a,22))>>>0;
110
- const maj=((a&b)^(a&c)^(b&c))>>>0;
111
- const t2=(S0+maj)>>>0;
112
- h=g; g=f; f=e; e=(d+t1)>>>0; d=c; c=b; b=a; a=(t1+t2)>>>0;
113
- }
114
- this.state[0]=(this.state[0]+a)>>>0;
115
- this.state[1]=(this.state[1]+b)>>>0;
116
- this.state[2]=(this.state[2]+c)>>>0;
117
- this.state[3]=(this.state[3]+d)>>>0;
118
- this.state[4]=(this.state[4]+e)>>>0;
119
- this.state[5]=(this.state[5]+f)>>>0;
120
- this.state[6]=(this.state[6]+g)>>>0;
121
- this.state[7]=(this.state[7]+h)>>>0;
122
- }
123
- }
124
-
125
- export function sha256ArtifactHash(chunks) {
126
- const hash=new IncrementalSha256();
127
- for (const chunk of chunks) hash.update(chunk);
128
- return hash.digestArtifactHash();
129
- }