agentscape3d-engine 0.0.0-stage → 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 (396) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/cli.mjs +53 -0
  4. package/dist/AssetCompiler-A99wKf7H.js +2424 -0
  5. package/dist/AssetCompiler-A99wKf7H.js.map +1 -0
  6. package/dist/AssetInputContracts-uKYeQu-X.js +245 -0
  7. package/dist/AssetInputContracts-uKYeQu-X.js.map +1 -0
  8. package/dist/AssetRecipe-DCaLLXvG.js +67 -0
  9. package/dist/AssetRecipe-DCaLLXvG.js.map +1 -0
  10. package/dist/BrowserCodeWorker.js +53850 -0
  11. package/dist/BrowserCodeWorker.js.map +1 -0
  12. package/dist/KinematicHypothesisScreen-4v7GBwdv.js +241 -0
  13. package/dist/KinematicHypothesisScreen-4v7GBwdv.js.map +1 -0
  14. package/dist/SceneSerializer-CLCzQjL_.js +350 -0
  15. package/dist/SceneSerializer-CLCzQjL_.js.map +1 -0
  16. package/dist/StylePack-CD_BC-Mv.js +6317 -0
  17. package/dist/StylePack-CD_BC-Mv.js.map +1 -0
  18. package/dist/WorldArchive-dYf1OpSe.js +417 -0
  19. package/dist/WorldArchive-dYf1OpSe.js.map +1 -0
  20. package/dist/WorldIO-Dqz4MqTQ.js +149 -0
  21. package/dist/WorldIO-Dqz4MqTQ.js.map +1 -0
  22. package/dist/blankWorld-OoOvN_IK.js +75 -0
  23. package/dist/blankWorld-OoOvN_IK.js.map +1 -0
  24. package/dist/core.d.ts +68 -0
  25. package/dist/core.js +209 -0
  26. package/dist/core.js.map +1 -0
  27. package/dist/disposeObject3D-B3HCflvO.js +128 -0
  28. package/dist/disposeObject3D-B3HCflvO.js.map +1 -0
  29. package/dist/environments-B1WaICAN.js +4197 -0
  30. package/dist/environments-B1WaICAN.js.map +1 -0
  31. package/dist/gltfIO-BMK1hc2D.js +9 -0
  32. package/dist/gltfIO-BMK1hc2D.js.map +1 -0
  33. package/dist/grandUrbanBlock-Bdjgc6ZT.js +515 -0
  34. package/dist/grandUrbanBlock-Bdjgc6ZT.js.map +1 -0
  35. package/dist/index.d.ts +275 -0
  36. package/dist/index.js +16239 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/magicCabin-DPQi_jh-.js +11019 -0
  39. package/dist/magicCabin-DPQi_jh-.js.map +1 -0
  40. package/dist/mcp.d.ts +2 -0
  41. package/dist/mcp.js +1 -0
  42. package/dist/monumentHall-IOLbRZQC.js +403 -0
  43. package/dist/monumentHall-IOLbRZQC.js.map +1 -0
  44. package/dist/node.d.ts +16 -0
  45. package/dist/node.js +26 -0
  46. package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
  47. package/dist/ruinedCourtyard-BtaF_aOi.js +696 -0
  48. package/dist/ruinedCourtyard-BtaF_aOi.js.map +1 -0
  49. package/dist/runtime/application/AgentTools.js +28 -0
  50. package/dist/runtime/application/README.md +14 -0
  51. package/dist/runtime/application/agent/ProgressiveAgentTools.js +92 -0
  52. package/dist/runtime/application/agent/StudioMcpAllowlist.js +8 -0
  53. package/dist/runtime/application/buildTaskObservation.js +117 -0
  54. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +46 -0
  55. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +35 -0
  56. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +17 -0
  57. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +72 -0
  58. package/dist/runtime/application/createSession.js +66 -0
  59. package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
  60. package/dist/runtime/application/generation/GenerationOrchestrator.js +629 -0
  61. package/dist/runtime/application/generation/GenerationRuntime.js +214 -0
  62. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +285 -0
  63. package/dist/runtime/application/native-scene/CodeProject.js +119 -0
  64. package/dist/runtime/application/native-scene/CodeProjectModules.js +128 -0
  65. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +62 -0
  66. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
  67. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
  68. package/dist/runtime/application/native-scene/NativeSceneHost.js +319 -0
  69. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
  70. package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
  71. package/dist/runtime/application/object-forge/SceneObjectForge.js +232 -0
  72. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +59 -0
  73. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +22 -0
  74. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +40 -0
  75. package/dist/runtime/application/scene/CapabilityResolver.js +79 -0
  76. package/dist/runtime/application/scene/RequestWindow.js +54 -0
  77. package/dist/runtime/application/scene/SceneAgentTools.js +21 -0
  78. package/dist/runtime/application/scene/SceneContracts.js +45 -0
  79. package/dist/runtime/application/scene/SceneEditService.js +144 -0
  80. package/dist/runtime/application/scene/SceneFacade.js +261 -0
  81. package/dist/runtime/application/scene/SceneInteractionAdapters.js +40 -0
  82. package/dist/runtime/application/scene/SceneJobController.js +229 -0
  83. package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
  84. package/dist/runtime/application/scene/ScenePackage.js +162 -0
  85. package/dist/runtime/application/scene/ScenePersistence.js +50 -0
  86. package/dist/runtime/application/scene/SceneProject.js +95 -0
  87. package/dist/runtime/application/scene/SceneSkillNames.js +5 -0
  88. package/dist/runtime/application/scene/StarterScene.js +56 -0
  89. package/dist/runtime/application/scene/WorldArchive.js +87 -0
  90. package/dist/runtime/application/scene/WorldDirectory.js +20 -0
  91. package/dist/runtime/application/scene/WorldDocument.js +74 -0
  92. package/dist/runtime/application/scene/WorldIO.js +103 -0
  93. package/dist/runtime/application/scene/WorldStorage.js +137 -0
  94. package/dist/runtime/application/skills/SkillRegistry.js +189 -0
  95. package/dist/runtime/application/skills/packs/acceptanceSkills.js +32 -0
  96. package/dist/runtime/application/skills/packs/affordanceSkills.js +36 -0
  97. package/dist/runtime/application/skills/packs/assetSkills.js +46 -0
  98. package/dist/runtime/application/skills/packs/authoringSkills.js +16 -0
  99. package/dist/runtime/application/skills/packs/batchSkills.js +22 -0
  100. package/dist/runtime/application/skills/packs/codeSkills.js +106 -0
  101. package/dist/runtime/application/skills/packs/generationSkills.js +45 -0
  102. package/dist/runtime/application/skills/packs/interactionSkills.js +46 -0
  103. package/dist/runtime/application/skills/packs/recoverySkills.js +80 -0
  104. package/dist/runtime/application/skills/packs/sceneSkills.js +24 -0
  105. package/dist/runtime/application/skills/packs/spatialSkills.js +35 -0
  106. package/dist/runtime/application/skills/packs/verificationSkills.js +14 -0
  107. package/dist/runtime/application/skills/packs/worldSkills.js +45 -0
  108. package/dist/runtime/application/skills/registerCoreSkills.js +31 -0
  109. package/dist/runtime/application/skills/skillPrimitives.js +4 -0
  110. package/dist/runtime/application/tasks/CabinetCupTask.js +76 -0
  111. package/dist/runtime/application/tasks.jsonl +67 -0
  112. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +42 -0
  113. package/dist/runtime/application/world-authoring/AuthoringDiff.js +149 -0
  114. package/dist/runtime/application/world-authoring/AuthoringDocument.js +825 -0
  115. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +109 -0
  116. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +17 -0
  117. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +29 -0
  118. package/dist/runtime/application/world-authoring/AuthoringPatch.js +118 -0
  119. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +334 -0
  120. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +126 -0
  121. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +144 -0
  122. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +174 -0
  123. package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
  124. package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
  125. package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +77 -0
  126. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +1 -0
  127. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +30 -0
  128. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +17 -0
  129. package/dist/runtime/apps/mcp-server/CodeExecutor.js +71 -0
  130. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +42 -0
  131. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +66 -0
  132. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +159 -0
  133. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +8 -0
  134. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +47 -0
  135. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +132 -0
  136. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +6 -0
  137. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +116 -0
  138. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +60 -0
  139. package/dist/runtime/apps/mcp-server/README.md +150 -0
  140. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +1 -0
  141. package/dist/runtime/apps/mcp-server/SandboxBundle.js +13 -0
  142. package/dist/runtime/apps/mcp-server/SessionManager.js +80 -0
  143. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +58 -0
  144. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +190 -0
  145. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +16 -0
  146. package/dist/runtime/apps/mcp-server/VALIDATION.md +45 -0
  147. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +332 -0
  148. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +32 -0
  149. package/dist/runtime/apps/mcp-server/examples/code-house.js +24 -0
  150. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +85 -0
  151. package/dist/runtime/apps/mcp-server/main.mjs +65 -0
  152. package/dist/runtime/apps/mcp-server/registerTools.js +225 -0
  153. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
  154. package/dist/runtime/apps/mcp-server/security.js +21 -0
  155. package/dist/runtime/apps/mcp-server/tasks.jsonl +9 -0
  156. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +157 -0
  157. package/dist/runtime/apps/server/README.md +7 -0
  158. package/dist/runtime/apps/server/WorldDiskStorage.js +51 -0
  159. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +278 -0
  160. package/dist/runtime/apps/server/tasks.jsonl +10 -0
  161. package/dist/runtime/foundation/EventBus.js +18 -0
  162. package/dist/runtime/foundation/JsonGateway.js +47 -0
  163. package/dist/runtime/foundation/PolicyEngine.js +21 -0
  164. package/dist/runtime/foundation/README.md +7 -0
  165. package/dist/runtime/foundation/TraceRecorder.js +76 -0
  166. package/dist/runtime/foundation/errors.js +8 -0
  167. package/dist/runtime/foundation/simulation/SimulationProfile.js +143 -0
  168. package/dist/runtime/foundation/version.js +2 -0
  169. package/dist/runtime/modules/agent/README.md +11 -0
  170. package/dist/runtime/modules/agent/ToolCallingAgent.js +19 -0
  171. package/dist/runtime/modules/agent/bootstrapWorld.js +10 -0
  172. package/dist/runtime/modules/agent/buildRecoveryProposals.js +533 -0
  173. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +128 -0
  174. package/dist/runtime/modules/agent/execution/AgentRunResults.js +55 -0
  175. package/dist/runtime/modules/agent/execution/AgentRunSession.js +393 -0
  176. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +40 -0
  177. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +19 -0
  178. package/dist/runtime/modules/agent/prompt/index.js +52 -0
  179. package/dist/runtime/modules/agent/tasks.jsonl +94 -0
  180. package/dist/runtime/modules/artifact/ArtifactContentGate.js +144 -0
  181. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +280 -0
  182. package/dist/runtime/modules/artifact/ArtifactImporter.js +185 -0
  183. package/dist/runtime/modules/artifact/ArtifactModule.js +111 -0
  184. package/dist/runtime/modules/artifact/ArtifactRegistry.js +197 -0
  185. package/dist/runtime/modules/artifact/IncrementalSha256.js +129 -0
  186. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +115 -0
  187. package/dist/runtime/modules/artifact/README.md +7 -0
  188. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +67 -0
  189. package/dist/runtime/modules/artifact/tasks.jsonl +31 -0
  190. package/dist/runtime/modules/asset/AssetModule.js +399 -0
  191. package/dist/runtime/modules/asset/README.md +54 -0
  192. package/dist/runtime/modules/asset/loading/AssetLoader.js +157 -0
  193. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +61 -0
  194. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +95 -0
  195. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +33 -0
  196. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +103 -0
  197. package/dist/runtime/modules/asset/model/AssetInputContracts.js +100 -0
  198. package/dist/runtime/modules/asset/model/AssetRef.js +12 -0
  199. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +172 -0
  200. package/dist/runtime/modules/asset/model/admission.js +117 -0
  201. package/dist/runtime/modules/asset/model/errors.js +6 -0
  202. package/dist/runtime/modules/asset/model/parts.js +27 -0
  203. package/dist/runtime/modules/asset/model/resourceBudget.js +10 -0
  204. package/dist/runtime/modules/asset/model/schema.js +150 -0
  205. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +78 -0
  206. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +84 -0
  207. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +86 -0
  208. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +81 -0
  209. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +272 -0
  210. package/dist/runtime/modules/asset/production/AssetRecipe.js +47 -0
  211. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +45 -0
  212. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +590 -0
  213. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +173 -0
  214. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +124 -0
  215. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +56 -0
  216. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +6 -0
  217. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +74 -0
  218. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +63 -0
  219. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +48 -0
  220. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +16 -0
  221. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +30 -0
  222. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +75 -0
  223. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +20 -0
  224. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +34 -0
  225. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +32 -0
  226. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +116 -0
  227. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +84 -0
  228. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +63 -0
  229. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +16 -0
  230. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +23 -0
  231. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +50 -0
  232. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +60 -0
  233. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +93 -0
  234. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +32 -0
  235. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +55 -0
  236. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +203 -0
  237. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +43 -0
  238. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +33 -0
  239. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +60 -0
  240. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +23 -0
  241. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +198 -0
  242. package/dist/runtime/modules/asset/registry/AssetCatalog.js +72 -0
  243. package/dist/runtime/modules/asset/registry/AssetRegistry.js +51 -0
  244. package/dist/runtime/modules/asset/registry/manifests/index.js +173 -0
  245. package/dist/runtime/modules/asset/tasks.jsonl +87 -0
  246. package/dist/runtime/modules/generation/README.md +9 -0
  247. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +45 -0
  248. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +169 -0
  249. package/dist/runtime/modules/generation/connector/ConnectorClient.js +192 -0
  250. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +167 -0
  251. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +179 -0
  252. package/dist/runtime/modules/generation/connector/ConnectorSession.js +202 -0
  253. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +239 -0
  254. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +99 -0
  255. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +91 -0
  256. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +50 -0
  257. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +304 -0
  258. package/dist/runtime/modules/generation/tasks.jsonl +35 -0
  259. package/dist/runtime/modules/navigation/NavigationBackend.js +17 -0
  260. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +245 -0
  261. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
  262. package/dist/runtime/modules/physics/PhysicsApiSurface.js +651 -0
  263. package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
  264. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +410 -0
  265. package/dist/runtime/modules/rendering/README.md +7 -0
  266. package/dist/runtime/modules/rendering/RendererProbe.js +153 -0
  267. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +140 -0
  268. package/dist/runtime/modules/rendering/createRenderer.js +76 -0
  269. package/dist/runtime/modules/rendering/disposeObject3D.js +37 -0
  270. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +74 -0
  271. package/dist/runtime/modules/rendering/spatial/ThreeBvhRuntime.js +107 -0
  272. package/dist/runtime/modules/rendering/style/StylePack.js +34 -0
  273. package/dist/runtime/modules/rendering/style/StyleSystem.js +173 -0
  274. package/dist/runtime/modules/rendering/tasks.jsonl +7 -0
  275. package/dist/runtime/modules/world/README.md +13 -0
  276. package/dist/runtime/modules/world/build/WorldBuilder.js +170 -0
  277. package/dist/runtime/modules/world/compiler/PipelineEngine.js +32 -0
  278. package/dist/runtime/modules/world/compiler/WorldAdmission.js +43 -0
  279. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +68 -0
  280. package/dist/runtime/modules/world/compiler/WorldCompilation.js +157 -0
  281. package/dist/runtime/modules/world/compiler/WorldComposer.js +201 -0
  282. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +76 -0
  283. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +356 -0
  284. package/dist/runtime/modules/world/compiler/WorldRetry.js +75 -0
  285. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +379 -0
  286. package/dist/runtime/modules/world/content/blankWorld.js +35 -0
  287. package/dist/runtime/modules/world/content/environments.js +84 -0
  288. package/dist/runtime/modules/world/content/grandUrbanBlock.js +189 -0
  289. package/dist/runtime/modules/world/content/magic-cabin/README.md +28 -0
  290. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +64 -0
  291. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +7078 -0
  292. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +26 -0
  293. package/dist/runtime/modules/world/content/magic-cabin/materials.js +20 -0
  294. package/dist/runtime/modules/world/content/magicCabin.js +190 -0
  295. package/dist/runtime/modules/world/content/monumentHall.js +154 -0
  296. package/dist/runtime/modules/world/content/ruinedCourtyard.js +196 -0
  297. package/dist/runtime/modules/world/content/suzhouGarden/README.md +141 -0
  298. package/dist/runtime/modules/world/content/suzhouGarden/index.js +137 -0
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +491 -0
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +670 -0
  301. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +578 -0
  302. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +127 -0
  303. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +642 -0
  304. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +650 -0
  305. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +280 -0
  306. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +242 -0
  307. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +215 -0
  308. package/dist/runtime/modules/world/content/woodlandWorkshop.js +192 -0
  309. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +36 -0
  310. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +351 -0
  311. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +490 -0
  312. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +505 -0
  313. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +101 -0
  314. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +435 -0
  315. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +169 -0
  316. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +245 -0
  317. package/dist/runtime/modules/world/errors.js +9 -0
  318. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +50 -0
  319. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +297 -0
  320. package/dist/runtime/modules/world/runtime/CommandHistory.js +80 -0
  321. package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +150 -0
  322. package/dist/runtime/modules/world/runtime/ObjectStore.js +31 -0
  323. package/dist/runtime/modules/world/runtime/ObjectTransform.js +62 -0
  324. package/dist/runtime/modules/world/runtime/ObservedEntity.js +37 -0
  325. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +207 -0
  326. package/dist/runtime/modules/world/runtime/SceneSerializer.js +246 -0
  327. package/dist/runtime/modules/world/runtime/WorldAuthority.js +41 -0
  328. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +14 -0
  329. package/dist/runtime/modules/world/runtime/WorldCommands.js +502 -0
  330. package/dist/runtime/modules/world/runtime/WorldObservation.js +71 -0
  331. package/dist/runtime/modules/world/runtime/WorldQueries.js +340 -0
  332. package/dist/runtime/modules/world/runtime/WorldRecovery.js +78 -0
  333. package/dist/runtime/modules/world/runtime/WorldRuntime.js +665 -0
  334. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +107 -0
  335. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +130 -0
  336. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +79 -0
  337. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +195 -0
  338. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +70 -0
  339. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +115 -0
  340. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +305 -0
  341. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +214 -0
  342. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +65 -0
  343. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +222 -0
  344. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +130 -0
  345. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
  346. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
  347. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +120 -0
  348. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +102 -0
  349. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
  350. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +99 -0
  351. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
  352. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
  353. package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +125 -0
  354. package/dist/runtime/modules/world/runtime/systems/Instrument.js +38 -0
  355. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +728 -0
  356. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +269 -0
  357. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +469 -0
  358. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1673 -0
  359. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +457 -0
  360. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +284 -0
  361. package/dist/runtime/modules/world/spec/WorldIR.js +165 -0
  362. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +86 -0
  363. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +51 -0
  364. package/dist/runtime/modules/world/spec/WorldRevision.js +231 -0
  365. package/dist/runtime/modules/world/spec/WorldSpec.js +86 -0
  366. package/dist/runtime/modules/world/tasks.jsonl +530 -0
  367. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +254 -0
  368. package/dist/runtime/modules/world/verification/Finding.js +105 -0
  369. package/dist/runtime/modules/world/verification/InteractionEvidence.js +69 -0
  370. package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
  371. package/dist/runtime/modules/world/verification/WorldAcceptance.js +158 -0
  372. package/dist/runtime/modules/world/verification/WorldValidator.js +65 -0
  373. package/dist/runtime/package-lock.json +16048 -0
  374. package/dist/runtime/package.json +105 -0
  375. package/dist/runtime/public/assets/cabinet.glb +0 -0
  376. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  377. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  379. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  380. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  381. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  382. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  383. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  384. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  385. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  386. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  387. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  388. package/dist/schema-BWpTl0Wj.js +359 -0
  389. package/dist/schema-BWpTl0Wj.js.map +1 -0
  390. package/dist/suzhouGarden-H9tiPgxq.js +6150 -0
  391. package/dist/suzhouGarden-H9tiPgxq.js.map +1 -0
  392. package/dist/woodlandWorkshop-D6zzSbHr.js +483 -0
  393. package/dist/woodlandWorkshop-D6zzSbHr.js.map +1 -0
  394. package/dist/yuanmingyuan-D6IHqjZ-.js +4955 -0
  395. package/dist/yuanmingyuan-D6IHqjZ-.js.map +1 -0
  396. package/package.json +70 -4
@@ -0,0 +1,52 @@
1
+ const BASE_POLICY = `You are AgentScape, a spatial agent controlling an interactive 3D world.
2
+ Use tools instead of inventing world state. Runtime observations, tool results, tool JSON schemas, and tool descriptions are authoritative. Never invent parameters, unsupported fields, provider topology, object state, verification evidence, or world truth that the current tool contracts do not expose.
3
+ Inspect only when current task context is insufficient. Prefer semantic relations over raw coordinates when relations answer the question. Do not issue read tools merely to reproduce evidence already present in the compact task observation.`;
4
+
5
+ const MUTATION_POLICY = `Treat every world-changing tool as a transaction boundary. AgentScape forces a fresh planning round after each mutation, so never assume multiple mutations from one assistant turn will execute in sequence.
6
+ A mutation is complete only when its tool outcome is verified/accepted according to the tool contract. blocked, failed, unverified, request-only, provisional, or error outcomes do not authorize a dependent mutation. Diagnose, recover, retry, or report the task incomplete.
7
+ Never repeat an identical semantic mutation after its latest authoritative outcome is already verified/accepted unless the task observation explicitly marks it unresolved again or later world evidence invalidates it. After a verified mutation satisfies the user's final remaining goal, the next fresh planning round must return the final answer with no tool calls. Do not re-run the final action merely to reconfirm evidence already present in the compact task observation.
8
+ Use executeBatch only for genuinely atomic, synchronously rollback-safe scene edits. Embodied actions, navigation, pickup/drop, articulation, generation jobs, and other long-running actions are not batchable.`;
9
+
10
+ const RECOVERY_POLICY = `Recovery evidence is Runtime-issued and provisional. Contact-at-failure is contact evidence, not proof of unique causality. Never select an alternate articulated action yourself when Runtime has not selected it.
11
+ Use suggestRecoveryActions and the returned eligibility/ranking exactly as scoped by the current failure evidence epoch. Physics counterfactual evidence is trustworthy only at the strength Runtime reports; never upgrade fallback geometry into Physics verification or ignore a third-object/environment veto.
12
+ Execute at most one recovery mutation from the current failure epoch, then fresh-replan and retry the original failed mutation. A successful recovery or cleanup mutation never clears the original unresolved task. Cleanup is housekeeping and must not be reported as completion of the original task.`;
13
+
14
+ const WORLD_POLICY = `For assets, searchAssets before generateAsset. Generation capabilities are discovered through AgentScape Generation/Connector contracts; never assume a particular remote Provider exists. Generated/imported assets may remain provisional and do not prove world validity.
15
+ For a request that explicitly requires a new generated background/world plus interactive assets, prefer buildGeneratedHybridWorld: provide only environmentPrompt and the planner proposal body, and let Runtime own text→image→world generation, verified Artifact import, Environment replacement, revision/provenance, observation-anchor resolution, canonical composition, and rollback. Never manually chain low-level generation jobs, artifact import, environment loading, and spawn to imitate this product path. For multi-object composition in the current Environment, use proposeWorldIR first and submit only the Runtime-issued World IR to runWorldPipeline after a fresh planning round. Revision/provenance lineage is Runtime-owned. Tool schemas are the sole authority for World IR fields; never invent unsupported constraints or state evidence.
16
+ runWorldPipeline is the canonical mutation/admission boundary. world-ready is verified; world-provisional remains unverified; world-rejected is failure. The Runtime may perform its own bounded missing-asset generation retry. Do not bypass canonical world admission by manually chaining low-level generation and spawn operations and then claiming completion.
17
+ Persisted acceptance evidence is historical after restore. Use replayWorldAcceptance before relying on it. For a bounded rejected revision, use Runtime-issued proposeWorldRevision/recompileWorldRevision contracts rather than authoring base revision identity or Finding scope yourself.`;
18
+
19
+ const CREATIVE_POLICY = `For original 3D content, choose authoring tools by the requested fidelity and behavior. addSceneModel Asset Recipe is bounded low-poly geometry (box/sphere/ellipsoid/cylinder/tapered-cylinder/endpoint segment, at most 64 parts). For complex organic silhouettes, dense foliage, intricate branches, materials, procedural variation, shaders or animation, prefer Studio code projects when the user asks for a new self-contained scene or explicitly permits switching from the built-in Scene. If the user wants a new detailed asset inserted into the existing built-in Scene, first search existing assets and inspect generation capabilities; use the approved asset-generation/import/admission path if available. Do not silently switch the user's existing world to a separate Studio code project or claim a visual decoration is a physically interactive asset. If neither approved generation nor sufficient Recipe fidelity is available, explain that limitation. First readStudioProject for the current revision and supported Three.js API. For substantial procedural projects with no existing draft, call writeStudioProject with create:true and a name, omitting source to create the small default scaffold; then replace the placeholder by incremental editStudioFile or coordinated preview/applyStudioProjectBatch edits. Put shared procedural geometry in separate source files and keep each edit focused instead of generating an entire huge scene in one response. Read the latest revision before each edit, then run, inspect the result, repair errors, and save. A standalone Studio code project is a different world from the built-in Scene: never claim that it inserted an asset into the built-in Scene. Physics and interactions need independent asset admission and Runtime verification.`;
20
+
21
+ const EMBODIED_POLICY = `Prefer Runtime placement/navigation/interaction tools over guessed coordinates. For ObjectStore assets, use navigateTo for embodied movement to an explicit world coordinate, moveForward for relative movement such as "walk forward a little", approachAndInteract for open/close, approachAndPickup for pickup and approachAndPlace for placing a held object. Never invent absolute coordinates for relative movement and never navigate an agent to its own id; if moveForward is unavailable, report that relative movement is unsupported instead of fabricating a target. For "what interactive objects are near you", call listInteractablesNearMe once instead of manually chaining canReach/listObjects. These high-level tools own interaction-pose search, navigation, Physics checks, live completion, settle, and post-condition verification as documented by their tool contracts.
22
+ When the task already names the actor and an ObjectStore asset target, call the matching high-level embodied tool directly. For open/close, do not call listObjects, findInteractionPose, or navigateTo first; call approachAndInteract directly. For pickup, call approachAndPickup directly. For placing a currently held object onto a named support, call approachAndPlace directly. Use listObjects or diagnostic spatial tools only when an id/target is genuinely unknown, or after a high-level embodied action fails and diagnosis/recovery is required. Do not duplicate navigation already owned by a high-level embodied tool.
23
+ Do not reinterpret request-only articulation as completion. Do not confuse held ownership with grasp-force verification. Do not confuse supportId with the held object or surfaceId with an object id. Use low-level scene primitives only when the task actually requires low-level editing rather than embodied execution.`;
24
+
25
+ const AFFORDANCE_POLICY = `An environment can also expose worldAffordances in the task observation. listWorldAffordances and inspectWorldAffordance discover both ObjectStore assets (source=asset) and environment contracts (source=environment). Use source and each action execution field to choose the executor: asset interaction actions use the existing approachAndPickup/approachAndPlace/approachAndInteract tools; world-action uses executeWorldAction. Editor actions are scene edits, not embodied physics. available=null means actor reach was not checked; EXECUTOR_UNAVAILABLE actions cannot be executed. These objects are discovered with listWorldAffordances and inspected with inspectWorldAffordance; listObjects is only the ObjectStore asset index. For an environment affordance such as cabin:front-door, use executeWorldAction with its discovered action, not approachAndInteract or other asset-only tools. Native Three.js scene interactives (chairs, ornaments, mirror, etc. in magic cabin) appear in listInteractablesNearMe.nativeInteractables / listEnvironmentInteractables: for a named interactionId use approachAndActivateEnvironmentInteract as the single embodied tool (Runtime owns pathfinding + reach + activation). If already within 1.5m, activateEnvironmentInteract is allowed. When contractId exists the activation may route through executeWorldAction verification; native-provisional activations are not force-verified articulation. After a door/path-changing activation returns navigationInvalidated=true, you MUST fresh-replan and call navigateTo/findPath again before entering the house or going upstairs; do not reuse an old path. navigateTo end must be a world-coordinate array like [-2, 3.12, 0] for cabin second floor — never pass the agent id as the destination. If approach reports unreachable, call findEnvironmentInteractApproach for diagnostics instead of inventing coordinates. Never navigate an agent to its own id. Respect reach and occlusion conditions. navigateTo may approach a reachable floor position near the observed target; the target's own position is not necessarily a standable floor point. Do not teleport to bypass blocked access. Report unsupported cross-floor access instead of inventing a route.
26
+ Only world-action-completed with verified=true confirms this contract's state post-condition. physicsVerified=false and evidenceKind=animated-transform/device-state/text-state never mean force-verified articulation, pickup, support, or containment. Decorative click animations are not Agent capabilities. Discover actual ids and actions instead of guessing capability from appearance.`;
27
+
28
+ export const AGENT_POLICIES = Object.freeze([
29
+ BASE_POLICY,
30
+ MUTATION_POLICY,
31
+ RECOVERY_POLICY,
32
+ WORLD_POLICY,
33
+ CREATIVE_POLICY,
34
+ EMBODIED_POLICY,
35
+ AFFORDANCE_POLICY
36
+ ]);
37
+
38
+ export function buildAgentSystemPrompt(toolDefinitions=[]) {
39
+ const tools=toolDefinitions.map((tool)=>tool.name).filter(Boolean);
40
+ const sceneTasks=tools.includes('planSceneTask') ? `For a multi-object goal such as tidying a room, use the fresh context.scene as the authoritative current world, relations, selected Agent and affordances. Declare planSceneTask with one verifiable relation/state criterion per intended object outcome and optional dependencies, not a fixed action sequence. Discover IDs from this observation; never assume demo IDs or add objects to make the task appear complete. Use objectAnyOf only for observed supports that are genuinely equivalent under the user's goal. Keep these declared goals immutable.
41
+ Use interactScene with goalId and the selected actor for each embodied action. It shares Scene API jobs with Studio and MCP and awaits verification. After each action, choose the next unsatisfied goal from fresh context.task.plan.verification and current carry/relations. OUT_OF_REACH/OCCLUDED with canApproach allows the high-level operation to plan an approach; it never permits teleporting. Environment contracts also approach automatically. A navigation-invalidating action requires fresh path planning.
42
+ On collision, unreachable or failed placement, inspect the returned evidence and choose an eligible recovery, another route or an equivalent declared support. Retry only after meaningful new evidence; unchanged failures are bounded. Do not replay a stale batch, clear failed outcomes yourself, weaken goals, or claim task completion merely because the last action succeeded. Completion requires every declared goal to pass current Runtime verification. If ambiguity or missing capabilities prevent a justified plan, report the unresolved scope honestly. Read-only questions do not need a task plan.` : '';
43
+ const availability=tools.length
44
+ ? `Available tools for this run are supplied as structured contracts: ${tools.join(', ')}. Do not assume any tool not in this list exists.`
45
+ : 'Available tools are supplied separately as structured contracts.';
46
+ const discovery = tools.includes('discoverAgentTools')
47
+ ? 'Tool schemas are progressively disclosed. If necessary tools are missing, call discoverAgentTools with {} to inspect available names, then call it with names:[...] to make the selected tools available next planning round. Never invent schemas for hidden tools.'
48
+ : '';
49
+ const projects = `A code project may expose context.scene.project.entities with source=project. These are native project-owned objects, not necessarily physical Agent assets. Discover their custom action names, JSON parameter schemas and availability from observeScene/inspect; invoke through interactScene with interaction={action:'custom',target,name,args} and a declared goalId. Actor is optional for project actions; the project defines its own access policy. A project may explicitly implement teleportation or other nonphysical behavior; do not use that as evidence of physical walking or use editor transforms to bypass embodied restrictions. A succeeded project action without a verifier is accepted execution, not verified success. Verification marked project-defined is a project callback's verdict, never physics verification. Check declared goals against fresh state before claiming task completion.`;
50
+ const studioProjects=tools.includes('readStudioProject') ? `Studio supports full executable code worlds. For creative coding, custom shaders, animation, games or new behaviors, use readStudioProject for the entry-source preview, file manifest and createProject guide. For multi-file worlds use readStudioFile to inspect paths. Prefer previewStudioProjectBatch({expectedRevision,operations:[{kind:'file',action:'create|write|patch|rename|delete',path,...}]}) to stage all related modifications, inspect bounded diffs, then applyStudioProjectBatch({previewId,expectedRevision}) to commit one atomic revision. discardStudioProjectBatch cancels a pending preview; undoStudioProjectBatch reverts the latest applied batch before any subsequent edits. Individual editStudioFile and editStudioResource remain for isolated changes. writeStudioProject can create/edit the main draft and patchStudioProject changes a unique source fragment. Always runStudioProject to activate and saveStudioProject to persist. These tools are a separate complete-code workflow from asset/world admission; do not force code projects through World IR or the static authoring executor. Read the current revision before editing and pass expectedRevision. Source edits are not live until run. Report compilation/setup errors and repair the draft; the previous running world stays active. Save after the requested runtime changes, not before. These are trusted scripts with arbitrary JS and optional verification; do not claim physics guarantees from successful execution.` : '';
51
+ return [...AGENT_POLICIES,availability,discovery,sceneTasks,projects,studioProjects,'Keep the final response concise.'].filter(Boolean).join('\n\n');
52
+ }
@@ -0,0 +1,94 @@
1
+ {"id": "AGENT-026", "type": "test", "title": "冗余 JSON quoted actorId 自动 unwrap", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["\"agent_01\"→agent_01"]}
2
+ {"id": "AGENT-027", "type": "test", "title": "非字符串/非法 JSON quoted 值不误改", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["原值保持"]}
3
+ {"id": "AGENT-028", "type": "test", "title": "legacy agentId 映射到 actorId", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["agentId 删除"]}
4
+ {"id": "AGENT-029", "type": "test", "title": "approachAndPlace legacy targetId 映射 supportId", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["targetId 删除"]}
5
+ {"id": "AGENT-030", "type": "test", "title": "mutationIdentity object key order deterministic", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["同语义不同 key order identity 相同"]}
6
+ {"id": "AGENT-031", "type": "test", "title": "mutationIdentity 纳入 resolved partName", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["不同 part 不碰撞"]}
7
+ {"id": "AGENT-032", "type": "test", "title": "worldPlanIdentity 忽略 revision/provenance 只看语义", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["换 revision 重提交仍识别重复"]}
8
+ {"id": "AGENT-033", "type": "test", "title": "Agent 无 configured gateway fail-fast", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["AGENT_CAPABILITY_UNAVAILABLE"]}
9
+ {"id": "AGENT-034", "type": "test", "title": "每 planning round 开始都调用 listObjects", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["world change 后不是旧 cache"]}
10
+ {"id": "AGENT-035", "type": "test", "title": "mutation 后 context 只发 compact world index", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["不重复大 world payload"]}
11
+ {"id": "AGENT-036", "type": "test", "title": "无 mutation 时 context 可给完整当前 world", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["首轮可观察实体"]}
12
+ {"id": "AGENT-037", "type": "test", "title": "maxSteps 正确限制 planning round 数", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["超限 bounded termination"]}
13
+ {"id": "AGENT-038", "type": "test", "title": "gateway response 的 toolCalls 全部 normalize 后再执行", "status": "DONE", "priority": "P1", "path": "agent", "depends": ["AGENT-026"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["handler 收到 canonical args"]}
14
+ {"id": "AGENT-039", "type": "test", "title": "tool invocation throw 被编码为 TOOL_ERROR 并进入 outcome", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["loop 可继续/replan"]}
15
+ {"id": "AGENT-040", "type": "test", "title": "tool result undefined 规范化为 {ok:true}", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["JSON 序列化稳定"]}
16
+ {"id": "AGENT-041", "type": "test", "title": "同一 LLM response 中第一个 mutation 后后续 mutation 不执行", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["reason=REPLAN_REQUIRED_AFTER_WORLD_CHANGE"]}
17
+ {"id": "AGENT-042", "type": "test", "title": "mutation 后后续 read-only call 也按 barrier 策略跳过", "status": "DONE", "priority": "P0", "path": "agent", "depends": ["AGENT-041"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["fresh planning round required"]}
18
+ {"id": "AGENT-043", "type": "test", "title": "verified mutation 从 unresolved map 删除", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["unresolved count=0"]}
19
+ {"id": "AGENT-044", "type": "test", "title": "blocked/failed/unverified mutation 进入 unresolved map", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["identity+outcome 保留"]}
20
+ {"id": "AGENT-045", "type": "test", "title": "invocationFailed 不制造错误 unresolved identity", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["tool transport failure 与 world mutation failure 分离"]}
21
+ {"id": "AGENT-046", "type": "test", "title": "LLM 直接给最终文本但有 unresolved mutation → taskStatus=incomplete", "status": "DONE", "priority": "P0", "path": "agent", "depends": ["AGENT-044"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["不信模型“完成了”"]}
22
+ {"id": "AGENT-047", "type": "test", "title": "最后 mutation verified 且无 unresolved → completed", "status": "DONE", "priority": "P0", "path": "agent", "depends": ["AGENT-043"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["taskStatus=completed"]}
23
+ {"id": "AGENT-048", "type": "test", "title": "acceptance required 但缺失/未接受 → incomplete", "status": "READY", "priority": "P0", "path": "agent", "depends": ["VERIFICATION-014"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["final message 改为 acceptance incomplete"]}
24
+ {"id": "AGENT-049", "type": "test", "title": "no-mutation 任务 final 返回 taskStatus=no-mutation", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["read-only 问答不误称 world mutation complete"]}
25
+ {"id": "AGENT-050", "type": "test", "title": "planning limit + unresolved 返回 structured incomplete", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["termination=planning-limit"]}
26
+ {"id": "AGENT-051", "type": "test", "title": "planning limit + 无 unresolved 保持 explicit exceeded error", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["不混淆 incomplete mutation"]}
27
+ {"id": "AGENT-052", "type": "test", "title": "有 proposeWorldIR skill 时禁止直接 runWorldPipeline", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["WORLD_PIPELINE_PROPOSAL_REQUIRED"]}
28
+ {"id": "AGENT-053", "type": "test", "title": "proposeWorldIR 成功后保存 Runtime-issued revision ID", "status": "READY", "priority": "P0", "path": "agent", "depends": ["REVISION-001"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["issued set 可 gate 后续"]}
29
+ {"id": "AGENT-054", "type": "test", "title": "proposal 后强制新 planning round", "status": "READY", "priority": "P0", "path": "agent", "depends": ["AGENT-053"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["同 response 的 pipeline call 被跳过"]}
30
+ {"id": "AGENT-055", "type": "test", "title": "runWorldPipeline 只能使用 issued revision", "status": "READY", "priority": "P0", "path": "agent", "depends": ["AGENT-053"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["fabricated revision 被拒绝"]}
31
+ {"id": "AGENT-056", "type": "test", "title": "完全相同 semantic world plan 换 revision 重提仍被拒绝", "status": "DONE", "priority": "P0", "path": "agent", "depends": ["AGENT-032"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["WORLD_PIPELINE_PLAN_ALREADY_ATTEMPTED"]}
32
+ {"id": "AGENT-057", "type": "test", "title": "world rejection 建立 pending proposal lineage", "status": "READY", "priority": "P1", "path": "agent", "depends": ["WORLD-COMPILER-022"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["parentRevisionId/evidenceRefs 保存"]}
33
+ {"id": "AGENT-058", "type": "test", "title": "rejected pipeline 若有 revisionContext 建 pending bounded repair", "status": "READY", "priority": "P1", "path": "agent", "depends": ["WORLD-RECOMPILER-001"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["baseWorldIR/revisionContext 成对保存"]}
34
+ {"id": "AGENT-059", "type": "test", "title": "无 pending revision repair 时 proposeWorldRevision 被 gate", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["WORLD_REVISION_CONTEXT_REQUIRED"]}
35
+ {"id": "AGENT-060", "type": "test", "title": "bounded revision proposal 后保存 exact signature", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["nextRevisionId→signature map"]}
36
+ {"id": "AGENT-061", "type": "test", "title": "recompileWorldRevision 未先 propose 被拒绝", "status": "DONE", "priority": "P0", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["WORLD_REVISION_PROPOSAL_REQUIRED"]}
37
+ {"id": "AGENT-062", "type": "test", "title": "recompileWorldRevision proposal 被篡改时拒绝", "status": "DONE", "priority": "P0", "path": "agent", "depends": ["AGENT-060"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["WORLD_REVISION_PROPOSAL_TAMPERED"]}
38
+ {"id": "AGENT-063", "type": "test", "title": "verified recompile 清掉对应 base revision unresolved mutation", "status": "READY", "priority": "P1", "path": "agent", "depends": ["WORLD-RECOMPILER-007"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["old unresolved 删除"]}
39
+ {"id": "AGENT-064", "type": "test", "title": "verified world build 后冗余 read-only confirmation 被跳过", "status": "READY", "priority": "P1", "path": "agent", "depends": ["WORLD-COMPILER-024"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["WORLD_READY_REDUNDANT_READ"]}
40
+ {"id": "AGENT-065", "type": "test", "title": "verified world 后真正下一步 mutation 仍允许进入新 round", "status": "READY", "priority": "P1", "path": "agent", "depends": ["AGENT-064"], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["不把 Agent 永久锁死"]}
41
+ {"id": "AGENT-066", "type": "test", "title": "recoveryOriginIdentity 只匹配同 actor/target/part 的 failed interact", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["不跨任务绑定"]}
42
+ {"id": "AGENT-067", "type": "test", "title": "recovery identity 补齐 origin partName", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["recovery ledger 粒度正确"]}
43
+ {"id": "AGENT-068", "type": "test", "title": "同一 recovery 对同一 origin verified 后不可重复执行", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["RECOVERY_ALREADY_APPLIED"]}
44
+ {"id": "AGENT-069", "type": "test", "title": "原 mutation 重试后开启新 recovery evidence epoch", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["applied recoveries 清除"]}
45
+ {"id": "AGENT-070", "type": "test", "title": "mutation 执行后 recoveryReadRounds 重置", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["read budget 新 epoch"]}
46
+ {"id": "AGENT-071", "type": "test", "title": "纯 read-only recovery round 每轮 +1", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["budget accounting 准确"]}
47
+ {"id": "AGENT-072", "type": "test", "title": "达 maxRecoveryReadRounds 后 read-only calls 全跳过", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["termination=recovery-observation-limit"]}
48
+ {"id": "AGENT-073", "type": "test", "title": "recovery observation limit 返回 unresolved snapshot", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["caller 可诊断"]}
49
+ {"id": "AGENT-074", "type": "test", "title": "auxiliary recovery 本身不替原 mutation 清 unresolved", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["必须 retry original"]}
50
+ {"id": "AGENT-075", "type": "test", "title": "auxiliary recovery failed 不加入 applied ledger", "status": "DONE", "priority": "P1", "path": "agent", "depends": [], "files": ["modules/agent/ToolCallingAgent.js"], "criteria": ["可另选 recovery"]}
51
+ {"id": "RECOVERY-001", "type": "test", "title": "非 STALL failure 返回 recovery-unavailable", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["reason=NO_STALL_FAILURE"]}
52
+ {"id": "RECOVERY-002", "type": "test", "title": "无 contact blocker candidate 返回 unavailable", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": ["INTERACTION-077"], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["reason=NO_CONTACT_BLOCKER_CANDIDATE"]}
53
+ {"id": "RECOVERY-003", "type": "test", "title": "environment blocker 永远 ineligible", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["ENVIRONMENT_IMMOVABLE"]}
54
+ {"id": "RECOVERY-004", "type": "test", "title": "不存在 blocker object ineligible", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["BLOCKER_OBJECT_UNAVAILABLE"]}
55
+ {"id": "RECOVERY-005", "type": "test", "title": "stale contact 必须 current sweep overlap 才继续", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["无 persistence→CONTACT_EVIDENCE_STALE"]}
56
+ {"id": "RECOVERY-006", "type": "test", "title": "articulated blocker 缺 joint/targets ineligible", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["ARTICULATED_PART_UNAVAILABLE"]}
57
+ {"id": "RECOVERY-007", "type": "test", "title": "blocker articulation state 未 verified 不执行恢复", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["ARTICULATED_STATE_UNVERIFIED"]}
58
+ {"id": "RECOVERY-008", "type": "test", "title": "blocker articulation 正在 moving 不执行第二动作", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["ARTICULATED_ACTION_PENDING"]}
59
+ {"id": "RECOVERY-009", "type": "test", "title": "无 alternate open/close action ineligible", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["NO_ALTERNATE_ARTICULATED_ACTION"]}
60
+ {"id": "RECOVERY-010", "type": "test", "title": "Policy denied articulated recovery 保留 missing permissions", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": ["AGENT-010"], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["status=denied"]}
61
+ {"id": "RECOVERY-011", "type": "test", "title": "单 alternate action 必须 findInteractionPose 成功", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": ["INTERACTION-029"], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["no pose→ineligible"]}
62
+ {"id": "RECOVERY-012", "type": "test", "title": "world counterfactual 第三对象阻挡则 alternate action ineligible", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": ["PHYSICS-162"], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["THIRD_OBJECT_COUNTERFACTUAL_BLOCKED"]}
63
+ {"id": "RECOVERY-013", "type": "test", "title": "多 alternate action 优先 physics counterfactual ranking", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": ["PHYSICS-165"], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["排名 tuple 稳定"]}
64
+ {"id": "RECOVERY-014", "type": "test", "title": "physics baseline inconsistent 时回退 visual AABB ranking", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["fallbackReason 明确"]}
65
+ {"id": "RECOVERY-015", "type": "test", "title": "counterfactual convergence unstable 时不信 physics ranking", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": ["PHYSICS-168"], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["回退且 reason 稳定"]}
66
+ {"id": "RECOVERY-016", "type": "test", "title": "两 action ranking 完全相同返回 COUNTERFACTUAL_ACTION_TIE", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["不任意选"]}
67
+ {"id": "RECOVERY-017", "type": "test", "title": "pickup blocker 必须 assertCarryable + pickupPlan.transfer.clear", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": ["INTERACTION-051"], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["任一 fail→ineligible"]}
68
+ {"id": "RECOVERY-018", "type": "test", "title": "eligible proposals 先按 routeCost 再 stable blocker key", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["deterministic order"]}
69
+ {"id": "RECOVERY-019", "type": "test", "title": "hands-full recovery-held blocker 时建议 cleanup", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": ["INTERACTION-072"], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["cleanupRecommended provisional"]}
70
+ {"id": "RECOVERY-020", "type": "test", "title": "recovery proposal verification 永远要求 retry original post-condition", "status": "DONE", "priority": "P1", "path": "agent.recovery", "depends": [], "files": ["modules/agent/buildRecoveryProposals.js"], "criteria": ["不以 cleanup 本身等价原任务完成"]}
71
+ {"id": "GATEWAY-001", "type": "test", "title": "HttpLLMGateway 默认 timeout=30s", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["modules/agent/gateway/HttpLLMGateway.js"], "criteria": ["constructor contract fixed"]}
72
+ {"id": "GATEWAY-002", "type": "test", "title": "normalize response 缺 call id 生成稳定 fallback", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["modules/agent/gateway/HttpLLMGateway.js"], "criteria": ["call_0 等"]}
73
+ {"id": "GATEWAY-003", "type": "test", "title": "arguments/args 两种 gateway 字段归一", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["modules/agent/gateway/HttpLLMGateway.js"], "criteria": ["args object canonical"]}
74
+ {"id": "GATEWAY-004", "type": "test", "title": "toolCalls 为空且有 message → final=true", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["modules/agent/gateway/HttpLLMGateway.js"], "criteria": ["response semantic stable"]}
75
+ {"id": "GATEWAY-005", "type": "test", "title": "env loader 不覆盖已存在 process env", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["explicit env wins"]}
76
+ {"id": "GATEWAY-006", "type": "test", "title": "env loader 忽略 comment/empty/invalid line", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["parser stable"]}
77
+ {"id": "GATEWAY-007", "type": "test", "title": "model list trim+dedupe", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["no duplicate fallback call"]}
78
+ {"id": "GATEWAY-008", "type": "test", "title": "空 model chain 拒绝", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["clear error"]}
79
+ {"id": "GATEWAY-009", "type": "test", "title": "tools 转 OpenAI function schema 不丢 parameters", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["strict schema preserved"]}
80
+ {"id": "GATEWAY-010", "type": "test", "title": "assistant toolCalls 转 OpenAI arguments JSON", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["round-trip"]}
81
+ {"id": "GATEWAY-011", "type": "test", "title": "OpenAI invalid JSON tool arguments 拒绝", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["不执行 malformed call"]}
82
+ {"id": "GATEWAY-012", "type": "test", "title": "context 插入 system message 在主 system 后", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["prompt order fixed"]}
83
+ {"id": "GATEWAY-013", "type": "test", "title": "upstream temperature=0 + stream=false", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["deterministic config fixed"]}
84
+ {"id": "GATEWAY-014", "type": "test", "title": "408/425/429/5xx 才切下一个 model", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["retryable set fixed"]}
85
+ {"id": "GATEWAY-015", "type": "test", "title": "4xx 非 retryable 不切 model", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["不放大错误调用"]}
86
+ {"id": "GATEWAY-016", "type": "test", "title": "fetch transport error 可切 fallback model", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["chain continues bounded"]}
87
+ {"id": "GATEWAY-017", "type": "test", "title": "localhost/127.0.0.1/::1 origin 允许", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["local Studio works"]}
88
+ {"id": "GATEWAY-018", "type": "test", "title": "任意公网 origin 默认拒绝", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["403"]}
89
+ {"id": "GATEWAY-019", "type": "test", "title": "explicit allowedOrigins 精确匹配", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["只允许配置 origin"]}
90
+ {"id": "GATEWAY-020", "type": "test", "title": "request >2MiB 在 JSON parse 前拒绝", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["bounded memory"]}
91
+ {"id": "GATEWAY-021", "type": "test", "title": "/health 不返回 API key/base auth", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["只 models/ok"]}
92
+ {"id": "GATEWAY-022", "type": "test", "title": "OPTIONS CORS 正确返回 204", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["local browser preflight pass"]}
93
+ {"id": "GATEWAY-023", "type": "test", "title": "非 /agent POST 返回 404", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["route surface 最小"]}
94
+ {"id": "GATEWAY-024", "type": "test", "title": "gateway bind 默认 127.0.0.1 而非 0.0.0.0", "status": "DONE", "priority": "P1", "path": "agent.gateway", "depends": [], "files": ["apps/server/openai-compatible-agent-gateway.mjs"], "criteria": ["local-only 默认安全"]}
@@ -0,0 +1,144 @@
1
+ import { ArtifactContractError } from './ArtifactDescriptor.js';
2
+
3
+ const ARCHIVE_MIMES=new Set(['application/zip','application/x-zip-compressed','application/x-tar','application/gzip']);
4
+ const FULL_BYTE_MIMES=new Set(['application/json','application/xml','text/xml','text/plain','model/obj']);
5
+ const decoder=()=>new TextDecoder('utf-8',{fatal:true});
6
+
7
+ const formatAllowed=(actual,declared)=>{
8
+ const value=String(declared||'').toLowerCase();
9
+ const allowed={
10
+ glb:new Set(['glb']),json:new Set(['json']),png:new Set(['png']),jpeg:new Set(['jpg','jpeg']),
11
+ webp:new Set(['webp']),ply:new Set(['ply']),spz:new Set(['spz']),xml:new Set(['xml','urdf']),text:new Set(['txt','text','obj']),obj:new Set(['obj'])
12
+ };
13
+ return allowed[actual]?.has(value) ?? false;
14
+ };
15
+
16
+ const fail=(code,message,details={})=>{ throw new ArtifactContractError(code,message,details); };
17
+
18
+ export function artifactContentNeedsFullBytes(mime) {
19
+ return FULL_BYTE_MIMES.has(String(mime||'').toLowerCase());
20
+ }
21
+
22
+ function requirePrefix(prefix,count,label) {
23
+ if (!(prefix instanceof Uint8Array) || prefix.byteLength<count) fail('ARTIFACT_STRUCTURE_INVALID',`${label} artifact is too short`);
24
+ }
25
+
26
+ function validateGlb(prefix,totalBytes) {
27
+ requirePrefix(prefix,20,'GLB');
28
+ if (prefix[0]!==0x67||prefix[1]!==0x6c||prefix[2]!==0x54||prefix[3]!==0x46) fail('ARTIFACT_MIME_MISMATCH','GLB magic does not match model/gltf-binary');
29
+ const view=new DataView(prefix.buffer,prefix.byteOffset,prefix.byteLength);
30
+ const version=view.getUint32(4,true);
31
+ const declaredLength=view.getUint32(8,true);
32
+ const firstChunkLength=view.getUint32(12,true);
33
+ const firstChunkType=view.getUint32(16,true);
34
+ if (version!==2) fail('ARTIFACT_STRUCTURE_INVALID','Only GLB version 2 is supported',{version});
35
+ if (declaredLength!==totalBytes) fail('ARTIFACT_STRUCTURE_INVALID','GLB header length does not match streamed artifact bytes',{declaredLength,totalBytes});
36
+ if (firstChunkType!==0x4e4f534a) fail('ARTIFACT_STRUCTURE_INVALID','GLB first chunk must be JSON');
37
+ if (firstChunkLength<4 || firstChunkLength%4!==0 || 20+firstChunkLength>totalBytes) {
38
+ fail('ARTIFACT_STRUCTURE_INVALID','GLB first JSON chunk length is invalid',{firstChunkLength,totalBytes});
39
+ }
40
+ const inspectEnd=Math.min(prefix.byteLength,20+firstChunkLength);
41
+ let firstJsonByte=null;
42
+ for (let i=20;i<inspectEnd;i++) {
43
+ if (![0x20,0x09,0x0a,0x0d].includes(prefix[i])) { firstJsonByte=prefix[i]; break; }
44
+ }
45
+ if (firstJsonByte!=null && firstJsonByte!==0x7b) {
46
+ fail('ARTIFACT_STRUCTURE_INVALID','GLB JSON chunk must begin with a JSON object');
47
+ }
48
+ return {mime:'model/gltf-binary',format:'glb'};
49
+ }
50
+
51
+ function validatePng(prefix) {
52
+ requirePrefix(prefix,8,'PNG');
53
+ const magic=[0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a];
54
+ if (!magic.every((byte,index)=>prefix[index]===byte)) fail('ARTIFACT_MIME_MISMATCH','PNG signature mismatch');
55
+ return {mime:'image/png',format:'png'};
56
+ }
57
+
58
+ function validateJpeg(prefix) {
59
+ requirePrefix(prefix,3,'JPEG');
60
+ if (prefix[0]!==0xff||prefix[1]!==0xd8||prefix[2]!==0xff) fail('ARTIFACT_MIME_MISMATCH','JPEG signature mismatch');
61
+ return {mime:'image/jpeg',format:'jpeg'};
62
+ }
63
+
64
+ function validateWebp(prefix) {
65
+ requirePrefix(prefix,12,'WebP');
66
+ const text=String.fromCharCode(...prefix.subarray(0,12));
67
+ if (text.slice(0,4)!=='RIFF'||text.slice(8,12)!=='WEBP') fail('ARTIFACT_MIME_MISMATCH','WebP signature mismatch');
68
+ return {mime:'image/webp',format:'webp'};
69
+ }
70
+
71
+ function validatePly(prefix) {
72
+ requirePrefix(prefix,4,'PLY');
73
+ if (prefix[0]!==0x70||prefix[1]!==0x6c||prefix[2]!==0x79||![0x0a,0x0d].includes(prefix[3])) {
74
+ fail('ARTIFACT_MIME_MISMATCH','PLY signature mismatch');
75
+ }
76
+ return {mime:'model/ply',format:'ply'};
77
+ }
78
+
79
+ function validateSpz(prefix) {
80
+ requirePrefix(prefix,4,'SPZ');
81
+ const ngsp=prefix[0]===0x4e&&prefix[1]===0x47&&prefix[2]===0x53&&prefix[3]===0x50;
82
+ const legacyGzip=prefix[0]===0x1f&&prefix[1]===0x8b;
83
+ if (!ngsp&&!legacyGzip) fail('ARTIFACT_MIME_MISMATCH','SPZ signature mismatch');
84
+ return {mime:'model/spz',format:'spz'};
85
+ }
86
+
87
+ function decodeText(fullBytes,label) {
88
+ if (!(fullBytes instanceof Uint8Array)) fail('ARTIFACT_STRUCTURE_INVALID',`${label} validation requires full bounded bytes`);
89
+ let text;
90
+ try { text=decoder().decode(fullBytes); }
91
+ catch { fail('ARTIFACT_STRUCTURE_INVALID',`${label} artifact is not valid UTF-8`); }
92
+ if (text.includes('\0')) fail('ARTIFACT_STRUCTURE_INVALID',`${label} artifact contains NUL bytes`);
93
+ return text;
94
+ }
95
+
96
+ function validateJson(fullBytes,{maxJsonDepth,maxJsonNodes}) {
97
+ const text=decodeText(fullBytes,'JSON');
98
+ let value;
99
+ try { value=JSON.parse(text); }
100
+ catch { fail('ARTIFACT_STRUCTURE_INVALID','JSON artifact failed bounded parse'); }
101
+ const stack=[{value,depth:1}];
102
+ let nodes=0;
103
+ while (stack.length) {
104
+ const current=stack.pop();
105
+ nodes++;
106
+ if (nodes>maxJsonNodes) fail('ARTIFACT_STRUCTURE_LIMIT','JSON artifact exceeds maxJsonNodes',{maxJsonNodes});
107
+ if (current.depth>maxJsonDepth) fail('ARTIFACT_STRUCTURE_LIMIT','JSON artifact exceeds maxJsonDepth',{maxJsonDepth});
108
+ if (current.value && typeof current.value==='object') {
109
+ const children=Array.isArray(current.value)?current.value:Object.values(current.value);
110
+ for (const child of children) stack.push({value:child,depth:current.depth+1});
111
+ }
112
+ }
113
+ return {mime:'application/json',format:'json'};
114
+ }
115
+
116
+ function validateXml(fullBytes,mime) {
117
+ const text=decodeText(fullBytes,'XML').trimStart();
118
+ if (!text.startsWith('<')) fail('ARTIFACT_STRUCTURE_INVALID','XML artifact does not begin with markup');
119
+ return {mime,format:'xml'};
120
+ }
121
+
122
+ function validateText(fullBytes,mime) {
123
+ decodeText(fullBytes,'Text');
124
+ return {mime,format:mime==='model/obj'?'obj':'text'};
125
+ }
126
+
127
+ export function validateArtifactContent(descriptor,{prefix,totalBytes,fullBytes=null,maxJsonDepth=64,maxJsonNodes=100000}={}) {
128
+ const mime=String(descriptor?.mime||'').toLowerCase();
129
+ if (ARCHIVE_MIMES.has(mime)) fail('ARTIFACT_ARCHIVE_UNSUPPORTED','Archive artifacts are fail-closed until bounded bundle parsing is implemented',{mime});
130
+ let actual;
131
+ if (mime==='model/gltf-binary') actual=validateGlb(prefix,totalBytes);
132
+ else if (mime==='application/json') actual=validateJson(fullBytes,{maxJsonDepth,maxJsonNodes});
133
+ else if (mime==='image/png') actual=validatePng(prefix);
134
+ else if (mime==='image/jpeg') actual=validateJpeg(prefix);
135
+ else if (mime==='image/webp') actual=validateWebp(prefix);
136
+ else if (mime==='model/ply') actual=validatePly(prefix);
137
+ else if (mime==='model/spz') actual=validateSpz(prefix);
138
+ else if (mime==='application/xml'||mime==='text/xml') actual=validateXml(fullBytes,mime);
139
+ else if (mime==='text/plain'||mime==='model/obj') actual=validateText(fullBytes,mime);
140
+ else fail('ARTIFACT_MIME_UNSUPPORTED','Artifact MIME is not supported by the v1 integrity gate',{mime});
141
+ if (actual.mime!==mime) fail('ARTIFACT_MIME_MISMATCH','Detected artifact MIME does not match descriptor MIME',{expected:mime,actual:actual.mime});
142
+ if (!formatAllowed(actual.format,descriptor.format)) fail('ARTIFACT_FORMAT_MISMATCH','Detected artifact format does not match descriptor format',{expected:descriptor.format,actual:actual.format});
143
+ return actual;
144
+ }