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