@apralabs/apra-fleet 0.4.2 → 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 (370) hide show
  1. package/README.md +38 -5
  2. package/dist/agents/backlog-groomer.md +25 -0
  3. package/dist/agents/ci-watcher.md +11 -0
  4. package/dist/agents/deployer.md +37 -2
  5. package/dist/agents/doer.md +36 -12
  6. package/dist/agents/harvester.md +11 -0
  7. package/dist/agents/integ-test-runner.md +11 -0
  8. package/dist/agents/kb-reconciler.md +9 -0
  9. package/dist/agents/plan-reviewer.md +110 -22
  10. package/dist/agents/planner.md +125 -37
  11. package/dist/agents/regression-test-runner.md +11 -0
  12. package/dist/agents/reviewer.md +13 -2
  13. package/dist/agents/schemas/plan-reviewer-output.json +37 -0
  14. package/dist/cli/agent-transform.d.ts +83 -2
  15. package/dist/cli/agent-transform.d.ts.map +1 -1
  16. package/dist/cli/agent-transform.js +266 -21
  17. package/dist/cli/agent-transform.js.map +1 -1
  18. package/dist/cli/auth.d.ts.map +1 -1
  19. package/dist/cli/auth.js +28 -9
  20. package/dist/cli/auth.js.map +1 -1
  21. package/dist/cli/config.d.ts +7 -5
  22. package/dist/cli/config.d.ts.map +1 -1
  23. package/dist/cli/config.js +44 -34
  24. package/dist/cli/config.js.map +1 -1
  25. package/dist/cli/install.d.ts +33 -0
  26. package/dist/cli/install.d.ts.map +1 -1
  27. package/dist/cli/install.js +290 -23
  28. package/dist/cli/install.js.map +1 -1
  29. package/dist/cli/kb-directives.d.ts.map +1 -1
  30. package/dist/cli/kb-directives.js +2 -1
  31. package/dist/cli/kb-directives.js.map +1 -1
  32. package/dist/cli/register-member.d.ts.map +1 -1
  33. package/dist/cli/register-member.js +6 -2
  34. package/dist/cli/register-member.js.map +1 -1
  35. package/dist/commands/kb-server.d.ts +3 -0
  36. package/dist/commands/kb-server.d.ts.map +1 -1
  37. package/dist/commands/kb-server.js +43 -3
  38. package/dist/commands/kb-server.js.map +1 -1
  39. package/dist/index.js +3 -3
  40. package/dist/os/linux.d.ts +6 -0
  41. package/dist/os/linux.d.ts.map +1 -1
  42. package/dist/os/linux.js +35 -2
  43. package/dist/os/linux.js.map +1 -1
  44. package/dist/os/os-commands.d.ts +61 -2
  45. package/dist/os/os-commands.d.ts.map +1 -1
  46. package/dist/os/windows-gitbash.d.ts +5 -0
  47. package/dist/os/windows-gitbash.d.ts.map +1 -1
  48. package/dist/os/windows-gitbash.js +15 -0
  49. package/dist/os/windows-gitbash.js.map +1 -1
  50. package/dist/os/windows.d.ts +6 -0
  51. package/dist/os/windows.d.ts.map +1 -1
  52. package/dist/os/windows.js +46 -3
  53. package/dist/os/windows.js.map +1 -1
  54. package/dist/providers/agy.d.ts +115 -6
  55. package/dist/providers/agy.d.ts.map +1 -1
  56. package/dist/providers/agy.js +569 -53
  57. package/dist/providers/agy.js.map +1 -1
  58. package/dist/providers/claude.d.ts +81 -3
  59. package/dist/providers/claude.d.ts.map +1 -1
  60. package/dist/providers/claude.js +344 -10
  61. package/dist/providers/claude.js.map +1 -1
  62. package/dist/providers/codex.d.ts +4 -2
  63. package/dist/providers/codex.d.ts.map +1 -1
  64. package/dist/providers/codex.js +19 -2
  65. package/dist/providers/codex.js.map +1 -1
  66. package/dist/providers/copilot.d.ts +4 -2
  67. package/dist/providers/copilot.d.ts.map +1 -1
  68. package/dist/providers/copilot.js +20 -2
  69. package/dist/providers/copilot.js.map +1 -1
  70. package/dist/providers/none.d.ts +4 -2
  71. package/dist/providers/none.d.ts.map +1 -1
  72. package/dist/providers/none.js +17 -2
  73. package/dist/providers/none.js.map +1 -1
  74. package/dist/providers/opencode.d.ts +3 -1
  75. package/dist/providers/opencode.d.ts.map +1 -1
  76. package/dist/providers/opencode.js +22 -2
  77. package/dist/providers/opencode.js.map +1 -1
  78. package/dist/providers/provider.d.ts +201 -6
  79. package/dist/providers/provider.d.ts.map +1 -1
  80. package/dist/providers/provider.js +56 -0
  81. package/dist/providers/provider.js.map +1 -1
  82. package/dist/services/agy-project.d.ts +102 -0
  83. package/dist/services/agy-project.d.ts.map +1 -0
  84. package/dist/services/agy-project.js +356 -0
  85. package/dist/services/agy-project.js.map +1 -0
  86. package/dist/services/auth-socket.js +4 -4
  87. package/dist/services/auth-web.js +1 -1
  88. package/dist/services/cloud/lifecycle.d.ts.map +1 -1
  89. package/dist/services/cloud/lifecycle.js +33 -4
  90. package/dist/services/cloud/lifecycle.js.map +1 -1
  91. package/dist/services/credential-cleanup.d.ts.map +1 -1
  92. package/dist/services/credential-cleanup.js +35 -17
  93. package/dist/services/credential-cleanup.js.map +1 -1
  94. package/dist/services/exit-drain.d.ts +44 -0
  95. package/dist/services/exit-drain.d.ts.map +1 -0
  96. package/dist/services/exit-drain.js +52 -0
  97. package/dist/services/exit-drain.js.map +1 -0
  98. package/dist/services/github-app.d.ts.map +1 -1
  99. package/dist/services/github-app.js +32 -4
  100. package/dist/services/github-app.js.map +1 -1
  101. package/dist/services/http-transport.d.ts +1 -0
  102. package/dist/services/http-transport.d.ts.map +1 -1
  103. package/dist/services/http-transport.js +48 -1
  104. package/dist/services/http-transport.js.map +1 -1
  105. package/dist/services/knowledge/kb-config.d.ts +42 -0
  106. package/dist/services/knowledge/kb-config.d.ts.map +1 -0
  107. package/dist/services/knowledge/kb-config.js +54 -0
  108. package/dist/services/knowledge/kb-config.js.map +1 -0
  109. package/dist/services/knowledge/kb-providers.d.ts +7 -1
  110. package/dist/services/knowledge/kb-providers.d.ts.map +1 -1
  111. package/dist/services/knowledge/kb-providers.js +191 -17
  112. package/dist/services/knowledge/kb-providers.js.map +1 -1
  113. package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
  114. package/dist/services/knowledge/require-sqlite-project.d.ts.map +1 -0
  115. package/dist/services/knowledge/require-sqlite-project.js +38 -0
  116. package/dist/services/knowledge/require-sqlite-project.js.map +1 -0
  117. package/dist/services/model-pricing.d.ts.map +1 -1
  118. package/dist/services/model-pricing.js +7 -3
  119. package/dist/services/model-pricing.js.map +1 -1
  120. package/dist/services/secret-token.d.ts +38 -0
  121. package/dist/services/secret-token.d.ts.map +1 -0
  122. package/dist/services/secret-token.js +51 -0
  123. package/dist/services/secret-token.js.map +1 -0
  124. package/dist/services/service-manager/types.d.ts +3 -1
  125. package/dist/services/service-manager/types.d.ts.map +1 -1
  126. package/dist/services/service-manager/windows.d.ts +14 -2
  127. package/dist/services/service-manager/windows.d.ts.map +1 -1
  128. package/dist/services/service-manager/windows.js +65 -7
  129. package/dist/services/service-manager/windows.js.map +1 -1
  130. package/dist/services/ssh.d.ts.map +1 -1
  131. package/dist/services/ssh.js +58 -2
  132. package/dist/services/ssh.js.map +1 -1
  133. package/dist/services/stall/read-log-tail.d.ts.map +1 -1
  134. package/dist/services/stall/read-log-tail.js +20 -10
  135. package/dist/services/stall/read-log-tail.js.map +1 -1
  136. package/dist/services/stall/stall-detector.d.ts +53 -4
  137. package/dist/services/stall/stall-detector.d.ts.map +1 -1
  138. package/dist/services/stall/stall-detector.js +212 -34
  139. package/dist/services/stall/stall-detector.js.map +1 -1
  140. package/dist/services/strategy.d.ts.map +1 -1
  141. package/dist/services/strategy.js +79 -2
  142. package/dist/services/strategy.js.map +1 -1
  143. package/dist/services/substitution-engine.js +2 -2
  144. package/dist/services/substitution-engine.js.map +1 -1
  145. package/dist/services/tool-registry.d.ts.map +1 -1
  146. package/dist/services/tool-registry.js +5 -3
  147. package/dist/services/tool-registry.js.map +1 -1
  148. package/dist/services/vcs/azure-devops.d.ts +66 -1
  149. package/dist/services/vcs/azure-devops.d.ts.map +1 -1
  150. package/dist/services/vcs/azure-devops.js +192 -21
  151. package/dist/services/vcs/azure-devops.js.map +1 -1
  152. package/dist/services/vcs/types.d.ts +1 -1
  153. package/dist/skills/fleet-sprint-cli/SKILL.md +18 -0
  154. package/dist/skills/pm/SKILL.md +1 -1
  155. package/dist/skills/pm/cost.md +0 -3
  156. package/dist/skills/pm/fleet-addendum.md +2 -2
  157. package/dist/tools/check-status.d.ts +7 -4
  158. package/dist/tools/check-status.d.ts.map +1 -1
  159. package/dist/tools/check-status.js +2 -0
  160. package/dist/tools/check-status.js.map +1 -1
  161. package/dist/tools/compose-permissions.d.ts +6 -0
  162. package/dist/tools/compose-permissions.d.ts.map +1 -1
  163. package/dist/tools/compose-permissions.js +182 -34
  164. package/dist/tools/compose-permissions.js.map +1 -1
  165. package/dist/tools/credential-store-set.js +1 -1
  166. package/dist/tools/execute-command.d.ts.map +1 -1
  167. package/dist/tools/execute-command.js +31 -20
  168. package/dist/tools/execute-command.js.map +1 -1
  169. package/dist/tools/execute-prompt.d.ts +15 -2
  170. package/dist/tools/execute-prompt.d.ts.map +1 -1
  171. package/dist/tools/execute-prompt.js +1196 -892
  172. package/dist/tools/execute-prompt.js.map +1 -1
  173. package/dist/tools/kb-capture.d.ts +2 -2
  174. package/dist/tools/kb-capture.d.ts.map +1 -1
  175. package/dist/tools/kb-capture.js +29 -5
  176. package/dist/tools/kb-capture.js.map +1 -1
  177. package/dist/tools/kb-export.d.ts +2 -2
  178. package/dist/tools/kb-export.d.ts.map +1 -1
  179. package/dist/tools/kb-export.js +3 -28
  180. package/dist/tools/kb-export.js.map +1 -1
  181. package/dist/tools/kb-feedback.d.ts.map +1 -1
  182. package/dist/tools/kb-feedback.js +3 -1
  183. package/dist/tools/kb-feedback.js.map +1 -1
  184. package/dist/tools/kb-freshness-sweep.d.ts.map +1 -1
  185. package/dist/tools/kb-freshness-sweep.js +3 -1
  186. package/dist/tools/kb-freshness-sweep.js.map +1 -1
  187. package/dist/tools/kb-import.d.ts.map +1 -1
  188. package/dist/tools/kb-import.js +2 -1
  189. package/dist/tools/kb-import.js.map +1 -1
  190. package/dist/tools/kb-list.d.ts.map +1 -1
  191. package/dist/tools/kb-list.js +3 -1
  192. package/dist/tools/kb-list.js.map +1 -1
  193. package/dist/tools/kb-query.d.ts +2 -2
  194. package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -1
  195. package/dist/tools/kb-reconcile-prefilter.js +3 -1
  196. package/dist/tools/kb-reconcile-prefilter.js.map +1 -1
  197. package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -1
  198. package/dist/tools/kb-resolve-contradiction.js +3 -1
  199. package/dist/tools/kb-resolve-contradiction.js.map +1 -1
  200. package/dist/tools/kb-setup.d.ts.map +1 -1
  201. package/dist/tools/kb-setup.js +125 -20
  202. package/dist/tools/kb-setup.js.map +1 -1
  203. package/dist/tools/kb-stats.d.ts.map +1 -1
  204. package/dist/tools/kb-stats.js +64 -43
  205. package/dist/tools/kb-stats.js.map +1 -1
  206. package/dist/tools/list-members.d.ts +2 -2
  207. package/dist/tools/list-members.d.ts.map +1 -1
  208. package/dist/tools/list-members.js +1 -0
  209. package/dist/tools/list-members.js.map +1 -1
  210. package/dist/tools/member-detail.d.ts +2 -2
  211. package/dist/tools/member-detail.d.ts.map +1 -1
  212. package/dist/tools/member-detail.js +17 -0
  213. package/dist/tools/member-detail.js.map +1 -1
  214. package/dist/tools/member-reservation.d.ts +58 -1
  215. package/dist/tools/member-reservation.d.ts.map +1 -1
  216. package/dist/tools/member-reservation.js +61 -20
  217. package/dist/tools/member-reservation.js.map +1 -1
  218. package/dist/tools/provision-auth.d.ts +80 -1
  219. package/dist/tools/provision-auth.d.ts.map +1 -1
  220. package/dist/tools/provision-auth.js +142 -54
  221. package/dist/tools/provision-auth.js.map +1 -1
  222. package/dist/tools/provision-vcs-auth.d.ts +91 -1
  223. package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
  224. package/dist/tools/provision-vcs-auth.js +209 -49
  225. package/dist/tools/provision-vcs-auth.js.map +1 -1
  226. package/dist/tools/register-member.d.ts +12 -9
  227. package/dist/tools/register-member.d.ts.map +1 -1
  228. package/dist/tools/register-member.js +99 -12
  229. package/dist/tools/register-member.js.map +1 -1
  230. package/dist/tools/remove-member.d.ts.map +1 -1
  231. package/dist/tools/remove-member.js +27 -2
  232. package/dist/tools/remove-member.js.map +1 -1
  233. package/dist/tools/send-email.d.ts +2 -2
  234. package/dist/tools/setup-git-app.d.ts.map +1 -1
  235. package/dist/tools/setup-git-app.js +11 -7
  236. package/dist/tools/setup-git-app.js.map +1 -1
  237. package/dist/tools/shutdown-server.d.ts +2 -0
  238. package/dist/tools/shutdown-server.d.ts.map +1 -1
  239. package/dist/tools/shutdown-server.js +23 -1
  240. package/dist/tools/shutdown-server.js.map +1 -1
  241. package/dist/tools/update-member.d.ts +12 -9
  242. package/dist/tools/update-member.d.ts.map +1 -1
  243. package/dist/tools/update-member.js +43 -11
  244. package/dist/tools/update-member.js.map +1 -1
  245. package/dist/tools/vcs-credential-exec.d.ts +127 -0
  246. package/dist/tools/vcs-credential-exec.d.ts.map +1 -0
  247. package/dist/tools/vcs-credential-exec.js +197 -0
  248. package/dist/tools/vcs-credential-exec.js.map +1 -0
  249. package/dist/types.d.ts +13 -0
  250. package/dist/types.d.ts.map +1 -1
  251. package/dist/utils/log-helpers.d.ts.map +1 -1
  252. package/dist/utils/log-helpers.js +2 -2
  253. package/dist/utils/log-helpers.js.map +1 -1
  254. package/dist/utils/prompt-errors.d.ts.map +1 -1
  255. package/dist/utils/prompt-errors.js +7 -1
  256. package/dist/utils/prompt-errors.js.map +1 -1
  257. package/dist/utils/shell-escape.d.ts +16 -0
  258. package/dist/utils/shell-escape.d.ts.map +1 -1
  259. package/dist/utils/shell-escape.js +22 -2
  260. package/dist/utils/shell-escape.js.map +1 -1
  261. package/dist/utils/vcs-provider-detect.d.ts +65 -0
  262. package/dist/utils/vcs-provider-detect.d.ts.map +1 -0
  263. package/dist/utils/vcs-provider-detect.js +109 -0
  264. package/dist/utils/vcs-provider-detect.js.map +1 -0
  265. package/dist/utils/workspace-trust.d.ts +20 -17
  266. package/dist/utils/workspace-trust.d.ts.map +1 -1
  267. package/dist/utils/workspace-trust.js +87 -1
  268. package/dist/utils/workspace-trust.js.map +1 -1
  269. package/dist/workflows/auto-sprint.js +176 -15
  270. package/package.json +6 -4
  271. package/packages/apra-fleet-client/src/client/api.mjs +319 -17
  272. package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
  273. package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
  274. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +25 -0
  275. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +11 -0
  276. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +37 -2
  277. package/packages/apra-fleet-se/apra-pm/agents/doer.md +36 -12
  278. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +11 -0
  279. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +11 -0
  280. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +9 -0
  281. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +110 -22
  282. package/packages/apra-fleet-se/apra-pm/agents/planner.md +125 -37
  283. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +11 -0
  284. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +13 -2
  285. package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
  286. package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -1
  287. package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -3
  288. package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -2
  289. package/packages/apra-fleet-se/bin/cli.mjs +149 -1
  290. package/packages/apra-fleet-se/bin/serve.mjs +78 -4
  291. package/packages/apra-fleet-se/fleet-sprint/abort.mjs +481 -0
  292. package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +491 -0
  293. package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +282 -0
  294. package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +208 -0
  295. package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +638 -0
  296. package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +301 -0
  297. package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
  298. package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +8 -0
  299. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +61 -14
  300. package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +516 -0
  301. package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +184 -0
  302. package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1121 -0
  303. package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
  304. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +1 -1
  305. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +276 -0
  306. package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +1 -1
  307. package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
  308. package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
  309. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +996 -32
  310. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +267 -0
  311. package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
  312. package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
  313. package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
  314. package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +556 -0
  315. package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +495 -0
  316. package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +564 -0
  317. package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
  318. package/packages/apra-fleet-se/fleet-sprint/kb.mjs +728 -0
  319. package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
  320. package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +252 -0
  321. package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +581 -0
  322. package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
  323. package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
  324. package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
  325. package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +136 -0
  326. package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +822 -0
  327. package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +294 -0
  328. package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +403 -0
  329. package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +180 -0
  330. package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
  331. package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +390 -0
  332. package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +323 -0
  333. package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +232 -0
  334. package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +174 -0
  335. package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +197 -0
  336. package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +305 -0
  337. package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +559 -0
  338. package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1416 -0
  339. package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
  340. package/packages/apra-fleet-se/fleet-sprint/runner.js +1467 -9798
  341. package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +17 -12
  342. package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +304 -0
  343. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +18 -0
  344. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +21 -2
  345. package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +454 -0
  346. package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +239 -0
  347. package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +163 -0
  348. package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
  349. package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +211 -0
  350. package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1279 -0
  351. package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +153 -19
  352. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +71 -21
  353. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
  354. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +131 -0
  355. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +140 -16
  356. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +1 -0
  357. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +77 -2
  358. package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
  359. package/packages/apra-fleet-se/package.json +1 -1
  360. package/packages/apra-fleet-workflow/src/viewer/index.mjs +17 -6
  361. package/packages/apra-fleet-workflow/src/workflow/index.mjs +49 -7
  362. package/skills/fleet/SKILL.md +8 -8
  363. package/skills/fleet/auth-azdevops.md +14 -3
  364. package/skills/fleet/auth-bitbucket.md +2 -2
  365. package/skills/fleet/auth-github.md +5 -4
  366. package/skills/fleet/onboarding.md +3 -3
  367. package/skills/fleet/permissions.md +5 -1
  368. package/skills/fleet/profiles/node.json +1 -1
  369. package/skills/fleet/troubleshooting.md +3 -3
  370. package/version.json +1 -1
@@ -481,6 +481,86 @@ export function isInfraDispatchFailure(err) {
481
481
  return INFRA_DISPATCH_REASONS.has(err?.details?.reason);
482
482
  }
483
483
 
484
+ // ---------------------------------------------------------------------------
485
+ // apra-fleet-hzeb.4.1 -- usage-limit dispatch classification
486
+ // ---------------------------------------------------------------------------
487
+ //
488
+ // execute_prompt relays a provider's usage-limit signal (e.g. Claude's 429
489
+ // classified via detectUsageLimit) as a structured `details.reason ===
490
+ // 'usage_limit'` on the AgentDispatchError it throws (src/tools/execute-
491
+ // prompt.ts), mirroring the existing `details.reason` classifiers above
492
+ // (isInfraDispatchFailure, isNonRetryableDispatchError). This is the ONLY
493
+ // vocabulary a caller may key on -- NEVER regex on message text, since a
494
+ // usage-limit message is provider-specific prose that can drift or be
495
+ // localized (see isInfraDispatchFailure's own header for the same
496
+ // discipline).
497
+ export const USAGE_LIMIT_DISPATCH_REASON = 'usage_limit';
498
+
499
+ /**
500
+ * True when a dispatch error is a provider usage-limit hit, keyed off the
501
+ * server's structured `details.reason` -- never on message text.
502
+ * @param {unknown} err
503
+ * @returns {boolean}
504
+ */
505
+ export function isUsageLimitDispatchError(err) {
506
+ return err?.details?.reason === USAGE_LIMIT_DISPATCH_REASON;
507
+ }
508
+
509
+ /**
510
+ * The provider's usage-limit signal object (see providers/provider.ts's
511
+ * UsageLimitSignal contract) carried on a usage-limit dispatch error, or
512
+ * `null` when the error carries none (e.g. it is not a usage-limit error at
513
+ * all, or a provider that classified the reason but supplied no signal
514
+ * detail).
515
+ * @param {unknown} err
516
+ * @returns {object|null}
517
+ */
518
+ export function usageLimitOf(err) {
519
+ return err?.details?.usageLimit ?? null;
520
+ }
521
+
522
+ /**
523
+ * Thrown by the fleet-sprint usage-limit pause/resume controller
524
+ * (apra-fleet-hzeb.4.2, the follow-up to this task) when a dispatch has been
525
+ * paused and re-probed until its budget (USAGE_LIMIT_MAX_WAIT_S /
526
+ * USAGE_LIMIT_MAX_REPROBES in role-policies.mjs) is exhausted with no
527
+ * successful resume. Registered in isTypedAbortError() (abort.mjs) so a
528
+ * give-up routes through finalizeAbort() / an [ABORTED] PR, exactly like
529
+ * every other unrecoverable sprint-abort class in that curated list -- a
530
+ * member permanently rate-limited past every allowed wait/reprobe is exactly
531
+ * as terminal as a stalled sprint or an unmergeable divergence.
532
+ *
533
+ * @property {string|null} member - the member whose dispatch hit the usage limit
534
+ * @property {string|null} roleLabel - the role/label of the dispatch that was paused
535
+ * @property {number|null} firstHitAt - epoch ms of the first usage-limit hit
536
+ * @property {number|null} lastResumeAt - epoch ms of the provider's last reported resumeAt
537
+ * @property {number} reprobes - how many re-probe attempts were made before giving up
538
+ * @property {number} waitedMs - total wall-clock time spent paused across all reprobes
539
+ */
540
+ export class UsageLimitWaitExhaustedError extends WorkflowError {
541
+ /**
542
+ * @param {string} message
543
+ * @param {{ member?: string|null, roleLabel?: string|null, firstHitAt?: number|null, lastResumeAt?: number|null, reprobes?: number, waitedMs?: number, details?: object, cause?: unknown }} [opts]
544
+ */
545
+ constructor(message, opts = {}) {
546
+ const {
547
+ member = null, roleLabel = null, firstHitAt = null, lastResumeAt = null,
548
+ reprobes = 0, waitedMs = 0, details, cause,
549
+ } = opts;
550
+ super(message, {
551
+ code: 'USAGE_LIMIT_WAIT_EXHAUSTED',
552
+ details: { member, roleLabel, firstHitAt, lastResumeAt, reprobes, waitedMs, ...details },
553
+ cause,
554
+ });
555
+ this.member = member;
556
+ this.roleLabel = roleLabel;
557
+ this.firstHitAt = firstHitAt;
558
+ this.lastResumeAt = lastResumeAt;
559
+ this.reprobes = reprobes;
560
+ this.waitedMs = waitedMs;
561
+ }
562
+ }
563
+
484
564
  // ---------------------------------------------------------------------------
485
565
  // apra-fleet-eft.75.2 -- sprint-launch machine-local pidfile mutex
486
566
  // ---------------------------------------------------------------------------
@@ -655,3 +735,190 @@ export class MemberReservationResumeError extends WorkflowError {
655
735
  this.members = members;
656
736
  }
657
737
  }
738
+
739
+ // ---------------------------------------------------------------------------
740
+ // apra-fleet-3swo.4.9 -- sync-bracket mutual-exclusion violation
741
+ // ---------------------------------------------------------------------------
742
+
743
+ /**
744
+ * Thrown by git-sync.mjs's createSyncBrackets() when two brackets sharing the
745
+ * same `exclusiveKey` genuinely OVERLAP rather than nest -- i.e. the bracket
746
+ * that opened FIRST closes while a bracket that opened LATER (for the same
747
+ * key) is still open. Proper nesting (LIFO open/close for the same key) never
748
+ * throws this; only a crossing close does, which is precisely the shape a
749
+ * broken bracket pairing (or a regression in the external serialization gate
750
+ * that is supposed to keep code-writing dispatches sequential, e.g. runner.js
751
+ * 's `globalDoerTurn`) would produce. Every OTHER key stays fully
752
+ * independent: two brackets with different `exclusiveKey`s (or no key at all)
753
+ * may overlap in any order and never trigger this -- that is legitimate,
754
+ * relied-upon concurrency (e.g. multiple members' D-pushes serialized by
755
+ * their own dolt push mutex, not by this counter).
756
+ *
757
+ * @property {string} exclusiveKey - the shared key the two brackets collided on.
758
+ * @property {string} closingLabel - the bracket that was closing when the
759
+ * violation was detected.
760
+ * @property {string[]} stillOpenLabels - the other bracket(s) sharing this key
761
+ * that were still open at that moment.
762
+ */
763
+ export class ConcurrentSyncBracketError extends WorkflowError {
764
+ /**
765
+ * @param {string} message
766
+ * @param {{ exclusiveKey: string, closingLabel: string, stillOpenLabels: string[], details?: object, cause?: unknown }} opts
767
+ */
768
+ constructor(message, opts = {}) {
769
+ const { exclusiveKey, closingLabel, stillOpenLabels = [], details, cause } = opts;
770
+ super(message, {
771
+ code: 'CONCURRENT_SYNC_BRACKET',
772
+ details: { exclusiveKey, closingLabel, stillOpenLabels, ...details },
773
+ cause,
774
+ });
775
+ this.exclusiveKey = exclusiveKey;
776
+ this.closingLabel = closingLabel;
777
+ this.stillOpenLabels = stillOpenLabels;
778
+ }
779
+ }
780
+
781
+ // ---------------------------------------------------------------------------
782
+ // Pre-sprint validation refusals
783
+ // ---------------------------------------------------------------------------
784
+ //
785
+ // Every refusal raised by runSprintCycle's pre-sprint validation block, as a
786
+ // closed machine-readable vocabulary. Before this existed the block threw bare
787
+ // `Error`s whose only discriminator was their prose, so a caller could not
788
+ // tell "there is genuinely no ready work" (an operator-facing, often benign
789
+ // outcome) from "this orchestrator's bd clone cannot see the target beads at
790
+ // all" (a sync fault) or "the scope is deadlocked" (a graph fault) without
791
+ // substring-matching a human-readable sentence.
792
+ //
793
+ // TARGET_NOT_VISIBLE One or more target issue ids are not present in the
794
+ // orchestrator member's own bd clone AT ALL. NOT the
795
+ // same as those beads being closed: they are invisible
796
+ // here, usually because they were created/mutated on a
797
+ // different clone that was never dolt-pushed to the
798
+ // shared remote. A SYNC fault, fixable by syncing.
799
+ // NOTHING_TO_DO The scope resolves to zero open/in-progress/blocked/
800
+ // deferred beads -- every target issue is genuinely
801
+ // done. Benign: there is no work, not a fault.
802
+ // CYCLE_REPAIR_FAILED The scope is deadlocked by parent-child + blocks
803
+ // cycle(s), the precise offending edges were computed,
804
+ // and the mechanical auto-repair (`bd dep remove`)
805
+ // ITSELF failed. Distinct from DEADLOCKED: the fix is
806
+ // known and was attempted, but could not be applied.
807
+ // DEADLOCKED Not-done beads remain in scope but none are ready,
808
+ // and the repairable cycle shape does not explain it.
809
+ // Needs a human to break the dependency deadlock.
810
+ //
811
+ // NOT in this vocabulary, deliberately: the VERIFY-ONLY sprint path. An empty
812
+ // ready set with implementation-complete beads routed to verify PROCEEDS, so
813
+ // it is not a refusal and must never raise. Nor is the stale-in-progress
814
+ // reclaim a refusal -- it runs BEFORE any of these are raised, precisely
815
+ // because an empty `--ready` set can be an artifact of an interrupted run
816
+ // rather than an absence of work.
817
+ export const PRE_SPRINT_REFUSAL_REASONS = Object.freeze({
818
+ TARGET_NOT_VISIBLE: 'TARGET_NOT_VISIBLE',
819
+ NOTHING_TO_DO: 'NOTHING_TO_DO',
820
+ CYCLE_REPAIR_FAILED: 'CYCLE_REPAIR_FAILED',
821
+ DEADLOCKED: 'DEADLOCKED',
822
+ });
823
+
824
+ /**
825
+ * Thrown when runSprintCycle's pre-sprint validation refuses to start a
826
+ * sprint. Adds a machine-readable `reason` discriminator (one of
827
+ * PRE_SPRINT_REFUSAL_REASONS) to what was previously an untyped `Error`
828
+ * distinguishable only by its prose.
829
+ *
830
+ * The human-readable message is deliberately UNCHANGED from the prose each
831
+ * refusal already emitted -- this adds a type and a discriminator, it does not
832
+ * restyle the operator-facing text.
833
+ *
834
+ * Like the other sprint-fatal errors here it is never caught inside the
835
+ * pre-sprint block, so it unwinds runWithContext()'s promise and fails the run
836
+ * before any dispatch occurs.
837
+ *
838
+ * @property {string} reason - one of PRE_SPRINT_REFUSAL_REASONS
839
+ * @property {string|null} scope - the sprint filter the refusal was raised for
840
+ * @property {string[]} [invisibleTargets] - TARGET_NOT_VISIBLE: the ids missing
841
+ * from the orchestrator member's clone
842
+ * @property {Array<{blockedIssue: string, blockedBy: string}>} [cyclePairs] -
843
+ * CYCLE_REPAIR_FAILED: the parent-child + blocks edge pairs whose removal
844
+ * was attempted
845
+ * @property {string[]} [deadlockedIds] - DEADLOCKED: the not-done bead ids that
846
+ * remain in scope with none ready
847
+ */
848
+ export class PreSprintValidationError extends WorkflowError {
849
+ /**
850
+ * @param {string} message
851
+ * @param {{ reason: string, scope?: string|null, invisibleTargets?: string[], cyclePairs?: Array<{blockedIssue: string, blockedBy: string}>, deadlockedIds?: string[], details?: object, cause?: unknown }} opts
852
+ */
853
+ constructor(message, opts = {}) {
854
+ const { reason, scope = null, invisibleTargets, cyclePairs, deadlockedIds, details, cause } = opts;
855
+ if (!Object.prototype.hasOwnProperty.call(PRE_SPRINT_REFUSAL_REASONS, String(reason))) {
856
+ // A refusal with no recognized discriminator is the exact failure
857
+ // this type exists to prevent, so it fails loudly at construction
858
+ // rather than shipping an untyped refusal wearing a typed name.
859
+ throw new TypeError(
860
+ `PreSprintValidationError requires a reason from PRE_SPRINT_REFUSAL_REASONS ` +
861
+ `(${Object.keys(PRE_SPRINT_REFUSAL_REASONS).join(', ')}); got ${JSON.stringify(reason)}`
862
+ );
863
+ }
864
+ super(message, {
865
+ code: 'PRE_SPRINT_VALIDATION',
866
+ details: { reason, scope, invisibleTargets, cyclePairs, deadlockedIds, ...details },
867
+ cause,
868
+ });
869
+ this.reason = reason;
870
+ this.scope = scope;
871
+ if (invisibleTargets) this.invisibleTargets = invisibleTargets;
872
+ if (cyclePairs) this.cyclePairs = cyclePairs;
873
+ if (deadlockedIds) this.deadlockedIds = deadlockedIds;
874
+ }
875
+ }
876
+
877
+ // ---------------------------------------------------------------------------
878
+ // Beads identity (which .beads a member's bd actually resolves to)
879
+ // ---------------------------------------------------------------------------
880
+
881
+ export const BEADS_IDENTITY_FAILURE_REASONS = Object.freeze({
882
+ MISMATCH: 'MISMATCH',
883
+ });
884
+
885
+ /**
886
+ * Thrown by verifyBeadsIdentity (beads-identity-check.mjs) BEFORE any
887
+ * mutating bd command when a member's probed identity (`bd where` / `bd
888
+ * config get sync.remote` / `git remote get-url origin`) DIFFERS from the
889
+ * expected one (the supervisor's expectation, or the orchestrator member's
890
+ * own identity) on a field that resolved on both sides. A probe that fails
891
+ * or cannot be parsed is a logged warning, never this error: only a proven
892
+ * mismatch is a data-corruption risk worth refusing the sprint for.
893
+ *
894
+ * A WorkflowError so main()'s terminal record names the reason, but
895
+ * deliberately NOT a typed abort: nothing has been dispatched or mutated, so
896
+ * there is no partial work for finalizeAbort() to push or open a PR for.
897
+ *
898
+ * @property {string} reason - one of BEADS_IDENTITY_FAILURE_REASONS
899
+ * @property {string} member - the member whose identity mismatched
900
+ * @property {Array<{field: string, expected: string, actual: string}>} [mismatches]
901
+ */
902
+ export class BeadsIdentityError extends WorkflowError {
903
+ /**
904
+ * @param {string} message
905
+ * @param {{ reason: string, member: string, mismatches?: Array<{field: string, expected: string, actual: string}>, details?: object, cause?: unknown }} opts
906
+ */
907
+ constructor(message, opts = {}) {
908
+ const { reason, member, mismatches, details, cause } = opts;
909
+ if (!Object.prototype.hasOwnProperty.call(BEADS_IDENTITY_FAILURE_REASONS, String(reason))) {
910
+ throw new TypeError(
911
+ `BeadsIdentityError requires a reason from BEADS_IDENTITY_FAILURE_REASONS ` +
912
+ `(${Object.keys(BEADS_IDENTITY_FAILURE_REASONS).join(', ')}); got ${JSON.stringify(reason)}`
913
+ );
914
+ }
915
+ super(message, {
916
+ code: 'BEADS_IDENTITY',
917
+ details: { reason, member, mismatches, ...details },
918
+ cause,
919
+ });
920
+ this.reason = reason;
921
+ this.member = member;
922
+ if (mismatches) this.mismatches = mismatches;
923
+ }
924
+ }