@apralabs/apra-fleet 0.4.0 → 0.4.1

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 (427) hide show
  1. package/README.md +145 -7
  2. package/dist/agents/backlog-groomer.md +17 -1
  3. package/dist/agents/ci-watcher.md +13 -1
  4. package/dist/agents/deployer.md +15 -3
  5. package/dist/agents/doer.md +35 -1
  6. package/dist/agents/harvester.md +22 -3
  7. package/dist/agents/integ-test-runner.md +18 -2
  8. package/dist/agents/kb-reconciler.md +216 -0
  9. package/dist/agents/plan-reviewer.md +14 -1
  10. package/dist/agents/planner.md +88 -5
  11. package/dist/agents/regression-test-runner.md +19 -1
  12. package/dist/agents/reviewer.md +104 -3
  13. package/dist/agents/schemas/doer-output.json +63 -3
  14. package/dist/agents/schemas/harvester-output.json +59 -2
  15. package/dist/agents/schemas/integ-test-runner-output.json +2 -2
  16. package/dist/agents/schemas/kb-reconciler-output.json +87 -0
  17. package/dist/agents/schemas/planner-output.json +65 -0
  18. package/dist/agents/schemas/reviewer-output.json +105 -8
  19. package/dist/cli/install.d.ts +1 -0
  20. package/dist/cli/install.d.ts.map +1 -1
  21. package/dist/cli/install.js +136 -5
  22. package/dist/cli/install.js.map +1 -1
  23. package/dist/cli/join.js +1 -1
  24. package/dist/cli/join.js.map +1 -1
  25. package/dist/cli/kb-commit.d.ts +12 -0
  26. package/dist/cli/kb-commit.d.ts.map +1 -0
  27. package/dist/cli/kb-commit.js +53 -0
  28. package/dist/cli/kb-commit.js.map +1 -0
  29. package/dist/cli/kb-directives.d.ts +17 -0
  30. package/dist/cli/kb-directives.d.ts.map +1 -0
  31. package/dist/cli/kb-directives.js +146 -0
  32. package/dist/cli/kb-directives.js.map +1 -0
  33. package/dist/cli/kb-import.d.ts +13 -0
  34. package/dist/cli/kb-import.d.ts.map +1 -0
  35. package/dist/cli/kb-import.js +56 -0
  36. package/dist/cli/kb-import.js.map +1 -0
  37. package/dist/cli/uninstall.d.ts.map +1 -1
  38. package/dist/cli/uninstall.js +11 -0
  39. package/dist/cli/uninstall.js.map +1 -1
  40. package/dist/cli/watch.d.ts +53 -4
  41. package/dist/cli/watch.d.ts.map +1 -1
  42. package/dist/cli/watch.js +118 -17
  43. package/dist/cli/watch.js.map +1 -1
  44. package/dist/commands/kb-server.d.ts +8 -0
  45. package/dist/commands/kb-server.d.ts.map +1 -0
  46. package/dist/commands/kb-server.js +221 -0
  47. package/dist/commands/kb-server.js.map +1 -0
  48. package/dist/index.js +77 -2
  49. package/dist/index.js.map +1 -1
  50. package/dist/os/linux.d.ts +1 -0
  51. package/dist/os/linux.d.ts.map +1 -1
  52. package/dist/os/linux.js +18 -1
  53. package/dist/os/linux.js.map +1 -1
  54. package/dist/os/os-commands.d.ts +5 -0
  55. package/dist/os/os-commands.d.ts.map +1 -1
  56. package/dist/os/windows.d.ts +35 -0
  57. package/dist/os/windows.d.ts.map +1 -1
  58. package/dist/os/windows.js +67 -31
  59. package/dist/os/windows.js.map +1 -1
  60. package/dist/providers/agy.d.ts +12 -1
  61. package/dist/providers/agy.d.ts.map +1 -1
  62. package/dist/providers/agy.js +134 -9
  63. package/dist/providers/agy.js.map +1 -1
  64. package/dist/providers/claude.d.ts +11 -1
  65. package/dist/providers/claude.d.ts.map +1 -1
  66. package/dist/providers/claude.js +47 -19
  67. package/dist/providers/claude.js.map +1 -1
  68. package/dist/providers/codex.d.ts +11 -1
  69. package/dist/providers/codex.d.ts.map +1 -1
  70. package/dist/providers/codex.js +29 -6
  71. package/dist/providers/codex.js.map +1 -1
  72. package/dist/providers/copilot.d.ts +11 -1
  73. package/dist/providers/copilot.d.ts.map +1 -1
  74. package/dist/providers/copilot.js +26 -6
  75. package/dist/providers/copilot.js.map +1 -1
  76. package/dist/providers/email/headers.d.ts +15 -0
  77. package/dist/providers/email/headers.d.ts.map +1 -0
  78. package/dist/providers/email/headers.js +42 -0
  79. package/dist/providers/email/headers.js.map +1 -0
  80. package/dist/providers/email/index.d.ts +18 -0
  81. package/dist/providers/email/index.d.ts.map +1 -0
  82. package/dist/providers/email/index.js +60 -0
  83. package/dist/providers/email/index.js.map +1 -0
  84. package/dist/providers/email/provider.d.ts +49 -0
  85. package/dist/providers/email/provider.d.ts.map +1 -0
  86. package/dist/providers/email/provider.js +2 -0
  87. package/dist/providers/email/provider.js.map +1 -0
  88. package/dist/providers/email/sendgrid.d.ts +12 -0
  89. package/dist/providers/email/sendgrid.d.ts.map +1 -0
  90. package/dist/providers/email/sendgrid.js +67 -0
  91. package/dist/providers/email/sendgrid.js.map +1 -0
  92. package/dist/providers/email/smtp.d.ts +65 -0
  93. package/dist/providers/email/smtp.d.ts.map +1 -0
  94. package/dist/providers/email/smtp.js +373 -0
  95. package/dist/providers/email/smtp.js.map +1 -0
  96. package/dist/providers/gemini.d.ts +11 -1
  97. package/dist/providers/gemini.d.ts.map +1 -1
  98. package/dist/providers/gemini.js +38 -4
  99. package/dist/providers/gemini.js.map +1 -1
  100. package/dist/providers/none.d.ts +11 -1
  101. package/dist/providers/none.d.ts.map +1 -1
  102. package/dist/providers/none.js +21 -0
  103. package/dist/providers/none.js.map +1 -1
  104. package/dist/providers/opencode.d.ts +11 -1
  105. package/dist/providers/opencode.d.ts.map +1 -1
  106. package/dist/providers/opencode.js +55 -4
  107. package/dist/providers/opencode.js.map +1 -1
  108. package/dist/providers/provider.d.ts +77 -0
  109. package/dist/providers/provider.d.ts.map +1 -1
  110. package/dist/providers/provider.js +44 -0
  111. package/dist/providers/provider.js.map +1 -1
  112. package/dist/services/agent-provisioner.d.ts.map +1 -1
  113. package/dist/services/agent-provisioner.js +3 -6
  114. package/dist/services/agent-provisioner.js.map +1 -1
  115. package/dist/services/cloud/lifecycle.d.ts.map +1 -1
  116. package/dist/services/cloud/lifecycle.js +3 -0
  117. package/dist/services/cloud/lifecycle.js.map +1 -1
  118. package/dist/services/cloud/task-wrapper.d.ts +18 -0
  119. package/dist/services/cloud/task-wrapper.d.ts.map +1 -1
  120. package/dist/services/cloud/task-wrapper.js +157 -0
  121. package/dist/services/cloud/task-wrapper.js.map +1 -1
  122. package/dist/services/github-app.d.ts.map +1 -1
  123. package/dist/services/github-app.js +11 -2
  124. package/dist/services/github-app.js.map +1 -1
  125. package/dist/services/knowledge/audn.d.ts +37 -0
  126. package/dist/services/knowledge/audn.d.ts.map +1 -0
  127. package/dist/services/knowledge/audn.js +219 -0
  128. package/dist/services/knowledge/audn.js.map +1 -0
  129. package/dist/services/knowledge/file-hash.d.ts +11 -0
  130. package/dist/services/knowledge/file-hash.d.ts.map +1 -0
  131. package/dist/services/knowledge/file-hash.js +123 -0
  132. package/dist/services/knowledge/file-hash.js.map +1 -0
  133. package/dist/services/knowledge/http-provider.d.ts +46 -0
  134. package/dist/services/knowledge/http-provider.d.ts.map +1 -0
  135. package/dist/services/knowledge/http-provider.js +254 -0
  136. package/dist/services/knowledge/http-provider.js.map +1 -0
  137. package/dist/services/knowledge/kb-providers.d.ts +15 -0
  138. package/dist/services/knowledge/kb-providers.d.ts.map +1 -0
  139. package/dist/services/knowledge/kb-providers.js +92 -0
  140. package/dist/services/knowledge/kb-providers.js.map +1 -0
  141. package/dist/services/knowledge/kb-scope-input.d.ts +5 -0
  142. package/dist/services/knowledge/kb-scope-input.d.ts.map +1 -0
  143. package/dist/services/knowledge/kb-scope-input.js +11 -0
  144. package/dist/services/knowledge/kb-scope-input.js.map +1 -0
  145. package/dist/services/knowledge/kb-service.d.ts +3 -0
  146. package/dist/services/knowledge/kb-service.d.ts.map +1 -0
  147. package/dist/services/knowledge/kb-service.js +2 -0
  148. package/dist/services/knowledge/kb-service.js.map +1 -0
  149. package/dist/services/knowledge/path-validation.d.ts +2 -0
  150. package/dist/services/knowledge/path-validation.d.ts.map +1 -0
  151. package/dist/services/knowledge/path-validation.js +13 -0
  152. package/dist/services/knowledge/path-validation.js.map +1 -0
  153. package/dist/services/knowledge/pre-init.d.ts +14 -0
  154. package/dist/services/knowledge/pre-init.d.ts.map +1 -0
  155. package/dist/services/knowledge/pre-init.js +147 -0
  156. package/dist/services/knowledge/pre-init.js.map +1 -0
  157. package/dist/services/knowledge/project-slug.d.ts +2 -0
  158. package/dist/services/knowledge/project-slug.d.ts.map +1 -0
  159. package/dist/services/knowledge/project-slug.js +49 -0
  160. package/dist/services/knowledge/project-slug.js.map +1 -0
  161. package/dist/services/knowledge/sqlite-provider.d.ts +147 -0
  162. package/dist/services/knowledge/sqlite-provider.d.ts.map +1 -0
  163. package/dist/services/knowledge/sqlite-provider.js +1646 -0
  164. package/dist/services/knowledge/sqlite-provider.js.map +1 -0
  165. package/dist/services/knowledge/types.d.ts +163 -0
  166. package/dist/services/knowledge/types.d.ts.map +1 -0
  167. package/dist/services/knowledge/types.js +9 -0
  168. package/dist/services/knowledge/types.js.map +1 -0
  169. package/dist/services/member-home.d.ts +89 -0
  170. package/dist/services/member-home.d.ts.map +1 -0
  171. package/dist/services/member-home.js +256 -0
  172. package/dist/services/member-home.js.map +1 -0
  173. package/dist/services/member-remote-url.d.ts +34 -0
  174. package/dist/services/member-remote-url.d.ts.map +1 -0
  175. package/dist/services/member-remote-url.js +39 -0
  176. package/dist/services/member-remote-url.js.map +1 -0
  177. package/dist/services/orphan-recovery.d.ts +5 -2
  178. package/dist/services/orphan-recovery.d.ts.map +1 -1
  179. package/dist/services/orphan-recovery.js +19 -8
  180. package/dist/services/orphan-recovery.js.map +1 -1
  181. package/dist/services/preflight-check.d.ts +56 -0
  182. package/dist/services/preflight-check.d.ts.map +1 -0
  183. package/dist/services/preflight-check.js +277 -0
  184. package/dist/services/preflight-check.js.map +1 -0
  185. package/dist/services/stall/log-path-resolver.d.ts +11 -8
  186. package/dist/services/stall/log-path-resolver.d.ts.map +1 -1
  187. package/dist/services/stall/log-path-resolver.js +17 -40
  188. package/dist/services/stall/log-path-resolver.js.map +1 -1
  189. package/dist/services/stall/stall-detector.d.ts +32 -0
  190. package/dist/services/stall/stall-detector.d.ts.map +1 -1
  191. package/dist/services/stall/stall-detector.js +149 -6
  192. package/dist/services/stall/stall-detector.js.map +1 -1
  193. package/dist/services/stall/stall-poller.d.ts +34 -0
  194. package/dist/services/stall/stall-poller.d.ts.map +1 -1
  195. package/dist/services/stall/stall-poller.js +134 -2
  196. package/dist/services/stall/stall-poller.js.map +1 -1
  197. package/dist/services/strategy.d.ts.map +1 -1
  198. package/dist/services/strategy.js +2 -2
  199. package/dist/services/strategy.js.map +1 -1
  200. package/dist/services/tool-registry.d.ts.map +1 -1
  201. package/dist/services/tool-registry.js +87 -1
  202. package/dist/services/tool-registry.js.map +1 -1
  203. package/dist/services/vcs/github.d.ts.map +1 -1
  204. package/dist/services/vcs/github.js +32 -1
  205. package/dist/services/vcs/github.js.map +1 -1
  206. package/dist/services/version-check.d.ts +22 -0
  207. package/dist/services/version-check.d.ts.map +1 -0
  208. package/dist/services/version-check.js +103 -0
  209. package/dist/services/version-check.js.map +1 -0
  210. package/dist/skills/fleet-sprint-cli/SKILL.md +13 -2
  211. package/dist/skills/pm/beads.md +6 -0
  212. package/dist/skills/pm/fleet-addendum.md +6 -0
  213. package/dist/skills/pm/index.md +56 -0
  214. package/dist/skills/pm/kb-reconcile.md +132 -0
  215. package/dist/skills/pm/kb-review.md +109 -0
  216. package/dist/tools/check-status.d.ts +47 -0
  217. package/dist/tools/check-status.d.ts.map +1 -1
  218. package/dist/tools/check-status.js +242 -0
  219. package/dist/tools/check-status.js.map +1 -1
  220. package/dist/tools/child-id-allocator.d.ts +2 -2
  221. package/dist/tools/code-intelligence-codebase-memory.d.ts +11 -0
  222. package/dist/tools/code-intelligence-codebase-memory.d.ts.map +1 -0
  223. package/dist/tools/code-intelligence-codebase-memory.js +270 -0
  224. package/dist/tools/code-intelligence-codebase-memory.js.map +1 -0
  225. package/dist/tools/code-intelligence-freshness.d.ts +2 -0
  226. package/dist/tools/code-intelligence-freshness.d.ts.map +1 -0
  227. package/dist/tools/code-intelligence-freshness.js +26 -0
  228. package/dist/tools/code-intelligence-freshness.js.map +1 -0
  229. package/dist/tools/code-intelligence-gitnexus.d.ts +14 -0
  230. package/dist/tools/code-intelligence-gitnexus.d.ts.map +1 -0
  231. package/dist/tools/code-intelligence-gitnexus.js +475 -0
  232. package/dist/tools/code-intelligence-gitnexus.js.map +1 -0
  233. package/dist/tools/code-intelligence-kb-enrich.d.ts +2 -0
  234. package/dist/tools/code-intelligence-kb-enrich.d.ts.map +1 -0
  235. package/dist/tools/code-intelligence-kb-enrich.js +65 -0
  236. package/dist/tools/code-intelligence-kb-enrich.js.map +1 -0
  237. package/dist/tools/code-intelligence-reindex.d.ts +7 -0
  238. package/dist/tools/code-intelligence-reindex.d.ts.map +1 -0
  239. package/dist/tools/code-intelligence-reindex.js +106 -0
  240. package/dist/tools/code-intelligence-reindex.js.map +1 -0
  241. package/dist/tools/code-intelligence-telemetry.d.ts +5 -0
  242. package/dist/tools/code-intelligence-telemetry.d.ts.map +1 -0
  243. package/dist/tools/code-intelligence-telemetry.js +52 -0
  244. package/dist/tools/code-intelligence-telemetry.js.map +1 -0
  245. package/dist/tools/code-intelligence-tests.d.ts +2 -0
  246. package/dist/tools/code-intelligence-tests.d.ts.map +1 -0
  247. package/dist/tools/code-intelligence-tests.js +24 -0
  248. package/dist/tools/code-intelligence-tests.js.map +1 -0
  249. package/dist/tools/code-intelligence.d.ts +114 -0
  250. package/dist/tools/code-intelligence.d.ts.map +1 -0
  251. package/dist/tools/code-intelligence.js +124 -0
  252. package/dist/tools/code-intelligence.js.map +1 -0
  253. package/dist/tools/compose-permissions.d.ts +26 -0
  254. package/dist/tools/compose-permissions.d.ts.map +1 -1
  255. package/dist/tools/compose-permissions.js +244 -33
  256. package/dist/tools/compose-permissions.js.map +1 -1
  257. package/dist/tools/execute-command.d.ts +2 -0
  258. package/dist/tools/execute-command.d.ts.map +1 -1
  259. package/dist/tools/execute-command.js +86 -16
  260. package/dist/tools/execute-command.js.map +1 -1
  261. package/dist/tools/execute-prompt.d.ts +13 -1
  262. package/dist/tools/execute-prompt.d.ts.map +1 -1
  263. package/dist/tools/execute-prompt.js +257 -45
  264. package/dist/tools/execute-prompt.js.map +1 -1
  265. package/dist/tools/kb-capture.d.ts +53 -0
  266. package/dist/tools/kb-capture.d.ts.map +1 -0
  267. package/dist/tools/kb-capture.js +130 -0
  268. package/dist/tools/kb-capture.js.map +1 -0
  269. package/dist/tools/kb-context.d.ts +17 -0
  270. package/dist/tools/kb-context.d.ts.map +1 -0
  271. package/dist/tools/kb-context.js +29 -0
  272. package/dist/tools/kb-context.js.map +1 -0
  273. package/dist/tools/kb-export.d.ts +19 -0
  274. package/dist/tools/kb-export.d.ts.map +1 -0
  275. package/dist/tools/kb-export.js +344 -0
  276. package/dist/tools/kb-export.js.map +1 -0
  277. package/dist/tools/kb-feedback.d.ts +23 -0
  278. package/dist/tools/kb-feedback.d.ts.map +1 -0
  279. package/dist/tools/kb-feedback.js +43 -0
  280. package/dist/tools/kb-feedback.js.map +1 -0
  281. package/dist/tools/kb-freshness-sweep.d.ts +14 -0
  282. package/dist/tools/kb-freshness-sweep.d.ts.map +1 -0
  283. package/dist/tools/kb-freshness-sweep.js +29 -0
  284. package/dist/tools/kb-freshness-sweep.js.map +1 -0
  285. package/dist/tools/kb-harvest.d.ts +20 -0
  286. package/dist/tools/kb-harvest.d.ts.map +1 -0
  287. package/dist/tools/kb-harvest.js +143 -0
  288. package/dist/tools/kb-harvest.js.map +1 -0
  289. package/dist/tools/kb-import.d.ts +44 -0
  290. package/dist/tools/kb-import.d.ts.map +1 -0
  291. package/dist/tools/kb-import.js +239 -0
  292. package/dist/tools/kb-import.js.map +1 -0
  293. package/dist/tools/kb-invalidate.d.ts +19 -0
  294. package/dist/tools/kb-invalidate.d.ts.map +1 -0
  295. package/dist/tools/kb-invalidate.js +34 -0
  296. package/dist/tools/kb-invalidate.js.map +1 -0
  297. package/dist/tools/kb-list.d.ts +32 -0
  298. package/dist/tools/kb-list.d.ts.map +1 -0
  299. package/dist/tools/kb-list.js +43 -0
  300. package/dist/tools/kb-list.js.map +1 -0
  301. package/dist/tools/kb-promote.d.ts +20 -0
  302. package/dist/tools/kb-promote.d.ts.map +1 -0
  303. package/dist/tools/kb-promote.js +20 -0
  304. package/dist/tools/kb-promote.js.map +1 -0
  305. package/dist/tools/kb-query.d.ts +35 -0
  306. package/dist/tools/kb-query.d.ts.map +1 -0
  307. package/dist/tools/kb-query.js +111 -0
  308. package/dist/tools/kb-query.js.map +1 -0
  309. package/dist/tools/kb-reconcile-prefilter.d.ts +14 -0
  310. package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -0
  311. package/dist/tools/kb-reconcile-prefilter.js +26 -0
  312. package/dist/tools/kb-reconcile-prefilter.js.map +1 -0
  313. package/dist/tools/kb-resolve-contradiction.d.ts +23 -0
  314. package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -0
  315. package/dist/tools/kb-resolve-contradiction.js +37 -0
  316. package/dist/tools/kb-resolve-contradiction.js.map +1 -0
  317. package/dist/tools/kb-session-prime.d.ts +26 -0
  318. package/dist/tools/kb-session-prime.d.ts.map +1 -0
  319. package/dist/tools/kb-session-prime.js +392 -0
  320. package/dist/tools/kb-session-prime.js.map +1 -0
  321. package/dist/tools/kb-setup.d.ts +20 -0
  322. package/dist/tools/kb-setup.d.ts.map +1 -0
  323. package/dist/tools/kb-setup.js +49 -0
  324. package/dist/tools/kb-setup.js.map +1 -0
  325. package/dist/tools/kb-stats.d.ts +20 -0
  326. package/dist/tools/kb-stats.d.ts.map +1 -0
  327. package/dist/tools/kb-stats.js +115 -0
  328. package/dist/tools/kb-stats.js.map +1 -0
  329. package/dist/tools/member-detail.d.ts.map +1 -1
  330. package/dist/tools/member-detail.js +8 -0
  331. package/dist/tools/member-detail.js.map +1 -1
  332. package/dist/tools/monitor-task.d.ts.map +1 -1
  333. package/dist/tools/monitor-task.js +21 -3
  334. package/dist/tools/monitor-task.js.map +1 -1
  335. package/dist/tools/provision-auth.d.ts.map +1 -1
  336. package/dist/tools/provision-auth.js +10 -3
  337. package/dist/tools/provision-auth.js.map +1 -1
  338. package/dist/tools/register-member.d.ts +3 -0
  339. package/dist/tools/register-member.d.ts.map +1 -1
  340. package/dist/tools/register-member.js +30 -1
  341. package/dist/tools/register-member.js.map +1 -1
  342. package/dist/tools/remove-member.d.ts.map +1 -1
  343. package/dist/tools/remove-member.js +17 -3
  344. package/dist/tools/remove-member.js.map +1 -1
  345. package/dist/tools/report-status.d.ts.map +1 -1
  346. package/dist/tools/report-status.js +2 -1
  347. package/dist/tools/report-status.js.map +1 -1
  348. package/dist/tools/send-email.d.ts +69 -0
  349. package/dist/tools/send-email.d.ts.map +1 -0
  350. package/dist/tools/send-email.js +177 -0
  351. package/dist/tools/send-email.js.map +1 -0
  352. package/dist/tools/setup-ssh-key.d.ts.map +1 -1
  353. package/dist/tools/setup-ssh-key.js +2 -0
  354. package/dist/tools/setup-ssh-key.js.map +1 -1
  355. package/dist/tools/update-member.d.ts +3 -0
  356. package/dist/tools/update-member.d.ts.map +1 -1
  357. package/dist/tools/update-member.js +25 -1
  358. package/dist/tools/update-member.js.map +1 -1
  359. package/dist/types.d.ts +1 -0
  360. package/dist/types.d.ts.map +1 -1
  361. package/dist/utils/prompt-errors.js +1 -1
  362. package/dist/utils/prompt-errors.js.map +1 -1
  363. package/dist/utils/session-caller.d.ts +28 -0
  364. package/dist/utils/session-caller.d.ts.map +1 -0
  365. package/dist/utils/session-caller.js +24 -0
  366. package/dist/utils/session-caller.js.map +1 -0
  367. package/dist/utils/work-folder-validation.d.ts +39 -0
  368. package/dist/utils/work-folder-validation.d.ts.map +1 -0
  369. package/dist/utils/work-folder-validation.js +60 -0
  370. package/dist/utils/work-folder-validation.js.map +1 -0
  371. package/dist/workflows/auto-sprint.js +546 -6
  372. package/package.json +7 -4
  373. package/packages/apra-fleet-client/src/client/api.mjs +118 -4
  374. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +17 -1
  375. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +13 -1
  376. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +15 -3
  377. package/packages/apra-fleet-se/apra-pm/agents/doer.md +35 -1
  378. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +22 -3
  379. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +18 -2
  380. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +216 -0
  381. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +14 -1
  382. package/packages/apra-fleet-se/apra-pm/agents/planner.md +88 -5
  383. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +19 -1
  384. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +104 -3
  385. package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +63 -3
  386. package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-output.json +59 -2
  387. package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +2 -2
  388. package/packages/apra-fleet-se/apra-pm/agents/schemas/kb-reconciler-output.json +87 -0
  389. package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +65 -0
  390. package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +105 -8
  391. package/packages/apra-fleet-se/apra-pm/skills/pm/beads.md +6 -0
  392. package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +6 -0
  393. package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +56 -0
  394. package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +132 -0
  395. package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +109 -0
  396. package/packages/apra-fleet-se/bin/cli.mjs +7 -0
  397. package/packages/apra-fleet-se/bin/serve.mjs +14 -2
  398. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +31 -5
  399. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +1 -1
  400. package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +23 -151
  401. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-manual-recovery-verified.md +256 -0
  402. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +1482 -0
  403. package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +908 -0
  404. package/packages/apra-fleet-se/fleet-sprint/docs/shared-orchestrator-reservation-design.md +399 -0
  405. package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +972 -0
  406. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +167 -101
  407. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +50 -6
  408. package/packages/apra-fleet-se/fleet-sprint/runner.js +1416 -116
  409. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +13 -2
  410. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +350 -0
  411. package/packages/apra-fleet-se/fleet-sprint/sprint-progress.mjs +101 -0
  412. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +30 -17
  413. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +62 -2
  414. package/packages/apra-fleet-se/package.json +1 -0
  415. package/packages/apra-fleet-workflow/src/viewer/index.mjs +127 -13
  416. package/packages/apra-fleet-workflow/src/viewer/run-title.mjs +60 -0
  417. package/packages/apra-fleet-workflow/src/workflow/index.mjs +8 -4
  418. package/skills/fleet/knowledge-agent.md +66 -0
  419. package/skills/fleet/permissions.md +28 -4
  420. package/skills/fleet/profiles/base-dev.json +10 -1
  421. package/skills/fleet/profiles/base-reviewer.json +8 -1
  422. package/skills/fleet/profiles/tag-kb-reconciler.json +20 -0
  423. package/version.json +1 -1
  424. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-tier2-runbook.md +0 -127
  425. package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-path-b.mjs +0 -339
  426. package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-tier2.mjs +0 -360
  427. package/packages/apra-fleet-se/fleet-sprint/dolt-recovery.mjs +0 -363
@@ -7,6 +7,7 @@ import { DebouncedStateWriter, DEFAULT_DEBOUNCE_MS, writeJsonFileAtomic } from '
7
7
  import { getRunningRunStatePath, getTerminalRunStatePath } from './run-state-paths.mjs';
8
8
  import { buildListStatePayload, resolveStringRefs } from './lean-state.mjs';
9
9
  import { capCommandActivityMeta, getFullOutput } from './command-output-cap.mjs';
10
+ import { buildRunTitle } from './run-title.mjs';
10
11
 
11
12
  // apra-fleet-eft.6.5: the SAME template serves both the live view and the
12
13
  // process-free History view -- `opts.history` (true) feeds a FROZEN state
@@ -51,6 +52,8 @@ const HTML_TEMPLATE = (dashboardExtensions, opts = {}) => {
51
52
  body { background: var(--bg); color: var(--text); font-family: sans-serif; height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
52
53
  .header { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: var(--bg-glass); border-bottom: 1px solid var(--border); }
53
54
  .header h1 { font-size: 16px; font-weight: 600; margin: 0; }
55
+ .header-title { display: flex; flex-direction: column; gap: 4px; }
56
+ .run-title { font-size: 12px; color: var(--text-muted); background: var(--bg-glass); padding: 2px 8px; border-radius: 4px; width: fit-content; }
54
57
  .header-actions { display: flex; gap: 12px; align-items: center; }
55
58
 
56
59
  .stats-banner { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); background: rgba(0,0,0,0.3); padding: 4px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }
@@ -168,11 +171,32 @@ const HTML_TEMPLATE = (dashboardExtensions, opts = {}) => {
168
171
  the only way to shrink total height. Flex here still wins on
169
172
  specificity but no longer conflicts with .panel's own flex layout. */
170
173
  .tab-content.active { display: flex; min-height: 0; }
174
+
175
+ /* apra-fleet-4yr.1: in-page replacements for window.confirm()/alert()
176
+ on the Stop path -- native OS dialogs clash with the dark-glass UI.
177
+ Modal reuses .btn-stop's danger color for its Stop action; toast is
178
+ non-blocking and auto-dismisses. */
179
+ .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); align-items: center; justify-content: center; z-index: 1000; }
180
+ .modal-overlay.open { display: flex; }
181
+ .modal-box { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 20px; max-width: 360px; width: 90%; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
182
+ .modal-box p { color: var(--text); font-size: 13px; margin-bottom: 16px; line-height: 1.4; }
183
+ .modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
184
+ .toast { position: fixed; bottom: 24px; right: 24px; background: var(--bg-glass); border: 1px solid var(--border); color: var(--text); padding: 10px 16px; border-radius: 6px; font-size: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.4); opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; pointer-events: none; z-index: 1001; }
185
+ .toast.show { opacity: 1; transform: translateY(0); }
171
186
  </style>
172
187
  </head>
173
188
  <body data-view="${isHistory ? 'history' : 'live'}">
174
189
  <div class="header">
175
- <h1><span id="workflow-name">Loading...</span></h1>
190
+ <div class="header-title">
191
+ <h1><span id="workflow-name">Loading...</span></h1>
192
+ <!-- apra-fleet-dm5.1: short human "run title" sentence (workflow-
193
+ specific fields such as members/issue-ids/goal, when the running
194
+ workflow publishes them), rendered by renderState() below via
195
+ buildRunTitle(state). Falls back to the plain workflow name
196
+ (still non-empty, never blank) whenever the relevant fields
197
+ aren't populated. -->
198
+ <div id="run-title" class="run-title"></div>
199
+ </div>
176
200
  <div class="header-actions">
177
201
  <!-- apra-fleet-eft.37.3: generic, workflow-agnostic display of
178
202
  state.result's top-level SCALAR fields -- populated (or hidden,
@@ -187,6 +211,16 @@ const HTML_TEMPLATE = (dashboardExtensions, opts = {}) => {
187
211
  ${isHistory ? '' : '<button class="btn btn-stop" onclick="stopWorkflow()">Stop</button>'}
188
212
  </div>
189
213
  </div>
214
+ ${isHistory ? '' : `<div class="modal-overlay" id="stop-modal-overlay">
215
+ <div class="modal-box">
216
+ <p>Are you sure you want to forcibly stop the workflow?</p>
217
+ <div class="modal-actions">
218
+ <button class="btn btn-secondary" onclick="closeStopModal()">Cancel</button>
219
+ <button class="btn btn-stop" onclick="confirmStopWorkflow()">Stop</button>
220
+ </div>
221
+ </div>
222
+ </div>
223
+ <div class="toast" id="stop-toast">Stop signal sent.</div>`}
190
224
  <div class="main-content">
191
225
  <div class="content-area">
192
226
  <div class="tab-bar" id="tab-bar">
@@ -218,30 +252,56 @@ const HTML_TEMPLATE = (dashboardExtensions, opts = {}) => {
218
252
  document.getElementById('tab-' + id).classList.add('active');
219
253
  }
220
254
 
255
+ // apra-fleet-4wr.1: the ONE shared h/m/s duration formatter -- every
256
+ // duration display in this viewer (live elapsed, closed/frozen phase and
257
+ // activity durations, the stats-banner Uptime) goes through this, so a
258
+ // closed row and a live row of the same elapsed value render identically
259
+ // instead of one showing raw/decimal seconds and the other h/m/s.
260
+ // ms == null (missing -- not yet known) is the ONLY case that renders
261
+ // the '-' placeholder; a genuine zero or sub-second duration renders
262
+ // '0s', never '-'.
221
263
  function formatTime(ms) {
222
- if (!ms) return '-';
223
- return (ms / 1000).toFixed(1) + 's';
224
- }
225
-
226
- function formatUptime(ms) {
227
- if (!ms || ms < 0) return '0s';
264
+ if (ms === null || ms === undefined) return '-';
265
+ // apra-fleet-x8r.6: a frozen phase carrying an end timestamp but no/
266
+ // invalid start timestamp (or any other NaN-producing input) must fall
267
+ // back to the same '-' placeholder as the missing-value case above,
268
+ // never the literal string 'NaNs'.
269
+ if (!Number.isFinite(ms)) return '-';
270
+ if (ms < 0) return '0s';
228
271
  let secs = Math.floor(ms / 1000);
229
272
  let mins = Math.floor(secs / 60);
230
273
  let hrs = Math.floor(mins / 60);
231
274
  secs = secs % 60;
232
275
  mins = mins % 60;
233
-
276
+
234
277
  let out = [];
235
278
  if (hrs > 0) out.push(hrs + 'hr');
236
279
  if (mins > 0) out.push(mins + 'm');
237
280
  out.push(secs + 's');
238
281
  return out.join(' ');
239
282
  }
283
+
284
+ // Live (still-running) elapsed durations, ticked forward on every
285
+ // render/poll from Date.now() - startTime -- delegates to formatTime()
286
+ // for the actual h/m/s formatting (the shared formatter above), only
287
+ // differing in that a falsy/negative/missing ms (nothing meaningful to
288
+ // show yet) renders '0s' rather than formatTime's own '-' missing-value
289
+ // case, since a live row always has SOME elapsed value once it starts.
290
+ function formatUptime(ms) {
291
+ if (!ms || ms < 0) return '0s';
292
+ return formatTime(ms);
293
+ }
240
294
 
241
295
  // Shared with dashboard extensions -- see src/viewer/html-utils.mjs for
242
296
  // why this is embedded via escapeHtml.toString() instead of duplicated.
243
297
  ${escapeHtml.toString()}
244
298
 
299
+ // apra-fleet-dm5.1: buildRunTitle() references escapeHtml by bare name
300
+ // (not an import) -- embedded here, right after escapeHtml itself, so
301
+ // that identifier resolves in this plain <script> tag exactly as it
302
+ // does in run-title.mjs's real ES-module scope.
303
+ ${buildRunTitle.toString()}
304
+
245
305
  // apra-fleet-eft.27.1: GET /state's lean list-state payload dedupes
246
306
  // repeated strings into a shared \`_strings\` table (see
247
307
  // src/viewer/lean-state.mjs) -- this is that module's resolveStringRefs()
@@ -262,13 +322,37 @@ const HTML_TEMPLATE = (dashboardExtensions, opts = {}) => {
262
322
  a.click();
263
323
  }
264
324
 
265
- async function stopWorkflow() {
266
- if (confirm('Are you sure you want to forcibly stop the workflow?')) {
267
- await fetch('/stop', { method: 'POST' });
268
- alert('Stop signal sent.');
269
- }
325
+ // apra-fleet-4yr.1: in-page modal replaces window.confirm() for the
326
+ // Stop confirmation step (the safety check itself stays -- only the
327
+ // native dialog is replaced), and a non-blocking toast replaces
328
+ // window.alert() once /stop resolves.
329
+ function stopWorkflow() {
330
+ const overlay = document.getElementById('stop-modal-overlay');
331
+ if (overlay) overlay.classList.add('open');
332
+ }
333
+
334
+ function closeStopModal() {
335
+ const overlay = document.getElementById('stop-modal-overlay');
336
+ if (overlay) overlay.classList.remove('open');
337
+ }
338
+
339
+ function showStopToast() {
340
+ const toast = document.getElementById('stop-toast');
341
+ if (!toast) return;
342
+ toast.classList.add('show');
343
+ setTimeout(() => toast.classList.remove('show'), 3000);
344
+ }
345
+
346
+ async function confirmStopWorkflow() {
347
+ closeStopModal();
348
+ await fetch('/stop', { method: 'POST' });
349
+ showStopToast();
270
350
  }
271
351
 
352
+ document.addEventListener('keydown', (ev) => {
353
+ if (ev.key === 'Escape') closeStopModal();
354
+ });
355
+
272
356
  let allExpanded = true;
273
357
  function toggleAllGlobal() {
274
358
  allExpanded = !allExpanded;
@@ -680,6 +764,13 @@ const HTML_TEMPLATE = (dashboardExtensions, opts = {}) => {
680
764
 
681
765
  document.getElementById('workflow-name').textContent = state.workflowName;
682
766
 
767
+ // apra-fleet-dm5.1: buildRunTitle() returns an ALREADY-ESCAPED HTML
768
+ // fragment (every user-supplied piece -- member names, bead ids,
769
+ // goal -- individually run through escapeHtml before being embedded
770
+ // into the sentence), safe to assign directly here.
771
+ const runTitleEl = document.getElementById('run-title');
772
+ if (runTitleEl) runTitleEl.innerHTML = buildRunTitle(state);
773
+
683
774
  const ind = document.getElementById('status-indicator');
684
775
  if (state.status === 'running') { ind.innerHTML = '<div class="status-live-indicator"><div class="led"></div> LIVE</div>'; }
685
776
  else if (state.status === 'success') { ind.innerHTML = '<span style="color:var(--success)">DONE</span>'; }
@@ -808,6 +899,23 @@ function findActivityById(state, id) {
808
899
  // for).
809
900
  export { HTML_TEMPLATE };
810
901
 
902
+ /**
903
+ * Creates a live dashboard viewer HTTP server for a workflow run.
904
+ * @param {import('../workflow/index.mjs').FleetWorkflow} workflow
905
+ * @param {Object} opts - Options object
906
+ * @param {number} [opts.port=8080] - HTTP server port
907
+ * @param {string} [opts.runId] - Stable per-run identifier (generated if not provided)
908
+ * @param {string} [opts.name] - Workflow display name
909
+ * @param {string} [opts.debouncedStatePath] - Path to write state JSON (uses default if not provided)
910
+ * @param {*} [opts.launchArgs] - Opaque, free-form per-workflow metadata (NOT argv).
911
+ * `launchArgs` is passed through unchanged into state.args and is never inspected
912
+ * or interpreted by core -- consumers must feature-detect the fields they need
913
+ * rather than assuming a type. Examples: argv array from test callers
914
+ * (['--track', 'eft-service'], ['--foo', 'bar']), or a structured object from
915
+ * fleet-sprint (e.g., { members, targetIssues, goal }). Defaults to null if omitted.
916
+ * @param {Array} [opts.dashboardExtensions] - Dashboard widget extensions
917
+ * @param {Object} [opts.env] - Environment variables (defaults to process.env)
918
+ */
811
919
  export function createDashboardViewer(workflow, opts = {}) {
812
920
  const port = (typeof opts.port === 'number') ? opts.port : 8080;
813
921
  const dashboardExtensions = opts.dashboardExtensions || [];
@@ -852,6 +960,12 @@ export function createDashboardViewer(workflow, opts = {}) {
852
960
  // a mid-run read of the file shows in-progress state, not just
853
961
  // the terminal shape.
854
962
  runId,
963
+ // apra-fleet-x8r.10: launchArgs is opaque, free-form, per-workflow
964
+ // metadata (NOT argv). Core never inspects or interprets it; consumers
965
+ // must feature-detect the fields they need rather than assuming a type.
966
+ // Examples: argv array from test callers (['--track', 'eft-service'],
967
+ // ['--foo', 'bar']), or a structured object from fleet-sprint
968
+ // ({ members, targetIssues, goal }).
855
969
  args: opts.launchArgs ?? null,
856
970
  // apra-fleet-eft.37.3: `result` is the workflow script's own return
857
971
  // value, stored WHOLESALE and OPAQUELY -- core never inspects or
@@ -0,0 +1,60 @@
1
+ import { escapeHtml } from './html-utils.mjs';
2
+
3
+ /**
4
+ * apra-fleet-dm5.1: builds a short, human-readable "run title" sentence for
5
+ * the workflow viewer's header -- e.g.
6
+ * "win-dev1 working apra-fleet-x8r, apra-fleet-dm5 (P1/P2/P3)" for a
7
+ * fleet-sprint run -- instead of the bare workflow name the header showed
8
+ * before this.
9
+ *
10
+ * Reads `state.args` (apra-fleet-eft.2.2's `launchArgs`-derived field,
11
+ * currently populated only where a caller opts in -- apra-fleet-dm5.2 wires
12
+ * fleet-sprint's own runner.js to actually publish it). Deliberately reads
13
+ * only three plain, additive fields off it -- `members` (string[]),
14
+ * `targetIssues` (string[], the sprint's issue-root ids), `goal` (string,
15
+ * e.g. 'P1/P2') -- so this stays workflow-agnostic: any OTHER workflow's
16
+ * `args` shape (or no `args` at all) simply doesn't have these three fields
17
+ * and falls through to the plain workflow-name fallback below, never
18
+ * throwing and never rendering 'undefined'/an empty parenthetical/a
19
+ * dangling separator.
20
+ *
21
+ * Returns an ALREADY HTML-ESCAPED string (every user-supplied piece --
22
+ * member names, bead ids, the goal string -- is run through the shared
23
+ * `escapeHtml()` before being embedded into the sentence), safe to assign
24
+ * directly to an element's `innerHTML` in the browser-side render code
25
+ * below. This function's OWN source text is also embedded verbatim (via
26
+ * `.toString()`) into that same client-side `<script>`, same pattern as
27
+ * `renderBeadsHtml`/`escapeHtml` elsewhere in this codebase, so the exact
28
+ * code under test here is the exact code that renders in the browser.
29
+ *
30
+ * @param {{ workflowName?: string, args?: { members?: string[], targetIssues?: string[], goal?: string } } | null | undefined} state
31
+ * @returns {string}
32
+ */
33
+ export function buildRunTitle(state) {
34
+ const s = (state && typeof state === 'object') ? state : {};
35
+ const fallback = escapeHtml(
36
+ (typeof s.workflowName === 'string' && s.workflowName.length > 0) ? s.workflowName : 'Apra Fleet Workflow'
37
+ );
38
+
39
+ const args = (s.args && typeof s.args === 'object') ? s.args : null;
40
+ if (!args) return fallback;
41
+
42
+ const members = Array.isArray(args.members)
43
+ ? args.members.filter((m) => typeof m === 'string' && m.length > 0)
44
+ : [];
45
+ const targetIssues = Array.isArray(args.targetIssues)
46
+ ? args.targetIssues.filter((i) => typeof i === 'string' && i.length > 0)
47
+ : [];
48
+ const goal = (typeof args.goal === 'string' && args.goal.length > 0) ? args.goal : '';
49
+
50
+ // Every field is required to build the full sentence -- a partial set
51
+ // (e.g. members known but no goal yet) degrades cleanly to the plain
52
+ // workflow name rather than rendering a sentence with a missing clause.
53
+ if (members.length === 0 || targetIssues.length === 0 || goal.length === 0) return fallback;
54
+
55
+ const membersText = escapeHtml(members.join(', '));
56
+ const issuesText = escapeHtml(targetIssues.join(', '));
57
+ const goalText = escapeHtml(goal);
58
+
59
+ return `${membersText} working ${issuesText} (${goalText})`;
60
+ }
@@ -386,10 +386,14 @@ export class FleetWorkflow extends EventEmitter {
386
386
  * @param {import('../fleet-client/api.mjs').ApraFleet} fleetApi
387
387
  * @param {any} args
388
388
  */
389
- constructor(fleetApi, args = {}) {
389
+ constructor(fleetApi, args = {}, logPrefix = '') {
390
390
  super();
391
391
  this.fleetApi = fleetApi;
392
392
  this.args = args;
393
+ // (apra-fleet-20i.1.1) Optional per-run scenario label prepended to
394
+ // the [Workflow Log]/[Dispatch]/[Command] console.log lines below.
395
+ // Defaults to '' so existing callers get byte-identical output.
396
+ this.logPrefix = logPrefix;
393
397
  this.currentPhase = null;
394
398
  this.budget = {
395
399
  total: null,
@@ -503,7 +507,7 @@ export class FleetWorkflow extends EventEmitter {
503
507
  }
504
508
 
505
509
  log(msg) {
506
- console.log(`[Workflow Log] ${msg}`);
510
+ console.log(`${this.logPrefix}[Workflow Log] ${msg}`);
507
511
  this.emit('log', { phase: this._currentPhase(), msg, runId: this._currentRunId() });
508
512
  }
509
513
 
@@ -632,7 +636,7 @@ export class FleetWorkflow extends EventEmitter {
632
636
  const effectivePhase = opts.phase || this._currentPhase();
633
637
  const runId = this._currentRunId();
634
638
  if (effectivePhase) {
635
- console.log(`[Dispatch] phase: ${effectivePhase} | member: ${opts.member_name || opts.member_id} | label: ${opts.label || 'none'}`);
639
+ console.log(`${this.logPrefix}[Dispatch] phase: ${effectivePhase} | member: ${opts.member_name || opts.member_id} | label: ${opts.label || 'none'}`);
636
640
  }
637
641
 
638
642
  let compiledSchema = null;
@@ -1113,7 +1117,7 @@ export class FleetWorkflow extends EventEmitter {
1113
1117
  const effectivePhase = opts.phase || this._currentPhase();
1114
1118
  const runId = this._currentRunId();
1115
1119
  if (!opts.silent) {
1116
- console.log(`[Command] phase: ${effectivePhase} | member: ${opts.member_name || opts.member_id} | label: ${opts.label || 'none'}`);
1120
+ console.log(`${this.logPrefix}[Command] phase: ${effectivePhase} | member: ${opts.member_name || opts.member_id} | label: ${opts.label || 'none'}`);
1117
1121
  }
1118
1122
 
1119
1123
  let finalCmd = cmd;
@@ -0,0 +1,66 @@
1
+ # Knowledge Bank Agent
2
+
3
+ The Knowledge Bank (KB) workflow gives fleet members persistent, cross-session
4
+ codebase context. It runs in three phases per session.
5
+
6
+ ---
7
+
8
+ ## Phase 1 (Prime)
9
+
10
+ Run at the start of every session before touching any code.
11
+
12
+ ```
13
+ kb_session_prime
14
+ ```
15
+
16
+ - Reads the KB index for the current repo and returns stale or missing entries.
17
+ - Returns a list of recommended code intelligence calls to refresh stale context.
18
+ - After priming, dispatch all recommended calls using the fleet code intelligence
19
+ tools (code_graph, code_impact, code_query, code_context).
20
+
21
+ **If kb_session_prime is unavailable**, skip and proceed -- the KB is optional.
22
+
23
+ ---
24
+
25
+ ## Phase 2 (Capture)
26
+
27
+ Run after significant decisions or architectural choices during the session.
28
+
29
+ ```
30
+ kb_capture
31
+ ```
32
+
33
+ - Writes a new KB entry summarizing the current decision or finding.
34
+ - Run after: choosing an approach, discovering a non-obvious constraint, making
35
+ a design trade-off, or resolving a subtle bug.
36
+ - Do NOT run after routine code edits -- only when the WHY is non-obvious.
37
+
38
+ ---
39
+
40
+ ## Phase 3 (Harvest)
41
+
42
+ `kb_harvest` fires automatically (fire-and-forget) after `execute_prompt` completes,
43
+ passing the full session transcript -- the one thing a member cannot reliably supply
44
+ about its own session. You do not need to call it yourself; calling it without a
45
+ transcript is a no-op.
46
+
47
+ - Regex-extracts learnings from the transcript into durable KB entries.
48
+ - Low-trust: entries are always captured at confidence=UNVERIFIED with
49
+ author='harvest', source='harvest' -- distinct from entries you capture directly
50
+ via kb_capture in Phase 2.
51
+ - Ensures future sessions (and other members) benefit from work done this session
52
+ even when nothing was explicitly captured.
53
+
54
+ ---
55
+
56
+ ## Code Intelligence Tools
57
+
58
+ Use these fleet tools for cross-file tracing and symbol lookup. Never
59
+ plain-read files for structural questions -- use the tools instead.
60
+
61
+ | Tool | Purpose |
62
+ |------|---------|
63
+ | `code_graph` | Call graph for a symbol (callers + callees) |
64
+ | `code_impact` | Blast radius for a symbol (upstream affected) |
65
+ | `code_query` | Semantic search across codebase |
66
+ | `code_context` | Full symbol context (callers, callees, flows) |
@@ -67,7 +67,7 @@ When `execute_prompt` output contains a permission denial, call `compose_permiss
67
67
 
68
68
  > "Grant Bash(docker:*) to build-server, reason: integration tests, project folder ./my-project"
69
69
 
70
- The tool validates (blocks dangerous tools like sudo/env), expands co-occurrences (docker -> docker-compose), delivers the updated config, and appends to the project ledger for future use.
70
+ The tool validates (wildcard-matched denylist -- blocks sudo/env, `bash -c`, catch-alls and shell chaining; see [Never auto-granted](#never-auto-granted)), expands co-occurrences (docker -> docker-compose), delivers the updated config, and appends to the project ledger for future use.
71
71
 
72
72
  ## Role switch
73
73
 
@@ -75,7 +75,31 @@ When a member's primary mode changes (e.g., from doer to reviewer), re-run `comp
75
75
 
76
76
  ## Never auto-granted
77
77
 
78
- `sudo`, `su`, `env`, `printenv`, `nc`, `nmap` - the tool rejects these. Escalate to user.
78
+ `compose_permissions` hard-rejects a `grant` request - from ANY caller, with or
79
+ without a role - when it matches the `NEVER_AUTO_GRANT` denylist. Matching is
80
+ wildcard-based against a normalized form of the request (whitespace collapsed;
81
+ the `:` separating the command token from its argument pattern treated as a
82
+ space), so `Bash(sudo:*)`, `Bash(sudo *)` and `Bash(sudo apt-get install *)`
83
+ are all the same request and all rejected.
84
+
85
+ Three rules, any of which rejects:
86
+
87
+ 1. **Catch-all** - a payload that is nothing but wildcards, e.g. `Bash(*)`.
88
+ That is not "a wider grant", it is unrestricted execution.
89
+ 2. **Shell chaining** - the payload contains `|`, `;`, `&&`, a backtick, or
90
+ `$(`, any of which turns one approved command into an arbitrary chain
91
+ (`Bash(curl *|sh)`).
92
+ 3. **Denied command patterns** - `sudo`, `su`, `doas`, `bash -c` / `sh -c`,
93
+ `eval`, `env`, `printenv`, `nc`, `nmap`, `chmod 777`.
94
+
95
+ Escalate to the user for any of these. Note rule 3 is prefix-based, so an
96
+ unrelated command that merely starts with a denied token (`ncdu`, `envsubst`)
97
+ is also refused - over-blocking is the safe direction for a denylist, and an
98
+ operator can still add such a permission by hand.
99
+
100
+ A denylist can never be complete: `Bash(make *)`, `Bash(npm run *)`,
101
+ `Bash(node -e *)` all remain arbitrary execution in practice. The denylist is
102
+ the unconditional floor that applies to every caller.
79
103
 
80
104
  ## settings.json vs settings.local.json (Claude)
81
105
 
@@ -124,5 +148,5 @@ known equivalent gate.
124
148
  If `execute_prompt` fails with a `workspace_not_trusted` structured error, the CLI's own
125
149
  stderr will contain a `"...this workspace has not been trusted"` message - seed trust
126
150
  via `ensureWorkspaceTrusted(workFolder)` (invoked automatically at
127
- register_member/update_member and on every `compose_permissions` call once
128
- apra-fleet-eft.40.2 wires it in), then retry.
151
+ register_member/update_member, and on every `compose_permissions` call once that
152
+ wiring lands), then retry.
@@ -13,7 +13,16 @@
13
13
  "Bash(tee:*)", "Bash(xargs:*)", "Bash(sleep:*)",
14
14
  "Bash(kill:*)", "Bash(pkill:*)",
15
15
  "Bash(bash:*)", "Bash(sh:*)",
16
- "Bash(gh:*)", "Bash(jq:*)"
16
+ "Bash(gh:*)", "Bash(jq:*)",
17
+ "mcp__apra-fleet__kb_session_prime",
18
+ "mcp__apra-fleet__kb_query",
19
+ "mcp__apra-fleet__kb_stats",
20
+ "mcp__apra-fleet__kb_capture",
21
+ "mcp__apra-fleet__kb_feedback",
22
+ "mcp__apra-fleet__code_context",
23
+ "mcp__apra-fleet__code_graph",
24
+ "mcp__apra-fleet__code_impact",
25
+ "mcp__apra-fleet__code_query"
17
26
  ]
18
27
  }
19
28
  }
@@ -9,7 +9,14 @@
9
9
  "Bash(which:*)", "Bash(ls:*)", "Bash(cat:*)", "Bash(head:*)", "Bash(tail:*)",
10
10
  "Bash(find:*)", "Bash(wc:*)", "Bash(sort:*)", "Bash(diff:*)",
11
11
  "Bash(echo:*)", "Bash(grep:*)",
12
- "Bash(gh:*)", "Bash(jq:*)"
12
+ "Bash(gh:*)", "Bash(jq:*)",
13
+ "mcp__apra-fleet__kb_session_prime",
14
+ "mcp__apra-fleet__kb_query",
15
+ "mcp__apra-fleet__kb_feedback",
16
+ "mcp__apra-fleet__code_context",
17
+ "mcp__apra-fleet__code_graph",
18
+ "mcp__apra-fleet__code_impact",
19
+ "mcp__apra-fleet__code_query"
13
20
  ]
14
21
  }
15
22
  }
@@ -0,0 +1,20 @@
1
+ {
2
+ "dev": [
3
+ "mcp__apra-fleet__code_context",
4
+ "mcp__apra-fleet__code_impact",
5
+ "mcp__apra-fleet__code_query",
6
+ "mcp__apra-fleet__kb_resolve_contradiction",
7
+ "mcp__apra-fleet__kb_query",
8
+ "mcp__apra-fleet__kb_list",
9
+ "mcp__apra-fleet__kb_export"
10
+ ],
11
+ "reviewer": [
12
+ "mcp__apra-fleet__code_context",
13
+ "mcp__apra-fleet__code_impact",
14
+ "mcp__apra-fleet__code_query",
15
+ "mcp__apra-fleet__kb_resolve_contradiction",
16
+ "mcp__apra-fleet__kb_query",
17
+ "mcp__apra-fleet__kb_list",
18
+ "mcp__apra-fleet__kb_export"
19
+ ]
20
+ }
package/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.4.0"
2
+ "version": "0.4.1"
3
3
  }
@@ -1,127 +0,0 @@
1
- # Dolt conflict recovery: Tier 2 runbook (apra-fleet-eft.9.6)
2
-
3
- > **Wiring status (apra-fleet-vkc.1): LIVE.** The Path A -> Path B -> Tier 2
4
- > recovery ladder described here is no longer test-only. `dolt-recovery-tier2.mjs`
5
- > exports `buildDoltRecoveryLadder()`, which `dolt-sync.mjs`'s `doltPushAfter()`
6
- > invokes at its divergence terminal and which `runner.js`'s post-dispatch sync
7
- > bracket (`syncMemberAfterOrdered`) threads in, so a wedged clone at a real
8
- > D-push attempts this ladder before surfacing `BEADS_SYNC_CONFLICT`. Path A's
9
- > resolve-in-place step still requires an injected dolt sql-server runtime;
10
- > until one is wired into `runner.js`, Path A is reached and cleanly self-defers
11
- > to Path B (discard-and-re-bootstrap) in production.
12
-
13
- This is the runbook a REAL agent receives when it is dispatched to resolve a
14
- wedged beads (dolt) clone that the scripted recovery ladder could not close on
15
- its own. It is the dolt counterpart of the git conflict ladder's Tier 2
16
- runbook (`conflict-ladder.mjs`'s `buildConflictResolutionRunbookPrompt`) -- see
17
- that module's header comment for the git version of the same posture.
18
-
19
- ## When to use this runbook (vs the operator runbook)
20
-
21
- Use **this** runbook when: a fleet MEMBER's clone is wedged during an automated
22
- sprint, a human operator at a terminal cannot resolve it, and an agent has been
23
- dispatched (by `dolt-recovery-tier2.mjs`) as the last-resort escalation after
24
- the scripted Path A/Path B recovery ladder both failed.
25
-
26
- Use [the operator runbook](../../../docs/dolt-operator-conflict-runbook.md)
27
- instead when: you are a human operator with direct terminal/`dolt` CLI access
28
- to your own local beads clone, and `bd dolt pull` reported a merge conflict.
29
- That is a different actor (you at a terminal, not a dispatched agent), a
30
- different clone (your own, not a fleet member's), and a different entry point
31
- (manual resolution, not automated escalation).
32
-
33
- See also: the operator runbook links back here for the "I am a dispatched agent,
34
- not a human at a terminal" case.
35
-
36
- ## Script-first posture: when this is (and is not) dispatched
37
-
38
- The dolt sync discipline (Plan Part 3.3/3.4, apra-fleet-eft.9) is
39
- script-first: two scripted recovery paths run with **zero** agent dispatch
40
- before Tier 2 is ever considered:
41
-
42
- 1. **Path A** (`dolt-recovery.mjs`, apra-fleet-eft.9.4) -- scripted,
43
- resolve-in-place recovery for a plain single-row conflict in an
44
- allowlisted table (`issues` by default), gated behind two deterministic
45
- checks (conflicted table(s) all allowlisted; exactly one conflicted row).
46
- 2. **Path B** (`dolt-recovery-path-b.mjs`, apra-fleet-eft.9.5) -- the
47
- fallback for whatever Path A's gates reject (a multi-row conflict, a
48
- conflict outside the allowlist, or a genuine operational failure that
49
- makes resolve-in-place unsafe): discard the wedged clone's local dolt
50
- state and re-bootstrap fresh from the shared remote, replaying back the
51
- one pending mutation that mattered.
52
-
53
- Tier 2 (this runbook, dispatched by `dolt-recovery-tier2.mjs`'s
54
- `recoverDoltConflict()`) is the escalation of LAST resort: it is dispatched
55
- **only** when
56
-
57
- - Path A's deterministic gate rejected the conflict shape, **and**
58
- - Path B was also attempted and itself failed (a scripted step -- most
59
- commonly `bd bootstrap` or the mutation replay -- returned output that is
60
- not one of the specific, already-classified recognized failure/gotcha
61
- patterns).
62
-
63
- The recovery procedure must never proceed blind past an output it does not
64
- recognize. Every escalation records the wedged state (see below) before
65
- dispatch -- there is no silent "try something and hope" step anywhere in this
66
- ladder.
67
-
68
- ## The wedged state you are handed
69
-
70
- Every Tier 2 dispatch is armed with a recorded **wedged state** snapshot,
71
- captured immediately before dispatch, with these fields:
72
-
73
- - `member` -- which fleet member/clone is wedged.
74
- - `clonePath` -- the local `.beads` embedded dolt data dir this recovery was
75
- operating against (default `.beads/embeddeddolt`).
76
- - `conflictShape` -- the last `assessConflictGates()` result Path A computed
77
- (which table(s) conflicted, how many conflicting rows, which gate(s)
78
- failed), or `null` if Path A never got far enough to compute one.
79
- - `lastOutput` -- the raw error/output text of the last scripted step that
80
- failed (Path B's failure if Path B ran, otherwise Path A's).
81
- - `stage` -- which stage of the ladder produced this wedged state (e.g.
82
- `path-b-exhausted`).
83
- - `recordedAt` -- an ISO timestamp of when the state was captured.
84
-
85
- Do not guess past what this snapshot tells you -- if it is incomplete or
86
- ambiguous, say so in your report rather than inventing what you think the
87
- conflict must have been.
88
-
89
- ## Steps to follow, in order
90
-
91
- 1. Read the wedged state above in full. Confirm you understand `clonePath`,
92
- `conflictShape`, and `lastOutput` before touching anything.
93
- 2. Run `bd dolt status` (or, if unavailable, inspect `.beads/metadata.json`
94
- and the embedded dolt data dir directly) to confirm the clone's actual
95
- current state matches what the wedged-state snapshot describes. If it does
96
- not (e.g. someone already fixed it), say so and stop -- do not "helpfully"
97
- redo work that already happened.
98
- 3. If a merge is genuinely still open and conflicted, use `dolt sql-server`
99
- against the SAME embedded data dir referenced by `clonePath` (see Path A's
100
- own module doc for the exact server-start / `dolt_allow_commit_conflicts`
101
- / `DOLT_MERGE` / `dolt_conflicts` sequence) to inspect every conflicting
102
- row with real judgment -- not a blind `--ours`/`--theirs` rule. Understand
103
- BOTH sides of each conflicting row before deciding how to resolve it.
104
- 4. Resolve each conflicting row with `CALL DOLT_CONFLICTS_RESOLVE(...)`
105
- (table-name arg required) and commit with `CALL DOLT_COMMIT(...)`. Verify
106
- with `SELECT * FROM dolt_conflicts` that zero rows remain before moving on.
107
- 5. Confirm zero data loss: `SELECT * FROM dolt_log` must show commits from
108
- BOTH sides of the original conflict.
109
- 6. Flip `.beads/metadata.json` back to `dolt_mode: "embedded"` and stop the
110
- ephemeral sql-server -- exactly as Path A's own teardown does, and
111
- regardless of whether you succeeded or not (reversibility always).
112
- 7. `bd dolt pull` then `bd dolt push` to republish the reconciled clone.
113
- Confirm the push actually succeeds -- your own belief that you fixed it is
114
- never sufficient; a mechanical re-verification (a clean `bd dolt status`
115
- and a genuinely successful push) is what decides success, the same
116
- posture as the git ladder's Tier 2 re-verification in
117
- `runner.js`'s `syncMemberAfter`.
118
- 8. If, after this, the clone is still wedged or you are not confident the
119
- conflict was resolved correctly, do **not** force a push or discard data
120
- to make the error go away. Report exactly what you observed (the
121
- conflicting row(s), what you tried, and why it did not resolve) so a
122
- human can take over -- silently discarding real work to unblock a sprint
123
- is worse than staying blocked.
124
-
125
- Do not run any `bd` beads-content command unrelated to this recovery (no
126
- closing/reopening beads) -- this is a pure dolt-clone-recovery dispatch, not a
127
- development streak.