sdd-agent-platform 0.2.0 → 0.4.0

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 (1290) hide show
  1. package/README.md +239 -239
  2. package/{dist/packages/core/src → node_modules/@sdd-agent-platform/core/dist}/ai-tools.d.ts +4 -3
  3. package/{dist/packages/core/src → node_modules/@sdd-agent-platform/core/dist}/ai-tools.js +249 -102
  4. package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js.map +1 -0
  5. package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.d.ts +24 -0
  6. package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js +181 -0
  7. package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js.map +1 -0
  8. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.d.ts +47 -0
  9. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js +241 -0
  10. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js.map +1 -0
  11. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.d.ts +29 -0
  12. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js +198 -0
  13. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js.map +1 -0
  14. package/node_modules/@sdd-agent-platform/core/dist/artifacts/templates.d.ts +10 -0
  15. package/node_modules/@sdd-agent-platform/core/dist/artifacts/templates.js +79 -0
  16. package/node_modules/@sdd-agent-platform/core/dist/artifacts/templates.js.map +1 -0
  17. package/node_modules/@sdd-agent-platform/core/dist/artifacts.d.ts +4 -0
  18. package/node_modules/@sdd-agent-platform/core/dist/artifacts.js +5 -0
  19. package/node_modules/@sdd-agent-platform/core/dist/artifacts.js.map +1 -0
  20. package/node_modules/@sdd-agent-platform/core/dist/coding-facts/contracts.d.ts +71 -0
  21. package/node_modules/@sdd-agent-platform/core/dist/coding-facts/contracts.js +2 -0
  22. package/node_modules/@sdd-agent-platform/core/dist/coding-facts/contracts.js.map +1 -0
  23. package/node_modules/@sdd-agent-platform/core/dist/coding-facts.d.ts +1 -0
  24. package/node_modules/@sdd-agent-platform/core/dist/coding-facts.js +2 -0
  25. package/node_modules/@sdd-agent-platform/core/dist/coding-facts.js.map +1 -0
  26. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.d.ts +31 -0
  27. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js +88 -0
  28. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js.map +1 -0
  29. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.d.ts +49 -0
  30. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js +202 -0
  31. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js.map +1 -0
  32. package/node_modules/@sdd-agent-platform/core/dist/config/project-detection.d.ts +21 -0
  33. package/node_modules/@sdd-agent-platform/core/dist/config/project-detection.js +111 -0
  34. package/node_modules/@sdd-agent-platform/core/dist/config/project-detection.js.map +1 -0
  35. package/node_modules/@sdd-agent-platform/core/dist/config/project-status.d.ts +1 -0
  36. package/node_modules/@sdd-agent-platform/core/dist/config/project-status.js +2 -0
  37. package/node_modules/@sdd-agent-platform/core/dist/config/project-status.js.map +1 -0
  38. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.d.ts +4 -0
  39. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js +432 -0
  40. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js.map +1 -0
  41. package/node_modules/@sdd-agent-platform/core/dist/context/budget.d.ts +10 -0
  42. package/node_modules/@sdd-agent-platform/core/dist/context/budget.js +20 -0
  43. package/node_modules/@sdd-agent-platform/core/dist/context/budget.js.map +1 -0
  44. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.d.ts +46 -0
  45. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js +244 -0
  46. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js.map +1 -0
  47. package/node_modules/@sdd-agent-platform/core/dist/context/command-summary.d.ts +14 -0
  48. package/node_modules/@sdd-agent-platform/core/dist/context/command-summary.js +34 -0
  49. package/node_modules/@sdd-agent-platform/core/dist/context/command-summary.js.map +1 -0
  50. package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.d.ts +50 -0
  51. package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js +86 -0
  52. package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js.map +1 -0
  53. package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.d.ts +19 -0
  54. package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js +28 -0
  55. package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js.map +1 -0
  56. package/node_modules/@sdd-agent-platform/core/dist/context/source-refs.d.ts +9 -0
  57. package/node_modules/@sdd-agent-platform/core/dist/context/source-refs.js +30 -0
  58. package/node_modules/@sdd-agent-platform/core/dist/context/source-refs.js.map +1 -0
  59. package/node_modules/@sdd-agent-platform/core/dist/context-offload/contracts.d.ts +43 -0
  60. package/node_modules/@sdd-agent-platform/core/dist/context-offload/contracts.js +2 -0
  61. package/node_modules/@sdd-agent-platform/core/dist/context-offload/contracts.js.map +1 -0
  62. package/node_modules/@sdd-agent-platform/core/dist/context-offload/runtime.d.ts +36 -0
  63. package/node_modules/@sdd-agent-platform/core/dist/context-offload/runtime.js +142 -0
  64. package/node_modules/@sdd-agent-platform/core/dist/context-offload/runtime.js.map +1 -0
  65. package/node_modules/@sdd-agent-platform/core/dist/context-offload.d.ts +2 -0
  66. package/node_modules/@sdd-agent-platform/core/dist/context-offload.js +3 -0
  67. package/node_modules/@sdd-agent-platform/core/dist/context-offload.js.map +1 -0
  68. package/node_modules/@sdd-agent-platform/core/dist/context.d.ts +6 -0
  69. package/node_modules/@sdd-agent-platform/core/dist/context.js +7 -0
  70. package/node_modules/@sdd-agent-platform/core/dist/context.js.map +1 -0
  71. package/node_modules/@sdd-agent-platform/core/dist/contracts/issues.d.ts +7 -0
  72. package/node_modules/@sdd-agent-platform/core/dist/contracts/issues.js +7 -0
  73. package/node_modules/@sdd-agent-platform/core/dist/contracts/issues.js.map +1 -0
  74. package/node_modules/@sdd-agent-platform/core/dist/contracts.d.ts +108 -0
  75. package/node_modules/@sdd-agent-platform/core/dist/contracts.js +73 -0
  76. package/node_modules/@sdd-agent-platform/core/dist/contracts.js.map +1 -0
  77. package/node_modules/@sdd-agent-platform/core/dist/delegation/model.d.ts +21 -0
  78. package/node_modules/@sdd-agent-platform/core/dist/delegation/model.js +2 -0
  79. package/node_modules/@sdd-agent-platform/core/dist/delegation/model.js.map +1 -0
  80. package/node_modules/@sdd-agent-platform/core/dist/delegation/queue.d.ts +10 -0
  81. package/node_modules/@sdd-agent-platform/core/dist/delegation/queue.js +47 -0
  82. package/node_modules/@sdd-agent-platform/core/dist/delegation/queue.js.map +1 -0
  83. package/node_modules/@sdd-agent-platform/core/dist/delegation/run-state.d.ts +2 -0
  84. package/node_modules/@sdd-agent-platform/core/dist/delegation/run-state.js +13 -0
  85. package/node_modules/@sdd-agent-platform/core/dist/delegation/run-state.js.map +1 -0
  86. package/node_modules/@sdd-agent-platform/core/dist/delegation/state-machine.d.ts +30 -0
  87. package/node_modules/@sdd-agent-platform/core/dist/delegation/state-machine.js +56 -0
  88. package/node_modules/@sdd-agent-platform/core/dist/delegation/state-machine.js.map +1 -0
  89. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.d.ts +28 -0
  90. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js +100 -0
  91. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js.map +1 -0
  92. package/node_modules/@sdd-agent-platform/core/dist/delegation.d.ts +7 -0
  93. package/node_modules/@sdd-agent-platform/core/dist/delegation.js +6 -0
  94. package/node_modules/@sdd-agent-platform/core/dist/delegation.js.map +1 -0
  95. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/ai-entries.d.ts +2 -0
  96. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/ai-entries.js +26 -0
  97. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/ai-entries.js.map +1 -0
  98. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.d.ts +2 -0
  99. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js +104 -0
  100. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js.map +1 -0
  101. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/local-run-index.d.ts +2 -0
  102. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/local-run-index.js +26 -0
  103. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/local-run-index.js.map +1 -0
  104. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.d.ts +11 -0
  105. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js +78 -0
  106. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js.map +1 -0
  107. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.d.ts +11 -0
  108. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js +247 -0
  109. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js.map +1 -0
  110. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.d.ts +6 -0
  111. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js +313 -0
  112. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js.map +1 -0
  113. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-records.d.ts +4 -0
  114. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-records.js +68 -0
  115. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-records.js.map +1 -0
  116. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.d.ts +3 -0
  117. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js +121 -0
  118. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js.map +1 -0
  119. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.d.ts +11 -0
  120. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js +279 -0
  121. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js.map +1 -0
  122. package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.d.ts +6 -0
  123. package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js +138 -0
  124. package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js.map +1 -0
  125. package/node_modules/@sdd-agent-platform/core/dist/doctor/model.d.ts +11 -0
  126. package/node_modules/@sdd-agent-platform/core/dist/doctor/model.js +2 -0
  127. package/node_modules/@sdd-agent-platform/core/dist/doctor/model.js.map +1 -0
  128. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.d.ts +2 -0
  129. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js +44 -0
  130. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js.map +1 -0
  131. package/node_modules/@sdd-agent-platform/core/dist/doctor/summary.d.ts +2 -0
  132. package/node_modules/@sdd-agent-platform/core/dist/doctor/summary.js +10 -0
  133. package/node_modules/@sdd-agent-platform/core/dist/doctor/summary.js.map +1 -0
  134. package/node_modules/@sdd-agent-platform/core/dist/doctor.d.ts +2 -0
  135. package/node_modules/@sdd-agent-platform/core/dist/doctor.js +3 -0
  136. package/node_modules/@sdd-agent-platform/core/dist/doctor.js.map +1 -0
  137. package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/contracts.d.ts +33 -0
  138. package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/contracts.js +2 -0
  139. package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/contracts.js.map +1 -0
  140. package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime.d.ts +1 -0
  141. package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime.js +2 -0
  142. package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime.js.map +1 -0
  143. package/node_modules/@sdd-agent-platform/core/dist/execution/agent-execution-records.d.ts +31 -0
  144. package/node_modules/@sdd-agent-platform/core/dist/execution/agent-execution-records.js +163 -0
  145. package/node_modules/@sdd-agent-platform/core/dist/execution/agent-execution-records.js.map +1 -0
  146. package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.d.ts +44 -0
  147. package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js +249 -0
  148. package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js.map +1 -0
  149. package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.d.ts +55 -0
  150. package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js +363 -0
  151. package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js.map +1 -0
  152. package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.d.ts +27 -0
  153. package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js +185 -0
  154. package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js.map +1 -0
  155. package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.d.ts +100 -0
  156. package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js +319 -0
  157. package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js.map +1 -0
  158. package/node_modules/@sdd-agent-platform/core/dist/execution/wave-executor.d.ts +45 -0
  159. package/node_modules/@sdd-agent-platform/core/dist/execution/wave-executor.js +178 -0
  160. package/node_modules/@sdd-agent-platform/core/dist/execution/wave-executor.js.map +1 -0
  161. package/node_modules/@sdd-agent-platform/core/dist/execution.d.ts +5 -0
  162. package/node_modules/@sdd-agent-platform/core/dist/execution.js +6 -0
  163. package/node_modules/@sdd-agent-platform/core/dist/execution.js.map +1 -0
  164. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.d.ts +53 -0
  165. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js +111 -0
  166. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js.map +1 -0
  167. package/node_modules/@sdd-agent-platform/core/dist/governance.d.ts +1 -0
  168. package/node_modules/@sdd-agent-platform/core/dist/governance.js +2 -0
  169. package/node_modules/@sdd-agent-platform/core/dist/governance.js.map +1 -0
  170. package/node_modules/@sdd-agent-platform/core/dist/index.d.ts +1 -0
  171. package/node_modules/@sdd-agent-platform/core/dist/index.js +2 -0
  172. package/node_modules/@sdd-agent-platform/core/dist/index.js.map +1 -0
  173. package/{dist/packages/core/src → node_modules/@sdd-agent-platform/core/dist}/instructions.d.ts +1 -1
  174. package/{dist/packages/core/src → node_modules/@sdd-agent-platform/core/dist}/instructions.js +48 -19
  175. package/node_modules/@sdd-agent-platform/core/dist/instructions.js.map +1 -0
  176. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.d.ts +39 -0
  177. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js +319 -0
  178. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js.map +1 -0
  179. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/rendering.d.ts +2 -0
  180. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/rendering.js +27 -0
  181. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/rendering.js.map +1 -0
  182. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/risk-signals.d.ts +57 -0
  183. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/risk-signals.js +80 -0
  184. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/risk-signals.js.map +1 -0
  185. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.d.ts +42 -0
  186. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js +187 -0
  187. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js.map +1 -0
  188. package/node_modules/@sdd-agent-platform/core/dist/lifecycle.d.ts +4 -0
  189. package/node_modules/@sdd-agent-platform/core/dist/lifecycle.js +5 -0
  190. package/node_modules/@sdd-agent-platform/core/dist/lifecycle.js.map +1 -0
  191. package/node_modules/@sdd-agent-platform/core/dist/orchestration/contracts.d.ts +45 -0
  192. package/node_modules/@sdd-agent-platform/core/dist/orchestration/contracts.js +2 -0
  193. package/node_modules/@sdd-agent-platform/core/dist/orchestration/contracts.js.map +1 -0
  194. package/node_modules/@sdd-agent-platform/core/dist/orchestration/index.d.ts +2 -0
  195. package/node_modules/@sdd-agent-platform/core/dist/orchestration/index.js +3 -0
  196. package/node_modules/@sdd-agent-platform/core/dist/orchestration/index.js.map +1 -0
  197. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.d.ts +55 -0
  198. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js +314 -0
  199. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js.map +1 -0
  200. package/node_modules/@sdd-agent-platform/core/dist/path-safety.js.map +1 -0
  201. package/node_modules/@sdd-agent-platform/core/dist/planning/task-graph.d.ts +57 -0
  202. package/node_modules/@sdd-agent-platform/core/dist/planning/task-graph.js +157 -0
  203. package/node_modules/@sdd-agent-platform/core/dist/planning/task-graph.js.map +1 -0
  204. package/node_modules/@sdd-agent-platform/core/dist/planning/wave-plan.d.ts +37 -0
  205. package/node_modules/@sdd-agent-platform/core/dist/planning/wave-plan.js +119 -0
  206. package/node_modules/@sdd-agent-platform/core/dist/planning/wave-plan.js.map +1 -0
  207. package/node_modules/@sdd-agent-platform/core/dist/planning.d.ts +2 -0
  208. package/node_modules/@sdd-agent-platform/core/dist/planning.js +3 -0
  209. package/node_modules/@sdd-agent-platform/core/dist/planning.js.map +1 -0
  210. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.d.ts +55 -0
  211. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js +109 -0
  212. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js.map +1 -0
  213. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.d.ts +22 -0
  214. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js +121 -0
  215. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js.map +1 -0
  216. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.d.ts +51 -0
  217. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js +39 -0
  218. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js.map +1 -0
  219. package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.d.ts +17 -0
  220. package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js +14 -0
  221. package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js.map +1 -0
  222. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.d.ts +70 -0
  223. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js +220 -0
  224. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js.map +1 -0
  225. package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.d.ts +64 -0
  226. package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js +161 -0
  227. package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js.map +1 -0
  228. package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.d.ts +28 -0
  229. package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js +84 -0
  230. package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js.map +1 -0
  231. package/node_modules/@sdd-agent-platform/core/dist/registries/skill-capabilities.d.ts +22 -0
  232. package/node_modules/@sdd-agent-platform/core/dist/registries/skill-capabilities.js +16 -0
  233. package/node_modules/@sdd-agent-platform/core/dist/registries/skill-capabilities.js.map +1 -0
  234. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.d.ts +20 -0
  235. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js +111 -0
  236. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js.map +1 -0
  237. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.d.ts +21 -0
  238. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js +107 -0
  239. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js.map +1 -0
  240. package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.d.ts +38 -0
  241. package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js +99 -0
  242. package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js.map +1 -0
  243. package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.d.ts +19 -0
  244. package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js +89 -0
  245. package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js.map +1 -0
  246. package/node_modules/@sdd-agent-platform/core/dist/registries.d.ts +14 -0
  247. package/node_modules/@sdd-agent-platform/core/dist/registries.js +13 -0
  248. package/node_modules/@sdd-agent-platform/core/dist/registries.js.map +1 -0
  249. package/node_modules/@sdd-agent-platform/core/dist/risk/consumer-diagnostics.d.ts +18 -0
  250. package/node_modules/@sdd-agent-platform/core/dist/risk/consumer-diagnostics.js +77 -0
  251. package/node_modules/@sdd-agent-platform/core/dist/risk/consumer-diagnostics.js.map +1 -0
  252. package/node_modules/@sdd-agent-platform/core/dist/risk/contracts.d.ts +57 -0
  253. package/node_modules/@sdd-agent-platform/core/dist/risk/contracts.js +2 -0
  254. package/node_modules/@sdd-agent-platform/core/dist/risk/contracts.js.map +1 -0
  255. package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.d.ts +20 -0
  256. package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js +195 -0
  257. package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js.map +1 -0
  258. package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.d.ts +33 -0
  259. package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js +215 -0
  260. package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js.map +1 -0
  261. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.d.ts +24 -0
  262. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js +160 -0
  263. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js.map +1 -0
  264. package/node_modules/@sdd-agent-platform/core/dist/risk.d.ts +5 -0
  265. package/node_modules/@sdd-agent-platform/core/dist/risk.js +6 -0
  266. package/node_modules/@sdd-agent-platform/core/dist/risk.js.map +1 -0
  267. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.d.ts +4 -0
  268. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js +263 -0
  269. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js.map +1 -0
  270. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime.d.ts +285 -0
  271. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime.js +2 -0
  272. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime.js.map +1 -0
  273. package/node_modules/@sdd-agent-platform/core/dist/router/profile-resolution.d.ts +18 -0
  274. package/node_modules/@sdd-agent-platform/core/dist/router/profile-resolution.js +127 -0
  275. package/node_modules/@sdd-agent-platform/core/dist/router/profile-resolution.js.map +1 -0
  276. package/node_modules/@sdd-agent-platform/core/dist/router/risk-policy.d.ts +6 -0
  277. package/node_modules/@sdd-agent-platform/core/dist/router/risk-policy.js +28 -0
  278. package/node_modules/@sdd-agent-platform/core/dist/router/risk-policy.js.map +1 -0
  279. package/node_modules/@sdd-agent-platform/core/dist/router/route-cache.d.ts +39 -0
  280. package/node_modules/@sdd-agent-platform/core/dist/router/route-cache.js +59 -0
  281. package/node_modules/@sdd-agent-platform/core/dist/router/route-cache.js.map +1 -0
  282. package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.d.ts +12 -0
  283. package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js +127 -0
  284. package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js.map +1 -0
  285. package/node_modules/@sdd-agent-platform/core/dist/router/route-sdd-task.d.ts +3 -0
  286. package/node_modules/@sdd-agent-platform/core/dist/router/route-sdd-task.js +4 -0
  287. package/node_modules/@sdd-agent-platform/core/dist/router/route-sdd-task.js.map +1 -0
  288. package/node_modules/@sdd-agent-platform/core/dist/router/routing-rules.d.ts +4 -0
  289. package/node_modules/@sdd-agent-platform/core/dist/router/routing-rules.js +68 -0
  290. package/node_modules/@sdd-agent-platform/core/dist/router/routing-rules.js.map +1 -0
  291. package/node_modules/@sdd-agent-platform/core/dist/router/routing.d.ts +18 -0
  292. package/node_modules/@sdd-agent-platform/core/dist/router/routing.js +143 -0
  293. package/node_modules/@sdd-agent-platform/core/dist/router/routing.js.map +1 -0
  294. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-inspection.d.ts +7 -0
  295. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-inspection.js +95 -0
  296. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-inspection.js.map +1 -0
  297. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-registry.d.ts +17 -0
  298. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-registry.js +82 -0
  299. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-registry.js.map +1 -0
  300. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.d.ts +26 -0
  301. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js +207 -0
  302. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js.map +1 -0
  303. package/node_modules/@sdd-agent-platform/core/dist/router/team-mode.d.ts +16 -0
  304. package/node_modules/@sdd-agent-platform/core/dist/router/team-mode.js +134 -0
  305. package/node_modules/@sdd-agent-platform/core/dist/router/team-mode.js.map +1 -0
  306. package/node_modules/@sdd-agent-platform/core/dist/router.d.ts +4 -0
  307. package/node_modules/@sdd-agent-platform/core/dist/router.js +5 -0
  308. package/node_modules/@sdd-agent-platform/core/dist/router.js.map +1 -0
  309. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.d.ts +6 -0
  310. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js +80 -0
  311. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js.map +1 -0
  312. package/node_modules/@sdd-agent-platform/core/dist/run-state/events.d.ts +3 -0
  313. package/node_modules/@sdd-agent-platform/core/dist/run-state/events.js +23 -0
  314. package/node_modules/@sdd-agent-platform/core/dist/run-state/events.js.map +1 -0
  315. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.d.ts +100 -0
  316. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js +117 -0
  317. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js.map +1 -0
  318. package/node_modules/@sdd-agent-platform/core/dist/run-state/invocation-ledger.d.ts +18 -0
  319. package/node_modules/@sdd-agent-platform/core/dist/run-state/invocation-ledger.js +99 -0
  320. package/node_modules/@sdd-agent-platform/core/dist/run-state/invocation-ledger.js.map +1 -0
  321. package/node_modules/@sdd-agent-platform/core/dist/run-state/model.d.ts +179 -0
  322. package/node_modules/@sdd-agent-platform/core/dist/run-state/model.js +2 -0
  323. package/node_modules/@sdd-agent-platform/core/dist/run-state/model.js.map +1 -0
  324. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.d.ts +97 -0
  325. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js +238 -0
  326. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js.map +1 -0
  327. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.d.ts +20 -0
  328. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js +359 -0
  329. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js.map +1 -0
  330. package/node_modules/@sdd-agent-platform/core/dist/run-state.d.ts +7 -0
  331. package/node_modules/@sdd-agent-platform/core/dist/run-state.js +8 -0
  332. package/node_modules/@sdd-agent-platform/core/dist/run-state.js.map +1 -0
  333. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.d.ts +2 -0
  334. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js +61 -0
  335. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js.map +1 -0
  336. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.d.ts +4 -0
  337. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js +274 -0
  338. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js.map +1 -0
  339. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/model.d.ts +175 -0
  340. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/model.js +2 -0
  341. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/model.js.map +1 -0
  342. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis.d.ts +3 -0
  343. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis.js +4 -0
  344. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis.js.map +1 -0
  345. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.d.ts +25 -0
  346. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js +112 -0
  347. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js.map +1 -0
  348. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/context.d.ts +18 -0
  349. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/context.js +89 -0
  350. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/context.js.map +1 -0
  351. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.d.ts +6 -0
  352. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js +79 -0
  353. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js.map +1 -0
  354. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-inspection.d.ts +6 -0
  355. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-inspection.js +31 -0
  356. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-inspection.js.map +1 -0
  357. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.d.ts +78 -0
  358. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js +458 -0
  359. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js.map +1 -0
  360. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-rendering.d.ts +5 -0
  361. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-rendering.js +77 -0
  362. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-rendering.js.map +1 -0
  363. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs.d.ts +5 -0
  364. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs.js +6 -0
  365. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs.js.map +1 -0
  366. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/contracts.d.ts +37 -0
  367. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/contracts.js +2 -0
  368. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/contracts.js.map +1 -0
  369. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.d.ts +71 -0
  370. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js +275 -0
  371. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js.map +1 -0
  372. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime.d.ts +2 -0
  373. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime.js +3 -0
  374. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime.js.map +1 -0
  375. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.d.ts +105 -0
  376. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js +251 -0
  377. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js.map +1 -0
  378. package/node_modules/@sdd-agent-platform/core/dist/status.d.ts +2 -0
  379. package/node_modules/@sdd-agent-platform/core/dist/status.js +3 -0
  380. package/node_modules/@sdd-agent-platform/core/dist/status.js.map +1 -0
  381. package/node_modules/@sdd-agent-platform/core/dist/storage/json-io.d.ts +1 -0
  382. package/node_modules/@sdd-agent-platform/core/dist/storage/json-io.js +11 -0
  383. package/node_modules/@sdd-agent-platform/core/dist/storage/json-io.js.map +1 -0
  384. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.d.ts +112 -0
  385. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js +362 -0
  386. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js.map +1 -0
  387. package/node_modules/@sdd-agent-platform/core/dist/subagents/contracts.d.ts +41 -0
  388. package/node_modules/@sdd-agent-platform/core/dist/subagents/contracts.js +2 -0
  389. package/node_modules/@sdd-agent-platform/core/dist/subagents/contracts.js.map +1 -0
  390. package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.d.ts +43 -0
  391. package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js +262 -0
  392. package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js.map +1 -0
  393. package/node_modules/@sdd-agent-platform/core/dist/subagents.d.ts +2 -0
  394. package/node_modules/@sdd-agent-platform/core/dist/subagents.js +3 -0
  395. package/node_modules/@sdd-agent-platform/core/dist/subagents.js.map +1 -0
  396. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.d.ts +17 -0
  397. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js +221 -0
  398. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js.map +1 -0
  399. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.d.ts +91 -0
  400. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js +395 -0
  401. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js.map +1 -0
  402. package/node_modules/@sdd-agent-platform/core/dist/sync-back.d.ts +2 -0
  403. package/node_modules/@sdd-agent-platform/core/dist/sync-back.js +3 -0
  404. package/node_modules/@sdd-agent-platform/core/dist/sync-back.js.map +1 -0
  405. package/node_modules/@sdd-agent-platform/core/dist/task-risk-profile.d.ts +33 -0
  406. package/node_modules/@sdd-agent-platform/core/dist/task-risk-profile.js +153 -0
  407. package/node_modules/@sdd-agent-platform/core/dist/task-risk-profile.js.map +1 -0
  408. package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.d.ts +21 -0
  409. package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js +363 -0
  410. package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js.map +1 -0
  411. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.d.ts +2 -0
  412. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js +55 -0
  413. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js.map +1 -0
  414. package/node_modules/@sdd-agent-platform/core/dist/test-support.d.ts +2 -0
  415. package/node_modules/@sdd-agent-platform/core/dist/test-support.js +3 -0
  416. package/node_modules/@sdd-agent-platform/core/dist/test-support.js.map +1 -0
  417. package/node_modules/@sdd-agent-platform/core/dist/tsconfig.tsbuildinfo +1 -0
  418. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.d.ts +50 -0
  419. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js +514 -0
  420. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js.map +1 -0
  421. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.d.ts +51 -0
  422. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js +119 -0
  423. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js.map +1 -0
  424. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.d.ts +29 -0
  425. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js +332 -0
  426. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js.map +1 -0
  427. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.d.ts +62 -0
  428. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js +591 -0
  429. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js.map +1 -0
  430. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.d.ts +42 -0
  431. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js +201 -0
  432. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js.map +1 -0
  433. package/node_modules/@sdd-agent-platform/core/dist/verification.d.ts +6 -0
  434. package/node_modules/@sdd-agent-platform/core/dist/verification.js +6 -0
  435. package/node_modules/@sdd-agent-platform/core/dist/verification.js.map +1 -0
  436. package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.d.ts +24 -0
  437. package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.js +2 -0
  438. package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.js.map +1 -0
  439. package/node_modules/@sdd-agent-platform/core/dist/work-units/runtime.d.ts +21 -0
  440. package/node_modules/@sdd-agent-platform/core/dist/work-units/runtime.js +90 -0
  441. package/node_modules/@sdd-agent-platform/core/dist/work-units/runtime.js.map +1 -0
  442. package/node_modules/@sdd-agent-platform/core/dist/work-units.d.ts +2 -0
  443. package/node_modules/@sdd-agent-platform/core/dist/work-units.js +3 -0
  444. package/node_modules/@sdd-agent-platform/core/dist/work-units.js.map +1 -0
  445. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.d.ts +12 -0
  446. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js +60 -0
  447. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js.map +1 -0
  448. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.d.ts +25 -0
  449. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js +64 -0
  450. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js.map +1 -0
  451. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.d.ts +50 -0
  452. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js +124 -0
  453. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js.map +1 -0
  454. package/node_modules/@sdd-agent-platform/core/dist/workflow-state.d.ts +1 -0
  455. package/node_modules/@sdd-agent-platform/core/dist/workflow-state.js +2 -0
  456. package/node_modules/@sdd-agent-platform/core/dist/workflow-state.js.map +1 -0
  457. package/node_modules/@sdd-agent-platform/core/dist/worktree/isolation.d.ts +40 -0
  458. package/node_modules/@sdd-agent-platform/core/dist/worktree/isolation.js +89 -0
  459. package/node_modules/@sdd-agent-platform/core/dist/worktree/isolation.js.map +1 -0
  460. package/node_modules/@sdd-agent-platform/core/dist/worktree/lifecycle.d.ts +39 -0
  461. package/node_modules/@sdd-agent-platform/core/dist/worktree/lifecycle.js +221 -0
  462. package/node_modules/@sdd-agent-platform/core/dist/worktree/lifecycle.js.map +1 -0
  463. package/node_modules/@sdd-agent-platform/core/dist/worktree.d.ts +2 -0
  464. package/node_modules/@sdd-agent-platform/core/dist/worktree.js +3 -0
  465. package/node_modules/@sdd-agent-platform/core/dist/worktree.js.map +1 -0
  466. package/node_modules/@sdd-agent-platform/core/package.json +40 -0
  467. package/node_modules/@sdd-agent-platform/core/src/ai-tools.test.ts +138 -0
  468. package/node_modules/@sdd-agent-platform/core/src/ai-tools.ts +574 -0
  469. package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.test.ts +189 -0
  470. package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.ts +222 -0
  471. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-evidence.test.ts +28 -0
  472. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-evidence.ts +302 -0
  473. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.test.ts +135 -0
  474. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.ts +231 -0
  475. package/node_modules/@sdd-agent-platform/core/src/artifacts/templates.ts +99 -0
  476. package/node_modules/@sdd-agent-platform/core/src/artifacts.ts +4 -0
  477. package/node_modules/@sdd-agent-platform/core/src/coding-facts/contracts.ts +79 -0
  478. package/node_modules/@sdd-agent-platform/core/src/coding-facts.ts +1 -0
  479. package/node_modules/@sdd-agent-platform/core/src/config/init-project.test.ts +303 -0
  480. package/node_modules/@sdd-agent-platform/core/src/config/init-project.ts +119 -0
  481. package/node_modules/@sdd-agent-platform/core/src/config/project-config.ts +259 -0
  482. package/node_modules/@sdd-agent-platform/core/src/config/project-detection.ts +147 -0
  483. package/node_modules/@sdd-agent-platform/core/src/config/project-status.ts +1 -0
  484. package/node_modules/@sdd-agent-platform/core/src/config/starter-documents.ts +435 -0
  485. package/node_modules/@sdd-agent-platform/core/src/context/budget.ts +30 -0
  486. package/node_modules/@sdd-agent-platform/core/src/context/build-package.ts +317 -0
  487. package/node_modules/@sdd-agent-platform/core/src/context/command-summary.ts +45 -0
  488. package/node_modules/@sdd-agent-platform/core/src/context/context-build.test.ts +188 -0
  489. package/node_modules/@sdd-agent-platform/core/src/context/evidence-summary.ts +144 -0
  490. package/node_modules/@sdd-agent-platform/core/src/context/log-worker.ts +48 -0
  491. package/node_modules/@sdd-agent-platform/core/src/context/source-refs.ts +41 -0
  492. package/node_modules/@sdd-agent-platform/core/src/context-offload/contracts.ts +47 -0
  493. package/node_modules/@sdd-agent-platform/core/src/context-offload/runtime.test.ts +71 -0
  494. package/node_modules/@sdd-agent-platform/core/src/context-offload/runtime.ts +178 -0
  495. package/node_modules/@sdd-agent-platform/core/src/context-offload.ts +2 -0
  496. package/node_modules/@sdd-agent-platform/core/src/context.ts +6 -0
  497. package/node_modules/@sdd-agent-platform/core/src/contracts/issues.ts +13 -0
  498. package/node_modules/@sdd-agent-platform/core/src/contracts.test.ts +9 -0
  499. package/node_modules/@sdd-agent-platform/core/src/contracts.ts +114 -0
  500. package/node_modules/@sdd-agent-platform/core/src/delegation/delegation.test.ts +183 -0
  501. package/node_modules/@sdd-agent-platform/core/src/delegation/model.ts +23 -0
  502. package/node_modules/@sdd-agent-platform/core/src/delegation/queue.ts +58 -0
  503. package/node_modules/@sdd-agent-platform/core/src/delegation/run-state.ts +14 -0
  504. package/node_modules/@sdd-agent-platform/core/src/delegation/state-machine.ts +90 -0
  505. package/node_modules/@sdd-agent-platform/core/src/delegation/validation.ts +124 -0
  506. package/node_modules/@sdd-agent-platform/core/src/delegation.ts +26 -0
  507. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/ai-entries.ts +28 -0
  508. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/document-chain.ts +112 -0
  509. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/local-run-index.ts +27 -0
  510. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/project.ts +84 -0
  511. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/registries.ts +252 -0
  512. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-evidence.ts +330 -0
  513. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-records.ts +79 -0
  514. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-trust.ts +128 -0
  515. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/runtime-contracts.ts +300 -0
  516. package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.test.ts +545 -0
  517. package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.ts +156 -0
  518. package/node_modules/@sdd-agent-platform/core/src/doctor/model.ts +13 -0
  519. package/node_modules/@sdd-agent-platform/core/src/doctor/summary.ts +11 -0
  520. package/node_modules/@sdd-agent-platform/core/src/doctor.ts +2 -0
  521. package/node_modules/@sdd-agent-platform/core/src/evidence-runtime/contracts.ts +37 -0
  522. package/node_modules/@sdd-agent-platform/core/src/evidence-runtime.ts +1 -0
  523. package/node_modules/@sdd-agent-platform/core/src/execution/agent-execution-records.ts +190 -0
  524. package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.test.ts +180 -0
  525. package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.ts +305 -0
  526. package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.test.ts +97 -0
  527. package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.ts +453 -0
  528. package/node_modules/@sdd-agent-platform/core/src/execution/host-invocation.ts +225 -0
  529. package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.test.ts +127 -0
  530. package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.ts +428 -0
  531. package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.test.ts +107 -0
  532. package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.ts +231 -0
  533. package/node_modules/@sdd-agent-platform/core/src/execution.ts +5 -0
  534. package/node_modules/@sdd-agent-platform/core/src/governance/policy.test.ts +55 -0
  535. package/node_modules/@sdd-agent-platform/core/src/governance/policy.ts +175 -0
  536. package/node_modules/@sdd-agent-platform/core/src/governance.ts +1 -0
  537. package/node_modules/@sdd-agent-platform/core/src/index.test.ts +25 -0
  538. package/node_modules/@sdd-agent-platform/core/src/index.ts +1 -0
  539. package/node_modules/@sdd-agent-platform/core/src/instructions.test.ts +43 -0
  540. package/node_modules/@sdd-agent-platform/core/src/instructions.ts +165 -0
  541. package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.test.ts +174 -0
  542. package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.ts +373 -0
  543. package/node_modules/@sdd-agent-platform/core/src/lifecycle/rendering.ts +29 -0
  544. package/node_modules/@sdd-agent-platform/core/src/lifecycle/risk-signals.ts +146 -0
  545. package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.ts +241 -0
  546. package/node_modules/@sdd-agent-platform/core/src/lifecycle.ts +4 -0
  547. package/node_modules/@sdd-agent-platform/core/src/orchestration/contracts.ts +50 -0
  548. package/node_modules/@sdd-agent-platform/core/src/orchestration/index.ts +2 -0
  549. package/node_modules/@sdd-agent-platform/core/src/orchestration/runtime.ts +342 -0
  550. package/node_modules/@sdd-agent-platform/core/src/path-safety.test.ts +22 -0
  551. package/node_modules/@sdd-agent-platform/core/src/path-safety.ts +37 -0
  552. package/node_modules/@sdd-agent-platform/core/src/phase8-contracts.test.ts +242 -0
  553. package/node_modules/@sdd-agent-platform/core/src/phase8-projection-compat.test.ts +153 -0
  554. package/node_modules/@sdd-agent-platform/core/src/phase8-risk-kernel.test.ts +272 -0
  555. package/node_modules/@sdd-agent-platform/core/src/planning/task-graph.test.ts +86 -0
  556. package/node_modules/@sdd-agent-platform/core/src/planning/task-graph.ts +222 -0
  557. package/node_modules/@sdd-agent-platform/core/src/planning/wave-plan.test.ts +76 -0
  558. package/node_modules/@sdd-agent-platform/core/src/planning/wave-plan.ts +160 -0
  559. package/node_modules/@sdd-agent-platform/core/src/planning.ts +2 -0
  560. package/node_modules/@sdd-agent-platform/core/src/registries/agent-capability-catalog.ts +174 -0
  561. package/node_modules/@sdd-agent-platform/core/src/registries/agent-registry.ts +146 -0
  562. package/node_modules/@sdd-agent-platform/core/src/registries/agent-runtime-static.ts +102 -0
  563. package/node_modules/@sdd-agent-platform/core/src/registries/capability-sources.ts +30 -0
  564. package/node_modules/@sdd-agent-platform/core/src/registries/command-team-runtime.ts +309 -0
  565. package/node_modules/@sdd-agent-platform/core/src/registries/eval-learning-context.ts +246 -0
  566. package/node_modules/@sdd-agent-platform/core/src/registries/query-status.ts +119 -0
  567. package/node_modules/@sdd-agent-platform/core/src/registries/registries.test.ts +404 -0
  568. package/node_modules/@sdd-agent-platform/core/src/registries/skill-capabilities.ts +37 -0
  569. package/node_modules/@sdd-agent-platform/core/src/registries/tool-capabilities.ts +135 -0
  570. package/node_modules/@sdd-agent-platform/core/src/registries/tool-plugins.ts +132 -0
  571. package/node_modules/@sdd-agent-platform/core/src/registries/worker-adapters.ts +144 -0
  572. package/node_modules/@sdd-agent-platform/core/src/registries/workflow-gates.ts +111 -0
  573. package/node_modules/@sdd-agent-platform/core/src/registries.ts +42 -0
  574. package/node_modules/@sdd-agent-platform/core/src/risk/consumer-diagnostics.ts +97 -0
  575. package/node_modules/@sdd-agent-platform/core/src/risk/contracts.ts +63 -0
  576. package/node_modules/@sdd-agent-platform/core/src/risk/kernel.ts +233 -0
  577. package/node_modules/@sdd-agent-platform/core/src/risk/legacy-adapters.ts +266 -0
  578. package/node_modules/@sdd-agent-platform/core/src/risk/workflow-gates.ts +203 -0
  579. package/node_modules/@sdd-agent-platform/core/src/risk.ts +5 -0
  580. package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime-config.ts +308 -0
  581. package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime.ts +323 -0
  582. package/node_modules/@sdd-agent-platform/core/src/router/profile-resolution.ts +154 -0
  583. package/node_modules/@sdd-agent-platform/core/src/router/risk-policy.ts +33 -0
  584. package/node_modules/@sdd-agent-platform/core/src/router/route-cache.ts +100 -0
  585. package/node_modules/@sdd-agent-platform/core/src/router/route-projection.ts +146 -0
  586. package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.test.ts +281 -0
  587. package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.ts +3 -0
  588. package/node_modules/@sdd-agent-platform/core/src/router/routing-rules.ts +73 -0
  589. package/node_modules/@sdd-agent-platform/core/src/router/routing.ts +163 -0
  590. package/node_modules/@sdd-agent-platform/core/src/router/runtime-inspection.ts +117 -0
  591. package/node_modules/@sdd-agent-platform/core/src/router/runtime-registry.ts +123 -0
  592. package/node_modules/@sdd-agent-platform/core/src/router/runtime-validation.ts +248 -0
  593. package/node_modules/@sdd-agent-platform/core/src/router/team-mode.ts +170 -0
  594. package/node_modules/@sdd-agent-platform/core/src/router.ts +4 -0
  595. package/node_modules/@sdd-agent-platform/core/src/run-state/artifacts.ts +85 -0
  596. package/node_modules/@sdd-agent-platform/core/src/run-state/events.ts +27 -0
  597. package/node_modules/@sdd-agent-platform/core/src/run-state/inspect-run.ts +207 -0
  598. package/node_modules/@sdd-agent-platform/core/src/run-state/invocation-ledger.ts +109 -0
  599. package/node_modules/@sdd-agent-platform/core/src/run-state/model.ts +204 -0
  600. package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.test.ts +52 -0
  601. package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.ts +356 -0
  602. package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.test.ts +67 -0
  603. package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.ts +402 -0
  604. package/node_modules/@sdd-agent-platform/core/src/run-state.ts +7 -0
  605. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/build.ts +63 -0
  606. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/findings.ts +296 -0
  607. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/model.ts +152 -0
  608. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.test.ts +68 -0
  609. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.ts +3 -0
  610. package/node_modules/@sdd-agent-platform/core/src/runtime-paths.ts +136 -0
  611. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/context.ts +111 -0
  612. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/run-binding.ts +86 -0
  613. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-inspection.ts +39 -0
  614. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.test.ts +262 -0
  615. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.ts +581 -0
  616. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-rendering.ts +81 -0
  617. package/node_modules/@sdd-agent-platform/core/src/sdd-docs.ts +5 -0
  618. package/node_modules/@sdd-agent-platform/core/src/stage-runtime/contracts.ts +40 -0
  619. package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.test.ts +209 -0
  620. package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.ts +352 -0
  621. package/node_modules/@sdd-agent-platform/core/src/stage-runtime.ts +2 -0
  622. package/node_modules/@sdd-agent-platform/core/src/status/project-status.test.ts +288 -0
  623. package/node_modules/@sdd-agent-platform/core/src/status/project-status.ts +362 -0
  624. package/node_modules/@sdd-agent-platform/core/src/status.ts +2 -0
  625. package/node_modules/@sdd-agent-platform/core/src/storage/json-io.ts +10 -0
  626. package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.test.ts +125 -0
  627. package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.ts +480 -0
  628. package/node_modules/@sdd-agent-platform/core/src/subagents/contracts.ts +45 -0
  629. package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.test.ts +232 -0
  630. package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.ts +307 -0
  631. package/node_modules/@sdd-agent-platform/core/src/subagents.ts +2 -0
  632. package/node_modules/@sdd-agent-platform/core/src/sync-back/apply.ts +248 -0
  633. package/node_modules/@sdd-agent-platform/core/src/sync-back/inspect.ts +522 -0
  634. package/node_modules/@sdd-agent-platform/core/src/sync-back/sync-back.test.ts +446 -0
  635. package/node_modules/@sdd-agent-platform/core/src/sync-back.ts +2 -0
  636. package/node_modules/@sdd-agent-platform/core/src/task-risk-profile.ts +193 -0
  637. package/node_modules/@sdd-agent-platform/core/src/test-support/fixtures.ts +377 -0
  638. package/node_modules/@sdd-agent-platform/core/src/test-support/run-state.ts +56 -0
  639. package/node_modules/@sdd-agent-platform/core/src/test-support.ts +2 -0
  640. package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.test.ts +335 -0
  641. package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.ts +615 -0
  642. package/node_modules/@sdd-agent-platform/core/src/verification/rendering.ts +171 -0
  643. package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.test.ts +195 -0
  644. package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.ts +396 -0
  645. package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.test.ts +392 -0
  646. package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.ts +707 -0
  647. package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.test.ts +65 -0
  648. package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.ts +247 -0
  649. package/node_modules/@sdd-agent-platform/core/src/verification.ts +6 -0
  650. package/node_modules/@sdd-agent-platform/core/src/work-units/contracts.ts +26 -0
  651. package/node_modules/@sdd-agent-platform/core/src/work-units/runtime.test.ts +88 -0
  652. package/node_modules/@sdd-agent-platform/core/src/work-units/runtime.ts +112 -0
  653. package/node_modules/@sdd-agent-platform/core/src/work-units.ts +2 -0
  654. package/node_modules/@sdd-agent-platform/core/src/workflow-state/affected-file-conflicts.ts +79 -0
  655. package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.test.ts +32 -0
  656. package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.ts +92 -0
  657. package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.test.ts +115 -0
  658. package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.ts +175 -0
  659. package/node_modules/@sdd-agent-platform/core/src/workflow-state.ts +1 -0
  660. package/node_modules/@sdd-agent-platform/core/src/worktree/isolation.ts +130 -0
  661. package/node_modules/@sdd-agent-platform/core/src/worktree/lifecycle.ts +269 -0
  662. package/node_modules/@sdd-agent-platform/core/src/worktree/worktree.test.ts +150 -0
  663. package/node_modules/@sdd-agent-platform/core/src/worktree.ts +2 -0
  664. package/node_modules/@sdd-agent-platform/core/tsconfig.json +15 -0
  665. package/package.json +67 -52
  666. package/packages/cli/dist/args.d.ts +23 -0
  667. package/packages/cli/dist/args.js +89 -0
  668. package/packages/cli/dist/args.js.map +1 -0
  669. package/packages/cli/dist/commands/ai-tools.d.ts +6 -0
  670. package/packages/cli/dist/commands/ai-tools.js +18 -0
  671. package/packages/cli/dist/commands/ai-tools.js.map +1 -0
  672. package/packages/cli/dist/commands/artifact.d.ts +6 -0
  673. package/packages/cli/dist/commands/artifact.js +168 -0
  674. package/packages/cli/dist/commands/artifact.js.map +1 -0
  675. package/packages/cli/dist/commands/context.d.ts +6 -0
  676. package/packages/cli/dist/commands/context.js +51 -0
  677. package/packages/cli/dist/commands/context.js.map +1 -0
  678. package/packages/cli/dist/commands/doctor.d.ts +6 -0
  679. package/packages/cli/dist/commands/doctor.js +29 -0
  680. package/packages/cli/dist/commands/doctor.js.map +1 -0
  681. package/packages/cli/dist/commands/execution.d.ts +6 -0
  682. package/packages/cli/dist/commands/execution.js +284 -0
  683. package/packages/cli/dist/commands/execution.js.map +1 -0
  684. package/packages/cli/dist/commands/governance.d.ts +6 -0
  685. package/packages/cli/dist/commands/governance.js +37 -0
  686. package/packages/cli/dist/commands/governance.js.map +1 -0
  687. package/packages/cli/dist/commands/init.d.ts +6 -0
  688. package/packages/cli/dist/commands/init.js +22 -0
  689. package/packages/cli/dist/commands/init.js.map +1 -0
  690. package/packages/cli/dist/commands/instructions.d.ts +6 -0
  691. package/packages/cli/dist/commands/instructions.js +15 -0
  692. package/packages/cli/dist/commands/instructions.js.map +1 -0
  693. package/packages/cli/dist/commands/lifecycle.d.ts +6 -0
  694. package/packages/cli/dist/commands/lifecycle.js +112 -0
  695. package/packages/cli/dist/commands/lifecycle.js.map +1 -0
  696. package/packages/cli/dist/commands/registry/contracts.d.ts +2 -0
  697. package/packages/cli/dist/commands/registry/contracts.js +62 -0
  698. package/packages/cli/dist/commands/registry/contracts.js.map +1 -0
  699. package/packages/cli/dist/commands/registry/core.d.ts +2 -0
  700. package/packages/cli/dist/commands/registry/core.js +75 -0
  701. package/packages/cli/dist/commands/registry/core.js.map +1 -0
  702. package/packages/cli/dist/commands/registry/platform.d.ts +2 -0
  703. package/packages/cli/dist/commands/registry/platform.js +123 -0
  704. package/packages/cli/dist/commands/registry/platform.js.map +1 -0
  705. package/packages/cli/dist/commands/registry/runtime.d.ts +2 -0
  706. package/packages/cli/dist/commands/registry/runtime.js +142 -0
  707. package/packages/cli/dist/commands/registry/runtime.js.map +1 -0
  708. package/packages/cli/dist/commands/registry/types.d.ts +5 -0
  709. package/packages/cli/dist/commands/registry/types.js +2 -0
  710. package/packages/cli/dist/commands/registry/types.js.map +1 -0
  711. package/packages/cli/dist/commands/registry.d.ts +3 -0
  712. package/packages/cli/dist/commands/registry.js +11 -0
  713. package/packages/cli/dist/commands/registry.js.map +1 -0
  714. package/packages/cli/dist/commands/run.d.ts +6 -0
  715. package/packages/cli/dist/commands/run.js +173 -0
  716. package/packages/cli/dist/commands/run.js.map +1 -0
  717. package/packages/cli/dist/commands/ship.d.ts +6 -0
  718. package/packages/cli/dist/commands/ship.js +33 -0
  719. package/packages/cli/dist/commands/ship.js.map +1 -0
  720. package/packages/cli/dist/commands/status.d.ts +6 -0
  721. package/packages/cli/dist/commands/status.js +25 -0
  722. package/packages/cli/dist/commands/status.js.map +1 -0
  723. package/packages/cli/dist/commands/sync-back.d.ts +6 -0
  724. package/packages/cli/dist/commands/sync-back.js +82 -0
  725. package/packages/cli/dist/commands/sync-back.js.map +1 -0
  726. package/packages/cli/dist/commands/tasks.d.ts +6 -0
  727. package/packages/cli/dist/commands/tasks.js +78 -0
  728. package/packages/cli/dist/commands/tasks.js.map +1 -0
  729. package/packages/cli/dist/commands/test.d.ts +6 -0
  730. package/packages/cli/dist/commands/test.js +106 -0
  731. package/packages/cli/dist/commands/test.js.map +1 -0
  732. package/packages/cli/dist/commands/verifies.d.ts +6 -0
  733. package/packages/cli/dist/commands/verifies.js +83 -0
  734. package/packages/cli/dist/commands/verifies.js.map +1 -0
  735. package/packages/cli/dist/commands/verify.d.ts +6 -0
  736. package/packages/cli/dist/commands/verify.js +93 -0
  737. package/packages/cli/dist/commands/verify.js.map +1 -0
  738. package/packages/cli/dist/dispatch.d.ts +7 -0
  739. package/packages/cli/dist/dispatch.js +121 -0
  740. package/packages/cli/dist/dispatch.js.map +1 -0
  741. package/packages/cli/dist/help.d.ts +4 -0
  742. package/packages/cli/dist/help.js +163 -0
  743. package/packages/cli/dist/help.js.map +1 -0
  744. package/packages/cli/dist/identity.d.ts +7 -0
  745. package/packages/cli/dist/identity.js +51 -0
  746. package/packages/cli/dist/identity.js.map +1 -0
  747. package/packages/cli/dist/main.js +17 -0
  748. package/packages/cli/dist/main.js.map +1 -0
  749. package/{dist/packages/cli/src → packages/cli/dist}/options.d.ts +2 -0
  750. package/{dist/packages/cli/src → packages/cli/dist}/options.js +6 -0
  751. package/packages/cli/dist/options.js.map +1 -0
  752. package/packages/cli/dist/renderers/artifacts.d.ts +5 -0
  753. package/packages/cli/dist/renderers/artifacts.js +43 -0
  754. package/packages/cli/dist/renderers/artifacts.js.map +1 -0
  755. package/packages/cli/dist/renderers/context.d.ts +4 -0
  756. package/packages/cli/dist/renderers/context.js +47 -0
  757. package/packages/cli/dist/renderers/context.js.map +1 -0
  758. package/packages/cli/dist/renderers/doctor.d.ts +5 -0
  759. package/packages/cli/dist/renderers/doctor.js +31 -0
  760. package/packages/cli/dist/renderers/doctor.js.map +1 -0
  761. package/packages/cli/dist/renderers/execution.d.ts +13 -0
  762. package/packages/cli/dist/renderers/execution.js +133 -0
  763. package/packages/cli/dist/renderers/execution.js.map +1 -0
  764. package/packages/cli/dist/renderers/governance.d.ts +3 -0
  765. package/packages/cli/dist/renderers/governance.js +23 -0
  766. package/packages/cli/dist/renderers/governance.js.map +1 -0
  767. package/packages/cli/dist/renderers/issues.d.ts +24 -0
  768. package/packages/cli/dist/renderers/issues.js +37 -0
  769. package/packages/cli/dist/renderers/issues.js.map +1 -0
  770. package/packages/cli/dist/renderers/json.d.ts +3 -0
  771. package/packages/cli/dist/renderers/json.js +10 -0
  772. package/packages/cli/dist/renderers/json.js.map +1 -0
  773. package/packages/cli/dist/renderers/lifecycle.d.ts +2 -0
  774. package/packages/cli/dist/renderers/lifecycle.js +30 -0
  775. package/packages/cli/dist/renderers/lifecycle.js.map +1 -0
  776. package/packages/cli/dist/renderers/planning.d.ts +4 -0
  777. package/packages/cli/dist/renderers/planning.js +66 -0
  778. package/packages/cli/dist/renderers/planning.js.map +1 -0
  779. package/packages/cli/dist/renderers/registry-contracts.d.ts +10 -0
  780. package/packages/cli/dist/renderers/registry-contracts.js +128 -0
  781. package/packages/cli/dist/renderers/registry-contracts.js.map +1 -0
  782. package/packages/cli/dist/renderers/registry-core.d.ts +8 -0
  783. package/packages/cli/dist/renderers/registry-core.js +93 -0
  784. package/packages/cli/dist/renderers/registry-core.js.map +1 -0
  785. package/packages/cli/dist/renderers/registry-platform.d.ts +12 -0
  786. package/packages/cli/dist/renderers/registry-platform.js +112 -0
  787. package/packages/cli/dist/renderers/registry-platform.js.map +1 -0
  788. package/packages/cli/dist/renderers/registry-runtime.d.ts +16 -0
  789. package/packages/cli/dist/renderers/registry-runtime.js +201 -0
  790. package/packages/cli/dist/renderers/registry-runtime.js.map +1 -0
  791. package/packages/cli/dist/renderers/registry-shared.d.ts +3 -0
  792. package/packages/cli/dist/renderers/registry-shared.js +15 -0
  793. package/packages/cli/dist/renderers/registry-shared.js.map +1 -0
  794. package/packages/cli/dist/renderers/registry.d.ts +5 -0
  795. package/packages/cli/dist/renderers/registry.js +6 -0
  796. package/packages/cli/dist/renderers/registry.js.map +1 -0
  797. package/packages/cli/dist/renderers/router.d.ts +2 -0
  798. package/packages/cli/dist/renderers/router.js +32 -0
  799. package/packages/cli/dist/renderers/router.js.map +1 -0
  800. package/packages/cli/dist/renderers/workflow.d.ts +19 -0
  801. package/packages/cli/dist/renderers/workflow.js +253 -0
  802. package/packages/cli/dist/renderers/workflow.js.map +1 -0
  803. package/packages/cli/dist/renderers/worktree.d.ts +5 -0
  804. package/packages/cli/dist/renderers/worktree.js +41 -0
  805. package/packages/cli/dist/renderers/worktree.js.map +1 -0
  806. package/packages/cli/dist/test-support/run-cli.d.ts +6 -0
  807. package/packages/cli/dist/test-support/run-cli.js +15 -0
  808. package/packages/cli/dist/test-support/run-cli.js.map +1 -0
  809. package/packages/cli/dist/tsconfig.tsbuildinfo +1 -0
  810. package/packages/cli/package.json +15 -0
  811. package/packages/core/dist/ai-tools.d.ts +68 -0
  812. package/packages/core/dist/ai-tools.js +461 -0
  813. package/packages/core/dist/ai-tools.js.map +1 -0
  814. package/packages/core/dist/artifacts/ingestion.d.ts +24 -0
  815. package/packages/core/dist/artifacts/ingestion.js +181 -0
  816. package/packages/core/dist/artifacts/ingestion.js.map +1 -0
  817. package/packages/core/dist/artifacts/sdd-evidence.d.ts +47 -0
  818. package/packages/core/dist/artifacts/sdd-evidence.js +241 -0
  819. package/packages/core/dist/artifacts/sdd-evidence.js.map +1 -0
  820. package/packages/core/dist/artifacts/sdd-result.d.ts +29 -0
  821. package/packages/core/dist/artifacts/sdd-result.js +198 -0
  822. package/packages/core/dist/artifacts/sdd-result.js.map +1 -0
  823. package/packages/core/dist/artifacts/templates.d.ts +10 -0
  824. package/packages/core/dist/artifacts/templates.js +79 -0
  825. package/packages/core/dist/artifacts/templates.js.map +1 -0
  826. package/packages/core/dist/artifacts.d.ts +4 -0
  827. package/packages/core/dist/artifacts.js +5 -0
  828. package/packages/core/dist/artifacts.js.map +1 -0
  829. package/packages/core/dist/coding-facts/contracts.d.ts +71 -0
  830. package/packages/core/dist/coding-facts/contracts.js +2 -0
  831. package/packages/core/dist/coding-facts/contracts.js.map +1 -0
  832. package/packages/core/dist/coding-facts.d.ts +1 -0
  833. package/packages/core/dist/coding-facts.js +2 -0
  834. package/packages/core/dist/coding-facts.js.map +1 -0
  835. package/packages/core/dist/config/init-project.d.ts +31 -0
  836. package/packages/core/dist/config/init-project.js +88 -0
  837. package/packages/core/dist/config/init-project.js.map +1 -0
  838. package/packages/core/dist/config/project-config.d.ts +49 -0
  839. package/packages/core/dist/config/project-config.js +202 -0
  840. package/packages/core/dist/config/project-config.js.map +1 -0
  841. package/packages/core/dist/config/project-detection.d.ts +21 -0
  842. package/packages/core/dist/config/project-detection.js +111 -0
  843. package/packages/core/dist/config/project-detection.js.map +1 -0
  844. package/packages/core/dist/config/project-status.d.ts +1 -0
  845. package/packages/core/dist/config/project-status.js +2 -0
  846. package/packages/core/dist/config/project-status.js.map +1 -0
  847. package/packages/core/dist/config/starter-documents.d.ts +4 -0
  848. package/packages/core/dist/config/starter-documents.js +432 -0
  849. package/packages/core/dist/config/starter-documents.js.map +1 -0
  850. package/packages/core/dist/context/budget.d.ts +10 -0
  851. package/packages/core/dist/context/budget.js +20 -0
  852. package/packages/core/dist/context/budget.js.map +1 -0
  853. package/packages/core/dist/context/build-package.d.ts +46 -0
  854. package/packages/core/dist/context/build-package.js +244 -0
  855. package/packages/core/dist/context/build-package.js.map +1 -0
  856. package/packages/core/dist/context/command-summary.d.ts +14 -0
  857. package/packages/core/dist/context/command-summary.js +34 -0
  858. package/packages/core/dist/context/command-summary.js.map +1 -0
  859. package/packages/core/dist/context/evidence-summary.d.ts +50 -0
  860. package/packages/core/dist/context/evidence-summary.js +86 -0
  861. package/packages/core/dist/context/evidence-summary.js.map +1 -0
  862. package/packages/core/dist/context/log-worker.d.ts +19 -0
  863. package/packages/core/dist/context/log-worker.js +28 -0
  864. package/packages/core/dist/context/log-worker.js.map +1 -0
  865. package/packages/core/dist/context/source-refs.d.ts +9 -0
  866. package/packages/core/dist/context/source-refs.js +30 -0
  867. package/packages/core/dist/context/source-refs.js.map +1 -0
  868. package/packages/core/dist/context-offload/contracts.d.ts +43 -0
  869. package/packages/core/dist/context-offload/contracts.js +2 -0
  870. package/packages/core/dist/context-offload/contracts.js.map +1 -0
  871. package/packages/core/dist/context-offload/runtime.d.ts +36 -0
  872. package/packages/core/dist/context-offload/runtime.js +142 -0
  873. package/packages/core/dist/context-offload/runtime.js.map +1 -0
  874. package/packages/core/dist/context-offload.d.ts +2 -0
  875. package/packages/core/dist/context-offload.js +3 -0
  876. package/packages/core/dist/context-offload.js.map +1 -0
  877. package/packages/core/dist/context.d.ts +6 -0
  878. package/packages/core/dist/context.js +7 -0
  879. package/packages/core/dist/context.js.map +1 -0
  880. package/packages/core/dist/contracts/issues.d.ts +7 -0
  881. package/packages/core/dist/contracts/issues.js +7 -0
  882. package/packages/core/dist/contracts/issues.js.map +1 -0
  883. package/packages/core/dist/contracts.d.ts +108 -0
  884. package/packages/core/dist/contracts.js +73 -0
  885. package/packages/core/dist/contracts.js.map +1 -0
  886. package/packages/core/dist/delegation/model.d.ts +21 -0
  887. package/packages/core/dist/delegation/model.js +2 -0
  888. package/packages/core/dist/delegation/model.js.map +1 -0
  889. package/packages/core/dist/delegation/queue.d.ts +10 -0
  890. package/packages/core/dist/delegation/queue.js +47 -0
  891. package/packages/core/dist/delegation/queue.js.map +1 -0
  892. package/packages/core/dist/delegation/run-state.d.ts +2 -0
  893. package/packages/core/dist/delegation/run-state.js +13 -0
  894. package/packages/core/dist/delegation/run-state.js.map +1 -0
  895. package/packages/core/dist/delegation/state-machine.d.ts +30 -0
  896. package/packages/core/dist/delegation/state-machine.js +56 -0
  897. package/packages/core/dist/delegation/state-machine.js.map +1 -0
  898. package/packages/core/dist/delegation/validation.d.ts +28 -0
  899. package/packages/core/dist/delegation/validation.js +100 -0
  900. package/packages/core/dist/delegation/validation.js.map +1 -0
  901. package/packages/core/dist/delegation.d.ts +7 -0
  902. package/packages/core/dist/delegation.js +6 -0
  903. package/packages/core/dist/delegation.js.map +1 -0
  904. package/packages/core/dist/doctor/checks/ai-entries.d.ts +2 -0
  905. package/packages/core/dist/doctor/checks/ai-entries.js +26 -0
  906. package/packages/core/dist/doctor/checks/ai-entries.js.map +1 -0
  907. package/packages/core/dist/doctor/checks/document-chain.d.ts +2 -0
  908. package/packages/core/dist/doctor/checks/document-chain.js +104 -0
  909. package/packages/core/dist/doctor/checks/document-chain.js.map +1 -0
  910. package/packages/core/dist/doctor/checks/local-run-index.d.ts +2 -0
  911. package/packages/core/dist/doctor/checks/local-run-index.js +26 -0
  912. package/packages/core/dist/doctor/checks/local-run-index.js.map +1 -0
  913. package/packages/core/dist/doctor/checks/project.d.ts +11 -0
  914. package/packages/core/dist/doctor/checks/project.js +78 -0
  915. package/packages/core/dist/doctor/checks/project.js.map +1 -0
  916. package/packages/core/dist/doctor/checks/registries.d.ts +11 -0
  917. package/packages/core/dist/doctor/checks/registries.js +247 -0
  918. package/packages/core/dist/doctor/checks/registries.js.map +1 -0
  919. package/packages/core/dist/doctor/checks/run-evidence.d.ts +6 -0
  920. package/packages/core/dist/doctor/checks/run-evidence.js +313 -0
  921. package/packages/core/dist/doctor/checks/run-evidence.js.map +1 -0
  922. package/packages/core/dist/doctor/checks/run-records.d.ts +4 -0
  923. package/packages/core/dist/doctor/checks/run-records.js +68 -0
  924. package/packages/core/dist/doctor/checks/run-records.js.map +1 -0
  925. package/packages/core/dist/doctor/checks/run-trust.d.ts +3 -0
  926. package/packages/core/dist/doctor/checks/run-trust.js +121 -0
  927. package/packages/core/dist/doctor/checks/run-trust.js.map +1 -0
  928. package/packages/core/dist/doctor/checks/runtime-contracts.d.ts +11 -0
  929. package/packages/core/dist/doctor/checks/runtime-contracts.js +279 -0
  930. package/packages/core/dist/doctor/checks/runtime-contracts.js.map +1 -0
  931. package/packages/core/dist/doctor/doctor.d.ts +6 -0
  932. package/packages/core/dist/doctor/doctor.js +138 -0
  933. package/packages/core/dist/doctor/doctor.js.map +1 -0
  934. package/packages/core/dist/doctor/model.d.ts +11 -0
  935. package/packages/core/dist/doctor/model.js +2 -0
  936. package/packages/core/dist/doctor/model.js.map +1 -0
  937. package/packages/core/dist/doctor/render.d.ts +2 -0
  938. package/packages/core/dist/doctor/render.js +44 -0
  939. package/packages/core/dist/doctor/render.js.map +1 -0
  940. package/packages/core/dist/doctor/summary.d.ts +2 -0
  941. package/packages/core/dist/doctor/summary.js +10 -0
  942. package/packages/core/dist/doctor/summary.js.map +1 -0
  943. package/packages/core/dist/doctor.d.ts +2 -0
  944. package/packages/core/dist/doctor.js +3 -0
  945. package/packages/core/dist/doctor.js.map +1 -0
  946. package/packages/core/dist/evidence-runtime/contracts.d.ts +33 -0
  947. package/packages/core/dist/evidence-runtime/contracts.js +2 -0
  948. package/packages/core/dist/evidence-runtime/contracts.js.map +1 -0
  949. package/packages/core/dist/evidence-runtime.d.ts +1 -0
  950. package/packages/core/dist/evidence-runtime.js +2 -0
  951. package/packages/core/dist/evidence-runtime.js.map +1 -0
  952. package/packages/core/dist/execution/agent-execution-records.d.ts +31 -0
  953. package/packages/core/dist/execution/agent-execution-records.js +163 -0
  954. package/packages/core/dist/execution/agent-execution-records.js.map +1 -0
  955. package/packages/core/dist/execution/background-executor.d.ts +44 -0
  956. package/packages/core/dist/execution/background-executor.js +249 -0
  957. package/packages/core/dist/execution/background-executor.js.map +1 -0
  958. package/packages/core/dist/execution/foreground-subagents.d.ts +55 -0
  959. package/packages/core/dist/execution/foreground-subagents.js +363 -0
  960. package/packages/core/dist/execution/foreground-subagents.js.map +1 -0
  961. package/packages/core/dist/execution/host-invocation.d.ts +27 -0
  962. package/packages/core/dist/execution/host-invocation.js +185 -0
  963. package/packages/core/dist/execution/host-invocation.js.map +1 -0
  964. package/packages/core/dist/execution/resident-worker.d.ts +100 -0
  965. package/packages/core/dist/execution/resident-worker.js +319 -0
  966. package/packages/core/dist/execution/resident-worker.js.map +1 -0
  967. package/packages/core/dist/execution/wave-executor.d.ts +45 -0
  968. package/packages/core/dist/execution/wave-executor.js +178 -0
  969. package/packages/core/dist/execution/wave-executor.js.map +1 -0
  970. package/packages/core/dist/execution.d.ts +5 -0
  971. package/packages/core/dist/execution.js +6 -0
  972. package/packages/core/dist/execution.js.map +1 -0
  973. package/packages/core/dist/governance/policy.d.ts +53 -0
  974. package/packages/core/dist/governance/policy.js +111 -0
  975. package/packages/core/dist/governance/policy.js.map +1 -0
  976. package/packages/core/dist/governance.d.ts +1 -0
  977. package/packages/core/dist/governance.js +2 -0
  978. package/packages/core/dist/governance.js.map +1 -0
  979. package/packages/core/dist/index.d.ts +1 -0
  980. package/packages/core/dist/index.js +2 -0
  981. package/packages/core/dist/index.js.map +1 -0
  982. package/packages/core/dist/instructions.d.ts +14 -0
  983. package/packages/core/dist/instructions.js +147 -0
  984. package/packages/core/dist/instructions.js.map +1 -0
  985. package/packages/core/dist/lifecycle/decision-gate.d.ts +39 -0
  986. package/packages/core/dist/lifecycle/decision-gate.js +319 -0
  987. package/packages/core/dist/lifecycle/decision-gate.js.map +1 -0
  988. package/packages/core/dist/lifecycle/rendering.d.ts +2 -0
  989. package/packages/core/dist/lifecycle/rendering.js +27 -0
  990. package/packages/core/dist/lifecycle/rendering.js.map +1 -0
  991. package/packages/core/dist/lifecycle/risk-signals.d.ts +57 -0
  992. package/packages/core/dist/lifecycle/risk-signals.js +80 -0
  993. package/packages/core/dist/lifecycle/risk-signals.js.map +1 -0
  994. package/packages/core/dist/lifecycle/ship.d.ts +42 -0
  995. package/packages/core/dist/lifecycle/ship.js +187 -0
  996. package/packages/core/dist/lifecycle/ship.js.map +1 -0
  997. package/packages/core/dist/lifecycle.d.ts +4 -0
  998. package/packages/core/dist/lifecycle.js +5 -0
  999. package/packages/core/dist/lifecycle.js.map +1 -0
  1000. package/packages/core/dist/orchestration/contracts.d.ts +45 -0
  1001. package/packages/core/dist/orchestration/contracts.js +2 -0
  1002. package/packages/core/dist/orchestration/contracts.js.map +1 -0
  1003. package/packages/core/dist/orchestration/index.d.ts +2 -0
  1004. package/packages/core/dist/orchestration/index.js +3 -0
  1005. package/packages/core/dist/orchestration/index.js.map +1 -0
  1006. package/packages/core/dist/orchestration/runtime.d.ts +55 -0
  1007. package/packages/core/dist/orchestration/runtime.js +314 -0
  1008. package/packages/core/dist/orchestration/runtime.js.map +1 -0
  1009. package/packages/core/dist/path-safety.d.ts +4 -0
  1010. package/packages/core/dist/path-safety.js +35 -0
  1011. package/packages/core/dist/path-safety.js.map +1 -0
  1012. package/packages/core/dist/planning/task-graph.d.ts +57 -0
  1013. package/packages/core/dist/planning/task-graph.js +157 -0
  1014. package/packages/core/dist/planning/task-graph.js.map +1 -0
  1015. package/packages/core/dist/planning/wave-plan.d.ts +37 -0
  1016. package/packages/core/dist/planning/wave-plan.js +119 -0
  1017. package/packages/core/dist/planning/wave-plan.js.map +1 -0
  1018. package/packages/core/dist/planning.d.ts +2 -0
  1019. package/packages/core/dist/planning.js +3 -0
  1020. package/packages/core/dist/planning.js.map +1 -0
  1021. package/packages/core/dist/registries/agent-capability-catalog.d.ts +55 -0
  1022. package/packages/core/dist/registries/agent-capability-catalog.js +109 -0
  1023. package/packages/core/dist/registries/agent-capability-catalog.js.map +1 -0
  1024. package/packages/core/dist/registries/agent-registry.d.ts +22 -0
  1025. package/packages/core/dist/registries/agent-registry.js +121 -0
  1026. package/packages/core/dist/registries/agent-registry.js.map +1 -0
  1027. package/packages/core/dist/registries/agent-runtime-static.d.ts +51 -0
  1028. package/packages/core/dist/registries/agent-runtime-static.js +39 -0
  1029. package/packages/core/dist/registries/agent-runtime-static.js.map +1 -0
  1030. package/packages/core/dist/registries/capability-sources.d.ts +17 -0
  1031. package/packages/core/dist/registries/capability-sources.js +14 -0
  1032. package/packages/core/dist/registries/capability-sources.js.map +1 -0
  1033. package/packages/core/dist/registries/command-team-runtime.d.ts +70 -0
  1034. package/packages/core/dist/registries/command-team-runtime.js +220 -0
  1035. package/packages/core/dist/registries/command-team-runtime.js.map +1 -0
  1036. package/packages/core/dist/registries/eval-learning-context.d.ts +64 -0
  1037. package/packages/core/dist/registries/eval-learning-context.js +161 -0
  1038. package/packages/core/dist/registries/eval-learning-context.js.map +1 -0
  1039. package/packages/core/dist/registries/query-status.d.ts +28 -0
  1040. package/packages/core/dist/registries/query-status.js +84 -0
  1041. package/packages/core/dist/registries/query-status.js.map +1 -0
  1042. package/packages/core/dist/registries/skill-capabilities.d.ts +22 -0
  1043. package/packages/core/dist/registries/skill-capabilities.js +16 -0
  1044. package/packages/core/dist/registries/skill-capabilities.js.map +1 -0
  1045. package/packages/core/dist/registries/tool-capabilities.d.ts +20 -0
  1046. package/packages/core/dist/registries/tool-capabilities.js +111 -0
  1047. package/packages/core/dist/registries/tool-capabilities.js.map +1 -0
  1048. package/packages/core/dist/registries/tool-plugins.d.ts +21 -0
  1049. package/packages/core/dist/registries/tool-plugins.js +107 -0
  1050. package/packages/core/dist/registries/tool-plugins.js.map +1 -0
  1051. package/packages/core/dist/registries/worker-adapters.d.ts +38 -0
  1052. package/packages/core/dist/registries/worker-adapters.js +99 -0
  1053. package/packages/core/dist/registries/worker-adapters.js.map +1 -0
  1054. package/packages/core/dist/registries/workflow-gates.d.ts +19 -0
  1055. package/packages/core/dist/registries/workflow-gates.js +89 -0
  1056. package/packages/core/dist/registries/workflow-gates.js.map +1 -0
  1057. package/packages/core/dist/registries.d.ts +14 -0
  1058. package/packages/core/dist/registries.js +13 -0
  1059. package/packages/core/dist/registries.js.map +1 -0
  1060. package/packages/core/dist/risk/consumer-diagnostics.d.ts +18 -0
  1061. package/packages/core/dist/risk/consumer-diagnostics.js +77 -0
  1062. package/packages/core/dist/risk/consumer-diagnostics.js.map +1 -0
  1063. package/packages/core/dist/risk/contracts.d.ts +57 -0
  1064. package/packages/core/dist/risk/contracts.js +2 -0
  1065. package/packages/core/dist/risk/contracts.js.map +1 -0
  1066. package/packages/core/dist/risk/kernel.d.ts +20 -0
  1067. package/packages/core/dist/risk/kernel.js +195 -0
  1068. package/packages/core/dist/risk/kernel.js.map +1 -0
  1069. package/packages/core/dist/risk/legacy-adapters.d.ts +33 -0
  1070. package/packages/core/dist/risk/legacy-adapters.js +215 -0
  1071. package/packages/core/dist/risk/legacy-adapters.js.map +1 -0
  1072. package/packages/core/dist/risk/workflow-gates.d.ts +24 -0
  1073. package/packages/core/dist/risk/workflow-gates.js +160 -0
  1074. package/packages/core/dist/risk/workflow-gates.js.map +1 -0
  1075. package/packages/core/dist/risk.d.ts +5 -0
  1076. package/packages/core/dist/risk.js +6 -0
  1077. package/packages/core/dist/risk.js.map +1 -0
  1078. package/packages/core/dist/router/agent-runtime-config.d.ts +4 -0
  1079. package/packages/core/dist/router/agent-runtime-config.js +263 -0
  1080. package/packages/core/dist/router/agent-runtime-config.js.map +1 -0
  1081. package/packages/core/dist/router/agent-runtime.d.ts +285 -0
  1082. package/packages/core/dist/router/agent-runtime.js +2 -0
  1083. package/packages/core/dist/router/agent-runtime.js.map +1 -0
  1084. package/packages/core/dist/router/profile-resolution.d.ts +18 -0
  1085. package/packages/core/dist/router/profile-resolution.js +127 -0
  1086. package/packages/core/dist/router/profile-resolution.js.map +1 -0
  1087. package/packages/core/dist/router/risk-policy.d.ts +6 -0
  1088. package/packages/core/dist/router/risk-policy.js +28 -0
  1089. package/packages/core/dist/router/risk-policy.js.map +1 -0
  1090. package/packages/core/dist/router/route-cache.d.ts +39 -0
  1091. package/packages/core/dist/router/route-cache.js +59 -0
  1092. package/packages/core/dist/router/route-cache.js.map +1 -0
  1093. package/packages/core/dist/router/route-projection.d.ts +12 -0
  1094. package/packages/core/dist/router/route-projection.js +127 -0
  1095. package/packages/core/dist/router/route-projection.js.map +1 -0
  1096. package/packages/core/dist/router/route-sdd-task.d.ts +3 -0
  1097. package/packages/core/dist/router/route-sdd-task.js +4 -0
  1098. package/packages/core/dist/router/route-sdd-task.js.map +1 -0
  1099. package/packages/core/dist/router/routing-rules.d.ts +4 -0
  1100. package/packages/core/dist/router/routing-rules.js +68 -0
  1101. package/packages/core/dist/router/routing-rules.js.map +1 -0
  1102. package/packages/core/dist/router/routing.d.ts +18 -0
  1103. package/packages/core/dist/router/routing.js +143 -0
  1104. package/packages/core/dist/router/routing.js.map +1 -0
  1105. package/packages/core/dist/router/runtime-inspection.d.ts +7 -0
  1106. package/packages/core/dist/router/runtime-inspection.js +95 -0
  1107. package/packages/core/dist/router/runtime-inspection.js.map +1 -0
  1108. package/packages/core/dist/router/runtime-registry.d.ts +17 -0
  1109. package/packages/core/dist/router/runtime-registry.js +82 -0
  1110. package/packages/core/dist/router/runtime-registry.js.map +1 -0
  1111. package/packages/core/dist/router/runtime-validation.d.ts +26 -0
  1112. package/packages/core/dist/router/runtime-validation.js +207 -0
  1113. package/packages/core/dist/router/runtime-validation.js.map +1 -0
  1114. package/packages/core/dist/router/team-mode.d.ts +16 -0
  1115. package/packages/core/dist/router/team-mode.js +134 -0
  1116. package/packages/core/dist/router/team-mode.js.map +1 -0
  1117. package/packages/core/dist/router.d.ts +4 -0
  1118. package/packages/core/dist/router.js +5 -0
  1119. package/packages/core/dist/router.js.map +1 -0
  1120. package/packages/core/dist/run-state/artifacts.d.ts +6 -0
  1121. package/packages/core/dist/run-state/artifacts.js +80 -0
  1122. package/packages/core/dist/run-state/artifacts.js.map +1 -0
  1123. package/packages/core/dist/run-state/events.d.ts +3 -0
  1124. package/packages/core/dist/run-state/events.js +23 -0
  1125. package/packages/core/dist/run-state/events.js.map +1 -0
  1126. package/packages/core/dist/run-state/inspect-run.d.ts +100 -0
  1127. package/packages/core/dist/run-state/inspect-run.js +117 -0
  1128. package/packages/core/dist/run-state/inspect-run.js.map +1 -0
  1129. package/packages/core/dist/run-state/invocation-ledger.d.ts +18 -0
  1130. package/packages/core/dist/run-state/invocation-ledger.js +99 -0
  1131. package/packages/core/dist/run-state/invocation-ledger.js.map +1 -0
  1132. package/packages/core/dist/run-state/model.d.ts +179 -0
  1133. package/packages/core/dist/run-state/model.js +2 -0
  1134. package/packages/core/dist/run-state/model.js.map +1 -0
  1135. package/packages/core/dist/run-state/run-index.d.ts +97 -0
  1136. package/packages/core/dist/run-state/run-index.js +238 -0
  1137. package/packages/core/dist/run-state/run-index.js.map +1 -0
  1138. package/packages/core/dist/run-state/run-state.d.ts +20 -0
  1139. package/packages/core/dist/run-state/run-state.js +359 -0
  1140. package/packages/core/dist/run-state/run-state.js.map +1 -0
  1141. package/packages/core/dist/run-state.d.ts +7 -0
  1142. package/packages/core/dist/run-state.js +8 -0
  1143. package/packages/core/dist/run-state.js.map +1 -0
  1144. package/packages/core/dist/runtime-analysis/build.d.ts +2 -0
  1145. package/packages/core/dist/runtime-analysis/build.js +61 -0
  1146. package/packages/core/dist/runtime-analysis/build.js.map +1 -0
  1147. package/packages/core/dist/runtime-analysis/findings.d.ts +4 -0
  1148. package/packages/core/dist/runtime-analysis/findings.js +274 -0
  1149. package/packages/core/dist/runtime-analysis/findings.js.map +1 -0
  1150. package/packages/core/dist/runtime-analysis/model.d.ts +175 -0
  1151. package/packages/core/dist/runtime-analysis/model.js +2 -0
  1152. package/packages/core/dist/runtime-analysis/model.js.map +1 -0
  1153. package/packages/core/dist/runtime-analysis.d.ts +3 -0
  1154. package/packages/core/dist/runtime-analysis.js +4 -0
  1155. package/packages/core/dist/runtime-analysis.js.map +1 -0
  1156. package/packages/core/dist/runtime-paths.d.ts +25 -0
  1157. package/packages/core/dist/runtime-paths.js +112 -0
  1158. package/packages/core/dist/runtime-paths.js.map +1 -0
  1159. package/packages/core/dist/sdd-docs/context.d.ts +18 -0
  1160. package/packages/core/dist/sdd-docs/context.js +89 -0
  1161. package/packages/core/dist/sdd-docs/context.js.map +1 -0
  1162. package/packages/core/dist/sdd-docs/run-binding.d.ts +6 -0
  1163. package/packages/core/dist/sdd-docs/run-binding.js +79 -0
  1164. package/packages/core/dist/sdd-docs/run-binding.js.map +1 -0
  1165. package/packages/core/dist/sdd-docs/task-inspection.d.ts +6 -0
  1166. package/packages/core/dist/sdd-docs/task-inspection.js +31 -0
  1167. package/packages/core/dist/sdd-docs/task-inspection.js.map +1 -0
  1168. package/packages/core/dist/sdd-docs/task-parser.d.ts +78 -0
  1169. package/packages/core/dist/sdd-docs/task-parser.js +458 -0
  1170. package/packages/core/dist/sdd-docs/task-parser.js.map +1 -0
  1171. package/packages/core/dist/sdd-docs/task-rendering.d.ts +5 -0
  1172. package/packages/core/dist/sdd-docs/task-rendering.js +77 -0
  1173. package/packages/core/dist/sdd-docs/task-rendering.js.map +1 -0
  1174. package/packages/core/dist/sdd-docs.d.ts +5 -0
  1175. package/packages/core/dist/sdd-docs.js +6 -0
  1176. package/packages/core/dist/sdd-docs.js.map +1 -0
  1177. package/packages/core/dist/stage-runtime/contracts.d.ts +37 -0
  1178. package/packages/core/dist/stage-runtime/contracts.js +2 -0
  1179. package/packages/core/dist/stage-runtime/contracts.js.map +1 -0
  1180. package/packages/core/dist/stage-runtime/runtime.d.ts +71 -0
  1181. package/packages/core/dist/stage-runtime/runtime.js +275 -0
  1182. package/packages/core/dist/stage-runtime/runtime.js.map +1 -0
  1183. package/packages/core/dist/stage-runtime.d.ts +2 -0
  1184. package/packages/core/dist/stage-runtime.js +3 -0
  1185. package/packages/core/dist/stage-runtime.js.map +1 -0
  1186. package/packages/core/dist/status/project-status.d.ts +105 -0
  1187. package/packages/core/dist/status/project-status.js +251 -0
  1188. package/packages/core/dist/status/project-status.js.map +1 -0
  1189. package/packages/core/dist/status.d.ts +2 -0
  1190. package/packages/core/dist/status.js +3 -0
  1191. package/packages/core/dist/status.js.map +1 -0
  1192. package/packages/core/dist/storage/json-io.d.ts +1 -0
  1193. package/packages/core/dist/storage/json-io.js +11 -0
  1194. package/packages/core/dist/storage/json-io.js.map +1 -0
  1195. package/packages/core/dist/storage/runtime-store.d.ts +112 -0
  1196. package/packages/core/dist/storage/runtime-store.js +362 -0
  1197. package/packages/core/dist/storage/runtime-store.js.map +1 -0
  1198. package/packages/core/dist/subagents/contracts.d.ts +41 -0
  1199. package/packages/core/dist/subagents/contracts.js +2 -0
  1200. package/packages/core/dist/subagents/contracts.js.map +1 -0
  1201. package/packages/core/dist/subagents/runtime.d.ts +43 -0
  1202. package/packages/core/dist/subagents/runtime.js +262 -0
  1203. package/packages/core/dist/subagents/runtime.js.map +1 -0
  1204. package/packages/core/dist/subagents.d.ts +2 -0
  1205. package/packages/core/dist/subagents.js +3 -0
  1206. package/packages/core/dist/subagents.js.map +1 -0
  1207. package/packages/core/dist/sync-back/apply.d.ts +17 -0
  1208. package/packages/core/dist/sync-back/apply.js +221 -0
  1209. package/packages/core/dist/sync-back/apply.js.map +1 -0
  1210. package/packages/core/dist/sync-back/inspect.d.ts +91 -0
  1211. package/packages/core/dist/sync-back/inspect.js +395 -0
  1212. package/packages/core/dist/sync-back/inspect.js.map +1 -0
  1213. package/packages/core/dist/sync-back.d.ts +2 -0
  1214. package/packages/core/dist/sync-back.js +3 -0
  1215. package/packages/core/dist/sync-back.js.map +1 -0
  1216. package/packages/core/dist/task-risk-profile.d.ts +33 -0
  1217. package/packages/core/dist/task-risk-profile.js +153 -0
  1218. package/packages/core/dist/task-risk-profile.js.map +1 -0
  1219. package/packages/core/dist/test-support/fixtures.d.ts +21 -0
  1220. package/packages/core/dist/test-support/fixtures.js +363 -0
  1221. package/packages/core/dist/test-support/fixtures.js.map +1 -0
  1222. package/packages/core/dist/test-support/run-state.d.ts +2 -0
  1223. package/packages/core/dist/test-support/run-state.js +55 -0
  1224. package/packages/core/dist/test-support/run-state.js.map +1 -0
  1225. package/packages/core/dist/test-support.d.ts +2 -0
  1226. package/packages/core/dist/test-support.js +3 -0
  1227. package/packages/core/dist/test-support.js.map +1 -0
  1228. package/packages/core/dist/tsconfig.tsbuildinfo +1 -0
  1229. package/packages/core/dist/verification/goal-verify.d.ts +50 -0
  1230. package/packages/core/dist/verification/goal-verify.js +514 -0
  1231. package/packages/core/dist/verification/goal-verify.js.map +1 -0
  1232. package/packages/core/dist/verification/rendering.d.ts +51 -0
  1233. package/packages/core/dist/verification/rendering.js +119 -0
  1234. package/packages/core/dist/verification/rendering.js.map +1 -0
  1235. package/packages/core/dist/verification/single-task-loop.d.ts +29 -0
  1236. package/packages/core/dist/verification/single-task-loop.js +332 -0
  1237. package/packages/core/dist/verification/single-task-loop.js.map +1 -0
  1238. package/packages/core/dist/verification/test-runtime.d.ts +62 -0
  1239. package/packages/core/dist/verification/test-runtime.js +591 -0
  1240. package/packages/core/dist/verification/test-runtime.js.map +1 -0
  1241. package/packages/core/dist/verification/verify-contract.d.ts +42 -0
  1242. package/packages/core/dist/verification/verify-contract.js +201 -0
  1243. package/packages/core/dist/verification/verify-contract.js.map +1 -0
  1244. package/packages/core/dist/verification.d.ts +6 -0
  1245. package/packages/core/dist/verification.js +6 -0
  1246. package/packages/core/dist/verification.js.map +1 -0
  1247. package/packages/core/dist/work-units/contracts.d.ts +24 -0
  1248. package/packages/core/dist/work-units/contracts.js +2 -0
  1249. package/packages/core/dist/work-units/contracts.js.map +1 -0
  1250. package/packages/core/dist/work-units/runtime.d.ts +21 -0
  1251. package/packages/core/dist/work-units/runtime.js +90 -0
  1252. package/packages/core/dist/work-units/runtime.js.map +1 -0
  1253. package/packages/core/dist/work-units.d.ts +2 -0
  1254. package/packages/core/dist/work-units.js +3 -0
  1255. package/packages/core/dist/work-units.js.map +1 -0
  1256. package/packages/core/dist/workflow-state/affected-file-conflicts.d.ts +12 -0
  1257. package/packages/core/dist/workflow-state/affected-file-conflicts.js +60 -0
  1258. package/packages/core/dist/workflow-state/affected-file-conflicts.js.map +1 -0
  1259. package/packages/core/dist/workflow-state/dependencies.d.ts +25 -0
  1260. package/packages/core/dist/workflow-state/dependencies.js +64 -0
  1261. package/packages/core/dist/workflow-state/dependencies.js.map +1 -0
  1262. package/packages/core/dist/workflow-state/resolve.d.ts +50 -0
  1263. package/packages/core/dist/workflow-state/resolve.js +124 -0
  1264. package/packages/core/dist/workflow-state/resolve.js.map +1 -0
  1265. package/packages/core/dist/workflow-state.d.ts +1 -0
  1266. package/packages/core/dist/workflow-state.js +2 -0
  1267. package/packages/core/dist/workflow-state.js.map +1 -0
  1268. package/packages/core/dist/worktree/isolation.d.ts +40 -0
  1269. package/packages/core/dist/worktree/isolation.js +89 -0
  1270. package/packages/core/dist/worktree/isolation.js.map +1 -0
  1271. package/packages/core/dist/worktree/lifecycle.d.ts +39 -0
  1272. package/packages/core/dist/worktree/lifecycle.js +221 -0
  1273. package/packages/core/dist/worktree/lifecycle.js.map +1 -0
  1274. package/packages/core/dist/worktree.d.ts +2 -0
  1275. package/packages/core/dist/worktree.js +3 -0
  1276. package/packages/core/dist/worktree.js.map +1 -0
  1277. package/packages/core/package.json +40 -0
  1278. package/tsconfig.build.json +4 -3
  1279. package/dist/packages/cli/src/main.js +0 -2364
  1280. package/dist/packages/cli/src/main.js.map +0 -1
  1281. package/dist/packages/cli/src/options.js.map +0 -1
  1282. package/dist/packages/core/src/ai-tools.js.map +0 -1
  1283. package/dist/packages/core/src/index.d.ts +0 -1751
  1284. package/dist/packages/core/src/index.js +0 -8404
  1285. package/dist/packages/core/src/index.js.map +0 -1
  1286. package/dist/packages/core/src/instructions.js.map +0 -1
  1287. package/dist/packages/core/src/path-safety.js.map +0 -1
  1288. /package/{dist/packages/core/src → node_modules/@sdd-agent-platform/core/dist}/path-safety.d.ts +0 -0
  1289. /package/{dist/packages/core/src → node_modules/@sdd-agent-platform/core/dist}/path-safety.js +0 -0
  1290. /package/{dist/packages/cli/src → packages/cli/dist}/main.d.ts +0 -0
@@ -1,2364 +0,0 @@
1
- #!/usr/bin/env node
2
- import { readFile } from 'node:fs/promises';
3
- import { writeArtifact, archiveRun, applyAiToolEntries, applySyncBack, createWorktreeLifecycle, createRun, doctor, evaluateLifecycleDecisionGate, extractLifecycleRiskSignalsFromText, evaluateGovernancePolicy, getProjectStatus, getDelegationStateMachine, getSddInstructions, initProject, inspectRun, claimResidentWorkerRuntime, heartbeatResidentWorkerRuntime, inspectSddTask, inspectToolPluginContract, inspectToolCapability, inspectDelegationQueueItem, inspectSyncBack, inspectTaskGraph, inspectWavePlan, inspectWaveExecutor, inspectBackgroundExecutor, inspectResidentWorkerRuntime, inspectArtifactResultIngestions, inspectWorktreeLifecycle, inspectWorkerAdapterContract, inspectWorktreeIsolation, inspectGovernancePolicy, inspectWorkflowGate, inspectAgentRegistryEntry, inspectQueryStatusContract, inspectSkillAgentEvalContract, inspectHarnessLearningContract, inspectProjectContextPackContract, inspectAgentSkillTeamRuntime, inspectSkillCapability, inspectCapabilitySource, inspectExternalAgentPackImport, inspectTeamModePolicy, keepWorktreeLifecycle, removeWorktreeLifecycle, listRuns, rebuildLocalRunIndex, inspectLocalRunIndex, queryLocalRunIndex, listToolPluginContracts, listToolCapabilities, listDelegationQueueItems, listWorkerAdapterContracts, listResidentWorkerRuntimes, listWorkflowGates, listAgentRegistry, listSkillCapabilities, listCapabilitySources, ingestArtifactResult, parseSddBranch, readRunState, resolveSddContext, recordLifecycleDecision, renderDoctorReport, renderGoalVerifyResult, renderLifecycleDecisionGate, renderSddResultArtifactTemplate, renderSddInstructions, renderSingleTaskLoopResult, renderTaskGapReport, renderTaskInspect, renderTaskList, runGoalVerify, runSingleTaskLoop, runBackgroundExecutor, runWaveExecutor, SDD_VERSION, summarizeAiProjectionStatus, validateSddResultArtifact, validateWorkflowGates, validateAgentRegistry, validateQueryStatusContract, validateSkillAgentEvalContract, validateHarnessLearningContract, validateProjectContextPackContract, routeSddTask, validateAgentSkillTeamRuntime, toArtifactRootRelativePath } from '../../core/src/index.js';
4
- import { readOption, readPositiveIntegerOption, readRepeatedOption, readRepeatedOptions } from './options.js';
5
- async function main(args) {
6
- const projectRoot = process.cwd();
7
- const [command, subcommand, ...rest] = args;
8
- if (!command || command === '--help' || command === '-h') {
9
- return {
10
- exitCode: 0,
11
- output: helpText()
12
- };
13
- }
14
- if (command === 'help') {
15
- return {
16
- exitCode: 0,
17
- output: helpText(subcommand)
18
- };
19
- }
20
- if (command === '--version' || command === '-v') {
21
- return {
22
- exitCode: 0,
23
- output: SDD_VERSION
24
- };
25
- }
26
- if (command === 'init') {
27
- const initArgs = [subcommand, ...rest].filter(Boolean);
28
- const force = initArgs.includes('--force');
29
- const aiTool = readAiToolSelection(initArgs, true);
30
- const branch = readOption(initArgs, '--branch') ?? undefined;
31
- const scaffoldDocuments = initArgs.includes('--no-scaffold-docs') ? false : initArgs.includes('--scaffold-docs') || branch !== undefined;
32
- const result = await initProject(projectRoot, { force, aiTool, branch, scaffoldDocuments });
33
- const json = wantsJson(initArgs);
34
- return {
35
- exitCode: 0,
36
- output: json ? jsonOutput({ command: 'init', ...result }, initArgs) : renderInitResult(result)
37
- };
38
- }
39
- if (command === 'update') {
40
- const updateArgs = [subcommand, ...rest].filter(Boolean);
41
- const check = updateArgs.includes('--check');
42
- const aiTool = readAiToolSelection(updateArgs, false);
43
- const results = await applyAiToolEntries(projectRoot, { tool: aiTool, check });
44
- const status = summarizeAiProjectionStatus(results);
45
- return {
46
- exitCode: status === 'FAIL' ? 1 : 0,
47
- output: JSON.stringify({ command: 'update', check, status, aiTools: results }, null, 2)
48
- };
49
- }
50
- if (command === 'instructions') {
51
- const instructionArgs = [subcommand, ...rest].filter(Boolean);
52
- const action = instructionArgs.find((item) => !item.startsWith('--')) ?? 'overview';
53
- const payload = getSddInstructions(action);
54
- return {
55
- exitCode: 0,
56
- output: renderTextOrJson(instructionArgs, payload, renderSddInstructions)
57
- };
58
- }
59
- if (command === 'doctor') {
60
- const doctorArgs = [subcommand, ...rest].filter(Boolean);
61
- if (doctorArgs.includes('--latest-only') && doctorArgs.includes('--all-runs')) {
62
- return {
63
- exitCode: 2,
64
- error: 'Usage: sdd doctor [--latest-only] [--all-runs] (choose only one scope flag)'
65
- };
66
- }
67
- const report = await doctor(projectRoot, {
68
- latestOnly: doctorArgs.includes('--latest-only'),
69
- allRuns: doctorArgs.includes('--all-runs')
70
- });
71
- const json = wantsJson(doctorArgs);
72
- return {
73
- exitCode: report.status === 'FAIL' ? 1 : 0,
74
- output: json ? jsonOutput(report, doctorArgs) : renderDoctorReport(report)
75
- };
76
- }
77
- if (command === 'status') {
78
- const statusArgs = [subcommand, ...rest].filter(Boolean);
79
- const result = await getProjectStatus(projectRoot, readBranchContext(statusArgs));
80
- const json = wantsJson(statusArgs);
81
- return {
82
- exitCode: result.gaps.some((gap) => gap.severity === 'blocking') ? 1 : 0,
83
- output: json ? jsonOutput(result, statusArgs) : renderProjectStatus(result)
84
- };
85
- }
86
- if (command === 'run' && subcommand === 'create') {
87
- const state = await createRun(projectRoot);
88
- return {
89
- exitCode: 0,
90
- output: JSON.stringify({ runId: state.runId, statePath: `.sdd/runs/${state.runId}/state.json`, eventLogPath: `.sdd/runs/${state.runId}/events.jsonl` }, null, 2)
91
- };
92
- }
93
- if (command === 'run' && subcommand === 'status') {
94
- const runId = rest[0];
95
- if (!runId) {
96
- return {
97
- exitCode: 2,
98
- error: 'Usage: sdd run status <run_id>'
99
- };
100
- }
101
- const state = await readRunState(projectRoot, runId);
102
- return {
103
- exitCode: 0,
104
- output: JSON.stringify({ runId: state.runId, status: state.status, phase: state.phase, currentTask: state.currentTask, updatedAt: state.updatedAt }, null, 2)
105
- };
106
- }
107
- if (command === 'run' && subcommand === 'list') {
108
- const runs = await listRuns(projectRoot);
109
- const json = rest.includes('--json');
110
- return {
111
- exitCode: 0,
112
- output: json ? JSON.stringify(runs, null, 2) : renderRunList(runs)
113
- };
114
- }
115
- if (command === 'run' && subcommand === 'index') {
116
- const action = rest[0];
117
- const json = wantsJson(rest);
118
- if (action === 'rebuild') {
119
- const index = await rebuildLocalRunIndex(projectRoot);
120
- return {
121
- exitCode: 0,
122
- output: json ? jsonOutput(index, rest) : renderLocalRunIndex(index)
123
- };
124
- }
125
- if (action === 'inspect') {
126
- const inspection = await inspectLocalRunIndex(projectRoot);
127
- return {
128
- exitCode: inspection.valid ? 0 : 1,
129
- output: json ? jsonOutput(inspection, rest) : renderLocalRunIndexInspection(inspection)
130
- };
131
- }
132
- if (action === 'query') {
133
- const status = readRunStatus(rest, '--status');
134
- if (readOption(rest, '--status') && !status) {
135
- return {
136
- exitCode: 2,
137
- error: 'Usage: sdd run index query [--run <run_id>] [--task <task_id>] [--status created|running|completed|blocked|failed|archived] [--artifact <path>] [--json|--compact-json]'
138
- };
139
- }
140
- const index = await queryLocalRunIndex(projectRoot, {
141
- runId: readOption(rest, '--run') ?? undefined,
142
- taskId: readOption(rest, '--task') ?? undefined,
143
- status: status ?? undefined,
144
- artifact: readOption(rest, '--artifact') ?? undefined
145
- });
146
- return {
147
- exitCode: 0,
148
- output: json ? jsonOutput(index, rest) : renderLocalRunIndex(index)
149
- };
150
- }
151
- return {
152
- exitCode: 2,
153
- error: 'Usage: sdd run index rebuild|inspect|query [options]'
154
- };
155
- }
156
- if (command === 'run' && subcommand === 'inspect') {
157
- const runId = rest[0];
158
- if (!runId) {
159
- return {
160
- exitCode: 2,
161
- error: 'Usage: sdd run inspect <run_id> [--json]'
162
- };
163
- }
164
- const result = await inspectRun(projectRoot, runId);
165
- const json = wantsJson(rest);
166
- return {
167
- exitCode: 0,
168
- output: json ? jsonOutput(result, rest) : renderRunInspection(result)
169
- };
170
- }
171
- if (command === 'run' && subcommand === 'archive') {
172
- const runId = rest[0];
173
- if (!runId) {
174
- return {
175
- exitCode: 2,
176
- error: 'Usage: sdd run archive <run_id> [--reason <text>]'
177
- };
178
- }
179
- const state = await archiveRun(projectRoot, runId, { reason: readOption(rest, '--reason') ?? undefined });
180
- return {
181
- exitCode: 0,
182
- output: JSON.stringify({ runId: state.runId, status: state.status, updatedAt: state.updatedAt }, null, 2)
183
- };
184
- }
185
- if (command === 'sync-back' && subcommand === 'inspect') {
186
- const runId = readOptionalPositionalArgument(rest);
187
- const taskId = readOption(rest, '--task') ?? undefined;
188
- if (!runId && !taskId) {
189
- return {
190
- exitCode: 2,
191
- error: 'Usage: sdd sync-back inspect [<run_id>] [--branch <branch>] --task <task_id> [--json|--compact-json]'
192
- };
193
- }
194
- const result = await inspectSyncBack(projectRoot, {
195
- runId,
196
- branch: readBranchOption(rest),
197
- taskId
198
- });
199
- const json = wantsJson(rest);
200
- return {
201
- exitCode: result.status === 'blocked' ? 1 : 0,
202
- output: json ? jsonOutput(result, rest) : renderSyncBackInspection(result)
203
- };
204
- }
205
- if (command === 'sync-back' && subcommand === 'apply') {
206
- const runId = readOptionalPositionalArgument(rest);
207
- const taskId = readOption(rest, '--task') ?? undefined;
208
- if (!runId && !taskId) {
209
- return {
210
- exitCode: 2,
211
- error: 'Usage: sdd sync-back apply [<run_id>] [--branch <branch>] --task <task_id> [--approved] [--json|--compact-json]'
212
- };
213
- }
214
- const result = await applySyncBack(projectRoot, {
215
- runId,
216
- branch: readBranchOption(rest),
217
- taskId,
218
- approved: rest.includes('--approved')
219
- });
220
- const json = wantsJson(rest);
221
- return {
222
- exitCode: 0,
223
- output: json ? jsonOutput(result, rest) : renderSyncBackApplyResult(result)
224
- };
225
- }
226
- if (command === 'tasks' && subcommand === 'format') {
227
- return {
228
- exitCode: 0,
229
- output: taskFormatText()
230
- };
231
- }
232
- if (command === 'tasks' && subcommand === 'list') {
233
- const model = await parseSddBranch(projectRoot, await readResolvedBranch(projectRoot, rest));
234
- return {
235
- exitCode: model.gaps.some((gap) => gap.severity === 'blocking') ? 1 : 0,
236
- output: renderTaskList(model)
237
- };
238
- }
239
- if (command === 'tasks' && subcommand === 'inspect') {
240
- const taskId = rest.find((item) => !item.startsWith('--'));
241
- if (!taskId) {
242
- return {
243
- exitCode: 2,
244
- error: 'Usage: sdd tasks inspect <task_id> [--branch <branch>] [--json]'
245
- };
246
- }
247
- const model = await parseSddBranch(projectRoot, await readResolvedBranch(projectRoot, rest));
248
- const result = inspectSddTask(model, taskId);
249
- if (!result.task && result.gaps.length === 0) {
250
- return {
251
- exitCode: 1,
252
- error: `Task not found: ${taskId}`
253
- };
254
- }
255
- const json = wantsJson(rest);
256
- return {
257
- exitCode: result.task === null || result.gaps.some((gap) => gap.severity === 'blocking') ? 1 : 0,
258
- output: json ? jsonOutput(result, rest) : renderTaskInspect(result.task, result.gaps)
259
- };
260
- }
261
- if (command === 'tasks' && subcommand === 'route') {
262
- const taskId = rest.find((item) => !item.startsWith('--'));
263
- if (!taskId) {
264
- return {
265
- exitCode: 2,
266
- error: 'Usage: sdd tasks route <task_id> [--branch <branch>] [--team-mode [auto|force|off]] [--no-team-mode] [--json]'
267
- };
268
- }
269
- const decision = await routeSddTask(projectRoot, {
270
- taskId,
271
- branch: readBranchOption(rest),
272
- teamModeActivation: readTeamModeActivation(rest)
273
- });
274
- return {
275
- exitCode: decision.blockedReason ? 1 : 0,
276
- output: wantsJson(rest) ? jsonOutput(decision, rest) : renderAgentRouterDecision(decision)
277
- };
278
- }
279
- if (command === 'tasks' && subcommand === 'gaps') {
280
- const model = await parseSddBranch(projectRoot, await readResolvedBranch(projectRoot, rest));
281
- return {
282
- exitCode: model.gaps.some((gap) => gap.severity === 'blocking') ? 1 : 0,
283
- output: renderTaskGapReport(model)
284
- };
285
- }
286
- if (command === 'lifecycle' && subcommand === 'decide') {
287
- const lifecycleInput = await readLifecycleSignalOptions(rest);
288
- if (lifecycleInput.error) {
289
- return {
290
- exitCode: 2,
291
- error: lifecycleInput.error
292
- };
293
- }
294
- const result = evaluateLifecycleDecisionGate(lifecycleInput.signals);
295
- const runId = readOption(rest, '--run');
296
- if (runId) {
297
- await recordLifecycleDecision(projectRoot, runId, result.record);
298
- }
299
- const json = rest.includes('--json');
300
- return {
301
- exitCode: 0,
302
- output: json
303
- ? JSON.stringify({ riskExtraction: lifecycleInput.riskExtraction, ...result, recordedRunId: runId ?? null }, null, 2)
304
- : `${renderLifecycleRiskExtraction(lifecycleInput.riskExtraction)}${renderLifecycleDecisionGate(result)}${runId ? `\nrecorded_run=${runId}` : ''}`
305
- };
306
- }
307
- if (command === 'do' && subcommand === 'task') {
308
- const taskId = rest.find((item) => !item.startsWith('--'));
309
- if (!taskId) {
310
- return {
311
- exitCode: 2,
312
- error: 'Usage: sdd do task <task_id> [--branch <branch>] [--run <run_id>] [--team-mode [auto|force|off]] [--no-team-mode] [--implement-artifact artifacts/path.md] [--review-artifact artifacts/path.md] [--debug-artifact artifacts/path.md] [--validation-artifact artifacts/path.md]'
313
- };
314
- }
315
- const result = await runSingleTaskLoop(projectRoot, {
316
- taskId,
317
- branch: readBranchOption(rest),
318
- runId: readOption(rest, '--run') ?? undefined,
319
- implementArtifact: readOption(rest, '--implement-artifact') ?? undefined,
320
- reviewArtifact: readOption(rest, '--review-artifact') ?? undefined,
321
- debugArtifact: readOption(rest, '--debug-artifact') ?? undefined,
322
- validationArtifact: readOption(rest, '--validation-artifact') ?? undefined,
323
- teamModeActivation: readTeamModeActivation(rest)
324
- });
325
- const json = wantsJson(rest);
326
- return {
327
- exitCode: result.status === 'completed' ? 0 : 1,
328
- output: json ? jsonOutput(result, rest) : renderSingleTaskLoopResult(result)
329
- };
330
- }
331
- if (command === 'verify' && subcommand === 'task') {
332
- const taskId = readOptionalPositionalArgument(rest);
333
- const runId = readOption(rest, '--run');
334
- if (!taskId) {
335
- return {
336
- exitCode: 2,
337
- error: 'Usage: sdd verify task <task_id> [--run <run_id>] [--branch <branch>] [--review-artifact artifacts/path.md] [--validation-artifact artifacts/path.md] [--json]'
338
- };
339
- }
340
- const result = await runGoalVerify(projectRoot, {
341
- taskId,
342
- runId: runId ?? undefined,
343
- branch: readBranchOption(rest),
344
- reviewArtifact: readOption(rest, '--review-artifact') ?? undefined,
345
- validationArtifact: readOption(rest, '--validation-artifact') ?? undefined
346
- });
347
- const json = wantsJson(rest);
348
- return {
349
- exitCode: result.status === 'PASS' ? 0 : 1,
350
- output: json ? jsonOutput(result, rest) : renderGoalVerifyResult(result)
351
- };
352
- }
353
- if (command === 'governance' && subcommand === 'inspect') {
354
- const policy = await inspectGovernancePolicy(projectRoot);
355
- return {
356
- exitCode: 0,
357
- output: rest.includes('--json') ? JSON.stringify(policy, null, 2) : renderGovernancePolicy(policy)
358
- };
359
- }
360
- if (command === 'governance' && subcommand === 'evaluate') {
361
- const operation = readGovernancePolicyOperation(rest[0]);
362
- if (!operation) {
363
- return {
364
- exitCode: 2,
365
- error: 'Usage: sdd governance evaluate background_executor|wave_executor|sync_back_apply|destructive_git|external_interaction|cleanup [--worker <adapter_id>] [--risk <tag>] [--approved] [--json]'
366
- };
367
- }
368
- const decision = await evaluateGovernancePolicy(projectRoot, {
369
- operation,
370
- workerAdapterId: readOption(rest, '--worker') ?? undefined,
371
- riskTags: readRepeatedOption(rest, '--risk'),
372
- approved: rest.includes('--approved')
373
- });
374
- return {
375
- exitCode: decision.allowed ? 0 : 1,
376
- output: rest.includes('--json') ? JSON.stringify(decision, null, 2) : renderGovernancePolicyDecision(decision)
377
- };
378
- }
379
- if (command === 'workflow' && subcommand === 'list') {
380
- const registry = await listWorkflowGates(projectRoot);
381
- return {
382
- exitCode: 0,
383
- output: rest.includes('--json') ? JSON.stringify(registry, null, 2) : renderWorkflowGateList(registry.workflows)
384
- };
385
- }
386
- if (command === 'workflow' && subcommand === 'inspect') {
387
- const workflowId = rest.find((item) => !item.startsWith('--'));
388
- if (!workflowId) {
389
- return {
390
- exitCode: 2,
391
- error: 'Usage: sdd workflow inspect <workflow_id> [--json]'
392
- };
393
- }
394
- const workflow = await inspectWorkflowGate(projectRoot, workflowId);
395
- if (!workflow) {
396
- return {
397
- exitCode: 1,
398
- error: `Unknown workflow: ${workflowId}`
399
- };
400
- }
401
- return {
402
- exitCode: 0,
403
- output: rest.includes('--json') ? JSON.stringify(workflow, null, 2) : renderWorkflowGateInspect(workflow)
404
- };
405
- }
406
- if (command === 'workflow' && subcommand === 'validate') {
407
- const result = await validateWorkflowGates(projectRoot);
408
- return {
409
- exitCode: result.valid ? 0 : 1,
410
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderWorkflowGateValidation(result)
411
- };
412
- }
413
- if (command === 'agents' && subcommand === 'list') {
414
- const registry = await listAgentRegistry(projectRoot);
415
- return {
416
- exitCode: 0,
417
- output: rest.includes('--json') ? JSON.stringify(registry, null, 2) : renderAgentRegistryList(registry.agents)
418
- };
419
- }
420
- if (command === 'agents' && subcommand === 'inspect') {
421
- const agentId = rest.find((item) => !item.startsWith('--'));
422
- if (!agentId) {
423
- return {
424
- exitCode: 2,
425
- error: 'Usage: sdd agents inspect <agent_id> [--json]'
426
- };
427
- }
428
- const agent = await inspectAgentRegistryEntry(projectRoot, agentId);
429
- if (!agent) {
430
- return {
431
- exitCode: 1,
432
- error: `Unknown agent: ${agentId}`
433
- };
434
- }
435
- return {
436
- exitCode: 0,
437
- output: rest.includes('--json') ? JSON.stringify(agent, null, 2) : renderAgentRegistryInspect(agent)
438
- };
439
- }
440
- if (command === 'agents' && subcommand === 'validate') {
441
- const result = await validateAgentRegistry(projectRoot);
442
- return {
443
- exitCode: result.valid ? 0 : 1,
444
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderAgentRegistryValidation(result)
445
- };
446
- }
447
- if (command === 'agent-runtime' && subcommand === 'inspect') {
448
- const inspection = await inspectAgentSkillTeamRuntime(projectRoot);
449
- return {
450
- exitCode: 0,
451
- output: rest.includes('--json') ? JSON.stringify(inspection, null, 2) : renderAgentSkillTeamRuntimeInspection(inspection)
452
- };
453
- }
454
- if (command === 'agent-runtime' && subcommand === 'validate') {
455
- const result = await validateAgentSkillTeamRuntime(projectRoot);
456
- return {
457
- exitCode: result.valid ? 0 : 1,
458
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderAgentSkillTeamRuntimeValidation(result)
459
- };
460
- }
461
- if (command === 'skill-capabilities' && subcommand === 'list') {
462
- const registry = await listSkillCapabilities(projectRoot);
463
- return {
464
- exitCode: 0,
465
- output: rest.includes('--json') ? JSON.stringify(registry, null, 2) : renderSkillCapabilityList(registry.capabilities, registry.registrySources)
466
- };
467
- }
468
- if (command === 'skill-capabilities' && subcommand === 'inspect') {
469
- const capabilityId = rest.find((item) => !item.startsWith('--'));
470
- if (!capabilityId) {
471
- return {
472
- exitCode: 2,
473
- error: 'Usage: sdd skill-capabilities inspect <capability_id> [--json]'
474
- };
475
- }
476
- const capability = await inspectSkillCapability(projectRoot, capabilityId);
477
- if (!capability) {
478
- return { exitCode: 1, error: `Unknown skill capability: ${capabilityId}` };
479
- }
480
- return {
481
- exitCode: 0,
482
- output: rest.includes('--json') ? JSON.stringify(capability, null, 2) : renderSkillCapabilityInspect(capability)
483
- };
484
- }
485
- if (command === 'capability-sources' && subcommand === 'list') {
486
- const catalog = await listCapabilitySources(projectRoot);
487
- return {
488
- exitCode: 0,
489
- output: rest.includes('--json') ? JSON.stringify(catalog, null, 2) : renderCapabilitySourceList(catalog.sources, catalog.registrySources)
490
- };
491
- }
492
- if (command === 'capability-sources' && subcommand === 'inspect') {
493
- const sourceId = rest.find((item) => !item.startsWith('--'));
494
- if (!sourceId) {
495
- return {
496
- exitCode: 2,
497
- error: 'Usage: sdd capability-sources inspect <source_id> [--json]'
498
- };
499
- }
500
- const source = await inspectCapabilitySource(projectRoot, sourceId);
501
- if (!source) {
502
- return { exitCode: 1, error: `Unknown capability source: ${sourceId}` };
503
- }
504
- return {
505
- exitCode: 0,
506
- output: rest.includes('--json') ? JSON.stringify(source, null, 2) : renderCapabilitySourceInspect(source)
507
- };
508
- }
509
- if (command === 'external-packs' && subcommand === 'inspect') {
510
- const sourceId = rest.find((item) => !item.startsWith('--'));
511
- if (!sourceId) {
512
- return {
513
- exitCode: 2,
514
- error: 'Usage: sdd external-packs inspect <source_id> [--json]'
515
- };
516
- }
517
- const inspection = await inspectExternalAgentPackImport(projectRoot, sourceId);
518
- return {
519
- exitCode: inspection.status === 'denied' ? 1 : 0,
520
- output: rest.includes('--json') ? JSON.stringify(inspection, null, 2) : renderExternalAgentPackImportInspection(inspection)
521
- };
522
- }
523
- if (command === 'team-mode' && subcommand === 'inspect') {
524
- const policy = await inspectTeamModePolicy(projectRoot, {
525
- taskId: readOption(rest, '--task') ?? undefined,
526
- branch: readBranchOption(rest),
527
- teamModeActivation: readTeamModeActivation(rest, rest.includes('--enabled') ? 'force' : undefined)
528
- });
529
- return {
530
- exitCode: policy.decision === 'blocked' ? 1 : 0,
531
- output: rest.includes('--json') ? JSON.stringify(policy, null, 2) : renderTeamModePolicy(policy)
532
- };
533
- }
534
- if (command === 'query-status' && subcommand === 'inspect') {
535
- const contract = await inspectQueryStatusContract(projectRoot);
536
- return {
537
- exitCode: 0,
538
- output: rest.includes('--json') ? JSON.stringify(contract, null, 2) : renderQueryStatusContract(contract)
539
- };
540
- }
541
- if (command === 'query-status' && subcommand === 'validate') {
542
- const result = await validateQueryStatusContract(projectRoot);
543
- return {
544
- exitCode: result.valid ? 0 : 1,
545
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderQueryStatusValidation(result)
546
- };
547
- }
548
- if (command === 'eval' && subcommand === 'inspect') {
549
- const contract = await inspectSkillAgentEvalContract(projectRoot);
550
- return {
551
- exitCode: 0,
552
- output: rest.includes('--json') ? JSON.stringify(contract, null, 2) : renderSkillAgentEvalContract(contract)
553
- };
554
- }
555
- if (command === 'eval' && subcommand === 'validate') {
556
- const result = await validateSkillAgentEvalContract(projectRoot);
557
- return {
558
- exitCode: result.valid ? 0 : 1,
559
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderSkillAgentEvalValidation(result)
560
- };
561
- }
562
- if (command === 'learning' && subcommand === 'inspect') {
563
- const contract = await inspectHarnessLearningContract(projectRoot);
564
- return {
565
- exitCode: 0,
566
- output: rest.includes('--json') ? JSON.stringify(contract, null, 2) : renderHarnessLearningContract(contract)
567
- };
568
- }
569
- if (command === 'learning' && subcommand === 'validate') {
570
- const result = await validateHarnessLearningContract(projectRoot);
571
- return {
572
- exitCode: result.valid ? 0 : 1,
573
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderHarnessLearningValidation(result)
574
- };
575
- }
576
- if (command === 'context-pack' && subcommand === 'inspect') {
577
- const contract = await inspectProjectContextPackContract(projectRoot);
578
- return {
579
- exitCode: 0,
580
- output: rest.includes('--json') ? JSON.stringify(contract, null, 2) : renderProjectContextPackContract(contract)
581
- };
582
- }
583
- if (command === 'context-pack' && subcommand === 'validate') {
584
- const result = await validateProjectContextPackContract(projectRoot);
585
- return {
586
- exitCode: result.valid ? 0 : 1,
587
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderProjectContextPackValidation(result)
588
- };
589
- }
590
- if (command === 'capabilities' && subcommand === 'list') {
591
- const registry = await listToolCapabilities(projectRoot);
592
- return {
593
- exitCode: 0,
594
- output: rest.includes('--json') ? JSON.stringify(registry, null, 2) : renderCapabilityList(registry.capabilities)
595
- };
596
- }
597
- if (command === 'capabilities' && subcommand === 'inspect') {
598
- const capabilityId = rest.find((item) => !item.startsWith('--'));
599
- if (!capabilityId) {
600
- return {
601
- exitCode: 2,
602
- error: 'Usage: sdd capabilities inspect <capability_id> [--json]'
603
- };
604
- }
605
- const capability = await inspectToolCapability(projectRoot, capabilityId);
606
- if (!capability) {
607
- return {
608
- exitCode: 1,
609
- error: `Unknown capability: ${capabilityId}`
610
- };
611
- }
612
- return {
613
- exitCode: 0,
614
- output: rest.includes('--json') ? JSON.stringify(capability, null, 2) : renderCapabilityInspect(capability)
615
- };
616
- }
617
- if (command === 'plugins' && subcommand === 'list') {
618
- const registry = await listToolPluginContracts(projectRoot);
619
- return {
620
- exitCode: 0,
621
- output: rest.includes('--json') ? JSON.stringify(registry, null, 2) : renderPluginContractList(registry.contracts)
622
- };
623
- }
624
- if (command === 'plugins' && subcommand === 'inspect') {
625
- const pluginId = rest.find((item) => !item.startsWith('--'));
626
- if (!pluginId) {
627
- return {
628
- exitCode: 2,
629
- error: 'Usage: sdd plugins inspect <plugin_id> [--json]'
630
- };
631
- }
632
- const contract = await inspectToolPluginContract(projectRoot, pluginId);
633
- if (!contract) {
634
- return {
635
- exitCode: 1,
636
- error: `Unknown plugin contract: ${pluginId}`
637
- };
638
- }
639
- return {
640
- exitCode: 0,
641
- output: rest.includes('--json') ? JSON.stringify(contract, null, 2) : renderPluginContractInspect(contract)
642
- };
643
- }
644
- if (command === 'queue' && subcommand === 'list') {
645
- const snapshot = await listDelegationQueueItems(projectRoot, { runId: readOption(rest, '--run') ?? undefined });
646
- return {
647
- exitCode: 0,
648
- output: rest.includes('--json') ? JSON.stringify(snapshot, null, 2) : renderDelegationQueueList(snapshot.items)
649
- };
650
- }
651
- if (command === 'queue' && subcommand === 'inspect') {
652
- const queueItemId = rest.find((item) => !item.startsWith('--'));
653
- if (!queueItemId) {
654
- return {
655
- exitCode: 2,
656
- error: 'Usage: sdd queue inspect <queue_item_id> [--json]'
657
- };
658
- }
659
- const item = await inspectDelegationQueueItem(projectRoot, queueItemId);
660
- if (!item) {
661
- return {
662
- exitCode: 1,
663
- error: `Unknown queue item: ${queueItemId}`
664
- };
665
- }
666
- return {
667
- exitCode: 0,
668
- output: rest.includes('--json') ? JSON.stringify(item, null, 2) : renderDelegationQueueInspect(item)
669
- };
670
- }
671
- if (command === 'state-machine' && subcommand === 'inspect') {
672
- const machine = getDelegationStateMachine();
673
- return {
674
- exitCode: 0,
675
- output: rest.includes('--json') ? JSON.stringify(machine, null, 2) : renderDelegationStateMachineInspect(machine)
676
- };
677
- }
678
- if (command === 'isolation' && subcommand === 'inspect') {
679
- const taskId = rest.find((item) => !item.startsWith('--'));
680
- if (!taskId) {
681
- return {
682
- exitCode: 2,
683
- error: 'Usage: sdd isolation inspect <task_id> [--branch <branch>] [--capability <capability_id>] [--peer-task <task_id>] [--json]'
684
- };
685
- }
686
- const decision = await inspectWorktreeIsolation(projectRoot, {
687
- taskId,
688
- branch: readBranchOption(rest),
689
- capabilityId: readOption(rest, '--capability') ?? undefined,
690
- peerTaskIds: readRepeatedOptions(rest, '--peer-task')
691
- });
692
- return {
693
- exitCode: decision.mode === 'blocked' ? 1 : 0,
694
- output: rest.includes('--json') ? JSON.stringify(decision, null, 2) : renderWorktreeIsolationDecision(decision)
695
- };
696
- }
697
- if (command === 'graph' && subcommand === 'inspect') {
698
- const graph = await inspectTaskGraph(projectRoot, { branch: readBranchOption(rest) });
699
- return {
700
- exitCode: graph.valid ? 0 : 1,
701
- output: rest.includes('--json') ? JSON.stringify(graph, null, 2) : renderTaskGraphPlan(graph)
702
- };
703
- }
704
- if (command === 'wave' && subcommand === 'inspect') {
705
- const wavePlan = await inspectWavePlan(projectRoot, {
706
- branch: readBranchOption(rest),
707
- capabilityId: readOption(rest, '--capability') ?? undefined
708
- });
709
- return {
710
- exitCode: wavePlan.valid ? 0 : 1,
711
- output: rest.includes('--json') ? JSON.stringify(wavePlan, null, 2) : renderWavePlan(wavePlan)
712
- };
713
- }
714
- if (command === 'wave' && subcommand === 'run') {
715
- const strategy = readWaveExecutorStrategy(rest, '--strategy');
716
- if (!strategy) {
717
- return {
718
- exitCode: 2,
719
- error: 'Usage: sdd wave run [--branch <branch>] [--run <run_id>] [--capability <id>] [--agent <agent>] [--worker <adapter_id>] [--strategy fast-stop|safe-continue] [--artifact <task_id:path>]... [--json]'
720
- };
721
- }
722
- const result = await runWaveExecutor(projectRoot, {
723
- branch: readBranchOption(rest),
724
- runId: readOption(rest, '--run') ?? undefined,
725
- capabilityId: readOption(rest, '--capability') ?? undefined,
726
- agent: readOption(rest, '--agent') ?? undefined,
727
- workerAdapterId: readOption(rest, '--worker') ?? undefined,
728
- strategy,
729
- artifactPaths: readTaskArtifactOptions(rest)
730
- });
731
- return {
732
- exitCode: result.status === 'completed' || result.status === 'claimed' ? 0 : 1,
733
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderWaveExecutorResult(result)
734
- };
735
- }
736
- if (command === 'wave' && subcommand === 'executor') {
737
- const runId = rest[0];
738
- if (!runId) {
739
- return {
740
- exitCode: 2,
741
- error: 'Usage: sdd wave executor <run_id> [--json]'
742
- };
743
- }
744
- const inspection = await inspectWaveExecutor(projectRoot, runId);
745
- return {
746
- exitCode: inspection.valid ? 0 : 1,
747
- output: rest.includes('--json') ? JSON.stringify(inspection, null, 2) : renderWaveExecutorInspection(inspection)
748
- };
749
- }
750
- if (command === 'background' && subcommand === 'run') {
751
- const taskId = rest[0];
752
- if (!taskId) {
753
- return {
754
- exitCode: 2,
755
- error: 'Usage: sdd background run <task_id> [--run <run_id>] [--agent <agent>] [--worker <adapter_id>] [--artifact <path>] [--branch <branch>] [--json]'
756
- };
757
- }
758
- const result = await runBackgroundExecutor(projectRoot, {
759
- branch: readBranchOption(rest),
760
- runId: readOption(rest, '--run') ?? undefined,
761
- taskId,
762
- agent: readOption(rest, '--agent') ?? undefined,
763
- workerAdapterId: readOption(rest, '--worker') ?? undefined,
764
- artifactPath: readOption(rest, '--artifact') ?? undefined,
765
- delegationId: readOption(rest, '--delegation') ?? undefined
766
- });
767
- return {
768
- exitCode: result.status === 'blocked' || result.status === 'failed' ? 1 : 0,
769
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderBackgroundExecutorResult(result)
770
- };
771
- }
772
- if (command === 'background' && subcommand === 'inspect') {
773
- const runId = rest[0];
774
- if (!runId) {
775
- return {
776
- exitCode: 2,
777
- error: 'Usage: sdd background inspect <run_id> [--json]'
778
- };
779
- }
780
- const inspection = await inspectBackgroundExecutor(projectRoot, runId);
781
- return {
782
- exitCode: inspection.valid ? 0 : 1,
783
- output: rest.includes('--json') ? JSON.stringify(inspection, null, 2) : renderBackgroundExecutorInspection(inspection)
784
- };
785
- }
786
- if (command === 'worker-runtime' && subcommand === 'claim') {
787
- const taskId = rest[0];
788
- if (!taskId) {
789
- return {
790
- exitCode: 2,
791
- error: 'Usage: sdd worker-runtime claim <task_id> [--run <run_id>] [--runtime <runtime_id>] [--agent <agent>] [--worker <adapter_id>] [--delegation <delegation_id>] [--lease-seconds <n>] [--branch <branch>] [--json]'
792
- };
793
- }
794
- const result = await claimResidentWorkerRuntime(projectRoot, {
795
- branch: readBranchOption(rest),
796
- runId: readOption(rest, '--run') ?? undefined,
797
- taskId,
798
- runtimeId: readOption(rest, '--runtime') ?? undefined,
799
- agent: readOption(rest, '--agent') ?? undefined,
800
- workerAdapterId: readOption(rest, '--worker') ?? undefined,
801
- delegationId: readOption(rest, '--delegation') ?? undefined,
802
- leaseSeconds: readPositiveIntegerOption(rest, '--lease-seconds') ?? undefined
803
- });
804
- return {
805
- exitCode: result.status === 'blocked' ? 1 : 0,
806
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderResidentWorkerRuntimeClaimResult(result)
807
- };
808
- }
809
- if (command === 'worker-runtime' && subcommand === 'heartbeat') {
810
- const runtimeId = rest[0];
811
- const runId = readOption(rest, '--run');
812
- if (!runtimeId || !runId) {
813
- return {
814
- exitCode: 2,
815
- error: 'Usage: sdd worker-runtime heartbeat <runtime_id> --run <run_id> [--lease-seconds <n>] [--json]'
816
- };
817
- }
818
- const result = await heartbeatResidentWorkerRuntime(projectRoot, {
819
- runId,
820
- runtimeId,
821
- leaseSeconds: readPositiveIntegerOption(rest, '--lease-seconds') ?? undefined
822
- });
823
- return {
824
- exitCode: result.status === 'blocked' ? 1 : 0,
825
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderResidentWorkerRuntimeHeartbeatResult(result)
826
- };
827
- }
828
- if (command === 'worker-runtime' && subcommand === 'status') {
829
- const positionalRunId = rest[0] && !rest[0].startsWith('--') ? rest[0] : null;
830
- const runId = readOption(rest, '--run') ?? positionalRunId;
831
- if (!runId) {
832
- return {
833
- exitCode: 2,
834
- error: 'Usage: sdd worker-runtime status --run <run_id> [--json]'
835
- };
836
- }
837
- const result = await listResidentWorkerRuntimes(projectRoot, { runId });
838
- return {
839
- exitCode: result.valid ? 0 : 1,
840
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderResidentWorkerRuntimeList(result)
841
- };
842
- }
843
- if (command === 'worker-runtime' && subcommand === 'inspect') {
844
- const runtimeId = rest[0];
845
- const runId = readOption(rest, '--run');
846
- if (!runtimeId || !runId) {
847
- return {
848
- exitCode: 2,
849
- error: 'Usage: sdd worker-runtime inspect <runtime_id> --run <run_id> [--json]'
850
- };
851
- }
852
- const result = await inspectResidentWorkerRuntime(projectRoot, { runId, runtimeId });
853
- return {
854
- exitCode: result.valid ? 0 : 1,
855
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderResidentWorkerRuntimeInspection(result)
856
- };
857
- }
858
- if (command === 'worktree' && subcommand === 'create') {
859
- const runId = rest[0];
860
- const taskId = rest[1];
861
- if (!runId || !taskId) {
862
- return {
863
- exitCode: 2,
864
- error: 'Usage: sdd worktree create <run_id> <task_id> [--base <ref>] [--id <worktree_id>] [--json]'
865
- };
866
- }
867
- const record = await createWorktreeLifecycle(projectRoot, runId, {
868
- taskId,
869
- baseRef: readOption(rest, '--base') ?? undefined,
870
- worktreeId: readOption(rest, '--id') ?? undefined
871
- });
872
- return {
873
- exitCode: 0,
874
- output: rest.includes('--json') ? JSON.stringify(record, null, 2) : renderWorktreeLifecycleRecord('Worktree created', record)
875
- };
876
- }
877
- if (command === 'worktree' && subcommand === 'inspect') {
878
- const runId = rest[0];
879
- if (!runId) {
880
- return {
881
- exitCode: 2,
882
- error: 'Usage: sdd worktree inspect <run_id> [--json]'
883
- };
884
- }
885
- const inspection = await inspectWorktreeLifecycle(projectRoot, runId);
886
- return {
887
- exitCode: inspection.valid ? 0 : 1,
888
- output: rest.includes('--json') ? JSON.stringify(inspection, null, 2) : renderWorktreeLifecycleInspection(inspection)
889
- };
890
- }
891
- if (command === 'worktree' && subcommand === 'keep') {
892
- const runId = rest[0];
893
- const worktreeId = rest[1];
894
- if (!runId || !worktreeId) {
895
- return {
896
- exitCode: 2,
897
- error: 'Usage: sdd worktree keep <run_id> <worktree_id> [--reason <text>] [--json]'
898
- };
899
- }
900
- const record = await keepWorktreeLifecycle(projectRoot, runId, worktreeId, { reason: readOption(rest, '--reason') ?? undefined });
901
- return {
902
- exitCode: 0,
903
- output: rest.includes('--json') ? JSON.stringify(record, null, 2) : renderWorktreeLifecycleRecord('Worktree kept', record)
904
- };
905
- }
906
- if (command === 'worktree' && subcommand === 'remove') {
907
- const runId = rest[0];
908
- const worktreeId = rest[1];
909
- if (!runId || !worktreeId) {
910
- return {
911
- exitCode: 2,
912
- error: 'Usage: sdd worktree remove <run_id> <worktree_id> [--json]'
913
- };
914
- }
915
- const record = await removeWorktreeLifecycle(projectRoot, runId, worktreeId);
916
- return {
917
- exitCode: 0,
918
- output: rest.includes('--json') ? JSON.stringify(record, null, 2) : renderWorktreeLifecycleRecord('Worktree removed', record)
919
- };
920
- }
921
- if (command === 'workers' && subcommand === 'list') {
922
- const registry = await listWorkerAdapterContracts(projectRoot);
923
- return {
924
- exitCode: 0,
925
- output: rest.includes('--json') ? JSON.stringify(registry, null, 2) : renderWorkerAdapterList(registry.adapters)
926
- };
927
- }
928
- if (command === 'workers' && subcommand === 'inspect') {
929
- const adapterId = rest.find((item) => !item.startsWith('--'));
930
- if (!adapterId) {
931
- return {
932
- exitCode: 2,
933
- error: 'Usage: sdd workers inspect <adapter_id> [--json]'
934
- };
935
- }
936
- const adapter = await inspectWorkerAdapterContract(projectRoot, adapterId);
937
- if (!adapter) {
938
- return {
939
- exitCode: 1,
940
- error: `Unknown worker adapter: ${adapterId}`
941
- };
942
- }
943
- return {
944
- exitCode: 0,
945
- output: rest.includes('--json') ? JSON.stringify(adapter, null, 2) : renderWorkerAdapterInspect(adapter)
946
- };
947
- }
948
- if (command === 'artifact' && subcommand === 'template') {
949
- const artifactPath = rest.find((item) => !item.startsWith('--'));
950
- const taskId = readOption(rest, '--task');
951
- const agent = readOption(rest, '--agent');
952
- if (!artifactPath || !taskId || !agent) {
953
- return {
954
- exitCode: 2,
955
- error: 'Usage: sdd artifact template <artifacts/path.md> --task <task_id> --agent <agent> [--run <run_id> --write] [--branch <branch>] [--status <status>]'
956
- };
957
- }
958
- const template = await renderSddResultArtifactTemplate(projectRoot, {
959
- artifactPath,
960
- taskId,
961
- agent,
962
- branch: readBranchOption(rest),
963
- status: readSddResultStatus(rest, '--status') ?? 'PASS'
964
- });
965
- const runId = readOption(rest, '--run');
966
- if (rest.includes('--write')) {
967
- if (!runId) {
968
- return {
969
- exitCode: 2,
970
- error: 'Usage: sdd artifact template <artifacts/path.md> --task <task_id> --agent <agent> --run <run_id> --write'
971
- };
972
- }
973
- const written = await writeArtifact(projectRoot, runId, toArtifactRootRelativePath(artifactPath), template);
974
- return {
975
- exitCode: 0,
976
- output: `Artifact template written: ${written.runRelativePath}\nphysical_path=${written.absolutePath}`
977
- };
978
- }
979
- return {
980
- exitCode: 0,
981
- output: template
982
- };
983
- }
984
- if (command === 'artifact' && subcommand === 'validate') {
985
- const runId = rest[0];
986
- const artifactPath = rest[1];
987
- if (!runId || !artifactPath) {
988
- return {
989
- exitCode: 2,
990
- error: 'Usage: sdd artifact validate <run_id> <artifacts/path.md> [--task <task_id>] [--agent <agent>] [--json|--compact-json]'
991
- };
992
- }
993
- const expectedTask = readOption(rest, '--task') ?? undefined;
994
- const expectedAgent = readOption(rest, '--agent') ?? undefined;
995
- const report = await validateSddResultArtifact(projectRoot, runId, artifactPath, {
996
- expectedTask,
997
- expectedAgent
998
- });
999
- return {
1000
- exitCode: report.valid ? 0 : 1,
1001
- output: renderTextOrJson(rest, report, (value) => renderArtifactValidationReport(artifactPath, value, expectedTask, expectedAgent))
1002
- };
1003
- }
1004
- if (command === 'artifact' && subcommand === 'ingest') {
1005
- const runId = rest[0];
1006
- const delegationId = rest[1];
1007
- const artifactPath = rest[2];
1008
- if (!runId || !delegationId || !artifactPath) {
1009
- return {
1010
- exitCode: 2,
1011
- error: 'Usage: sdd artifact ingest <run_id> <delegation_id> <artifacts/path.md> [--json]'
1012
- };
1013
- }
1014
- const result = await ingestArtifactResult(projectRoot, runId, { delegationId, artifactPath });
1015
- return {
1016
- exitCode: result.valid ? 0 : 1,
1017
- output: rest.includes('--json') ? JSON.stringify(result, null, 2) : renderArtifactIngestionResult(result)
1018
- };
1019
- }
1020
- if (command === 'artifact' && subcommand === 'ingestions') {
1021
- const runId = rest[0];
1022
- if (!runId) {
1023
- return {
1024
- exitCode: 2,
1025
- error: 'Usage: sdd artifact ingestions <run_id> [--json]'
1026
- };
1027
- }
1028
- const inspection = await inspectArtifactResultIngestions(projectRoot, runId);
1029
- return {
1030
- exitCode: inspection.valid ? 0 : 1,
1031
- output: rest.includes('--json') ? JSON.stringify(inspection, null, 2) : renderArtifactIngestionInspection(inspection)
1032
- };
1033
- }
1034
- return {
1035
- exitCode: 2,
1036
- error: `Unknown command: ${args.join(' ')}\n\n${helpText()}`
1037
- };
1038
- }
1039
- function helpText(topic) {
1040
- if (topic === 'advanced') {
1041
- return advancedHelpText();
1042
- }
1043
- if (topic === 'workflow') {
1044
- return workflowHelpText();
1045
- }
1046
- return `sdd Phase 2 platform CLI
1047
-
1048
- Common workflow:
1049
- sdd init [--force] [--ai <mode>] [--scaffold-docs] [--json]
1050
- sdd status [--branch <branch>] [--json|--compact-json]
1051
- sdd tasks inspect <task_id> [--branch <branch>] [--json|--compact-json]
1052
- sdd tasks route <task_id> [--branch <branch>] [--json|--compact-json]
1053
- sdd do task <task_id> [options]
1054
- sdd verify task <task_id> [--branch <branch>] [--run <run_id>] [--json|--compact-json]
1055
- sdd sync-back inspect [<run_id>] [--task <task_id>] [--branch <branch>] [--json|--compact-json]
1056
- sdd sync-back apply [<run_id>] [--task <task_id>] [--branch <branch>] [--approved] [--json|--compact-json]
1057
- sdd doctor [--latest-only] [--all-runs] [--json|--compact-json]
1058
-
1059
- Evidence helpers:
1060
- sdd run create
1061
- sdd run list [--json]
1062
- sdd run inspect <run_id> [--json|--compact-json]
1063
- sdd run index rebuild|inspect|query [options] [--json|--compact-json]
1064
- sdd artifact template <path> --task <task_id> --agent <agent> [--run <run_id> --write]
1065
- sdd artifact validate <run_id> <path> [--task <task_id>] [--agent <agent>] [--json|--compact-json]
1066
-
1067
- Generated AI entries:
1068
- sdd update [--check] [--ai <mode>]
1069
- sdd instructions [action] [--json|--compact-json]
1070
-
1071
- More help:
1072
- sdd help workflow Show core workflow options.
1073
- sdd help advanced Show platform/agent/runtime commands.
1074
-
1075
- Notes:
1076
- /sdd:spec owns workflow partition docs after project init.
1077
- init --branch is legacy starter-doc scaffolding; prefer sdd status --branch or /sdd:spec --branch for workflow partitions.
1078
- `;
1079
- }
1080
- function workflowHelpText() {
1081
- return `sdd workflow help
1082
-
1083
- Core path:
1084
- 1. sdd status [--branch <branch>]
1085
- 2. sdd tasks inspect <task_id> [--branch <branch>]
1086
- 3. sdd tasks route <task_id> [--branch <branch>]
1087
- 4. sdd artifact template artifacts/<agent>-<task_id>.md --task <task_id> --agent <agent> --run <run_id> --write
1088
- 5. sdd do task <task_id> --run <run_id> --implement-artifact <path> --review-artifact <path> --validation-artifact <path>
1089
- 6. sdd verify task <task_id> [--branch <branch>]
1090
- 7. sdd sync-back inspect --task <task_id> [--branch <branch>]
1091
- 8. sdd sync-back apply --task <task_id> [--branch <branch>]
1092
-
1093
- JSON:
1094
- --json prints readable JSON; --compact-json prints one-line JSON for logs and scripts.
1095
- `;
1096
- }
1097
- function advancedHelpText() {
1098
- return `sdd advanced help
1099
-
1100
- Runtime/catalog:
1101
- sdd agent-runtime inspect|validate [--json]
1102
- sdd skill-capabilities list|inspect [--json]
1103
- sdd capability-sources list|inspect [--json]
1104
- sdd external-packs inspect <source_id> [--json]
1105
- sdd team-mode inspect [--task <id>] [--team-mode [auto|force|off]] [--no-team-mode] [--json]
1106
-
1107
- Harness/platform:
1108
- sdd workflow list|inspect|validate [--json]
1109
- sdd agents list|inspect|validate [--json]
1110
- sdd query-status inspect|validate [--json]
1111
- sdd eval inspect|validate [--json]
1112
- sdd learning inspect|validate [--json]
1113
- sdd context-pack inspect|validate [--json]
1114
- sdd capabilities list|inspect [--json]
1115
- sdd governance inspect|evaluate [options]
1116
- sdd plugins list|inspect [--json]
1117
- sdd queue list|inspect [options]
1118
- sdd state-machine inspect [--json]
1119
- sdd workers list|inspect [--json]
1120
-
1121
- Execution/isolation:
1122
- sdd background run|inspect [options]
1123
- sdd worker-runtime claim|heartbeat|status|inspect [options]
1124
- sdd isolation inspect <task_id> [options]
1125
- sdd graph inspect [--branch <branch>] [--json]
1126
- sdd wave inspect|run|executor [options]
1127
- sdd worktree create|inspect|keep|remove [options]
1128
-
1129
- Legacy init partition option:
1130
- sdd init --branch <branch> creates starter docs for that branch, but normal workflow partitioning belongs to /sdd:spec and sdd status --branch.
1131
- `;
1132
- }
1133
- function wantsJson(args) {
1134
- return args.includes('--json') || args.includes('--compact-json');
1135
- }
1136
- function jsonOutput(value, args) {
1137
- return JSON.stringify(value, null, args.includes('--compact-json') ? 0 : 2);
1138
- }
1139
- function renderTextOrJson(args, value, renderText) {
1140
- return wantsJson(args) ? jsonOutput(value, args) : renderText(value);
1141
- }
1142
- function renderInitResult(result) {
1143
- const aiEntries = result.aiTools.flatMap((tool) => tool.entries);
1144
- const aiCounts = new Map();
1145
- for (const entry of aiEntries) {
1146
- aiCounts.set(entry.status, (aiCounts.get(entry.status) ?? 0) + 1);
1147
- }
1148
- const aiSummary = Array.from(aiCounts.entries()).map(([status, count]) => `${status}=${count}`).join(' ') || 'none';
1149
- const scaffoldedDocuments = result.documents.documents.filter((document) => document.status !== 'skipped');
1150
- const lines = ['SDD init', 'changed'];
1151
- lines.push(`- config ${result.created ? 'created/updated' : 'unchanged'} at ${result.configPath}`);
1152
- lines.push(`- semantic docs ${scaffoldedDocuments.map((document) => `${document.status}:${document.relativePath}`).join(', ') || 'none'}`);
1153
- lines.push(`- ai entries ${aiSummary}`);
1154
- lines.push('decision');
1155
- if (scaffoldedDocuments.length > 0) {
1156
- lines.push(`- legacy_scaffold_branch=${result.documents.branch}`);
1157
- lines.push(`- legacy_spec_dir=${result.documents.root}`);
1158
- }
1159
- lines.push('- sdd init is project-level setup; /sdd:spec is the workflow partition/spec entry');
1160
- lines.push('evidence');
1161
- for (const document of scaffoldedDocuments) {
1162
- lines.push(`- [${document.status}] ${document.relativePath}: ${document.message}`);
1163
- }
1164
- if (aiEntries.length === 0) {
1165
- lines.push('- ai entries skipped');
1166
- }
1167
- else {
1168
- lines.push(`- ${aiEntries.length} managed AI entry projection(s) checked/applied`);
1169
- }
1170
- lines.push('- doctor checks git repository health; run git init first in fresh temporary projects before relying on doctor/run-index checks');
1171
- lines.push('gaps');
1172
- const driftEntries = aiEntries.filter((entry) => entry.status === 'drifted' || entry.status === 'user-modified' || entry.status === 'foreign' || entry.status === 'conflict');
1173
- if (driftEntries.length === 0) {
1174
- lines.push('- none');
1175
- }
1176
- else {
1177
- for (const entry of driftEntries) {
1178
- lines.push(`- [${entry.status}] ${entry.relativePath}: ${entry.action ?? entry.message}`);
1179
- }
1180
- }
1181
- lines.push('next');
1182
- lines.push('- /sdd:spec');
1183
- return lines.join('\n');
1184
- }
1185
- function renderProjectStatus(status) {
1186
- const lines = [`SDD status for ${status.branch}`];
1187
- const staleDocuments = [
1188
- status.documents.planStale ? 'plan' : null,
1189
- status.documents.tasksStale ? 'tasks' : null
1190
- ].filter((item) => item !== null);
1191
- const hasDocumentHashes = Boolean(status.documents.specHash
1192
- || status.documents.planHash
1193
- || status.documents.tasksHash
1194
- || status.documents.planBasedOnSpecHash
1195
- || status.documents.tasksBasedOnPlanHash);
1196
- lines.push('decision');
1197
- lines.push(`- workflow_status=${status.workflowStatus}`);
1198
- lines.push(`- context raw_branch=${status.context.rawBranch} partition=${status.context.partition} source=${status.context.branchSource} spec_dir=${status.context.specDir}`);
1199
- lines.push(`- git current_branch=${status.context.currentGitBranch ?? 'none'} working_tree_matched=${status.context.workingTreeMatched ?? 'unknown'}`);
1200
- lines.push(`- documents spec=${status.documents.specExists} plan=${status.documents.planExists} tasks=${status.documents.tasksExists} stale=${staleDocuments.join(',') || 'none'}`);
1201
- if (hasDocumentHashes) {
1202
- lines.push(`- document_hashes spec=${status.documents.specHash ?? 'none'} plan=${status.documents.planHash ?? 'none'} tasks=${status.documents.tasksHash ?? 'none'} plan_based_on_spec=${status.documents.planBasedOnSpecHash ?? 'none'} tasks_based_on_plan=${status.documents.tasksBasedOnPlanHash ?? 'none'}`);
1203
- }
1204
- lines.push(`- tasks total=${status.tasks.total} pending=${status.tasks.pending} in_progress=${status.tasks.inProgress} completed=${status.tasks.completed} blocked=${status.tasks.blocked} deferred=${status.tasks.deferred} unknown=${status.tasks.unknown} gaps=${status.tasks.gaps}`);
1205
- if (status.latestRun) {
1206
- lines.push(`- latest_run ${status.latestRun.runId} status=${status.latestRun.status} phase=${status.latestRun.phase ?? 'n/a'} task=${status.latestRun.currentTask ?? 'n/a'} validation=${status.latestRun.validationStatus} sync_back=${status.latestRun.syncBackStatus}`);
1207
- if (status.latestRunEvidence) {
1208
- lines.push(`- latest_run_evidence route_preflight=${status.latestRunEvidence.routePreflight} agent_executions=${status.latestRunEvidence.agentExecutions} team_sessions=${status.latestRunEvidence.teamSessions} worker_runtimes=${status.latestRunEvidence.workerRuntimes} stale_worker_runtimes=${status.latestRunEvidence.staleWorkerRuntimes} artifact_ingestions=${status.latestRunEvidence.artifactIngestions}`);
1209
- if (status.latestRunEvidence.tasksChangedAfterRun && status.latestRun.syncBackStatus !== 'applied') {
1210
- lines.push('- latest_run_evidence may be stale: tasks.md changed after the latest run; inspect the task or rerun before relying on this run.');
1211
- }
1212
- else if (status.latestRunEvidence.tasksChangedAfterRun) {
1213
- lines.push('- latest_run_evidence tasks.md changed after sync-back apply; task completion state is already recorded.');
1214
- }
1215
- }
1216
- }
1217
- else {
1218
- lines.push('- latest_run none');
1219
- }
1220
- lines.push('evidence');
1221
- lines.push(`- branch documents loaded from ${status.context.specDir}`);
1222
- lines.push(status.gitRoot
1223
- ? `- git repository detected at ${status.gitRoot}; doctor and run-index checks can use Git repository context`
1224
- : '- doctor and run-index checks expect Git repository context; run git init first in fresh temporary projects');
1225
- renderDocumentGaps(lines, status.gaps);
1226
- lines.push(`next ${status.recommendedNextCommand}`);
1227
- return lines.join('\n');
1228
- }
1229
- function renderRunList(runs) {
1230
- if (runs.length === 0) {
1231
- return 'No SDD runs found.';
1232
- }
1233
- const lines = ['SDD runs'];
1234
- for (const run of runs) {
1235
- lines.push(`${run.runId}\t${run.status}\tphase=${run.phase ?? 'n/a'}\ttask=${run.currentTask ?? 'n/a'}\tvalidation=${run.validationStatus}\tsync_back=${run.syncBackStatus}\tupdated=${run.updatedAt}`);
1236
- }
1237
- return lines.join('\n');
1238
- }
1239
- function renderLocalRunIndex(index) {
1240
- const lines = [`Local run index ${index.contract}`];
1241
- lines.push(`generated=${index.generatedAt} runs=${index.runs.length} tasks=${index.tasks.length} delegations=${index.delegations.length} artifacts=${index.artifacts.length} waves=${index.waves.length}`);
1242
- for (const run of index.runs) {
1243
- lines.push(`- ${run.runId}: ${run.status} phase=${run.phase ?? 'n/a'} task=${run.currentTask ?? 'n/a'} artifacts=${run.artifactCount} updated=${run.updatedAt}`);
1244
- }
1245
- return lines.join('\n');
1246
- }
1247
- function renderLocalRunIndexInspection(inspection) {
1248
- const lines = [`Local run index ${inspection.valid ? 'valid' : 'invalid'}`];
1249
- lines.push(`path=${inspection.indexPath} exists=${inspection.exists}`);
1250
- if (inspection.index) {
1251
- lines.push(`contract=${inspection.index.contract} runs=${inspection.index.runs.length} tasks=${inspection.index.tasks.length} delegations=${inspection.index.delegations.length} artifacts=${inspection.index.artifacts.length} waves=${inspection.index.waves.length}`);
1252
- }
1253
- renderIssues(lines, inspection.issues);
1254
- return lines.join('\n');
1255
- }
1256
- function renderGovernancePolicy(policy) {
1257
- const lines = [`Governance policy ${policy.version}`];
1258
- lines.push(`concurrency background=${policy.concurrency.maxBackgroundDelegations} wave=${policy.concurrency.maxWaveExecutors}`);
1259
- lines.push(`confirmation operations=${policy.manualConfirmation.operations.join(',')}`);
1260
- lines.push(`confirmation workers=${policy.manualConfirmation.workerAdapters.join(',') || 'none'}`);
1261
- lines.push(`confirmation risks=${policy.manualConfirmation.riskTags.join(',') || 'none'}`);
1262
- lines.push(`cleanup archive_only=${policy.cleanup.archiveOnly} delete_run_history=${policy.cleanup.deleteRunHistory}`);
1263
- lines.push(`retry reopen_terminal=${policy.retry.reopenTerminalDelegation} max_attempts=${policy.retry.maxAttemptsPerDelegation}`);
1264
- lines.push(`stop_conditions=${policy.stopConditions.join(',')}`);
1265
- return lines.join('\n');
1266
- }
1267
- function renderGovernancePolicyDecision(decision) {
1268
- const lines = [`Governance decision ${decision.status} for ${decision.operation}`];
1269
- lines.push(`version=${decision.version} allowed=${decision.allowed}`);
1270
- lines.push('reasons');
1271
- for (const reason of decision.reasons) {
1272
- lines.push(`- ${reason}`);
1273
- }
1274
- renderIssues(lines, decision.issues);
1275
- return lines.join('\n');
1276
- }
1277
- function renderRunInspection(inspection) {
1278
- const lines = [`SDD run ${inspection.summary.runId}`];
1279
- lines.push(`status=${inspection.summary.status} phase=${inspection.summary.phase ?? 'n/a'} task=${inspection.summary.currentTask ?? 'n/a'} updated=${inspection.summary.updatedAt}`);
1280
- lines.push(`validation=${inspection.validation.status} evidence=${inspection.validation.evidence.join(',') || 'none'}`);
1281
- lines.push(`sync_back=${inspection.syncBack.status} proposal=${inspection.syncBack.proposalPath ?? 'none'}`);
1282
- lines.push(`task_run_evidence=${inspection.taskRunEvidence.version} gaps=${inspection.taskRunEvidence.gaps.length} sync_back=${inspection.taskRunEvidence.syncBackProposal ?? 'none'}`);
1283
- lines.push(`artifacts=${inspection.artifacts.length}`);
1284
- for (const artifact of inspection.artifacts) {
1285
- lines.push(`- ${artifact.path} kind=${artifact.kind} task=${artifact.task ?? 'n/a'} agent=${artifact.agent ?? 'n/a'}`);
1286
- }
1287
- lines.push(`artifact_ingestions=${inspection.artifactIngestions.length}`);
1288
- for (const ingestion of inspection.artifactIngestions) {
1289
- lines.push(`- ${ingestion.delegationId} ${ingestion.status} artifact=${ingestion.artifactPath} result=${ingestion.resultStatus ?? 'n/a'} delegation=${ingestion.delegationStatus ?? 'n/a'}`);
1290
- }
1291
- lines.push(`agent_executions=${inspection.agentExecutions.length}`);
1292
- for (const execution of inspection.agentExecutions) {
1293
- lines.push(`- ${execution.executionId} profile=${execution.profile} status=${execution.status} task=${execution.taskId} artifacts=${execution.artifacts.join(',') || 'none'}`);
1294
- }
1295
- lines.push(`team_sessions=${inspection.teamSessions.length}`);
1296
- for (const session of inspection.teamSessions) {
1297
- lines.push(`- ${session.teamId} status=${session.status} mode=${session.teamMode.mode} activation=${session.teamMode.activation} cost=${session.teamMode.costClass} chief=${session.chiefProfile} members=${session.memberProfiles.join(',') || 'none'} artifacts=${session.artifacts.join(',') || 'none'}`);
1298
- }
1299
- lines.push(`worker_runtimes=${inspection.workerRuntimes.length}`);
1300
- for (const runtime of inspection.workerRuntimes) {
1301
- lines.push(`- ${runtime.runtimeId} status=${runtime.status} task=${runtime.taskId} agent=${runtime.agent} delegation=${runtime.delegationId} lease_expires=${runtime.leaseExpiresAt}`);
1302
- }
1303
- lines.push(`events=${inspection.eventCount}`);
1304
- for (const event of inspection.recentEvents) {
1305
- lines.push(`- ${event.time} ${event.event}${event.summary ? `: ${event.summary}` : ''}`);
1306
- }
1307
- return lines.join('\n');
1308
- }
1309
- function renderSyncBackInspection(inspection) {
1310
- const lines = [`Sync-back ${inspection.status} for ${inspection.runId}/${inspection.taskId ?? 'n/a'}`];
1311
- lines.push(`branch=${inspection.branch}`);
1312
- lines.push(`proposal=${inspection.proposalPath ?? 'none'}`);
1313
- lines.push(`run_task_status=${inspection.runTaskStatus ?? 'n/a'} markdown_status=${inspection.markdownStatus ?? 'n/a'}`);
1314
- if (inspection.reasons.length > 0) {
1315
- lines.push('reasons');
1316
- for (const reason of inspection.reasons) {
1317
- lines.push(`- ${reason}`);
1318
- }
1319
- }
1320
- renderDocumentGaps(lines, inspection.gaps);
1321
- lines.push(`apply_policy=${inspection.applyPolicy.mode} approval_required=${inspection.applyPolicy.requiresApproval}`);
1322
- for (const reason of inspection.applyPolicy.reasons) {
1323
- lines.push(`- policy: ${reason}`);
1324
- }
1325
- if (inspection.status === 'ready') {
1326
- const approvedFlag = inspection.applyPolicy.requiresApproval ? ' --approved' : '';
1327
- lines.push(`next sdd sync-back apply ${inspection.runId} --branch ${inspection.branch} --task ${inspection.taskId}${approvedFlag}`);
1328
- }
1329
- return lines.join('\n');
1330
- }
1331
- function renderSyncBackApplyResult(result) {
1332
- const lines = [result.message];
1333
- lines.push(`tasks_path=${result.tasksPath}`);
1334
- lines.push(`applied=${result.applied}`);
1335
- lines.push(`sync_back=${result.inspection.status}`);
1336
- return lines.join('\n');
1337
- }
1338
- function renderWorkflowGateList(workflows) {
1339
- const lines = ['SDD workflow gates'];
1340
- for (const workflow of workflows) {
1341
- lines.push(`- ${workflow.id} command=${workflow.command} agents=${workflow.allowedAgents.join(',') || 'none'}`);
1342
- }
1343
- return lines.join('\n');
1344
- }
1345
- function renderWorkflowGateInspect(workflow) {
1346
- const lines = [`Workflow gate ${workflow.id}`];
1347
- lines.push(`version=${workflow.version}`);
1348
- lines.push(`command=${workflow.command}`);
1349
- lines.push(`agents=${workflow.allowedAgents.join(',') || 'none'}`);
1350
- lines.push('required_inputs');
1351
- for (const input of workflow.requiredInputs) {
1352
- lines.push(`- ${input}`);
1353
- }
1354
- lines.push('required_artifacts');
1355
- for (const artifact of workflow.requiredArtifacts) {
1356
- lines.push(`- ${artifact}`);
1357
- }
1358
- lines.push('gate_conditions');
1359
- for (const condition of workflow.gateConditions) {
1360
- lines.push(`- ${condition}`);
1361
- }
1362
- lines.push(`gap_closure=${workflow.gapClosureBehavior}`);
1363
- lines.push(`next=${workflow.nextAction}`);
1364
- return lines.join('\n');
1365
- }
1366
- function renderWorkflowGateValidation(result) {
1367
- const lines = ['SDD workflow gate validation'];
1368
- lines.push(`valid=${result.valid}`);
1369
- lines.push(`workflows=${result.workflows.length}`);
1370
- lines.push('issues');
1371
- if (result.issues.length === 0) {
1372
- lines.push('- none');
1373
- }
1374
- else {
1375
- for (const issue of result.issues) {
1376
- lines.push(`- ${issue.field}: ${issue.message}`);
1377
- }
1378
- }
1379
- return lines.join('\n');
1380
- }
1381
- function renderAgentRegistryList(agents) {
1382
- const lines = ['SDD agent registry'];
1383
- for (const agent of agents) {
1384
- lines.push(`- ${agent.id} stages=${agent.allowedStages.join(',')} autonomy=${agent.autonomyCeiling}`);
1385
- }
1386
- return lines.join('\n');
1387
- }
1388
- function renderAgentRegistryInspect(agent) {
1389
- const lines = [`Agent ${agent.id}`];
1390
- lines.push(`version=${agent.version}`);
1391
- lines.push(`role=${agent.role}`);
1392
- lines.push(`allowed_stages=${agent.allowedStages.join(',')}`);
1393
- lines.push(`autonomy_ceiling=${agent.autonomyCeiling}`);
1394
- lines.push(`required_artifact=${agent.requiredArtifact}`);
1395
- lines.push(`verification=${agent.verificationExpectation}`);
1396
- lines.push('capabilities');
1397
- for (const capability of agent.capabilities) {
1398
- lines.push(`- ${capability}`);
1399
- }
1400
- lines.push('read_boundary');
1401
- for (const item of agent.readBoundary) {
1402
- lines.push(`- ${item}`);
1403
- }
1404
- lines.push('write_boundary');
1405
- for (const item of agent.writeBoundary) {
1406
- lines.push(`- ${item}`);
1407
- }
1408
- lines.push('tool_allowlist');
1409
- for (const tool of agent.toolAllowlist) {
1410
- lines.push(`- ${tool}`);
1411
- }
1412
- lines.push(`stop_condition=${agent.stopCondition}`);
1413
- return lines.join('\n');
1414
- }
1415
- function renderAgentRegistryValidation(result) {
1416
- const lines = ['SDD agent registry validation'];
1417
- lines.push(`valid=${result.valid}`);
1418
- lines.push(`agents=${result.agents.length}`);
1419
- lines.push('issues');
1420
- if (result.issues.length === 0) {
1421
- lines.push('- none');
1422
- }
1423
- else {
1424
- for (const issue of result.issues) {
1425
- lines.push(`- ${issue.field}: ${issue.message}`);
1426
- }
1427
- }
1428
- return lines.join('\n');
1429
- }
1430
- function renderRegistryOriginCounts(sources) {
1431
- if (!sources || sources.length === 0) {
1432
- return 'none';
1433
- }
1434
- const counts = new Map();
1435
- for (const source of sources) {
1436
- counts.set(source.origin, (counts.get(source.origin) ?? 0) + 1);
1437
- }
1438
- return [...counts.entries()].map(([origin, count]) => `${origin}:${count}`).join(',');
1439
- }
1440
- function idsByOrigin(sources, kind, origin) {
1441
- const ids = sources?.filter((source) => source.kind === kind && source.origin === origin).map((source) => source.id) ?? [];
1442
- return ids.join(',') || 'none';
1443
- }
1444
- function renderAgentRouterDecision(decision) {
1445
- const lines = [`Agent router decision ${decision.taskId}`];
1446
- lines.push(`version=${decision.version}`);
1447
- lines.push(`branch=${decision.branch} category=${decision.category}`);
1448
- lines.push(`recommended_profile=${decision.recommendedProfile ?? 'none'} autonomy_ceiling=${decision.autonomyCeiling}`);
1449
- lines.push(`allowed_profiles=${decision.allowedProfiles.join(',') || 'none'}`);
1450
- lines.push(`required_capabilities=${decision.requiredCapabilities.join(',') || 'none'}`);
1451
- lines.push(`source_capability=${decision.sourceCapability ?? 'none'} reuse=${decision.reuseDecision ?? 'none'}`);
1452
- if (decision.registrySources && decision.registrySources.length > 0) {
1453
- lines.push(`registry_sources=${decision.registrySources.map((source) => `${source.kind}:${source.id}:${source.origin}`).join(',')}`);
1454
- }
1455
- if (decision.resolvedAliases && decision.resolvedAliases.length > 0) {
1456
- lines.push(`alias_resolutions=${decision.resolvedAliases.map((alias) => `${alias.input}->${alias.resolved}:${alias.source}`).join(',')}`);
1457
- }
1458
- if (decision.routingRuleHits && decision.routingRuleHits.length > 0) {
1459
- lines.push(`routing_rule_hits=${decision.routingRuleHits.join(',')}`);
1460
- }
1461
- if (decision.quarantineWarnings && decision.quarantineWarnings.length > 0) {
1462
- lines.push('quarantine_warnings');
1463
- for (const warning of decision.quarantineWarnings) {
1464
- lines.push(`- ${warning}`);
1465
- }
1466
- }
1467
- if (decision.adapterMapping) {
1468
- lines.push(`adapter_mapping profile=${decision.adapterMapping.profile} host=${decision.adapterMapping.hostAdapter} projection=${decision.adapterMapping.projection}`);
1469
- }
1470
- if (decision.toolPermission) {
1471
- lines.push(`tool_permission profile=${decision.toolPermission.profile} policy=${decision.toolPermission.policy} groups=${decision.toolPermission.toolGroups.join(',')}`);
1472
- lines.push(`approval=${decision.toolPermission.approvalPolicy}`);
1473
- }
1474
- lines.push(`model_policy=${decision.modelPolicy.id} category=${decision.modelPolicy.category}`);
1475
- lines.push(`team_mode=${decision.teamMode.decision} mode=${decision.teamMode.mode} activation=${decision.teamMode.activation} cost=${decision.teamMode.costClass} waves=${decision.teamMode.waveRecommendation.join(',') || 'none'}`);
1476
- lines.push(`team_mode_reason=${decision.teamMode.reason}`);
1477
- lines.push(`required_artifacts=${decision.requiredArtifacts.join(',') || 'none'}`);
1478
- if (decision.blockedReason) {
1479
- lines.push(`blocked_reason=${decision.blockedReason}`);
1480
- }
1481
- lines.push(`next=${decision.nextAction}`);
1482
- return lines.join('\n');
1483
- }
1484
- function renderAgentSkillTeamRuntimeInspection(inspection) {
1485
- const lines = ['SDD agent/skill/team runtime'];
1486
- lines.push(`version=${inspection.version}`);
1487
- lines.push(`profiles=${inspection.profiles.length} skill_capabilities=${inspection.skillCapabilities.length} capability_sources=${inspection.capabilitySources.length}`);
1488
- lines.push(`registry_origins=${renderRegistryOriginCounts(inspection.registrySources)}`);
1489
- lines.push(`project_profiles=${idsByOrigin(inspection.registrySources, 'profile', 'project_config')}`);
1490
- lines.push(`project_capabilities=${idsByOrigin(inspection.registrySources, 'skill_capability', 'project_config')}`);
1491
- lines.push(`project_sources=${idsByOrigin(inspection.registrySources, 'capability_source', 'project_config')}`);
1492
- if (inspection.aliases && Object.keys(inspection.aliases).length > 0) {
1493
- lines.push(`aliases=${Object.entries(inspection.aliases).map(([alias, target]) => `${alias}->${target}`).join(',')}`);
1494
- }
1495
- if (inspection.routingRules && inspection.routingRules.length > 0) {
1496
- lines.push(`routing_rules=${inspection.routingRules.map((rule) => rule.id).join(',')}`);
1497
- }
1498
- if (inspection.adapterMappings && inspection.adapterMappings.length > 0) {
1499
- lines.push(`adapter_mappings=${inspection.adapterMappings.map((mapping) => `${mapping.profile}:${mapping.hostAdapter}`).join(',')}`);
1500
- }
1501
- lines.push(`host_adapter=${inspection.hostAdapter.id} host=${inspection.hostAdapter.host}`);
1502
- lines.push(`team_mode_default=${inspection.teamMode.decision}`);
1503
- lines.push(`reuse_policy=${inspection.reusePolicy}`);
1504
- lines.push('profiles');
1505
- for (const profile of inspection.profiles) {
1506
- lines.push(`- ${profile.id} stages=${profile.stageScope.join(',')} risk_ceiling=${profile.riskCeiling}`);
1507
- }
1508
- lines.push('capabilities');
1509
- for (const capability of inspection.skillCapabilities) {
1510
- lines.push(`- ${capability.id} reuse=${capability.reuseDecision} evidence=${capability.evidenceType}`);
1511
- }
1512
- return lines.join('\n');
1513
- }
1514
- function renderAgentSkillTeamRuntimeValidation(result) {
1515
- const lines = ['SDD agent/skill/team runtime validation'];
1516
- lines.push(`valid=${result.valid}`);
1517
- lines.push(`profiles=${result.inspection.profiles.length}`);
1518
- lines.push(`capabilities=${result.inspection.skillCapabilities.length}`);
1519
- lines.push(`registry_origins=${renderRegistryOriginCounts(result.inspection.registrySources)}`);
1520
- lines.push('issues');
1521
- if (result.issues.length === 0) {
1522
- lines.push('- none');
1523
- }
1524
- else {
1525
- for (const issue of result.issues) {
1526
- lines.push(`- ${issue.field}: ${issue.message}`);
1527
- }
1528
- }
1529
- return lines.join('\n');
1530
- }
1531
- function renderSkillCapabilityList(capabilities, registrySources) {
1532
- const lines = ['SDD skill capabilities'];
1533
- lines.push(`registry_origins=${renderRegistryOriginCounts(registrySources)}`);
1534
- for (const capability of capabilities) {
1535
- const source = registrySources?.find((candidate) => candidate.kind === 'skill_capability' && candidate.id === capability.id);
1536
- lines.push(`- ${capability.id} domain=${capability.capabilityDomain.join(',')} reuse=${capability.reuseDecision} evidence=${capability.evidenceType} origin=${source?.origin ?? 'unknown'}`);
1537
- }
1538
- return lines.join('\n');
1539
- }
1540
- function renderSkillCapabilityInspect(capability) {
1541
- const lines = [`Skill capability ${capability.id}`];
1542
- lines.push(`version=${capability.version}`);
1543
- lines.push(`name=${capability.name}`);
1544
- lines.push(`kind=${capability.kind} source=${capability.source} source_ref=${capability.sourceRef}`);
1545
- lines.push(`domain=${capability.capabilityDomain.join(',')}`);
1546
- lines.push(`allowed_stages=${capability.allowedStages.join(',')}`);
1547
- lines.push(`risk_ceiling=${capability.requiredRiskCeiling}`);
1548
- lines.push(`evidence_type=${capability.evidenceType}`);
1549
- lines.push(`reuse_decision=${capability.reuseDecision}`);
1550
- if (capability.buildExceptionReason) {
1551
- lines.push(`build_exception=${capability.buildExceptionReason}`);
1552
- }
1553
- return lines.join('\n');
1554
- }
1555
- function renderCapabilitySourceList(sources, registrySources) {
1556
- const lines = ['SDD capability sources'];
1557
- lines.push(`registry_origins=${renderRegistryOriginCounts(registrySources)}`);
1558
- for (const source of sources) {
1559
- const registrySource = registrySources?.find((candidate) => candidate.kind === 'capability_source' && candidate.id === source.id);
1560
- lines.push(`- ${source.id} kind=${source.kind} reuse=${source.reuseDecision} quarantine=${source.quarantineRequired} origin=${registrySource?.origin ?? 'unknown'}`);
1561
- }
1562
- return lines.join('\n');
1563
- }
1564
- function renderCapabilitySourceInspect(source) {
1565
- const lines = [`Capability source ${source.id}`];
1566
- lines.push(`version=${source.version}`);
1567
- lines.push(`name=${source.name}`);
1568
- lines.push(`kind=${source.kind} reuse=${source.reuseDecision} quarantine=${source.quarantineRequired}`);
1569
- lines.push(`source_ref=${source.sourceRef}`);
1570
- lines.push(`allowed_use=${source.allowedUse}`);
1571
- lines.push(`attribution=${source.attribution}`);
1572
- lines.push(`rationale=${source.rationale}`);
1573
- return lines.join('\n');
1574
- }
1575
- function renderExternalAgentPackImportInspection(inspection) {
1576
- const lines = [`External pack import ${inspection.sourceId}`];
1577
- lines.push(`version=${inspection.version}`);
1578
- lines.push(`status=${inspection.status} risk_ceiling=${inspection.riskCeiling}`);
1579
- lines.push(`allowed_profiles=${inspection.allowedProfiles.join(',') || 'none'}`);
1580
- lines.push(`mapping=${inspection.mappingResult}`);
1581
- lines.push(`reason=${inspection.reason}`);
1582
- lines.push('checks');
1583
- for (const check of inspection.checks) {
1584
- lines.push(`- ${check.check} status=${check.status} evidence=${check.evidence}`);
1585
- }
1586
- return lines.join('\n');
1587
- }
1588
- function renderTeamModePolicy(policy) {
1589
- const lines = ['SDD team-mode policy'];
1590
- lines.push(`version=${policy.version}`);
1591
- lines.push(`enabled=${policy.enabled} decision=${policy.decision} mode=${policy.mode} activation=${policy.activation} cost=${policy.costClass}`);
1592
- lines.push(`reason=${policy.reason}`);
1593
- lines.push(`chief=${policy.chiefProfile} members=${policy.memberProfiles.join(',') || 'none'} max_members=${policy.maxMembers}`);
1594
- lines.push(`require_artifacts=${policy.requireArtifacts}`);
1595
- lines.push(`waves=${policy.waveRecommendation.join(',') || 'none'}`);
1596
- if (policy.blockedReason) {
1597
- lines.push(`blocked_reason=${policy.blockedReason}`);
1598
- }
1599
- for (const wave of policy.allowedWaves) {
1600
- lines.push(`- ${wave.id} kind=${wave.waveKind} members=${wave.memberProfiles.join(',')} merge_gate=${wave.mergeGate}`);
1601
- }
1602
- return lines.join('\n');
1603
- }
1604
- function renderQueryStatusContract(contract) {
1605
- const lines = ['SDD query status contract'];
1606
- lines.push(`version=${contract.version}`);
1607
- lines.push(`source=${contract.sourceDocument}`);
1608
- for (const surface of contract.surfaces) {
1609
- lines.push(`- ${surface.id} command=${surface.command}`);
1610
- lines.push(` responsibility=${surface.responsibility}`);
1611
- lines.push(` includes=${surface.includes.join(',')}`);
1612
- lines.push(` excludes=${surface.excludes.join(',')}`);
1613
- lines.push(` next=${surface.nextActionRule}`);
1614
- }
1615
- return lines.join('\n');
1616
- }
1617
- function renderQueryStatusValidation(result) {
1618
- const lines = ['SDD query status validation'];
1619
- lines.push(`valid=${result.valid}`);
1620
- lines.push(`surfaces=${result.surfaces.length}`);
1621
- lines.push('issues');
1622
- if (result.issues.length === 0) {
1623
- lines.push('- none');
1624
- }
1625
- else {
1626
- for (const issue of result.issues) {
1627
- lines.push(`- ${issue.field}: ${issue.message}`);
1628
- }
1629
- }
1630
- return lines.join('\n');
1631
- }
1632
- function renderSkillAgentEvalContract(contract) {
1633
- const lines = ['SDD skill/agent eval contract'];
1634
- lines.push(`version=${contract.version}`);
1635
- lines.push(`source=${contract.sourceReport}`);
1636
- lines.push(`corpus=${contract.corpus.length}`);
1637
- lines.push('dimensions');
1638
- for (const dimension of contract.dimensions) {
1639
- lines.push(`- ${dimension.id} threshold=${dimension.passThreshold}`);
1640
- lines.push(` expectation=${dimension.expectation}`);
1641
- lines.push(` baseline=${dimension.baselineFinding}`);
1642
- }
1643
- lines.push('regression_assertions');
1644
- for (const assertion of contract.regressionAssertions) {
1645
- lines.push(`- ${assertion}`);
1646
- }
1647
- return lines.join('\n');
1648
- }
1649
- function renderSkillAgentEvalValidation(result) {
1650
- const lines = ['SDD skill/agent eval validation'];
1651
- lines.push(`valid=${result.valid}`);
1652
- lines.push(`dimensions=${result.contract.dimensions.length}`);
1653
- lines.push(`corpus=${result.contract.corpus.length}`);
1654
- lines.push('issues');
1655
- if (result.issues.length === 0) {
1656
- lines.push('- none');
1657
- }
1658
- else {
1659
- for (const issue of result.issues) {
1660
- lines.push(`- ${issue.field}: ${issue.message}`);
1661
- }
1662
- }
1663
- return lines.join('\n');
1664
- }
1665
- function renderHarnessLearningContract(contract) {
1666
- const lines = ['SDD harness learning contract'];
1667
- lines.push(`version=${contract.version}`);
1668
- lines.push(`source=${contract.sourceTrial}`);
1669
- lines.push(`promotion=${contract.promotionRule}`);
1670
- lines.push('allowed_sinks');
1671
- for (const sink of contract.allowedSinks) {
1672
- lines.push(`- ${sink.id}: ${sink.output}`);
1673
- lines.push(` boundary=${sink.boundary}`);
1674
- }
1675
- lines.push('forbidden_outputs');
1676
- for (const output of contract.forbiddenOutputs) {
1677
- lines.push(`- ${output}`);
1678
- }
1679
- return lines.join('\n');
1680
- }
1681
- function renderHarnessLearningValidation(result) {
1682
- const lines = ['SDD harness learning validation'];
1683
- lines.push(`valid=${result.valid}`);
1684
- lines.push(`allowed_sinks=${result.contract.allowedSinks.length}`);
1685
- lines.push(`forbidden_outputs=${result.contract.forbiddenOutputs.length}`);
1686
- lines.push('issues');
1687
- if (result.issues.length === 0) {
1688
- lines.push('- none');
1689
- }
1690
- else {
1691
- for (const issue of result.issues) {
1692
- lines.push(`- ${issue.field}: ${issue.message}`);
1693
- }
1694
- }
1695
- return lines.join('\n');
1696
- }
1697
- function renderProjectContextPackContract(contract) {
1698
- const lines = ['SDD project context pack contract'];
1699
- lines.push(`version=${contract.version}`);
1700
- lines.push(`entry=${contract.entryPoint}`);
1701
- lines.push('durable_context');
1702
- for (const item of contract.durableContext) {
1703
- lines.push(`- ${item}`);
1704
- }
1705
- lines.push('runtime_sources_of_truth');
1706
- for (const source of contract.runtimeSourcesOfTruth) {
1707
- lines.push(`- ${source}`);
1708
- }
1709
- lines.push('boundaries');
1710
- for (const boundary of contract.boundaries) {
1711
- lines.push(`- ${boundary}`);
1712
- }
1713
- return lines.join('\n');
1714
- }
1715
- function renderProjectContextPackValidation(result) {
1716
- const lines = ['SDD project context pack validation'];
1717
- lines.push(`valid=${result.valid}`);
1718
- lines.push(`entry=${result.contract.entryPoint}`);
1719
- lines.push(`runtime_sources=${result.contract.runtimeSourcesOfTruth.length}`);
1720
- lines.push('issues');
1721
- if (result.issues.length === 0) {
1722
- lines.push('- none');
1723
- }
1724
- else {
1725
- for (const issue of result.issues) {
1726
- lines.push(`- ${issue.field}: ${issue.message}`);
1727
- }
1728
- }
1729
- return lines.join('\n');
1730
- }
1731
- function renderCapabilityList(capabilities) {
1732
- const lines = ['SDD tool capabilities'];
1733
- for (const capability of capabilities) {
1734
- lines.push(`- ${capability.id} category=${capability.category} side_effect=${capability.sideEffect} default=${capability.defaultAvailable}`);
1735
- }
1736
- return lines.join('\n');
1737
- }
1738
- function renderCapabilityInspect(capability) {
1739
- const lines = [`Capability ${capability.id}`];
1740
- lines.push(`title=${capability.title}`);
1741
- lines.push(`category=${capability.category} side_effect=${capability.sideEffect} default=${capability.defaultAvailable}`);
1742
- lines.push(`summary=${capability.summary}`);
1743
- lines.push('allowed_stages');
1744
- for (const stage of capability.allowedStages) {
1745
- lines.push(`- ${stage}`);
1746
- }
1747
- lines.push('required_evidence');
1748
- for (const evidence of capability.requiredEvidence) {
1749
- lines.push(`- ${evidence}`);
1750
- }
1751
- lines.push('forbidden_uses');
1752
- for (const forbiddenUse of capability.forbiddenUses) {
1753
- lines.push(`- ${forbiddenUse}`);
1754
- }
1755
- return lines.join('\n');
1756
- }
1757
- function renderPluginContractList(contracts) {
1758
- const lines = ['SDD plugin loading contracts'];
1759
- for (const contract of contracts) {
1760
- lines.push(`- ${contract.id} capability=${contract.capabilityId} entry=${contract.entryKind} load_mode=${contract.loadMode}`);
1761
- }
1762
- return lines.join('\n');
1763
- }
1764
- function renderPluginContractInspect(contract) {
1765
- const lines = [`Plugin contract ${contract.id}`];
1766
- lines.push(`title=${contract.title}`);
1767
- lines.push(`version=${contract.version} capability=${contract.capabilityId}`);
1768
- lines.push(`entry=${contract.entryKind} load_mode=${contract.loadMode}`);
1769
- lines.push(`asset_path=${contract.assetPath}`);
1770
- lines.push(`checksum=${contract.checksum ?? 'none'}`);
1771
- lines.push('required_evidence');
1772
- for (const evidence of contract.requiredEvidence) {
1773
- lines.push(`- ${evidence}`);
1774
- }
1775
- lines.push('forbidden_uses');
1776
- for (const forbiddenUse of contract.forbiddenUses) {
1777
- lines.push(`- ${forbiddenUse}`);
1778
- }
1779
- return lines.join('\n');
1780
- }
1781
- function renderDelegationQueueList(items) {
1782
- const lines = ['SDD delegation queue items'];
1783
- for (const item of items) {
1784
- lines.push(`- ${item.id} task=${item.taskId} agent=${item.agent} status=${item.status} capability=${item.requestedCapabilityId}`);
1785
- }
1786
- return lines.join('\n');
1787
- }
1788
- function renderDelegationQueueInspect(item) {
1789
- const lines = [`Queue item ${item.id}`];
1790
- lines.push(`run=${item.runId} delegation=${item.delegationId}`);
1791
- lines.push(`task=${item.taskId} agent=${item.agent} status=${item.status}`);
1792
- lines.push(`capability=${item.requestedCapabilityId} source=${item.statusSource} run_mode=${item.runMode}`);
1793
- lines.push(`dedupe_key=${item.dedupeKey}`);
1794
- lines.push(`expected_artifact=${item.expectedArtifact}`);
1795
- lines.push('required_evidence');
1796
- for (const evidence of item.requiredEvidence) {
1797
- lines.push(`- ${evidence}`);
1798
- }
1799
- return lines.join('\n');
1800
- }
1801
- function renderDelegationStateMachineInspect(machine) {
1802
- const lines = [`Delegation state machine ${machine.version}`];
1803
- lines.push(`statuses=${machine.statuses.join(',')}`);
1804
- lines.push(`terminal_statuses=${machine.terminalStatuses.join(',')}`);
1805
- lines.push('transitions');
1806
- for (const transition of machine.transitions) {
1807
- lines.push(`- ${transition.from} -> ${transition.to} event=${transition.event} terminal=${transition.terminal}`);
1808
- }
1809
- return lines.join('\n');
1810
- }
1811
- function renderWorkerAdapterList(adapters) {
1812
- const lines = ['SDD worker adapter contracts'];
1813
- for (const adapter of adapters) {
1814
- lines.push(`- ${adapter.id} kind=${adapter.kind} capability=${adapter.capabilityId} plugin=${adapter.pluginContractId} side_effect=${adapter.sideEffect}`);
1815
- }
1816
- return lines.join('\n');
1817
- }
1818
- function renderWorkerAdapterInspect(adapter) {
1819
- const lines = [`Worker adapter ${adapter.id}`];
1820
- lines.push(`title=${adapter.title}`);
1821
- lines.push(`version=${adapter.version} kind=${adapter.kind}`);
1822
- lines.push(`capability=${adapter.capabilityId} plugin=${adapter.pluginContractId} side_effect=${adapter.sideEffect}`);
1823
- lines.push(`state_machine=${adapter.input.stateMachineVersion}`);
1824
- lines.push(`artifact_reference=${adapter.output.artifactReference}`);
1825
- lines.push(`terminal_status=${adapter.output.terminalStatus.join(',')}`);
1826
- lines.push(`exit_statuses=${adapter.output.exitStatuses.join(',')}`);
1827
- lines.push(`permission_prompt=${adapter.permissionPrompt}`);
1828
- lines.push('required_events');
1829
- for (const event of adapter.output.requiredEvents) {
1830
- lines.push(`- ${event}`);
1831
- }
1832
- lines.push('required_evidence');
1833
- for (const evidence of adapter.requiredEvidence) {
1834
- lines.push(`- ${evidence}`);
1835
- }
1836
- lines.push('forbidden_uses');
1837
- for (const forbiddenUse of adapter.forbiddenUses) {
1838
- lines.push(`- ${forbiddenUse}`);
1839
- }
1840
- return lines.join('\n');
1841
- }
1842
- function renderArtifactIngestionResult(result) {
1843
- const lines = [`Artifact ingestion ${result.record.status}: ${result.record.artifactPath}`];
1844
- lines.push(`delegation=${result.record.delegationId} duplicate=${result.duplicate} result=${result.record.resultStatus ?? 'n/a'} terminal=${result.record.delegationStatus ?? 'n/a'}`);
1845
- if (result.record.issues.length > 0) {
1846
- lines.push('issues');
1847
- for (const issue of result.record.issues) {
1848
- lines.push(`- ${issue.field}: ${issue.message}`);
1849
- lines.push(` recommendation: ${issue.recommendation}`);
1850
- }
1851
- }
1852
- if (result.record.gaps.length > 0) {
1853
- lines.push('gaps');
1854
- for (const gap of result.record.gaps) {
1855
- lines.push(`- [${gap.severity}] ${gap.type} ${gap.field}: ${gap.message}`);
1856
- }
1857
- }
1858
- return lines.join('\n');
1859
- }
1860
- function renderArtifactIngestionInspection(inspection) {
1861
- const lines = [`Artifact ingestions ${inspection.valid ? 'valid' : 'invalid'} for ${inspection.runId}`];
1862
- lines.push(`records=${inspection.records.length}`);
1863
- for (const record of inspection.records) {
1864
- lines.push(`- ${record.delegationId} ${record.status} artifact=${record.artifactPath} result=${record.resultStatus ?? 'n/a'} delegation=${record.delegationStatus ?? 'n/a'}`);
1865
- }
1866
- renderIssues(lines, inspection.issues);
1867
- return lines.join('\n');
1868
- }
1869
- function renderBackgroundExecutorResult(result) {
1870
- const lines = [`Background executor ${result.status} for ${result.taskId}`];
1871
- lines.push(`version=${result.version}`);
1872
- lines.push(`run=${result.runId} delegation=${result.delegationId ?? 'n/a'} queue=${result.queueItemId ?? 'n/a'} worker=${result.workerAdapterId}`);
1873
- lines.push(`artifact=${result.artifactPath ?? 'pending'}`);
1874
- lines.push(result.message);
1875
- renderIssues(lines, result.issues);
1876
- return lines.join('\n');
1877
- }
1878
- function renderBackgroundExecutorInspection(inspection) {
1879
- const lines = [`Background executor ${inspection.valid ? 'valid' : 'invalid'} for ${inspection.runId}`];
1880
- lines.push(`version=${inspection.version}`);
1881
- lines.push(`delegations=${inspection.delegations.length} running=${inspection.runningDelegations} terminal=${inspection.terminalDelegations} ingestions=${inspection.artifactIngestions.length}`);
1882
- for (const delegation of inspection.delegations) {
1883
- lines.push(`- ${delegation.delegationId} ${delegation.status} task=${delegation.taskId} agent=${delegation.agent} artifact=${delegation.expectedArtifact}`);
1884
- }
1885
- renderIssues(lines, inspection.issues);
1886
- return lines.join('\n');
1887
- }
1888
- function renderResidentWorkerRuntimeClaimResult(result) {
1889
- const lines = [`Resident worker runtime ${result.status} for ${result.taskId}`];
1890
- lines.push(`version=${result.version}`);
1891
- lines.push(`run=${result.runId} runtime=${result.runtimeId ?? 'n/a'} delegation=${result.delegationId ?? 'n/a'} queue=${result.queueItemId ?? 'n/a'} worker=${result.workerAdapterId}`);
1892
- lines.push(`artifact=${result.expectedArtifact ?? 'pending'} lease_expires=${result.leaseExpiresAt ?? 'n/a'}`);
1893
- lines.push(result.message);
1894
- renderIssues(lines, result.issues);
1895
- if (result.runtimeId && result.leaseExpiresAt) {
1896
- lines.push(`next sdd worker-runtime heartbeat ${result.runtimeId} --run ${result.runId}`);
1897
- lines.push(`inspect sdd worker-runtime inspect ${result.runtimeId} --run ${result.runId}`);
1898
- }
1899
- return lines.join('\n');
1900
- }
1901
- function renderResidentWorkerRuntimeHeartbeatResult(result) {
1902
- const lines = [`Resident worker runtime ${result.status}: ${result.runtimeId}`];
1903
- lines.push(`version=${result.version}`);
1904
- lines.push(`run=${result.runId} lease_expires=${result.leaseExpiresAt ?? 'n/a'}`);
1905
- lines.push(result.message);
1906
- renderIssues(lines, result.issues);
1907
- if (result.runtime) {
1908
- lines.push(`next ${result.status === 'terminal' ? `sdd background inspect ${result.runId}` : `sdd worker-runtime inspect ${result.runtimeId} --run ${result.runId}`}`);
1909
- }
1910
- return lines.join('\n');
1911
- }
1912
- function renderResidentWorkerRuntimeList(result) {
1913
- const lines = [`Resident worker runtimes for ${result.runId}`];
1914
- lines.push(`version=${result.version}`);
1915
- lines.push(`runtimes=${result.runtimes.length} active=${result.activeRuntimes} stale=${result.staleRuntimes} terminal=${result.terminalRuntimes} blocked=${result.blockedRuntimes}`);
1916
- for (const runtime of result.runtimes) {
1917
- lines.push(`- ${runtime.runtimeId} ${runtime.status} task=${runtime.taskId} agent=${runtime.agent} delegation=${runtime.delegationId} lease_expires=${runtime.leaseExpiresAt}`);
1918
- }
1919
- renderIssues(lines, result.issues);
1920
- return lines.join('\n');
1921
- }
1922
- function renderResidentWorkerRuntimeInspection(inspection) {
1923
- const lines = [`Resident worker runtime ${inspection.status}: ${inspection.runtimeId}`];
1924
- lines.push(`version=${inspection.version}`);
1925
- lines.push(`run=${inspection.runId} valid=${inspection.valid} lease_expired=${inspection.leaseExpired}`);
1926
- if (inspection.runtime) {
1927
- lines.push(`task=${inspection.runtime.taskId} agent=${inspection.runtime.agent} worker=${inspection.runtime.workerAdapterId}`);
1928
- lines.push(`delegation=${inspection.runtime.delegationId} queue=${inspection.runtime.queueItemId} artifact=${inspection.runtime.expectedArtifact}`);
1929
- lines.push(`claimed=${inspection.runtime.claimedAt} heartbeat=${inspection.runtime.lastHeartbeatAt ?? 'none'} lease_expires=${inspection.runtime.leaseExpiresAt}`);
1930
- lines.push(`evidence=${inspection.runtime.evidenceSummary}`);
1931
- }
1932
- lines.push(`queue_status=${inspection.queueItem?.status ?? 'missing'} adapter=${inspection.workerAdapter?.id ?? 'missing'}`);
1933
- lines.push(`next ${inspection.recommendedNextCommand}`);
1934
- renderIssues(lines, inspection.issues);
1935
- return lines.join('\n');
1936
- }
1937
- function renderIssues(lines, issues) {
1938
- if (issues.length === 0) {
1939
- return;
1940
- }
1941
- lines.push('issues');
1942
- for (const issue of issues) {
1943
- lines.push(`- ${issue.field}: ${issue.message}`);
1944
- lines.push(` recommendation: ${issue.recommendation}`);
1945
- }
1946
- }
1947
- function renderDocumentGaps(lines, gaps) {
1948
- if (gaps.length === 0) {
1949
- return;
1950
- }
1951
- lines.push('gaps');
1952
- for (const gap of gaps) {
1953
- lines.push(`- [${gap.severity}] ${gap.type} ${gap.taskId ?? 'document'} ${gap.field}: ${gap.message}`);
1954
- }
1955
- }
1956
- function renderWaveExecutorResult(result) {
1957
- const lines = [`Wave executor ${result.status} for ${result.branch}`];
1958
- lines.push(`version=${result.version}`);
1959
- lines.push(`run=${result.runId} strategy=${result.strategy} waves=${result.executedWaves}/${result.plannedWaves} tasks=${result.taskResults.length}`);
1960
- lines.push(result.message);
1961
- for (const task of result.taskResults) {
1962
- lines.push(`- wave ${task.waveIndex} ${task.taskId}: ${task.result.status} delegation=${task.result.delegationId ?? 'n/a'} artifact=${task.result.artifactPath ?? 'pending'}`);
1963
- }
1964
- if (result.manualGates.length > 0) {
1965
- lines.push('manual_gates');
1966
- for (const gate of result.manualGates) {
1967
- lines.push(`- ${gate.taskId}: ${gate.reasons.join(' | ')}`);
1968
- }
1969
- }
1970
- if (result.blockedTasks.length > 0) {
1971
- lines.push('blocked_tasks');
1972
- for (const gate of result.blockedTasks) {
1973
- lines.push(`- ${gate.taskId}: ${gate.reasons.join(' | ')}`);
1974
- }
1975
- }
1976
- renderIssues(lines, result.issues);
1977
- return lines.join('\n');
1978
- }
1979
- function renderWaveExecutorInspection(inspection) {
1980
- const lines = [`Wave executor ${inspection.valid ? 'valid' : 'invalid'} for ${inspection.runId}`];
1981
- lines.push(`version=${inspection.version}`);
1982
- lines.push(`events=${inspection.waveEvents.length} delegations=${inspection.background.delegations.length} terminal=${inspection.background.terminalDelegations}`);
1983
- for (const event of inspection.waveEvents) {
1984
- lines.push(`- ${event.event}: ${event.summary ?? ''}`);
1985
- }
1986
- renderIssues(lines, inspection.issues);
1987
- return lines.join('\n');
1988
- }
1989
- function renderWorktreeIsolationDecision(decision) {
1990
- const lines = [`Worktree isolation ${decision.mode} for ${decision.taskId}`];
1991
- lines.push(`version=${decision.version}`);
1992
- lines.push(`safe_concurrency=${decision.safeConcurrency} capability=${decision.capabilityId} side_effect=${decision.capabilitySideEffect}`);
1993
- lines.push(`affected_files=${decision.affectedFiles.length > 0 ? decision.affectedFiles.join(',') : 'none'}`);
1994
- lines.push(`risk=${decision.risk.length > 0 ? decision.risk.join(',') : 'none'}`);
1995
- if (decision.overlaps.length > 0) {
1996
- lines.push('overlaps');
1997
- for (const overlap of decision.overlaps) {
1998
- lines.push(`- ${overlap.peerTaskId}: ${overlap.files.join(',')}`);
1999
- }
2000
- }
2001
- lines.push('gates');
2002
- for (const gate of decision.gates) {
2003
- lines.push(`- ${gate.name} ${gate.passed ? 'PASS' : 'FAIL'}: ${gate.message}`);
2004
- }
2005
- lines.push('reasons');
2006
- for (const reason of decision.reasons) {
2007
- lines.push(`- ${reason}`);
2008
- }
2009
- return lines.join('\n');
2010
- }
2011
- function renderWorktreeLifecycleRecord(title, record) {
2012
- return [
2013
- `${title}: ${record.worktreeId}`,
2014
- `status=${record.status} task=${record.taskId} branch=${record.branchName}`,
2015
- `path=${record.worktreePath} base=${record.baseRef} dirty=${record.dirty}`,
2016
- `kept=${record.keepReason ?? 'n/a'} removed=${record.removedAt ?? 'n/a'}`
2017
- ].join('\n');
2018
- }
2019
- function renderWorktreeLifecycleInspection(inspection) {
2020
- const lines = [`Worktree lifecycle ${inspection.valid ? 'valid' : 'invalid'} for ${inspection.runId}`];
2021
- lines.push(`records=${inspection.records.length}`);
2022
- for (const record of inspection.records) {
2023
- lines.push(`- ${record.worktreeId} ${record.status} task=${record.taskId} path=${record.worktreePath} dirty=${record.dirty}`);
2024
- }
2025
- renderIssues(lines, inspection.issues);
2026
- return lines.join('\n');
2027
- }
2028
- function renderTaskGraphPlan(graph) {
2029
- const lines = [`Task graph ${graph.valid ? 'valid' : 'blocked'} for ${graph.branch}`];
2030
- lines.push(`version=${graph.version}`);
2031
- lines.push(`contract=${graph.contract}`);
2032
- lines.push(`tasks=${graph.summary.tasks} dependencies=${graph.summary.dependencies} file_overlaps=${graph.summary.fileOverlaps}`);
2033
- lines.push(`high_risk_tasks=${graph.summary.highRiskTasks.length > 0 ? graph.summary.highRiskTasks.join(',') : 'none'}`);
2034
- lines.push(`validation=${graph.summary.validationCommands.length > 0 ? graph.summary.validationCommands.join(' | ') : 'none'}`);
2035
- lines.push('nodes');
2036
- for (const node of graph.nodes) {
2037
- lines.push(`- ${node.taskId} status=${node.status} wave=${node.wave ?? 'n/a'} deps=${node.dependsOn.join(',') || 'none'} files=${node.affectedFiles.length} agent_fit=${node.agentFit.join(',') || 'none'} verification=${node.verificationAvailability.join(',') || 'none'} autonomy=${node.autonomy ?? 'n/a'}`);
2038
- }
2039
- if (graph.dependencyEdges.length > 0) {
2040
- lines.push('dependency_edges');
2041
- for (const edge of graph.dependencyEdges) {
2042
- lines.push(`- ${edge.from} -> ${edge.to}`);
2043
- }
2044
- }
2045
- if (graph.fileOverlapEdges.length > 0) {
2046
- lines.push('file_overlap_edges');
2047
- for (const edge of graph.fileOverlapEdges) {
2048
- lines.push(`- ${edge.from} <-> ${edge.to}: ${edge.files.join(',')}`);
2049
- }
2050
- }
2051
- if (graph.diagnostics.length > 0) {
2052
- lines.push('diagnostics');
2053
- for (const diagnostic of graph.diagnostics) {
2054
- lines.push(`- [${diagnostic.severity}] ${diagnostic.taskId ?? 'document'} ${diagnostic.field}: ${diagnostic.message}`);
2055
- lines.push(` recommendation: ${diagnostic.recommendation}`);
2056
- }
2057
- }
2058
- return lines.join('\n');
2059
- }
2060
- function renderWavePlan(plan) {
2061
- const lines = [`Wave plan ${plan.valid ? 'valid' : 'blocked'} for ${plan.branch}`];
2062
- lines.push(`version=${plan.version}`);
2063
- lines.push(`tasks=${plan.summary.tasks} waves=${plan.summary.waves} planned=${plan.summary.plannedTasks} manual=${plan.summary.manualTasks} blocked=${plan.summary.blockedTasks}`);
2064
- if (plan.waves.length > 0) {
2065
- lines.push('waves');
2066
- for (const wave of plan.waves) {
2067
- const tasks = wave.tasks.map((task) => `${task.taskId}(${task.isolationMode})`).join(', ');
2068
- lines.push(`- wave ${wave.index}: ${tasks}`);
2069
- }
2070
- }
2071
- if (plan.manualGates.length > 0) {
2072
- lines.push('manual_gates');
2073
- for (const gate of plan.manualGates) {
2074
- lines.push(`- ${gate.taskId}: ${gate.reasons.join(' | ')}`);
2075
- }
2076
- }
2077
- if (plan.blockedTasks.length > 0) {
2078
- lines.push('blocked_tasks');
2079
- for (const gate of plan.blockedTasks) {
2080
- lines.push(`- ${gate.taskId}: ${gate.reasons.join(' | ')}`);
2081
- }
2082
- }
2083
- if (plan.diagnostics.length > 0) {
2084
- lines.push('diagnostics');
2085
- for (const diagnostic of plan.diagnostics) {
2086
- lines.push(`- [${diagnostic.severity}] ${diagnostic.taskId ?? 'document'} ${diagnostic.field}: ${diagnostic.message}`);
2087
- lines.push(` recommendation: ${diagnostic.recommendation}`);
2088
- }
2089
- }
2090
- return lines.join('\n');
2091
- }
2092
- function readTeamModeActivation(args, fallback) {
2093
- if (args.includes('--no-team-mode')) {
2094
- return 'off';
2095
- }
2096
- const inline = args.find((item) => item.startsWith('--team-mode='));
2097
- const inlineValue = inline?.split('=', 2)[1];
2098
- if (inlineValue === 'auto' || inlineValue === 'force' || inlineValue === 'off') {
2099
- return inlineValue;
2100
- }
2101
- const index = args.indexOf('--team-mode');
2102
- if (index >= 0) {
2103
- const value = args[index + 1];
2104
- if (value === 'auto' || value === 'force' || value === 'off') {
2105
- return value;
2106
- }
2107
- return 'force';
2108
- }
2109
- return fallback;
2110
- }
2111
- function readBranchContext(args) {
2112
- const branch = readBranchOption(args);
2113
- return branch ? { branch, branchSource: 'cli_option' } : {};
2114
- }
2115
- function readBranchOption(args) {
2116
- return readOption(args, '--branch') ?? undefined;
2117
- }
2118
- function readOptionalPositionalArgument(args) {
2119
- const booleanOptions = new Set(['--approved', '--json', '--no-team-mode', '--force', '--check', '--latest-only', '--all-runs', '--scaffold-docs', '--no-scaffold-docs', '--direct-safe', '--external-unknown', '--architecture', '--checkpoint']);
2120
- for (let index = 0; index < args.length; index += 1) {
2121
- const item = args[index];
2122
- if (!item.startsWith('--')) {
2123
- return item;
2124
- }
2125
- if (item.includes('=')) {
2126
- continue;
2127
- }
2128
- if (!booleanOptions.has(item) && args[index + 1] && !args[index + 1].startsWith('--')) {
2129
- index += 1;
2130
- }
2131
- }
2132
- return undefined;
2133
- }
2134
- async function readResolvedBranch(projectRoot, args) {
2135
- return (await resolveSddContext(projectRoot, readBranchContext(args))).branch;
2136
- }
2137
- function readWaveExecutorStrategy(args, name) {
2138
- const value = readOption(args, name) ?? 'fast-stop';
2139
- return value === 'fast-stop' || value === 'safe-continue' ? value : null;
2140
- }
2141
- function readRunStatus(args, name) {
2142
- const value = readOption(args, name);
2143
- return value === 'created' || value === 'running' || value === 'completed' || value === 'blocked' || value === 'failed' || value === 'archived' ? value : null;
2144
- }
2145
- function readGovernancePolicyOperation(value) {
2146
- return value === 'background_executor' || value === 'wave_executor' || value === 'sync_back_apply' || value === 'destructive_git' || value === 'external_interaction' || value === 'cleanup' ? value : null;
2147
- }
2148
- function readTaskArtifactOptions(args) {
2149
- const artifacts = {};
2150
- for (let index = 0; index < args.length; index += 1) {
2151
- if (args[index] !== '--artifact') {
2152
- continue;
2153
- }
2154
- const value = args[index + 1];
2155
- const separator = value?.indexOf(':') ?? -1;
2156
- if (!value || separator <= 0) {
2157
- continue;
2158
- }
2159
- artifacts[value.slice(0, separator)] = value.slice(separator + 1);
2160
- }
2161
- return artifacts;
2162
- }
2163
- function readSddResultStatus(args, name) {
2164
- const value = readOption(args, name);
2165
- return value === 'PASS' || value === 'PASS_WITH_GAPS' || value === 'FAIL' || value === 'BLOCKED' || value === 'TIMED_OUT' || value === 'CANCELLED' ? value : null;
2166
- }
2167
- function renderArtifactValidationReport(artifactPath, report, expectedTask, expectedAgent) {
2168
- if (report.valid) {
2169
- return `Artifact valid: ${artifactPath}`;
2170
- }
2171
- const lines = [`Artifact invalid: ${artifactPath}`];
2172
- for (const issue of report.issues) {
2173
- lines.push(`- ${issue.field}: ${issue.message}`);
2174
- lines.push(` recommendation: ${issue.recommendation}`);
2175
- }
2176
- if (expectedTask && expectedAgent) {
2177
- lines.push(`next sdd artifact template ${artifactPath} --task ${expectedTask} --agent ${expectedAgent}`);
2178
- }
2179
- return lines.join('\n');
2180
- }
2181
- function readAiToolSelection(args, allowNone) {
2182
- const value = readOption(args, '--ai') ?? 'auto';
2183
- if (value === 'auto' || value === 'claude-code' || (allowNone && value === 'none')) {
2184
- return value;
2185
- }
2186
- throw new Error(`Unsupported --ai value: ${value}`);
2187
- }
2188
- async function readLifecycleSignalOptions(args) {
2189
- const directSafe = args.includes('--direct-safe');
2190
- const riskTags = readRepeatedOptions(args, '--risk');
2191
- const contracts = readRepeatedOptions(args, '--contract');
2192
- const permissions = readRepeatedOptions(args, '--permission');
2193
- const fromText = readOption(args, '--from-text');
2194
- const fromFile = readOption(args, '--from-file');
2195
- if (fromText && fromFile) {
2196
- return { signals: {}, riskExtraction: null, error: 'Usage: sdd lifecycle decide accepts only one of --from-text or --from-file' };
2197
- }
2198
- const riskExtraction = fromText
2199
- ? extractLifecycleRiskSignalsFromText(fromText, 'from_text')
2200
- : fromFile
2201
- ? extractLifecycleRiskSignalsFromText(await readFile(fromFile, 'utf8'), 'from_file')
2202
- : null;
2203
- const extracted = riskExtraction?.signals ?? {};
2204
- const signals = {
2205
- intent_clarity: directSafe ? 'high' : readSignalClarity(args, '--intent') ?? 'medium',
2206
- acceptance_clarity: directSafe ? 'high' : readSignalClarity(args, '--acceptance') ?? 'medium',
2207
- estimated_change_size: directSafe ? 'tiny' : readEstimatedChangeSize(args, '--size') ?? 'small',
2208
- task_count_estimate: Number(readOption(args, '--tasks') ?? (directSafe ? '1' : '1')),
2209
- file_count_estimate: Number(readOption(args, '--files') ?? (directSafe ? '1' : '1')),
2210
- affected_layers: readRepeatedOptions(args, '--layer'),
2211
- affected_contracts: uniqueCliStrings([...contracts, ...(extracted.affected_contracts ?? [])]),
2212
- dependency_fanout: readDependencyFanout(args, '--fanout') ?? 'local',
2213
- impact_confidence: directSafe ? 'high' : extracted.impact_confidence ?? readImpactConfidence(args, '--impact-confidence') ?? 'medium',
2214
- risk_tags: uniqueCliStrings([...riskTags, ...(extracted.risk_tags ?? [])]),
2215
- reversibility: directSafe ? 'reversible' : extracted.reversibility ?? readReversibility(args, '--reversibility') ?? 'unknown',
2216
- validation_clarity: directSafe ? 'clear' : extracted.validation_clarity ?? readValidationClarity(args, '--validation') ?? 'partial',
2217
- validation_available: directSafe || args.includes('--validation-available'),
2218
- validation_cost: directSafe ? 'cheap' : readValidationCost(args, '--validation-cost') ?? 'unknown',
2219
- policy_hits: readRepeatedOptions(args, '--policy'),
2220
- permission_required: permissions,
2221
- requires_agents: args.includes('--requires-agents'),
2222
- handoff_count: Number(readOption(args, '--handoffs') ?? '0'),
2223
- artifact_dependency: args.includes('--artifact-dependency'),
2224
- runtime_recovery_need: args.includes('--runtime-recovery'),
2225
- orchestration_uncertainty: directSafe ? 'low' : readOrchestrationUncertainty(args, '--orchestration') ?? 'medium',
2226
- human_checkpoint_required: args.includes('--checkpoint'),
2227
- approval_reason: readRepeatedOptions(args, '--approval-reason'),
2228
- source_artifacts: uniqueCliStrings([...readRepeatedOptions(args, '--source-artifact'), ...(fromFile ? [fromFile] : [])]),
2229
- can_scout_impact: !args.includes('--cannot-scout-impact'),
2230
- architecture_decision_required: args.includes('--architecture') || Boolean(extracted.architecture_decision_required),
2231
- external_unknown: args.includes('--external-unknown') || Boolean(extracted.external_unknown)
2232
- };
2233
- return { signals, riskExtraction };
2234
- }
2235
- function uniqueCliStrings(values) {
2236
- return Array.from(new Set(values.filter((value) => value.length > 0)));
2237
- }
2238
- function renderLifecycleRiskExtraction(extraction) {
2239
- if (!extraction) {
2240
- return '';
2241
- }
2242
- const lines = [
2243
- 'Lifecycle Risk Gate',
2244
- 'changed',
2245
- '- deterministic risk signals extracted',
2246
- 'decision',
2247
- `- source=${extraction.source}`,
2248
- `- risk_tags=${extraction.riskTags.join(',') || 'none'}`,
2249
- `- affected_contracts=${extraction.affectedContracts.join(',') || 'none'}`,
2250
- `- external_unknown=${extraction.externalUnknown}`,
2251
- 'evidence'
2252
- ];
2253
- if (extraction.evidence.length === 0) {
2254
- lines.push('- none');
2255
- }
2256
- else {
2257
- for (const item of extraction.evidence) {
2258
- lines.push(`- ${item.category}: ${item.matched} -> ${item.riskTag}`);
2259
- }
2260
- }
2261
- lines.push('gaps');
2262
- lines.push('- none');
2263
- lines.push('next');
2264
- lines.push('- Evaluate extracted signals with lifecycle decision gate.');
2265
- return `${lines.join('\n')}\n`;
2266
- }
2267
- function readSignalClarity(args, name) {
2268
- const value = readOption(args, name);
2269
- return value === 'high' || value === 'medium' || value === 'low' ? value : null;
2270
- }
2271
- function readEstimatedChangeSize(args, name) {
2272
- const value = readOption(args, name);
2273
- return value === 'tiny' || value === 'small' || value === 'medium' || value === 'large' ? value : null;
2274
- }
2275
- function readImpactConfidence(args, name) {
2276
- return readSignalClarity(args, name);
2277
- }
2278
- function readValidationClarity(args, name) {
2279
- const value = readOption(args, name);
2280
- return value === 'clear' || value === 'partial' || value === 'unclear' ? value : null;
2281
- }
2282
- function readValidationCost(args, name) {
2283
- const value = readOption(args, name);
2284
- return value === 'cheap' || value === 'moderate' || value === 'expensive' || value === 'unknown' ? value : null;
2285
- }
2286
- function readDependencyFanout(args, name) {
2287
- const value = readOption(args, name);
2288
- return value === 'none' || value === 'local' || value === 'multi_component' || value === 'unknown' ? value : null;
2289
- }
2290
- function readReversibility(args, name) {
2291
- const value = readOption(args, name);
2292
- return value === 'reversible' || value === 'irreversible' || value === 'unknown' ? value : null;
2293
- }
2294
- function readOrchestrationUncertainty(args, name) {
2295
- const value = readOption(args, name);
2296
- return value === 'low' || value === 'medium' || value === 'high' ? value : null;
2297
- }
2298
- function taskFormatText() {
2299
- return `# Canonical sdd-task format
2300
-
2301
- \`\`\`sdd-task
2302
- id: T1
2303
- status: pending
2304
- wave: 1
2305
- depends_on: []
2306
- acceptance_refs:
2307
- - AC-1
2308
- plan_refs:
2309
- - "§4 Target Design Overview"
2310
- affected_files:
2311
- - path/to/file
2312
- validation:
2313
- - command string
2314
- risk:
2315
- - state-machine
2316
- agent_fit:
2317
- - scout
2318
- - implementer
2319
- - reviewer
2320
- - validator
2321
- verification_availability:
2322
- - unit:command string
2323
- - build:command string
2324
- autonomy: full_sdd_with_checkpoint
2325
- allowed_agents:
2326
- - scout
2327
- - implementer
2328
- - reviewer
2329
- - validator
2330
- required_artifacts:
2331
- - artifacts/review-T1.md
2332
- - artifacts/validation-T1.md
2333
- \`\`\`
2334
-
2335
- Put contract metadata inside the fenced block: acceptance_refs, plan_refs, agent_fit, verification_availability, autonomy, allowed_agents, and required_artifacts. Companion sections such as #### Boundary, #### Acceptance, and #### Implementation Notes must stay outside the fenced sdd-task metadata block.
2336
-
2337
- #### Boundary
2338
-
2339
- Allowed implementation scope. Explicitly list forbidden scope when relevant.
2340
-
2341
- #### Acceptance
2342
-
2343
- - Verifiable acceptance item.
2344
-
2345
- #### Implementation Notes
2346
-
2347
- Reserved for approved sync-back notes and artifact links.
2348
- `;
2349
- }
2350
- main(process.argv.slice(2))
2351
- .then((result) => {
2352
- if (result.output) {
2353
- console.log(result.output);
2354
- }
2355
- if (result.error) {
2356
- console.error(result.error);
2357
- }
2358
- process.exitCode = result.exitCode;
2359
- })
2360
- .catch((error) => {
2361
- console.error(error instanceof Error ? error.message : String(error));
2362
- process.exitCode = 1;
2363
- });
2364
- //# sourceMappingURL=main.js.map