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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/README.md +23 -48
  2. package/dist/core.d.ts +68 -0
  3. package/dist/core.js +209 -0
  4. package/dist/core.js.map +1 -0
  5. package/dist/index.d.ts +10 -229
  6. package/dist/index.js +192 -15462
  7. package/dist/index.js.map +1 -1
  8. package/package.json +11 -40
  9. package/cli.mjs +0 -27
  10. package/dist/AssetCompiler-CDFiElji.js +0 -2451
  11. package/dist/AssetCompiler-CDFiElji.js.map +0 -1
  12. package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
  13. package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
  14. package/dist/AssetRecipe-DmFpzxr-.js +0 -55
  15. package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
  16. package/dist/BrowserCodeWorker.js +0 -53615
  17. package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
  18. package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
  19. package/dist/SceneSerializer-DPVOyeRk.js +0 -353
  20. package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
  21. package/dist/StylePack-DNrdLeGI.js +0 -6314
  22. package/dist/StylePack-DNrdLeGI.js.map +0 -1
  23. package/dist/WorldArchive-pSBIGxLa.js +0 -420
  24. package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
  25. package/dist/WorldIO-wsDfZGM4.js +0 -150
  26. package/dist/WorldIO-wsDfZGM4.js.map +0 -1
  27. package/dist/blankWorld-CBWbwJGj.js +0 -76
  28. package/dist/blankWorld-CBWbwJGj.js.map +0 -1
  29. package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
  30. package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
  31. package/dist/environments-DgH66NqV.js +0 -4220
  32. package/dist/environments-DgH66NqV.js.map +0 -1
  33. package/dist/gltfIO-B87nJaat.js +0 -10
  34. package/dist/gltfIO-B87nJaat.js.map +0 -1
  35. package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
  36. package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
  37. package/dist/magicCabin-D64fD1E2.js +0 -11024
  38. package/dist/magicCabin-D64fD1E2.js.map +0 -1
  39. package/dist/mcp.d.ts +0 -2
  40. package/dist/mcp.js +0 -1
  41. package/dist/monumentHall-BKbs0UOQ.js +0 -404
  42. package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
  43. package/dist/node.d.ts +0 -16
  44. package/dist/node.js +0 -25
  45. package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
  46. package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
  47. package/dist/runtime/application/AgentTools.js +0 -25
  48. package/dist/runtime/application/README.md +0 -14
  49. package/dist/runtime/application/buildTaskObservation.js +0 -117
  50. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
  51. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
  52. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
  53. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
  54. package/dist/runtime/application/createSession.js +0 -66
  55. package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
  56. package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
  57. package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
  58. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
  59. package/dist/runtime/application/native-scene/CodeProject.js +0 -119
  60. package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
  61. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
  62. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
  63. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
  64. package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
  65. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
  66. package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
  67. package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
  68. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
  69. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
  70. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
  71. package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
  72. package/dist/runtime/application/scene/RequestWindow.js +0 -54
  73. package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
  74. package/dist/runtime/application/scene/SceneContracts.js +0 -45
  75. package/dist/runtime/application/scene/SceneEditService.js +0 -144
  76. package/dist/runtime/application/scene/SceneFacade.js +0 -267
  77. package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
  78. package/dist/runtime/application/scene/SceneJobController.js +0 -229
  79. package/dist/runtime/application/scene/ScenePackage.js +0 -162
  80. package/dist/runtime/application/scene/ScenePersistence.js +0 -50
  81. package/dist/runtime/application/scene/SceneProject.js +0 -95
  82. package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
  83. package/dist/runtime/application/scene/StarterScene.js +0 -56
  84. package/dist/runtime/application/scene/WorldArchive.js +0 -87
  85. package/dist/runtime/application/scene/WorldDirectory.js +0 -20
  86. package/dist/runtime/application/scene/WorldDocument.js +0 -74
  87. package/dist/runtime/application/scene/WorldIO.js +0 -103
  88. package/dist/runtime/application/scene/WorldStorage.js +0 -137
  89. package/dist/runtime/application/skills/SkillRegistry.js +0 -163
  90. package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
  91. package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
  92. package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
  93. package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
  94. package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
  95. package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
  96. package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
  97. package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
  98. package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
  99. package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
  100. package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
  101. package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
  102. package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
  103. package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
  104. package/dist/runtime/application/skills/skillPrimitives.js +0 -4
  105. package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
  106. package/dist/runtime/application/tasks.jsonl +0 -67
  107. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
  108. package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
  109. package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
  110. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
  111. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
  112. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
  113. package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
  114. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
  115. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
  116. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
  117. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
  118. package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
  119. package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
  120. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
  121. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
  122. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
  123. package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
  124. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
  125. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
  126. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
  127. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
  128. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
  129. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
  130. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
  131. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
  132. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
  133. package/dist/runtime/apps/mcp-server/README.md +0 -150
  134. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
  135. package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
  136. package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
  137. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
  138. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
  139. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
  140. package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
  141. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
  142. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
  143. package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
  144. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
  145. package/dist/runtime/apps/mcp-server/main.mjs +0 -56
  146. package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
  147. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
  148. package/dist/runtime/apps/mcp-server/security.js +0 -21
  149. package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
  150. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
  151. package/dist/runtime/apps/server/README.md +0 -7
  152. package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
  153. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
  154. package/dist/runtime/apps/server/tasks.jsonl +0 -10
  155. package/dist/runtime/foundation/EventBus.js +0 -18
  156. package/dist/runtime/foundation/JsonGateway.js +0 -47
  157. package/dist/runtime/foundation/PolicyEngine.js +0 -21
  158. package/dist/runtime/foundation/README.md +0 -7
  159. package/dist/runtime/foundation/TraceRecorder.js +0 -76
  160. package/dist/runtime/foundation/errors.js +0 -8
  161. package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
  162. package/dist/runtime/foundation/version.js +0 -2
  163. package/dist/runtime/modules/agent/README.md +0 -11
  164. package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
  165. package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
  166. package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
  167. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
  168. package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
  169. package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
  170. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
  171. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
  172. package/dist/runtime/modules/agent/prompt/index.js +0 -46
  173. package/dist/runtime/modules/agent/tasks.jsonl +0 -94
  174. package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
  175. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
  176. package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
  177. package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
  178. package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
  179. package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
  180. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
  181. package/dist/runtime/modules/artifact/README.md +0 -7
  182. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
  183. package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
  184. package/dist/runtime/modules/asset/AssetModule.js +0 -399
  185. package/dist/runtime/modules/asset/README.md +0 -54
  186. package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
  187. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
  188. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
  189. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
  190. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
  191. package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
  192. package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
  193. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
  194. package/dist/runtime/modules/asset/model/admission.js +0 -117
  195. package/dist/runtime/modules/asset/model/errors.js +0 -6
  196. package/dist/runtime/modules/asset/model/parts.js +0 -27
  197. package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
  198. package/dist/runtime/modules/asset/model/schema.js +0 -150
  199. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
  200. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
  201. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
  202. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
  203. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
  204. package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
  205. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
  206. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
  207. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
  208. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
  209. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
  210. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
  211. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
  212. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
  213. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
  214. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
  215. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
  216. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
  217. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
  218. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
  219. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
  220. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
  221. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
  222. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
  223. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
  224. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
  225. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
  226. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
  227. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
  228. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
  229. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
  230. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
  231. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
  232. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
  233. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
  234. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
  235. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
  236. package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
  237. package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
  238. package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
  239. package/dist/runtime/modules/asset/tasks.jsonl +0 -87
  240. package/dist/runtime/modules/generation/README.md +0 -9
  241. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
  242. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
  243. package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
  244. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
  245. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
  246. package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
  247. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
  248. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
  249. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
  250. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
  251. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
  252. package/dist/runtime/modules/generation/tasks.jsonl +0 -35
  253. package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
  254. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
  255. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
  256. package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
  257. package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
  258. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
  259. package/dist/runtime/modules/rendering/README.md +0 -7
  260. package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
  261. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
  262. package/dist/runtime/modules/rendering/createRenderer.js +0 -76
  263. package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
  264. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
  265. package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
  266. package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
  267. package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
  268. package/dist/runtime/modules/world/README.md +0 -13
  269. package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
  270. package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
  271. package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
  272. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
  273. package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
  274. package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
  275. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
  276. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
  277. package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
  278. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
  279. package/dist/runtime/modules/world/content/blankWorld.js +0 -35
  280. package/dist/runtime/modules/world/content/environments.js +0 -84
  281. package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
  282. package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
  283. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
  284. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
  285. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
  286. package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
  287. package/dist/runtime/modules/world/content/magicCabin.js +0 -190
  288. package/dist/runtime/modules/world/content/monumentHall.js +0 -154
  289. package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
  290. package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
  291. package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
  292. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
  293. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
  294. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
  295. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
  296. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
  297. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
  298. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
  301. package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
  302. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
  303. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
  304. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
  305. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
  306. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
  307. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
  308. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
  309. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
  310. package/dist/runtime/modules/world/errors.js +0 -9
  311. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
  312. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
  313. package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
  314. package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
  315. package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
  316. package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
  317. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
  318. package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
  319. package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
  320. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
  321. package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
  322. package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
  323. package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
  324. package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
  325. package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
  326. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
  327. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
  328. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
  329. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
  330. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
  331. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
  332. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
  333. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
  334. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
  335. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
  336. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
  337. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
  338. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
  339. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
  340. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
  341. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
  342. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
  343. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
  344. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
  345. package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
  346. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
  347. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
  348. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
  349. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
  350. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
  351. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
  352. package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
  353. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
  354. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
  355. package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
  356. package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
  357. package/dist/runtime/modules/world/tasks.jsonl +0 -530
  358. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
  359. package/dist/runtime/modules/world/verification/Finding.js +0 -105
  360. package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
  361. package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
  362. package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
  363. package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
  364. package/dist/runtime/package-lock.json +0 -6245
  365. package/dist/runtime/package.json +0 -91
  366. package/dist/runtime/public/assets/cabinet.glb +0 -0
  367. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  368. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  369. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  370. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  371. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  372. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  373. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  374. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  375. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  376. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  377. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  379. package/dist/schema-Dudvovhu.js +0 -364
  380. package/dist/schema-Dudvovhu.js.map +0 -1
  381. package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
  382. package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
  383. package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
  384. package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
  385. package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
  386. package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
@@ -1,254 +0,0 @@
1
- import * as THREE from 'three';
2
- import { ObjectStore } from '../runtime/ObjectStore.js';
3
- import { PhysicsSystem } from '../runtime/systems/PhysicsSystem.js';
4
- import { RapierPhysicsBackend } from '../../physics/RapierPhysicsBackend.js';
5
- import { disposeObject3D } from '../../rendering/disposeObject3D.js';
6
-
7
- const finiteVec3 = (v) => [v.x, v.y, v.z].every(Number.isFinite);
8
- const finiteQuat = (q) => [q.x, q.y, q.z, q.w].every(Number.isFinite);
9
- const angularDelta = (a, b) => 2 * Math.acos(Math.min(1, Math.abs(a.dot(b))));
10
- const axisVector = (axis = [1, 0, 0]) => new THREE.Vector3(...axis).normalize();
11
- const wrappedAngle = (angle) => Math.atan2(Math.sin(angle), Math.cos(angle));
12
- const failure = (stage, code, details = {}) => ({ stage, code, ...details });
13
-
14
- function jointCoordinate(node, reference, part) {
15
- const axis = reference.axis;
16
- if (part.joint.type === 'prismatic') {
17
- return (node.position.x-reference.position.x)*axis.x + (node.position.y-reference.position.y)*axis.y + (node.position.z-reference.position.z)*axis.z;
18
- }
19
- const delta = node.quaternion.clone().multiply(reference.inverseRotation).normalize();
20
- return wrappedAngle(2 * Math.atan2(delta.x*axis.x + delta.y*axis.y + delta.z*axis.z, delta.w));
21
- }
22
-
23
- function penetrationMap(physics, instanceId, partName, refresh = false) {
24
- return new Map(physics.articulationPenetrations(instanceId, partName, { refresh }).map((item) => [item.key, item]));
25
- }
26
-
27
- export class ArticulationVerifier {
28
- constructor({
29
- assetRegistry,
30
- assetLoader,
31
- physicsFactory = () => new PhysicsSystem({ backend:new RapierPhysicsBackend() }),
32
- steps = 180,
33
- dt = 1 / 60,
34
- prismaticTolerance = 0.03,
35
- revoluteTolerance = 0.08,
36
- movementTolerance = 0.01,
37
- collisionTolerance = 0.005,
38
- stallWindow = 30,
39
- stallTolerance = 0.002
40
- } = {}) {
41
- if (!assetRegistry?.getManifest) throw new TypeError('ArticulationVerifier requires AssetRegistry');
42
- if (!assetLoader?.instantiate) throw new TypeError('ArticulationVerifier requires AssetLoader');
43
- this.assetRegistry = assetRegistry;
44
- this.assetLoader = assetLoader;
45
- this.physicsFactory = physicsFactory;
46
- this.steps = steps;
47
- this.dt = dt;
48
- this.prismaticTolerance = prismaticTolerance;
49
- this.revoluteTolerance = revoluteTolerance;
50
- this.movementTolerance = movementTolerance;
51
- this.collisionTolerance = collisionTolerance;
52
- this.stallWindow = stallWindow;
53
- this.stallTolerance = stallTolerance;
54
- }
55
-
56
- async verify(assetId,{requireRegistration=false,manifest:override=null,instantiate=null,verifyRigidBody=false,requireSettled=false}={}) {
57
- const manifest = override || this.assetRegistry.getManifest(assetId);
58
- const parts = Object.entries(manifest.parts || {}).filter(([, part]) => part.joint && part.joint.type!=='fixed' && part.physics && (Object.keys(part.targets || {}).length || part.joint.limits?.length===2));
59
- if (!parts.length && !requireRegistration) return { ok: true, assetId, tested: 0, parts: [], note: 'no executable articulation' };
60
-
61
- const { object } = await (instantiate ? instantiate() : this.assetLoader.instantiate(assetId));
62
- const physics = this.physicsFactory();
63
- const store = new ObjectStore();
64
- const instanceId = `verify_${assetId}`;
65
- store.add(instanceId, { id: instanceId, assetId, object, manifest, state: {} });
66
-
67
- try {
68
- await physics.init();
69
- if(requireRegistration && (!physics.hasCapability('rigid-body') || !physics.hasCapability('collision'))) return {ok:false,assetId,tested:0,parts:[],physicsRegistered:false,reason:'PHYSICS_CAPABILITY_UNAVAILABLE'};
70
- physics.addObject(instanceId, manifest, object);
71
- const reports = [];
72
- for (const [partName, part] of parts) reports.push(this.verifyPart({ physics, store, object, instanceId, partName, part, requireSettled }));
73
- let rigidBody=null;
74
- if(verifyRigidBody && !parts.length) {
75
- const body=physics.manipulationBody(instanceId);
76
- let exercised=true,displacement=0;
77
- if(body.body==='dynamic') {
78
- const bounds=new THREE.Box3().setFromObject(object),center=bounds.getCenter(new THREE.Vector3());
79
- physics.addEnvironment([{shape:'box',halfExtents:[10,.1,10],translation:[center.x,bounds.min.y-.1,center.z]}]);
80
- const before=physics.getPosition(instanceId);
81
- exercised=physics.applyImpulse(instanceId,[Math.min(body.mass || 1,100)*.5,0,0]);
82
- for(let step=0;step<15;step++) physics.step(this.dt,store);
83
- const after=physics.getPosition(instanceId);
84
- displacement=Math.hypot(...after.map((value,index)=>value-before[index]));
85
- exercised=exercised && after.every(Number.isFinite) && Math.abs(after[0]-before[0])>1e-5;
86
- }
87
- rigidBody={ok:body.registered && body.colliderCount>0 && exercised,colliderCount:body.colliderCount,body:body.body,displacement};
88
- }
89
- return { ok: reports.every((report) => report.ok) && (!rigidBody || rigidBody.ok), assetId, tested: reports.length, parts: reports,
90
- ...(rigidBody?{rigidBody}:{}),physicsRegistered:Boolean(physics.getPosition(instanceId)) };
91
- } finally {
92
- physics.dispose();
93
- disposeObject3D(object);
94
- }
95
- }
96
-
97
- verifyPart({ physics, store, object, instanceId, partName, part, requireSettled=false }) {
98
- const node = object.getObjectByName(part.node);
99
- if (!node) {
100
- return {
101
- ok: false,
102
- part: partName,
103
- node: part.node,
104
- failures: [failure('PRE_CONDITION', 'MISSING_NODE', { node:part.node })]
105
- };
106
- }
107
-
108
- const reference = {
109
- position:node.position.clone(),
110
- rotation:node.quaternion.clone(),
111
- inverseRotation:node.quaternion.clone().invert(),
112
- axis:axisVector(part.joint.axis)
113
- };
114
- const declared=Object.entries(part.targets || {});
115
- const probes=declared.length ? declared : [['probe',part.joint.limits.reduce((a,b)=>Math.abs(a)>Math.abs(b)?a:b)],['return',0]];
116
- const actions = probes.sort((a, b) => Math.abs(b[1]) - Math.abs(a[1]));
117
- const referencePenetrations = penetrationMap(physics, instanceId, partName, true);
118
- const reports = [];
119
- for (const [action, target] of actions) reports.push(this.verifyAction({
120
- physics, store, node, reference, referencePenetrations, instanceId, partName, part, action, target,requireSettled
121
- }));
122
-
123
- const zeroAction = actions.find(([, target]) => Math.abs(target) <= 1e-8);
124
- const returnPositionDelta = node.position.distanceTo(reference.position);
125
- const returnRotationDelta = angularDelta(node.quaternion, reference.rotation);
126
- const returnTolerance = part.joint.type === 'prismatic' ? this.prismaticTolerance : this.revoluteTolerance;
127
- const returnMovement = part.joint.type === 'prismatic' ? returnPositionDelta : returnRotationDelta;
128
- const reversibility = zeroAction
129
- ? { checked:true, ok:returnMovement <= returnTolerance, action:zeroAction[0], positionDelta:returnPositionDelta, rotationDelta:returnRotationDelta }
130
- : { checked:false, ok:true };
131
- const failures = reversibility.ok ? [] : [failure('RETURN', 'RETURN_FAILED', { movement:returnMovement, tolerance:returnTolerance })];
132
-
133
- return {
134
- ok: reports.every((report) => report.ok) && reversibility.ok,
135
- part: partName,
136
- node: part.node,
137
- jointType: part.joint.type,
138
- limits: part.joint.limits ? [...part.joint.limits] : null,
139
- actions: reports,
140
- reversibility,
141
- baselinePenetrations:[...referencePenetrations.values()],
142
- failures
143
- };
144
- }
145
-
146
- verifyAction({ physics, store, node, reference, referencePenetrations, instanceId, partName, part, action, target,requireSettled=false }) {
147
- const tolerance = part.joint.type === 'prismatic' ? this.prismaticTolerance : this.revoluteTolerance;
148
- const failures = [];
149
- const limits = part.joint.limits || [];
150
- if (!Number.isFinite(target)) failures.push(failure('PRE_CONDITION', 'TARGET_NON_FINITE', { target }));
151
- if (limits.length === 2 && Number.isFinite(target) && (target < limits[0] - 1e-8 || target > limits[1] + 1e-8)) {
152
- failures.push(failure('PRE_CONDITION', 'TARGET_OUT_OF_LIMITS', { target, limits:[...limits] }));
153
- }
154
-
155
- const beforePosition = node.position.clone();
156
- const beforeRotation = node.quaternion.clone();
157
- const initialCoordinate = jointCoordinate(node, reference, part);
158
- const initialError = Number.isFinite(target) ? Math.abs(wrappedAngleIfNeeded(part, initialCoordinate - target)) : Infinity;
159
- const baseline = referencePenetrations;
160
- const collisions = new Map();
161
- const coordinates = [initialCoordinate];
162
- let finite = finiteVec3(node.position) && finiteQuat(node.quaternion);
163
- let accepted = false;
164
-
165
- if (!failures.length) {
166
- accepted = physics.setArticulationTarget(instanceId, partName, target);
167
- if (!accepted) failures.push(failure('PRE_CONDITION', 'TARGET_REJECTED', { target }));
168
- }
169
-
170
- let stepsRun = 0;
171
- if (accepted) {
172
- for (let i = 0; i < this.steps; i++) {
173
- physics.step(this.dt, store);
174
- stepsRun += 1;
175
- finite = finiteVec3(node.position) && finiteQuat(node.quaternion);
176
- if (!finite) {
177
- failures.push(failure('EXECUTION', 'NON_FINITE_TRANSFORM', { step:i + 1 }));
178
- break;
179
- }
180
- coordinates.push(jointCoordinate(node, reference, part));
181
- for (const hit of physics.articulationPenetrations(instanceId, partName)) {
182
- const baseDepth = baseline.get(hit.key)?.depth || 0;
183
- const regression = hit.depth - baseDepth;
184
- if (regression > this.collisionTolerance) {
185
- const previous = collisions.get(hit.key);
186
- if (!previous || regression > previous.regression) collisions.set(hit.key, { ...hit, baseDepth, regression, step:i + 1 });
187
- }
188
- }
189
- }
190
- }
191
-
192
- if (collisions.size) failures.push(failure('EXECUTION', 'COLLISION_REGRESSION', { collisions:[...collisions.values()] }));
193
- let minCoordinate = Infinity;
194
- let maxCoordinate = -Infinity;
195
- for (const coordinate of coordinates) { minCoordinate = Math.min(minCoordinate, coordinate); maxCoordinate = Math.max(maxCoordinate, coordinate); }
196
- if (limits.length === 2 && finite && (minCoordinate < limits[0] - tolerance || maxCoordinate > limits[1] + tolerance)) {
197
- failures.push(failure('EXECUTION', 'LIMIT_VIOLATION', { minCoordinate, maxCoordinate, limits:[...limits], tolerance }));
198
- }
199
- const finalCoordinate = coordinates.at(-1);
200
- const targetError = Number.isFinite(target) && Number.isFinite(finalCoordinate)
201
- ? Math.abs(wrappedAngleIfNeeded(part, finalCoordinate - target))
202
- : Infinity;
203
- const alreadyAtTarget = initialError <= tolerance;
204
- const positionDelta = node.position.distanceTo(beforePosition);
205
- const rotationDelta = angularDelta(node.quaternion, beforeRotation);
206
- const movement = part.joint.type === 'prismatic' ? positionDelta : rotationDelta;
207
- const moved = movement > this.movementTolerance;
208
- const window = Math.min(this.stallWindow, Math.max(0, coordinates.length - 1));
209
- const recentMovement = window > 0 ? Math.abs(wrappedAngleIfNeeded(part, finalCoordinate - coordinates[coordinates.length - 1 - window])) : 0;
210
- const stalled = accepted && finite && !alreadyAtTarget && targetError > tolerance && recentMovement < this.stallTolerance;
211
- if (stalled) failures.push(failure('EXECUTION', 'STALL', { recentMovement, window, targetError }));
212
- const targetReached = targetError <= tolerance;
213
- const motion=physics.getMotion(instanceId,{partName});
214
- const settled=targetReached && recentMovement<=tolerance*.25 && motion?.linearSpeed<.08 && motion?.angularSpeed<.08;
215
- if(requireSettled && !settled) failures.push(failure('POST_CONDITION','NOT_SETTLED',{recentMovement,linearSpeed:motion?.linearSpeed,angularSpeed:motion?.angularSpeed}));
216
- if (accepted && finite && !targetReached) failures.push(failure('POST_CONDITION', 'TARGET_NOT_REACHED', { target, coordinate:finalCoordinate, error:targetError, tolerance }));
217
-
218
- return {
219
- ok: failures.length === 0,
220
- action,
221
- target,
222
- accepted,
223
- finite,
224
- alreadyAtTarget,
225
- positionDelta,
226
- rotationDelta,
227
- moved,
228
- initialCoordinate,
229
- finalCoordinate,
230
- minCoordinate,
231
- maxCoordinate,
232
- initialError,
233
- targetError,
234
- targetReached,
235
- settled,
236
- progress: Number.isFinite(initialError) && Number.isFinite(targetError) ? initialError - targetError : null,
237
- stepsRun,
238
- stalled,
239
- recentMovement,
240
- collisionRegressions:[...collisions.values()],
241
- failures,
242
- coordinateReference:'initial-zero-pose',
243
- phases:{
244
- preCondition:{ ok:!failures.some((item) => item.stage === 'PRE_CONDITION') },
245
- execution:{ ok:!failures.some((item) => item.stage === 'EXECUTION') },
246
- postCondition:{ ok:!failures.some((item) => item.stage === 'POST_CONDITION'), targetReached }
247
- }
248
- };
249
- }
250
- }
251
-
252
- function wrappedAngleIfNeeded(part, value) {
253
- return part.joint.type === 'revolute' ? wrappedAngle(value) : value;
254
- }
@@ -1,105 +0,0 @@
1
- export const FINDING_SCHEMA='agentscape.finding';
2
- export const FINDING_VERSION=1;
3
-
4
- const clone=(value)=>value==null?value:structuredClone(value);
5
- const clean=(value)=>typeof value==='string'?value.trim():'';
6
- const REPAIR_STRATEGY={
7
- G_BELOW_GROUND:'lift_to_ground',
8
- P_OVERLAP:'separate_overlap'
9
- };
10
-
11
- export function normalizeFinding(input,{index=0}={}){
12
- if(!input||typeof input!=='object'||Array.isArray(input)) throw new TypeError('Finding must be an object');
13
- if(input.schema!==FINDING_SCHEMA||input.schemaVersion!==FINDING_VERSION) throw new TypeError('Unsupported Finding contract');
14
- const id=clean(input.id),source=clean(input.source),severity=clean(input.severity),code=clean(input.code);
15
- if(!id||!source||!code||!['hard','advisory'].includes(severity)) throw new TypeError(`Finding[${index}] requires id/source/severity/code`);
16
- const affectedObjects=Array.isArray(input.affectedObjects)?[...new Set(input.affectedObjects.map(clean).filter(Boolean))]:[];
17
- const repair=input.repair&&typeof input.repair==='object'&&!Array.isArray(input.repair)?{
18
- eligible:input.repair.eligible===true,
19
- ...(clean(input.repair.strategy)?{strategy:clean(input.repair.strategy)}:{})
20
- }:{eligible:false};
21
- if(repair.eligible&&!repair.strategy) throw new TypeError(`Finding ${id} repairable finding requires strategy`);
22
- return {
23
- schema:FINDING_SCHEMA,schemaVersion:FINDING_VERSION,id,source,severity,code,
24
- ...(clean(input.worldRevisionId)?{worldRevisionId:clean(input.worldRevisionId)}:{}),
25
- affectedObjects,
26
- message:clean(input.message),
27
- evidence:clone(input.evidence||{}),
28
- repair
29
- };
30
- }
31
-
32
- export function compileValidationFindings(report,{worldRevisionId=null}={}){
33
- const rows=[
34
- ...(report?.hard||[]).map((raw)=>({severity:'hard',raw})),
35
- ...(report?.advisory||[]).map((raw)=>({severity:'advisory',raw}))
36
- ];
37
- return rows.map(({severity,raw},index)=>{
38
- const affectedObjects=[raw.object,raw.other].map(clean).filter(Boolean);
39
- const strategy=REPAIR_STRATEGY[raw.code]||null;
40
- return normalizeFinding({
41
- schema:FINDING_SCHEMA,schemaVersion:FINDING_VERSION,
42
- id:`validation:${severity}:${raw.code||'UNKNOWN'}:${affectedObjects.join('+')||'$world'}:${index}`,
43
- source:'world-validator',severity,code:raw.code||'UNKNOWN',
44
- ...(worldRevisionId?{worldRevisionId}:{}),affectedObjects,
45
- message:raw.message||'',evidence:{...clone(raw)},
46
- repair:{eligible:Boolean(strategy),...(strategy?{strategy}:{})}
47
- },{index});
48
- });
49
- }
50
-
51
-
52
- const admissionCode=(stage,item,report)=>{
53
- const explicit=clean(item?.code||item?.reason||report?.reason);
54
- if(explicit) return explicit.toUpperCase().replace(/[^A-Z0-9_]+/g,'_');
55
- const status=clean(item?.status);
56
- if(stage==='asset'&&status) return `ASSET_${status.toUpperCase().replace(/[^A-Z0-9_]+/g,'_')}`;
57
- return `${clean(stage).toUpperCase()||'WORLD'}_ADMISSION_REJECTED`;
58
- };
59
-
60
- const admissionAffectedObjects=(item)=>[item?.entityId,item?.targetId,item?.supportId,item?.subject,item?.object,item?.instanceId,item?.id]
61
- .map(clean).filter(Boolean);
62
-
63
- export function compileAdmissionFindings(report,{stage='world',worldRevisionId=null}={}){
64
- if(report?.status!=='rejected') return [];
65
- const issues=Array.isArray(report.issues)&&report.issues.length ? report.issues
66
- : Array.isArray(report.unresolved)&&report.unresolved.length ? report.unresolved
67
- : [{}];
68
- return issues.map((item,index)=>{
69
- const code=admissionCode(stage,item,report);
70
- const affectedObjects=[...new Set(admissionAffectedObjects(item))];
71
- return normalizeFinding({
72
- schema:FINDING_SCHEMA,schemaVersion:FINDING_VERSION,
73
- id:`${clean(stage)||'world'}:hard:${code}:${affectedObjects.join('+')||'$world'}:${index}`,
74
- source:`world-${clean(stage)||'world'}-admission`,severity:'hard',code,
75
- ...(worldRevisionId?{worldRevisionId}:{}),affectedObjects,
76
- message:`${clean(stage)||'world'} admission rejected: ${code}`,
77
- evidence:{stage:clean(stage)||'world',...clone(item),...(report?.reason?{admissionReason:report.reason}:{})},
78
- repair:{eligible:false}
79
- },{index});
80
- });
81
- }
82
-
83
- export function compileAcceptanceFindings(result,{worldRevisionId=null}={}){
84
- return (result?.checks||[]).filter((check)=>check?.verified===false).map((check,index)=>normalizeFinding({
85
- schema:FINDING_SCHEMA,schemaVersion:FINDING_VERSION,
86
- id:`acceptance:hard:${check.id||check.kind||'check'}:${index}`,
87
- source:'world-acceptance',severity:'hard',code:`A_${check.reason||'NOT_VERIFIED'}`,
88
- ...(worldRevisionId?{worldRevisionId}:{}),
89
- affectedObjects:[check.targetId,check.subject,check.object].filter(Boolean),
90
- message:`Acceptance criterion not verified: ${check.id||check.kind||'unknown'}`,
91
- evidence:clone(check),repair:{eligible:false}
92
- },{index}));
93
- }
94
-
95
- export function assertFindingRevision(findings,currentWorldRevisionId){
96
- for(const finding of findings.map((item,index)=>normalizeFinding(item,{index}))){
97
- if(finding.worldRevisionId&&currentWorldRevisionId&&finding.worldRevisionId!==currentWorldRevisionId){
98
- const error=new Error(`Finding revision mismatch: ${finding.worldRevisionId} != ${currentWorldRevisionId}`);
99
- error.code='FINDING_REVISION_MISMATCH';
100
- error.findingId=finding.id;
101
- throw error;
102
- }
103
- }
104
- return true;
105
- }
@@ -1,69 +0,0 @@
1
- export const INTERACTION_EVIDENCE_SCHEMA='agentscape.interaction-evidence';
2
- export const INTERACTION_EVIDENCE_VERSION=1;
3
-
4
- const clean=(value)=>typeof value==='string'?value.trim():'';
5
- const clone=(value)=>structuredClone(value);
6
- const key=(revisionId,targetId,capability,source)=>`${revisionId}\u0000${targetId}\u0000${capability}\u0000${source}`;
7
- const store=(runtime)=>runtime.interactionEvidence ||= new Map();
8
-
9
- const summarizeResult=(result)=>{
10
- if(!result||typeof result!=='object') return null;
11
- const summary={};
12
- for(const field of ['status','action','targetId','actorId','supportId','stateKey','evidenceKind']){
13
- const value=clean(result[field]);
14
- if(value) summary[field]=value;
15
- }
16
- for(const field of ['targetReached','settled','supportVerified','heldRequired','physicsVerified']){
17
- if(typeof result[field]==='boolean') summary[field]=result[field];
18
- }
19
- if(Object.prototype.hasOwnProperty.call(result,'value') && (result.value===null||['string','number','boolean'].includes(typeof result.value))) summary.value=result.value;
20
- return Object.keys(summary).length?summary:null;
21
- };
22
-
23
- export function clearInteractionEvidence(runtime){
24
- runtime?.interactionEvidence?.clear?.();
25
- }
26
-
27
- export function clearInteractionEvidenceForTarget(runtime,targetId){
28
- const target=clean(targetId);
29
- if(!target||!runtime?.interactionEvidence?.size) return;
30
- for(const [entryKey,evidence] of runtime.interactionEvidence){
31
- if(evidence?.targetId===target) runtime.interactionEvidence.delete(entryKey);
32
- }
33
- }
34
-
35
- export function recordInteractionEvidence(runtime,{targetId,capability,verified,source='runtime',commandId=null,result=null}={}){
36
- if(verified!==true) return null;
37
- // Code Project and ad-hoc worlds have no World IR revision. Use a transient,
38
- // runtime-local evidence scope; it is not exported and cannot validate a reopened world.
39
- const worldRevisionId=clean(runtime?.currentWorldRevision?.revision?.id)
40
- || (runtime.interactionEvidenceScope ||= 'session:' + crypto.randomUUID());
41
- const target=clean(targetId),normalizedCapability=clean(capability).toUpperCase();
42
- if(!worldRevisionId||!target||!normalizedCapability) return null;
43
- const resultSummary=summarizeResult(result);
44
- const evidence={
45
- schema:INTERACTION_EVIDENCE_SCHEMA,schemaVersion:INTERACTION_EVIDENCE_VERSION,
46
- worldRevisionId,targetId:target,capability:normalizedCapability,verified:true,source,
47
- ...(clean(commandId)?{commandId:clean(commandId)}:{}),
48
- ...(resultSummary?{result:resultSummary}:{})
49
- };
50
- store(runtime).set(key(worldRevisionId,target,normalizedCapability,source),evidence);
51
- runtime.trace?.emit?.('interaction.verified',{evidence:clone(evidence)},{actor:'runtime'});
52
- return clone(evidence);
53
- }
54
-
55
- export function getInteractionEvidence(runtime,targetId,capability,{worldRevisionId=null,source=null}={}){
56
- const revisionId=clean(worldRevisionId)||clean(runtime?.currentWorldRevision?.revision?.id)
57
- || runtime?.interactionEvidenceScope;
58
- const target=clean(targetId),normalizedCapability=clean(capability).toUpperCase();
59
- if(!revisionId||!target||!normalizedCapability) return null;
60
- if(source) {
61
- const evidence=runtime?.interactionEvidence?.get?.(key(revisionId,target,normalizedCapability,source));
62
- return evidence?.verified===true ? clone(evidence) : null;
63
- }
64
- // Legacy unscoped lookup remains supported when no provider is requested.
65
- const matches=[...(runtime?.interactionEvidence?.values?.() || [])].filter(item=>
66
- item?.verified===true && item.worldRevisionId===revisionId
67
- && item.targetId===target && item.capability===normalizedCapability);
68
- return matches.length ? clone(matches[matches.length - 1]) : null;
69
- }
@@ -1,49 +0,0 @@
1
- import { assertFindingRevision, compileValidationFindings, normalizeFinding } from './Finding.js';
2
-
3
- export class RepairEngine {
4
- constructor(runtime) { this.runtime = runtime; }
5
-
6
- async repair(report, { maxRepairs = 20, worldRevisionId = null, silent = false } = {}) {
7
- const currentRevisionId=worldRevisionId || this.runtime.currentWorldRevision?.revision?.id || null;
8
- const findings=(report?.findings?.length?report.findings:compileValidationFindings(report||{},{worldRevisionId:currentRevisionId})).map((item,index)=>normalizeFinding(item,{index}));
9
- assertFindingRevision(findings,currentRevisionId);
10
- const hardFindings=findings.filter((finding)=>finding.severity==='hard');
11
- const beforeCounts=report?.counts || {hard:hardFindings.length,advisory:findings.filter((finding)=>finding.severity==='advisory').length};
12
- const before = this.runtime.snapshot();
13
- const applied = [];
14
- const ignored=[];
15
- for (const finding of hardFindings.slice(0, maxRepairs)) {
16
- if (!finding.repair.eligible) { ignored.push({findingId:finding.id,code:finding.code,reason:'NOT_REPAIRABLE'}); continue; }
17
- const objectId=finding.affectedObjects[0];
18
- if (finding.repair.strategy === 'lift_to_ground') {
19
- const record = this.runtime.store.get(objectId);
20
- const bounds = this.runtime.spatial.getBounds(objectId);
21
- const p = record.object.position.toArray();
22
- p[1] += -bounds.min[1] + 0.01;
23
- this.runtime.interactions.move(objectId, p,{silent});
24
- applied.push({ findingId:finding.id,code: finding.code, object: objectId, action: 'lift_to_ground' });
25
- continue;
26
- }
27
- if (finding.repair.strategy === 'separate_overlap') {
28
- const record = this.runtime.store.get(objectId);
29
- const p = record.object.position.toArray();
30
- let solved = false;
31
- for (const [dx, dz] of [[0.25,0],[-0.25,0],[0,0.25],[0,-0.25],[0.5,0],[0,0.5]]) {
32
- this.runtime.interactions.move(objectId, [p[0]+dx, p[1], p[2]+dz],{silent});
33
- if (!this.runtime.spatial.overlappingIds(objectId, { margin: 0.015 }).length) { solved = true; break; }
34
- }
35
- if (solved) applied.push({ findingId:finding.id,code: finding.code, object: objectId, action: 'separate_overlap' });
36
- else { this.runtime.interactions.move(objectId, p,{silent}); ignored.push({findingId:finding.id,code:finding.code,reason:'REPAIR_SEARCH_EXHAUSTED'}); }
37
- continue;
38
- }
39
- ignored.push({findingId:finding.id,code:finding.code,reason:'STRATEGY_UNSUPPORTED'});
40
- }
41
- this.runtime.sceneGraph.changed();
42
- const after = this.runtime.validator.run({worldRevisionId:currentRevisionId});
43
- if (after.counts.hard > beforeCounts.hard) {
44
- await this.runtime.restoreSnapshot(before);
45
- return { status:'repair-failed',accepted: false, reason: 'hard_findings_increased', before: beforeCounts, after: after.counts, applied: [], ignored, findingsConsumed:hardFindings.map((finding)=>finding.id) };
46
- }
47
- return { status:'repair-applied',accepted: true, before: beforeCounts, after: after.counts, applied, ignored, findingsConsumed:hardFindings.map((finding)=>finding.id) };
48
- }
49
- }
@@ -1,158 +0,0 @@
1
- import { compileAcceptanceFindings } from './Finding.js';
2
- import { getInteractionEvidence } from './InteractionEvidence.js';
3
- import { SemanticWorldView } from '../runtime/semantic/SemanticWorldView.js';
4
-
5
- const SCHEMA='agentscape.world-acceptance';
6
- const VERSION=1;
7
- const scalar=v=>v===null||typeof v==='string'||typeof v==='number'||typeof v==='boolean';
8
- const clean=v=>typeof v==='string'?v.trim():'';
9
-
10
- export function compileWorldAcceptance(criteria=[]){
11
- if(!Array.isArray(criteria)) throw new TypeError('Acceptance criteria must be an array');
12
- const ids=new Set();
13
- const checks=criteria.map((item,index)=>{
14
- if(!item||typeof item!=='object'||Array.isArray(item)) throw new TypeError(`Acceptance[${index}] must be an object`);
15
- const id=clean(item.id),kind=clean(item.kind);
16
- if(!id||ids.has(id)) throw new TypeError(`Acceptance[${index}] requires unique id`); ids.add(id);
17
- if(!kind) throw new TypeError(`Acceptance[${index}] requires kind`);
18
- if(!['world-valid','object-exists','state-equals','interaction-verified','relation-exists','no-unresolved'].includes(kind)) throw new TypeError(`Acceptance[${index}] unsupported kind: ${kind}`);
19
- const check={id,kind};
20
- if(['object-exists','state-equals','interaction-verified'].includes(kind)) check.targetId=clean(item.targetId);
21
- if(kind==='state-equals'){ check.stateKey=clean(item.stateKey); check.value=item.value; if(!check.targetId||!check.stateKey||!Object.prototype.hasOwnProperty.call(item,'value')||!scalar(item.value)) throw new TypeError(`Acceptance[${index}] state-equals requires targetId/stateKey/scalar value`); }
22
- if(['state-equals','interaction-verified'].includes(kind) && item.source != null) {
23
- check.source=clean(item.source);
24
- if(!check.source) throw new TypeError(`Acceptance[${index}] source must be non-empty`);
25
- }
26
- if(kind==='interaction-verified'){ check.capability=clean(item.capability).toUpperCase(); if(!check.targetId||!check.capability) throw new TypeError(`Acceptance[${index}] interaction-verified requires targetId/capability`); }
27
- if(kind==='relation-exists'){
28
- check.subject=clean(item.subject); check.predicate=clean(item.predicate).toUpperCase(); check.object=clean(item.object);
29
- if(item.objectAnyOf!=null) {
30
- if(check.object || !Array.isArray(item.objectAnyOf) || !item.objectAnyOf.length || item.objectAnyOf.length>32 || item.objectAnyOf.some(value=>!clean(value))) throw new TypeError('Use object or a bounded objectAnyOf');
31
- check.objectAnyOf=[...new Set(item.objectAnyOf.map(clean))];delete check.object;
32
- }
33
- if(clean(item.surfaceId)) check.surfaceId=clean(item.surfaceId);
34
- if(!check.subject||!check.predicate||(!check.object&&!check.objectAnyOf)) throw new TypeError(`Acceptance[${index}] relation-exists requires subject/predicate/object`);
35
- if(!['ON','NEAR','INSIDE','CONTAINS','SUPPORTS'].includes(check.predicate)) throw new TypeError(`Acceptance[${index}] unsupported relation predicate: ${check.predicate}`);
36
- }
37
- if(kind==='object-exists'&&!check.targetId) throw new TypeError(`Acceptance[${index}] object-exists requires targetId`);
38
- if(clean(item.description)) check.description=clean(item.description);
39
- return check;
40
- });
41
- return {schema:SCHEMA,schemaVersion:VERSION,checks};
42
- }
43
-
44
- export function evaluateWorldAcceptance(runtime,graph,{unresolvedMutations=undefined,worldRevisionId=null,validationEvidence=null}={}){
45
- if(graph?.schema!==SCHEMA||graph.schemaVersion!==VERSION) throw new TypeError('Unsupported WorldAcceptance graph');
46
- const facts=runtime?.semantic || new SemanticWorldView(runtime);
47
- const evidence=graph.checks.map(check=>{
48
- if(check.kind==='world-valid'){
49
- const validation=validationEvidence || runtime?.validator?.run?.();
50
- return validation?.ok===true ? {id:check.id,kind:check.kind,verified:true,evidence:{validation:structuredClone(validation)}} : {id:check.id,kind:check.kind,verified:false,reason:'WORLD_VALIDATION_FAILED',evidence:validation?structuredClone(validation):null};
51
- }
52
- if(check.kind==='object-exists'){
53
- const entity=facts.entity(check.targetId);
54
- return {id:check.id,kind:check.kind,verified:entity.exists,targetId:check.targetId,source:entity.source,
55
- ...(!entity.exists?{reason:entity.reason}:{})};
56
- }
57
- if(check.kind==='state-equals'){
58
- const fact=facts.state(check.targetId,check.stateKey,check.source ? {source:check.source} : {});
59
- const base={id:check.id,kind:check.kind,targetId:check.targetId,stateKey:check.stateKey,expected:check.value,source:fact.source};
60
- if(fact.status!=='known')return {...base,verified:false,truth:'unknown',reason:fact.reason};
61
- const verified=Object.is(fact.value,check.value);
62
- return {...base,verified,truth:verified?'true':'false',actual:fact.value,...(!verified?{reason:'STATE_MISMATCH'}:{})};
63
- }
64
- if(check.kind==='interaction-verified'){
65
- const projectAction=runtime?.projectCapabilities?.hasAction?.(check.targetId,check.capability.toLowerCase());
66
- const physicalAction=projectAction && runtime?.affordances?.inspect?.(check.targetId)?.actions?.some(action =>
67
- action.action?.toUpperCase() === check.capability && ['interaction','world-action'].includes(action.execution));
68
- if(!check.source && projectAction && physicalAction) {
69
- return {id:check.id,kind:check.kind,verified:false,targetId:check.targetId,
70
- expected:check.capability,reason:'INTERACTION_SOURCE_REQUIRED'};
71
- }
72
- const evidenceSource=check.source==='asset'?'physical-articulation'
73
- :check.source==='project'?'project-defined':check.source || null;
74
- const evidence=getInteractionEvidence(runtime,check.targetId,check.capability,
75
- {worldRevisionId,...(evidenceSource?{source:evidenceSource}:{})});
76
- const verified=Boolean(evidence);
77
- return {id:check.id,kind:check.kind,verified,targetId:check.targetId,expected:check.capability,
78
- ...(check.source?{source:check.source}:{}),...(evidence?{evidence}:{reason:'INTERACTION_NOT_VERIFIED'})};
79
- }
80
- if(check.kind==='relation-exists'){
81
- const fact=facts.relation(check);
82
- return {id:check.id,kind:check.kind,verified:fact.truth==='true',subject:check.subject,predicate:check.predicate,
83
- ...(check.objectAnyOf?{objectAnyOf:check.objectAnyOf}:{object:check.object}),...(check.surfaceId?{surfaceId:check.surfaceId}:{}),
84
- truth:fact.truth,source:fact.source,...(fact.evidenceKind?{evidenceKind:fact.evidenceKind}:{}),
85
- ...(fact.evidence?{evidence:fact.evidence}:{reason:fact.reason})};
86
- }
87
- if (!Array.isArray(unresolvedMutations)) return {id:check.id,kind:check.kind,verified:false,reason:'EVIDENCE_MISSING'};
88
- const verified=unresolvedMutations.length===0;
89
- return {id:check.id,kind:check.kind,verified,...(!verified?{reason:'UNRESOLVED_MUTATIONS',unresolvedCount:unresolvedMutations.length}:{})};
90
- });
91
- const failed=evidence.filter(x=>!x.verified);
92
- return {schema:SCHEMA,schemaVersion:VERSION,status:failed.length?'world-incomplete':'world-accepted',checks:evidence,verifiedCount:evidence.length-failed.length,failedCount:failed.length};
93
- }
94
-
95
- export {SCHEMA as WORLD_ACCEPTANCE_SCHEMA,VERSION as WORLD_ACCEPTANCE_VERSION};
96
-
97
-
98
- export function buildAcceptanceEvidenceBundle(graph,result,{worldRevisionId=null,source='runtime',provenance=null}={}){
99
- if(graph?.schema!==SCHEMA||graph.schemaVersion!==VERSION) throw new TypeError('Unsupported WorldAcceptance graph');
100
- if(!result||typeof result!=='object') throw new TypeError('WorldAcceptance result is required');
101
- return {
102
- schema:'agentscape.acceptance-evidence',schemaVersion:1,required:true,
103
- source,
104
- ...(worldRevisionId?{worldRevisionId}:{}),
105
- ...(provenance?{provenance:structuredClone(provenance)}:{}),
106
- criteria:structuredClone(graph.checks),
107
- result:structuredClone(result),
108
- findings:compileAcceptanceFindings(result,{worldRevisionId})
109
- };
110
- }
111
-
112
-
113
- export function replayAcceptanceEvidence(runtime,evidence,{unresolvedMutations=undefined}={}){
114
- if(!evidence||typeof evidence!=='object'||evidence.schema!=='agentscape.acceptance-evidence'||evidence.schemaVersion!==1) throw new TypeError('Unsupported acceptance evidence bundle');
115
- const graph=compileWorldAcceptance(evidence.criteria || []);
116
- const evidenceRevisionId=clean(evidence.worldRevisionId)||null;
117
- const currentRevisionId=clean(runtime?.currentWorldRevision?.revision?.id)||null;
118
- let bindingReason=null;
119
- if(evidenceRevisionId&&!currentRevisionId) bindingReason='CURRENT_REVISION_UNKNOWN';
120
- else if(!evidenceRevisionId&&currentRevisionId) bindingReason='EVIDENCE_REVISION_MISSING';
121
- else if(evidenceRevisionId&&currentRevisionId&&evidenceRevisionId!==currentRevisionId) bindingReason='WORLD_REVISION_CHANGED';
122
-
123
- let result;
124
- let changedCriteria=[];
125
- if(bindingReason){
126
- result={
127
- schema:SCHEMA,schemaVersion:VERSION,status:'world-incomplete',
128
- checks:[{id:'revision-binding',kind:'revision-binding',verified:false,reason:bindingReason,expected:evidenceRevisionId,actual:currentRevisionId}],
129
- verifiedCount:0,failedCount:1
130
- };
131
- changedCriteria=['revision-binding'];
132
- } else {
133
- result=evaluateWorldAcceptance(runtime,graph,{unresolvedMutations});
134
- const previous=new Map((evidence.result?.checks||[]).map((check)=>[check.id,check]));
135
- changedCriteria=result.checks.filter((check)=>{
136
- const before=previous.get(check.id);
137
- if(!before) return true;
138
- return JSON.stringify([before.verified,before.reason??null,before.actual??null])!==JSON.stringify([check.verified,check.reason??null,check.actual??null]);
139
- }).map((check)=>check.id);
140
- }
141
-
142
- const bundle=buildAcceptanceEvidenceBundle(graph,result,{
143
- worldRevisionId:currentRevisionId||evidenceRevisionId||null,
144
- source:'acceptance-replay',
145
- provenance:runtime?.currentWorldRevision?.provenance || evidence.provenance || null
146
- });
147
- return {
148
- ...result,
149
- replay:{
150
- status:bindingReason?'stale':'replayed',
151
- ...(bindingReason?{reason:bindingReason}:{}),
152
- evidenceRevisionId,currentRevisionId,
153
- previousStatus:evidence.result?.status || null,
154
- changedCriteria
155
- },
156
- acceptanceBundle:bundle
157
- };
158
- }