@apralabs/apra-fleet 0.4.1 → 0.4.3

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 (476) hide show
  1. package/README.md +53 -12
  2. package/dist/agents/backlog-groomer.md +42 -21
  3. package/dist/agents/ci-watcher.md +14 -0
  4. package/dist/agents/deployer.md +59 -46
  5. package/dist/agents/doer.md +157 -134
  6. package/dist/agents/harvester.md +31 -32
  7. package/dist/agents/integ-test-runner.md +92 -113
  8. package/dist/agents/kb-reconciler.md +40 -42
  9. package/dist/agents/plan-reviewer.md +139 -63
  10. package/dist/agents/planner.md +176 -100
  11. package/dist/agents/regression-test-runner.md +77 -81
  12. package/dist/agents/reviewer.md +69 -85
  13. package/dist/agents/schemas/integ-test-runner-output.json +1 -1
  14. package/dist/agents/schemas/plan-reviewer-output.json +37 -0
  15. package/dist/agents/schemas/regression-test-runner-output.json +4 -17
  16. package/dist/cli/agent-transform.d.ts +83 -2
  17. package/dist/cli/agent-transform.d.ts.map +1 -1
  18. package/dist/cli/agent-transform.js +266 -21
  19. package/dist/cli/agent-transform.js.map +1 -1
  20. package/dist/cli/auth.d.ts.map +1 -1
  21. package/dist/cli/auth.js +29 -11
  22. package/dist/cli/auth.js.map +1 -1
  23. package/dist/cli/config.d.ts +7 -5
  24. package/dist/cli/config.d.ts.map +1 -1
  25. package/dist/cli/config.js +44 -43
  26. package/dist/cli/config.js.map +1 -1
  27. package/dist/cli/install.d.ts +33 -0
  28. package/dist/cli/install.d.ts.map +1 -1
  29. package/dist/cli/install.js +294 -61
  30. package/dist/cli/install.js.map +1 -1
  31. package/dist/cli/kb-directives.d.ts.map +1 -1
  32. package/dist/cli/kb-directives.js +2 -1
  33. package/dist/cli/kb-directives.js.map +1 -1
  34. package/dist/cli/register-member.d.ts.map +1 -1
  35. package/dist/cli/register-member.js +7 -3
  36. package/dist/cli/register-member.js.map +1 -1
  37. package/dist/cli/start.d.ts.map +1 -1
  38. package/dist/cli/start.js +7 -0
  39. package/dist/cli/start.js.map +1 -1
  40. package/dist/cli/uninstall.d.ts.map +1 -1
  41. package/dist/cli/uninstall.js +5 -3
  42. package/dist/cli/uninstall.js.map +1 -1
  43. package/dist/cli/watch.d.ts +26 -3
  44. package/dist/cli/watch.d.ts.map +1 -1
  45. package/dist/cli/watch.js +41 -9
  46. package/dist/cli/watch.js.map +1 -1
  47. package/dist/commands/kb-server.d.ts +3 -0
  48. package/dist/commands/kb-server.d.ts.map +1 -1
  49. package/dist/commands/kb-server.js +43 -3
  50. package/dist/commands/kb-server.js.map +1 -1
  51. package/dist/index.js +3 -3
  52. package/dist/os/git-bash-candidates.d.ts +35 -0
  53. package/dist/os/git-bash-candidates.d.ts.map +1 -0
  54. package/dist/os/git-bash-candidates.js +46 -0
  55. package/dist/os/git-bash-candidates.js.map +1 -0
  56. package/dist/os/index.d.ts +13 -4
  57. package/dist/os/index.d.ts.map +1 -1
  58. package/dist/os/index.js +17 -2
  59. package/dist/os/index.js.map +1 -1
  60. package/dist/os/linux.d.ts +6 -0
  61. package/dist/os/linux.d.ts.map +1 -1
  62. package/dist/os/linux.js +36 -3
  63. package/dist/os/linux.js.map +1 -1
  64. package/dist/os/os-commands.d.ts +68 -2
  65. package/dist/os/os-commands.d.ts.map +1 -1
  66. package/dist/os/os-commands.js.map +1 -1
  67. package/dist/os/windows-gitbash.d.ts +98 -0
  68. package/dist/os/windows-gitbash.d.ts.map +1 -0
  69. package/dist/os/windows-gitbash.js +259 -0
  70. package/dist/os/windows-gitbash.js.map +1 -0
  71. package/dist/os/windows.d.ts +6 -0
  72. package/dist/os/windows.d.ts.map +1 -1
  73. package/dist/os/windows.js +73 -8
  74. package/dist/os/windows.js.map +1 -1
  75. package/dist/providers/agy.d.ts +118 -8
  76. package/dist/providers/agy.d.ts.map +1 -1
  77. package/dist/providers/agy.js +580 -55
  78. package/dist/providers/agy.js.map +1 -1
  79. package/dist/providers/claude.d.ts +83 -4
  80. package/dist/providers/claude.d.ts.map +1 -1
  81. package/dist/providers/claude.js +365 -12
  82. package/dist/providers/claude.js.map +1 -1
  83. package/dist/providers/codex.d.ts +7 -4
  84. package/dist/providers/codex.d.ts.map +1 -1
  85. package/dist/providers/codex.js +24 -4
  86. package/dist/providers/codex.js.map +1 -1
  87. package/dist/providers/copilot.d.ts +7 -4
  88. package/dist/providers/copilot.d.ts.map +1 -1
  89. package/dist/providers/copilot.js +27 -4
  90. package/dist/providers/copilot.js.map +1 -1
  91. package/dist/providers/index.d.ts +0 -1
  92. package/dist/providers/index.d.ts.map +1 -1
  93. package/dist/providers/index.js +0 -3
  94. package/dist/providers/index.js.map +1 -1
  95. package/dist/providers/none.d.ts +7 -4
  96. package/dist/providers/none.d.ts.map +1 -1
  97. package/dist/providers/none.js +22 -4
  98. package/dist/providers/none.js.map +1 -1
  99. package/dist/providers/opencode.d.ts +6 -3
  100. package/dist/providers/opencode.d.ts.map +1 -1
  101. package/dist/providers/opencode.js +27 -4
  102. package/dist/providers/opencode.js.map +1 -1
  103. package/dist/providers/provider.d.ts +215 -11
  104. package/dist/providers/provider.d.ts.map +1 -1
  105. package/dist/providers/provider.js +58 -2
  106. package/dist/providers/provider.js.map +1 -1
  107. package/dist/services/agent-provisioner.js +2 -2
  108. package/dist/services/agent-provisioner.js.map +1 -1
  109. package/dist/services/agy-project.d.ts +102 -0
  110. package/dist/services/agy-project.d.ts.map +1 -0
  111. package/dist/services/agy-project.js +356 -0
  112. package/dist/services/agy-project.js.map +1 -0
  113. package/dist/services/auth-socket.js +4 -4
  114. package/dist/services/auth-web.js +1 -1
  115. package/dist/services/cloud/activity.js +2 -2
  116. package/dist/services/cloud/activity.js.map +1 -1
  117. package/dist/services/cloud/lifecycle.d.ts.map +1 -1
  118. package/dist/services/cloud/lifecycle.js +33 -4
  119. package/dist/services/cloud/lifecycle.js.map +1 -1
  120. package/dist/services/context-admission.d.ts.map +1 -1
  121. package/dist/services/context-admission.js +9 -7
  122. package/dist/services/context-admission.js.map +1 -1
  123. package/dist/services/credential-cleanup.d.ts.map +1 -1
  124. package/dist/services/credential-cleanup.js +47 -10
  125. package/dist/services/credential-cleanup.js.map +1 -1
  126. package/dist/services/exit-drain.d.ts +44 -0
  127. package/dist/services/exit-drain.d.ts.map +1 -0
  128. package/dist/services/exit-drain.js +52 -0
  129. package/dist/services/exit-drain.js.map +1 -0
  130. package/dist/services/github-app.d.ts.map +1 -1
  131. package/dist/services/github-app.js +32 -4
  132. package/dist/services/github-app.js.map +1 -1
  133. package/dist/services/http-transport.d.ts +1 -0
  134. package/dist/services/http-transport.d.ts.map +1 -1
  135. package/dist/services/http-transport.js +48 -1
  136. package/dist/services/http-transport.js.map +1 -1
  137. package/dist/services/knowledge/kb-config.d.ts +42 -0
  138. package/dist/services/knowledge/kb-config.d.ts.map +1 -0
  139. package/dist/services/knowledge/kb-config.js +54 -0
  140. package/dist/services/knowledge/kb-config.js.map +1 -0
  141. package/dist/services/knowledge/kb-providers.d.ts +7 -1
  142. package/dist/services/knowledge/kb-providers.d.ts.map +1 -1
  143. package/dist/services/knowledge/kb-providers.js +191 -17
  144. package/dist/services/knowledge/kb-providers.js.map +1 -1
  145. package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
  146. package/dist/services/knowledge/require-sqlite-project.d.ts.map +1 -0
  147. package/dist/services/knowledge/require-sqlite-project.js +38 -0
  148. package/dist/services/knowledge/require-sqlite-project.js.map +1 -0
  149. package/dist/services/member-home.d.ts +1 -1
  150. package/dist/services/member-home.d.ts.map +1 -1
  151. package/dist/services/member-home.js +15 -12
  152. package/dist/services/member-home.js.map +1 -1
  153. package/dist/services/model-pricing.d.ts.map +1 -1
  154. package/dist/services/model-pricing.js +7 -8
  155. package/dist/services/model-pricing.js.map +1 -1
  156. package/dist/services/orphan-recovery.d.ts +6 -3
  157. package/dist/services/orphan-recovery.d.ts.map +1 -1
  158. package/dist/services/orphan-recovery.js +17 -14
  159. package/dist/services/orphan-recovery.js.map +1 -1
  160. package/dist/services/preflight-check.js +2 -2
  161. package/dist/services/preflight-check.js.map +1 -1
  162. package/dist/services/secret-token.d.ts +38 -0
  163. package/dist/services/secret-token.d.ts.map +1 -0
  164. package/dist/services/secret-token.js +51 -0
  165. package/dist/services/secret-token.js.map +1 -0
  166. package/dist/services/service-manager/types.d.ts +3 -1
  167. package/dist/services/service-manager/types.d.ts.map +1 -1
  168. package/dist/services/service-manager/windows.d.ts +14 -2
  169. package/dist/services/service-manager/windows.d.ts.map +1 -1
  170. package/dist/services/service-manager/windows.js +65 -7
  171. package/dist/services/service-manager/windows.js.map +1 -1
  172. package/dist/services/shell-probe.d.ts +131 -0
  173. package/dist/services/shell-probe.d.ts.map +1 -0
  174. package/dist/services/shell-probe.js +210 -0
  175. package/dist/services/shell-probe.js.map +1 -0
  176. package/dist/services/singleton.d.ts +2 -0
  177. package/dist/services/singleton.d.ts.map +1 -1
  178. package/dist/services/singleton.js +1 -1
  179. package/dist/services/singleton.js.map +1 -1
  180. package/dist/services/ssh.d.ts.map +1 -1
  181. package/dist/services/ssh.js +60 -4
  182. package/dist/services/ssh.js.map +1 -1
  183. package/dist/services/stall/find-log-file.d.ts.map +1 -1
  184. package/dist/services/stall/find-log-file.js +22 -16
  185. package/dist/services/stall/find-log-file.js.map +1 -1
  186. package/dist/services/stall/read-log-tail.d.ts.map +1 -1
  187. package/dist/services/stall/read-log-tail.js +26 -15
  188. package/dist/services/stall/read-log-tail.js.map +1 -1
  189. package/dist/services/stall/stall-detector.d.ts +53 -4
  190. package/dist/services/stall/stall-detector.d.ts.map +1 -1
  191. package/dist/services/stall/stall-detector.js +212 -34
  192. package/dist/services/stall/stall-detector.js.map +1 -1
  193. package/dist/services/stall/stall-poller.d.ts.map +1 -1
  194. package/dist/services/stall/stall-poller.js +35 -42
  195. package/dist/services/stall/stall-poller.js.map +1 -1
  196. package/dist/services/strategy.d.ts +9 -0
  197. package/dist/services/strategy.d.ts.map +1 -1
  198. package/dist/services/strategy.js +119 -8
  199. package/dist/services/strategy.js.map +1 -1
  200. package/dist/services/substitution-engine.js +2 -2
  201. package/dist/services/substitution-engine.js.map +1 -1
  202. package/dist/services/tool-registry.d.ts.map +1 -1
  203. package/dist/services/tool-registry.js +5 -3
  204. package/dist/services/tool-registry.js.map +1 -1
  205. package/dist/services/user-config.js +1 -1
  206. package/dist/services/user-config.js.map +1 -1
  207. package/dist/services/vcs/azure-devops.d.ts +67 -2
  208. package/dist/services/vcs/azure-devops.d.ts.map +1 -1
  209. package/dist/services/vcs/azure-devops.js +281 -15
  210. package/dist/services/vcs/azure-devops.js.map +1 -1
  211. package/dist/services/vcs/bitbucket.d.ts.map +1 -1
  212. package/dist/services/vcs/bitbucket.js +16 -0
  213. package/dist/services/vcs/bitbucket.js.map +1 -1
  214. package/dist/services/vcs/github.d.ts.map +1 -1
  215. package/dist/services/vcs/github.js +24 -0
  216. package/dist/services/vcs/github.js.map +1 -1
  217. package/dist/services/vcs/types.d.ts +123 -2
  218. package/dist/services/vcs/types.d.ts.map +1 -1
  219. package/dist/skills/fleet-sprint-cli/SKILL.md +20 -1
  220. package/dist/skills/pm/SKILL.md +1 -2
  221. package/dist/skills/pm/cost.md +0 -4
  222. package/dist/skills/pm/fleet-addendum.md +2 -3
  223. package/dist/tools/check-status.d.ts +7 -4
  224. package/dist/tools/check-status.d.ts.map +1 -1
  225. package/dist/tools/check-status.js +5 -3
  226. package/dist/tools/check-status.js.map +1 -1
  227. package/dist/tools/cloud-control.js +2 -2
  228. package/dist/tools/cloud-control.js.map +1 -1
  229. package/dist/tools/compose-permissions.d.ts +6 -0
  230. package/dist/tools/compose-permissions.d.ts.map +1 -1
  231. package/dist/tools/compose-permissions.js +211 -50
  232. package/dist/tools/compose-permissions.js.map +1 -1
  233. package/dist/tools/credential-store-set.js +1 -1
  234. package/dist/tools/execute-command.d.ts.map +1 -1
  235. package/dist/tools/execute-command.js +56 -29
  236. package/dist/tools/execute-command.js.map +1 -1
  237. package/dist/tools/execute-prompt.d.ts +15 -2
  238. package/dist/tools/execute-prompt.d.ts.map +1 -1
  239. package/dist/tools/execute-prompt.js +1214 -873
  240. package/dist/tools/execute-prompt.js.map +1 -1
  241. package/dist/tools/kb-capture.d.ts +2 -2
  242. package/dist/tools/kb-capture.d.ts.map +1 -1
  243. package/dist/tools/kb-capture.js +29 -5
  244. package/dist/tools/kb-capture.js.map +1 -1
  245. package/dist/tools/kb-export.d.ts +2 -2
  246. package/dist/tools/kb-export.d.ts.map +1 -1
  247. package/dist/tools/kb-export.js +3 -28
  248. package/dist/tools/kb-export.js.map +1 -1
  249. package/dist/tools/kb-feedback.d.ts.map +1 -1
  250. package/dist/tools/kb-feedback.js +3 -1
  251. package/dist/tools/kb-feedback.js.map +1 -1
  252. package/dist/tools/kb-freshness-sweep.d.ts.map +1 -1
  253. package/dist/tools/kb-freshness-sweep.js +3 -1
  254. package/dist/tools/kb-freshness-sweep.js.map +1 -1
  255. package/dist/tools/kb-import.d.ts.map +1 -1
  256. package/dist/tools/kb-import.js +2 -1
  257. package/dist/tools/kb-import.js.map +1 -1
  258. package/dist/tools/kb-list.d.ts.map +1 -1
  259. package/dist/tools/kb-list.js +3 -1
  260. package/dist/tools/kb-list.js.map +1 -1
  261. package/dist/tools/kb-query.d.ts +2 -2
  262. package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -1
  263. package/dist/tools/kb-reconcile-prefilter.js +3 -1
  264. package/dist/tools/kb-reconcile-prefilter.js.map +1 -1
  265. package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -1
  266. package/dist/tools/kb-resolve-contradiction.js +3 -1
  267. package/dist/tools/kb-resolve-contradiction.js.map +1 -1
  268. package/dist/tools/kb-setup.d.ts.map +1 -1
  269. package/dist/tools/kb-setup.js +125 -20
  270. package/dist/tools/kb-setup.js.map +1 -1
  271. package/dist/tools/kb-stats.d.ts.map +1 -1
  272. package/dist/tools/kb-stats.js +64 -43
  273. package/dist/tools/kb-stats.js.map +1 -1
  274. package/dist/tools/list-members.d.ts +2 -2
  275. package/dist/tools/list-members.d.ts.map +1 -1
  276. package/dist/tools/list-members.js +7 -2
  277. package/dist/tools/list-members.js.map +1 -1
  278. package/dist/tools/member-detail.d.ts +2 -2
  279. package/dist/tools/member-detail.d.ts.map +1 -1
  280. package/dist/tools/member-detail.js +22 -3
  281. package/dist/tools/member-detail.js.map +1 -1
  282. package/dist/tools/member-reservation.d.ts +58 -1
  283. package/dist/tools/member-reservation.d.ts.map +1 -1
  284. package/dist/tools/member-reservation.js +71 -18
  285. package/dist/tools/member-reservation.js.map +1 -1
  286. package/dist/tools/monitor-task.d.ts.map +1 -1
  287. package/dist/tools/monitor-task.js +17 -2
  288. package/dist/tools/monitor-task.js.map +1 -1
  289. package/dist/tools/provision-auth.d.ts +80 -1
  290. package/dist/tools/provision-auth.d.ts.map +1 -1
  291. package/dist/tools/provision-auth.js +147 -59
  292. package/dist/tools/provision-auth.js.map +1 -1
  293. package/dist/tools/provision-vcs-auth.d.ts +96 -3
  294. package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
  295. package/dist/tools/provision-vcs-auth.js +254 -88
  296. package/dist/tools/provision-vcs-auth.js.map +1 -1
  297. package/dist/tools/register-member.d.ts +21 -12
  298. package/dist/tools/register-member.d.ts.map +1 -1
  299. package/dist/tools/register-member.js +141 -16
  300. package/dist/tools/register-member.js.map +1 -1
  301. package/dist/tools/remove-member.d.ts.map +1 -1
  302. package/dist/tools/remove-member.js +29 -4
  303. package/dist/tools/remove-member.js.map +1 -1
  304. package/dist/tools/revoke-vcs-auth.js +2 -2
  305. package/dist/tools/revoke-vcs-auth.js.map +1 -1
  306. package/dist/tools/send-email.d.ts +2 -2
  307. package/dist/tools/setup-git-app.d.ts.map +1 -1
  308. package/dist/tools/setup-git-app.js +11 -7
  309. package/dist/tools/setup-git-app.js.map +1 -1
  310. package/dist/tools/setup-ssh-key.d.ts.map +1 -1
  311. package/dist/tools/setup-ssh-key.js +2 -1
  312. package/dist/tools/setup-ssh-key.js.map +1 -1
  313. package/dist/tools/shutdown-server.d.ts +2 -0
  314. package/dist/tools/shutdown-server.d.ts.map +1 -1
  315. package/dist/tools/shutdown-server.js +23 -1
  316. package/dist/tools/shutdown-server.js.map +1 -1
  317. package/dist/tools/stop-prompt.js +2 -2
  318. package/dist/tools/stop-prompt.js.map +1 -1
  319. package/dist/tools/update-agent-cli.js +2 -2
  320. package/dist/tools/update-agent-cli.js.map +1 -1
  321. package/dist/tools/update-member.d.ts +21 -12
  322. package/dist/tools/update-member.d.ts.map +1 -1
  323. package/dist/tools/update-member.js +61 -12
  324. package/dist/tools/update-member.js.map +1 -1
  325. package/dist/tools/vcs-credential-exec.d.ts +127 -0
  326. package/dist/tools/vcs-credential-exec.d.ts.map +1 -0
  327. package/dist/tools/vcs-credential-exec.js +197 -0
  328. package/dist/tools/vcs-credential-exec.js.map +1 -0
  329. package/dist/types.d.ts +24 -1
  330. package/dist/types.d.ts.map +1 -1
  331. package/dist/utils/agent-helpers.d.ts +36 -0
  332. package/dist/utils/agent-helpers.d.ts.map +1 -1
  333. package/dist/utils/agent-helpers.js +39 -1
  334. package/dist/utils/agent-helpers.js.map +1 -1
  335. package/dist/utils/log-helpers.d.ts.map +1 -1
  336. package/dist/utils/log-helpers.js +2 -2
  337. package/dist/utils/log-helpers.js.map +1 -1
  338. package/dist/utils/platform.d.ts +7 -0
  339. package/dist/utils/platform.d.ts.map +1 -1
  340. package/dist/utils/platform.js +11 -1
  341. package/dist/utils/platform.js.map +1 -1
  342. package/dist/utils/prompt-errors.d.ts.map +1 -1
  343. package/dist/utils/prompt-errors.js +7 -1
  344. package/dist/utils/prompt-errors.js.map +1 -1
  345. package/dist/utils/shell-escape.d.ts +16 -0
  346. package/dist/utils/shell-escape.d.ts.map +1 -1
  347. package/dist/utils/shell-escape.js +22 -2
  348. package/dist/utils/shell-escape.js.map +1 -1
  349. package/dist/utils/vcs-provider-detect.d.ts +65 -0
  350. package/dist/utils/vcs-provider-detect.d.ts.map +1 -0
  351. package/dist/utils/vcs-provider-detect.js +109 -0
  352. package/dist/utils/vcs-provider-detect.js.map +1 -0
  353. package/dist/utils/workspace-trust.d.ts +20 -17
  354. package/dist/utils/workspace-trust.d.ts.map +1 -1
  355. package/dist/utils/workspace-trust.js +91 -1
  356. package/dist/utils/workspace-trust.js.map +1 -1
  357. package/dist/workflows/auto-sprint.js +180 -32
  358. package/package.json +7 -5
  359. package/packages/apra-fleet-client/src/client/api.mjs +403 -12
  360. package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
  361. package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
  362. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +42 -21
  363. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +14 -0
  364. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +59 -46
  365. package/packages/apra-fleet-se/apra-pm/agents/doer.md +157 -134
  366. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +31 -32
  367. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +92 -113
  368. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +40 -42
  369. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +139 -63
  370. package/packages/apra-fleet-se/apra-pm/agents/planner.md +176 -100
  371. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +77 -81
  372. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +69 -85
  373. package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +1 -1
  374. package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
  375. package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +4 -17
  376. package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -2
  377. package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -4
  378. package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -3
  379. package/packages/apra-fleet-se/bin/cli.mjs +280 -3
  380. package/packages/apra-fleet-se/bin/serve.mjs +114 -5
  381. package/packages/apra-fleet-se/fleet-sprint/abort.mjs +481 -0
  382. package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +491 -0
  383. package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +282 -0
  384. package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +208 -0
  385. package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +638 -0
  386. package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +301 -0
  387. package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
  388. package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +8 -0
  389. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +199 -34
  390. package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +516 -0
  391. package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +184 -0
  392. package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1121 -0
  393. package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
  394. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +23 -8
  395. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-manual-recovery-verified.md +10 -8
  396. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +285 -4
  397. package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +3 -3
  398. package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
  399. package/packages/apra-fleet-se/fleet-sprint/docs/shared-orchestrator-reservation-design.md +12 -12
  400. package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +14 -4
  401. package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
  402. package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +275 -99
  403. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1054 -39
  404. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +308 -0
  405. package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
  406. package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
  407. package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
  408. package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +556 -0
  409. package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +495 -0
  410. package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +564 -0
  411. package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
  412. package/packages/apra-fleet-se/fleet-sprint/kb.mjs +728 -0
  413. package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
  414. package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +252 -0
  415. package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +581 -0
  416. package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
  417. package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
  418. package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
  419. package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +136 -0
  420. package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +822 -0
  421. package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +294 -0
  422. package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +403 -0
  423. package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +180 -0
  424. package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
  425. package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +390 -0
  426. package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +323 -0
  427. package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +232 -0
  428. package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +174 -0
  429. package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +197 -0
  430. package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +305 -0
  431. package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +559 -0
  432. package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1416 -0
  433. package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
  434. package/packages/apra-fleet-se/fleet-sprint/runner.js +1672 -9072
  435. package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +134 -0
  436. package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +159 -0
  437. package/packages/apra-fleet-se/fleet-sprint/se-windows-gitbash.mjs +97 -0
  438. package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +143 -0
  439. package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +304 -0
  440. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +20 -1
  441. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +21 -2
  442. package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +454 -0
  443. package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +239 -0
  444. package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +163 -0
  445. package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
  446. package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +211 -0
  447. package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1279 -0
  448. package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +204 -19
  449. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +707 -12
  450. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
  451. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +33 -4
  452. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +191 -43
  453. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +333 -6
  454. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +165 -0
  455. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +167 -37
  456. package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
  457. package/packages/apra-fleet-se/package.json +1 -1
  458. package/packages/apra-fleet-workflow/src/viewer/index.mjs +178 -1
  459. package/packages/apra-fleet-workflow/src/workflow/index.mjs +478 -32
  460. package/skills/fleet/SKILL.md +27 -16
  461. package/skills/fleet/auth-azdevops.md +57 -7
  462. package/skills/fleet/auth-bitbucket.md +5 -5
  463. package/skills/fleet/auth-github.md +7 -6
  464. package/skills/fleet/beads-conflict-resolution.md +141 -0
  465. package/skills/fleet/beads.md +16 -12
  466. package/skills/fleet/onboarding.md +6 -6
  467. package/skills/fleet/permissions.md +11 -7
  468. package/skills/fleet/profiles/node.json +1 -1
  469. package/skills/fleet/skill-matrix.md +1 -1
  470. package/skills/fleet/troubleshooting.md +4 -3
  471. package/version.json +1 -1
  472. package/dist/providers/gemini.d.ts +0 -52
  473. package/dist/providers/gemini.d.ts.map +0 -1
  474. package/dist/providers/gemini.js +0 -236
  475. package/dist/providers/gemini.js.map +0 -1
  476. package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +0 -23
@@ -0,0 +1,174 @@
1
+ // =============================================================================
2
+ // PHASE MODULE: Regression Test (apra-fleet-3swo.6.6).
3
+ //
4
+ // The TENTH of runSprintCycle's twelve phase() boundaries -- the sprint's
5
+ // standing, once-per-sprint confidence check that EXISTING functionality still
6
+ // works. Moved verbatim out of runner.js: every prompt, log line and dispatch
7
+ // option is byte-identical to the inline version, so the golden transcript is
8
+ // unchanged. Move-only, no behaviour change.
9
+ //
10
+ // WHERE THIS PHASE STARTS AND STOPS. It is the body of the
11
+ // `if (hasRegressionPlaybook)` branch, and nothing else. The
12
+ // probeFileExists('regression-test-playbook.md') call that PRODUCES
13
+ // hasRegressionPlaybook, the `let regressionResult = null` it defaults to, and
14
+ // the "Skipping Regression Test Phase" else branch all stay in runner.js --
15
+ // exactly as ./deploy.mjs's deploy.md probe and ./integ-test.mjs's runbook
16
+ // probes stayed behind. The trailing `await updateDashboard()` inside that
17
+ // branch comes WITH the phase, same as ./integ-test.mjs's does.
18
+ //
19
+ // WHY IT SITS WHERE IT SITS -- THIS IS THE SAFETY PROPERTY, NOT A PREFERENCE.
20
+ // This phase runs AFTER Final Review and BEFORE Harvest, and both halves of
21
+ // that sandwich are load-bearing:
22
+ //
23
+ // - After Final Review, because `finalVerdictResult` is ALREADY COMPUTED by
24
+ // the time this runs -- so a regression failure structurally CANNOT perturb
25
+ // the sprint's verdict. No LLM-trusted "please ignore this" instruction is
26
+ // needed; the ordering IS the guarantee. That guarantee is enforced by TWO
27
+ // TEST PINS, not by the language: this phase never so much as NAMES
28
+ // finalVerdictResult, so there is no binding for a hoist above Final Review
29
+ // to trip a ReferenceError on -- verified by experiment (apra-fleet-3swo.38)
30
+ // that hoisting this phase's call site above Final Review runs to
31
+ // completion with no error. test/regression-phase-never-gates.test.mjs's
32
+ // source-shape ordering pin and the A/B mock sprint in
33
+ // test/mock-sprint-regression-failure-never-gates.test.mjs are what
34
+ // actually hold the line; ./final-review.mjs RETURNING finalVerdictResult
35
+ // to runner.js documents the intended order for a reader, it does not
36
+ // enforce it.
37
+ // - Before Harvest, because the harvester writes
38
+ // docs/sprint-analysis-<slug>.md and this phase's summary is folded into
39
+ // that document as an informational section (see buildAnalysisText).
40
+ //
41
+ // Its failures are filed as STANDALONE, PARENT-LESS `[regression][carry-over]`
42
+ // beads: bdListScoped() builds the sprint's scope tree by walking `.parent`
43
+ // edges only, so a parent-less bead is mechanically invisible to openAtGoal /
44
+ // finalOpenAtGoal, and a regression failure therefore carries over to a future
45
+ // sprint instead of retroactively blocking the sprint that happened to find it.
46
+ //
47
+ // NO CATCH BLOCK HERE, BY DESIGN. This phase is informational and must never
48
+ // abort the sprint, but the soft-fail that guarantees it is NOT a try/catch in
49
+ // this file -- it is the 'regression-test-runner' row's catch-all degrade in
50
+ // ../role-policies.mjs, executed by ../dispatch-role.mjs (apra-fleet-3swo.5.7).
51
+ // Do not reintroduce a local catch: the row already enumerates every class it
52
+ // fabricates a summary for, states that unrecognised classes degrade too, and
53
+ // names the only two signals it deliberately rethrows (an operator cancellation
54
+ // and a blown spend ceiling, both RUN-level control signals rather than "the
55
+ // regression phase failed"). See the comment kept at the dispatch below.
56
+ //
57
+ // WHY ITS HELPERS ARE INJECTED RATHER THAN IMPORTED. dispatchCtx,
58
+ // getMemberForRole, ensureUnattendedAuto, ensureDeployPermissions,
59
+ // updateDashboard and sprintSelfIdLine are all runSprintCycle-scoped locals, so
60
+ // there is nothing to import; dispatchRole/TURN_BASES live in a real sibling
61
+ // module and are imported directly.
62
+ //
63
+ // GUARD COVERAGE: registered as 'phases/regression-test.mjs' in
64
+ // ../guarded-modules.mjs. It took NO member_name-bearing command() call site
65
+ // out of runner.js -- it issues no bd/git command of its own; the carry-over
66
+ // beads are filed by the DISPATCHED runner inside its own repo -- but it took
67
+ // ONE dispatchRole() site (the regression-test-runner ladder), which is exactly
68
+ // what dispatch-safety-guard and the phase 3 dispatch census read. Both
69
+ // baselines are pinned rather than assumed.
70
+ // =============================================================================
71
+
72
+ import { dispatchRole, TURN_BASES } from '../dispatch-role.mjs';
73
+
74
+ /**
75
+ * Runs the once-per-sprint Regression Test phase. Informational: its result
76
+ * never gates the sprint (see this file's header for why the ordering, not a
77
+ * flag, is what guarantees that).
78
+ *
79
+ * @param {object} state Explicit phase state; see this file's header.
80
+ * @returns {Promise<{ regressionResult: object|null }>} The regression report
81
+ * the dispatched runner returned (or the policy row's degraded stand-in),
82
+ * which runner.js folds into the sprint analysis document.
83
+ */
84
+ export async function runRegressionTestPhase({
85
+ // Presentation + dispatch seams.
86
+ phase,
87
+ log,
88
+ dispatchCtx,
89
+ // Sprint identity/config.
90
+ finalCycleLabel,
91
+ sprintSelfIdLine,
92
+ // Reassigned, so passed in and returned (see header).
93
+ regressionResult,
94
+ // runSprintCycle-scoped locals, injected rather than imported (see header).
95
+ getMemberForRole,
96
+ ensureUnattendedAuto,
97
+ ensureDeployPermissions,
98
+ updateDashboard,
99
+ }) {
100
+ phase(`Regression Test C${finalCycleLabel}`);
101
+ await ensureUnattendedAuto(getMemberForRole('regression-test-runner'));
102
+ await ensureDeployPermissions(getMemberForRole('regression-test-runner'));
103
+ // The real functional suite alone spends roughly one turn per liveness
104
+ // poll for the better part of an hour, and this single dispatch carries
105
+ // both it and the sandbox smoke sprint -- hence the large turn budget
106
+ // and the wider hard ceiling.
107
+ const regressionPrompt =
108
+ `Run the full regression pass using regression-test-playbook.md at the repo root: part 1 ` +
109
+ `(the real functional suite) and part 2 (the sandbox smoke test), then ALWAYS run the ` +
110
+ `playbook's Teardown before returning, pass or fail. ` +
111
+ `File every failure you find as a STANDALONE bead: run bd create WITHOUT any --parent flag ` +
112
+ `and do NOT bd dep add it to any sprint bead, titled "[regression][carry-over] <description>". ` +
113
+ `Search bd for "[carry-over]" first and update an existing bead rather than filing a duplicate. ` +
114
+ `Filing these parent-less is what makes them carry over to a future sprint instead of blocking ` +
115
+ `this one -- do not "helpfully" parent them under a sprint bead. ` +
116
+ `This sprint's verdict has already been decided and your result is informational: report it ` +
117
+ `honestly, and never soften a failure because the sprint has otherwise passed.\n` +
118
+ // Same generic hand-off as the integ prompt: a leftover isolated
119
+ // test instance from this sprint's deploy (Deploy succeeded but
120
+ // Integ Test never ran) is the playbook's to sweep, keyed on the id.
121
+ `${sprintSelfIdLine}\n` +
122
+ `If an isolated test instance from this sprint's deploy is still up, the playbook says how to ` +
123
+ `locate it from that id; tear it down too before you return.`;
124
+ // apra-fleet-3swo.5.7: the regression ladder -- its dispatch, its
125
+ // pushBeads git-sync bracket, its max_turns-exhaustion resume at
126
+ // doubled turns, its refusal to re-dispatch a pass that already ran,
127
+ // and its load-bearing CATCH-ALL degrade -- is now the
128
+ // 'regression-test-runner' row of fleet-sprint/role-policies.mjs.
129
+ //
130
+ // WHY THE CATCH-ALL IS POLICY DATA AND NOT A try/catch HERE: this
131
+ // phase is informational and must never abort the sprint. The dispatch
132
+ // is bracketed with pushBeads:true, and this is the ONE phase whose
133
+ // whole job is mutating beads (filing carry-over bugs), so a D-push
134
+ // failure is a routine outcome. Among the classes it can throw are
135
+ // typed sprint aborts (GitDivergedError, DoltDivergedError bare or
136
+ // wrapped in a PostDispatchSyncError) -- without the catch-all the
137
+ // top-level handler would turn one into a terminal verdict:'ABORTED',
138
+ // skipping Harvest AND Publish PR and discarding an already-computed
139
+ // finalVerdictResult. A green sprint would be reported as ABORTED
140
+ // because an informational pass could not push a bug bead. The row
141
+ // says all of that as data: degrade.classes lists all four error
142
+ // classes it fabricates a summary for, and
143
+ // degrade.classifiesUnrecognisedErrors is what stops an unknown class
144
+ // from escaping.
145
+ //
146
+ // Two deliberate exceptions, both RUN-level control signals rather than
147
+ // "the regression phase failed", recorded as
148
+ // degrade.rethrowsRunControlSignals: CancelledError (honouring an
149
+ // operator cancellation outranks finishing an informational phase) and
150
+ // BudgetExceededError (swallowing a blown spend ceiling would let
151
+ // Harvest keep spending past a limit the operator set).
152
+ const regressionOutcome = await dispatchRole(dispatchCtx, 'regression-test-runner', {
153
+ prompt: regressionPrompt,
154
+ // A resume DELIVERS A NEW prompt artifact, so restate the
155
+ // dispatch's scope/filing rules -- a bare "continue" would lose the
156
+ // parent-less filing rule, which is the whole point of this phase.
157
+ resumePrompt:
158
+ 'Continue the regression pass exactly where you left off in this same session -- do not restart the playbook or rebuild the sandbox if it is already up. Finish the remaining work, run Teardown, and return your final report now. ' +
159
+ 'Your original instructions, restated so a resumed dispatch never loses them: ' + regressionPrompt,
160
+ roleLabel: 'Regression Test Runner',
161
+ resumeLabel: `Regression Test (resume, max_turns=${TURN_BASES.REGRESSION_TEST_MAX_TURNS * 2})`,
162
+ });
163
+ regressionResult = regressionOutcome.value;
164
+ // No duplicate log() dump -- see dispatchReview() for why. Only an
165
+ // explicit passed:true is treated as a green regression pass.
166
+ if (regressionResult.passed !== true) {
167
+ log(`Regression pass reported FAILURES (carry-over beads: ${(regressionResult.bugsFiled || []).join(', ') || 'none'}): ${regressionResult.summary}`);
168
+ } else {
169
+ log(`Regression pass PASSED (suite: ${regressionResult.suitePassed}, smoke: ${regressionResult.smokePassed}).`);
170
+ }
171
+ await updateDashboard();
172
+
173
+ return { regressionResult };
174
+ }
@@ -0,0 +1,197 @@
1
+ // =============================================================================
2
+ // PHASE MODULE: Replan (apra-fleet-3swo.6.7).
3
+ //
4
+ // The THIRD of runSprintCycle's twelve phase() boundaries -- the IN-CYCLE
5
+ // SCOPED REPLAN. It fires inside the Develop/Review round loop, on the FIRST
6
+ // round in which a still-ready bead carries a reviewer `replanIds` flag: the
7
+ // bead is reopened, but its ACCEPTANCE CRITERIA are themselves defective, so
8
+ // re-development cannot satisfy them. Rather than defer to the next cycle's
9
+ // full planner, this phase dispatches a planner pass scoped to exactly those
10
+ // beads' subtree plus a scoped plan-review of the result, then hands control
11
+ // back to the round loop so an APPROVED amendment is re-dispatched to a doer
12
+ // in this same cycle. Moved verbatim out of runner.js: every prompt, log
13
+ // line, dispatch option and sync call is byte-identical to the inline
14
+ // version, so the golden transcript is unchanged. Move-only, no behaviour
15
+ // change.
16
+ //
17
+ // WHERE THIS PHASE STARTS AND STOPS. It is the body of the round loop's
18
+ // `if (eligibleReplan.length > 0)` branch, and nothing else. The eligibility
19
+ // filter itself (`replanIds` minus `replannedThisCycle`) and the `continue`
20
+ // that restarts the round loop stay in runner.js: the filter decides whether
21
+ // this phase runs at all, and `continue` is loop control that cannot be
22
+ // expressed from inside a function. The "replan short-circuit" block that
23
+ // follows the branch is NOT part of this phase -- it emits no phase() of its
24
+ // own, it `break`s the round loop, and it computes `currentReady`, which is
25
+ // the Develop phase's input.
26
+ //
27
+ // WHY devRounds IS PASSED IN ALREADY INCREMENTED. `devRounds` is a round-loop
28
+ // local that this phase used to increment before labelling itself. A replan
29
+ // pass CONSUMES one develop round -- that is what stops a replan<->develop
30
+ // ping-pong outrunning the round cap -- so the increment stays in runner.js
31
+ // next to the loop variable it belongs to, and the incremented value arrives
32
+ // here purely to build the `Replan C{cycle} R{devRounds}` label. The order of
33
+ // the two statements is the only thing that changed and neither reads the
34
+ // other.
35
+ //
36
+ // EXPLICIT STATE, NOT A CLOSURE. The inline version read its inputs off the
37
+ // enclosing runSprintCycle/round-loop scope; they arrive as one explicit
38
+ // state argument now. Two of them -- `replanIds` and `replannedThisCycle` --
39
+ // are Sets this phase MUTATES IN PLACE (mark-before-attempt, then clear on an
40
+ // approved amendment). Passing the Set objects themselves is exactly
41
+ // equivalent to the closure they replace: neither binding is ever reassigned,
42
+ // only added to and deleted from, so runner.js observes every mutation
43
+ // without anything being threaded back. That is why this phase, unlike
44
+ // phases/plan.mjs, returns nothing.
45
+ //
46
+ // WHY NOTHING IS INJECTED HERE. Every dependency this phase has lives in a
47
+ // real sibling module (dispatchRole, the two prompt builders) or is a seam
48
+ // already passed to every phase, so -- unlike phases/plan.mjs -- there are no
49
+ // runner.js-exported helpers to route around a circular import.
50
+ //
51
+ // GUARD COVERAGE: registered as 'phases/replan.mjs' in ../guarded-modules.mjs.
52
+ // It carries NO command() call site of its own (its only repo-side effect is
53
+ // the shared gitSync bracket below) plus the two dispatchRole call sites for
54
+ // the scoped planner and scoped plan-reviewer ladders.
55
+ // =============================================================================
56
+
57
+ import { dispatchRole } from '../dispatch-role.mjs';
58
+ import { buildPlannerPrompt, buildPlanReviewerPrompt } from '../prompts.mjs';
59
+
60
+ /**
61
+ * Runs the in-cycle scoped Replan phase for ONE develop round.
62
+ *
63
+ * @param {object} state Explicit phase state; see this file's header.
64
+ * @returns {Promise<void>} Nothing: the only outputs are the in-place
65
+ * mutations of `replanIds`/`replannedThisCycle` described in the header,
66
+ * which runner.js's round loop reads back off its own bindings.
67
+ */
68
+ export async function runReplanPhase({
69
+ // Presentation + dispatch seams.
70
+ phase,
71
+ log,
72
+ dispatchCtx,
73
+ // Sprint identity/config.
74
+ cycle,
75
+ validated,
76
+ targetIssues,
77
+ requirementsContent,
78
+ orchestratorMember,
79
+ // The git/beads sync bracket the post-replan D-push goes through, plus the
80
+ // dashboard refresh that follows it.
81
+ gitSync,
82
+ updateDashboard,
83
+ // Per-cycle inputs.
84
+ verifySetThisCycle,
85
+ pendingRejectedNewTasks,
86
+ // Per-round inputs. `devRounds` arrives already incremented (see header);
87
+ // `replanIds` and `replannedThisCycle` are mutated in place.
88
+ devRounds,
89
+ eligibleReplan,
90
+ replanIds,
91
+ replannedThisCycle,
92
+ }) {
93
+ const replanScopeIds = eligibleReplan.map((b) => b.id);
94
+ phase(`Replan C${cycle} R${devRounds}`);
95
+ log(
96
+ `[fleet-sprint] in-cycle scoped replan: reviewer flagged bead(s) ${replanScopeIds.join(', ')} as ` +
97
+ `having defective acceptance criteria -- dispatching a SCOPED planner + plan-review pass for their ` +
98
+ `subtree THIS cycle (replan round R${devRounds}) instead of deferring to the next cycle, then ` +
99
+ `resuming develop rounds.`
100
+ );
101
+ // Guard: mark up front so a SECOND replan flag for the same bead
102
+ // this cycle is refused (see the reviewer fold-in below), whatever
103
+ // the outcome of this pass.
104
+ for (const id of replanScopeIds) replannedThisCycle.add(id);
105
+
106
+ // --- Scoped planner pass ---
107
+ // apra-fleet-3swo.5.3: the 'scoped-replan-planner' row of
108
+ // role-policies.mjs, executed by dispatchRole. That row owns
109
+ // the turn budget, the read-side pushBeads:true bracket (this
110
+ // dispatch re-scopes the flagged subtree, so its beads writes
111
+ // must be D-pushed), the client-side watchdog, the SINGLE
112
+ // bounded attempt (no retry ladder of its own), the one auth
113
+ // self-heal -- so the next cycle's planner, which this bead is
114
+ // deferred to below, does not hit the identical wall -- and the
115
+ // defer-to-next-cycle degrade, which never aborts the sprint.
116
+ //
117
+ // apra-fleet-zmqm: the policy's 'invalidate-beads-cache'
118
+ // postResult step is the same reasoning as the main Planning
119
+ // Loop's -- a successful dispatch mutated beads on its own
120
+ // clone, and everything after it in this same "Replan
121
+ // C{cycle} R{devRounds}" phase (the scoped plan-reviewer, the
122
+ // resumed develop round) must see those mutations, not the
123
+ // pre-replan snapshot taken when this phase() started. The
124
+ // engine runs it only on success, exactly as this ladder did.
125
+ const scopedPlannerOutcome = await dispatchRole(dispatchCtx, 'scoped-replan-planner', {
126
+ prompt: buildPlannerPrompt({
127
+ isDeltaCycle: true,
128
+ targetIssues,
129
+ goal: validated.goal,
130
+ requirementsFile: validated.requirementsFile,
131
+ requirementsContent,
132
+ feedback: null,
133
+ replanScope: replanScopeIds,
134
+ // The scoped replan is a real planner dispatch like the
135
+ // main Plan phase, so a pending rejected newTask must
136
+ // resurface here too.
137
+ rejectedNewTasksToResubmit: pendingRejectedNewTasks,
138
+ verifyExcluded: verifySetThisCycle,
139
+ }),
140
+ label: 'Scoped Replan Plan (interactive)',
141
+ roleLabel: 'Scoped Replan Plan',
142
+ });
143
+ const scopedPlannerOk = scopedPlannerOutcome.ok;
144
+ if (scopedPlannerOk) {
145
+ log(`Scoped Replan Planner: ${scopedPlannerOutcome.value}`);
146
+ } else {
147
+ log(`[fleet-sprint] in-cycle scoped replan: planner dispatch failed (${scopedPlannerOutcome.error.message}) -- leaving bead(s) ${replanScopeIds.join(', ')} flagged for the next cycle's planner.`);
148
+ }
149
+ // --- Scoped plan-review pass ---
150
+ let scopedReplanApproved = false;
151
+ if (scopedPlannerOk) {
152
+ // The 'scoped-replan-plan-reviewer' row of
153
+ // role-policies.mjs, executed by dispatchRole. That row
154
+ // owns the turn budget, the read-side bracket, the single
155
+ // bounded attempt, the auth self-heal (same rationale as
156
+ // the scoped planner above: heal before deferring to the
157
+ // next cycle's planner/plan-reviewer pass) and the
158
+ // non-approval degrade -- a schema-repair-exhausted or
159
+ // failed dispatch is a FAILED scoped review, never an
160
+ // approval, and never an abort, the same discipline as the
161
+ // main plan loop.
162
+ const scopedReviewOutcome = await dispatchRole(dispatchCtx, 'scoped-replan-plan-reviewer', {
163
+ prompt: buildPlanReviewerPrompt({ targetIssues, goal: validated.goal, replanScope: replanScopeIds, verifyExcluded: verifySetThisCycle }),
164
+ label: 'Scoped Replan Review',
165
+ roleLabel: 'Scoped Replan Review',
166
+ });
167
+ if (scopedReviewOutcome.ok) {
168
+ log(`Scoped Replan Reviewer: ${JSON.stringify(scopedReviewOutcome.value)}`);
169
+ // ONLY an explicit APPROVED approves.
170
+ scopedReplanApproved = scopedReviewOutcome.value.verdict === 'APPROVED';
171
+ } else {
172
+ log(`[fleet-sprint] in-cycle scoped replan: plan-review dispatch failed (${scopedReviewOutcome.error.message}) -- treating the scoped replan as NOT approved; bead(s) ${replanScopeIds.join(', ')} handed to the next cycle's planner.`);
173
+ }
174
+ }
175
+
176
+ if (scopedReplanApproved) {
177
+ // The planner re-scoped the flagged bead(s) and the
178
+ // plan-reviewer approved the amendment -- clear them from
179
+ // replanIds so the NEXT loop iteration re-dispatches them to a
180
+ // doer IN THIS SAME cycle.
181
+ for (const id of replanScopeIds) replanIds.delete(id);
182
+ log(`[fleet-sprint] in-cycle scoped replan: plan-review APPROVED the amendment for ${replanScopeIds.join(', ')} -- resuming develop rounds; the re-scoped bead(s) are re-dispatchable to a doer this cycle.`);
183
+ } else {
184
+ // Not approved (or the planner/reviewer dispatch failed): the
185
+ // bead(s) stay in replanIds AND are now marked
186
+ // replannedThisCycle, so the next iteration's exclude/break
187
+ // short-circuit defers them to the next cycle's planner.
188
+ log(`[fleet-sprint] in-cycle scoped replan: the scoped replan of ${replanScopeIds.join(', ')} was not approved -- they stay excluded from this cycle's develop rounds (deferred to the next cycle's planner).`);
189
+ }
190
+
191
+ // The scoped planner just MUTATED beads in this clone -- D-push
192
+ // and refresh the dashboard before re-evaluating the loop top.
193
+ // Routed through the single dolt-sync module's AFTER bracket
194
+ // (apra-fleet-417.2.1); behavior is identical.
195
+ await gitSync.syncBeadsAfter(orchestratorMember, { pushBeads: true });
196
+ await updateDashboard();
197
+ }