sdd-agent-platform 0.4.0 → 0.4.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 (801) hide show
  1. package/README.md +36 -39
  2. package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js +72 -71
  3. package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js.map +1 -1
  4. package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js +64 -9
  5. package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js.map +1 -1
  6. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js +0 -1
  7. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js.map +1 -1
  8. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js +26 -17
  9. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js.map +1 -1
  10. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.d.ts +3 -0
  11. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js +13 -9
  12. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js.map +1 -1
  13. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.d.ts +3 -1
  14. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js +7 -3
  15. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js.map +1 -1
  16. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.d.ts +4 -4
  17. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js +16 -20
  18. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js.map +1 -1
  19. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.d.ts +1 -1
  20. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js +1 -7
  21. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js.map +1 -1
  22. package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js +26 -8
  23. package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js.map +1 -1
  24. package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js +2 -2
  25. package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js.map +1 -1
  26. package/node_modules/@sdd-agent-platform/core/dist/context-offload/contracts.d.ts +1 -1
  27. package/node_modules/@sdd-agent-platform/core/dist/contracts.d.ts +4 -1
  28. package/node_modules/@sdd-agent-platform/core/dist/contracts.js +3 -0
  29. package/node_modules/@sdd-agent-platform/core/dist/contracts.js.map +1 -1
  30. package/node_modules/@sdd-agent-platform/core/dist/delegation/model.d.ts +3 -0
  31. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.d.ts +3 -0
  32. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js +7 -4
  33. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js.map +1 -1
  34. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js +1 -1
  35. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js.map +1 -1
  36. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js +8 -8
  37. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js.map +1 -1
  38. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js +0 -1
  39. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js.map +1 -1
  40. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js +7 -7
  41. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js.map +1 -1
  42. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js +0 -24
  43. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js.map +1 -1
  44. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js +1 -1
  45. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
  46. package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js +277 -3
  47. package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js.map +1 -1
  48. package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.d.ts +23 -0
  49. package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js +61 -0
  50. package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js.map +1 -0
  51. package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/contracts.d.ts +11 -1
  52. package/node_modules/@sdd-agent-platform/core/dist/execution/agent-execution-records.js +15 -8
  53. package/node_modules/@sdd-agent-platform/core/dist/execution/agent-execution-records.js.map +1 -1
  54. package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js +4 -4
  55. package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js.map +1 -1
  56. package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js +3 -3
  57. package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js.map +1 -1
  58. package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js +5 -4
  59. package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js.map +1 -1
  60. package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js +16 -7
  61. package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js.map +1 -1
  62. package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.d.ts +112 -0
  63. package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js +145 -0
  64. package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js.map +1 -0
  65. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.d.ts +1 -1
  66. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js +1 -1
  67. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js.map +1 -1
  68. package/node_modules/@sdd-agent-platform/core/dist/instructions.d.ts +1 -1
  69. package/node_modules/@sdd-agent-platform/core/dist/instructions.js +59 -66
  70. package/node_modules/@sdd-agent-platform/core/dist/instructions.js.map +1 -1
  71. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js +1 -1
  72. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js.map +1 -1
  73. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.d.ts +3 -0
  74. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js +55 -19
  75. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js.map +1 -1
  76. package/node_modules/@sdd-agent-platform/core/dist/orchestration/contracts.d.ts +1 -1
  77. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.d.ts +12 -2
  78. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js +62 -21
  79. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js.map +1 -1
  80. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.d.ts +20 -2
  81. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js +218 -18
  82. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js.map +1 -1
  83. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js +17 -17
  84. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js.map +1 -1
  85. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.d.ts +10 -0
  86. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js +32 -2
  87. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js.map +1 -1
  88. package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.d.ts +2 -17
  89. package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js +222 -10
  90. package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js.map +1 -1
  91. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.d.ts +1 -1
  92. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js +9 -9
  93. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js.map +1 -1
  94. package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js +4 -4
  95. package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js.map +1 -1
  96. package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js +2 -2
  97. package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js.map +1 -1
  98. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js +3 -3
  99. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js.map +1 -1
  100. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js +2 -2
  101. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js.map +1 -1
  102. package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js +11 -11
  103. package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js.map +1 -1
  104. package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js +12 -12
  105. package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js.map +1 -1
  106. package/node_modules/@sdd-agent-platform/core/dist/risk/contracts.d.ts +2 -2
  107. package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js +4 -4
  108. package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js.map +1 -1
  109. package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js +4 -7
  110. package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js.map +1 -1
  111. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.d.ts +2 -2
  112. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js +19 -17
  113. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js.map +1 -1
  114. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js +28 -13
  115. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js.map +1 -1
  116. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime.d.ts +61 -1
  117. package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.d.ts +3 -1
  118. package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js +192 -1
  119. package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js.map +1 -1
  120. package/node_modules/@sdd-agent-platform/core/dist/router/routing.js +73 -17
  121. package/node_modules/@sdd-agent-platform/core/dist/router/routing.js.map +1 -1
  122. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.d.ts +28 -0
  123. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js +373 -0
  124. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js.map +1 -0
  125. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-inspection.js +11 -4
  126. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-inspection.js.map +1 -1
  127. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js +31 -3
  128. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js.map +1 -1
  129. package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.d.ts +37 -0
  130. package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js +235 -0
  131. package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js.map +1 -0
  132. package/node_modules/@sdd-agent-platform/core/dist/router.d.ts +2 -0
  133. package/node_modules/@sdd-agent-platform/core/dist/router.js +2 -0
  134. package/node_modules/@sdd-agent-platform/core/dist/router.js.map +1 -1
  135. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.d.ts +16 -0
  136. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js +168 -18
  137. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js.map +1 -1
  138. package/node_modules/@sdd-agent-platform/core/dist/run-state/events.js +2 -2
  139. package/node_modules/@sdd-agent-platform/core/dist/run-state/events.js.map +1 -1
  140. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.d.ts +3 -3
  141. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js +22 -54
  142. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js.map +1 -1
  143. package/node_modules/@sdd-agent-platform/core/dist/run-state/invocation-ledger.js +2 -2
  144. package/node_modules/@sdd-agent-platform/core/dist/run-state/invocation-ledger.js.map +1 -1
  145. package/node_modules/@sdd-agent-platform/core/dist/run-state/model.d.ts +53 -9
  146. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.d.ts +0 -2
  147. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js +1 -3
  148. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js.map +1 -1
  149. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js +51 -34
  150. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js.map +1 -1
  151. package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.d.ts +65 -0
  152. package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js +169 -0
  153. package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js.map +1 -0
  154. package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.d.ts +8 -0
  155. package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.js +131 -0
  156. package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.js.map +1 -0
  157. package/node_modules/@sdd-agent-platform/core/dist/run-state.d.ts +2 -0
  158. package/node_modules/@sdd-agent-platform/core/dist/run-state.js +2 -0
  159. package/node_modules/@sdd-agent-platform/core/dist/run-state.js.map +1 -1
  160. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js +0 -3
  161. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js.map +1 -1
  162. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js +5 -44
  163. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js.map +1 -1
  164. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/model.d.ts +1 -17
  165. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.d.ts +20 -0
  166. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js +109 -14
  167. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js.map +1 -1
  168. package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.d.ts +64 -0
  169. package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js +200 -0
  170. package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js.map +1 -0
  171. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/context.js +1 -1
  172. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/context.js.map +1 -1
  173. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.d.ts +6 -0
  174. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js +276 -0
  175. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js.map +1 -0
  176. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.d.ts +1 -1
  177. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js +15 -4
  178. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js.map +1 -1
  179. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.d.ts +21 -0
  180. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js +139 -38
  181. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js.map +1 -1
  182. package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.d.ts +55 -0
  183. package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js +322 -0
  184. package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js.map +1 -0
  185. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.d.ts +55 -0
  186. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js +241 -0
  187. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js.map +1 -0
  188. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.d.ts +888 -0
  189. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js +3870 -0
  190. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js.map +1 -0
  191. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js +8 -1
  192. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js.map +1 -1
  193. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.d.ts +105 -1
  194. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js +343 -8
  195. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js.map +1 -1
  196. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.d.ts +348 -3
  197. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js +1017 -8
  198. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js.map +1 -1
  199. package/node_modules/@sdd-agent-platform/core/dist/subagents/contracts.d.ts +1 -1
  200. package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js +7 -7
  201. package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js.map +1 -1
  202. package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js +21 -0
  203. package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js.map +1 -1
  204. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.d.ts +1 -1
  205. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js +19 -20
  206. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js.map +1 -1
  207. package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.d.ts +44 -0
  208. package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js +138 -0
  209. package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js.map +1 -0
  210. package/node_modules/@sdd-agent-platform/core/dist/tsconfig.tsbuildinfo +1 -1
  211. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.d.ts +0 -1
  212. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js +44 -37
  213. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js.map +1 -1
  214. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.d.ts +0 -2
  215. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js +19 -49
  216. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js.map +1 -1
  217. package/node_modules/@sdd-agent-platform/core/dist/verification/review-gate.d.ts +22 -0
  218. package/node_modules/@sdd-agent-platform/core/dist/verification/review-gate.js +53 -0
  219. package/node_modules/@sdd-agent-platform/core/dist/verification/review-gate.js.map +1 -0
  220. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.d.ts +0 -1
  221. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js +213 -111
  222. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js.map +1 -1
  223. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.d.ts +28 -3
  224. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js +546 -125
  225. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js.map +1 -1
  226. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.d.ts +26 -0
  227. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.js +73 -0
  228. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.js.map +1 -0
  229. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.d.ts +76 -0
  230. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js +450 -0
  231. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js.map +1 -0
  232. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.d.ts +3 -1
  233. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js +105 -30
  234. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js.map +1 -1
  235. package/node_modules/@sdd-agent-platform/core/dist/verification.d.ts +2 -0
  236. package/node_modules/@sdd-agent-platform/core/dist/verification.js +2 -0
  237. package/node_modules/@sdd-agent-platform/core/dist/verification.js.map +1 -1
  238. package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.d.ts +1 -1
  239. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.d.ts +24 -0
  240. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js +395 -0
  241. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js.map +1 -0
  242. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.d.ts +4 -0
  243. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js +164 -0
  244. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js.map +1 -0
  245. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.d.ts +4 -0
  246. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js +182 -0
  247. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js.map +1 -0
  248. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.d.ts +88 -0
  249. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.js +2 -0
  250. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.js.map +1 -0
  251. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.d.ts +1 -1
  252. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js +17 -3
  253. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
  254. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.d.ts +8 -4
  255. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js +25 -11
  256. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js.map +1 -1
  257. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.d.ts +37 -0
  258. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js +188 -0
  259. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js.map +1 -0
  260. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.d.ts +40 -0
  261. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.js +110 -0
  262. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.js.map +1 -0
  263. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.d.ts +12 -0
  264. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.js +63 -0
  265. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.js.map +1 -0
  266. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.d.ts +21 -0
  267. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.js +95 -0
  268. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.js.map +1 -0
  269. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.d.ts +80 -3
  270. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js +674 -41
  271. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js.map +1 -1
  272. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.d.ts +228 -0
  273. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.js +452 -0
  274. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.js.map +1 -0
  275. package/node_modules/@sdd-agent-platform/core/dist/workflow-state.d.ts +1 -0
  276. package/node_modules/@sdd-agent-platform/core/dist/workflow-state.js +1 -0
  277. package/node_modules/@sdd-agent-platform/core/dist/workflow-state.js.map +1 -1
  278. package/node_modules/@sdd-agent-platform/core/package.json +3 -3
  279. package/node_modules/@sdd-agent-platform/core/src/ai-tools.test.ts +49 -1
  280. package/node_modules/@sdd-agent-platform/core/src/ai-tools.ts +72 -71
  281. package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.test.ts +38 -0
  282. package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.ts +65 -9
  283. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-evidence.ts +0 -1
  284. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.test.ts +52 -6
  285. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.ts +26 -17
  286. package/node_modules/@sdd-agent-platform/core/src/config/init-project.test.ts +44 -29
  287. package/node_modules/@sdd-agent-platform/core/src/config/init-project.ts +15 -11
  288. package/node_modules/@sdd-agent-platform/core/src/config/project-config.ts +10 -4
  289. package/node_modules/@sdd-agent-platform/core/src/config/starter-documents.ts +17 -20
  290. package/node_modules/@sdd-agent-platform/core/src/context/build-package.ts +2 -8
  291. package/node_modules/@sdd-agent-platform/core/src/context/context-build.test.ts +3 -2
  292. package/node_modules/@sdd-agent-platform/core/src/context/evidence-summary.ts +27 -8
  293. package/node_modules/@sdd-agent-platform/core/src/context/log-worker.ts +2 -2
  294. package/node_modules/@sdd-agent-platform/core/src/context-offload/contracts.ts +1 -1
  295. package/node_modules/@sdd-agent-platform/core/src/contracts.ts +4 -1
  296. package/node_modules/@sdd-agent-platform/core/src/delegation/model.ts +3 -0
  297. package/node_modules/@sdd-agent-platform/core/src/delegation/validation.ts +8 -5
  298. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/document-chain.ts +1 -1
  299. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/project.ts +8 -8
  300. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/registries.ts +0 -1
  301. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-evidence.ts +7 -7
  302. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-trust.ts +0 -21
  303. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/runtime-contracts.ts +1 -1
  304. package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.test.ts +217 -7
  305. package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.ts +301 -3
  306. package/node_modules/@sdd-agent-platform/core/src/evidence/lookup.ts +88 -0
  307. package/node_modules/@sdd-agent-platform/core/src/evidence-runtime/contracts.ts +12 -1
  308. package/node_modules/@sdd-agent-platform/core/src/execution/agent-execution-records.ts +16 -11
  309. package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.test.ts +57 -2
  310. package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.ts +4 -4
  311. package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.test.ts +11 -2
  312. package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.ts +3 -3
  313. package/node_modules/@sdd-agent-platform/core/src/execution/host-invocation.ts +5 -4
  314. package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.test.ts +17 -1
  315. package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.ts +16 -7
  316. package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.test.ts +102 -0
  317. package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.ts +271 -0
  318. package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.test.ts +14 -0
  319. package/node_modules/@sdd-agent-platform/core/src/governance/policy.test.ts +10 -0
  320. package/node_modules/@sdd-agent-platform/core/src/governance/policy.ts +2 -2
  321. package/node_modules/@sdd-agent-platform/core/src/instructions.test.ts +34 -13
  322. package/node_modules/@sdd-agent-platform/core/src/instructions.ts +60 -67
  323. package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.test.ts +1 -1
  324. package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.ts +1 -1
  325. package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.test.ts +47 -0
  326. package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.ts +58 -19
  327. package/node_modules/@sdd-agent-platform/core/src/orchestration/contracts.ts +1 -1
  328. package/node_modules/@sdd-agent-platform/core/src/orchestration/runtime.ts +74 -22
  329. package/node_modules/@sdd-agent-platform/core/src/phase8-contracts.test.ts +3 -3
  330. package/node_modules/@sdd-agent-platform/core/src/phase8-risk-kernel.test.ts +8 -3
  331. package/node_modules/@sdd-agent-platform/core/src/planning/task-graph.test.ts +2 -0
  332. package/node_modules/@sdd-agent-platform/core/src/planning/wave-plan.test.ts +3 -0
  333. package/node_modules/@sdd-agent-platform/core/src/registries/agent-capability-catalog.ts +319 -20
  334. package/node_modules/@sdd-agent-platform/core/src/registries/agent-registry.ts +17 -17
  335. package/node_modules/@sdd-agent-platform/core/src/registries/agent-runtime-static.ts +42 -2
  336. package/node_modules/@sdd-agent-platform/core/src/registries/capability-sources.ts +238 -15
  337. package/node_modules/@sdd-agent-platform/core/src/registries/command-team-runtime.ts +10 -10
  338. package/node_modules/@sdd-agent-platform/core/src/registries/eval-learning-context.ts +4 -4
  339. package/node_modules/@sdd-agent-platform/core/src/registries/query-status.ts +2 -2
  340. package/node_modules/@sdd-agent-platform/core/src/registries/registries.test.ts +45 -4
  341. package/node_modules/@sdd-agent-platform/core/src/registries/tool-capabilities.ts +3 -3
  342. package/node_modules/@sdd-agent-platform/core/src/registries/tool-plugins.ts +2 -2
  343. package/node_modules/@sdd-agent-platform/core/src/registries/worker-adapters.ts +11 -11
  344. package/node_modules/@sdd-agent-platform/core/src/registries/workflow-gates.ts +12 -12
  345. package/node_modules/@sdd-agent-platform/core/src/risk/contracts.ts +2 -2
  346. package/node_modules/@sdd-agent-platform/core/src/risk/kernel.ts +4 -4
  347. package/node_modules/@sdd-agent-platform/core/src/risk/legacy-adapters.ts +4 -7
  348. package/node_modules/@sdd-agent-platform/core/src/risk/workflow-gates.ts +20 -18
  349. package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime-config.ts +32 -13
  350. package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime.ts +68 -1
  351. package/node_modules/@sdd-agent-platform/core/src/router/route-projection.ts +212 -1
  352. package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.test.ts +391 -6
  353. package/node_modules/@sdd-agent-platform/core/src/router/routing.ts +78 -17
  354. package/node_modules/@sdd-agent-platform/core/src/router/runtime-import.ts +453 -0
  355. package/node_modules/@sdd-agent-platform/core/src/router/runtime-inspection.ts +11 -4
  356. package/node_modules/@sdd-agent-platform/core/src/router/runtime-validation.ts +32 -3
  357. package/node_modules/@sdd-agent-platform/core/src/router/stage-route-binding.ts +279 -0
  358. package/node_modules/@sdd-agent-platform/core/src/router.ts +2 -0
  359. package/node_modules/@sdd-agent-platform/core/src/run-state/artifacts.ts +173 -18
  360. package/node_modules/@sdd-agent-platform/core/src/run-state/events.ts +2 -2
  361. package/node_modules/@sdd-agent-platform/core/src/run-state/inspect-run.ts +24 -59
  362. package/node_modules/@sdd-agent-platform/core/src/run-state/invocation-ledger.ts +2 -2
  363. package/node_modules/@sdd-agent-platform/core/src/run-state/model.ts +59 -9
  364. package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.ts +1 -5
  365. package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.test.ts +53 -2
  366. package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.ts +55 -41
  367. package/node_modules/@sdd-agent-platform/core/src/run-state/task-evidence.ts +252 -0
  368. package/node_modules/@sdd-agent-platform/core/src/run-state/timing.ts +146 -0
  369. package/node_modules/@sdd-agent-platform/core/src/run-state.ts +2 -0
  370. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/build.ts +0 -3
  371. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/findings.ts +6 -46
  372. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/model.ts +1 -13
  373. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.test.ts +0 -2
  374. package/node_modules/@sdd-agent-platform/core/src/runtime-paths.ts +131 -14
  375. package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.test.ts +96 -0
  376. package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.ts +292 -0
  377. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/context.ts +1 -1
  378. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/document-hashes.ts +306 -0
  379. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/run-binding.ts +15 -4
  380. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.test.ts +261 -0
  381. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.ts +169 -41
  382. package/node_modules/@sdd-agent-platform/core/src/stage-artifacts.ts +450 -0
  383. package/node_modules/@sdd-agent-platform/core/src/stage-collaboration-contracts.ts +322 -0
  384. package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.test.ts +2903 -0
  385. package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.ts +5831 -0
  386. package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.test.ts +1 -1
  387. package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.ts +9 -1
  388. package/node_modules/@sdd-agent-platform/core/src/status/project-status.test.ts +239 -16
  389. package/node_modules/@sdd-agent-platform/core/src/status/project-status.ts +497 -8
  390. package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.test.ts +560 -4
  391. package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.ts +1510 -9
  392. package/node_modules/@sdd-agent-platform/core/src/subagents/contracts.ts +1 -1
  393. package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.test.ts +3 -3
  394. package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.ts +7 -7
  395. package/node_modules/@sdd-agent-platform/core/src/test-support/fixtures.ts +21 -0
  396. package/node_modules/@sdd-agent-platform/core/src/test-support/run-state.ts +20 -20
  397. package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.test.ts +72 -0
  398. package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.ts +177 -0
  399. package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.test.ts +13 -87
  400. package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.ts +46 -42
  401. package/node_modules/@sdd-agent-platform/core/src/verification/rendering.ts +18 -52
  402. package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.test.ts +84 -0
  403. package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.ts +77 -0
  404. package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.test.ts +138 -64
  405. package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.ts +226 -116
  406. package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.test.ts +148 -48
  407. package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.ts +619 -136
  408. package/node_modules/@sdd-agent-platform/core/src/verification/validation-cache.ts +106 -0
  409. package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.test.ts +383 -0
  410. package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.ts +556 -0
  411. package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.test.ts +131 -8
  412. package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.ts +117 -30
  413. package/node_modules/@sdd-agent-platform/core/src/verification.ts +2 -0
  414. package/node_modules/@sdd-agent-platform/core/src/work-units/contracts.ts +1 -1
  415. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/evidence-packet.ts +425 -0
  416. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.test.ts +507 -0
  417. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.ts +182 -0
  418. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.test.ts +174 -0
  419. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.ts +194 -0
  420. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/types.ts +115 -0
  421. package/node_modules/@sdd-agent-platform/core/src/workflow-state/affected-file-conflicts.ts +19 -4
  422. package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.test.ts +1 -1
  423. package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.ts +33 -11
  424. package/node_modules/@sdd-agent-platform/core/src/workflow-state/latest-eligible-run.ts +224 -0
  425. package/node_modules/@sdd-agent-platform/core/src/workflow-state/migration-recovery.ts +158 -0
  426. package/node_modules/@sdd-agent-platform/core/src/workflow-state/repair-contract.ts +77 -0
  427. package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve-task-run.ts +114 -0
  428. package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.test.ts +851 -9
  429. package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.ts +862 -45
  430. package/node_modules/@sdd-agent-platform/core/src/workflow-state/runtime-projections.ts +712 -0
  431. package/node_modules/@sdd-agent-platform/core/src/workflow-state.ts +1 -0
  432. package/package.json +1 -1
  433. package/packages/cli/dist/args.js +2 -2
  434. package/packages/cli/dist/args.js.map +1 -1
  435. package/packages/cli/dist/commands/ai-tools.js +13 -2
  436. package/packages/cli/dist/commands/ai-tools.js.map +1 -1
  437. package/packages/cli/dist/commands/context.js +1 -1
  438. package/packages/cli/dist/commands/context.js.map +1 -1
  439. package/packages/cli/dist/commands/execution.js +49 -1
  440. package/packages/cli/dist/commands/execution.js.map +1 -1
  441. package/packages/cli/dist/commands/governance.js +1 -1
  442. package/packages/cli/dist/commands/governance.js.map +1 -1
  443. package/packages/cli/dist/commands/init.js +6 -1
  444. package/packages/cli/dist/commands/init.js.map +1 -1
  445. package/packages/cli/dist/commands/lifecycle.js +15 -2
  446. package/packages/cli/dist/commands/lifecycle.js.map +1 -1
  447. package/packages/cli/dist/commands/registry/runtime.js +48 -2
  448. package/packages/cli/dist/commands/registry/runtime.js.map +1 -1
  449. package/packages/cli/dist/commands/run.js +52 -2
  450. package/packages/cli/dist/commands/run.js.map +1 -1
  451. package/packages/cli/dist/commands/stage-close.d.ts +6 -0
  452. package/packages/cli/dist/commands/stage-close.js +295 -0
  453. package/packages/cli/dist/commands/stage-close.js.map +1 -0
  454. package/packages/cli/dist/commands/status.js +70 -4
  455. package/packages/cli/dist/commands/status.js.map +1 -1
  456. package/packages/cli/dist/commands/tasks.js +4 -4
  457. package/packages/cli/dist/commands/tasks.js.map +1 -1
  458. package/packages/cli/dist/commands/test.js +272 -5
  459. package/packages/cli/dist/commands/test.js.map +1 -1
  460. package/packages/cli/dist/commands/verifies.js +9 -5
  461. package/packages/cli/dist/commands/verifies.js.map +1 -1
  462. package/packages/cli/dist/commands/verify.js +257 -20
  463. package/packages/cli/dist/commands/verify.js.map +1 -1
  464. package/packages/cli/dist/dispatch.js +4 -9
  465. package/packages/cli/dist/dispatch.js.map +1 -1
  466. package/packages/cli/dist/help.js +42 -27
  467. package/packages/cli/dist/help.js.map +1 -1
  468. package/packages/cli/dist/renderers/doctor.js +1 -1
  469. package/packages/cli/dist/renderers/doctor.js.map +1 -1
  470. package/packages/cli/dist/renderers/execution.js +1 -1
  471. package/packages/cli/dist/renderers/execution.js.map +1 -1
  472. package/packages/cli/dist/renderers/json.d.ts +1 -0
  473. package/packages/cli/dist/renderers/json.js +3 -0
  474. package/packages/cli/dist/renderers/json.js.map +1 -1
  475. package/packages/cli/dist/renderers/registry-runtime.d.ts +2 -1
  476. package/packages/cli/dist/renderers/registry-runtime.js +27 -2
  477. package/packages/cli/dist/renderers/registry-runtime.js.map +1 -1
  478. package/packages/cli/dist/renderers/router.js +5 -3
  479. package/packages/cli/dist/renderers/router.js.map +1 -1
  480. package/packages/cli/dist/renderers/workflow.d.ts +0 -4
  481. package/packages/cli/dist/renderers/workflow.js +46 -84
  482. package/packages/cli/dist/renderers/workflow.js.map +1 -1
  483. package/packages/cli/dist/skill-import-args.d.ts +10 -0
  484. package/packages/cli/dist/skill-import-args.js +47 -0
  485. package/packages/cli/dist/skill-import-args.js.map +1 -0
  486. package/packages/cli/dist/tsconfig.tsbuildinfo +1 -1
  487. package/packages/cli/package.json +2 -2
  488. package/packages/core/dist/ai-tools.js +72 -71
  489. package/packages/core/dist/ai-tools.js.map +1 -1
  490. package/packages/core/dist/artifacts/ingestion.js +64 -9
  491. package/packages/core/dist/artifacts/ingestion.js.map +1 -1
  492. package/packages/core/dist/artifacts/sdd-evidence.js +0 -1
  493. package/packages/core/dist/artifacts/sdd-evidence.js.map +1 -1
  494. package/packages/core/dist/artifacts/sdd-result.js +26 -17
  495. package/packages/core/dist/artifacts/sdd-result.js.map +1 -1
  496. package/packages/core/dist/config/init-project.d.ts +3 -0
  497. package/packages/core/dist/config/init-project.js +13 -9
  498. package/packages/core/dist/config/init-project.js.map +1 -1
  499. package/packages/core/dist/config/project-config.d.ts +3 -1
  500. package/packages/core/dist/config/project-config.js +7 -3
  501. package/packages/core/dist/config/project-config.js.map +1 -1
  502. package/packages/core/dist/config/starter-documents.d.ts +4 -4
  503. package/packages/core/dist/config/starter-documents.js +16 -20
  504. package/packages/core/dist/config/starter-documents.js.map +1 -1
  505. package/packages/core/dist/context/build-package.d.ts +1 -1
  506. package/packages/core/dist/context/build-package.js +1 -7
  507. package/packages/core/dist/context/build-package.js.map +1 -1
  508. package/packages/core/dist/context/evidence-summary.js +26 -8
  509. package/packages/core/dist/context/evidence-summary.js.map +1 -1
  510. package/packages/core/dist/context/log-worker.js +2 -2
  511. package/packages/core/dist/context/log-worker.js.map +1 -1
  512. package/packages/core/dist/context-offload/contracts.d.ts +1 -1
  513. package/packages/core/dist/contracts.d.ts +4 -1
  514. package/packages/core/dist/contracts.js +3 -0
  515. package/packages/core/dist/contracts.js.map +1 -1
  516. package/packages/core/dist/delegation/model.d.ts +3 -0
  517. package/packages/core/dist/delegation/validation.d.ts +3 -0
  518. package/packages/core/dist/delegation/validation.js +7 -4
  519. package/packages/core/dist/delegation/validation.js.map +1 -1
  520. package/packages/core/dist/doctor/checks/document-chain.js +1 -1
  521. package/packages/core/dist/doctor/checks/document-chain.js.map +1 -1
  522. package/packages/core/dist/doctor/checks/project.js +8 -8
  523. package/packages/core/dist/doctor/checks/project.js.map +1 -1
  524. package/packages/core/dist/doctor/checks/registries.js +0 -1
  525. package/packages/core/dist/doctor/checks/registries.js.map +1 -1
  526. package/packages/core/dist/doctor/checks/run-evidence.js +7 -7
  527. package/packages/core/dist/doctor/checks/run-evidence.js.map +1 -1
  528. package/packages/core/dist/doctor/checks/run-trust.js +0 -24
  529. package/packages/core/dist/doctor/checks/run-trust.js.map +1 -1
  530. package/packages/core/dist/doctor/checks/runtime-contracts.js +1 -1
  531. package/packages/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
  532. package/packages/core/dist/doctor/doctor.js +277 -3
  533. package/packages/core/dist/doctor/doctor.js.map +1 -1
  534. package/packages/core/dist/evidence/lookup.d.ts +23 -0
  535. package/packages/core/dist/evidence/lookup.js +61 -0
  536. package/packages/core/dist/evidence/lookup.js.map +1 -0
  537. package/packages/core/dist/evidence-runtime/contracts.d.ts +11 -1
  538. package/packages/core/dist/execution/agent-execution-records.js +15 -8
  539. package/packages/core/dist/execution/agent-execution-records.js.map +1 -1
  540. package/packages/core/dist/execution/background-executor.js +4 -4
  541. package/packages/core/dist/execution/background-executor.js.map +1 -1
  542. package/packages/core/dist/execution/foreground-subagents.js +3 -3
  543. package/packages/core/dist/execution/foreground-subagents.js.map +1 -1
  544. package/packages/core/dist/execution/host-invocation.js +5 -4
  545. package/packages/core/dist/execution/host-invocation.js.map +1 -1
  546. package/packages/core/dist/execution/resident-worker.js +16 -7
  547. package/packages/core/dist/execution/resident-worker.js.map +1 -1
  548. package/packages/core/dist/execution/stage-team-runtime.d.ts +112 -0
  549. package/packages/core/dist/execution/stage-team-runtime.js +145 -0
  550. package/packages/core/dist/execution/stage-team-runtime.js.map +1 -0
  551. package/packages/core/dist/governance/policy.d.ts +1 -1
  552. package/packages/core/dist/governance/policy.js +1 -1
  553. package/packages/core/dist/governance/policy.js.map +1 -1
  554. package/packages/core/dist/instructions.d.ts +1 -1
  555. package/packages/core/dist/instructions.js +59 -66
  556. package/packages/core/dist/instructions.js.map +1 -1
  557. package/packages/core/dist/lifecycle/decision-gate.js +1 -1
  558. package/packages/core/dist/lifecycle/decision-gate.js.map +1 -1
  559. package/packages/core/dist/lifecycle/ship.d.ts +3 -0
  560. package/packages/core/dist/lifecycle/ship.js +55 -19
  561. package/packages/core/dist/lifecycle/ship.js.map +1 -1
  562. package/packages/core/dist/orchestration/contracts.d.ts +1 -1
  563. package/packages/core/dist/orchestration/runtime.d.ts +12 -2
  564. package/packages/core/dist/orchestration/runtime.js +62 -21
  565. package/packages/core/dist/orchestration/runtime.js.map +1 -1
  566. package/packages/core/dist/registries/agent-capability-catalog.d.ts +20 -2
  567. package/packages/core/dist/registries/agent-capability-catalog.js +218 -18
  568. package/packages/core/dist/registries/agent-capability-catalog.js.map +1 -1
  569. package/packages/core/dist/registries/agent-registry.js +17 -17
  570. package/packages/core/dist/registries/agent-registry.js.map +1 -1
  571. package/packages/core/dist/registries/agent-runtime-static.d.ts +10 -0
  572. package/packages/core/dist/registries/agent-runtime-static.js +32 -2
  573. package/packages/core/dist/registries/agent-runtime-static.js.map +1 -1
  574. package/packages/core/dist/registries/capability-sources.d.ts +2 -17
  575. package/packages/core/dist/registries/capability-sources.js +222 -10
  576. package/packages/core/dist/registries/capability-sources.js.map +1 -1
  577. package/packages/core/dist/registries/command-team-runtime.d.ts +1 -1
  578. package/packages/core/dist/registries/command-team-runtime.js +9 -9
  579. package/packages/core/dist/registries/command-team-runtime.js.map +1 -1
  580. package/packages/core/dist/registries/eval-learning-context.js +4 -4
  581. package/packages/core/dist/registries/eval-learning-context.js.map +1 -1
  582. package/packages/core/dist/registries/query-status.js +2 -2
  583. package/packages/core/dist/registries/query-status.js.map +1 -1
  584. package/packages/core/dist/registries/tool-capabilities.js +3 -3
  585. package/packages/core/dist/registries/tool-capabilities.js.map +1 -1
  586. package/packages/core/dist/registries/tool-plugins.js +2 -2
  587. package/packages/core/dist/registries/tool-plugins.js.map +1 -1
  588. package/packages/core/dist/registries/worker-adapters.js +11 -11
  589. package/packages/core/dist/registries/worker-adapters.js.map +1 -1
  590. package/packages/core/dist/registries/workflow-gates.js +12 -12
  591. package/packages/core/dist/registries/workflow-gates.js.map +1 -1
  592. package/packages/core/dist/risk/contracts.d.ts +2 -2
  593. package/packages/core/dist/risk/kernel.js +4 -4
  594. package/packages/core/dist/risk/kernel.js.map +1 -1
  595. package/packages/core/dist/risk/legacy-adapters.js +4 -7
  596. package/packages/core/dist/risk/legacy-adapters.js.map +1 -1
  597. package/packages/core/dist/risk/workflow-gates.d.ts +2 -2
  598. package/packages/core/dist/risk/workflow-gates.js +19 -17
  599. package/packages/core/dist/risk/workflow-gates.js.map +1 -1
  600. package/packages/core/dist/router/agent-runtime-config.js +28 -13
  601. package/packages/core/dist/router/agent-runtime-config.js.map +1 -1
  602. package/packages/core/dist/router/agent-runtime.d.ts +61 -1
  603. package/packages/core/dist/router/route-projection.d.ts +3 -1
  604. package/packages/core/dist/router/route-projection.js +192 -1
  605. package/packages/core/dist/router/route-projection.js.map +1 -1
  606. package/packages/core/dist/router/routing.js +73 -17
  607. package/packages/core/dist/router/routing.js.map +1 -1
  608. package/packages/core/dist/router/runtime-import.d.ts +28 -0
  609. package/packages/core/dist/router/runtime-import.js +373 -0
  610. package/packages/core/dist/router/runtime-import.js.map +1 -0
  611. package/packages/core/dist/router/runtime-inspection.js +11 -4
  612. package/packages/core/dist/router/runtime-inspection.js.map +1 -1
  613. package/packages/core/dist/router/runtime-validation.js +31 -3
  614. package/packages/core/dist/router/runtime-validation.js.map +1 -1
  615. package/packages/core/dist/router/stage-route-binding.d.ts +37 -0
  616. package/packages/core/dist/router/stage-route-binding.js +235 -0
  617. package/packages/core/dist/router/stage-route-binding.js.map +1 -0
  618. package/packages/core/dist/router.d.ts +2 -0
  619. package/packages/core/dist/router.js +2 -0
  620. package/packages/core/dist/router.js.map +1 -1
  621. package/packages/core/dist/run-state/artifacts.d.ts +16 -0
  622. package/packages/core/dist/run-state/artifacts.js +168 -18
  623. package/packages/core/dist/run-state/artifacts.js.map +1 -1
  624. package/packages/core/dist/run-state/events.js +2 -2
  625. package/packages/core/dist/run-state/events.js.map +1 -1
  626. package/packages/core/dist/run-state/inspect-run.d.ts +3 -3
  627. package/packages/core/dist/run-state/inspect-run.js +22 -54
  628. package/packages/core/dist/run-state/inspect-run.js.map +1 -1
  629. package/packages/core/dist/run-state/invocation-ledger.js +2 -2
  630. package/packages/core/dist/run-state/invocation-ledger.js.map +1 -1
  631. package/packages/core/dist/run-state/model.d.ts +53 -9
  632. package/packages/core/dist/run-state/run-index.d.ts +0 -2
  633. package/packages/core/dist/run-state/run-index.js +1 -3
  634. package/packages/core/dist/run-state/run-index.js.map +1 -1
  635. package/packages/core/dist/run-state/run-state.js +51 -34
  636. package/packages/core/dist/run-state/run-state.js.map +1 -1
  637. package/packages/core/dist/run-state/task-evidence.d.ts +65 -0
  638. package/packages/core/dist/run-state/task-evidence.js +169 -0
  639. package/packages/core/dist/run-state/task-evidence.js.map +1 -0
  640. package/packages/core/dist/run-state/timing.d.ts +8 -0
  641. package/packages/core/dist/run-state/timing.js +131 -0
  642. package/packages/core/dist/run-state/timing.js.map +1 -0
  643. package/packages/core/dist/run-state.d.ts +2 -0
  644. package/packages/core/dist/run-state.js +2 -0
  645. package/packages/core/dist/run-state.js.map +1 -1
  646. package/packages/core/dist/runtime-analysis/build.js +0 -3
  647. package/packages/core/dist/runtime-analysis/build.js.map +1 -1
  648. package/packages/core/dist/runtime-analysis/findings.js +5 -44
  649. package/packages/core/dist/runtime-analysis/findings.js.map +1 -1
  650. package/packages/core/dist/runtime-analysis/model.d.ts +1 -17
  651. package/packages/core/dist/runtime-paths.d.ts +20 -0
  652. package/packages/core/dist/runtime-paths.js +109 -14
  653. package/packages/core/dist/runtime-paths.js.map +1 -1
  654. package/packages/core/dist/runtime-projection-p0.d.ts +64 -0
  655. package/packages/core/dist/runtime-projection-p0.js +200 -0
  656. package/packages/core/dist/runtime-projection-p0.js.map +1 -0
  657. package/packages/core/dist/sdd-docs/context.js +1 -1
  658. package/packages/core/dist/sdd-docs/context.js.map +1 -1
  659. package/packages/core/dist/sdd-docs/document-hashes.d.ts +6 -0
  660. package/packages/core/dist/sdd-docs/document-hashes.js +276 -0
  661. package/packages/core/dist/sdd-docs/document-hashes.js.map +1 -0
  662. package/packages/core/dist/sdd-docs/run-binding.d.ts +1 -1
  663. package/packages/core/dist/sdd-docs/run-binding.js +15 -4
  664. package/packages/core/dist/sdd-docs/run-binding.js.map +1 -1
  665. package/packages/core/dist/sdd-docs/task-parser.d.ts +21 -0
  666. package/packages/core/dist/sdd-docs/task-parser.js +139 -38
  667. package/packages/core/dist/sdd-docs/task-parser.js.map +1 -1
  668. package/packages/core/dist/stage-artifacts.d.ts +55 -0
  669. package/packages/core/dist/stage-artifacts.js +322 -0
  670. package/packages/core/dist/stage-artifacts.js.map +1 -0
  671. package/packages/core/dist/stage-collaboration-contracts.d.ts +55 -0
  672. package/packages/core/dist/stage-collaboration-contracts.js +241 -0
  673. package/packages/core/dist/stage-collaboration-contracts.js.map +1 -0
  674. package/packages/core/dist/stage-collaboration.d.ts +888 -0
  675. package/packages/core/dist/stage-collaboration.js +3870 -0
  676. package/packages/core/dist/stage-collaboration.js.map +1 -0
  677. package/packages/core/dist/stage-runtime/runtime.js +8 -1
  678. package/packages/core/dist/stage-runtime/runtime.js.map +1 -1
  679. package/packages/core/dist/status/project-status.d.ts +105 -1
  680. package/packages/core/dist/status/project-status.js +343 -8
  681. package/packages/core/dist/status/project-status.js.map +1 -1
  682. package/packages/core/dist/storage/runtime-store.d.ts +348 -3
  683. package/packages/core/dist/storage/runtime-store.js +1017 -8
  684. package/packages/core/dist/storage/runtime-store.js.map +1 -1
  685. package/packages/core/dist/subagents/contracts.d.ts +1 -1
  686. package/packages/core/dist/subagents/runtime.js +7 -7
  687. package/packages/core/dist/subagents/runtime.js.map +1 -1
  688. package/packages/core/dist/test-support/fixtures.js +21 -0
  689. package/packages/core/dist/test-support/fixtures.js.map +1 -1
  690. package/packages/core/dist/test-support/run-state.d.ts +1 -1
  691. package/packages/core/dist/test-support/run-state.js +19 -20
  692. package/packages/core/dist/test-support/run-state.js.map +1 -1
  693. package/packages/core/dist/truth-reconciliation.d.ts +44 -0
  694. package/packages/core/dist/truth-reconciliation.js +138 -0
  695. package/packages/core/dist/truth-reconciliation.js.map +1 -0
  696. package/packages/core/dist/tsconfig.tsbuildinfo +1 -1
  697. package/packages/core/dist/verification/goal-verify.d.ts +0 -1
  698. package/packages/core/dist/verification/goal-verify.js +44 -37
  699. package/packages/core/dist/verification/goal-verify.js.map +1 -1
  700. package/packages/core/dist/verification/rendering.d.ts +0 -2
  701. package/packages/core/dist/verification/rendering.js +19 -49
  702. package/packages/core/dist/verification/rendering.js.map +1 -1
  703. package/packages/core/dist/verification/review-gate.d.ts +22 -0
  704. package/packages/core/dist/verification/review-gate.js +53 -0
  705. package/packages/core/dist/verification/review-gate.js.map +1 -0
  706. package/packages/core/dist/verification/single-task-loop.d.ts +0 -1
  707. package/packages/core/dist/verification/single-task-loop.js +213 -111
  708. package/packages/core/dist/verification/single-task-loop.js.map +1 -1
  709. package/packages/core/dist/verification/test-runtime.d.ts +28 -3
  710. package/packages/core/dist/verification/test-runtime.js +546 -125
  711. package/packages/core/dist/verification/test-runtime.js.map +1 -1
  712. package/packages/core/dist/verification/validation-cache.d.ts +26 -0
  713. package/packages/core/dist/verification/validation-cache.js +73 -0
  714. package/packages/core/dist/verification/validation-cache.js.map +1 -0
  715. package/packages/core/dist/verification/validation-wave.d.ts +76 -0
  716. package/packages/core/dist/verification/validation-wave.js +450 -0
  717. package/packages/core/dist/verification/validation-wave.js.map +1 -0
  718. package/packages/core/dist/verification/verify-contract.d.ts +3 -1
  719. package/packages/core/dist/verification/verify-contract.js +105 -30
  720. package/packages/core/dist/verification/verify-contract.js.map +1 -1
  721. package/packages/core/dist/verification.d.ts +2 -0
  722. package/packages/core/dist/verification.js +2 -0
  723. package/packages/core/dist/verification.js.map +1 -1
  724. package/packages/core/dist/work-units/contracts.d.ts +1 -1
  725. package/packages/core/dist/workflow-gate/evidence-packet.d.ts +24 -0
  726. package/packages/core/dist/workflow-gate/evidence-packet.js +395 -0
  727. package/packages/core/dist/workflow-gate/evidence-packet.js.map +1 -0
  728. package/packages/core/dist/workflow-gate/hard-checks.d.ts +4 -0
  729. package/packages/core/dist/workflow-gate/hard-checks.js +164 -0
  730. package/packages/core/dist/workflow-gate/hard-checks.js.map +1 -0
  731. package/packages/core/dist/workflow-gate/policy.d.ts +4 -0
  732. package/packages/core/dist/workflow-gate/policy.js +182 -0
  733. package/packages/core/dist/workflow-gate/policy.js.map +1 -0
  734. package/packages/core/dist/workflow-gate/types.d.ts +88 -0
  735. package/packages/core/dist/workflow-gate/types.js +2 -0
  736. package/packages/core/dist/workflow-gate/types.js.map +1 -0
  737. package/packages/core/dist/workflow-state/affected-file-conflicts.d.ts +1 -1
  738. package/packages/core/dist/workflow-state/affected-file-conflicts.js +17 -3
  739. package/packages/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
  740. package/packages/core/dist/workflow-state/dependencies.d.ts +8 -4
  741. package/packages/core/dist/workflow-state/dependencies.js +25 -11
  742. package/packages/core/dist/workflow-state/dependencies.js.map +1 -1
  743. package/packages/core/dist/workflow-state/latest-eligible-run.d.ts +37 -0
  744. package/packages/core/dist/workflow-state/latest-eligible-run.js +188 -0
  745. package/packages/core/dist/workflow-state/latest-eligible-run.js.map +1 -0
  746. package/packages/core/dist/workflow-state/migration-recovery.d.ts +40 -0
  747. package/packages/core/dist/workflow-state/migration-recovery.js +110 -0
  748. package/packages/core/dist/workflow-state/migration-recovery.js.map +1 -0
  749. package/packages/core/dist/workflow-state/repair-contract.d.ts +12 -0
  750. package/packages/core/dist/workflow-state/repair-contract.js +63 -0
  751. package/packages/core/dist/workflow-state/repair-contract.js.map +1 -0
  752. package/packages/core/dist/workflow-state/resolve-task-run.d.ts +21 -0
  753. package/packages/core/dist/workflow-state/resolve-task-run.js +95 -0
  754. package/packages/core/dist/workflow-state/resolve-task-run.js.map +1 -0
  755. package/packages/core/dist/workflow-state/resolve.d.ts +80 -3
  756. package/packages/core/dist/workflow-state/resolve.js +674 -41
  757. package/packages/core/dist/workflow-state/resolve.js.map +1 -1
  758. package/packages/core/dist/workflow-state/runtime-projections.d.ts +228 -0
  759. package/packages/core/dist/workflow-state/runtime-projections.js +452 -0
  760. package/packages/core/dist/workflow-state/runtime-projections.js.map +1 -0
  761. package/packages/core/dist/workflow-state.d.ts +1 -0
  762. package/packages/core/dist/workflow-state.js +1 -0
  763. package/packages/core/dist/workflow-state.js.map +1 -1
  764. package/packages/core/package.json +3 -3
  765. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.d.ts +0 -2
  766. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js +0 -44
  767. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js.map +0 -1
  768. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.d.ts +0 -17
  769. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js +0 -221
  770. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js.map +0 -1
  771. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.d.ts +0 -91
  772. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js +0 -395
  773. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js.map +0 -1
  774. package/node_modules/@sdd-agent-platform/core/dist/sync-back.d.ts +0 -2
  775. package/node_modules/@sdd-agent-platform/core/dist/sync-back.js +0 -3
  776. package/node_modules/@sdd-agent-platform/core/dist/sync-back.js.map +0 -1
  777. package/node_modules/@sdd-agent-platform/core/src/sync-back/apply.ts +0 -248
  778. package/node_modules/@sdd-agent-platform/core/src/sync-back/inspect.ts +0 -522
  779. package/node_modules/@sdd-agent-platform/core/src/sync-back/sync-back.test.ts +0 -446
  780. package/node_modules/@sdd-agent-platform/core/src/sync-back.ts +0 -2
  781. package/packages/cli/dist/commands/artifact.d.ts +0 -6
  782. package/packages/cli/dist/commands/artifact.js +0 -168
  783. package/packages/cli/dist/commands/artifact.js.map +0 -1
  784. package/packages/cli/dist/commands/sync-back.d.ts +0 -6
  785. package/packages/cli/dist/commands/sync-back.js +0 -82
  786. package/packages/cli/dist/commands/sync-back.js.map +0 -1
  787. package/packages/cli/dist/renderers/artifacts.d.ts +0 -5
  788. package/packages/cli/dist/renderers/artifacts.js +0 -43
  789. package/packages/cli/dist/renderers/artifacts.js.map +0 -1
  790. package/packages/core/dist/doctor/render.d.ts +0 -2
  791. package/packages/core/dist/doctor/render.js +0 -44
  792. package/packages/core/dist/doctor/render.js.map +0 -1
  793. package/packages/core/dist/sync-back/apply.d.ts +0 -17
  794. package/packages/core/dist/sync-back/apply.js +0 -221
  795. package/packages/core/dist/sync-back/apply.js.map +0 -1
  796. package/packages/core/dist/sync-back/inspect.d.ts +0 -91
  797. package/packages/core/dist/sync-back/inspect.js +0 -395
  798. package/packages/core/dist/sync-back/inspect.js.map +0 -1
  799. package/packages/core/dist/sync-back.d.ts +0 -2
  800. package/packages/core/dist/sync-back.js +0 -3
  801. package/packages/core/dist/sync-back.js.map +0 -1
@@ -1,6 +1,7 @@
1
+ import { readFile } from 'node:fs/promises';
1
2
  import { SDD_RESULT_CONTRACT, SDD_RESULT_VERSION } from '../contracts.js';
2
3
  import { readArtifact } from '../run-state/artifacts.js';
3
- import { toArtifactRootRelativePath } from '../runtime-paths.js';
4
+ import { getBranchStageEvidencePathFromRef, isBranchStageEvidenceRef, normalizeStageEvidenceOrLegacyArtifactRef, toEvidencePayloadFileName } from '../runtime-paths.js';
4
5
  import { validateArtifactTrust } from './sdd-evidence.js';
5
6
  import type { ArtifactTrustValidationReport, ContractValidationIssue } from './sdd-evidence.js';
6
7
 
@@ -25,29 +26,29 @@ export interface SddResultValidationReport {
25
26
 
26
27
  export async function validateSddResultArtifact(projectRoot: string, runId: string, runRelativeArtifactPath: string, options: { expectedTask?: string; expectedAgent?: string } = {}): Promise<SddResultValidationReport> {
27
28
  const issues: ContractValidationIssue[] = [];
28
- let artifactRootRelativePath: string;
29
+ let evidenceRef: string;
29
30
  try {
30
- artifactRootRelativePath = toArtifactRootRelativePath(runRelativeArtifactPath);
31
+ evidenceRef = normalizeStageEvidenceOrLegacyArtifactRef(runRelativeArtifactPath);
31
32
  } catch (error) {
32
- return { valid: false, result: null, issues: [contractIssue('artifacts', messageFromError(error), 'Use a run-relative artifacts/<file> path; the physical file lives under branch evidence .sdd/runs/<branchSlug>/evidence/artifacts/<file>. Source/test files belong in ## Evidence, not in sdd-result.artifacts.')] };
33
+ return { valid: false, result: null, issues: [contractIssue('artifacts', messageFromError(error), 'Use a repo-relative stage evidence ref under .sdd/runs/<branch>/<stage>/*.md. Source/test files belong in ## Evidence, not in sdd-result.artifacts.')] };
33
34
  }
34
35
 
35
36
  let raw: string;
36
37
  try {
37
- raw = await readArtifact(projectRoot, runId, artifactRootRelativePath);
38
+ raw = await readSddResultEvidence(projectRoot, runId, evidenceRef);
38
39
  } catch (error) {
39
- return { valid: false, result: null, issues: [contractIssue('artifacts', `Cannot read artifact ${runRelativeArtifactPath}: ${messageFromError(error)}`, `Create the expected artifact in branch evidence and pass the run-relative path ${runRelativeArtifactPath}.`)] };
40
+ return { valid: false, result: null, issues: [contractIssue('artifacts', `Cannot read evidence ${evidenceRef}: ${messageFromError(error)}`, `Create the expected stage evidence and pass ${evidenceRef}.`)] };
40
41
  }
41
42
 
42
43
  if (raw.trim().length === 0) {
43
- issues.push(contractIssue('artifacts', `Artifact ${runRelativeArtifactPath} is empty.`, 'Write non-empty evidence and an sdd-result block.'));
44
+ issues.push(contractIssue('artifacts', `Evidence ${evidenceRef} is empty.`, 'Write non-empty evidence and an sdd-result block.'));
44
45
  }
45
46
  const parsed = parseSddResultMarkdown(raw);
46
47
  issues.push(...parsed.issues);
47
48
  let trust: ArtifactTrustValidationReport | undefined;
48
49
  if (parsed.result) {
49
- issues.push(...validateSddResult(parsed.result, { ...options, runRelativeArtifactPath }));
50
- trust = validateArtifactTrust(raw, parsed.result, runRelativeArtifactPath, options);
50
+ issues.push(...validateSddResult(parsed.result, { ...options, runRelativeArtifactPath: evidenceRef }));
51
+ trust = validateArtifactTrust(raw, parsed.result, evidenceRef, options);
51
52
  if (!trust.valid) {
52
53
  issues.push(...trust.issues);
53
54
  }
@@ -135,22 +136,30 @@ function validateSddResultMetadata(metadata: Record<string, string | string[]>):
135
136
  issues.push(contractIssue('status', `Unsupported sdd-result status ${status ?? 'missing'}.`, 'Use PASS, PASS_WITH_GAPS, FAIL, BLOCKED, TIMED_OUT, or CANCELLED.'));
136
137
  }
137
138
  if (artifacts.length === 0) {
138
- issues.push(contractIssue('artifacts', 'sdd-result artifacts must contain at least one path.', 'Add the current run-relative artifact path, for example artifacts/<file>. Source/test files belong in ## Evidence.'));
139
+ issues.push(contractIssue('artifacts', 'sdd-result artifacts must contain at least one evidence ref.', 'Add the current stage evidence ref, for example .sdd/runs/<branch>/<stage>/<file>.md. Source/test files belong in ## Evidence.'));
139
140
  }
140
141
  for (const artifactPath of artifacts) {
141
- validateRunRelativeArtifactReference(artifactPath, issues);
142
- if (!artifactPath.replace(/\\/g, '/').startsWith('artifacts/')) {
143
- issues.push(contractIssue('artifacts', `Source/test path ${artifactPath} is not a run artifact reference.`, 'Move source/test file citations to ## Evidence; keep only run-relative artifacts/<file> paths in sdd-result.artifacts.'));
144
- }
142
+ validateSddResultEvidenceReference(artifactPath, issues);
145
143
  }
146
144
  return issues;
147
145
  }
148
146
 
149
- function validateRunRelativeArtifactReference(value: string, issues: ContractValidationIssue[], field = 'artifacts'): void {
147
+ async function readSddResultEvidence(projectRoot: string, runId: string, evidenceRef: string): Promise<string> {
148
+ if (isBranchStageEvidenceRef(evidenceRef)) {
149
+ try {
150
+ return await readFile(getBranchStageEvidencePathFromRef(projectRoot, evidenceRef), 'utf8');
151
+ } catch {
152
+ return readArtifact(projectRoot, runId, toEvidencePayloadFileName(evidenceRef));
153
+ }
154
+ }
155
+ return readArtifact(projectRoot, runId, toEvidencePayloadFileName(evidenceRef));
156
+ }
157
+
158
+ function validateSddResultEvidenceReference(value: string, issues: ContractValidationIssue[], field = 'artifacts'): void {
150
159
  try {
151
- toArtifactRootRelativePath(value);
160
+ normalizeStageEvidenceOrLegacyArtifactRef(value);
152
161
  } catch (error) {
153
- issues.push(contractIssue(field, messageFromError(error), 'Use a run-relative artifacts/<file> path inside the active run.'));
162
+ issues.push(contractIssue(field, messageFromError(error), 'Use a repo-relative stage evidence ref under .sdd/runs/<branch>/<stage>/*.md.'));
154
163
  }
155
164
  }
156
165
 
@@ -19,7 +19,15 @@ test('initProject creates readable project config', async () => {
19
19
  assert.equal(config.contract, 'phase-1.2-project-contract');
20
20
  assert.equal(config.sdd.docs_language, 'zh-CN');
21
21
  assert.equal(config.lifecycle.decision_required, true);
22
- assert.match(await readFile(init.configPath, 'utf8'), /Project-level SDD document prose language/);
22
+ assert.equal(config.runtime.runtime_store, '.sdd/runtime.sqlite');
23
+ assert.equal(config.runtime.stage_evidence, '.sdd/runs/<branch>/<stage>/*.md');
24
+ assert.equal(config.runtime.truth_alignment_mode, 'required');
25
+ const renderedConfig = await readFile(init.configPath, 'utf8');
26
+ assert.match(renderedConfig, /Project-level SDD document prose language/);
27
+ assert.match(renderedConfig, /runtime_store: \.sdd\/runtime\.sqlite/);
28
+ assert.match(renderedConfig, /stage_evidence: \.sdd\/runs\/<branch>\/<stage>\/\*\.md/);
29
+ assert.match(renderedConfig, /truth_alignment_mode: required/);
30
+ await assert.rejects(access(path.join(root, '.sdd', 'runs')));
23
31
  } finally {
24
32
  await rm(root, { recursive: true, force: true });
25
33
  }
@@ -186,13 +194,13 @@ test('initProject projects managed Claude Code entries by default', async () =>
186
194
  const init = await initProject(root);
187
195
  const skill = await readFile(path.join(root, '.claude', 'skills', 'sdd', 'SKILL.md'), 'utf8');
188
196
  const doctorCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'doctor.md'), 'utf8');
197
+ const updateCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'update.md'), 'utf8');
189
198
 
190
199
  const specCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'spec.md'), 'utf8');
191
200
  const planCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'plan.md'), 'utf8');
192
201
  const tasksCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'tasks.md'), 'utf8');
193
202
  const doCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'do.md'), 'utf8');
194
203
  const testCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'test.md'), 'utf8');
195
- const syncBackCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'sync-back.md'), 'utf8');
196
204
  const shipCommand = await readFile(path.join(root, '.claude', 'commands', 'sdd', 'ship.md'), 'utf8');
197
205
 
198
206
  assert.equal(init.aiTools.length, 1);
@@ -203,13 +211,13 @@ test('initProject projects managed Claude Code entries by default', async () =>
203
211
  assert.match(skill, /do not paste or restate full status/);
204
212
  assert.match(skill, /natural-language intent/);
205
213
  assert.match(skill, /CLI\/core output/);
206
- assert.match(skill, /\/sdd:\*/);
214
+ assert.match(skill, /projected command bundle/);
207
215
  assert.match(skill, /ambiguous after status/);
208
216
  assert.match(skill, /sdd tasks inspect <task_id>/);
209
- assert.match(skill, /sdd sync-back inspect --branch <branch> --task <task_id>/);
210
- assert.match(skill, /\/sdd:ship/);
211
- assert.match(skill, /\/sdd:test/);
212
- assert.match(skill, /follow apply_policy/);
217
+ assert.doesNotMatch(skill, /sync-back|sync_back/);
218
+ assert.match(skill, /sdd ship close --branch <branch> --json/);
219
+ assert.match(skill, /`test -> goal-verify`/);
220
+ assert.doesNotMatch(skill, /follow apply_policy/);
213
221
  assert.match(skill, /workflow_status=not_started/);
214
222
  assert.match(skill, /workflow branch entry/);
215
223
  assert.match(doctorCommand, /sdd instructions doctor --json/);
@@ -218,14 +226,15 @@ test('initProject projects managed Claude Code entries by default', async () =>
218
226
  await assert.rejects(access(path.join(root, '.claude', 'commands', 'sdd', 'init.md')), /ENOENT/);
219
227
  await assert.rejects(access(path.join(root, '.claude', 'commands', 'sdd', 'verify.md')), /ENOENT/);
220
228
  await assert.rejects(access(path.join(root, '.claude', 'commands', 'sdd', 'verifies.md')), /ENOENT/);
221
- await assert.rejects(access(path.join(root, '.claude', 'commands', 'sdd', 'update.md')), /ENOENT/);
222
229
  await assert.rejects(access(path.join(root, '.claude', 'commands', 'sdd', 'instructions.md')), /ENOENT/);
230
+ await assert.rejects(access(path.join(root, '.claude', 'commands', 'sdd', 'sync-back.md')), /ENOENT/);
223
231
  assert.equal(init.aiTools[0].entries.some((entry) => entry.id === 'sdd-root'), false);
224
232
  assert.equal(init.aiTools[0].entries.some((entry) => entry.id === 'sdd-init'), false);
225
233
  assert.equal(init.aiTools[0].entries.some((entry) => entry.id === 'sdd-verify'), false);
226
234
  assert.equal(init.aiTools[0].entries.some((entry) => entry.id === 'sdd-verifies'), false);
227
- assert.equal(init.aiTools[0].entries.some((entry) => entry.id === 'sdd-update'), false);
235
+ assert.equal(init.aiTools[0].entries.some((entry) => entry.id === 'sdd-update'), true);
228
236
  assert.equal(init.aiTools[0].entries.some((entry) => entry.id === 'sdd-instructions'), false);
237
+ assert.equal(init.aiTools[0].entries.some((entry) => entry.id === 'sdd-sync-back'), false);
229
238
  assert.match(specCommand, /sdd instructions spec --json/);
230
239
  assert.match(planCommand, /sdd instructions plan --json/);
231
240
  assert.match(tasksCommand, /sdd instructions tasks --json/);
@@ -235,31 +244,37 @@ test('initProject projects managed Claude Code entries by default', async () =>
235
244
  assert.match(tasksCommand, /metadata inside the ```sdd-task fenced block/);
236
245
  assert.match(specCommand, /workflow partition entry/);
237
246
  assert.match(specCommand, /not a technical design/);
238
- assert.match(planCommand, /Refine the existing SDD plan document/);
239
- assert.match(planCommand, /deliverable technical solution/);
240
- assert.match(planCommand, /based_on_spec_hash/);
247
+ assert.match(planCommand, /Refine specs\/<branch>\/plan\.md and \.sdd\/runs\/<branch>\/plan\/\*\.md/);
248
+ assert.match(planCommand, /technical bridge from approved spec to task-ready execution/);
249
+ assert.match(planCommand, /plan-collaboration-contract-vN\.md/);
241
250
  assert.match(planCommand, /PlantUML/);
242
- assert.match(planCommand, /state-machine risk needs a state diagram/);
243
- assert.match(tasksCommand, /executable evidence contract/);
244
- assert.match(tasksCommand, /based_on_plan_hash/);
251
+ assert.match(planCommand, /state diagrams for state-machine risk/);
252
+ assert.match(tasksCommand, /user-visible bundle for the `tasks -> verifies` runtime stages/);
253
+ assert.match(tasksCommand, /tasks-collaboration-contract-vN\.md/);
254
+ assert.match(tasksCommand, /sdd tasks close --branch <branch> --target verifies --json/);
255
+ assert.match(tasksCommand, /verifies-collaboration-contract-vN\.md/);
245
256
  assert.match(doCommand, /sdd status/);
246
257
  assert.match(doCommand, /sdd instructions do --json/);
247
- assert.match(doCommand, /sdd tasks inspect <task_id>/);
248
- assert.match(doCommand, /artifacts\/implement-<task_id>\.md/);
249
- assert.match(doCommand, /--agent implementer/);
250
- assert.match(doCommand, /sdd do task <task_id>/);
251
- assert.match(doCommand, /sdd test task <task_id> --branch <branch>/);
258
+ assert.match(doCommand, /sdd tasks inspect <bound_task_id>/);
259
+ assert.match(doCommand, /runs\/<branch>\/do\/implementation-vN\.md/);
260
+ assert.match(doCommand, /runs\/<branch>\/do\/code-review-vN\.md/);
261
+ assert.match(doCommand, /runs\/<branch>\/do\/do-manager-vN\.md/);
262
+ assert.match(doCommand, /sdd do task <task_id-or-task-text> --branch <branch>/);
263
+ assert.match(doCommand, /write only SQLite projections\/run state/);
252
264
  assert.match(testCommand, /sdd instructions test --json/);
253
- assert.match(testCommand, /sdd verifies inspect --branch <branch>/);
254
- assert.match(testCommand, /Execute task validation commands/);
255
- assert.match(syncBackCommand, /sdd instructions sync-back --json/);
256
- assert.match(syncBackCommand, /sdd sync-back inspect --branch <branch> --task <task_id>/);
257
- assert.match(syncBackCommand, /approval_required=true/);
258
- assert.match(syncBackCommand, /Do not apply without inspect/);
265
+ assert.match(testCommand, /sdd test <validation_unit_id-or-validation_text> --branch <branch>/);
266
+ assert.match(testCommand, /Bind validation intent to an accepted verify\.md validation unit/);
267
+ assert.match(testCommand, /test-collaboration-contract-vN\.md/);
268
+ assert.match(testCommand, /user-visible bundle for the `test -> goal-verify` runtime stages/);
269
+ assert.match(testCommand, /sdd test close --branch <branch> --target goal-verify --json/);
270
+ assert.match(testCommand, /runs\/<branch>\/goal-verify\/\*\.md/);
271
+ assert.match(updateCommand, /sdd update/);
272
+ assert.match(updateCommand, /does not execute imported skills/);
273
+ assert.doesNotMatch(`${skill}\n${doCommand}\n${testCommand}\n${shipCommand}\n${updateCommand}`, /sync-back|sync_back/);
259
274
  assert.match(shipCommand, /sdd instructions ship --json/);
260
- assert.match(shipCommand, /sdd ship --branch <branch> --dry-run/);
261
- assert.match(shipCommand, /does not authorize npm publish/);
262
- assert.match(shipCommand, /statusline --branch <branch>/);
275
+ assert.match(shipCommand, /sdd ship close --branch <branch> --json/);
276
+ assert.match(shipCommand, /truthAlignment/);
277
+ assert.match(shipCommand, /ship-collaboration-contract-vN\.md/);
263
278
  } finally {
264
279
  await rm(root, { recursive: true, force: true });
265
280
  }
@@ -1,7 +1,8 @@
1
1
  import { mkdir, writeFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { applyAiToolEntries, type AiProjectionResult, type AiToolSelection } from '../ai-tools.js';
4
- import { getProjectConfigPath, getRunsDir, getSddDir } from '../runtime-paths.js';
4
+ import { importRuntimeSkillCapability, type RuntimeSkillImportRequest, type RuntimeSkillImportResult } from '../router/runtime-import.js';
5
+ import { getProjectConfigPath, getSddDir } from '../runtime-paths.js';
5
6
  import { detectProjectConfig, readProjectConfig, renderProjectConfig } from './project-config.js';
6
7
  import { assertSafePathSegment } from '../path-safety.js';
7
8
  import { exists } from '../storage/json-io.js';
@@ -27,17 +28,18 @@ export interface InitProjectResult {
27
28
  created: boolean;
28
29
  documents: InitDocumentsResult;
29
30
  aiTools: AiProjectionResult[];
31
+ skillImports: RuntimeSkillImportResult[];
30
32
  }
31
33
 
32
34
  export async function applyInitDocuments(projectRoot: string, options: { branch: string; force?: boolean; scaffoldDocuments: boolean; docsLanguage: string }): Promise<InitDocumentsResult> {
33
35
  assertSafePathSegment(options.branch, 'branch');
34
36
  const docsRoot = path.join(projectRoot, 'specs', options.branch);
35
- const now = new Date().toISOString();
37
+ const tasksContent = renderInitTasksDocument(options.branch, options.docsLanguage);
36
38
  const documents = [
37
- { name: 'spec.md', content: renderInitSpecDocument(options.branch, now, options.docsLanguage) },
38
- { name: 'plan.md', content: renderInitPlanDocument(options.branch, now, options.docsLanguage) },
39
- { name: 'tasks.md', content: renderInitTasksDocument(options.branch, now, options.docsLanguage) },
40
- { name: 'verify.md', content: renderInitVerifyDocument(options.branch, now, options.docsLanguage) }
39
+ { name: 'spec.md', content: renderInitSpecDocument(options.branch, options.docsLanguage) },
40
+ { name: 'plan.md', content: renderInitPlanDocument(options.branch, options.docsLanguage) },
41
+ { name: 'tasks.md', content: tasksContent },
42
+ { name: 'verify.md', content: renderInitVerifyDocument(options.branch, options.docsLanguage) }
41
43
  ];
42
44
 
43
45
  if (!options.scaffoldDocuments) {
@@ -81,16 +83,14 @@ export async function applyInitDocuments(projectRoot: string, options: { branch:
81
83
  return { branch: options.branch, root: path.relative(projectRoot, docsRoot), documents: reports };
82
84
  }
83
85
 
84
- export async function initProject(projectRoot: string, options: { force?: boolean; aiTool?: AiToolSelection; branch?: string; scaffoldDocuments?: boolean } = {}): Promise<InitProjectResult> {
86
+ export async function initProject(projectRoot: string, options: { force?: boolean; aiTool?: AiToolSelection; branch?: string; scaffoldDocuments?: boolean; skillImports?: RuntimeSkillImportRequest[] } = {}): Promise<InitProjectResult> {
85
87
  const sddDir = getSddDir(projectRoot);
86
- const runsDir = getRunsDir(projectRoot);
87
88
  const configPath = getProjectConfigPath(projectRoot);
88
89
  const requestedBranch = options.branch?.trim();
89
90
  const scaffoldDocuments = options.scaffoldDocuments ?? true;
90
91
  const branch = requestedBranch || 'master';
91
92
  assertSafePathSegment(branch, 'branch');
92
- await mkdir(runsDir, { recursive: true });
93
-
93
+ await mkdir(sddDir, { recursive: true });
94
94
  let created = false;
95
95
  let projectConfig = null;
96
96
  if (options.force || !await exists(configPath)) {
@@ -115,5 +115,9 @@ export async function initProject(projectRoot: string, options: { force?: boolea
115
115
 
116
116
  await mkdir(sddDir, { recursive: true });
117
117
  const aiTools = await applyAiToolEntries(projectRoot, { tool: options.aiTool ?? 'auto' });
118
- return { configPath, created, documents, aiTools };
118
+ const skillImports: RuntimeSkillImportResult[] = [];
119
+ for (const request of options.skillImports ?? []) {
120
+ skillImports.push(await importRuntimeSkillCapability(projectRoot, { ...request, force: request.force ?? options.force }));
121
+ }
122
+ return { configPath, created, documents, aiTools, skillImports };
119
123
  }
@@ -41,7 +41,9 @@ export interface ProjectConfig<TAgentRuntimeConfig = unknown> {
41
41
  runtime: {
42
42
  background_write: boolean;
43
43
  worktree_isolation: boolean;
44
- sync_back_mode: 'proposal';
44
+ runtime_store: string;
45
+ stage_evidence: string;
46
+ truth_alignment_mode: string;
45
47
  };
46
48
  lifecycle: {
47
49
  decision_required: boolean;
@@ -93,7 +95,9 @@ export function defaultProjectConfig<TAgentRuntimeConfig = unknown>(projectName:
93
95
  runtime: {
94
96
  background_write: false,
95
97
  worktree_isolation: false,
96
- sync_back_mode: 'proposal'
98
+ runtime_store: '.sdd/runtime.sqlite',
99
+ stage_evidence: '.sdd/runs/<branch>/<stage>/*.md',
100
+ truth_alignment_mode: 'required'
97
101
  },
98
102
  lifecycle: {
99
103
  decision_required: true,
@@ -105,7 +109,7 @@ export function defaultProjectConfig<TAgentRuntimeConfig = unknown>(projectName:
105
109
  export function renderProjectConfig(config: ProjectConfig<unknown>): string {
106
110
  const detection = config.detection ? `detection:\n confidence: ${config.detection.confidence}\n mixed_stack: ${config.detection.mixed_stack}\n primary: ${config.detection.primary}\n candidates:\n${config.detection.candidates.map((candidate) => ` - id: ${candidate.id}\n confidence: ${candidate.confidence}\n score: ${candidate.score}`).join('\n')}\n` : '';
107
111
  const defaultBranch = config.sdd.default_branch ? ` default_branch: ${config.sdd.default_branch}\n` : '';
108
- return `contract: ${config.contract}\nproject:\n name: ${config.project.name}\n language: ${config.project.language}\n framework: ${config.project.framework}\n${detection}sdd:\n spec_dir: ${config.sdd.spec_dir}\n${defaultBranch} # Project-level SDD document prose language; runtime CLI/JSON output remains English.\n docs_language: ${config.sdd.docs_language}\n compatible_with: ${config.sdd.compatible_with}\nvalidation:\n default:\n${config.validation.default.map((command) => ` - ${command}`).join('\n')}\nediting:\n prefer_hashline: ${config.editing.prefer_hashline}\n native_edit_fallback: ${config.editing.native_edit_fallback}\nruntime:\n background_write: ${config.runtime.background_write}\n worktree_isolation: ${config.runtime.worktree_isolation}\n sync_back_mode: ${config.runtime.sync_back_mode}\nlifecycle:\n decision_required: ${config.lifecycle.decision_required}\n profiles:\n${config.lifecycle.profiles.map((profile) => ` - ${profile}`).join('\n')}\n`;
112
+ return `contract: ${config.contract}\nproject:\n name: ${config.project.name}\n language: ${config.project.language}\n framework: ${config.project.framework}\n${detection}sdd:\n spec_dir: ${config.sdd.spec_dir}\n${defaultBranch} # Project-level SDD document prose language; runtime CLI/JSON output remains English.\n docs_language: ${config.sdd.docs_language}\n compatible_with: ${config.sdd.compatible_with}\nvalidation:\n default:\n${config.validation.default.map((command) => ` - ${command}`).join('\n')}\nediting:\n prefer_hashline: ${config.editing.prefer_hashline}\n native_edit_fallback: ${config.editing.native_edit_fallback}\nruntime:\n background_write: ${config.runtime.background_write}\n worktree_isolation: ${config.runtime.worktree_isolation}\n runtime_store: ${config.runtime.runtime_store}\n stage_evidence: ${config.runtime.stage_evidence}\n truth_alignment_mode: ${config.runtime.truth_alignment_mode}\nlifecycle:\n decision_required: ${config.lifecycle.decision_required}\n profiles:\n${config.lifecycle.profiles.map((profile) => ` - ${profile}`).join('\n')}\n`;
109
113
  }
110
114
 
111
115
  export async function readProjectConfig<TAgentRuntimeConfig = unknown>(projectRoot: string, parseAgentRuntime?: (raw: string) => TAgentRuntimeConfig | undefined): Promise<ProjectConfig<TAgentRuntimeConfig>> {
@@ -163,7 +167,9 @@ export function parseProjectConfig<TAgentRuntimeConfig = unknown>(raw: string, c
163
167
  runtime: {
164
168
  background_write: readBoolean(raw, 'background_write', false),
165
169
  worktree_isolation: readBoolean(raw, 'worktree_isolation', false),
166
- sync_back_mode: 'proposal'
170
+ runtime_store: readScalar(raw, 'runtime_store') ?? '.sdd/runtime.sqlite',
171
+ stage_evidence: readScalar(raw, 'stage_evidence') ?? '.sdd/runs/<branch>/<stage>/*.md',
172
+ truth_alignment_mode: readScalar(raw, 'truth_alignment_mode') ?? 'required'
167
173
  },
168
174
  lifecycle: {
169
175
  decision_required: readBoolean(raw, 'decision_required', true),
@@ -1,8 +1,9 @@
1
+
1
2
  function usesChineseInitDocs(value: string): boolean {
2
3
  return value === 'zh-CN';
3
4
  }
4
5
 
5
- export function renderInitSpecDocument(branch: string, timestamp: string, docsLanguage: string): string {
6
+ export function renderInitSpecDocument(branch: string, docsLanguage: string): string {
6
7
  const zh = usesChineseInitDocs(docsLanguage);
7
8
  const title = zh ? '# Spec: Project Onboarding / 项目入门' : '# Spec: Project Onboarding';
8
9
  const objectiveLines = zh ? `- User value: 仓库在第一个真实变更前已有可见的 SDD 入口。
@@ -37,8 +38,6 @@ ${title}
37
38
  - lifecycle_profile: \`direct\`
38
39
  - source_request: \`Created by sdd init\`
39
40
  - status: \`draft\`
40
- - created_at: \`${timestamp}\`
41
- - updated_at: \`${timestamp}\`
42
41
 
43
42
  ## 1. Objective / Customer Value
44
43
 
@@ -77,7 +76,7 @@ ${story}
77
76
 
78
77
  - Running background agents.
79
78
  - Creating worktrees.
80
- - Applying sync-back without explicit user approval.
79
+ - Claiming truth-alignment or release approval without accepted runtime evidence.
81
80
 
82
81
  ## 6. Requirements
83
82
 
@@ -129,7 +128,7 @@ ${story}
129
128
  `;
130
129
  }
131
130
 
132
- export function renderInitPlanDocument(branch: string, timestamp: string, docsLanguage: string): string {
131
+ export function renderInitPlanDocument(branch: string, docsLanguage: string): string {
133
132
  const zh = usesChineseInitDocs(docsLanguage);
134
133
  const title = zh ? '# Plan: Project Onboarding / 项目入门' : '# Plan: Project Onboarding';
135
134
  const background = zh
@@ -158,8 +157,6 @@ ${title}
158
157
  - spec_id: \`onboarding\`
159
158
  - plan_id: \`onboarding\`
160
159
  - branch: \`${branch}\`
161
- - created_at: \`${timestamp}\`
162
- - updated_at: \`${timestamp}\`
163
160
 
164
161
  ## 0.1 Requirement Trace
165
162
 
@@ -261,7 +258,7 @@ Explain why \`specs/${branch}/tasks.md\` should be split into the planned task b
261
258
  `;
262
259
  }
263
260
 
264
- export function renderInitTasksDocument(branch: string, timestamp: string, docsLanguage: string): string {
261
+ export function renderInitTasksDocument(branch: string, docsLanguage: string): string {
265
262
  const zh = usesChineseInitDocs(docsLanguage);
266
263
  const title = zh ? '# Tasks: Project Onboarding / 项目入门' : '# Tasks: Project Onboarding';
267
264
  const boundary = zh
@@ -287,8 +284,6 @@ ${title}
287
284
  - branch: \`${branch}\`
288
285
  - lifecycle_profile: \`direct\`
289
286
  - status: \`draft\`
290
- - created_at: \`${timestamp}\`
291
- - updated_at: \`${timestamp}\`
292
287
 
293
288
  ## 1. Delivery Map
294
289
 
@@ -347,7 +342,7 @@ Forbidden scope:
347
342
  - Do not create worktrees.
348
343
  - Do not start background agents.
349
344
  - Do not commit changes.
350
- - Do not apply sync-back automatically.
345
+ - Do not claim truth-alignment or release approval automatically.
351
346
 
352
347
  #### Acceptance
353
348
 
@@ -389,12 +384,12 @@ ${implementationNotes}
389
384
  `;
390
385
  }
391
386
 
392
- export function renderInitVerifyDocument(branch: string, timestamp: string, docsLanguage: string): string {
387
+ export function renderInitVerifyDocument(branch: string, docsLanguage: string): string {
393
388
  const zh = usesChineseInitDocs(docsLanguage);
394
389
  const title = zh ? '# Verify: Project Onboarding / 项目入门' : '# Verify: Project Onboarding';
395
390
  const purpose = zh
396
- ? '这份 verify.md 是从 starter tasks 派生的 verification guidance,不是 runtime evidence,也不替代 `/sdd:test` 产生的验证证据。'
397
- : 'This verify.md is task-derived verification guidance, not runtime evidence, and it does not replace validation evidence produced by `/sdd:test`.';
391
+ ? '这份 verify.md 是从 starter tasks 派生的 verification guidance,不是 runtime evidence,也不替代 `sdd test <validation_unit_id-or-validation_text>` 产生的验证证据。'
392
+ : 'This verify.md is task-derived verification guidance, not runtime evidence, and it does not replace validation evidence produced by `sdd test <validation_unit_id-or-validation_text>`.';
398
393
  const availability = zh
399
394
  ? '在替换真实 spec/plan/tasks 前,只能检查 onboarding scaffold 是否仍然可见且未被误当作已批准实现。'
400
395
  : 'Before replacing the real spec/plan/tasks, verification can only inspect that the onboarding scaffold is visible and not mistaken for approved implementation.';
@@ -404,8 +399,10 @@ version: 1.4.0
404
399
  contract: sdd-verify-doc-v1
405
400
  sdd_managed_starter: true
406
401
  branch: ${branch}
407
- created_at: ${timestamp}
408
- updated_at: ${timestamp}
402
+ author_role: verification-designer
403
+ independent_from_roles:
404
+ - task-planner
405
+ - implementer
409
406
  ---
410
407
 
411
408
  ${title}
@@ -418,18 +415,18 @@ ${purpose}
418
415
 
419
416
  | Task | Acceptance refs | Validation commands | Required artifacts | Verification availability |
420
417
  |---|---|---|---|---|
421
- | ONBOARDING-1 | AC-1<br>AC-2 | sdd status --branch ${branch}<br>sdd verifies inspect --branch ${branch} | none | ${availability} |
418
+ | ONBOARDING-1 | AC-1<br>AC-2 | sdd status --branch ${branch}<br>sdd test task-ONBOARDING-1 --branch ${branch} | none | ${availability} |
422
419
 
423
420
  ## 3. Verification Rules
424
421
 
425
- - This starter verify contract does not authorize source changes, validation execution, runtime mutation, sync-back, commit, push, publish, or release.
422
+ - This starter verify contract does not authorize source changes, validation execution, runtime mutation, truth-alignment approval, commit, push, publish, or release.
426
423
  - Replace starter spec, plan, tasks, and verify documents with a real branch contract before implementation.
427
- - Runtime PASS is judged by \`/sdd:test\` / \`sdd test task <task_id> --branch ${branch}\`; low-level verify remains available for compatibility diagnostics.
424
+ - Runtime PASS is judged by \`sdd test <validation_unit_id-or-validation_text> --branch ${branch}\` consuming the current verify contract; \`sdd test task|batch|wave\` remains available for explicit low-level diagnostics.
428
425
  - Re-run \`sdd verifies write --branch ${branch} --force\` only after reviewing changed task expectations.
429
426
 
430
427
  ## 4. Out of Scope
431
428
 
432
429
  - This document is not evidence in \`.sdd/runtime.sqlite\`.
433
- - This document is not a release, ship, or sync-back approval.
430
+ - This document is not a release, ship, or truth-alignment approval.
434
431
  `;
435
432
  }
@@ -7,7 +7,7 @@ import { contextBudgetForProfile, type ContextBudget, type ContextProfile } from
7
7
  import { contextSourceRefForAbsolutePath, contextSourceRefForProjectPath, uniqueContextSourceRefs } from './source-refs.js';
8
8
  import type { ContextSourceRef } from './source-refs.js';
9
9
 
10
- export type ContextBuildMode = 'do' | 'verify' | 'sync-back' | 'doctor';
10
+ export type ContextBuildMode = 'do' | 'verify' | 'doctor';
11
11
  export type ContextBuildRole = 'default' | 'implementer' | 'reviewer' | 'validator' | 'context-curator';
12
12
 
13
13
  export interface ContextBuildPackage {
@@ -254,9 +254,6 @@ function contextMustReadRefs(mode: ContextBuildMode, role: ContextBuildRole, doc
254
254
  if (mode === 'verify') {
255
255
  return [docs[0], ...artifacts];
256
256
  }
257
- if (mode === 'sync-back') {
258
- return [docs[0], ...affected];
259
- }
260
257
  return [docs[0]];
261
258
  }
262
259
 
@@ -307,10 +304,7 @@ function contextNextCommands(taskId: string, branch: string, mode: ContextBuildM
307
304
  return [`sdd do task ${taskId} --branch ${branch}`];
308
305
  }
309
306
  if (mode === 'verify') {
310
- return [`sdd test task ${taskId} --branch ${branch}`, `sdd evidence summary <run_id> --task ${taskId} --json`];
311
- }
312
- if (mode === 'sync-back') {
313
- return [`sdd sync-back inspect --branch ${branch} --task ${taskId}`];
307
+ return [`sdd test task-${taskId} --branch ${branch}`, `sdd evidence summary <run_id> --task ${taskId} --json`];
314
308
  }
315
309
  const agentSuffix = agent ? ` --agent ${agent}` : '';
316
310
  return [`sdd doctor fast --branch ${branch}`, `sdd context build --task ${taskId} --branch ${branch} --mode verify${agentSuffix} --json`];
@@ -55,7 +55,8 @@ test('evidence summary projection is hash-backed and not usable for PASS', async
55
55
  assert.equal(summary.usableForPass, false);
56
56
  assert.equal(summary.taskId, 'T1');
57
57
  assert.ok(summary.sources.some((source) => source.path.endsWith('runtime.sqlite') && source.kind === 'run_state' && source.hash.length === 64));
58
- assert.ok(summary.sources.some((source) => source.path.endsWith('.sdd/runs/master/evidence/artifacts/validation-T1.md') && source.kind === 'artifact'));
58
+ assert.ok(summary.sources.some((source) => source.path === '.sdd/runs/master/test/validation-T1.md' && source.kind === 'artifact' && source.hash.length === 64));
59
+ assert.equal(summary.sources.some((source) => source.path.includes('evidence/artifacts')), false);
59
60
  assert.ok(summary.policyRefs.some((ref) => ref.includes('reject-derived-source-evidence')));
60
61
  assert.equal(projection?.scope_key, 'summary-run:T1');
61
62
  assert.equal(payload.contract, 'sdd-evidence-summary-v1');
@@ -88,7 +89,7 @@ test('context build packages differ by mode and agent while remaining derived gu
88
89
  assert.ok(validatorPackage.mustRead.some((ref) => ref.path === 'artifacts/validation-T1.md'));
89
90
  assert.notDeepEqual(implementerPackage.mustRead.map((ref) => ref.path), validatorPackage.mustRead.map((ref) => ref.path));
90
91
  assert.ok(validatorPackage.warnings.some((warning) => warning.includes('cannot satisfy PASS evidence')));
91
- assert.ok(validatorPackage.nextCommands.includes('sdd test task T1 --branch master'));
92
+ assert.ok(validatorPackage.nextCommands.includes('sdd test task-T1 --branch master'));
92
93
  assert.equal(validatorPackage.nextCommands.some((command) => command.startsWith('sdd verify task')), false);
93
94
  assert.ok(implementerPackage.budget.estimatedBytes <= implementerPackage.budget.maxBytes);
94
95
  assert.ok(implementerPackage.budget.estimatedTokens > 0);
@@ -71,19 +71,28 @@ export async function buildEvidenceSummaryProjection(projectRoot: string, option
71
71
  const admittedClaims = await readRuntimeEvidenceClaims(projectRoot, state.runId, taskId ?? null);
72
72
  const artifactIngestions = Object.values(state.artifactIngestions ?? {}).filter((record) => !taskId || record.task === taskId);
73
73
  const artifacts = state.artifacts.filter((artifact) => !taskId || artifact.task === taskId);
74
+ const branch = state.gitBranch ?? state.partition ?? 'unscoped';
74
75
  const ledgerArtifactRefs = invocationLedger
75
76
  .filter((entry) => entry.kind === 'artifact_hash' && entry.artifactPath)
76
- .map((entry) => ({ path: entry.artifactPath as string, kind: 'artifact' as const }));
77
- const branchEvidenceRoot = `.sdd/runs/${branchToSafePartition(state.gitBranch ?? state.partition ?? 'unscoped')}/evidence`;
78
- const artifactSourceRefs = [
79
- ...artifacts.map((artifact) => ({ path: `${branchEvidenceRoot}/${artifact.path}`, kind: 'artifact' as const })),
80
- ...ledgerArtifactRefs.map((artifact) => ({ path: `${branchEvidenceRoot}/${artifact.path}`, kind: artifact.kind }))
77
+ .map((entry) => ({
78
+ path: stageEvidenceDisplayRefForRuntimeArtifact(branch, entry.artifactPath as string, 'artifact'),
79
+ kind: 'artifact' as const,
80
+ hash: entry.outputHash ?? null
81
+ }));
82
+ const artifactSourceRefs = artifacts.map((artifact) => ({ path: stageEvidenceDisplayRefForRuntimeArtifact(branch, artifact.path, artifact.kind), kind: 'artifact' as const }));
83
+ const hashedArtifactSourceRefs: ContextSourceRef[] = ledgerArtifactRefs
84
+ .filter((artifact): artifact is { path: string; kind: 'artifact'; hash: string } => artifact.hash !== null)
85
+ .map((artifact) => ({ path: artifact.path, kind: artifact.kind, hash: artifact.hash }));
86
+ const unresolvedArtifactSourceRefs = [
87
+ ...artifactSourceRefs,
88
+ ...ledgerArtifactRefs.filter((artifact) => artifact.hash === null).map((artifact) => ({ path: artifact.path, kind: artifact.kind }))
81
89
  ];
82
90
  const sources = await uniqueContextSourceRefs([
83
91
  await contextSourceRefForProjectPath(projectRoot, `.sdd/runtime.sqlite`, 'run_state'),
84
92
  await contextSourceRefForProjectPath(projectRoot, `.sdd/runtime.sqlite`, 'command_output'),
85
93
  await contextSourceRefForProjectPath(projectRoot, `.sdd/runtime.sqlite`, 'ledger'),
86
- ...(await Promise.all(artifactSourceRefs.map((artifact) => contextSourceRefForProjectPath(projectRoot, artifact.path, artifact.kind))))
94
+ ...hashedArtifactSourceRefs,
95
+ ...(await Promise.all(unresolvedArtifactSourceRefs.map((artifact) => contextSourceRefForProjectPath(projectRoot, artifact.path, artifact.kind))))
87
96
  ]);
88
97
  const issueCodes = uniqueEvidenceIssueCodes(artifactIngestions.flatMap((record) => record.issues));
89
98
  const passCount = Math.max(admittedClaims.filter((claim) => claim.status === 'PASS').length, artifactIngestions.filter((record) => record.status === 'accepted' && (record.resultStatus === 'PASS' || record.resultStatus === 'PASS_WITH_GAPS')).length);
@@ -91,8 +100,8 @@ export async function buildEvidenceSummaryProjection(projectRoot: string, option
91
100
  const blockedCount = Math.max(admittedClaims.filter((claim) => claim.status === 'BLOCKED').length, artifactIngestions.filter((record) => record.resultStatus === 'BLOCKED' || record.resultStatus === 'TIMED_OUT' || record.resultStatus === 'CANCELLED' || record.gaps.length > 0).length);
92
101
  const highlights = [
93
102
  `run=${state.runId} status=${state.status} phase=${state.phase ?? 'none'}`,
94
- `task=${taskId ?? 'none'} validation=${state.validation.status} sync_back=${state.syncBack.status}`,
95
- `artifacts=${artifacts.length} ingestions=${artifactIngestions.length} admitted_claims=${admittedClaims.length} events=${events.length} ledger=${invocationLedger.length}`,
103
+ `task=${taskId ?? 'none'} validation=${state.validation.status}`,
104
+ `stage_evidence_refs=${artifacts.length} ingestions=${artifactIngestions.length} admitted_claims=${admittedClaims.length} events=${events.length} ledger=${invocationLedger.length}`,
96
105
  `pass=${passCount} blocked=${blockedCount} fail=${failCount}`
97
106
  ];
98
107
  if (issueCodes.length > 0) {
@@ -120,6 +129,16 @@ export async function buildEvidenceSummaryProjection(projectRoot: string, option
120
129
  return projection;
121
130
  }
122
131
 
132
+ function stageEvidenceDisplayRefForRuntimeArtifact(branch: string, artifactPath: string, kind: string): string {
133
+ const portablePath = artifactPath.replace(/\\/g, '/').replace(/^\.\//, '');
134
+ if (portablePath.startsWith('.sdd/runs/')) {
135
+ return portablePath;
136
+ }
137
+ const fileName = portablePath.split('/').filter(Boolean).pop() ?? 'evidence.md';
138
+ const stage = kind === 'validation' || kind === 'test-validation' || fileName.startsWith('validation-') || fileName.startsWith('test-validation-') ? 'test' : 'do';
139
+ return `.sdd/runs/${branchToSafePartition(branch)}/${stage}/${fileName}`;
140
+ }
141
+
123
142
  export async function readRuntimeEvidenceClaims(projectRoot: string, runId: string, taskId: string | null): Promise<EvidenceClaim[]> {
124
143
  return withRuntimeStore(projectRoot, ({ db }) => {
125
144
  const rows = taskId
@@ -33,9 +33,9 @@ export function validateLogWorkerSummary(summary: LogWorkerSummary): LogWorkerSu
33
33
  }
34
34
  const forbiddenAuthority = Array.isArray(candidate.forbiddenAuthority) ? candidate.forbiddenAuthority.filter((item) => typeof item === 'string') : [];
35
35
  if (forbiddenAuthority.length > 0) {
36
- issues.push(contractIssue('forbiddenAuthority', `Log worker summary claims forbidden workflow authority: ${forbiddenAuthority.join(', ')}.`, 'Remove PASS/BLOCKED/route/doctor/sync-back decisions from worker summaries.'));
36
+ issues.push(contractIssue('forbiddenAuthority', `Log worker summary claims forbidden workflow authority: ${forbiddenAuthority.join(', ')}.`, 'Remove PASS/BLOCKED/route/doctor/truth-alignment decisions from worker summaries.'));
37
37
  }
38
- for (const field of ['status', 'verdict', 'routeDecision', 'doctorVerdict', 'syncBackReady']) {
38
+ for (const field of ['status', 'verdict', 'routeDecision', 'doctorVerdict', 'truthAlignmentReady']) {
39
39
  if (field in candidate) {
40
40
  issues.push(contractIssue(field, `Log worker summary must not expose workflow decision field ${field}.`, 'Keep decision fields in core runtime outputs only.'));
41
41
  }
@@ -26,7 +26,7 @@ export interface ContextOffloadDecision {
26
26
  scope: RuntimeScope;
27
27
  action: ContextOffloadAction;
28
28
  loadSignalRef: RuntimeRef;
29
- requiredBefore: 'stage-output' | 'handoff' | 'sync-back' | 'ship' | 'never';
29
+ requiredBefore: 'stage-output' | 'handoff' | 'ship' | 'never';
30
30
  inlineRefs: RuntimeRef[];
31
31
  summarizeRefs: RuntimeRef[];
32
32
  dispatchRefs: RuntimeRef[];
@@ -56,6 +56,8 @@ export const WORKFLOW_STATE_RESOLVER_CONTRACT_VERSION = 'phase-7.3-workflow-stat
56
56
  export const VERIFY_DOCUMENT_CONTRACT_VERSION = 'sdd-verify-doc-v1';
57
57
  export const AGENT_CAPABILITY_CATALOG_CONTRACT_VERSION = 'phase-7.6-agent-capability-catalog-v1';
58
58
  export const COMMAND_TEAM_RUNTIME_CONTRACT_VERSION = 'phase-7.7-command-team-runtime-v1';
59
+ export const STAGE_TEAM_RUNTIME_CONTRACT_VERSION = 'phase-8.15-stage-team-runtime-v1';
60
+ export const WORKFLOW_GATE_RUNTIME_CONTRACT_VERSION = 'phase-8.16-workflow-gate-runtime-v1';
59
61
  export const RUNTIME_PROJECTION_ENVELOPE_CONTRACT_VERSION = 'sdd-runtime-projection-envelope-v1';
60
62
  export const CODING_FACT_SET_CONTRACT_VERSION = 'sdd-coding-fact-set-v1';
61
63
  export const CODING_RISK_PROFILE_CONTRACT_VERSION = 'sdd-coding-risk-profile-v1';
@@ -71,10 +73,11 @@ export const CONTEXT_OFFLOAD_DECISION_CONTRACT_VERSION = 'sdd-context-offload-de
71
73
  export const SCOPED_CONTEXT_HANDOFF_CONTRACT_VERSION = 'sdd-scoped-context-handoff-v1';
72
74
  export const TEST_EVIDENCE_RUN_CONTRACT_VERSION = 'sdd-test-evidence-run-v1';
73
75
  export const MODEL_PRODUCED_ARTIFACT_CONTRACT_VERSION = 'sdd-model-produced-artifact-v1';
76
+ export const STAGE_COLLABORATION_RUNTIME_CONTRACT_VERSION = 'phase-9.1-stage-collaboration-runtime-v1';
74
77
 
75
78
  export type RuntimeConfidence = 'high' | 'medium' | 'low';
76
79
  export type RuntimeProjectionStaleness = 'fresh' | 'stale' | 'incompatible' | 'unknown';
77
- export type SddStage = 'spec' | 'plan' | 'tasks' | 'verifies' | 'do' | 'test' | 'goal-verify' | 'sync-back' | 'ship';
80
+ export type SddStage = 'spec' | 'plan' | 'tasks' | 'verifies' | 'do' | 'test' | 'goal-verify' | 'ship';
78
81
  export type RuntimeRefKind = 'document' | 'task' | 'run' | 'artifact' | 'projection' | 'evidence' | 'command' | 'external';
79
82
 
80
83
  export interface RuntimeScope {
@@ -20,4 +20,7 @@ export interface DelegationRecord {
20
20
  expectedArtifact: string;
21
21
  terminalEventRequired: boolean;
22
22
  terminalEventAt?: string | null;
23
+ attempt?: number;
24
+ retryOf?: string | null;
25
+ replayReason?: 'document_contract_refresh' | 'artifact_reingest' | 'validation_replay' | 'manual_retry' | 'runtime_recovery' | null;
23
26
  }