@tacuchi/agent-workflow-cli 25.7.0 → 25.9.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 (580) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +5 -1
  3. package/dist/adapters/git-cli.js +311 -24
  4. package/dist/adapters/git-cli.js.map +1 -1
  5. package/dist/adapters/node-file-system.js +48 -0
  6. package/dist/adapters/node-file-system.js.map +1 -1
  7. package/dist/application/amend-service.js +51 -14
  8. package/dist/application/amend-service.js.map +1 -1
  9. package/dist/application/branch-resolver.js +6 -3
  10. package/dist/application/branch-resolver.js.map +1 -1
  11. package/dist/application/capability/design-handler.js +124 -43
  12. package/dist/application/capability/design-handler.js.map +1 -1
  13. package/dist/application/capability/dispatcher.js +4 -1
  14. package/dist/application/capability/dispatcher.js.map +1 -1
  15. package/dist/application/capability/durable-effect.js +3 -0
  16. package/dist/application/capability/durable-effect.js.map +1 -1
  17. package/dist/application/capability/readiness.js +26 -10
  18. package/dist/application/capability/readiness.js.map +1 -1
  19. package/dist/application/capability/wrapper.js +10 -3
  20. package/dist/application/capability/wrapper.js.map +1 -1
  21. package/dist/application/check-branch-service.js +158 -19
  22. package/dist/application/check-branch-service.js.map +1 -1
  23. package/dist/application/checkpoint/markdown.js +2 -2
  24. package/dist/application/checkpoint/markdown.js.map +1 -1
  25. package/dist/application/checkpoint/state-reader.js +12 -0
  26. package/dist/application/checkpoint/state-reader.js.map +1 -1
  27. package/dist/application/checkpoint-service.js +12 -4
  28. package/dist/application/checkpoint-service.js.map +1 -1
  29. package/dist/application/checkpoint-write-service.js +91 -17
  30. package/dist/application/checkpoint-write-service.js.map +1 -1
  31. package/dist/application/claims-ledger.js +137 -11
  32. package/dist/application/claims-ledger.js.map +1 -1
  33. package/dist/application/claims-recovery.js +85 -44
  34. package/dist/application/claims-recovery.js.map +1 -1
  35. package/dist/application/database-tool-catalog.js +33 -0
  36. package/dist/application/database-tool-catalog.js.map +1 -1
  37. package/dist/application/design/consumer-document.js +2 -2
  38. package/dist/application/design/consumer-document.js.map +1 -1
  39. package/dist/application/design/design-content-gate-service.js +20 -2
  40. package/dist/application/design/design-content-gate-service.js.map +1 -1
  41. package/dist/application/design/design-gate-service.js +2 -0
  42. package/dist/application/design/design-gate-service.js.map +1 -1
  43. package/dist/application/design/design-index-service.js +4 -0
  44. package/dist/application/design/design-index-service.js.map +1 -1
  45. package/dist/application/design/design-publish-service.js +1 -4
  46. package/dist/application/design/design-publish-service.js.map +1 -1
  47. package/dist/application/design/design-record-service.js +13 -7
  48. package/dist/application/design/design-record-service.js.map +1 -1
  49. package/dist/application/design/design-resolver-service.js +22 -3
  50. package/dist/application/design/design-resolver-service.js.map +1 -1
  51. package/dist/application/design/design-simple-service.js +24 -5
  52. package/dist/application/design/design-simple-service.js.map +1 -1
  53. package/dist/application/design/digest.js +41 -0
  54. package/dist/application/design/digest.js.map +1 -0
  55. package/dist/application/dev-only-services.js +171 -27
  56. package/dist/application/dev-only-services.js.map +1 -1
  57. package/dist/application/doc-branch-ledger.js +145 -0
  58. package/dist/application/doc-branch-ledger.js.map +1 -0
  59. package/dist/application/docs-canon-service.js +1 -1
  60. package/dist/application/docs-canon-service.js.map +1 -1
  61. package/dist/application/doctor/dist-integrity.js +113 -0
  62. package/dist/application/doctor/dist-integrity.js.map +1 -0
  63. package/dist/application/doctor/hosts.js +5 -2
  64. package/dist/application/doctor/hosts.js.map +1 -1
  65. package/dist/application/doctor/prepare.js +4 -1
  66. package/dist/application/doctor/prepare.js.map +1 -1
  67. package/dist/application/doctor/provider-installation.js +39 -19
  68. package/dist/application/doctor/provider-installation.js.map +1 -1
  69. package/dist/application/doctor/provider-mcps.js +10 -2
  70. package/dist/application/doctor/provider-mcps.js.map +1 -1
  71. package/dist/application/doctor/provider-skills.js +25 -0
  72. package/dist/application/doctor/provider-skills.js.map +1 -1
  73. package/dist/application/doctor/provider-visibility.js +76 -3
  74. package/dist/application/doctor/provider-visibility.js.map +1 -1
  75. package/dist/application/doctor/provider-workspace-block.js +156 -0
  76. package/dist/application/doctor/provider-workspace-block.js.map +1 -0
  77. package/dist/application/doctor/repair-runner.js +47 -3
  78. package/dist/application/doctor/repair-runner.js.map +1 -1
  79. package/dist/application/doctor/report.js +24 -4
  80. package/dist/application/doctor/report.js.map +1 -1
  81. package/dist/application/doctor/skills-toml-migrate.js +76 -0
  82. package/dist/application/doctor/skills-toml-migrate.js.map +1 -0
  83. package/dist/application/export-catalog-check.js +200 -0
  84. package/dist/application/export-catalog-check.js.map +1 -0
  85. package/dist/application/export-service.js +716 -79
  86. package/dist/application/export-service.js.map +1 -1
  87. package/dist/application/fix-git-service.js +285 -64
  88. package/dist/application/fix-git-service.js.map +1 -1
  89. package/dist/application/flow/advance.js +241 -30
  90. package/dist/application/flow/advance.js.map +1 -1
  91. package/dist/application/flow/annul-service.js +3 -1
  92. package/dist/application/flow/annul-service.js.map +1 -1
  93. package/dist/application/flow/batch-commit.js +189 -0
  94. package/dist/application/flow/batch-commit.js.map +1 -0
  95. package/dist/application/flow/checkout-observation.js +110 -8
  96. package/dist/application/flow/checkout-observation.js.map +1 -1
  97. package/dist/application/flow/close-artifacts.js +105 -0
  98. package/dist/application/flow/close-artifacts.js.map +1 -0
  99. package/dist/application/flow/close-at-boundary.js +155 -0
  100. package/dist/application/flow/close-at-boundary.js.map +1 -0
  101. package/dist/application/flow/close-document-guidance.js +70 -0
  102. package/dist/application/flow/close-document-guidance.js.map +1 -0
  103. package/dist/application/flow/flow-service.js +49 -5
  104. package/dist/application/flow/flow-service.js.map +1 -1
  105. package/dist/application/flow/internal-actions.js +361 -80
  106. package/dist/application/flow/internal-actions.js.map +1 -1
  107. package/dist/application/flow/internal-drive.js +47 -19
  108. package/dist/application/flow/internal-drive.js.map +1 -1
  109. package/dist/application/flow/plan-entry.js +82 -0
  110. package/dist/application/flow/plan-entry.js.map +1 -0
  111. package/dist/application/flow/prove.js +32 -1
  112. package/dist/application/flow/prove.js.map +1 -1
  113. package/dist/application/flow/quick-checkouts.js +48 -0
  114. package/dist/application/flow/quick-checkouts.js.map +1 -0
  115. package/dist/application/flow/reinfer-batch.js +177 -0
  116. package/dist/application/flow/reinfer-batch.js.map +1 -0
  117. package/dist/application/flow/reopen-run.js +159 -0
  118. package/dist/application/flow/reopen-run.js.map +1 -0
  119. package/dist/application/flow/run-journey.js +11 -8
  120. package/dist/application/flow/run-journey.js.map +1 -1
  121. package/dist/application/flow/run-projection.js +16 -5
  122. package/dist/application/flow/run-projection.js.map +1 -1
  123. package/dist/application/flow/run-state-service.js +3 -1
  124. package/dist/application/flow/run-state-service.js.map +1 -1
  125. package/dist/application/flow/submit.js +731 -154
  126. package/dist/application/flow/submit.js.map +1 -1
  127. package/dist/application/generate-launch-service.js +16 -6
  128. package/dist/application/generate-launch-service.js.map +1 -1
  129. package/dist/application/git-flow-service.js +34 -3
  130. package/dist/application/git-flow-service.js.map +1 -1
  131. package/dist/application/history-publications.js +24 -0
  132. package/dist/application/history-publications.js.map +1 -1
  133. package/dist/application/history-reconcile-service.js +45 -0
  134. package/dist/application/history-reconcile-service.js.map +1 -0
  135. package/dist/application/history-table.js +61 -12
  136. package/dist/application/history-table.js.map +1 -1
  137. package/dist/application/history-update-service.js +25 -4
  138. package/dist/application/history-update-service.js.map +1 -1
  139. package/dist/application/hook-branch-check.js +25 -3
  140. package/dist/application/hook-branch-check.js.map +1 -1
  141. package/dist/application/hook-git-commit-advisor.js +3 -4
  142. package/dist/application/hook-git-commit-advisor.js.map +1 -1
  143. package/dist/application/hook-sql-mutation-guard.js +147 -12
  144. package/dist/application/hook-sql-mutation-guard.js.map +1 -1
  145. package/dist/application/hook-turn-start.js +51 -0
  146. package/dist/application/hook-turn-start.js.map +1 -0
  147. package/dist/application/host-memory/codex.js +1 -1
  148. package/dist/application/host-memory/codex.js.map +1 -1
  149. package/dist/application/hub-registry.js +135 -0
  150. package/dist/application/hub-registry.js.map +1 -0
  151. package/dist/application/local-proposal.js +72 -19
  152. package/dist/application/local-proposal.js.map +1 -1
  153. package/dist/application/mcp-host-reader.js +1 -1
  154. package/dist/application/mcp-host-reader.js.map +1 -1
  155. package/dist/application/mcp-host-writer.js +16 -10
  156. package/dist/application/mcp-host-writer.js.map +1 -1
  157. package/dist/application/merge-state-service.js +150 -34
  158. package/dist/application/merge-state-service.js.map +1 -1
  159. package/dist/application/multiroot/claude.js +17 -10
  160. package/dist/application/multiroot/claude.js.map +1 -1
  161. package/dist/application/multiroot/codex.js +17 -11
  162. package/dist/application/multiroot/codex.js.map +1 -1
  163. package/dist/application/multiroot-service.js +52 -28
  164. package/dist/application/multiroot-service.js.map +1 -1
  165. package/dist/application/parsers/execution-batches.js +64 -0
  166. package/dist/application/parsers/execution-batches.js.map +1 -0
  167. package/dist/application/parsers/phases.js +23 -2
  168. package/dist/application/parsers/phases.js.map +1 -1
  169. package/dist/application/parsers/project-block.js +146 -17
  170. package/dist/application/parsers/project-block.js.map +1 -1
  171. package/dist/application/parsers/tasks.js +16 -2
  172. package/dist/application/parsers/tasks.js.map +1 -1
  173. package/dist/application/parsers/toml.js +19 -0
  174. package/dist/application/parsers/toml.js.map +1 -0
  175. package/dist/application/paths-service.js +13 -16
  176. package/dist/application/paths-service.js.map +1 -1
  177. package/dist/application/persist-service.js +118 -5
  178. package/dist/application/persist-service.js.map +1 -1
  179. package/dist/application/plan-exec-batch-service.js +162 -22
  180. package/dist/application/plan-exec-batch-service.js.map +1 -1
  181. package/dist/application/plan-exec-decision-service.js +61 -12
  182. package/dist/application/plan-exec-decision-service.js.map +1 -1
  183. package/dist/application/plan-exec-plan-diff.js +105 -0
  184. package/dist/application/plan-exec-plan-diff.js.map +1 -0
  185. package/dist/application/plan-lint-service.js +2 -0
  186. package/dist/application/plan-lint-service.js.map +1 -1
  187. package/dist/application/plan-passes.js +41 -0
  188. package/dist/application/plan-passes.js.map +1 -0
  189. package/dist/application/preparation-receipts.js +58 -0
  190. package/dist/application/preparation-receipts.js.map +1 -0
  191. package/dist/application/project-md-upsert-service.js +191 -52
  192. package/dist/application/project-md-upsert-service.js.map +1 -1
  193. package/dist/application/project-tab-data.js +40 -10
  194. package/dist/application/project-tab-data.js.map +1 -1
  195. package/dist/application/release-data/artifacts.js +15 -7
  196. package/dist/application/release-data/artifacts.js.map +1 -1
  197. package/dist/application/release-data/bundles.js +52 -6
  198. package/dist/application/release-data/bundles.js.map +1 -1
  199. package/dist/application/release-data/common.js +2 -2
  200. package/dist/application/release-data/common.js.map +1 -1
  201. package/dist/application/release-data/rollback.js +7 -0
  202. package/dist/application/release-data/rollback.js.map +1 -0
  203. package/dist/application/release-data/sessions.js +2 -2
  204. package/dist/application/release-data/sessions.js.map +1 -1
  205. package/dist/application/release-pass-ledger.js +1 -1
  206. package/dist/application/render/history-row.js +2 -0
  207. package/dist/application/render/history-row.js.map +1 -1
  208. package/dist/application/render/project-block.js +28 -11
  209. package/dist/application/render/project-block.js.map +1 -1
  210. package/dist/application/reseal-service.js +1 -0
  211. package/dist/application/reseal-service.js.map +1 -1
  212. package/dist/application/resume-service.js +55 -8
  213. package/dist/application/resume-service.js.map +1 -1
  214. package/dist/application/retirement/apply.js +25 -7
  215. package/dist/application/retirement/apply.js.map +1 -1
  216. package/dist/application/retirement/attribution.js +121 -48
  217. package/dist/application/retirement/attribution.js.map +1 -1
  218. package/dist/application/retirement/prepare.js +17 -11
  219. package/dist/application/retirement/prepare.js.map +1 -1
  220. package/dist/application/retirement/preview.js +2 -1
  221. package/dist/application/retirement/preview.js.map +1 -1
  222. package/dist/application/self/codex-plugin.js +1 -1
  223. package/dist/application/self/codex-plugin.js.map +1 -1
  224. package/dist/application/self/host-states.js +3 -3
  225. package/dist/application/self/host-states.js.map +1 -1
  226. package/dist/application/self/install-hooks.js +1 -1
  227. package/dist/application/self/install-hooks.js.map +1 -1
  228. package/dist/application/self/install-skill.js +35 -11
  229. package/dist/application/self/install-skill.js.map +1 -1
  230. package/dist/application/self/install-targets.js +73 -2
  231. package/dist/application/self/install-targets.js.map +1 -1
  232. package/dist/application/self/mcp-config.js +19 -11
  233. package/dist/application/self/mcp-config.js.map +1 -1
  234. package/dist/application/self/opencode-plugin.js +1 -0
  235. package/dist/application/self/opencode-plugin.js.map +1 -1
  236. package/dist/application/self/uninstall.js +22 -8
  237. package/dist/application/self/uninstall.js.map +1 -1
  238. package/dist/application/semantic-operation/protocol.js +66 -5
  239. package/dist/application/semantic-operation/protocol.js.map +1 -1
  240. package/dist/application/session-archive-service.js +113 -0
  241. package/dist/application/session-archive-service.js.map +1 -0
  242. package/dist/application/session-binding-service.js +35 -0
  243. package/dist/application/session-binding-service.js.map +1 -1
  244. package/dist/application/session-close-service.js +390 -54
  245. package/dist/application/session-close-service.js.map +1 -1
  246. package/dist/application/session-create-service.js +97 -5
  247. package/dist/application/session-create-service.js.map +1 -1
  248. package/dist/application/session-custody-recorder.js +15 -12
  249. package/dist/application/session-custody-recorder.js.map +1 -1
  250. package/dist/application/session-custody-service.js +1 -0
  251. package/dist/application/session-custody-service.js.map +1 -1
  252. package/dist/application/session-narrative.js +51 -12
  253. package/dist/application/session-narrative.js.map +1 -1
  254. package/dist/application/session-pause-service.js +46 -0
  255. package/dist/application/session-pause-service.js.map +1 -0
  256. package/dist/application/session-resolver.js +36 -11
  257. package/dist/application/session-resolver.js.map +1 -1
  258. package/dist/application/session-resume-service.js +190 -20
  259. package/dist/application/session-resume-service.js.map +1 -1
  260. package/dist/application/sessions-service.js +4 -0
  261. package/dist/application/sessions-service.js.map +1 -1
  262. package/dist/application/sessions-sweep-service.js +77 -0
  263. package/dist/application/sessions-sweep-service.js.map +1 -0
  264. package/dist/application/settle-service.js +3 -1
  265. package/dist/application/settle-service.js.map +1 -1
  266. package/dist/application/skills-resolver-service.js +1 -1
  267. package/dist/application/skills-resolver-service.js.map +1 -1
  268. package/dist/application/source-add-service.js +37 -0
  269. package/dist/application/source-add-service.js.map +1 -0
  270. package/dist/application/source-boundary-policy.js +97 -8
  271. package/dist/application/source-boundary-policy.js.map +1 -1
  272. package/dist/application/source-pipeline.js +68 -0
  273. package/dist/application/source-pipeline.js.map +1 -0
  274. package/dist/application/source-remove-service.js +15 -3
  275. package/dist/application/source-remove-service.js.map +1 -1
  276. package/dist/application/sources-service.js +71 -16
  277. package/dist/application/sources-service.js.map +1 -1
  278. package/dist/application/status-service.js +55 -5
  279. package/dist/application/status-service.js.map +1 -1
  280. package/dist/application/unit-dependencies.js +100 -0
  281. package/dist/application/unit-dependencies.js.map +1 -0
  282. package/dist/application/unit-membership.js +37 -0
  283. package/dist/application/unit-membership.js.map +1 -0
  284. package/dist/application/unit-residue.js +72 -0
  285. package/dist/application/unit-residue.js.map +1 -0
  286. package/dist/application/visibility-doctor-service.js +66 -4
  287. package/dist/application/visibility-doctor-service.js.map +1 -1
  288. package/dist/application/working-branch-service.js +6 -0
  289. package/dist/application/working-branch-service.js.map +1 -1
  290. package/dist/application/workline-graph.js +1 -1
  291. package/dist/application/workline-graph.js.map +1 -1
  292. package/dist/application/workline-index-service.js +118 -17
  293. package/dist/application/workline-index-service.js.map +1 -1
  294. package/dist/application/workspace-commit-service.js +218 -0
  295. package/dist/application/workspace-commit-service.js.map +1 -0
  296. package/dist/application/workspace-init-service.js +64 -34
  297. package/dist/application/workspace-init-service.js.map +1 -1
  298. package/dist/application/workspace-local-config.js +90 -0
  299. package/dist/application/workspace-local-config.js.map +1 -0
  300. package/dist/application/workspace-materialization-service.js +52 -3
  301. package/dist/application/workspace-materialization-service.js.map +1 -1
  302. package/dist/application/workspace-migrate/apply.js +525 -4
  303. package/dist/application/workspace-migrate/apply.js.map +1 -1
  304. package/dist/application/workspace-migrate/markers.js +9 -6
  305. package/dist/application/workspace-migrate/markers.js.map +1 -1
  306. package/dist/application/workspace-migrate/plan.js +97 -5
  307. package/dist/application/workspace-migrate/plan.js.map +1 -1
  308. package/dist/application/workspace-move-service.js +270 -0
  309. package/dist/application/workspace-move-service.js.map +1 -0
  310. package/dist/application/workspace-untrack-service.js +28 -0
  311. package/dist/application/workspace-untrack-service.js.map +1 -0
  312. package/dist/application/worktree-service.js +654 -105
  313. package/dist/application/worktree-service.js.map +1 -1
  314. package/dist/cli/ascii.js +86 -0
  315. package/dist/cli/ascii.js.map +1 -0
  316. package/dist/cli/commands/add-source.js +38 -0
  317. package/dist/cli/commands/add-source.js.map +1 -0
  318. package/dist/cli/commands/amend.js +14 -2
  319. package/dist/cli/commands/amend.js.map +1 -1
  320. package/dist/cli/commands/capability.js +26 -0
  321. package/dist/cli/commands/capability.js.map +1 -1
  322. package/dist/cli/commands/check-branch.js +1 -0
  323. package/dist/cli/commands/check-branch.js.map +1 -1
  324. package/dist/cli/commands/checkpoint-read.js +1 -0
  325. package/dist/cli/commands/checkpoint-read.js.map +1 -1
  326. package/dist/cli/commands/checkpoint-write.js +4 -1
  327. package/dist/cli/commands/checkpoint-write.js.map +1 -1
  328. package/dist/cli/commands/claims.js +1 -0
  329. package/dist/cli/commands/claims.js.map +1 -1
  330. package/dist/cli/commands/code-scan.js +1 -0
  331. package/dist/cli/commands/code-scan.js.map +1 -1
  332. package/dist/cli/commands/context-budget.js +1 -0
  333. package/dist/cli/commands/context-budget.js.map +1 -1
  334. package/dist/cli/commands/context-plan.js +1 -0
  335. package/dist/cli/commands/context-plan.js.map +1 -1
  336. package/dist/cli/commands/cut-intent.js +1 -0
  337. package/dist/cli/commands/cut-intent.js.map +1 -1
  338. package/dist/cli/commands/designs.js +15 -5
  339. package/dist/cli/commands/designs.js.map +1 -1
  340. package/dist/cli/commands/dev-only.js +22 -5
  341. package/dist/cli/commands/dev-only.js.map +1 -1
  342. package/dist/cli/commands/doc-branch.js +184 -0
  343. package/dist/cli/commands/doc-branch.js.map +1 -0
  344. package/dist/cli/commands/doctor.js +9 -0
  345. package/dist/cli/commands/doctor.js.map +1 -1
  346. package/dist/cli/commands/export.js +89 -16
  347. package/dist/cli/commands/export.js.map +1 -1
  348. package/dist/cli/commands/fix-git.js +89 -13
  349. package/dist/cli/commands/fix-git.js.map +1 -1
  350. package/dist/cli/commands/flow.js +129 -13
  351. package/dist/cli/commands/flow.js.map +1 -1
  352. package/dist/cli/commands/generate-launch.js +15 -2
  353. package/dist/cli/commands/generate-launch.js.map +1 -1
  354. package/dist/cli/commands/git-flow.js +1 -0
  355. package/dist/cli/commands/git-flow.js.map +1 -1
  356. package/dist/cli/commands/history-update.js +7 -9
  357. package/dist/cli/commands/history-update.js.map +1 -1
  358. package/dist/cli/commands/history.js +14 -0
  359. package/dist/cli/commands/history.js.map +1 -0
  360. package/dist/cli/commands/hook.js +26 -5
  361. package/dist/cli/commands/hook.js.map +1 -1
  362. package/dist/cli/commands/host-doctor.js +1 -0
  363. package/dist/cli/commands/host-doctor.js.map +1 -1
  364. package/dist/cli/commands/host-memory.js +2 -9
  365. package/dist/cli/commands/host-memory.js.map +1 -1
  366. package/dist/cli/commands/index.js +18 -1
  367. package/dist/cli/commands/index.js.map +1 -1
  368. package/dist/cli/commands/mcp.js +30 -4
  369. package/dist/cli/commands/mcp.js.map +1 -1
  370. package/dist/cli/commands/merge-state.js +3 -2
  371. package/dist/cli/commands/merge-state.js.map +1 -1
  372. package/dist/cli/commands/multiroot.js +16 -0
  373. package/dist/cli/commands/multiroot.js.map +1 -1
  374. package/dist/cli/commands/persist.js +7 -5
  375. package/dist/cli/commands/persist.js.map +1 -1
  376. package/dist/cli/commands/plan.js +1 -0
  377. package/dist/cli/commands/plan.js.map +1 -1
  378. package/dist/cli/commands/plugin-cache.js +4 -0
  379. package/dist/cli/commands/plugin-cache.js.map +1 -1
  380. package/dist/cli/commands/plugin-doctor.js +3 -0
  381. package/dist/cli/commands/plugin-doctor.js.map +1 -1
  382. package/dist/cli/commands/project-md-upsert.js +8 -3
  383. package/dist/cli/commands/project-md-upsert.js.map +1 -1
  384. package/dist/cli/commands/release-data.js +12 -0
  385. package/dist/cli/commands/release-data.js.map +1 -1
  386. package/dist/cli/commands/release-pass.js +13 -3
  387. package/dist/cli/commands/release-pass.js.map +1 -1
  388. package/dist/cli/commands/remove-source.js +1 -0
  389. package/dist/cli/commands/remove-source.js.map +1 -1
  390. package/dist/cli/commands/reseal.js +1 -0
  391. package/dist/cli/commands/reseal.js.map +1 -1
  392. package/dist/cli/commands/resume-summary.js +5 -0
  393. package/dist/cli/commands/resume-summary.js.map +1 -1
  394. package/dist/cli/commands/resume.js +13 -3
  395. package/dist/cli/commands/resume.js.map +1 -1
  396. package/dist/cli/commands/retirement.js +1 -0
  397. package/dist/cli/commands/retirement.js.map +1 -1
  398. package/dist/cli/commands/self.js +39 -1
  399. package/dist/cli/commands/self.js.map +1 -1
  400. package/dist/cli/commands/session-artifacts.js +1 -0
  401. package/dist/cli/commands/session-artifacts.js.map +1 -1
  402. package/dist/cli/commands/session-close.js +185 -31
  403. package/dist/cli/commands/session-close.js.map +1 -1
  404. package/dist/cli/commands/session-create.js +4 -1
  405. package/dist/cli/commands/session-create.js.map +1 -1
  406. package/dist/cli/commands/session-pause.js +14 -0
  407. package/dist/cli/commands/session-pause.js.map +1 -0
  408. package/dist/cli/commands/session-resume.js +1 -0
  409. package/dist/cli/commands/session-resume.js.map +1 -1
  410. package/dist/cli/commands/sessions.js +16 -2
  411. package/dist/cli/commands/sessions.js.map +1 -1
  412. package/dist/cli/commands/set-branch.js +29 -4
  413. package/dist/cli/commands/set-branch.js.map +1 -1
  414. package/dist/cli/commands/set-edit-mode.js +20 -0
  415. package/dist/cli/commands/set-edit-mode.js.map +1 -0
  416. package/dist/cli/commands/set-pipeline.js +35 -0
  417. package/dist/cli/commands/set-pipeline.js.map +1 -0
  418. package/dist/cli/commands/settle.js +1 -0
  419. package/dist/cli/commands/settle.js.map +1 -1
  420. package/dist/cli/commands/skill-index.js +1 -0
  421. package/dist/cli/commands/skill-index.js.map +1 -1
  422. package/dist/cli/commands/skills.js +1 -0
  423. package/dist/cli/commands/skills.js.map +1 -1
  424. package/dist/cli/commands/sources.js +5 -0
  425. package/dist/cli/commands/sources.js.map +1 -1
  426. package/dist/cli/commands/stack.js +1 -0
  427. package/dist/cli/commands/stack.js.map +1 -1
  428. package/dist/cli/commands/status.js +36 -2
  429. package/dist/cli/commands/status.js.map +1 -1
  430. package/dist/cli/commands/tool.js +5 -21
  431. package/dist/cli/commands/tool.js.map +1 -1
  432. package/dist/cli/commands/unknown-flags.js +68 -16
  433. package/dist/cli/commands/unknown-flags.js.map +1 -1
  434. package/dist/cli/commands/visibility.js +2 -0
  435. package/dist/cli/commands/visibility.js.map +1 -1
  436. package/dist/cli/commands/workspace-commit.js +62 -0
  437. package/dist/cli/commands/workspace-commit.js.map +1 -0
  438. package/dist/cli/commands/workspace-init.js +51 -2
  439. package/dist/cli/commands/workspace-init.js.map +1 -1
  440. package/dist/cli/commands/workspace-migrate.js +31 -14
  441. package/dist/cli/commands/workspace-migrate.js.map +1 -1
  442. package/dist/cli/commands/workspace-move.js +42 -0
  443. package/dist/cli/commands/workspace-move.js.map +1 -0
  444. package/dist/cli/commands/worktree.js +5 -4
  445. package/dist/cli/commands/worktree.js.map +1 -1
  446. package/dist/cli/context-id.js +6 -0
  447. package/dist/cli/context-id.js.map +1 -1
  448. package/dist/cli/full-cli.js +555 -0
  449. package/dist/cli/full-cli.js.map +1 -0
  450. package/dist/cli/help-groups.js +108 -14
  451. package/dist/cli/help-groups.js.map +1 -1
  452. package/dist/cli/hook-stdin-cache.js +12 -0
  453. package/dist/cli/hook-stdin-cache.js.map +1 -0
  454. package/dist/cli/main.js +47 -471
  455. package/dist/cli/main.js.map +1 -1
  456. package/dist/cli/output-mode.js +11 -2
  457. package/dist/cli/output-mode.js.map +1 -1
  458. package/dist/cli/parser.js +18 -5
  459. package/dist/cli/parser.js.map +1 -1
  460. package/dist/cli/registry.js.map +1 -1
  461. package/dist/cli/render.js +30 -1
  462. package/dist/cli/render.js.map +1 -1
  463. package/dist/cli/tui/app.js +1 -1
  464. package/dist/cli/tui/app.js.map +1 -1
  465. package/dist/cli/tui/components/workspace-init-form.js +4 -1
  466. package/dist/cli/tui/components/workspace-init-form.js.map +1 -1
  467. package/dist/cli/tui/data/recommended-skills.js +2 -2
  468. package/dist/cli/tui/data/recommended-skills.js.map +1 -1
  469. package/dist/cli/tui/data/workflow-content.js +6 -1
  470. package/dist/cli/tui/data/workflow-content.js.map +1 -1
  471. package/dist/cli/tui/tabs/mcp-tab.js +4 -3
  472. package/dist/cli/tui/tabs/mcp-tab.js.map +1 -1
  473. package/dist/cli/tui/tabs/project-tab.js +7 -2
  474. package/dist/cli/tui/tabs/project-tab.js.map +1 -1
  475. package/dist/dist-manifest.json +4117 -0
  476. package/dist/domain/capability/protocol.js.map +1 -1
  477. package/dist/domain/decision-note.js +13 -0
  478. package/dist/domain/decision-note.js.map +1 -1
  479. package/dist/domain/design/artifact.js +22 -3
  480. package/dist/domain/design/artifact.js.map +1 -1
  481. package/dist/domain/design/capability.js +1 -0
  482. package/dist/domain/design/capability.js.map +1 -1
  483. package/dist/domain/design/expansion.js +1 -1
  484. package/dist/domain/design/expansion.js.map +1 -1
  485. package/dist/domain/design/maturity.js +16 -0
  486. package/dist/domain/design/maturity.js.map +1 -1
  487. package/dist/domain/design/reference.js +5 -0
  488. package/dist/domain/design/reference.js.map +1 -1
  489. package/dist/domain/doctor/operations.js +28 -2
  490. package/dist/domain/doctor/operations.js.map +1 -1
  491. package/dist/domain/effective-contract.js +3 -1
  492. package/dist/domain/effective-contract.js.map +1 -1
  493. package/dist/domain/elicitation.js +1 -1
  494. package/dist/domain/flow/answer.js +273 -130
  495. package/dist/domain/flow/answer.js.map +1 -1
  496. package/dist/domain/flow/authority.js +330 -44
  497. package/dist/domain/flow/authority.js.map +1 -1
  498. package/dist/domain/flow/batch-review.js +65 -0
  499. package/dist/domain/flow/batch-review.js.map +1 -0
  500. package/dist/domain/flow/decision-schema.js +47 -0
  501. package/dist/domain/flow/decision-schema.js.map +1 -0
  502. package/dist/domain/flow/directive.js +16 -0
  503. package/dist/domain/flow/directive.js.map +1 -1
  504. package/dist/domain/flow/execution-result.js +169 -9
  505. package/dist/domain/flow/execution-result.js.map +1 -1
  506. package/dist/domain/flow/route.js.map +1 -1
  507. package/dist/domain/flow/rules.js +5 -6
  508. package/dist/domain/flow/rules.js.map +1 -1
  509. package/dist/domain/flow/run-state.js +531 -47
  510. package/dist/domain/flow/run-state.js.map +1 -1
  511. package/dist/domain/flow/test-run-evidence.js +285 -0
  512. package/dist/domain/flow/test-run-evidence.js.map +1 -0
  513. package/dist/domain/flow/unchanged-phase.js +15 -0
  514. package/dist/domain/flow/unchanged-phase.js.map +1 -0
  515. package/dist/domain/harnesses.js +22 -6
  516. package/dist/domain/harnesses.js.map +1 -1
  517. package/dist/domain/isolation-unit.js +2 -2
  518. package/dist/domain/isolation-unit.js.map +1 -1
  519. package/dist/domain/lineage.js +7 -2
  520. package/dist/domain/lineage.js.map +1 -1
  521. package/dist/domain/obligation-correspondence.js +4 -2
  522. package/dist/domain/obligation-correspondence.js.map +1 -1
  523. package/dist/domain/plan-handoff.js +5 -0
  524. package/dist/domain/plan-handoff.js.map +1 -0
  525. package/dist/domain/proposal.js +18 -7
  526. package/dist/domain/proposal.js.map +1 -1
  527. package/dist/domain/reservation.js +5 -3
  528. package/dist/domain/reservation.js.map +1 -1
  529. package/dist/domain/retirement/proposal.js +1 -0
  530. package/dist/domain/retirement/proposal.js.map +1 -1
  531. package/dist/domain/session/custody.js +10 -6
  532. package/dist/domain/session/custody.js.map +1 -1
  533. package/dist/domain/session/narrative.js +4 -1
  534. package/dist/domain/session/narrative.js.map +1 -1
  535. package/dist/domain/skills.js +2 -0
  536. package/dist/domain/skills.js.map +1 -1
  537. package/dist/domain/sql-lexer.js +15 -2
  538. package/dist/domain/sql-lexer.js.map +1 -1
  539. package/dist/runtime/namespace-resolver.js +4 -0
  540. package/dist/runtime/namespace-resolver.js.map +1 -1
  541. package/dist/runtime/workline-marker.js +35 -8
  542. package/dist/runtime/workline-marker.js.map +1 -1
  543. package/dist/runtime/workspace-resolution.js +123 -0
  544. package/dist/runtime/workspace-resolution.js.map +1 -0
  545. package/package.json +5 -4
  546. package/skills/w/SKILL.md +3 -1
  547. package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +1 -1
  548. package/skills/w/artifacts/artifacts-core/SCRIPTS.rollback.sql +8 -0
  549. package/skills/w/artifacts/artifacts-core/SCRIPTS.sql +4 -8
  550. package/skills/w/commands/export-diagrams.md +3 -3
  551. package/skills/w/commands/export-manuals.md +6 -6
  552. package/skills/w/commands/export-reports.md +3 -3
  553. package/skills/w/commands/export-scripts.md +5 -5
  554. package/skills/w/commands/fix-git.md +12 -13
  555. package/skills/w/commands/persist.md +2 -2
  556. package/skills/w/commands/plan-exec.md +4 -2
  557. package/skills/w/commands/spec-new.md +1 -1
  558. package/skills/w/commands/workspace-init.md +2 -0
  559. package/skills/w/context/MANIFEST.json +1 -1
  560. package/skills/w/exports/export-diagrams/EXPORT.md +3 -3
  561. package/skills/w/exports/export-manuals/EXPORT.md +14 -16
  562. package/skills/w/exports/export-reports/EXPORT.md +3 -3
  563. package/skills/w/exports/export-scripts/EXPORT.md +45 -21
  564. package/skills/w/harness/HARNESS.md +5 -3
  565. package/skills/w/hooks/hooks.template.json +6 -4
  566. package/skills/w/loops/CHASSIS.md +12 -6
  567. package/skills/w/loops/CODE-POLICIES.md +7 -4
  568. package/skills/w/loops/plan-exec-loop/LOOP.md +23 -22
  569. package/skills/w/loops/plan-new-loop/LOOP.md +23 -31
  570. package/skills/w/loops/plan-refine-loop/LOOP.md +8 -2
  571. package/skills/w/loops/quick-loop/LOOP.md +6 -5
  572. package/skills/w/modules/DESIGN-REFERENCES.md +9 -11
  573. package/skills/w/modules/PLAN-EXECUTION-BATCHES.md +4 -4
  574. package/skills/w/modules/SESSION-NUMBERING.md +2 -0
  575. package/skills/w/roles/design/CONTRACT.md +16 -7
  576. package/skills/w/roles/design/ROLE.md +4 -2
  577. package/skills/w/roles/git/ROLE.md +16 -9
  578. package/skills/w/roles/research/ROLE.md +1 -1
  579. package/skills/w/roles/sql/ROLE.md +16 -14
  580. package/skills/w/schemas/design/ui-screen.v1.schema.json +9 -0
@@ -43,6 +43,10 @@ export function proposalContractOf(decision) {
43
43
  export function publishApprovalOf(decision) {
44
44
  return decision.publishes?.approve ?? null;
45
45
  }
46
+ /** The redraft alternative of a confirmation row and where it re-enters, or `null`. */
47
+ export function reentryOf(decision) {
48
+ return decision.reenters ?? null;
49
+ }
46
50
  /** Whether this row's answer is what fixes the run's plan and its sources. */
47
51
  export function scopesSources(decision) {
48
52
  return decision.scopes_sources === true;
@@ -139,6 +143,7 @@ export const INTERNAL_ACTION_OPERATIONS = [
139
143
  "proposal.publish",
140
144
  /** Seal the next plan-execution batch before any of its work is credited. */
141
145
  "plan-exec.batch-infer",
146
+ "plan-exec.batch-commit",
142
147
  /** Close one sealed plan-execution batch through the document/state CAS. */
143
148
  "plan-exec.batch-close",
144
149
  /** Seal a fully evidenced PLAN-exec document as done. */
@@ -164,13 +169,14 @@ export const INTERNAL_OPERATION_EFFECTS = {
164
169
  // it replaces nothing and it destroys nothing. That the CLI reaches git to make
165
170
  // it is not what the class measures — `workspace.board` already reads git the
166
171
  // same way and is `read_only`.
167
- "worktree.ensure": ["local_additive"],
172
+ "worktree.ensure": ["local_additive", "mutate_overwrite"],
168
173
  // Creating and replacing, both real — and which of the two happens is decided
169
174
  // by the proposal, not by the row: what the row declares here is the ceiling.
170
175
  "proposal.publish": ["local_additive", "mutate_overwrite"],
171
176
  // Inference writes only the run's sealed ledger. It changes no project
172
177
  // artifact and therefore has no capability-world effect to authorize.
173
178
  "plan-exec.batch-infer": [],
179
+ "plan-exec.batch-commit": ["execute", "local_additive"],
174
180
  // Batch progress always rewrites the current plan document, but only from the
175
181
  // exact before/after pair persisted in its v10 batch state.
176
182
  "plan-exec.batch-close": ["mutate_overwrite"],
@@ -451,14 +457,17 @@ const ROUTE_VALIDATION = {
451
457
  },
452
458
  risk: "la ausencia o sustitución de evidencia reduce el assurance del cierre",
453
459
  };
454
- const ROUTE_REVIEW = {
460
+ /**
461
+ * The phase validation of `plan-exec`: substitutable, never omissible. Omitting it
462
+ * would credit a batch with no proof of its own checkout at all.
463
+ */
464
+ const ROUTE_PHASE_VALIDATION = {
455
465
  recommendation: "apply",
456
466
  consequences: {
457
- apply: "se revisan los hallazgos del cambio antes de continuar",
458
- omit: "se continúa sin esa revisión y queda el riesgo aceptado",
459
- substitute: "se usa la revisión o inspección sustituta declarada",
467
+ apply: ROUTE_VALIDATION.consequences.apply,
468
+ substitute: ROUTE_VALIDATION.consequences.substitute,
460
469
  },
461
- risk: "un cambio sin revisión puede conservar defectos o deuda innecesaria",
470
+ risk: ROUTE_VALIDATION.risk,
462
471
  };
463
472
  /** The five signals of the multi-plan split gate, shared by both plan loops. */
464
473
  const PLAN_SPLIT_SIGNALS = [
@@ -713,6 +722,42 @@ export const FLOW_DECISIONS = [
713
722
  symbol: "flowControlChoices",
714
723
  },
715
724
  },
725
+ {
726
+ id: "chassis.commit-choice",
727
+ scope: CHASSIS,
728
+ title: "aprobar el commit del workspace por rutas explícitas o cerrar sin él",
729
+ authority: "human",
730
+ ownership: "cli-owned",
731
+ document: CHASSIS_MD,
732
+ attribution: CHASSIS_ATTRIBUTION,
733
+ placement: "suffix",
734
+ alternatives: [
735
+ {
736
+ label: "Cerrar sin commit",
737
+ consequence: "se archiva el mínimo y se cierra la sesión; el trabajo del workspace queda sin commitear",
738
+ recommended: true,
739
+ outcome: { kind: "continue" },
740
+ },
741
+ {
742
+ label: "Aprobar commit del workspace",
743
+ consequence: "se cierra y luego el CLI commitea solamente el pathspec y mensaje mostrados en la propuesta; nunca hace push",
744
+ recommended: false,
745
+ outcome: { kind: "continue" },
746
+ },
747
+ {
748
+ label: "Copiar evidencia y cerrar",
749
+ consequence: "se copian a la sesión las referencias existentes del scratchpad y se archivan antes de cerrar, sin commit",
750
+ recommended: false,
751
+ outcome: { kind: "continue" },
752
+ },
753
+ {
754
+ label: "Copiar evidencia y aprobar commit del workspace",
755
+ consequence: "se copia la evidencia efímera a la sesión, se archiva y entra en el commit aprobado del cierre; nunca hace push",
756
+ recommended: false,
757
+ outcome: { kind: "continue" },
758
+ },
759
+ ],
760
+ },
716
761
  {
717
762
  id: "chassis.finalize",
718
763
  scope: CHASSIS,
@@ -743,7 +788,7 @@ export const FLOW_DECISIONS = [
743
788
  execution: { kind: "internal", operation: "session.close" },
744
789
  evidence: ["chassis.sesion-cerrada"],
745
790
  idempotent: true,
746
- recovery: "una sesión que no cerró deja la corrida abierta: no la marques finalizada — reparás la fila del registro con 'aw history-update' y volvés a cerrar",
791
+ recovery: "una sesión que no cerró deja la corrida abierta: no la marques finalizada — reparás la fila del registro con 'aw history-update' y volvés a cerrar; si el cierre lo empezó 'aw session-close', volvé a correrlo: termina la corrida en su frontera conservando las unidades",
747
792
  },
748
793
  },
749
794
  // ── QUICK — the pilot tranche, and the first one this CLI decides ──────────
@@ -830,9 +875,9 @@ export const FLOW_DECISIONS = [
830
875
  alternatives: [
831
876
  {
832
877
  label: "Cambiar a SPEC",
833
- consequence: "no se crea sesión quick: la línea de trabajo pasa al flow SPEC con el objetivo original",
878
+ consequence: "se cierra la sesión quick conservando lo pendiente y se entrega el pedido a /w:spec-new",
834
879
  recommended: true,
835
- outcome: { kind: "continue" },
880
+ outcome: { kind: "handoff", destination: "spec-new" },
836
881
  },
837
882
  {
838
883
  label: "Seguir en quick",
@@ -928,7 +973,7 @@ export const FLOW_DECISIONS = [
928
973
  "quick.checkpoint-sembrado",
929
974
  ],
930
975
  idempotent: true,
931
- recovery: "sembrá lo que falte (objetivo, criterios de éxito y CHECKPOINT.Pending) y volvé a devolver el dump: sembrar de nuevo lo ya escrito no rompe nada",
976
+ recovery: "completá el objetivo y los criterios de éxito y corré aw flow advance: el CLI siembra el CHECKPOINT que falta sin reemplazar lo escrito",
932
977
  },
933
978
  },
934
979
  {
@@ -942,7 +987,12 @@ export const FLOW_DECISIONS = [
942
987
  // Same read as PLAN's, and for the same reason: `aw check-branch` with no
943
988
  // --source resolves no target and passes unconditionally.
944
989
  action: {
945
- invocation: { program: "aw", args: ["sources", "--verbose"], target: ".", input: null },
990
+ invocation: {
991
+ program: "aw",
992
+ args: ["sources", "--verbose", "--code", "{code}"],
993
+ target: ".",
994
+ input: null,
995
+ },
946
996
  execution: {
947
997
  kind: "external",
948
998
  reason: "la rama esperada de cada fuente es un veredicto sobre git, y un workspace sin fuentes declaradas no lo tiene: leerlo desde adentro diría 'verificada' donde no hay nada que verificar",
@@ -1027,12 +1077,12 @@ export const FLOW_DECISIONS = [
1027
1077
  {
1028
1078
  id: "quick.db-touched",
1029
1079
  scope: "quick",
1030
- title: "reconocer si la tarea llegó a tocar una base de datos",
1080
+ title: "reconocer si la tarea mutó una base de datos; leer no declara la señal",
1031
1081
  authority: "agent",
1032
1082
  ownership: "cli-owned",
1033
1083
  document: DB_SCRIPTS_ONLY,
1034
1084
  attribution: PLAN_ATTRIBUTION,
1035
- // A quick that never went near a database has no statement to derive and no
1085
+ // A read-only quick has no mutation statement to derive and no
1036
1086
  // `SCRIPTS.sql` to hand back, so the row below it used to demand an artifact
1037
1087
  // that should not exist. Declaring the signal is what lets the rule apply
1038
1088
  // exactly where it has something to govern.
@@ -1049,7 +1099,7 @@ export const FLOW_DECISIONS = [
1049
1099
  effects: ["local_additive"],
1050
1100
  condition: {
1051
1101
  threshold: { observed: "quick.db-touched", of: ["quick.db-touched"], min: 1 },
1052
- otherwise: "la tarea no tocó ninguna base de datos: no hay sentencia que derivar",
1102
+ otherwise: "la tarea no mutó la base de datos: las lecturas no exigen scripts",
1053
1103
  },
1054
1104
  // Migrated with the PLAN tranche and not with QUICK, for the same reason
1055
1105
  // CODE-POLICIES was: `plan-exec` reads this module too, and retiring its rule
@@ -1066,7 +1116,7 @@ export const FLOW_DECISIONS = [
1066
1116
  execution: { kind: "internal", operation: "session.artifacts", dump: ["scripts"] },
1067
1117
  evidence: ["quick.scripts-derivados"],
1068
1118
  idempotent: true,
1069
- recovery: "escribí el DDL o DML en el SCRIPTS.sql de la sesión y volvé a devolver el dump; ejecutarlo no es una alternativa que este contrato admita",
1119
+ recovery: "escribí el DDL o DML en SCRIPTS.sql o scripts/*.sql de la sesión y corré aw flow advance; si sólo leíste la base, retirá la señal con aw flow retract --session <código> --signal quick.db-touched; el CLI no ejecuta SQL",
1070
1120
  },
1071
1121
  },
1072
1122
  {
@@ -1462,6 +1512,7 @@ export const FLOW_DECISIONS = [
1462
1512
  // person would have been confirming a write that already happened. The
1463
1513
  // doctrine's own line is `edit_in_place_with_confirm(spec) + stamp`.
1464
1514
  publishes: { approve: "Aprobar y guardar" },
1515
+ reenters: { label: "Refinar", from: "spec-refine.content-authoring" },
1465
1516
  alternatives: [
1466
1517
  {
1467
1518
  label: "Aprobar y guardar",
@@ -1736,6 +1787,7 @@ export const FLOW_DECISIONS = [
1736
1787
  document: PLAN_NEW_LOOP,
1737
1788
  attribution: PLAN_ATTRIBUTION,
1738
1789
  publishes: { approve: "Aprobar y guardar" },
1790
+ reenters: { label: "Refinar", from: "plan-new.phase-shaping" },
1739
1791
  alternatives: [
1740
1792
  {
1741
1793
  label: "Aprobar y guardar",
@@ -1949,6 +2001,7 @@ export const FLOW_DECISIONS = [
1949
2001
  document: PLAN_REFINE_LOOP,
1950
2002
  attribution: PLAN_ATTRIBUTION,
1951
2003
  publishes: { approve: "Aprobar y guardar" },
2004
+ reenters: { label: "Refinar", from: "plan-refine.journey-map" },
1952
2005
  alternatives: [
1953
2006
  {
1954
2007
  label: "Aprobar y guardar",
@@ -2050,9 +2103,14 @@ export const FLOW_DECISIONS = [
2050
2103
  document: PLAN_EXEC_LOOP,
2051
2104
  attribution: PLAN_ATTRIBUTION,
2052
2105
  condition: {
2053
- threshold: { observed: "plan-exec.entry-gap-recognition", min: 1 },
2054
- otherwise: "el gate de entrada no encontró ningún hueco: no hay severidad que clasificar",
2106
+ threshold: {
2107
+ observed: "plan-exec.entry-gap-recognition",
2108
+ of: ["plan.entry-gap-structural"],
2109
+ min: 1,
2110
+ },
2111
+ otherwise: "el gate de entrada no encontró un hueco estructural: no hay que escalar",
2055
2112
  },
2113
+ handoff: { kind: "handoff", destination: "plan-refine" },
2056
2114
  },
2057
2115
  {
2058
2116
  id: "plan-exec.normalization-consent",
@@ -2088,6 +2146,23 @@ export const FLOW_DECISIONS = [
2088
2146
  },
2089
2147
  ],
2090
2148
  },
2149
+ {
2150
+ id: "plan-exec.unchanged-phase-consent",
2151
+ scope: "plan-exec",
2152
+ title: "aprobar la validación sin cambios de las fases detectadas al entrar",
2153
+ authority: "human",
2154
+ ownership: "cli-owned",
2155
+ document: PLAN_EXEC_LOOP,
2156
+ attribution: PLAN_ATTRIBUTION,
2157
+ alternatives: [
2158
+ {
2159
+ label: "Aprobar validación sin cambios",
2160
+ consequence: "se validan con evidencia real sólo las fases sin tareas abiertas observadas al entrar; no se cierra ninguna tarea y el crédito se puede anular",
2161
+ recommended: true,
2162
+ outcome: { kind: "continue" },
2163
+ },
2164
+ ],
2165
+ },
2091
2166
  {
2092
2167
  id: "plan-exec.source-scope",
2093
2168
  scope: "plan-exec",
@@ -2144,7 +2219,7 @@ export const FLOW_DECISIONS = [
2144
2219
  execution: { kind: "internal", operation: "plan-exec.batch-infer" },
2145
2220
  evidence: ["plan.batch-inferido"],
2146
2221
  idempotent: true,
2147
- recovery: "reanudá con 'aw flow advance': el batch inferido conserva su digest y sólo se vuelve a inferir si todavía no quedó sellado",
2222
+ recovery: "reanudá con 'aw flow advance'; si el plan cambió, usá 'aw flow recover --session <código> --reinfer-batch' para ver el diff antes de re-sellar el lote no publicado",
2148
2223
  },
2149
2224
  },
2150
2225
  {
@@ -2177,7 +2252,7 @@ export const FLOW_DECISIONS = [
2177
2252
  ownership: "cli-owned",
2178
2253
  document: CODE_POLICIES_MD,
2179
2254
  attribution: PLAN_ATTRIBUTION,
2180
- effects: ["local_additive"],
2255
+ effects: ["local_additive", "mutate_overwrite"],
2181
2256
  // BEFORE `plan-exec.implementation`, and the position is the whole rule: the
2182
2257
  // policy says a loop that edits code edits inside its unit, and a unit obtained
2183
2258
  // after the first write would be an isolation nobody was ever isolated by.
@@ -2364,7 +2439,7 @@ export const FLOW_DECISIONS = [
2364
2439
  document: PLAN_EXEC_LOOP,
2365
2440
  attribution: PLAN_ATTRIBUTION,
2366
2441
  effects: ["execute"],
2367
- route_control: ROUTE_VALIDATION,
2442
+ route_control: ROUTE_PHASE_VALIDATION,
2368
2443
  // Running the proofs the plan itself declares is the run verifying its own
2369
2444
  // work: custody covers the `execute`, and the real output stays mandatory.
2370
2445
  custody: "run",
@@ -2384,9 +2459,11 @@ export const FLOW_DECISIONS = [
2384
2459
  kind: "external",
2385
2460
  reason: "correr las pruebas de fase es ejecutar código, nunca una operación interna",
2386
2461
  },
2387
- evidence: ["plan.validaciones-de-fase-verdes"],
2462
+ // One proof per source of the batch: what ties the output to THIS batch's
2463
+ // checkout, so an envelope recycled from another batch cannot credit it.
2464
+ evidence: ["plan.validaciones-de-fase-verdes", SOURCE_BOUNDED_EVIDENCE],
2388
2465
  idempotent: true,
2389
- recovery: "arreglá lo que la validación reprobó y volvé a correr las pruebas afectadas: la transición sigue pendiente hasta que su salida real vuelva en verde",
2466
+ recovery: "arreglá lo que la validación reprobó y volvé a correr las pruebas afectadas: la transición sigue pendiente hasta que su salida real vuelva en verde, con una prueba 'aw flow prove --source <alias>' de cada fuente del lote tomada después de sus cambios",
2390
2467
  },
2391
2468
  },
2392
2469
  {
@@ -2406,7 +2483,57 @@ export const FLOW_DECISIONS = [
2406
2483
  ownership: "cli-owned",
2407
2484
  document: CODE_POLICIES_MD,
2408
2485
  attribution: PLAN_ATTRIBUTION,
2409
- route_control: ROUTE_REVIEW,
2486
+ answer_contract: "batch-review",
2487
+ },
2488
+ {
2489
+ id: "plan-exec.batch-commit-proposal",
2490
+ scope: "plan-exec",
2491
+ title: "proponer el mensaje de commit por fuente sobre las rutas del lote",
2492
+ authority: "agent",
2493
+ ownership: "cli-owned",
2494
+ document: PLAN_EXEC_LOOP,
2495
+ attribution: PLAN_ATTRIBUTION,
2496
+ },
2497
+ {
2498
+ id: "plan-exec.batch-commit-authorization",
2499
+ scope: "plan-exec",
2500
+ title: "aprobar los commits propuestos del lote con sus rutas y mensajes",
2501
+ authority: "human",
2502
+ ownership: "cli-owned",
2503
+ document: PLAN_EXEC_LOOP,
2504
+ attribution: PLAN_ATTRIBUTION,
2505
+ authorizes: { approve: "Aprobar los commits del lote", transition: "plan-exec.batch-commit" },
2506
+ alternatives: [
2507
+ {
2508
+ label: "Aprobar los commits del lote",
2509
+ consequence: "el CLI crea sólo los commits del lote aprobado, por fuente y por rutas",
2510
+ recommended: true,
2511
+ outcome: { kind: "continue" },
2512
+ },
2513
+ ],
2514
+ },
2515
+ {
2516
+ id: "plan-exec.batch-commit",
2517
+ scope: "plan-exec",
2518
+ title: "crear y comprobar los commits aprobados del lote",
2519
+ authority: "cli",
2520
+ ownership: "cli-owned",
2521
+ document: PLAN_EXEC_LOOP,
2522
+ attribution: PLAN_ATTRIBUTION,
2523
+ effects: ["execute", "local_additive"],
2524
+ custody: "run",
2525
+ action: {
2526
+ invocation: {
2527
+ program: "aw",
2528
+ args: ["flow", "advance", "--code", "{code}"],
2529
+ target: ".",
2530
+ input: null,
2531
+ },
2532
+ execution: { kind: "internal", operation: "plan-exec.batch-commit" },
2533
+ evidence: ["plan.batch-commits-verificados"],
2534
+ idempotent: true,
2535
+ recovery: "reanudá con aw flow advance: se reconocen los recibos y commits propios ya aplicados antes de avanzar",
2536
+ },
2410
2537
  },
2411
2538
  {
2412
2539
  id: "plan-exec.batch-close",
@@ -2432,7 +2559,7 @@ export const FLOW_DECISIONS = [
2432
2559
  execution: { kind: "internal", operation: "plan-exec.batch-close" },
2433
2560
  evidence: ["plan.batch-publicado"],
2434
2561
  idempotent: true,
2435
- recovery: "reanudá con 'aw flow advance': el batch conserva su before/after sellado y o termina exactamente esa publicación o rechaza el plan movido",
2562
+ recovery: "reanudá con 'aw flow advance'; si el plan cambió antes de publicar, mirá el diff con 'aw flow recover --session <código> --reinfer-batch' y volvé a validar el lote",
2436
2563
  },
2437
2564
  },
2438
2565
  // ── The settlement, between the last batch and the final validation ──────
@@ -2522,7 +2649,6 @@ export const FLOW_DECISIONS = [
2522
2649
  ownership: "cli-owned",
2523
2650
  document: PLAN_EXEC_LOOP,
2524
2651
  attribution: PLAN_ATTRIBUTION,
2525
- route_control: ROUTE_VALIDATION,
2526
2652
  // BEFORE Git, and the real walk is what proved it: the registry had inherited
2527
2653
  // an order where the plan was committed and only then validated and stamped.
2528
2654
  // The document says the opposite — "last Batch also runs final validation
@@ -2559,7 +2685,7 @@ export const FLOW_DECISIONS = [
2559
2685
  {
2560
2686
  id: "plan-exec.commit-authorization",
2561
2687
  scope: "plan-exec",
2562
- title: "aprobar los commits del batch o preautorizarlos condicionalmente",
2688
+ title: "aprobar los commits de una corrida heredada",
2563
2689
  authority: "human",
2564
2690
  ownership: "cli-owned",
2565
2691
  document: CODE_POLICIES_MD,
@@ -2578,12 +2704,6 @@ export const FLOW_DECISIONS = [
2578
2704
  recommended: true,
2579
2705
  outcome: { kind: "continue" },
2580
2706
  },
2581
- {
2582
- label: "Dejar el batch sin commitear",
2583
- consequence: "los cambios quedan en el árbol de trabajo y el batch se registra sin commitear en CHECKPOINT y BACKLOG",
2584
- recommended: false,
2585
- outcome: { kind: "continue" },
2586
- },
2587
2707
  ],
2588
2708
  },
2589
2709
  {
@@ -2663,7 +2783,7 @@ export const FLOW_DECISIONS = [
2663
2783
  // Integrating an already-integrated session is a no-op that reports the same
2664
2784
  // thing, which is what lets the recovery end where it started.
2665
2785
  idempotent: true,
2666
- recovery: "una unidad en conflicto conserva su merge y sus commits: resolvé con 'aw fix-git --path <fuente>' (prepare → apply → commit --confirm) y volvé a correr la integración; la transición sigue pendiente mientras la sesión conserve una unidad",
2786
+ recovery: "una unidad en conflicto conserva su merge y sus commits: resolvé con 'aw fix-git --path <ruta que reportó la integración>' (prepare → apply → commit --confirm) y volvé a correr la integración; la transición sigue pendiente mientras la sesión conserve una unidad",
2667
2787
  },
2668
2788
  },
2669
2789
  {
@@ -3035,6 +3155,14 @@ export const FLOW_DECISIONS = [
3035
3155
  * a second list: one field, one reason, one guard.
3036
3156
  */
3037
3157
  export const COMMAND_EXCLUSIONS = [
3158
+ {
3159
+ command: "workspace-commit",
3160
+ reason: "comando transversal sin corrida propia: prepare sella mensaje y pathspec del workspace y apply exige ese digest; el cierre del chasis también lo invoca sólo después del consentimiento humano",
3161
+ },
3162
+ {
3163
+ command: "workspace-move",
3164
+ reason: "mudanza o reparación puntual de un hub; valida el destino y las referencias vivas antes de mover, sin abrir una corrida adicional",
3165
+ },
3038
3166
  {
3039
3167
  command: "spec-new",
3040
3168
  reason: "comando `/w:` de una sola pasada que no abre loop: sin corrida que dirigir, su gate de división lo aplica el propio comando con la regla de modules/SPLIT-GATE.md, que por eso conserva su enunciado",
@@ -3091,8 +3219,16 @@ export const COMMAND_EXCLUSIONS = [
3091
3219
  { command: "stack", reason: "detección de stack informativa" },
3092
3220
  { command: "sources", reason: "inventario de fuentes del workspace" },
3093
3221
  { command: "set-working-branch", reason: "configuración declarativa de rama" },
3222
+ {
3223
+ command: "doc-branch",
3224
+ reason: "asociación declarativa de una rama de trabajo a un documento, con lectura sin efectos y escritura append-only después de asegurar la rama",
3225
+ },
3094
3226
  { command: "set-qa-branch", reason: "configuración declarativa de rama" },
3227
+ { command: "set-exception-branch", reason: "configuración declarativa de rama" },
3228
+ { command: "set-edit-mode", reason: "configuración declarativa del workspace" },
3229
+ { command: "set-pipeline", reason: "configuración declarativa de build y test por fuente" },
3095
3230
  { command: "remove-source", reason: "operación de configuración del workspace" },
3231
+ { command: "add-source", reason: "operación de configuración del workspace" },
3096
3232
  { command: "git-flow", reason: "utilidad de ramas sin recorrido de flow" },
3097
3233
  { command: "merge-state", reason: "lectura del estado de una fusión" },
3098
3234
  { command: "attach-multiroot", reason: "configuración de multiroot" },
@@ -3113,6 +3249,11 @@ export const COMMAND_EXCLUSIONS = [
3113
3249
  reason: "comparte la clasificación de export-reports: selección semántica del agente más corpus, numeración y escritura del CLI, con su propio destino documental",
3114
3250
  },
3115
3251
  { command: "history-update", reason: "reparación del registro durable" },
3252
+ {
3253
+ command: "session-pause",
3254
+ reason: "marca explícita de pausa por decisión humana, fuera de recorridos",
3255
+ },
3256
+ { command: "history", reason: "reconciliación de sólo lectura del registro de sesiones" },
3116
3257
  { command: "project-md-upsert", reason: "escritura del bloque de proyecto en el host" },
3117
3258
  {
3118
3259
  command: "workspace-migrate",
@@ -3163,25 +3304,42 @@ export function journeyOfFlow(flow) {
3163
3304
  const at = (placement) => transversal.filter((decision) => decision.placement === placement);
3164
3305
  return [...at("prefix"), ...decisionsOfScope(flow), ...at("suffix")];
3165
3306
  }
3307
+ const FINALIZE_TRANSITION = "chassis.finalize";
3166
3308
  /**
3167
3309
  * The actual cursor journey for a persisted run.
3168
3310
  *
3169
- * PLAN-exec alone has a repeatable middle: every sealed batch appends another
3170
- * copy of `batch-inference … batch-close` to the journey while an open phase
3171
- * remains. The cursor therefore remains a normal append-only prefix — it never
3172
- * rewinds to make a second batch look like a first one — and the final close
3173
- * simply stops adding a copy, exposing final validation, Git and `done`.
3311
+ * The registry list, with two kinds of repetition layered on it: plan-exec's
3312
+ * batch segment (see {@link batchSegments}) and the reentries the run recorded
3313
+ * (see {@link JourneyReentry}). Both only ever INSERT rows at or after the
3314
+ * cursor, so the cursor remains an append-only prefix — it never rewinds, which
3315
+ * would make already-applied transitions re-runnable.
3174
3316
  *
3175
3317
  * This intentionally accepts only the small state shape it reads, avoiding a
3176
3318
  * runtime dependency back from the authority registry to the run-state domain.
3177
3319
  */
3178
3320
  export function journeyForState(state, baseJourney) {
3321
+ return expandJourney(state, baseJourney).rows;
3322
+ }
3323
+ /** {@link journeyForState} with the reentry each row came from. */
3324
+ export function expandJourney(state, baseJourney) {
3179
3325
  // The runtime normally supplies no base, so this reads the registry directly.
3180
- // A controlled host may supply its own fixture journey: PLAN-exec still adds
3181
- // its cursor only when that journey actually contains the batch segment.
3182
- const base = baseJourney ?? journeyOfFlow(state.flow);
3183
- if (state.flow !== "plan-exec")
3184
- return base;
3326
+ // A controlled host may supply its own fixture journey.
3327
+ const source = baseJourney ?? journeyOfFlow(state.flow);
3328
+ // A run finalized by an older CLI must keep its completed cursor: inserting
3329
+ // a human gate before an already applied finalize would reinterpret its close.
3330
+ const base = state.applied?.includes(FINALIZE_TRANSITION) && !state.applied.includes("chassis.commit-choice")
3331
+ ? source.filter((row) => row.id !== "chassis.commit-choice")
3332
+ : source;
3333
+ const batched = state.flow === "plan-exec" ? batchSegments(state, base) : base;
3334
+ return withReentries(batched, base, state.reentries ?? []);
3335
+ }
3336
+ /**
3337
+ * PLAN-exec's repeatable middle: every sealed batch appends another copy of
3338
+ * `batch-eligibility-signal … batch-close` while an open phase remains, and the
3339
+ * final close simply stops adding a copy, exposing final validation, Git and
3340
+ * `done`. A fixture journey without the segment keeps its ordinary path.
3341
+ */
3342
+ function batchSegments(state, base) {
3185
3343
  const first = base.findIndex((decision) => decision.id === "plan-exec.batch-eligibility-signal");
3186
3344
  const last = base.findIndex((decision) => decision.id === "plan-exec.batch-close");
3187
3345
  // A registry build missing either boundary must keep the ordinary path rather
@@ -3208,7 +3366,9 @@ export function journeyForState(state, baseJourney) {
3208
3366
  const noWorkInferenceStarted = copies === 0 &&
3209
3367
  inference >= first &&
3210
3368
  (state.applied?.includes("plan-exec.batch-inference") === true ||
3211
- state.boundary === "plan-exec.batch-inference");
3369
+ state.boundary === "plan-exec.batch-inference" ||
3370
+ // A close there moves the boundary to its finalize; the row stood on is the same.
3371
+ (state.reentries ?? []).some((reentry) => reentry.kind === "close" && reentry.transition === "plan-exec.batch-inference"));
3212
3372
  if (noWorkInferenceStarted) {
3213
3373
  return [...base.slice(0, first), ...base.slice(first, inference + 1), ...base.slice(last + 1)];
3214
3374
  }
@@ -3223,6 +3383,132 @@ export function journeyForState(state, baseJourney) {
3223
3383
  ...base.slice(last + 1),
3224
3384
  ];
3225
3385
  }
3386
+ /**
3387
+ * Lay the recorded reentries over the journey, oldest first.
3388
+ *
3389
+ * Each one names its row as the run walked it at that moment, which is exactly
3390
+ * what replaying them in order rebuilds. A reentry whose rows this build no
3391
+ * longer has is left out rather than approximated — and so is the reopen of a
3392
+ * close left out — so the cursor check names the mismatch instead of the run
3393
+ * walking an invented stretch.
3394
+ */
3395
+ function withReentries(rows, base, reentries) {
3396
+ let journey = { rows, copies: rows.map(() => 0) };
3397
+ let cut = null;
3398
+ for (const [index, reentry] of reentries.entries()) {
3399
+ const ordinal = index + 1;
3400
+ if (reentry.kind === "refine") {
3401
+ journey = insertRedraft(journey, base, reentry, ordinal);
3402
+ }
3403
+ else if (reentry.kind === "review") {
3404
+ journey = insertReview(journey, base, reentry, ordinal);
3405
+ }
3406
+ else if (reentry.kind === "reinfer") {
3407
+ journey = insertBatchRevalidation(journey, base, reentry, ordinal);
3408
+ }
3409
+ else if (reentry.kind === "close") {
3410
+ const closed = closeAt(journey, base, reentry, ordinal);
3411
+ journey = closed?.journey ?? journey;
3412
+ cut = closed?.cut ?? "dropped";
3413
+ }
3414
+ else {
3415
+ if (cut !== "dropped")
3416
+ journey = reopen(journey, cut, reentry, ordinal);
3417
+ cut = null;
3418
+ }
3419
+ }
3420
+ return journey;
3421
+ }
3422
+ /** Index of the `occurrence`-th row of `transition`, or -1 when there is none. */
3423
+ export function occurrenceIndex(rows, transition, occurrence) {
3424
+ let seen = 0;
3425
+ for (const [index, row] of rows.entries()) {
3426
+ if (row.id !== transition)
3427
+ continue;
3428
+ seen += 1;
3429
+ if (seen === occurrence)
3430
+ return index;
3431
+ }
3432
+ return -1;
3433
+ }
3434
+ /** Which walk of its id the row at `index` is, counting from 1. */
3435
+ export function occurrenceAt(rows, index) {
3436
+ const id = rows[index]?.id;
3437
+ return rows.slice(0, index + 1).filter((row) => row.id === id).length;
3438
+ }
3439
+ function insertRedraft(journey, base, reentry, ordinal) {
3440
+ const from = base.findIndex((decision) => decision.id === reentry.from);
3441
+ const to = base.findIndex((decision) => decision.id === reentry.transition);
3442
+ const origin = occurrenceIndex(journey.rows, reentry.transition, reentry.occurrence);
3443
+ if (from < 0 || to < from || origin < 0)
3444
+ return journey;
3445
+ const at = origin + 1;
3446
+ const segment = base.slice(from, to + 1);
3447
+ return {
3448
+ rows: [...journey.rows.slice(0, at), ...segment, ...journey.rows.slice(at)],
3449
+ copies: [
3450
+ ...journey.copies.slice(0, at),
3451
+ ...segment.map(() => ordinal),
3452
+ ...journey.copies.slice(at),
3453
+ ],
3454
+ };
3455
+ }
3456
+ /** Restore required evidence immediately before a legacy pending close, even after reopening. */
3457
+ function insertReview(journey, base, reentry, ordinal) {
3458
+ const row = base.find((decision) => decision.id === "plan-exec.review-findings");
3459
+ const at = occurrenceIndex(journey.rows, reentry.transition, reentry.occurrence);
3460
+ if (row === undefined || at < 0)
3461
+ return journey;
3462
+ return {
3463
+ rows: [...journey.rows.slice(0, at), row, ...journey.rows.slice(at)],
3464
+ copies: [...journey.copies.slice(0, at), ordinal, ...journey.copies.slice(at)],
3465
+ };
3466
+ }
3467
+ /** Re-run validation and review before the uncommitted batch is published. */
3468
+ function insertBatchRevalidation(journey, base, reentry, ordinal) {
3469
+ const start = base.findIndex((decision) => decision.id === "plan-exec.validation-execution");
3470
+ const end = base.findIndex((decision) => decision.id === reentry.transition);
3471
+ const at = occurrenceIndex(journey.rows, reentry.transition, reentry.occurrence);
3472
+ if (start < 0 || end <= start || at < 0)
3473
+ return journey;
3474
+ const segment = base.slice(start, end);
3475
+ return {
3476
+ rows: [...journey.rows.slice(0, at), ...segment, ...journey.rows.slice(at)],
3477
+ copies: [
3478
+ ...journey.copies.slice(0, at),
3479
+ ...segment.map(() => ordinal),
3480
+ ...journey.copies.slice(at),
3481
+ ],
3482
+ };
3483
+ }
3484
+ function closeAt(journey, base, reentry, ordinal) {
3485
+ const finalize = base.find((decision) => decision.id === FINALIZE_TRANSITION);
3486
+ const at = occurrenceIndex(journey.rows, reentry.transition, reentry.occurrence);
3487
+ if (finalize === undefined || at < 0)
3488
+ return null;
3489
+ return {
3490
+ journey: {
3491
+ rows: [...journey.rows.slice(0, at), finalize],
3492
+ copies: [...journey.copies.slice(0, at), ordinal],
3493
+ },
3494
+ cut: { rows: journey.rows.slice(at), copies: journey.copies.slice(at) },
3495
+ };
3496
+ }
3497
+ function reopen(journey, cut, reentry, ordinal) {
3498
+ // After a close, the rows it cut are the same rows, not copies: the boundary it
3499
+ // stood on keeps its attempts, so closing and reopening never refills a budget.
3500
+ if (cut !== null) {
3501
+ return { rows: [...journey.rows, ...cut.rows], copies: [...journey.copies, ...cut.copies] };
3502
+ }
3503
+ const from = occurrenceIndex(journey.rows, reentry.transition, reentry.occurrence);
3504
+ if (from < 0)
3505
+ return journey;
3506
+ const again = journey.rows.slice(from);
3507
+ return {
3508
+ rows: [...journey.rows, ...again],
3509
+ copies: [...journey.copies, ...again.map(() => ordinal)],
3510
+ };
3511
+ }
3226
3512
  /**
3227
3513
  * The `docs/` folders a flow may write, as the chassis' boundary states them.
3228
3514
  *