@apralabs/apra-fleet 0.4.4 → 0.4.5

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 (268) hide show
  1. package/README.md +49 -4
  2. package/dist/agents/backlog-groomer.md +5 -0
  3. package/dist/agents/ci-watcher.md +5 -0
  4. package/dist/agents/deployer.md +20 -2
  5. package/dist/agents/doer.md +38 -2
  6. package/dist/agents/harvester.md +12 -9
  7. package/dist/agents/integ-test-runner.md +5 -0
  8. package/dist/agents/kb-reconciler.md +6 -0
  9. package/dist/agents/plan-reviewer.md +5 -0
  10. package/dist/agents/planner.md +5 -0
  11. package/dist/agents/regression-test-runner.md +5 -0
  12. package/dist/agents/reviewer.md +67 -15
  13. package/dist/agents/schemas/deployer-output.json +5 -0
  14. package/dist/agents/schemas/doer-output.json +78 -2
  15. package/dist/agents/schemas/reviewer-output.json +104 -2
  16. package/dist/cli/auth.js +5 -1
  17. package/dist/cli/beads-pin.js +6 -7
  18. package/dist/cli/claude-mod.d.ts +75 -0
  19. package/dist/cli/claude-mod.js +288 -0
  20. package/dist/cli/dolt-install.d.ts +1 -1
  21. package/dist/cli/dolt-install.js +5 -1
  22. package/dist/cli/fleet-se-guard.d.ts +8 -0
  23. package/dist/cli/fleet-se-guard.js +19 -3
  24. package/dist/cli/install-guard.d.ts +9 -0
  25. package/dist/cli/install-guard.js +24 -0
  26. package/dist/cli/install.d.ts +12 -0
  27. package/dist/cli/install.js +180 -20
  28. package/dist/cli/kb-profile.d.ts +16 -0
  29. package/dist/cli/kb-profile.js +81 -0
  30. package/dist/cli/start.js +3 -0
  31. package/dist/cli/uninstall.js +13 -3
  32. package/dist/cli/update.d.ts +4 -0
  33. package/dist/cli/update.js +19 -3
  34. package/dist/commands/kb-server.d.ts +10 -1
  35. package/dist/commands/kb-server.js +285 -11
  36. package/dist/index.js +22 -1
  37. package/dist/os/git-executable.d.ts +57 -0
  38. package/dist/os/git-executable.js +85 -0
  39. package/dist/os/go-concurrency.d.ts +44 -0
  40. package/dist/os/go-concurrency.js +53 -0
  41. package/dist/os/index.d.ts +1 -0
  42. package/dist/os/index.js +1 -0
  43. package/dist/os/linux.d.ts +2 -0
  44. package/dist/os/linux.js +10 -1
  45. package/dist/os/os-commands.d.ts +25 -0
  46. package/dist/os/os-commands.js +2 -0
  47. package/dist/os/windows-executable.d.ts +53 -0
  48. package/dist/os/windows-executable.js +185 -0
  49. package/dist/os/windows-gitbash.d.ts +23 -14
  50. package/dist/os/windows-gitbash.js +40 -16
  51. package/dist/os/windows.d.ts +2 -0
  52. package/dist/os/windows.js +37 -6
  53. package/dist/paths.d.ts +10 -1
  54. package/dist/paths.js +19 -2
  55. package/dist/services/agy-project.d.ts +7 -1
  56. package/dist/services/agy-project.js +7 -2
  57. package/dist/services/auth-socket.d.ts +18 -0
  58. package/dist/services/auth-socket.js +30 -4
  59. package/dist/services/credential-store.d.ts +33 -0
  60. package/dist/services/credential-store.js +79 -2
  61. package/dist/services/http-transport.d.ts +29 -0
  62. package/dist/services/http-transport.js +166 -37
  63. package/dist/services/kb-tool-profile.d.ts +36 -0
  64. package/dist/services/kb-tool-profile.js +88 -0
  65. package/dist/services/knowledge/bible-blob-id.js +10 -1
  66. package/dist/services/knowledge/bible-import.d.ts +108 -0
  67. package/dist/services/knowledge/bible-import.js +137 -4
  68. package/dist/services/knowledge/file-hash.js +6 -5
  69. package/dist/services/knowledge/http-provider.d.ts +303 -20
  70. package/dist/services/knowledge/http-provider.js +795 -125
  71. package/dist/services/knowledge/kb-config.d.ts +65 -1
  72. package/dist/services/knowledge/kb-config.js +143 -3
  73. package/dist/services/knowledge/kb-http-auth-state.d.ts +26 -0
  74. package/dist/services/knowledge/kb-http-auth-state.js +40 -0
  75. package/dist/services/knowledge/kb-providers.d.ts +9 -2
  76. package/dist/services/knowledge/kb-providers.js +67 -37
  77. package/dist/services/knowledge/kb-removed-scope-keys.js +1 -1
  78. package/dist/services/knowledge/kb-self.d.ts +122 -9
  79. package/dist/services/knowledge/kb-self.js +196 -36
  80. package/dist/services/knowledge/member-bible-view.js +16 -3
  81. package/dist/services/knowledge/path-validation.d.ts +7 -0
  82. package/dist/services/knowledge/path-validation.js +11 -0
  83. package/dist/services/knowledge/project-slug.js +3 -2
  84. package/dist/services/knowledge/repository-header.d.ts +77 -0
  85. package/dist/services/knowledge/repository-header.js +233 -0
  86. package/dist/services/knowledge/require-sqlite-project.d.ts +1 -1
  87. package/dist/services/knowledge/require-sqlite-project.js +1 -1
  88. package/dist/services/knowledge/sqlite-provider.d.ts +169 -0
  89. package/dist/services/knowledge/sqlite-provider.js +416 -4
  90. package/dist/services/knowledge/types.d.ts +15 -2
  91. package/dist/services/member-busy.d.ts +12 -0
  92. package/dist/services/member-busy.js +20 -0
  93. package/dist/services/member-config-io.d.ts +3 -2
  94. package/dist/services/member-config-io.js +7 -4
  95. package/dist/services/member-fleet-install.js +1 -0
  96. package/dist/services/member-tool-allowlist.d.ts +1 -1
  97. package/dist/services/member-tool-allowlist.js +8 -4
  98. package/dist/services/port-holder.js +2 -1
  99. package/dist/services/service-manager/types.d.ts +17 -1
  100. package/dist/services/service-manager/windows.d.ts +7 -2
  101. package/dist/services/service-manager/windows.js +28 -11
  102. package/dist/services/service-notice.d.ts +7 -0
  103. package/dist/services/service-notice.js +19 -0
  104. package/dist/services/session-registry.d.ts +13 -0
  105. package/dist/services/session-registry.js +13 -0
  106. package/dist/services/session-roots.d.ts +67 -0
  107. package/dist/services/session-roots.js +126 -0
  108. package/dist/services/statusline.d.ts +21 -0
  109. package/dist/services/statusline.js +97 -1
  110. package/dist/services/supervisor-service-cleanup.js +2 -1
  111. package/dist/services/tool-registry.js +108 -20
  112. package/dist/services/tool-scope.d.ts +34 -1
  113. package/dist/services/tool-scope.js +27 -2
  114. package/dist/services/vcs/azure-devops.js +10 -0
  115. package/dist/services/vcs/bitbucket.d.ts +22 -1
  116. package/dist/services/vcs/bitbucket.js +163 -17
  117. package/dist/services/vcs/types.d.ts +25 -2
  118. package/dist/services/watch/project-resolver.js +2 -1
  119. package/dist/skills/pm/cost.md +5 -1
  120. package/dist/skills/pm/index.md +9 -9
  121. package/dist/skills/pm/sprint.md +2 -1
  122. package/dist/tools/check-status.d.ts +51 -0
  123. package/dist/tools/check-status.js +124 -12
  124. package/dist/tools/code-intelligence-freshness.js +1 -1
  125. package/dist/tools/code-intelligence-gitnexus.d.ts +19 -0
  126. package/dist/tools/code-intelligence-gitnexus.js +166 -9
  127. package/dist/tools/code-intelligence-readiness.d.ts +58 -1
  128. package/dist/tools/code-intelligence-readiness.js +93 -8
  129. package/dist/tools/code-intelligence-reindex.d.ts +25 -1
  130. package/dist/tools/code-intelligence-reindex.js +76 -4
  131. package/dist/tools/code-intelligence.d.ts +1 -1
  132. package/dist/tools/code-intelligence.js +1 -1
  133. package/dist/tools/execute-command.js +14 -8
  134. package/dist/tools/execute-prompt.js +6 -2
  135. package/dist/tools/fleet-snapshot.d.ts +21 -0
  136. package/dist/tools/fleet-snapshot.js +78 -0
  137. package/dist/tools/kb-bible-commit.d.ts +25 -11
  138. package/dist/tools/kb-bible-commit.js +142 -33
  139. package/dist/tools/kb-capture.d.ts +2 -2
  140. package/dist/tools/kb-context.js +47 -27
  141. package/dist/tools/kb-demote.d.ts +27 -0
  142. package/dist/tools/kb-demote.js +37 -0
  143. package/dist/tools/kb-export.d.ts +35 -3
  144. package/dist/tools/kb-export.js +56 -13
  145. package/dist/tools/kb-feedback.d.ts +2 -0
  146. package/dist/tools/kb-feedback.js +17 -7
  147. package/dist/tools/kb-harvest.js +28 -9
  148. package/dist/tools/kb-import.d.ts +18 -2
  149. package/dist/tools/kb-import.js +24 -9
  150. package/dist/tools/kb-invalidate.d.ts +11 -3
  151. package/dist/tools/kb-invalidate.js +80 -7
  152. package/dist/tools/kb-list.js +38 -10
  153. package/dist/tools/kb-promote.js +6 -4
  154. package/dist/tools/kb-query.d.ts +3 -0
  155. package/dist/tools/kb-query.js +181 -37
  156. package/dist/tools/kb-session-prime.d.ts +4 -4
  157. package/dist/tools/kb-session-prime.js +89 -9
  158. package/dist/tools/kb-setup.d.ts +20 -0
  159. package/dist/tools/kb-setup.js +149 -11
  160. package/dist/tools/list-members.js +1 -1
  161. package/dist/tools/member-detail.js +7 -3
  162. package/dist/tools/provision-vcs-auth.d.ts +28 -3
  163. package/dist/tools/provision-vcs-auth.js +53 -7
  164. package/dist/tools/receive-files.js +7 -4
  165. package/dist/tools/send-files.js +5 -4
  166. package/dist/tools/send-message.d.ts +3 -0
  167. package/dist/tools/send-message.js +15 -2
  168. package/dist/tools/stop-prompt.js +3 -1
  169. package/dist/tools/vcs-credential-exec.d.ts +45 -3
  170. package/dist/tools/vcs-credential-exec.js +90 -11
  171. package/dist/utils/process-utils.js +5 -1
  172. package/dist/utils/redact-known-secrets.d.ts +17 -0
  173. package/dist/utils/redact-known-secrets.js +70 -0
  174. package/dist/utils/skill-matrix.js +1 -1
  175. package/dist/utils/vcs-provider-detect.js +2 -2
  176. package/dist/workflows/auto-sprint.js +245 -9
  177. package/package.json +10 -7
  178. package/packages/apra-fleet-client/package.json +1 -1
  179. package/packages/apra-fleet-client/src/client/api.mjs +172 -19
  180. package/packages/apra-fleet-client/src/client/reconnecting-transport.mjs +35 -2
  181. package/packages/apra-fleet-client/src/client/transport.mjs +6 -0
  182. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +5 -0
  183. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +5 -0
  184. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +20 -2
  185. package/packages/apra-fleet-se/apra-pm/agents/doer.md +38 -2
  186. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +12 -9
  187. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +5 -0
  188. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +6 -0
  189. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +5 -0
  190. package/packages/apra-fleet-se/apra-pm/agents/planner.md +5 -0
  191. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +5 -0
  192. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +67 -15
  193. package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-output.json +5 -0
  194. package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +78 -2
  195. package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +104 -2
  196. package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +5 -1
  197. package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +9 -9
  198. package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +2 -1
  199. package/packages/apra-fleet-se/bin/cli.mjs +104 -31
  200. package/packages/apra-fleet-se/bin/serve.mjs +46 -8
  201. package/packages/apra-fleet-se/fleet-sprint/abort.mjs +184 -32
  202. package/packages/apra-fleet-se/fleet-sprint/bd-sync-command.mjs +69 -0
  203. package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +21 -0
  204. package/packages/apra-fleet-se/fleet-sprint/beads-lock-probe.mjs +176 -0
  205. package/packages/apra-fleet-se/fleet-sprint/beads-reachability.mjs +126 -0
  206. package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +158 -1
  207. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +82 -2
  208. package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +23 -6
  209. package/packages/apra-fleet-se/fleet-sprint/decision-notify.mjs +338 -0
  210. package/packages/apra-fleet-se/fleet-sprint/decision-wait.mjs +731 -0
  211. package/packages/apra-fleet-se/fleet-sprint/decisions.mjs +372 -0
  212. package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +44 -11
  213. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +4 -1
  214. package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +9 -3
  215. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +314 -19
  216. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +72 -4
  217. package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +7 -1
  218. package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +112 -1
  219. package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +36 -2
  220. package/packages/apra-fleet-se/fleet-sprint/kb.mjs +736 -101
  221. package/packages/apra-fleet-se/fleet-sprint/member-init-probe.mjs +1 -1
  222. package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +7 -1
  223. package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +49 -2
  224. package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +206 -3
  225. package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +61 -3
  226. package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +81 -31
  227. package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +7 -3
  228. package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +39 -14
  229. package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +17 -1
  230. package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +18 -3
  231. package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +14 -1
  232. package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +32 -5
  233. package/packages/apra-fleet-se/fleet-sprint/runner.js +824 -98
  234. package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +4 -2
  235. package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +54 -1
  236. package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +29 -2
  237. package/packages/apra-fleet-se/fleet-sprint/set-aside.mjs +288 -0
  238. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +3 -2
  239. package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +20 -0
  240. package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +21 -0
  241. package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +9 -0
  242. package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +605 -32
  243. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +811 -17
  244. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +89 -1
  245. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +225 -2
  246. package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +59 -3
  247. package/packages/apra-fleet-se/src/supervisor/api.mjs +148 -8
  248. package/packages/apra-fleet-se/src/supervisor/dashboard.mjs +6 -3
  249. package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +30 -10
  250. package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +17 -4
  251. package/packages/apra-fleet-se/src/supervisor/history.mjs +8 -1
  252. package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +92 -2
  253. package/packages/apra-fleet-se/src/supervisor/proxy.mjs +26 -1
  254. package/packages/apra-fleet-se/src/supervisor/server.mjs +151 -8
  255. package/packages/apra-fleet-se/src/supervisor/spawner.mjs +11 -9
  256. package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +7 -1
  257. package/packages/apra-fleet-workflow/package.json +2 -1
  258. package/packages/apra-fleet-workflow/src/viewer/index.mjs +86 -5
  259. package/packages/apra-fleet-workflow/src/viewer/request-guard.mjs +222 -0
  260. package/packages/apra-fleet-workflow/src/workflow/index.mjs +34 -2
  261. package/plugins/claude-code/fleet-status/.claude-plugin/plugin.json +7 -0
  262. package/plugins/claude-code/fleet-status/hooks/hooks.json +1 -0
  263. package/plugins/claude-code/fleet-status/hooks/register.tsx +906 -0
  264. package/plugins/claude-code/fleet-status/types/index.d.ts +88 -0
  265. package/skills/fleet/auth-bitbucket.md +47 -20
  266. package/skills/fleet/onboarding.md +1 -1
  267. package/skills/fleet/skill-matrix.md +3 -3
  268. package/version.json +1 -1
@@ -1394,6 +1394,41 @@ function exportGuardLogLine(detected, stepLabel) {
1394
1394
  return null;
1395
1395
  }
1396
1396
 
1397
+ // The sprint analysis summary (sprint-logs/<branch>-<ts>.analysis.md) is written to the
1398
+ // working tree but NEVER committed. This builds the one command that lists its pattern
1399
+ // in the target clone's local git exclude file, so every later `git add -A` /
1400
+ // `git add sprint-logs/` skips it and it never shows as a local change. Same contract as
1401
+ // fleet-sprint's ensureGitExcluded: the exclude file is resolved by git itself
1402
+ // (`git rev-parse --git-path info/exclude`, so linked worktrees work), its directory is
1403
+ // created when missing, a missing trailing newline is repaired, and the line is
1404
+ // appended only when not already present (idempotent). Runs unchanged in a POSIX shell
1405
+ // and in PowerShell: node with argv (no inner shell), no `$`, no backticks, no double
1406
+ // quotes inside the program. Prints exactly one GIT_EXCLUDE_OK: or GIT_EXCLUDE_ERROR:
1407
+ // line. Pure -- builds a string only.
1408
+ const ANALYSIS_EXCLUDE_PATTERN = 'sprint-logs/*.analysis.md';
1409
+ function buildGitExcludeCmd(repoPath, pattern) {
1410
+ return `node -e "` +
1411
+ `const{execFileSync}=require('child_process');` +
1412
+ `const fs=require('fs');const path=require('path');` +
1413
+ `const repo=process.argv[1];const pat=process.argv[2];const NL=String.fromCharCode(10);` +
1414
+ `try{` +
1415
+ `const rel=execFileSync('git',['rev-parse','--git-path','info/exclude'],{cwd:repo,encoding:'utf8',stdio:['ignore','pipe','pipe']}).trim();` +
1416
+ `if(!rel)throw new Error('git printed no exclude path');` +
1417
+ `const f=path.resolve(repo,rel);` +
1418
+ `fs.mkdirSync(path.dirname(f),{recursive:true});` +
1419
+ `let t='';try{t=fs.readFileSync(f,'utf8');}catch(e){}` +
1420
+ `if(t.split(/\\r?\\n/).includes(pat)){console.log('GIT_EXCLUDE_OK: already listed '+pat);}` +
1421
+ `else{fs.appendFileSync(f,(t.length>0&&!t.endsWith(NL)?NL:'')+pat+NL);console.log('GIT_EXCLUDE_OK: added '+pat);}` +
1422
+ `}catch(e){console.log('GIT_EXCLUDE_ERROR: '+String((e&&(e.stderr||e.message))||e).trim().split(NL)[0]);}` +
1423
+ `" "${repoPath}" "${pattern}"`;
1424
+ }
1425
+
1426
+ // True only when a dispatch result carries GIT_EXCLUDE_OK and no GIT_EXCLUDE_ERROR. Pure.
1427
+ function gitExcludeSucceeded(result) {
1428
+ const text = typeof result === 'string' ? result : JSON.stringify(result || '');
1429
+ return text.includes('GIT_EXCLUDE_OK:') && !text.includes('GIT_EXCLUDE_ERROR:');
1430
+ }
1431
+
1397
1432
  // PURE_FUNCTIONS_END
1398
1433
 
1399
1434
  // ROLE_SCHEMAS_GENERATED_BEGIN -- do not hand-edit; run `node scripts/gen-auto-sprint-schemas.mjs` to regenerate from agents/schemas/*.json
@@ -1427,12 +1462,62 @@ const REVIEW_SCHEMA = {
1427
1462
  "type": "string",
1428
1463
  "enum": [
1429
1464
  "APPROVED",
1430
- "CHANGES_NEEDED"
1465
+ "CHANGES_NEEDED",
1466
+ "NEEDS-DECISION"
1431
1467
  ]
1432
1468
  },
1433
1469
  "notes": {
1434
1470
  "type": "string"
1435
1471
  },
1472
+ "decision": {
1473
+ "type": "object",
1474
+ "description": "REQUIRED when verdict is \"NEEDS-DECISION\", otherwise omit. The decision only a human operator can make before the named bead can go on. The orchestrator files it for an operator verbatim (never truncated), sets the bead aside for the rest of the run without re-dispatching it, and keeps working other ready beads. Use it only for a real choice between alternatives you cannot settle from the bead, its parent or the code -- not for a missing secret or an unmet prerequisite (BLOCKED), and not for an ordinary failure.",
1475
+ "required": [
1476
+ "beadId",
1477
+ "question",
1478
+ "options",
1479
+ "recommendation"
1480
+ ],
1481
+ "properties": {
1482
+ "beadId": {
1483
+ "type": "string",
1484
+ "minLength": 1,
1485
+ "description": "The one bead under review that cannot be approved or sent back for rework until the decision is made. The orchestrator reopens it if it is closed and sets it aside."
1486
+ },
1487
+ "question": {
1488
+ "type": "string",
1489
+ "minLength": 1,
1490
+ "description": "The full question, self-contained: what was found, why it blocks the bead, and what must be decided. An operator reads only this and the options."
1491
+ },
1492
+ "options": {
1493
+ "type": "array",
1494
+ "minItems": 2,
1495
+ "description": "At least two concrete alternatives, each with a short stable id (for example \"a\", \"b\") and its full text: what it means and what it costs.",
1496
+ "items": {
1497
+ "type": "object",
1498
+ "required": [
1499
+ "id",
1500
+ "text"
1501
+ ],
1502
+ "properties": {
1503
+ "id": {
1504
+ "type": "string",
1505
+ "minLength": 1
1506
+ },
1507
+ "text": {
1508
+ "type": "string",
1509
+ "minLength": 1
1510
+ }
1511
+ }
1512
+ }
1513
+ },
1514
+ "recommendation": {
1515
+ "type": "string",
1516
+ "minLength": 1,
1517
+ "description": "The option id you recommend, followed by why."
1518
+ }
1519
+ }
1520
+ },
1436
1521
  "reopenIds": {
1437
1522
  "type": "array",
1438
1523
  "items": {
@@ -1518,6 +1603,39 @@ const REVIEW_SCHEMA = {
1518
1603
  }
1519
1604
  }
1520
1605
  },
1606
+ "kb_demotions": {
1607
+ "type": "array",
1608
+ "description": "CONFIRMED entries a re-check during this review shows do not hold -- whether you are now less certain of the claim or have shown it wrong -- demoted back to INFERRED. Not for a drifted or removed basis. Reviewer-only, with the same evidence bar as kb_promotions and kb_discards. An id may appear in only one of kb_promotions, kb_discards and kb_demotions -- the engine refuses it in all lists it appears in. The engine makes the demotion calls.",
1609
+ "items": {
1610
+ "type": "object",
1611
+ "required": [
1612
+ "id",
1613
+ "reason",
1614
+ "evidence_files"
1615
+ ],
1616
+ "properties": {
1617
+ "id": {
1618
+ "type": "string",
1619
+ "description": "The entry id, copied verbatim from the 'KNOWLEDGE BANK -- demotion candidates' block in your dispatch prompt. That block is the ONLY source of demotable ids -- do not call a kb_* tool to find one, and never invent one.",
1620
+ "minLength": 1
1621
+ },
1622
+ "reason": {
1623
+ "type": "string",
1624
+ "description": "What you re-checked this review that the claim does not hold up against.",
1625
+ "minLength": 20
1626
+ },
1627
+ "evidence_files": {
1628
+ "type": "array",
1629
+ "description": "The repo-relative files you re-checked -- at least one, each a real file in the repo.",
1630
+ "minItems": 1,
1631
+ "items": {
1632
+ "type": "string",
1633
+ "minLength": 1
1634
+ }
1635
+ }
1636
+ }
1637
+ }
1638
+ },
1521
1639
  "kb_captures": {
1522
1640
  "type": "array",
1523
1641
  "description": "Durable knowledge this role verified during its run. The engine makes the kb_capture calls; the role only decides. Optional -- omit or send [] to capture nothing.",
@@ -1601,7 +1719,26 @@ const REVIEW_SCHEMA = {
1601
1719
  }
1602
1720
  }
1603
1721
  }
1604
- }
1722
+ },
1723
+ "allOf": [
1724
+ {
1725
+ "if": {
1726
+ "properties": {
1727
+ "verdict": {
1728
+ "const": "NEEDS-DECISION"
1729
+ }
1730
+ },
1731
+ "required": [
1732
+ "verdict"
1733
+ ]
1734
+ },
1735
+ "then": {
1736
+ "required": [
1737
+ "decision"
1738
+ ]
1739
+ }
1740
+ }
1741
+ ]
1605
1742
  };
1606
1743
  const PLAN_REVIEW_SCHEMA = {
1607
1744
  "$schema": "http://json-schema.org/draft-07/schema#",
@@ -1711,7 +1848,8 @@ const DOER_STATUS_SCHEMA = {
1711
1848
  "type": "string",
1712
1849
  "enum": [
1713
1850
  "VERIFY",
1714
- "BLOCKED"
1851
+ "BLOCKED",
1852
+ "NEEDS-DECISION"
1715
1853
  ]
1716
1854
  },
1717
1855
  "closedIds": {
@@ -1723,6 +1861,62 @@ const DOER_STATUS_SCHEMA = {
1723
1861
  "notes": {
1724
1862
  "type": "string"
1725
1863
  },
1864
+ "decision": {
1865
+ "type": "object",
1866
+ "description": "REQUIRED when status is \"NEEDS-DECISION\", otherwise omit. The decision only a human operator can make before the named bead can go on. The orchestrator files it for an operator verbatim (never truncated), sets the bead aside for the rest of the run without re-dispatching it, and keeps working other ready beads. Use it only for a real choice between alternatives you cannot settle from the bead, its parent or the code -- not for a missing secret or an unmet prerequisite (BLOCKED), and not for an ordinary failure.",
1867
+ "required": [
1868
+ "beadId",
1869
+ "question",
1870
+ "options",
1871
+ "recommendation"
1872
+ ],
1873
+ "properties": {
1874
+ "beadId": {
1875
+ "type": "string",
1876
+ "minLength": 1,
1877
+ "description": "The one open bead id that cannot go on until the decision is made."
1878
+ },
1879
+ "question": {
1880
+ "type": "string",
1881
+ "minLength": 1,
1882
+ "description": "The full question, self-contained: what was found, why it blocks the bead, and what must be decided. An operator reads only this and the options."
1883
+ },
1884
+ "options": {
1885
+ "type": "array",
1886
+ "minItems": 2,
1887
+ "description": "At least two concrete alternatives, each with a short stable id (for example \"a\", \"b\") and its full text: what it means and what it costs.",
1888
+ "items": {
1889
+ "type": "object",
1890
+ "required": [
1891
+ "id",
1892
+ "text"
1893
+ ],
1894
+ "properties": {
1895
+ "id": {
1896
+ "type": "string",
1897
+ "minLength": 1
1898
+ },
1899
+ "text": {
1900
+ "type": "string",
1901
+ "minLength": 1
1902
+ }
1903
+ }
1904
+ }
1905
+ },
1906
+ "recommendation": {
1907
+ "type": "string",
1908
+ "minLength": 1,
1909
+ "description": "The option id you recommend, followed by why."
1910
+ }
1911
+ }
1912
+ },
1913
+ "blockedIds": {
1914
+ "type": "array",
1915
+ "description": "With status BLOCKED: the assigned bead ids you left open BECAUSE of the block -- not ids you merely did not reach (e.g. same-lane stop rule). The engine sets these beads, and every open bead depending on them, aside for the rest of the run. Optional -- omitted on a single-bead assignment it means that bead; omit or send [] with status VERIFY.",
1916
+ "items": {
1917
+ "type": "string"
1918
+ }
1919
+ },
1726
1920
  "kb_captures": {
1727
1921
  "type": "array",
1728
1922
  "description": "Durable knowledge this role verified during its run. The engine makes the kb_capture calls; the role only decides. Optional -- omit or send [] to capture nothing.",
@@ -1806,7 +2000,26 @@ const DOER_STATUS_SCHEMA = {
1806
2000
  }
1807
2001
  }
1808
2002
  }
1809
- }
2003
+ },
2004
+ "allOf": [
2005
+ {
2006
+ "if": {
2007
+ "properties": {
2008
+ "status": {
2009
+ "const": "NEEDS-DECISION"
2010
+ }
2011
+ },
2012
+ "required": [
2013
+ "status"
2014
+ ]
2015
+ },
2016
+ "then": {
2017
+ "required": [
2018
+ "decision"
2019
+ ]
2020
+ }
2021
+ }
2022
+ ]
1810
2023
  };
1811
2024
  const DEPLOYER_SCHEMA = {
1812
2025
  "$schema": "http://json-schema.org/draft-07/schema#",
@@ -1824,6 +2037,13 @@ const DEPLOYER_SCHEMA = {
1824
2037
  },
1825
2038
  "notes": {
1826
2039
  "type": "string"
2040
+ },
2041
+ "failedStep": {
2042
+ "type": "string",
2043
+ "enum": [
2044
+ "permissions"
2045
+ ],
2046
+ "description": "Set to \"permissions\" ONLY when you returned deployed: false because you stopped at Step 0a (the deploy.md Permissions check) before running any deploy command. The orchestrator then does not dispatch the deploy again this run. Omit it for every other outcome, including any failure after a deploy command ran."
1827
2047
  }
1828
2048
  }
1829
2049
  };
@@ -4027,6 +4247,22 @@ sprintSummary.summaryText += '\n' + executionSummary.summaryText;
4027
4247
  log('Sprint summary:\n' + sprintSummary.summaryText);
4028
4248
  const analysisArtifactFile = `sprint-logs/${sprintLogBranch}-${effectiveStartedAt}.analysis.md`;
4029
4249
 
4250
+ // The analysis file is written locally and never committed: list its pattern in this
4251
+ // clone's git exclude file BEFORE anything writes it, so the harvester's commits, the
4252
+ // fallback and beads-export-cleanup's `git add -A` / `git add sprint-logs/` all skip it.
4253
+ // Without the exclude those would sweep it in, so a failure stops the harvest loudly.
4254
+ const analysisExcludeRes = await dispatchShell(
4255
+ [buildGitExcludeCmd(repo, ANALYSIS_EXCLUDE_PATTERN)],
4256
+ { model: MODEL_HAIKU, label: 'analysis-git-exclude', phase: 'Harvest' }
4257
+ );
4258
+ if (!gitExcludeSucceeded(analysisExcludeRes)) {
4259
+ log(`ERROR: could not add ${ANALYSIS_EXCLUDE_PATTERN} to the local git exclude file of ${repo} -- ` +
4260
+ `harvest NOT run (its commits could sweep the uncommitted analysis file in). ` +
4261
+ `Result: ${JSON.stringify(analysisExcludeRes)}`);
4262
+ await clearSprintState(stateFileRel, 'state-clear-harvestfailed');
4263
+ return { cycles: cycleCount, goalMet, goal, harvest: 'failed' };
4264
+ }
4265
+
4030
4266
  const harvestLabel = 'harvester';
4031
4267
  const harvestResult = await dispatch(
4032
4268
  kbContext +
@@ -4037,7 +4273,8 @@ const harvestResult = await dispatch(
4037
4273
  `The sprint is complete. Harvest the sprint artefacts.\n` +
4038
4274
  `Follow your runbook (agents/harvester.md).\n\n` +
4039
4275
  `IMPORTANT: Your FIRST action (Step 1 of your runbook) is to write the analysis artifact below ` +
4040
- `to "${repo}/${analysisArtifactFile}" and commit it before doing anything else.\n\n` +
4276
+ `to "${repo}/${analysisArtifactFile}" before doing anything else. Do NOT git add or commit it: ` +
4277
+ `it stays a local, git-excluded file.\n\n` +
4041
4278
  `analysisText (write this verbatim to ${analysisArtifactFile}):\n` +
4042
4279
  sprintSummary.summaryText + `\n\n` +
4043
4280
  `Regression pass (once-per-sprint, informational -- does not gate this sprint):\n` +
@@ -4049,15 +4286,14 @@ await runKbWork(repo, 'harvester', harvestResult);
4049
4286
 
4050
4287
  if (!harvestResult || harvestResult.status !== 'OK') {
4051
4288
  log(`Harvest failed: ${(harvestResult && harvestResult.notes) || 'null'} -- writing analysis fallback`);
4052
- // JS fallback: write .analysis.md directly from in-memory analysisText so the artifact
4053
- // is preserved in branch history even when the harvester agent is killed or crashes.
4289
+ // JS fallback: write .analysis.md directly from in-memory analysisText so the local
4290
+ // record exists even when the harvester agent is killed or crashes. Never staged or
4291
+ // committed: the file is git-excluded above.
4054
4292
  const safeContent = sprintSummary.summaryText.replace(/'/g, "'\\''");
4055
4293
  await dispatchShell(
4056
4294
  [
4057
4295
  `mkdir -p "${repo}/sprint-logs"`,
4058
4296
  `printf '%s' '${safeContent}' > "${repo}/${analysisArtifactFile}"`,
4059
- `git -C "${repo}" add "${analysisArtifactFile}"`,
4060
- `git -C "${repo}" -c user.name='pm' -c user.email='pm@pm.local' commit --allow-empty -m "chore: sprint-analysis fallback ${branch} ${effectiveStartedAt}"`,
4061
4297
  ],
4062
4298
  { model: MODEL_HAIKU, label: 'harvest-analysis-fallback', phase: 'Harvest' }
4063
4299
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apralabs/apra-fleet",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "MCP server for orchestrating multiple agentic AI instances (Claude, Gemini, Codex, Copilot, AGY) across machines via SSH",
5
5
  "author": "Apra Labs",
6
6
  "homepage": "https://github.com/Apra-Labs/apra-fleet",
@@ -43,14 +43,17 @@
43
43
  "packages/apra-fleet-workflow/src/",
44
44
  "packages/apra-fleet-workflow/package.json",
45
45
  "packages/apra-fleet-client/src/",
46
- "packages/apra-fleet-client/package.json"
46
+ "packages/apra-fleet-client/package.json",
47
+ "plugins/claude-code/fleet-status/.claude-plugin/plugin.json",
48
+ "plugins/claude-code/fleet-status/hooks/",
49
+ "plugins/claude-code/fleet-status/types/"
47
50
  ],
48
51
  "publishConfig": {
49
52
  "access": "public"
50
53
  },
51
54
  "overrides": {
52
- "undici": "^7.30.0",
53
- "fast-uri": "^4.1.5"
55
+ "undici": "^7.30.1",
56
+ "fast-uri": "^4.2.3"
54
57
  },
55
58
  "scripts": {
56
59
  "build": "npm run build:contract && tsc",
@@ -97,7 +100,7 @@
97
100
  "pg": "^8.22.0",
98
101
  "smol-toml": "^1.7.1",
99
102
  "ssh2": "^1.17.0",
100
- "undici": "^7.30.0",
103
+ "undici": "^7.30.1",
101
104
  "uuid": "^14.0.0",
102
105
  "zod": "^3.25.0"
103
106
  },
@@ -111,8 +114,8 @@
111
114
  "pg-mem": "^3.0.14",
112
115
  "postject": "^1.0.0-alpha.6",
113
116
  "typescript": "^5.5.0",
114
- "vite": "^7.3.6",
115
- "vitest": "^4.1.11",
117
+ "vite": "^7.3.7",
118
+ "vitest": "^4.1.12",
116
119
  "yaml": "^2.9.0",
117
120
  "zod-to-json-schema": "^3.25.1"
118
121
  }
@@ -21,6 +21,6 @@
21
21
  "author": "Apra Labs",
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
- "undici": "^7.30.0"
24
+ "undici": "^7.30.1"
25
25
  }
26
26
  }