sdd-agent-platform 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (722) hide show
  1. package/README.md +30 -28
  2. package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js +67 -69
  3. package/node_modules/@sdd-agent-platform/core/dist/ai-tools.js.map +1 -1
  4. package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js +64 -9
  5. package/node_modules/@sdd-agent-platform/core/dist/artifacts/ingestion.js.map +1 -1
  6. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js +0 -1
  7. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-evidence.js.map +1 -1
  8. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js +26 -17
  9. package/node_modules/@sdd-agent-platform/core/dist/artifacts/sdd-result.js.map +1 -1
  10. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.d.ts +3 -0
  11. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js +12 -9
  12. package/node_modules/@sdd-agent-platform/core/dist/config/init-project.js.map +1 -1
  13. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.d.ts +3 -1
  14. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js +7 -3
  15. package/node_modules/@sdd-agent-platform/core/dist/config/project-config.js.map +1 -1
  16. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.d.ts +4 -4
  17. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js +12 -25
  18. package/node_modules/@sdd-agent-platform/core/dist/config/starter-documents.js.map +1 -1
  19. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.d.ts +1 -1
  20. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js +1 -7
  21. package/node_modules/@sdd-agent-platform/core/dist/context/build-package.js.map +1 -1
  22. package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js +26 -8
  23. package/node_modules/@sdd-agent-platform/core/dist/context/evidence-summary.js.map +1 -1
  24. package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js +2 -2
  25. package/node_modules/@sdd-agent-platform/core/dist/context/log-worker.js.map +1 -1
  26. package/node_modules/@sdd-agent-platform/core/dist/context-offload/contracts.d.ts +1 -1
  27. package/node_modules/@sdd-agent-platform/core/dist/contracts.d.ts +2 -1
  28. package/node_modules/@sdd-agent-platform/core/dist/contracts.js +1 -0
  29. package/node_modules/@sdd-agent-platform/core/dist/contracts.js.map +1 -1
  30. package/node_modules/@sdd-agent-platform/core/dist/delegation/model.d.ts +3 -0
  31. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.d.ts +3 -0
  32. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js +7 -4
  33. package/node_modules/@sdd-agent-platform/core/dist/delegation/validation.js.map +1 -1
  34. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js +1 -1
  35. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/document-chain.js.map +1 -1
  36. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js +8 -8
  37. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/project.js.map +1 -1
  38. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js +0 -1
  39. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/registries.js.map +1 -1
  40. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js +4 -4
  41. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-evidence.js.map +1 -1
  42. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js +0 -24
  43. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/run-trust.js.map +1 -1
  44. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js +1 -1
  45. package/node_modules/@sdd-agent-platform/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
  46. package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js +178 -58
  47. package/node_modules/@sdd-agent-platform/core/dist/doctor/doctor.js.map +1 -1
  48. package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js +14 -7
  49. package/node_modules/@sdd-agent-platform/core/dist/evidence/lookup.js.map +1 -1
  50. package/node_modules/@sdd-agent-platform/core/dist/evidence-runtime/contracts.d.ts +0 -1
  51. package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js +4 -4
  52. package/node_modules/@sdd-agent-platform/core/dist/execution/background-executor.js.map +1 -1
  53. package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js +3 -3
  54. package/node_modules/@sdd-agent-platform/core/dist/execution/foreground-subagents.js.map +1 -1
  55. package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js +5 -4
  56. package/node_modules/@sdd-agent-platform/core/dist/execution/host-invocation.js.map +1 -1
  57. package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js +3 -2
  58. package/node_modules/@sdd-agent-platform/core/dist/execution/resident-worker.js.map +1 -1
  59. package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js +2 -2
  60. package/node_modules/@sdd-agent-platform/core/dist/execution/stage-team-runtime.js.map +1 -1
  61. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.d.ts +1 -1
  62. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js +1 -1
  63. package/node_modules/@sdd-agent-platform/core/dist/governance/policy.js.map +1 -1
  64. package/node_modules/@sdd-agent-platform/core/dist/instructions.d.ts +1 -1
  65. package/node_modules/@sdd-agent-platform/core/dist/instructions.js +54 -61
  66. package/node_modules/@sdd-agent-platform/core/dist/instructions.js.map +1 -1
  67. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js +1 -1
  68. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/decision-gate.js.map +1 -1
  69. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.d.ts +1 -0
  70. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js +24 -8
  71. package/node_modules/@sdd-agent-platform/core/dist/lifecycle/ship.js.map +1 -1
  72. package/node_modules/@sdd-agent-platform/core/dist/orchestration/contracts.d.ts +1 -1
  73. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.d.ts +12 -2
  74. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js +62 -21
  75. package/node_modules/@sdd-agent-platform/core/dist/orchestration/runtime.js.map +1 -1
  76. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.d.ts +5 -2
  77. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js +69 -27
  78. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-capability-catalog.js.map +1 -1
  79. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js +15 -15
  80. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-registry.js.map +1 -1
  81. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js +1 -1
  82. package/node_modules/@sdd-agent-platform/core/dist/registries/agent-runtime-static.js.map +1 -1
  83. package/node_modules/@sdd-agent-platform/core/dist/registries/capability-sources.js +1 -1
  84. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.d.ts +1 -1
  85. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js +9 -9
  86. package/node_modules/@sdd-agent-platform/core/dist/registries/command-team-runtime.js.map +1 -1
  87. package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js +4 -4
  88. package/node_modules/@sdd-agent-platform/core/dist/registries/eval-learning-context.js.map +1 -1
  89. package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js +2 -2
  90. package/node_modules/@sdd-agent-platform/core/dist/registries/query-status.js.map +1 -1
  91. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js +3 -3
  92. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-capabilities.js.map +1 -1
  93. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js +2 -2
  94. package/node_modules/@sdd-agent-platform/core/dist/registries/tool-plugins.js.map +1 -1
  95. package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js +11 -11
  96. package/node_modules/@sdd-agent-platform/core/dist/registries/worker-adapters.js.map +1 -1
  97. package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js +12 -12
  98. package/node_modules/@sdd-agent-platform/core/dist/registries/workflow-gates.js.map +1 -1
  99. package/node_modules/@sdd-agent-platform/core/dist/risk/contracts.d.ts +2 -2
  100. package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js +4 -4
  101. package/node_modules/@sdd-agent-platform/core/dist/risk/kernel.js.map +1 -1
  102. package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js +4 -7
  103. package/node_modules/@sdd-agent-platform/core/dist/risk/legacy-adapters.js.map +1 -1
  104. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.d.ts +2 -2
  105. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js +19 -17
  106. package/node_modules/@sdd-agent-platform/core/dist/risk/workflow-gates.js.map +1 -1
  107. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js +1 -1
  108. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime-config.js.map +1 -1
  109. package/node_modules/@sdd-agent-platform/core/dist/router/agent-runtime.d.ts +2 -0
  110. package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js +1 -1
  111. package/node_modules/@sdd-agent-platform/core/dist/router/route-projection.js.map +1 -1
  112. package/node_modules/@sdd-agent-platform/core/dist/router/routing.js +45 -15
  113. package/node_modules/@sdd-agent-platform/core/dist/router/routing.js.map +1 -1
  114. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.d.ts +28 -0
  115. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js +373 -0
  116. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-import.js.map +1 -0
  117. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js +2 -2
  118. package/node_modules/@sdd-agent-platform/core/dist/router/runtime-validation.js.map +1 -1
  119. package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.d.ts +37 -0
  120. package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js +235 -0
  121. package/node_modules/@sdd-agent-platform/core/dist/router/stage-route-binding.js.map +1 -0
  122. package/node_modules/@sdd-agent-platform/core/dist/router.d.ts +2 -0
  123. package/node_modules/@sdd-agent-platform/core/dist/router.js +2 -0
  124. package/node_modules/@sdd-agent-platform/core/dist/router.js.map +1 -1
  125. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.d.ts +16 -0
  126. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js +126 -9
  127. package/node_modules/@sdd-agent-platform/core/dist/run-state/artifacts.js.map +1 -1
  128. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.d.ts +0 -2
  129. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js +7 -5
  130. package/node_modules/@sdd-agent-platform/core/dist/run-state/inspect-run.js.map +1 -1
  131. package/node_modules/@sdd-agent-platform/core/dist/run-state/model.d.ts +28 -8
  132. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.d.ts +0 -2
  133. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js +1 -3
  134. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-index.js.map +1 -1
  135. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js +37 -27
  136. package/node_modules/@sdd-agent-platform/core/dist/run-state/run-state.js.map +1 -1
  137. package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.d.ts +5 -2
  138. package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js +53 -14
  139. package/node_modules/@sdd-agent-platform/core/dist/run-state/task-evidence.js.map +1 -1
  140. package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.d.ts +8 -0
  141. package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.js +131 -0
  142. package/node_modules/@sdd-agent-platform/core/dist/run-state/timing.js.map +1 -0
  143. package/node_modules/@sdd-agent-platform/core/dist/run-state.d.ts +1 -0
  144. package/node_modules/@sdd-agent-platform/core/dist/run-state.js +1 -0
  145. package/node_modules/@sdd-agent-platform/core/dist/run-state.js.map +1 -1
  146. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js +0 -3
  147. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/build.js.map +1 -1
  148. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js +5 -44
  149. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/findings.js.map +1 -1
  150. package/node_modules/@sdd-agent-platform/core/dist/runtime-analysis/model.d.ts +1 -17
  151. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.d.ts +10 -0
  152. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js +65 -0
  153. package/node_modules/@sdd-agent-platform/core/dist/runtime-paths.js.map +1 -1
  154. package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.d.ts +64 -0
  155. package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js +200 -0
  156. package/node_modules/@sdd-agent-platform/core/dist/runtime-projection-p0.js.map +1 -0
  157. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.d.ts +2 -0
  158. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js +97 -10
  159. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/document-hashes.js.map +1 -1
  160. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.d.ts +1 -1
  161. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js +8 -6
  162. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/run-binding.js.map +1 -1
  163. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.d.ts +1 -0
  164. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js +55 -34
  165. package/node_modules/@sdd-agent-platform/core/dist/sdd-docs/task-parser.js.map +1 -1
  166. package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.d.ts +55 -0
  167. package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js +322 -0
  168. package/node_modules/@sdd-agent-platform/core/dist/stage-artifacts.js.map +1 -0
  169. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.d.ts +55 -0
  170. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js +241 -0
  171. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration-contracts.js.map +1 -0
  172. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.d.ts +888 -0
  173. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js +3870 -0
  174. package/node_modules/@sdd-agent-platform/core/dist/stage-collaboration.js.map +1 -0
  175. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js +8 -1
  176. package/node_modules/@sdd-agent-platform/core/dist/stage-runtime/runtime.js.map +1 -1
  177. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.d.ts +44 -1
  178. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js +170 -23
  179. package/node_modules/@sdd-agent-platform/core/dist/status/project-status.js.map +1 -1
  180. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.d.ts +170 -18
  181. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js +544 -32
  182. package/node_modules/@sdd-agent-platform/core/dist/storage/runtime-store.js.map +1 -1
  183. package/node_modules/@sdd-agent-platform/core/dist/subagents/contracts.d.ts +1 -1
  184. package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js +7 -7
  185. package/node_modules/@sdd-agent-platform/core/dist/subagents/runtime.js.map +1 -1
  186. package/node_modules/@sdd-agent-platform/core/dist/test-support/fixtures.js +1 -1
  187. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.d.ts +1 -1
  188. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js +8 -23
  189. package/node_modules/@sdd-agent-platform/core/dist/test-support/run-state.js.map +1 -1
  190. package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.d.ts +44 -0
  191. package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js +138 -0
  192. package/node_modules/@sdd-agent-platform/core/dist/truth-reconciliation.js.map +1 -0
  193. package/node_modules/@sdd-agent-platform/core/dist/tsconfig.tsbuildinfo +1 -1
  194. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.d.ts +0 -1
  195. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js +28 -53
  196. package/node_modules/@sdd-agent-platform/core/dist/verification/goal-verify.js.map +1 -1
  197. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.d.ts +0 -2
  198. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js +10 -50
  199. package/node_modules/@sdd-agent-platform/core/dist/verification/rendering.js.map +1 -1
  200. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.d.ts +0 -1
  201. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js +159 -150
  202. package/node_modules/@sdd-agent-platform/core/dist/verification/single-task-loop.js.map +1 -1
  203. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.d.ts +12 -2
  204. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js +238 -103
  205. package/node_modules/@sdd-agent-platform/core/dist/verification/test-runtime.js.map +1 -1
  206. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.d.ts +26 -0
  207. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.js +73 -0
  208. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-cache.js.map +1 -0
  209. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.d.ts +18 -0
  210. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js +27 -5
  211. package/node_modules/@sdd-agent-platform/core/dist/verification/validation-wave.js.map +1 -1
  212. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.d.ts +1 -1
  213. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js +9 -32
  214. package/node_modules/@sdd-agent-platform/core/dist/verification/verify-contract.js.map +1 -1
  215. package/node_modules/@sdd-agent-platform/core/dist/work-units/contracts.d.ts +1 -1
  216. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js +228 -15
  217. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/evidence-packet.js.map +1 -1
  218. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js +49 -15
  219. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/hard-checks.js.map +1 -1
  220. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js +42 -6
  221. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/policy.js.map +1 -1
  222. package/node_modules/@sdd-agent-platform/core/dist/workflow-gate/types.d.ts +4 -5
  223. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.d.ts +0 -1
  224. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js +1 -2
  225. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
  226. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/dependencies.js +1 -1
  227. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.d.ts +0 -1
  228. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js +72 -6
  229. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/latest-eligible-run.js.map +1 -1
  230. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.d.ts +40 -0
  231. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.js +110 -0
  232. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/migration-recovery.js.map +1 -0
  233. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.d.ts +12 -0
  234. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.js +63 -0
  235. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/repair-contract.js.map +1 -0
  236. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.d.ts +21 -0
  237. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.js +95 -0
  238. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve-task-run.js.map +1 -0
  239. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.d.ts +55 -5
  240. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js +538 -34
  241. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/resolve.js.map +1 -1
  242. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.d.ts +228 -0
  243. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.js +452 -0
  244. package/node_modules/@sdd-agent-platform/core/dist/workflow-state/runtime-projections.js.map +1 -0
  245. package/node_modules/@sdd-agent-platform/core/package.json +3 -3
  246. package/node_modules/@sdd-agent-platform/core/src/ai-tools.test.ts +49 -1
  247. package/node_modules/@sdd-agent-platform/core/src/ai-tools.ts +67 -69
  248. package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.test.ts +38 -0
  249. package/node_modules/@sdd-agent-platform/core/src/artifacts/ingestion.ts +65 -9
  250. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-evidence.ts +0 -1
  251. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.test.ts +2 -2
  252. package/node_modules/@sdd-agent-platform/core/src/artifacts/sdd-result.ts +26 -17
  253. package/node_modules/@sdd-agent-platform/core/src/config/init-project.test.ts +43 -31
  254. package/node_modules/@sdd-agent-platform/core/src/config/init-project.ts +14 -11
  255. package/node_modules/@sdd-agent-platform/core/src/config/project-config.ts +10 -4
  256. package/node_modules/@sdd-agent-platform/core/src/config/starter-documents.ts +12 -25
  257. package/node_modules/@sdd-agent-platform/core/src/context/build-package.ts +2 -8
  258. package/node_modules/@sdd-agent-platform/core/src/context/context-build.test.ts +3 -2
  259. package/node_modules/@sdd-agent-platform/core/src/context/evidence-summary.ts +27 -8
  260. package/node_modules/@sdd-agent-platform/core/src/context/log-worker.ts +2 -2
  261. package/node_modules/@sdd-agent-platform/core/src/context-offload/contracts.ts +1 -1
  262. package/node_modules/@sdd-agent-platform/core/src/contracts.ts +2 -1
  263. package/node_modules/@sdd-agent-platform/core/src/delegation/model.ts +3 -0
  264. package/node_modules/@sdd-agent-platform/core/src/delegation/validation.ts +8 -5
  265. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/document-chain.ts +1 -1
  266. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/project.ts +8 -8
  267. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/registries.ts +0 -1
  268. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-evidence.ts +4 -4
  269. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/run-trust.ts +0 -21
  270. package/node_modules/@sdd-agent-platform/core/src/doctor/checks/runtime-contracts.ts +1 -1
  271. package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.test.ts +143 -45
  272. package/node_modules/@sdd-agent-platform/core/src/doctor/doctor.ts +193 -58
  273. package/node_modules/@sdd-agent-platform/core/src/evidence/lookup.ts +15 -7
  274. package/node_modules/@sdd-agent-platform/core/src/evidence-runtime/contracts.ts +0 -1
  275. package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.test.ts +50 -2
  276. package/node_modules/@sdd-agent-platform/core/src/execution/background-executor.ts +4 -4
  277. package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.test.ts +11 -2
  278. package/node_modules/@sdd-agent-platform/core/src/execution/foreground-subagents.ts +3 -3
  279. package/node_modules/@sdd-agent-platform/core/src/execution/host-invocation.ts +5 -4
  280. package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.test.ts +12 -1
  281. package/node_modules/@sdd-agent-platform/core/src/execution/resident-worker.ts +3 -2
  282. package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.test.ts +1 -1
  283. package/node_modules/@sdd-agent-platform/core/src/execution/stage-team-runtime.ts +2 -2
  284. package/node_modules/@sdd-agent-platform/core/src/execution/wave-executor.test.ts +10 -0
  285. package/node_modules/@sdd-agent-platform/core/src/governance/policy.test.ts +8 -0
  286. package/node_modules/@sdd-agent-platform/core/src/governance/policy.ts +2 -2
  287. package/node_modules/@sdd-agent-platform/core/src/instructions.test.ts +33 -18
  288. package/node_modules/@sdd-agent-platform/core/src/instructions.ts +55 -62
  289. package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.test.ts +1 -1
  290. package/node_modules/@sdd-agent-platform/core/src/lifecycle/decision-gate.ts +1 -1
  291. package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.test.ts +47 -0
  292. package/node_modules/@sdd-agent-platform/core/src/lifecycle/ship.ts +25 -8
  293. package/node_modules/@sdd-agent-platform/core/src/orchestration/contracts.ts +1 -1
  294. package/node_modules/@sdd-agent-platform/core/src/orchestration/runtime.ts +74 -22
  295. package/node_modules/@sdd-agent-platform/core/src/phase8-contracts.test.ts +2 -3
  296. package/node_modules/@sdd-agent-platform/core/src/phase8-risk-kernel.test.ts +3 -3
  297. package/node_modules/@sdd-agent-platform/core/src/registries/agent-capability-catalog.ts +82 -35
  298. package/node_modules/@sdd-agent-platform/core/src/registries/agent-registry.ts +15 -15
  299. package/node_modules/@sdd-agent-platform/core/src/registries/agent-runtime-static.ts +1 -1
  300. package/node_modules/@sdd-agent-platform/core/src/registries/capability-sources.ts +1 -1
  301. package/node_modules/@sdd-agent-platform/core/src/registries/command-team-runtime.ts +10 -10
  302. package/node_modules/@sdd-agent-platform/core/src/registries/eval-learning-context.ts +4 -4
  303. package/node_modules/@sdd-agent-platform/core/src/registries/query-status.ts +2 -2
  304. package/node_modules/@sdd-agent-platform/core/src/registries/registries.test.ts +18 -2
  305. package/node_modules/@sdd-agent-platform/core/src/registries/tool-capabilities.ts +3 -3
  306. package/node_modules/@sdd-agent-platform/core/src/registries/tool-plugins.ts +2 -2
  307. package/node_modules/@sdd-agent-platform/core/src/registries/worker-adapters.ts +11 -11
  308. package/node_modules/@sdd-agent-platform/core/src/registries/workflow-gates.ts +12 -12
  309. package/node_modules/@sdd-agent-platform/core/src/risk/contracts.ts +2 -2
  310. package/node_modules/@sdd-agent-platform/core/src/risk/kernel.ts +4 -4
  311. package/node_modules/@sdd-agent-platform/core/src/risk/legacy-adapters.ts +4 -7
  312. package/node_modules/@sdd-agent-platform/core/src/risk/workflow-gates.ts +20 -18
  313. package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime-config.ts +1 -1
  314. package/node_modules/@sdd-agent-platform/core/src/router/agent-runtime.ts +2 -0
  315. package/node_modules/@sdd-agent-platform/core/src/router/route-projection.ts +1 -1
  316. package/node_modules/@sdd-agent-platform/core/src/router/route-sdd-task.test.ts +241 -4
  317. package/node_modules/@sdd-agent-platform/core/src/router/routing.ts +47 -15
  318. package/node_modules/@sdd-agent-platform/core/src/router/runtime-import.ts +453 -0
  319. package/node_modules/@sdd-agent-platform/core/src/router/runtime-validation.ts +2 -2
  320. package/node_modules/@sdd-agent-platform/core/src/router/stage-route-binding.ts +279 -0
  321. package/node_modules/@sdd-agent-platform/core/src/router.ts +2 -0
  322. package/node_modules/@sdd-agent-platform/core/src/run-state/artifacts.ts +132 -10
  323. package/node_modules/@sdd-agent-platform/core/src/run-state/inspect-run.ts +7 -7
  324. package/node_modules/@sdd-agent-platform/core/src/run-state/model.ts +31 -8
  325. package/node_modules/@sdd-agent-platform/core/src/run-state/run-index.ts +1 -5
  326. package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.test.ts +50 -2
  327. package/node_modules/@sdd-agent-platform/core/src/run-state/run-state.ts +39 -29
  328. package/node_modules/@sdd-agent-platform/core/src/run-state/task-evidence.ts +62 -16
  329. package/node_modules/@sdd-agent-platform/core/src/run-state/timing.ts +146 -0
  330. package/node_modules/@sdd-agent-platform/core/src/run-state.ts +1 -0
  331. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/build.ts +0 -3
  332. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/findings.ts +6 -46
  333. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis/model.ts +1 -13
  334. package/node_modules/@sdd-agent-platform/core/src/runtime-analysis.test.ts +0 -2
  335. package/node_modules/@sdd-agent-platform/core/src/runtime-paths.ts +77 -0
  336. package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.test.ts +96 -0
  337. package/node_modules/@sdd-agent-platform/core/src/runtime-projection-p0.ts +292 -0
  338. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/document-hashes.ts +109 -10
  339. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/run-binding.ts +8 -6
  340. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.test.ts +123 -1
  341. package/node_modules/@sdd-agent-platform/core/src/sdd-docs/task-parser.ts +58 -43
  342. package/node_modules/@sdd-agent-platform/core/src/stage-artifacts.ts +450 -0
  343. package/node_modules/@sdd-agent-platform/core/src/stage-collaboration-contracts.ts +322 -0
  344. package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.test.ts +2903 -0
  345. package/node_modules/@sdd-agent-platform/core/src/stage-collaboration.ts +5831 -0
  346. package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.test.ts +1 -1
  347. package/node_modules/@sdd-agent-platform/core/src/stage-runtime/runtime.ts +9 -1
  348. package/node_modules/@sdd-agent-platform/core/src/status/project-status.test.ts +239 -16
  349. package/node_modules/@sdd-agent-platform/core/src/status/project-status.ts +249 -23
  350. package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.test.ts +196 -4
  351. package/node_modules/@sdd-agent-platform/core/src/storage/runtime-store.ts +860 -54
  352. package/node_modules/@sdd-agent-platform/core/src/subagents/contracts.ts +1 -1
  353. package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.test.ts +3 -3
  354. package/node_modules/@sdd-agent-platform/core/src/subagents/runtime.ts +7 -7
  355. package/node_modules/@sdd-agent-platform/core/src/test-support/fixtures.ts +1 -1
  356. package/node_modules/@sdd-agent-platform/core/src/test-support/run-state.ts +9 -23
  357. package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.test.ts +72 -0
  358. package/node_modules/@sdd-agent-platform/core/src/truth-reconciliation.ts +177 -0
  359. package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.test.ts +13 -87
  360. package/node_modules/@sdd-agent-platform/core/src/verification/goal-verify.ts +27 -56
  361. package/node_modules/@sdd-agent-platform/core/src/verification/rendering.ts +10 -54
  362. package/node_modules/@sdd-agent-platform/core/src/verification/review-gate.test.ts +8 -1
  363. package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.test.ts +93 -79
  364. package/node_modules/@sdd-agent-platform/core/src/verification/single-task-loop.ts +166 -154
  365. package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.test.ts +100 -47
  366. package/node_modules/@sdd-agent-platform/core/src/verification/test-runtime.ts +265 -107
  367. package/node_modules/@sdd-agent-platform/core/src/verification/validation-cache.ts +106 -0
  368. package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.test.ts +47 -5
  369. package/node_modules/@sdd-agent-platform/core/src/verification/validation-wave.ts +48 -5
  370. package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.test.ts +15 -31
  371. package/node_modules/@sdd-agent-platform/core/src/verification/verify-contract.ts +9 -33
  372. package/node_modules/@sdd-agent-platform/core/src/work-units/contracts.ts +1 -1
  373. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/evidence-packet.ts +246 -17
  374. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.test.ts +339 -3
  375. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/hard-checks.ts +53 -14
  376. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.test.ts +45 -8
  377. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/policy.ts +45 -6
  378. package/node_modules/@sdd-agent-platform/core/src/workflow-gate/types.ts +6 -5
  379. package/node_modules/@sdd-agent-platform/core/src/workflow-state/affected-file-conflicts.ts +1 -3
  380. package/node_modules/@sdd-agent-platform/core/src/workflow-state/dependencies.ts +1 -1
  381. package/node_modules/@sdd-agent-platform/core/src/workflow-state/latest-eligible-run.ts +75 -7
  382. package/node_modules/@sdd-agent-platform/core/src/workflow-state/migration-recovery.ts +158 -0
  383. package/node_modules/@sdd-agent-platform/core/src/workflow-state/repair-contract.ts +77 -0
  384. package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve-task-run.ts +114 -0
  385. package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.test.ts +518 -25
  386. package/node_modules/@sdd-agent-platform/core/src/workflow-state/resolve.ts +670 -41
  387. package/node_modules/@sdd-agent-platform/core/src/workflow-state/runtime-projections.ts +712 -0
  388. package/package.json +1 -1
  389. package/packages/cli/dist/args.js +2 -2
  390. package/packages/cli/dist/args.js.map +1 -1
  391. package/packages/cli/dist/commands/ai-tools.js +13 -2
  392. package/packages/cli/dist/commands/ai-tools.js.map +1 -1
  393. package/packages/cli/dist/commands/context.js +1 -1
  394. package/packages/cli/dist/commands/context.js.map +1 -1
  395. package/packages/cli/dist/commands/execution.js +49 -1
  396. package/packages/cli/dist/commands/execution.js.map +1 -1
  397. package/packages/cli/dist/commands/governance.js +1 -1
  398. package/packages/cli/dist/commands/governance.js.map +1 -1
  399. package/packages/cli/dist/commands/init.js +6 -1
  400. package/packages/cli/dist/commands/init.js.map +1 -1
  401. package/packages/cli/dist/commands/lifecycle.js +15 -2
  402. package/packages/cli/dist/commands/lifecycle.js.map +1 -1
  403. package/packages/cli/dist/commands/registry/runtime.js +48 -2
  404. package/packages/cli/dist/commands/registry/runtime.js.map +1 -1
  405. package/packages/cli/dist/commands/run.js +52 -2
  406. package/packages/cli/dist/commands/run.js.map +1 -1
  407. package/packages/cli/dist/commands/stage-close.d.ts +6 -0
  408. package/packages/cli/dist/commands/stage-close.js +295 -0
  409. package/packages/cli/dist/commands/stage-close.js.map +1 -0
  410. package/packages/cli/dist/commands/status.js +68 -2
  411. package/packages/cli/dist/commands/status.js.map +1 -1
  412. package/packages/cli/dist/commands/test.js +180 -2
  413. package/packages/cli/dist/commands/test.js.map +1 -1
  414. package/packages/cli/dist/commands/verifies.js +7 -5
  415. package/packages/cli/dist/commands/verifies.js.map +1 -1
  416. package/packages/cli/dist/commands/verify.js +222 -26
  417. package/packages/cli/dist/commands/verify.js.map +1 -1
  418. package/packages/cli/dist/dispatch.js +4 -9
  419. package/packages/cli/dist/dispatch.js.map +1 -1
  420. package/packages/cli/dist/help.js +27 -26
  421. package/packages/cli/dist/help.js.map +1 -1
  422. package/packages/cli/dist/renderers/doctor.js +1 -1
  423. package/packages/cli/dist/renderers/doctor.js.map +1 -1
  424. package/packages/cli/dist/renderers/execution.js +1 -1
  425. package/packages/cli/dist/renderers/execution.js.map +1 -1
  426. package/packages/cli/dist/renderers/json.d.ts +1 -0
  427. package/packages/cli/dist/renderers/json.js +3 -0
  428. package/packages/cli/dist/renderers/json.js.map +1 -1
  429. package/packages/cli/dist/renderers/registry-runtime.d.ts +2 -1
  430. package/packages/cli/dist/renderers/registry-runtime.js +20 -0
  431. package/packages/cli/dist/renderers/registry-runtime.js.map +1 -1
  432. package/packages/cli/dist/renderers/router.js +1 -1
  433. package/packages/cli/dist/renderers/router.js.map +1 -1
  434. package/packages/cli/dist/renderers/workflow.d.ts +0 -4
  435. package/packages/cli/dist/renderers/workflow.js +30 -89
  436. package/packages/cli/dist/renderers/workflow.js.map +1 -1
  437. package/packages/cli/dist/skill-import-args.d.ts +10 -0
  438. package/packages/cli/dist/skill-import-args.js +47 -0
  439. package/packages/cli/dist/skill-import-args.js.map +1 -0
  440. package/packages/cli/dist/tsconfig.tsbuildinfo +1 -1
  441. package/packages/cli/package.json +2 -2
  442. package/packages/core/dist/ai-tools.js +67 -69
  443. package/packages/core/dist/ai-tools.js.map +1 -1
  444. package/packages/core/dist/artifacts/ingestion.js +64 -9
  445. package/packages/core/dist/artifacts/ingestion.js.map +1 -1
  446. package/packages/core/dist/artifacts/sdd-evidence.js +0 -1
  447. package/packages/core/dist/artifacts/sdd-evidence.js.map +1 -1
  448. package/packages/core/dist/artifacts/sdd-result.js +26 -17
  449. package/packages/core/dist/artifacts/sdd-result.js.map +1 -1
  450. package/packages/core/dist/config/init-project.d.ts +3 -0
  451. package/packages/core/dist/config/init-project.js +12 -9
  452. package/packages/core/dist/config/init-project.js.map +1 -1
  453. package/packages/core/dist/config/project-config.d.ts +3 -1
  454. package/packages/core/dist/config/project-config.js +7 -3
  455. package/packages/core/dist/config/project-config.js.map +1 -1
  456. package/packages/core/dist/config/starter-documents.d.ts +4 -4
  457. package/packages/core/dist/config/starter-documents.js +12 -25
  458. package/packages/core/dist/config/starter-documents.js.map +1 -1
  459. package/packages/core/dist/context/build-package.d.ts +1 -1
  460. package/packages/core/dist/context/build-package.js +1 -7
  461. package/packages/core/dist/context/build-package.js.map +1 -1
  462. package/packages/core/dist/context/evidence-summary.js +26 -8
  463. package/packages/core/dist/context/evidence-summary.js.map +1 -1
  464. package/packages/core/dist/context/log-worker.js +2 -2
  465. package/packages/core/dist/context/log-worker.js.map +1 -1
  466. package/packages/core/dist/context-offload/contracts.d.ts +1 -1
  467. package/packages/core/dist/contracts.d.ts +2 -1
  468. package/packages/core/dist/contracts.js +1 -0
  469. package/packages/core/dist/contracts.js.map +1 -1
  470. package/packages/core/dist/delegation/model.d.ts +3 -0
  471. package/packages/core/dist/delegation/validation.d.ts +3 -0
  472. package/packages/core/dist/delegation/validation.js +7 -4
  473. package/packages/core/dist/delegation/validation.js.map +1 -1
  474. package/packages/core/dist/doctor/checks/document-chain.js +1 -1
  475. package/packages/core/dist/doctor/checks/document-chain.js.map +1 -1
  476. package/packages/core/dist/doctor/checks/project.js +8 -8
  477. package/packages/core/dist/doctor/checks/project.js.map +1 -1
  478. package/packages/core/dist/doctor/checks/registries.js +0 -1
  479. package/packages/core/dist/doctor/checks/registries.js.map +1 -1
  480. package/packages/core/dist/doctor/checks/run-evidence.js +4 -4
  481. package/packages/core/dist/doctor/checks/run-evidence.js.map +1 -1
  482. package/packages/core/dist/doctor/checks/run-trust.js +0 -24
  483. package/packages/core/dist/doctor/checks/run-trust.js.map +1 -1
  484. package/packages/core/dist/doctor/checks/runtime-contracts.js +1 -1
  485. package/packages/core/dist/doctor/checks/runtime-contracts.js.map +1 -1
  486. package/packages/core/dist/doctor/doctor.js +178 -58
  487. package/packages/core/dist/doctor/doctor.js.map +1 -1
  488. package/packages/core/dist/evidence/lookup.js +14 -7
  489. package/packages/core/dist/evidence/lookup.js.map +1 -1
  490. package/packages/core/dist/evidence-runtime/contracts.d.ts +0 -1
  491. package/packages/core/dist/execution/background-executor.js +4 -4
  492. package/packages/core/dist/execution/background-executor.js.map +1 -1
  493. package/packages/core/dist/execution/foreground-subagents.js +3 -3
  494. package/packages/core/dist/execution/foreground-subagents.js.map +1 -1
  495. package/packages/core/dist/execution/host-invocation.js +5 -4
  496. package/packages/core/dist/execution/host-invocation.js.map +1 -1
  497. package/packages/core/dist/execution/resident-worker.js +3 -2
  498. package/packages/core/dist/execution/resident-worker.js.map +1 -1
  499. package/packages/core/dist/execution/stage-team-runtime.js +2 -2
  500. package/packages/core/dist/execution/stage-team-runtime.js.map +1 -1
  501. package/packages/core/dist/governance/policy.d.ts +1 -1
  502. package/packages/core/dist/governance/policy.js +1 -1
  503. package/packages/core/dist/governance/policy.js.map +1 -1
  504. package/packages/core/dist/instructions.d.ts +1 -1
  505. package/packages/core/dist/instructions.js +54 -61
  506. package/packages/core/dist/instructions.js.map +1 -1
  507. package/packages/core/dist/lifecycle/decision-gate.js +1 -1
  508. package/packages/core/dist/lifecycle/decision-gate.js.map +1 -1
  509. package/packages/core/dist/lifecycle/ship.d.ts +1 -0
  510. package/packages/core/dist/lifecycle/ship.js +24 -8
  511. package/packages/core/dist/lifecycle/ship.js.map +1 -1
  512. package/packages/core/dist/orchestration/contracts.d.ts +1 -1
  513. package/packages/core/dist/orchestration/runtime.d.ts +12 -2
  514. package/packages/core/dist/orchestration/runtime.js +62 -21
  515. package/packages/core/dist/orchestration/runtime.js.map +1 -1
  516. package/packages/core/dist/registries/agent-capability-catalog.d.ts +5 -2
  517. package/packages/core/dist/registries/agent-capability-catalog.js +69 -27
  518. package/packages/core/dist/registries/agent-capability-catalog.js.map +1 -1
  519. package/packages/core/dist/registries/agent-registry.js +15 -15
  520. package/packages/core/dist/registries/agent-registry.js.map +1 -1
  521. package/packages/core/dist/registries/agent-runtime-static.js +1 -1
  522. package/packages/core/dist/registries/agent-runtime-static.js.map +1 -1
  523. package/packages/core/dist/registries/capability-sources.js +1 -1
  524. package/packages/core/dist/registries/command-team-runtime.d.ts +1 -1
  525. package/packages/core/dist/registries/command-team-runtime.js +9 -9
  526. package/packages/core/dist/registries/command-team-runtime.js.map +1 -1
  527. package/packages/core/dist/registries/eval-learning-context.js +4 -4
  528. package/packages/core/dist/registries/eval-learning-context.js.map +1 -1
  529. package/packages/core/dist/registries/query-status.js +2 -2
  530. package/packages/core/dist/registries/query-status.js.map +1 -1
  531. package/packages/core/dist/registries/tool-capabilities.js +3 -3
  532. package/packages/core/dist/registries/tool-capabilities.js.map +1 -1
  533. package/packages/core/dist/registries/tool-plugins.js +2 -2
  534. package/packages/core/dist/registries/tool-plugins.js.map +1 -1
  535. package/packages/core/dist/registries/worker-adapters.js +11 -11
  536. package/packages/core/dist/registries/worker-adapters.js.map +1 -1
  537. package/packages/core/dist/registries/workflow-gates.js +12 -12
  538. package/packages/core/dist/registries/workflow-gates.js.map +1 -1
  539. package/packages/core/dist/risk/contracts.d.ts +2 -2
  540. package/packages/core/dist/risk/kernel.js +4 -4
  541. package/packages/core/dist/risk/kernel.js.map +1 -1
  542. package/packages/core/dist/risk/legacy-adapters.js +4 -7
  543. package/packages/core/dist/risk/legacy-adapters.js.map +1 -1
  544. package/packages/core/dist/risk/workflow-gates.d.ts +2 -2
  545. package/packages/core/dist/risk/workflow-gates.js +19 -17
  546. package/packages/core/dist/risk/workflow-gates.js.map +1 -1
  547. package/packages/core/dist/router/agent-runtime-config.js +1 -1
  548. package/packages/core/dist/router/agent-runtime-config.js.map +1 -1
  549. package/packages/core/dist/router/agent-runtime.d.ts +2 -0
  550. package/packages/core/dist/router/route-projection.js +1 -1
  551. package/packages/core/dist/router/route-projection.js.map +1 -1
  552. package/packages/core/dist/router/routing.js +45 -15
  553. package/packages/core/dist/router/routing.js.map +1 -1
  554. package/packages/core/dist/router/runtime-import.d.ts +28 -0
  555. package/packages/core/dist/router/runtime-import.js +373 -0
  556. package/packages/core/dist/router/runtime-import.js.map +1 -0
  557. package/packages/core/dist/router/runtime-validation.js +2 -2
  558. package/packages/core/dist/router/runtime-validation.js.map +1 -1
  559. package/packages/core/dist/router/stage-route-binding.d.ts +37 -0
  560. package/packages/core/dist/router/stage-route-binding.js +235 -0
  561. package/packages/core/dist/router/stage-route-binding.js.map +1 -0
  562. package/packages/core/dist/router.d.ts +2 -0
  563. package/packages/core/dist/router.js +2 -0
  564. package/packages/core/dist/router.js.map +1 -1
  565. package/packages/core/dist/run-state/artifacts.d.ts +16 -0
  566. package/packages/core/dist/run-state/artifacts.js +126 -9
  567. package/packages/core/dist/run-state/artifacts.js.map +1 -1
  568. package/packages/core/dist/run-state/inspect-run.d.ts +0 -2
  569. package/packages/core/dist/run-state/inspect-run.js +7 -5
  570. package/packages/core/dist/run-state/inspect-run.js.map +1 -1
  571. package/packages/core/dist/run-state/model.d.ts +28 -8
  572. package/packages/core/dist/run-state/run-index.d.ts +0 -2
  573. package/packages/core/dist/run-state/run-index.js +1 -3
  574. package/packages/core/dist/run-state/run-index.js.map +1 -1
  575. package/packages/core/dist/run-state/run-state.js +37 -27
  576. package/packages/core/dist/run-state/run-state.js.map +1 -1
  577. package/packages/core/dist/run-state/task-evidence.d.ts +5 -2
  578. package/packages/core/dist/run-state/task-evidence.js +53 -14
  579. package/packages/core/dist/run-state/task-evidence.js.map +1 -1
  580. package/packages/core/dist/run-state/timing.d.ts +8 -0
  581. package/packages/core/dist/run-state/timing.js +131 -0
  582. package/packages/core/dist/run-state/timing.js.map +1 -0
  583. package/packages/core/dist/run-state.d.ts +1 -0
  584. package/packages/core/dist/run-state.js +1 -0
  585. package/packages/core/dist/run-state.js.map +1 -1
  586. package/packages/core/dist/runtime-analysis/build.js +0 -3
  587. package/packages/core/dist/runtime-analysis/build.js.map +1 -1
  588. package/packages/core/dist/runtime-analysis/findings.js +5 -44
  589. package/packages/core/dist/runtime-analysis/findings.js.map +1 -1
  590. package/packages/core/dist/runtime-analysis/model.d.ts +1 -17
  591. package/packages/core/dist/runtime-paths.d.ts +10 -0
  592. package/packages/core/dist/runtime-paths.js +65 -0
  593. package/packages/core/dist/runtime-paths.js.map +1 -1
  594. package/packages/core/dist/runtime-projection-p0.d.ts +64 -0
  595. package/packages/core/dist/runtime-projection-p0.js +200 -0
  596. package/packages/core/dist/runtime-projection-p0.js.map +1 -0
  597. package/packages/core/dist/sdd-docs/document-hashes.d.ts +2 -0
  598. package/packages/core/dist/sdd-docs/document-hashes.js +97 -10
  599. package/packages/core/dist/sdd-docs/document-hashes.js.map +1 -1
  600. package/packages/core/dist/sdd-docs/run-binding.d.ts +1 -1
  601. package/packages/core/dist/sdd-docs/run-binding.js +8 -6
  602. package/packages/core/dist/sdd-docs/run-binding.js.map +1 -1
  603. package/packages/core/dist/sdd-docs/task-parser.d.ts +1 -0
  604. package/packages/core/dist/sdd-docs/task-parser.js +55 -34
  605. package/packages/core/dist/sdd-docs/task-parser.js.map +1 -1
  606. package/packages/core/dist/stage-artifacts.d.ts +55 -0
  607. package/packages/core/dist/stage-artifacts.js +322 -0
  608. package/packages/core/dist/stage-artifacts.js.map +1 -0
  609. package/packages/core/dist/stage-collaboration-contracts.d.ts +55 -0
  610. package/packages/core/dist/stage-collaboration-contracts.js +241 -0
  611. package/packages/core/dist/stage-collaboration-contracts.js.map +1 -0
  612. package/packages/core/dist/stage-collaboration.d.ts +888 -0
  613. package/packages/core/dist/stage-collaboration.js +3870 -0
  614. package/packages/core/dist/stage-collaboration.js.map +1 -0
  615. package/packages/core/dist/stage-runtime/runtime.js +8 -1
  616. package/packages/core/dist/stage-runtime/runtime.js.map +1 -1
  617. package/packages/core/dist/status/project-status.d.ts +44 -1
  618. package/packages/core/dist/status/project-status.js +170 -23
  619. package/packages/core/dist/status/project-status.js.map +1 -1
  620. package/packages/core/dist/storage/runtime-store.d.ts +170 -18
  621. package/packages/core/dist/storage/runtime-store.js +544 -32
  622. package/packages/core/dist/storage/runtime-store.js.map +1 -1
  623. package/packages/core/dist/subagents/contracts.d.ts +1 -1
  624. package/packages/core/dist/subagents/runtime.js +7 -7
  625. package/packages/core/dist/subagents/runtime.js.map +1 -1
  626. package/packages/core/dist/test-support/fixtures.js +1 -1
  627. package/packages/core/dist/test-support/run-state.d.ts +1 -1
  628. package/packages/core/dist/test-support/run-state.js +8 -23
  629. package/packages/core/dist/test-support/run-state.js.map +1 -1
  630. package/packages/core/dist/truth-reconciliation.d.ts +44 -0
  631. package/packages/core/dist/truth-reconciliation.js +138 -0
  632. package/packages/core/dist/truth-reconciliation.js.map +1 -0
  633. package/packages/core/dist/tsconfig.tsbuildinfo +1 -1
  634. package/packages/core/dist/verification/goal-verify.d.ts +0 -1
  635. package/packages/core/dist/verification/goal-verify.js +28 -53
  636. package/packages/core/dist/verification/goal-verify.js.map +1 -1
  637. package/packages/core/dist/verification/rendering.d.ts +0 -2
  638. package/packages/core/dist/verification/rendering.js +10 -50
  639. package/packages/core/dist/verification/rendering.js.map +1 -1
  640. package/packages/core/dist/verification/single-task-loop.d.ts +0 -1
  641. package/packages/core/dist/verification/single-task-loop.js +159 -150
  642. package/packages/core/dist/verification/single-task-loop.js.map +1 -1
  643. package/packages/core/dist/verification/test-runtime.d.ts +12 -2
  644. package/packages/core/dist/verification/test-runtime.js +238 -103
  645. package/packages/core/dist/verification/test-runtime.js.map +1 -1
  646. package/packages/core/dist/verification/validation-cache.d.ts +26 -0
  647. package/packages/core/dist/verification/validation-cache.js +73 -0
  648. package/packages/core/dist/verification/validation-cache.js.map +1 -0
  649. package/packages/core/dist/verification/validation-wave.d.ts +18 -0
  650. package/packages/core/dist/verification/validation-wave.js +27 -5
  651. package/packages/core/dist/verification/validation-wave.js.map +1 -1
  652. package/packages/core/dist/verification/verify-contract.d.ts +1 -1
  653. package/packages/core/dist/verification/verify-contract.js +9 -32
  654. package/packages/core/dist/verification/verify-contract.js.map +1 -1
  655. package/packages/core/dist/work-units/contracts.d.ts +1 -1
  656. package/packages/core/dist/workflow-gate/evidence-packet.js +228 -15
  657. package/packages/core/dist/workflow-gate/evidence-packet.js.map +1 -1
  658. package/packages/core/dist/workflow-gate/hard-checks.js +49 -15
  659. package/packages/core/dist/workflow-gate/hard-checks.js.map +1 -1
  660. package/packages/core/dist/workflow-gate/policy.js +42 -6
  661. package/packages/core/dist/workflow-gate/policy.js.map +1 -1
  662. package/packages/core/dist/workflow-gate/types.d.ts +4 -5
  663. package/packages/core/dist/workflow-state/affected-file-conflicts.d.ts +0 -1
  664. package/packages/core/dist/workflow-state/affected-file-conflicts.js +1 -2
  665. package/packages/core/dist/workflow-state/affected-file-conflicts.js.map +1 -1
  666. package/packages/core/dist/workflow-state/dependencies.js +1 -1
  667. package/packages/core/dist/workflow-state/latest-eligible-run.d.ts +0 -1
  668. package/packages/core/dist/workflow-state/latest-eligible-run.js +72 -6
  669. package/packages/core/dist/workflow-state/latest-eligible-run.js.map +1 -1
  670. package/packages/core/dist/workflow-state/migration-recovery.d.ts +40 -0
  671. package/packages/core/dist/workflow-state/migration-recovery.js +110 -0
  672. package/packages/core/dist/workflow-state/migration-recovery.js.map +1 -0
  673. package/packages/core/dist/workflow-state/repair-contract.d.ts +12 -0
  674. package/packages/core/dist/workflow-state/repair-contract.js +63 -0
  675. package/packages/core/dist/workflow-state/repair-contract.js.map +1 -0
  676. package/packages/core/dist/workflow-state/resolve-task-run.d.ts +21 -0
  677. package/packages/core/dist/workflow-state/resolve-task-run.js +95 -0
  678. package/packages/core/dist/workflow-state/resolve-task-run.js.map +1 -0
  679. package/packages/core/dist/workflow-state/resolve.d.ts +55 -5
  680. package/packages/core/dist/workflow-state/resolve.js +538 -34
  681. package/packages/core/dist/workflow-state/resolve.js.map +1 -1
  682. package/packages/core/dist/workflow-state/runtime-projections.d.ts +228 -0
  683. package/packages/core/dist/workflow-state/runtime-projections.js +452 -0
  684. package/packages/core/dist/workflow-state/runtime-projections.js.map +1 -0
  685. package/packages/core/package.json +3 -3
  686. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.d.ts +0 -2
  687. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js +0 -44
  688. package/node_modules/@sdd-agent-platform/core/dist/doctor/render.js.map +0 -1
  689. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.d.ts +0 -17
  690. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js +0 -243
  691. package/node_modules/@sdd-agent-platform/core/dist/sync-back/apply.js.map +0 -1
  692. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.d.ts +0 -110
  693. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js +0 -497
  694. package/node_modules/@sdd-agent-platform/core/dist/sync-back/inspect.js.map +0 -1
  695. package/node_modules/@sdd-agent-platform/core/dist/sync-back.d.ts +0 -2
  696. package/node_modules/@sdd-agent-platform/core/dist/sync-back.js +0 -3
  697. package/node_modules/@sdd-agent-platform/core/dist/sync-back.js.map +0 -1
  698. package/node_modules/@sdd-agent-platform/core/src/sync-back/apply.ts +0 -270
  699. package/node_modules/@sdd-agent-platform/core/src/sync-back/inspect.ts +0 -655
  700. package/node_modules/@sdd-agent-platform/core/src/sync-back/sync-back.test.ts +0 -569
  701. package/node_modules/@sdd-agent-platform/core/src/sync-back.ts +0 -2
  702. package/packages/cli/dist/commands/artifact.d.ts +0 -6
  703. package/packages/cli/dist/commands/artifact.js +0 -168
  704. package/packages/cli/dist/commands/artifact.js.map +0 -1
  705. package/packages/cli/dist/commands/sync-back.d.ts +0 -6
  706. package/packages/cli/dist/commands/sync-back.js +0 -82
  707. package/packages/cli/dist/commands/sync-back.js.map +0 -1
  708. package/packages/cli/dist/renderers/artifacts.d.ts +0 -5
  709. package/packages/cli/dist/renderers/artifacts.js +0 -43
  710. package/packages/cli/dist/renderers/artifacts.js.map +0 -1
  711. package/packages/core/dist/doctor/render.d.ts +0 -2
  712. package/packages/core/dist/doctor/render.js +0 -44
  713. package/packages/core/dist/doctor/render.js.map +0 -1
  714. package/packages/core/dist/sync-back/apply.d.ts +0 -17
  715. package/packages/core/dist/sync-back/apply.js +0 -243
  716. package/packages/core/dist/sync-back/apply.js.map +0 -1
  717. package/packages/core/dist/sync-back/inspect.d.ts +0 -110
  718. package/packages/core/dist/sync-back/inspect.js +0 -497
  719. package/packages/core/dist/sync-back/inspect.js.map +0 -1
  720. package/packages/core/dist/sync-back.d.ts +0 -2
  721. package/packages/core/dist/sync-back.js +0 -3
  722. package/packages/core/dist/sync-back.js.map +0 -1
@@ -0,0 +1,279 @@
1
+ import type { RuntimeRef, SddStage } from '../contracts.js';
2
+ import { readLifecycleRiskDecisionProjection } from '../risk/kernel.js';
3
+ import { resolveSddContext } from '../sdd-docs/context.js';
4
+ import { parseSddBranch, type SddTask, type SddTaskModel } from '../sdd-docs/task-parser.js';
5
+ import { STAGE_ROUTE_BINDING_PRODUCER_VERSION, STAGE_ROUTE_BINDING_PROJECTION_TYPE, runtimeProjectionStableHash } from '../runtime-projection-p0.js';
6
+ import { recordRuntimeProjectionEnvelope, type RuntimeProjectionEnvelopeWriteResult } from '../storage/runtime-store.js';
7
+
8
+ export const STAGE_ROUTE_BINDING_CONTRACT_VERSION = 'sdd-stage-route-binding-v1' as const;
9
+
10
+ export type StageRouteEntry = 'sdd:plan' | 'sdd:tasks' | 'sdd:do' | 'sdd:test' | 'sdd:ship';
11
+ export type SddCommandBundle = 'plan' | 'tasks' | 'do' | 'test' | 'ship';
12
+ export type StageRouteBindingStatus = 'bound' | 'ambiguous' | 'not_found' | 'stale_upstream' | 'boundary_expanding' | 'blocked';
13
+ export type StageRouteTargetKind = 'task' | 'stage' | 'gate' | 'evidence_set' | 'ship_scope';
14
+ export type StageRouteBindingNextAction = 'enter_stage' | 'run_internal_stage' | 'ask_clarification' | 'route_to_lifecycle_decision' | 'runtime_repair_required' | 'blocked';
15
+
16
+ export interface StageRouteBinding {
17
+ contract: typeof STAGE_ROUTE_BINDING_CONTRACT_VERSION;
18
+ branch: string;
19
+ entry: StageRouteEntry;
20
+ bundle: SddCommandBundle;
21
+ targetRuntimeStage: SddStage;
22
+ userText: string;
23
+ status: StageRouteBindingStatus;
24
+ targetKind: StageRouteTargetKind | null;
25
+ targetId: string | null;
26
+ matchedRefs: RuntimeRef[];
27
+ activeLifecycleDecisionRef: string | null;
28
+ nextAction: StageRouteBindingNextAction;
29
+ reasons: string[];
30
+ }
31
+
32
+ interface TaskMatchCandidate {
33
+ task: SddTask;
34
+ score: number;
35
+ }
36
+
37
+ export async function bindStageRoute(projectRoot: string, input: { entry: StageRouteEntry; branch?: string; userText?: string }): Promise<StageRouteBinding> {
38
+ const context = await resolveSddContext(projectRoot, { branch: input.branch, branchSource: input.branch ? 'cli_option' : undefined });
39
+ const model = await parseSddBranch(projectRoot, context.partition);
40
+ return bindStageRouteForModel(projectRoot, {
41
+ branch: context.partition,
42
+ model,
43
+ entry: input.entry,
44
+ userText: input.userText ?? ''
45
+ });
46
+ }
47
+
48
+ export async function bindStageRouteForModel(projectRoot: string, input: { branch: string; model: SddTaskModel; entry: StageRouteEntry; userText?: string }): Promise<StageRouteBinding> {
49
+ const userText = (input.userText ?? '').trim();
50
+ const activeLifecycleDecisionRef = (await readLifecycleRiskDecisionProjection(projectRoot, { branch: input.branch }))?.id ?? null;
51
+ if (input.entry === 'sdd:do') {
52
+ return bindDoTask(input.branch, input.model, userText, activeLifecycleDecisionRef);
53
+ }
54
+ return bindBundleStage(input.branch, input.entry, userText, activeLifecycleDecisionRef);
55
+ }
56
+
57
+ export function stageRouteBindingScopeKey(binding: Pick<StageRouteBinding, 'branch' | 'entry' | 'userText'>): string {
58
+ return [binding.branch, binding.entry, runtimeProjectionStableHash(binding.userText || '<empty>').slice(0, 16)].join(':');
59
+ }
60
+
61
+ export async function recordStageRouteBindingProjection(projectRoot: string, binding: StageRouteBinding): Promise<RuntimeProjectionEnvelopeWriteResult<StageRouteBinding>> {
62
+ return recordRuntimeProjectionEnvelope(projectRoot, {
63
+ projectionType: STAGE_ROUTE_BINDING_PROJECTION_TYPE,
64
+ scopeKey: stageRouteBindingScopeKey(binding),
65
+ inputHash: runtimeProjectionStableHash(binding),
66
+ producer: 'phase9.18-stage-route-binding-runtime',
67
+ producerVersion: STAGE_ROUTE_BINDING_PRODUCER_VERSION,
68
+ payload: binding
69
+ });
70
+ }
71
+
72
+ function bindDoTask(branch: string, model: SddTaskModel, userText: string, activeLifecycleDecisionRef: string | null): StageRouteBinding {
73
+ const staleReason = doStageStaleReason(model);
74
+ if (staleReason) {
75
+ return binding({
76
+ branch,
77
+ entry: 'sdd:do',
78
+ targetRuntimeStage: 'do',
79
+ userText,
80
+ status: 'stale_upstream',
81
+ targetKind: 'task',
82
+ targetId: null,
83
+ matchedRefs: [],
84
+ activeLifecycleDecisionRef,
85
+ nextAction: 'runtime_repair_required',
86
+ reasons: [staleReason]
87
+ });
88
+ }
89
+
90
+ const matches = matchTasks(model.tasks, userText);
91
+ if (matches.length === 0) {
92
+ const looksLikeId = looksLikeTaskId(userText);
93
+ return binding({
94
+ branch,
95
+ entry: 'sdd:do',
96
+ targetRuntimeStage: 'do',
97
+ userText,
98
+ status: looksLikeId ? 'not_found' : 'boundary_expanding',
99
+ targetKind: 'task',
100
+ targetId: null,
101
+ matchedRefs: [],
102
+ activeLifecycleDecisionRef,
103
+ nextAction: looksLikeId ? 'ask_clarification' : 'route_to_lifecycle_decision',
104
+ reasons: looksLikeId
105
+ ? [`Task ${userText || '<empty>'} was not found in the accepted task set.`]
106
+ : [`No accepted task boundary matched "${userText}"; run /sdd or /sdd:spec if this is new scope, risk, or acceptance.`]
107
+ });
108
+ }
109
+
110
+ const topScore = matches[0].score;
111
+ const tied = matches.filter((candidate) => candidate.score === topScore);
112
+ if (tied.length > 1) {
113
+ return binding({
114
+ branch,
115
+ entry: 'sdd:do',
116
+ targetRuntimeStage: 'do',
117
+ userText,
118
+ status: 'ambiguous',
119
+ targetKind: 'task',
120
+ targetId: null,
121
+ matchedRefs: tied.map((candidate) => taskRuntimeRef(candidate.task)),
122
+ activeLifecycleDecisionRef,
123
+ nextAction: 'ask_clarification',
124
+ reasons: [`Ambiguous task text "${userText}" matched ${tied.map((candidate) => candidate.task.id).join(', ')}; specify a task id or more precise title.`]
125
+ });
126
+ }
127
+
128
+ const task = matches[0].task;
129
+ return binding({
130
+ branch,
131
+ entry: 'sdd:do',
132
+ targetRuntimeStage: 'do',
133
+ userText,
134
+ status: 'bound',
135
+ targetKind: 'task',
136
+ targetId: task.id,
137
+ matchedRefs: [taskRuntimeRef(task)],
138
+ activeLifecycleDecisionRef,
139
+ nextAction: 'enter_stage',
140
+ reasons: [`Bound "${userText}" to task ${task.id}.`]
141
+ });
142
+ }
143
+
144
+ function bindBundleStage(branch: string, entry: Exclude<StageRouteEntry, 'sdd:do'>, userText: string, activeLifecycleDecisionRef: string | null): StageRouteBinding {
145
+ const targetRuntimeStage = bundleTargetRuntimeStage(entry, userText);
146
+ return binding({
147
+ branch,
148
+ entry,
149
+ targetRuntimeStage,
150
+ userText,
151
+ status: 'bound',
152
+ targetKind: entry === 'sdd:ship' ? 'ship_scope' : 'stage',
153
+ targetId: targetRuntimeStage,
154
+ matchedRefs: [{ kind: entry === 'sdd:ship' ? 'projection' : 'command', ref: `${entry}:${targetRuntimeStage}` }],
155
+ activeLifecycleDecisionRef,
156
+ nextAction: targetRuntimeStage === bundleForEntry(entry) ? 'enter_stage' : 'run_internal_stage',
157
+ reasons: [`Bound ${entry} to runtime stage ${targetRuntimeStage}.`]
158
+ });
159
+ }
160
+
161
+ function binding(input: Omit<StageRouteBinding, 'contract' | 'bundle'>): StageRouteBinding {
162
+ return {
163
+ contract: STAGE_ROUTE_BINDING_CONTRACT_VERSION,
164
+ bundle: bundleForEntry(input.entry),
165
+ ...input
166
+ };
167
+ }
168
+
169
+ function bundleForEntry(entry: StageRouteEntry): SddCommandBundle {
170
+ if (entry === 'sdd:plan') return 'plan';
171
+ if (entry === 'sdd:tasks') return 'tasks';
172
+ if (entry === 'sdd:do') return 'do';
173
+ if (entry === 'sdd:test') return 'test';
174
+ return 'ship';
175
+ }
176
+
177
+ function bundleTargetRuntimeStage(entry: Exclude<StageRouteEntry, 'sdd:do'>, userText: string): SddStage {
178
+ const normalized = normalizeSearchText(userText);
179
+ if (entry === 'sdd:plan') return 'plan';
180
+ if (entry === 'sdd:tasks') return normalized.includes('verif') || normalized.includes('verify') ? 'verifies' : 'tasks';
181
+ if (entry === 'sdd:test') return normalized.includes('goalverify') || normalized.includes('goal') ? 'goal-verify' : 'test';
182
+ return 'ship';
183
+ }
184
+
185
+ function doStageStaleReason(model: SddTaskModel): string | null {
186
+ if (model.documents.tasksStale) {
187
+ return 'Tasks document is stale; return to the tasks bundle before executing do-stage binding.';
188
+ }
189
+ if (model.documents.verifyStale) {
190
+ return 'Verify document is stale; return to the tasks/verifies bundle before executing do-stage binding.';
191
+ }
192
+ return null;
193
+ }
194
+
195
+ function matchTasks(tasks: SddTask[], userText: string): TaskMatchCandidate[] {
196
+ const query = normalizeSearchText(userText);
197
+ if (!query) {
198
+ return [];
199
+ }
200
+ return tasks
201
+ .map((task) => ({ task, score: scoreTask(task, userText, query) }))
202
+ .filter((candidate) => candidate.score >= 40)
203
+ .sort((left, right) => right.score - left.score || left.task.id.localeCompare(right.task.id));
204
+ }
205
+
206
+ function scoreTask(task: SddTask, rawQuery: string, normalizedQuery: string): number {
207
+ const normalizedId = normalizeSearchText(task.id);
208
+ if (normalizedId === normalizedQuery) {
209
+ return 1000;
210
+ }
211
+ if (normalizedId.includes(normalizedQuery) && normalizedQuery.length >= 2) {
212
+ return 700;
213
+ }
214
+
215
+ let score = 0;
216
+ score = Math.max(score, scoreTextField(task.title ?? '', rawQuery, normalizedQuery, 600, 360, 80));
217
+ score = Math.max(score, scoreTextField(task.acceptance.join(' '), rawQuery, normalizedQuery, 260, 180, 35));
218
+ score = Math.max(score, scoreTextField(task.boundary ?? '', rawQuery, normalizedQuery, 180, 120, 24));
219
+ score = Math.max(score, scoreTextField(task.affectedFiles.join(' '), rawQuery, normalizedQuery, 120, 80, 12));
220
+ return score;
221
+ }
222
+
223
+ function scoreTextField(value: string, rawQuery: string, normalizedQuery: string, exactScore: number, containsScore: number, tokenWeight: number): number {
224
+ const normalizedValue = normalizeSearchText(value);
225
+ if (!normalizedValue) {
226
+ return 0;
227
+ }
228
+ if (normalizedValue === normalizedQuery) {
229
+ return exactScore;
230
+ }
231
+ if ((normalizedValue.includes(normalizedQuery) || normalizedQuery.includes(normalizedValue)) && Math.min(normalizedValue.length, normalizedQuery.length) >= 2) {
232
+ return containsScore;
233
+ }
234
+ const queryTokens = searchTokens(rawQuery);
235
+ const valueTokens = searchTokens(value);
236
+ let overlap = 0;
237
+ for (const token of queryTokens) {
238
+ if (valueTokens.has(token)) {
239
+ overlap += 1;
240
+ }
241
+ }
242
+ return overlap * tokenWeight;
243
+ }
244
+
245
+ function normalizeSearchText(value: string): string {
246
+ return value.toLocaleLowerCase().normalize('NFKC').replace(/[\s\p{P}\p{S}_-]+/gu, '');
247
+ }
248
+
249
+ const LOW_SIGNAL_SEARCH_TOKENS = new Set(['system', 'systems', 'feature', 'features', '功能', '系统', '模块', '服务', '任务', '实现', '完成', '边界']);
250
+
251
+ function searchTokens(value: string): Set<string> {
252
+ const tokens = new Set<string>();
253
+ const normalized = value.toLocaleLowerCase().normalize('NFKC');
254
+ for (const match of normalized.matchAll(/[a-z0-9]+/g)) {
255
+ addSearchToken(tokens, match[0]);
256
+ }
257
+ for (const match of normalized.matchAll(/\p{Script=Han}+/gu)) {
258
+ const text = match[0];
259
+ addSearchToken(tokens, text);
260
+ for (let index = 0; index < text.length - 1; index += 1) {
261
+ addSearchToken(tokens, text.slice(index, index + 2));
262
+ }
263
+ }
264
+ return tokens;
265
+ }
266
+
267
+ function addSearchToken(tokens: Set<string>, token: string): void {
268
+ if (token.length >= 2 && !LOW_SIGNAL_SEARCH_TOKENS.has(token)) {
269
+ tokens.add(token);
270
+ }
271
+ }
272
+
273
+ function looksLikeTaskId(value: string): boolean {
274
+ return /^[a-z][a-z0-9._-]*-?\d+$/i.test(value.trim());
275
+ }
276
+
277
+ function taskRuntimeRef(task: SddTask): RuntimeRef {
278
+ return { kind: 'task', ref: `task:${task.id}` };
279
+ }
@@ -2,3 +2,5 @@ export * from './router/agent-runtime-config.js';
2
2
  export * from './router/agent-runtime.js';
3
3
  export * from './router/route-cache.js';
4
4
  export * from './router/route-sdd-task.js';
5
+ export * from './router/stage-route-binding.js';
6
+ export * from './router/runtime-import.js';
@@ -1,8 +1,9 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { mkdir, readFile, writeFile } from 'node:fs/promises';
3
3
  import path from 'node:path';
4
- import { getEvidenceAttachmentPath, getLegacyArtifactPath, getRunRelativeArtifactPath, normalizeArtifactRootRelativePath } from '../runtime-paths.js';
5
- import { readRuntimeRunState, recordRuntimeArtifactPayload, recordRuntimeEvidenceAttachment, resolveRuntimeArtifactPayload, runtimeScopedId, withRuntimeStore } from '../storage/runtime-store.js';
4
+ import { getBranchStageEvidencePathFromRef, getEvidenceAttachmentPath, getLegacyArtifactPath, getRunRelativeArtifactPath, getRuntimeStorePath, isBranchStageEvidenceRef, normalizeArtifactRootRelativePath, normalizeBranchStageEvidenceRef, toBranchStageEvidenceRef } from '../runtime-paths.js';
5
+ import { readRuntimeRunState, recordRuntimeArtifactPayload, recordRuntimeEvidenceAttachment, resolveRuntimeArtifactPayload, runtimeScopedId, withRuntimeStore, type RuntimeArtifactPayloadRecord } from '../storage/runtime-store.js';
6
+ import type { SddStage } from '../contracts.js';
6
7
  import { appendArtifactHashLedgerEntry } from './invocation-ledger.js';
7
8
 
8
9
  export async function writeArtifact(projectRoot: string, runId: string, artifactRootRelativePath: string, content: string): Promise<{ absolutePath: string; runRelativePath: string }> {
@@ -47,20 +48,144 @@ export async function writeArtifact(projectRoot: string, runId: string, artifact
47
48
  return { absolutePath, runRelativePath };
48
49
  }
49
50
 
51
+ export async function recordStageEvidenceArtifact(projectRoot: string, runId: string, stageEvidenceRef: string, content: string, options: { taskId?: string | null; artifactRole?: string } = {}): Promise<{ absolutePath: string; runRelativePath: string }> {
52
+ const runRelativePath = normalizeBranchStageEvidenceRef(stageEvidenceRef);
53
+ const runScope = await resolveRunScope(projectRoot, runId);
54
+ const taskId = options.taskId ?? runScope.taskId;
55
+ const contentHash = hashDocumentContent(content);
56
+ const absolutePath = getBranchStageEvidencePathFromRef(projectRoot, runRelativePath);
57
+ await mkdir(path.dirname(absolutePath), { recursive: true });
58
+ await writeFile(absolutePath, content, 'utf8');
59
+ await appendArtifactHashLedgerEntry(projectRoot, {
60
+ runId,
61
+ taskId,
62
+ branch: runScope.branchSlug,
63
+ artifactPath: runRelativePath,
64
+ content,
65
+ status: 'written'
66
+ });
67
+ await recordRuntimeArtifact(projectRoot, { runId, path: runRelativePath, content, status: 'written', taskId });
68
+ await recordRuntimeArtifactPayload(projectRoot, {
69
+ payloadId: runtimeScopedId(runId, runRelativePath, contentHash),
70
+ runId,
71
+ sourceRunId: runId,
72
+ branchSlug: runScope.branchSlug,
73
+ taskId,
74
+ logicalRef: runRelativePath,
75
+ physicalPayloadPath: runRelativePath,
76
+ artifactRole: options.artifactRole ?? artifactKind(runRelativePath),
77
+ digest: contentHash,
78
+ status: 'active',
79
+ payload: { logicalRef: runRelativePath, physicalPayloadPath: runRelativePath, storage: 'stage-evidence', status: 'written' }
80
+ });
81
+ await recordRuntimeEvidenceAttachment(projectRoot, {
82
+ branchSlug: runScope.branchSlug,
83
+ runId,
84
+ taskId,
85
+ kind: options.artifactRole ?? artifactKind(runRelativePath),
86
+ relativePath: runRelativePath,
87
+ contentHash,
88
+ bytes: Buffer.byteLength(content, 'utf8'),
89
+ payload: { logicalRef: runRelativePath, physicalPayloadPath: runRelativePath, storage: 'stage-evidence', status: 'written' }
90
+ });
91
+ return { absolutePath, runRelativePath };
92
+ }
93
+
94
+ export async function recordRuntimeOnlyArtifact(projectRoot: string, runId: string, artifactRootRelativePath: string, content: string, options: { logicalRef?: string; branch?: string | null; taskId?: string | null; artifactRole?: string } = {}): Promise<{ absolutePath: string; runRelativePath: string }> {
95
+ const normalized = normalizeArtifactRootRelativePath(artifactRootRelativePath);
96
+ const runRelativePath = options.logicalRef ?? getRunRelativeArtifactPath(normalized);
97
+ const runScope = await resolveRunScope(projectRoot, runId);
98
+ const branchSlug = options.branch ?? runScope.branchSlug;
99
+ const taskId = options.taskId ?? runScope.taskId;
100
+ const contentHash = hashDocumentContent(content);
101
+ const physicalPayloadPath = `runtime.sqlite:${runId}:${runRelativePath}`;
102
+ await appendArtifactHashLedgerEntry(projectRoot, {
103
+ runId,
104
+ taskId,
105
+ branch: branchSlug,
106
+ artifactPath: runRelativePath,
107
+ content,
108
+ status: 'recorded'
109
+ });
110
+ await recordRuntimeArtifact(projectRoot, { runId, path: runRelativePath, content, status: 'recorded', taskId });
111
+ await recordRuntimeArtifactPayload(projectRoot, {
112
+ payloadId: runtimeScopedId(runId, runRelativePath, contentHash),
113
+ runId,
114
+ sourceRunId: runId,
115
+ branchSlug,
116
+ taskId,
117
+ logicalRef: runRelativePath,
118
+ physicalPayloadPath,
119
+ artifactRole: options.artifactRole ?? artifactKind(runRelativePath),
120
+ digest: contentHash,
121
+ status: 'active',
122
+ payload: { logicalRef: runRelativePath, physicalPayloadPath, storage: 'runtime.sqlite', content }
123
+ });
124
+ await recordRuntimeEvidenceAttachment(projectRoot, {
125
+ branchSlug,
126
+ runId,
127
+ taskId,
128
+ kind: options.artifactRole ?? artifactKind(runRelativePath),
129
+ relativePath: physicalPayloadPath,
130
+ contentHash,
131
+ bytes: Buffer.byteLength(content, 'utf8'),
132
+ payload: { logicalRef: runRelativePath, physicalPayloadPath, storage: 'runtime.sqlite' }
133
+ });
134
+ return { absolutePath: `${getRuntimeStorePath(projectRoot)}#${runRelativePath}`, runRelativePath };
135
+ }
136
+
50
137
  export async function readArtifact(projectRoot: string, runId: string, artifactRootRelativePath: string): Promise<string> {
51
138
  const normalized = normalizeArtifactRootRelativePath(artifactRootRelativePath);
52
139
  const runRelativePath = getRunRelativeArtifactPath(normalized);
53
- const payload = await resolveRuntimeArtifactPayload(projectRoot, runId, runRelativePath);
54
140
  const runScope = await resolveRunScope(projectRoot, runId);
55
- const evidencePath = getEvidenceAttachmentPath(projectRoot, runScope.branchSlug, payload?.physicalPayloadPath ?? runRelativePath);
141
+ const payload = await resolveRuntimeArtifactPayload(projectRoot, runId, runRelativePath)
142
+ ?? await resolveRuntimeArtifactPayload(projectRoot, runId, runtimeStageEvidenceRef(runScope.branchSlug, normalized));
143
+ const payloadContent = runtimePayloadContent(payload);
144
+ if (payloadContent !== null) {
145
+ return payloadContent;
146
+ }
56
147
  if (payload) {
57
- return readFile(evidencePath, 'utf8');
148
+ if (isBranchStageEvidenceRef(payload.physicalPayloadPath)) {
149
+ return readFile(getBranchStageEvidencePathFromRef(projectRoot, payload.physicalPayloadPath), 'utf8');
150
+ }
151
+ return readFile(getEvidenceAttachmentPath(projectRoot, runScope.branchSlug, payload.physicalPayloadPath), 'utf8');
58
152
  }
153
+ const stageEvidenceRef = runtimeStageEvidenceRef(runScope.branchSlug, normalized);
59
154
  try {
60
- return await readFile(evidencePath, 'utf8');
155
+ return await readFile(getBranchStageEvidencePathFromRef(projectRoot, stageEvidenceRef), 'utf8');
61
156
  } catch {
62
- return readFile(getLegacyArtifactPath(projectRoot, runId, normalized), 'utf8');
157
+ try {
158
+ return await readFile(getEvidenceAttachmentPath(projectRoot, runScope.branchSlug, runRelativePath), 'utf8');
159
+ } catch {
160
+ return readFile(getLegacyArtifactPath(projectRoot, runId, normalized), 'utf8');
161
+ }
162
+ }
163
+ }
164
+
165
+ function runtimePayloadContent(payload: RuntimeArtifactPayloadRecord | null): string | null {
166
+ if (!payload || !payload.payload || typeof payload.payload !== 'object' || Array.isArray(payload.payload)) {
167
+ return null;
63
168
  }
169
+ const content = (payload.payload as { content?: unknown }).content;
170
+ return typeof content === 'string' ? content : null;
171
+ }
172
+
173
+ function runtimeStageEvidenceRef(branch: string, artifactRootRelativePath: string): string {
174
+ const fileName = path.posix.basename(artifactRootRelativePath.replace(/\\/g, '/'));
175
+ return toBranchStageEvidenceRef(branch, runtimeStageForArtifact(fileName), fileName);
176
+ }
177
+
178
+ function runtimeStageForArtifact(fileName: string): SddStage {
179
+ if (fileName.startsWith('acceptance-coverage-')) {
180
+ return 'goal-verify';
181
+ }
182
+ if (fileName.startsWith('test-') || fileName.startsWith('validation-')) {
183
+ return 'test';
184
+ }
185
+ if (fileName.startsWith('ship-') || fileName.startsWith('release-')) {
186
+ return 'ship';
187
+ }
188
+ return 'do';
64
189
  }
65
190
 
66
191
  function uniquePhysicalPayloadPath(logicalRef: string, runId: string, digest: string): string {
@@ -89,9 +214,6 @@ export function artifactKind(artifactPath: string): string {
89
214
  if (fileName.startsWith('gap-report-')) {
90
215
  return 'gap-report';
91
216
  }
92
- if (fileName === 'sync-back-proposal.md') {
93
- return 'sync-back-proposal';
94
- }
95
217
  return 'artifact';
96
218
  }
97
219
 
@@ -1,11 +1,13 @@
1
1
  import { TASK_RUN_EVIDENCE_CONTRACT_VERSION } from '../contracts.js';
2
2
  import { listAgentExecutionRecords as listRuntimeBackedAgentExecutionRecords, listTeamSessionRecords as listRuntimeBackedTeamSessionRecords } from '../execution/agent-execution-records.js';
3
3
  import { listResidentWorkerRuntimeRecords as listRuntimeBackedResidentWorkerRuntimeRecords } from '../execution/resident-worker.js';
4
+ import { listRuntimeTestRuns, listRuntimeTestSteps } from '../storage/runtime-store.js';
4
5
  import type { ArtifactIndexEntry, InvocationLedgerEntry, RunState, RunStateArtifactIngestionRecord, RunStateWorktreeLifecycleRecord, RunStatus, RunSummary, RuntimeEvent } from './model.js';
5
6
  import { readRunEvents } from './events.js';
6
7
  import { listInvocationLedgerEntries } from './invocation-ledger.js';
7
8
  import { readRunState, summarizeRunState } from './run-state.js';
8
9
  import { readTaskEvidenceView, type TaskEvidenceView } from './task-evidence.js';
10
+ import { buildRunDurationBreakdown } from './timing.js';
9
11
 
10
12
  export interface TaskRunEvidenceGap {
11
13
  type: string;
@@ -63,7 +65,6 @@ export interface TaskRunEvidenceContract {
63
65
  artifacts: ArtifactIndexEntry[];
64
66
  validation: RunState['validation'];
65
67
  gaps: TaskRunEvidenceGap[];
66
- syncBackProposal: string | null;
67
68
  invocationLedger: InvocationLedgerEntry[];
68
69
  agentExecutions: AgentExecutionRecordView[];
69
70
  teamSessions: TeamSessionRecordView[];
@@ -80,7 +81,6 @@ export interface RunInspection {
80
81
  artifactIngestions: RunStateArtifactIngestionRecord[];
81
82
  worktrees: RunStateWorktreeLifecycleRecord[];
82
83
  validation: RunState['validation'];
83
- syncBack: RunState['syncBack'];
84
84
  tasks: Record<string, unknown>;
85
85
  taskRunEvidence: TaskRunEvidenceContract;
86
86
  taskEvidenceView: TaskEvidenceView | null;
@@ -92,19 +92,21 @@ export interface RunInspection {
92
92
 
93
93
  export async function inspectRun(projectRoot: string, runId: string): Promise<RunInspection> {
94
94
  const state = await readRunState(projectRoot, runId);
95
- const [events, agentExecutions, teamSessions, workerRuntimes, invocationLedger] = await Promise.all([
95
+ const [events, agentExecutions, teamSessions, workerRuntimes, invocationLedger, testRuns, testSteps] = await Promise.all([
96
96
  readRunEvents(projectRoot, runId),
97
97
  listRuntimeBackedAgentExecutionRecords(projectRoot, runId),
98
98
  listRuntimeBackedTeamSessionRecords(projectRoot, runId),
99
99
  listRuntimeBackedResidentWorkerRuntimeRecords(projectRoot, runId),
100
- listInvocationLedgerEntries(projectRoot, runId)
100
+ listInvocationLedgerEntries(projectRoot, runId),
101
+ listRuntimeTestRuns(projectRoot, runId),
102
+ listRuntimeTestSteps(projectRoot, { runId })
101
103
  ]);
102
104
  const agentExecutionViews = agentExecutions.map((record) => ({ ...record }) as AgentExecutionRecordView);
103
105
  const teamSessionViews = teamSessions.map((record) => ({ ...record }) as TeamSessionRecordView);
104
106
  const workerRuntimeViews = workerRuntimes.map((record) => ({ ...record }) as ResidentWorkerRuntimeRecordView);
105
107
  const taskEvidenceView = state.partition && state.taskId ? await readTaskEvidenceView(projectRoot, { branch: state.partition, taskId: state.taskId }) : null;
106
108
  return {
107
- summary: summarizeRunState(state),
109
+ summary: { ...summarizeRunState(state), durationBreakdown: buildRunDurationBreakdown(state, { events, testRuns, testSteps }) },
108
110
  state,
109
111
  events,
110
112
  eventCount: events.length,
@@ -113,7 +115,6 @@ export async function inspectRun(projectRoot: string, runId: string): Promise<Ru
113
115
  artifactIngestions: Object.values(state.artifactIngestions ?? {}),
114
116
  worktrees: Object.values(state.worktrees ?? {}),
115
117
  validation: state.validation,
116
- syncBack: state.syncBack,
117
118
  taskRunEvidence: buildTaskRunEvidence(state, events, agentExecutionViews, teamSessionViews, workerRuntimeViews, invocationLedger),
118
119
  taskEvidenceView,
119
120
  tasks: state.tasks,
@@ -142,7 +143,6 @@ function buildTaskRunEvidence(state: RunState, events: RuntimeEvent[], agentExec
142
143
  artifacts: state.artifacts,
143
144
  validation: state.validation,
144
145
  gaps: Object.values(state.tasks).flatMap(extractTaskGaps),
145
- syncBackProposal: state.syncBack.proposalPath,
146
146
  agentExecutions,
147
147
  teamSessions,
148
148
  workerRuntimes,
@@ -28,6 +28,7 @@ export interface RunDocumentSnapshot {
28
28
  specContractHash: string | null;
29
29
  planContractHash: string | null;
30
30
  tasksContractHash: string | null;
31
+ taskContractHash: string | null;
31
32
  planBasedOnSpecHash: string | null;
32
33
  tasksBasedOnPlanHash: string | null;
33
34
  planBasedOnSpecContractHash: string | null;
@@ -89,6 +90,9 @@ export interface RunStateDelegationRecord {
89
90
  expectedArtifact: string;
90
91
  terminalEventRequired: boolean;
91
92
  terminalEventAt?: string | null;
93
+ attempt?: number;
94
+ retryOf?: string | null;
95
+ replayReason?: 'document_contract_refresh' | 'artifact_reingest' | 'validation_replay' | 'manual_retry' | 'runtime_recovery' | null;
92
96
  }
93
97
 
94
98
  export interface RunStateArtifactIngestionRecord {
@@ -104,6 +108,9 @@ export interface RunStateArtifactIngestionRecord {
104
108
  ingestedAt: string;
105
109
  issues: RunStateContractValidationIssue[];
106
110
  gaps: RunStateTaskGap[];
111
+ contentDigest?: string;
112
+ retryOf?: string | null;
113
+ replayReason?: string | null;
107
114
  }
108
115
 
109
116
  export interface RunStateWorktreeLifecycleRecord {
@@ -174,15 +181,31 @@ export interface RunState {
174
181
  commands: string[];
175
182
  evidence: string[];
176
183
  };
177
- syncBack: {
178
- mode: 'proposal';
179
- proposalPath: string | null;
180
- proposalDigest?: string | null;
181
- sourceVerifyStatus?: 'PASS' | 'PASS_WITH_GAPS' | 'FAIL' | 'BLOCKED' | 'completed' | 'blocked' | 'failed' | null;
182
- status: 'not_created' | 'proposed' | 'applied';
183
- };
184
184
  }
185
185
 
186
+ export interface RunDurationContributor {
187
+ kind: 'validation' | 'waiting' | 'blocked' | 'queue_or_bind' | 'host_waiting' | 'unknown_gap';
188
+ durationMs: number;
189
+ startedAt: string;
190
+ endedAt: string;
191
+ reason: string;
192
+ refs: string[];
193
+ }
194
+
195
+ export interface RunDurationBreakdown {
196
+ elapsedDurationMs: number;
197
+ activeRuntimeDurationMs: number;
198
+ validationDurationMs: number;
199
+ waitingDurationMs: number;
200
+ blockedDurationMs: number;
201
+ queueOrBindDurationMs: number;
202
+ unknownGapDurationMs: number;
203
+ hostWaitingDurationMs: number;
204
+ slowReason: RunDurationContributor['kind'] | 'active_runtime' | 'none';
205
+ topContributors: RunDurationContributor[];
206
+ }
207
+
208
+
186
209
  export interface RunSummary {
187
210
  runId: string;
188
211
  status: RunStatus;
@@ -196,9 +219,9 @@ export interface RunSummary {
196
219
  createdAt: string;
197
220
  updatedAt: string;
198
221
  validationStatus: RunState['validation']['status'];
199
- syncBackStatus: RunState['syncBack']['status'];
200
222
  taskIds: string[];
201
223
  artifactCount: number;
224
+ durationBreakdown: RunDurationBreakdown;
202
225
  }
203
226
 
204
227
  export interface RuntimeEvent {
@@ -66,7 +66,6 @@ export interface LocalRunIndexPartitionTaskEntry {
66
66
  runId: string;
67
67
  runStatus: RunStatus;
68
68
  validationStatus: RunState['validation']['status'];
69
- syncBackStatus: RunState['syncBack']['status'];
70
69
  affectedFiles: string[];
71
70
  updatedAt: string;
72
71
  }
@@ -78,7 +77,6 @@ export interface LocalRunIndexAffectedFileEntry {
78
77
  taskId: string;
79
78
  runId: string;
80
79
  runStatus: RunStatus;
81
- syncBackStatus: RunState['syncBack']['status'];
82
80
  updatedAt: string;
83
81
  }
84
82
 
@@ -232,7 +230,6 @@ async function buildLocalRunIndexSnapshot(projectRoot: string): Promise<LocalRun
232
230
  runId: state.runId,
233
231
  runStatus: state.status,
234
232
  validationStatus: state.validation.status,
235
- syncBackStatus: state.syncBack.status,
236
233
  affectedFiles: state.affectedFiles,
237
234
  updatedAt: state.updatedAt
238
235
  };
@@ -250,7 +247,6 @@ async function buildLocalRunIndexSnapshot(projectRoot: string): Promise<LocalRun
250
247
  taskId: state.taskId,
251
248
  runId: state.runId,
252
249
  runStatus: state.status,
253
- syncBackStatus: state.syncBack.status,
254
250
  updatedAt: state.updatedAt
255
251
  });
256
252
  }
@@ -336,7 +332,7 @@ function partitionTaskKey(partition: string, taskId: string): string {
336
332
  }
337
333
 
338
334
  function isActiveRunForAffectedFile(state: RunState): boolean {
339
- return state.status !== 'archived' && state.syncBack.status !== 'applied' && state.affectedFiles.length > 0;
335
+ return state.status !== 'archived' && state.affectedFiles.length > 0;
340
336
  }
341
337
 
342
338
  function contractIssue(field: string, message: string, recommendation: string): ContractValidationIssue {