@apralabs/apra-fleet 0.4.2 → 0.4.4

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 (997) hide show
  1. package/README.md +103 -34
  2. package/dist/agents/backlog-groomer.md +87 -14
  3. package/dist/agents/ci-watcher.md +35 -9
  4. package/dist/agents/deployer.md +63 -11
  5. package/dist/agents/doer.md +99 -41
  6. package/dist/agents/harvester.md +47 -27
  7. package/dist/agents/integ-test-runner.md +38 -10
  8. package/dist/agents/kb-reconciler.md +37 -7
  9. package/dist/agents/plan-reviewer.md +145 -32
  10. package/dist/agents/planner.md +180 -69
  11. package/dist/agents/regression-test-runner.md +98 -64
  12. package/dist/agents/reviewer.md +117 -45
  13. package/dist/agents/schemas/backlog-groomer-output.json +1 -1
  14. package/dist/agents/schemas/doer-output.json +32 -0
  15. package/dist/agents/schemas/harvester-input.json +1 -5
  16. package/dist/agents/schemas/plan-reviewer-output.json +37 -0
  17. package/dist/agents/schemas/planner-output.json +1 -1
  18. package/dist/agents/schemas/regression-test-runner-output.json +41 -7
  19. package/dist/agents/schemas/reviewer-output.json +62 -3
  20. package/dist/cli/agent-transform.d.ts +90 -2
  21. package/dist/cli/agent-transform.js +310 -20
  22. package/dist/cli/auth.d.ts +1 -0
  23. package/dist/cli/auth.js +66 -17
  24. package/dist/cli/beads-install.d.ts +35 -0
  25. package/dist/cli/beads-install.js +125 -0
  26. package/dist/cli/beads-pin.d.ts +5 -0
  27. package/dist/cli/beads-pin.js +27 -0
  28. package/dist/cli/call.d.ts +27 -0
  29. package/dist/cli/call.js +177 -0
  30. package/dist/cli/config.d.ts +31 -6
  31. package/dist/cli/config.js +113 -36
  32. package/dist/cli/dolt-install.d.ts +18 -2
  33. package/dist/cli/dolt-install.js +46 -15
  34. package/dist/cli/fleet-se-guard.d.ts +51 -0
  35. package/dist/cli/fleet-se-guard.js +215 -0
  36. package/dist/cli/install-guard.d.ts +54 -0
  37. package/dist/cli/install-guard.js +132 -4
  38. package/dist/cli/install.d.ts +100 -11
  39. package/dist/cli/install.js +864 -139
  40. package/dist/cli/kb-commit.d.ts +2 -1
  41. package/dist/cli/kb-commit.js +1 -1
  42. package/dist/cli/kb-directives.js +2 -1
  43. package/dist/cli/kb-import.d.ts +2 -1
  44. package/dist/cli/kb-import.js +1 -1
  45. package/dist/cli/register-member.js +26 -5
  46. package/dist/cli/remove-member.d.ts +4 -0
  47. package/dist/cli/remove-member.js +63 -0
  48. package/dist/cli/secret.js +9 -0
  49. package/dist/cli/start.js +59 -4
  50. package/dist/cli/status.d.ts +3 -0
  51. package/dist/cli/status.js +45 -12
  52. package/dist/cli/stop.js +64 -9
  53. package/dist/cli/uninstall.js +101 -15
  54. package/dist/cli/update.js +33 -2
  55. package/dist/cli/watch.js +1 -1
  56. package/dist/cli/workflow.js +3 -2
  57. package/dist/commands/kb-server.d.ts +3 -0
  58. package/dist/commands/kb-server.js +52 -5
  59. package/dist/hub-service/http-server.d.ts +5 -1
  60. package/dist/hub-service/http-server.js +55 -5
  61. package/dist/index.js +158 -11
  62. package/dist/os/child-env-bound.d.ts +77 -0
  63. package/dist/os/child-env-bound.js +171 -0
  64. package/dist/os/linux.d.ts +13 -2
  65. package/dist/os/linux.js +75 -16
  66. package/dist/os/macos.d.ts +1 -1
  67. package/dist/os/macos.js +2 -11
  68. package/dist/os/os-commands.d.ts +78 -4
  69. package/dist/os/windows-gitbash.d.ts +6 -0
  70. package/dist/os/windows-gitbash.js +32 -3
  71. package/dist/os/windows-wrapper.d.ts +0 -4
  72. package/dist/os/windows-wrapper.js +2 -1
  73. package/dist/os/windows.d.ts +11 -2
  74. package/dist/os/windows.js +121 -32
  75. package/dist/paths.d.ts +21 -0
  76. package/dist/paths.js +35 -0
  77. package/dist/providers/agy.d.ts +120 -7
  78. package/dist/providers/agy.js +741 -86
  79. package/dist/providers/claude-permission-denial.d.ts +7 -0
  80. package/dist/providers/claude-permission-denial.js +137 -0
  81. package/dist/providers/claude.d.ts +132 -6
  82. package/dist/providers/claude.js +644 -48
  83. package/dist/providers/codex.d.ts +4 -2
  84. package/dist/providers/codex.js +23 -2
  85. package/dist/providers/copilot.d.ts +4 -2
  86. package/dist/providers/copilot.js +24 -2
  87. package/dist/providers/none.d.ts +4 -2
  88. package/dist/providers/none.js +17 -2
  89. package/dist/providers/opencode.d.ts +12 -2
  90. package/dist/providers/opencode.js +135 -54
  91. package/dist/providers/provider.d.ts +368 -35
  92. package/dist/providers/provider.js +219 -2
  93. package/dist/services/agent-provisioner.d.ts +29 -0
  94. package/dist/services/agent-provisioner.js +107 -0
  95. package/dist/services/agent-shadow.d.ts +96 -0
  96. package/dist/services/agent-shadow.js +479 -0
  97. package/dist/services/agy-project.d.ts +103 -0
  98. package/dist/services/agy-project.js +354 -0
  99. package/dist/services/auth-socket.d.ts +25 -0
  100. package/dist/services/auth-socket.js +72 -27
  101. package/dist/services/auth-web.js +2 -2
  102. package/dist/services/budget-awareness.d.ts +11 -11
  103. package/dist/services/budget-awareness.js +15 -3
  104. package/dist/services/claude-local-scope-mcp.d.ts +19 -0
  105. package/dist/services/claude-local-scope-mcp.js +91 -0
  106. package/dist/services/cloud/aws.js +2 -1
  107. package/dist/services/cloud/lifecycle.js +52 -6
  108. package/dist/services/cloud/task-wrapper.d.ts +0 -9
  109. package/dist/services/cloud/task-wrapper.js +15 -6
  110. package/dist/services/credential-cleanup.js +35 -17
  111. package/dist/services/event-loop-watchdog.d.ts +32 -0
  112. package/dist/services/event-loop-watchdog.js +140 -0
  113. package/dist/services/exit-drain.d.ts +44 -0
  114. package/dist/services/exit-drain.js +52 -0
  115. package/dist/services/github-app.js +32 -4
  116. package/dist/services/http-transport.d.ts +50 -1
  117. package/dist/services/http-transport.js +238 -25
  118. package/dist/services/in-flight-agents.d.ts +2 -0
  119. package/dist/services/in-flight-agents.js +4 -0
  120. package/dist/services/knowledge/bible-basis-filter.d.ts +53 -0
  121. package/dist/services/knowledge/bible-basis-filter.js +134 -0
  122. package/dist/services/knowledge/bible-blob-id.d.ts +44 -0
  123. package/dist/services/knowledge/bible-blob-id.js +113 -0
  124. package/dist/services/knowledge/bible-import.d.ts +65 -0
  125. package/dist/services/knowledge/bible-import.js +211 -0
  126. package/dist/services/knowledge/file-hash.d.ts +31 -0
  127. package/dist/services/knowledge/file-hash.js +153 -23
  128. package/dist/services/knowledge/http-provider.d.ts +4 -3
  129. package/dist/services/knowledge/http-provider.js +17 -5
  130. package/dist/services/knowledge/kb-config.d.ts +42 -0
  131. package/dist/services/knowledge/kb-config.js +54 -0
  132. package/dist/services/knowledge/kb-maintainer-grant.d.ts +15 -0
  133. package/dist/services/knowledge/kb-maintainer-grant.js +34 -0
  134. package/dist/services/knowledge/kb-providers.d.ts +11 -1
  135. package/dist/services/knowledge/kb-providers.js +199 -17
  136. package/dist/services/knowledge/kb-removed-scope-keys.d.ts +28 -0
  137. package/dist/services/knowledge/kb-removed-scope-keys.js +59 -0
  138. package/dist/services/knowledge/kb-scopes.d.ts +14 -0
  139. package/dist/services/knowledge/kb-scopes.js +47 -0
  140. package/dist/services/knowledge/kb-self.d.ts +91 -0
  141. package/dist/services/knowledge/kb-self.js +198 -0
  142. package/dist/services/knowledge/member-bible-view.d.ts +21 -0
  143. package/dist/services/knowledge/member-bible-view.js +194 -0
  144. package/dist/services/knowledge/pre-init.js +1 -0
  145. package/dist/services/knowledge/project-slug.js +2 -2
  146. package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
  147. package/dist/services/knowledge/require-sqlite-project.js +38 -0
  148. package/dist/services/knowledge/sqlite-provider.d.ts +64 -11
  149. package/dist/services/knowledge/sqlite-provider.js +303 -41
  150. package/dist/services/knowledge/types.d.ts +45 -2
  151. package/dist/services/member-access-secret.d.ts +70 -0
  152. package/dist/services/member-access-secret.js +195 -0
  153. package/dist/services/member-call-counts.d.ts +24 -0
  154. package/dist/services/member-call-counts.js +58 -0
  155. package/dist/services/member-config-io.d.ts +192 -0
  156. package/dist/services/member-config-io.js +443 -0
  157. package/dist/services/member-fleet-install.d.ts +710 -0
  158. package/dist/services/member-fleet-install.js +1895 -0
  159. package/dist/services/member-secret-env.d.ts +42 -0
  160. package/dist/services/member-secret-env.js +68 -0
  161. package/dist/services/member-tool-allowlist.d.ts +49 -0
  162. package/dist/services/member-tool-allowlist.js +111 -0
  163. package/dist/services/model-pricing.d.ts +19 -0
  164. package/dist/services/model-pricing.js +60 -10
  165. package/dist/services/port-holder.d.ts +86 -0
  166. package/dist/services/port-holder.js +351 -0
  167. package/dist/services/preflight-check.js +2 -0
  168. package/dist/services/registry.d.ts +13 -2
  169. package/dist/services/registry.js +27 -1
  170. package/dist/services/relay-strategy.d.ts +2 -0
  171. package/dist/services/relay-strategy.js +8 -0
  172. package/dist/services/secret-token.d.ts +38 -0
  173. package/dist/services/secret-token.js +51 -0
  174. package/dist/services/server-lifecycle.d.ts +26 -0
  175. package/dist/services/server-lifecycle.js +85 -0
  176. package/dist/services/service-manager/index.d.ts +7 -1
  177. package/dist/services/service-manager/index.js +17 -4
  178. package/dist/services/service-manager/linux.d.ts +1 -1
  179. package/dist/services/service-manager/linux.js +15 -7
  180. package/dist/services/service-manager/macos.d.ts +11 -1
  181. package/dist/services/service-manager/macos.js +45 -7
  182. package/dist/services/service-manager/service-path.d.ts +24 -0
  183. package/dist/services/service-manager/service-path.js +55 -0
  184. package/dist/services/service-manager/types.d.ts +39 -2
  185. package/dist/services/service-manager/types.js +29 -0
  186. package/dist/services/service-manager/windows.d.ts +194 -3
  187. package/dist/services/service-manager/windows.js +705 -30
  188. package/dist/services/service-notice.d.ts +14 -0
  189. package/dist/services/service-notice.js +62 -0
  190. package/dist/services/service-start-guard.d.ts +20 -0
  191. package/dist/services/service-start-guard.js +86 -0
  192. package/dist/services/session-cost.d.ts +24 -0
  193. package/dist/services/session-cost.js +105 -0
  194. package/dist/services/session-mcp-config.d.ts +83 -0
  195. package/dist/services/session-mcp-config.js +211 -0
  196. package/dist/services/sftp.d.ts +34 -0
  197. package/dist/services/sftp.js +304 -76
  198. package/dist/services/shell-probe.d.ts +0 -24
  199. package/dist/services/shell-probe.js +28 -3
  200. package/dist/services/singleton.d.ts +68 -2
  201. package/dist/services/singleton.js +168 -11
  202. package/dist/services/sprint-coordination.js +9 -3
  203. package/dist/services/ssh.d.ts +27 -0
  204. package/dist/services/ssh.js +287 -40
  205. package/dist/services/stall/find-log-file.js +12 -5
  206. package/dist/services/stall/index.d.ts +1 -1
  207. package/dist/services/stall/read-log-tail.d.ts +23 -0
  208. package/dist/services/stall/read-log-tail.js +53 -12
  209. package/dist/services/stall/stall-detector.d.ts +78 -5
  210. package/dist/services/stall/stall-detector.js +296 -39
  211. package/dist/services/stall/stall-poller.d.ts +16 -0
  212. package/dist/services/stall/stall-poller.js +50 -6
  213. package/dist/services/stopped-marker.d.ts +16 -0
  214. package/dist/services/stopped-marker.js +55 -0
  215. package/dist/services/strategy.d.ts +33 -1
  216. package/dist/services/strategy.js +165 -19
  217. package/dist/services/substitution-engine.js +2 -2
  218. package/dist/services/supervisor-service-cleanup.d.ts +52 -0
  219. package/dist/services/supervisor-service-cleanup.js +332 -0
  220. package/dist/services/tool-registry.d.ts +8 -1
  221. package/dist/services/tool-registry.js +164 -61
  222. package/dist/services/tool-scope.d.ts +58 -0
  223. package/dist/services/tool-scope.js +99 -0
  224. package/dist/services/vcs/azure-devops.d.ts +66 -1
  225. package/dist/services/vcs/azure-devops.js +192 -21
  226. package/dist/services/vcs/types.d.ts +1 -1
  227. package/dist/services/watch/project-resolver.js +1 -0
  228. package/dist/skills/auto-sprint-args/SKILL.md +2 -2
  229. package/dist/skills/fleet-sprint-cli/SKILL.md +48 -6
  230. package/dist/skills/pm/SKILL.md +4 -4
  231. package/dist/skills/pm/cost.md +0 -3
  232. package/dist/skills/pm/fleet-addendum.md +2 -2
  233. package/dist/skills/pm/index.md +4 -2
  234. package/dist/skills/pm/kb-reconcile.md +29 -14
  235. package/dist/skills/pm/kb-review.md +1 -0
  236. package/dist/skills/pm/sprint.md +5 -5
  237. package/dist/tools/check-status.d.ts +60 -9
  238. package/dist/tools/check-status.js +211 -52
  239. package/dist/tools/child-id-allocator.d.ts +2 -2
  240. package/dist/tools/child-id-allocator.js +1 -1
  241. package/dist/tools/code-index-heal.d.ts +8 -0
  242. package/dist/tools/code-index-heal.js +21 -0
  243. package/dist/tools/code-index-state.d.ts +45 -0
  244. package/dist/tools/code-index-state.js +115 -0
  245. package/dist/tools/code-intelligence-codebase-memory.js +6 -33
  246. package/dist/tools/code-intelligence-freshness.js +1 -1
  247. package/dist/tools/code-intelligence-gitnexus.d.ts +30 -0
  248. package/dist/tools/code-intelligence-gitnexus.js +333 -57
  249. package/dist/tools/code-intelligence-kb-enrich.js +7 -6
  250. package/dist/tools/code-intelligence-readiness.d.ts +99 -0
  251. package/dist/tools/code-intelligence-readiness.js +206 -0
  252. package/dist/tools/code-intelligence-reindex.d.ts +195 -0
  253. package/dist/tools/code-intelligence-reindex.js +530 -50
  254. package/dist/tools/code-intelligence-telemetry.d.ts +6 -1
  255. package/dist/tools/code-intelligence-telemetry.js +12 -3
  256. package/dist/tools/code-intelligence.d.ts +81 -31
  257. package/dist/tools/code-intelligence.js +156 -52
  258. package/dist/tools/compose-permissions.d.ts +63 -2
  259. package/dist/tools/compose-permissions.js +673 -72
  260. package/dist/tools/credential-store-set.js +1 -1
  261. package/dist/tools/execute-command.d.ts +11 -0
  262. package/dist/tools/execute-command.js +111 -32
  263. package/dist/tools/execute-prompt.d.ts +69 -12
  264. package/dist/tools/execute-prompt.js +1610 -895
  265. package/dist/tools/kb-bible-commit.d.ts +65 -0
  266. package/dist/tools/kb-bible-commit.js +239 -0
  267. package/dist/tools/kb-capture.d.ts +15 -11
  268. package/dist/tools/kb-capture.js +71 -16
  269. package/dist/tools/kb-context.d.ts +27 -7
  270. package/dist/tools/kb-context.js +60 -9
  271. package/dist/tools/kb-export.d.ts +98 -9
  272. package/dist/tools/kb-export.js +230 -92
  273. package/dist/tools/kb-feedback.d.ts +13 -9
  274. package/dist/tools/kb-feedback.js +16 -8
  275. package/dist/tools/kb-freshness-sweep.d.ts +11 -7
  276. package/dist/tools/kb-freshness-sweep.js +10 -8
  277. package/dist/tools/kb-harvest.d.ts +11 -7
  278. package/dist/tools/kb-harvest.js +7 -7
  279. package/dist/tools/kb-import.d.ts +26 -10
  280. package/dist/tools/kb-import.js +170 -159
  281. package/dist/tools/kb-invalidate.d.ts +17 -10
  282. package/dist/tools/kb-invalidate.js +41 -8
  283. package/dist/tools/kb-list.d.ts +14 -10
  284. package/dist/tools/kb-list.js +33 -11
  285. package/dist/tools/kb-promote.d.ts +11 -7
  286. package/dist/tools/kb-promote.js +14 -8
  287. package/dist/tools/kb-query.d.ts +21 -11
  288. package/dist/tools/kb-query.js +76 -13
  289. package/dist/tools/kb-reconcile-prefilter.d.ts +11 -7
  290. package/dist/tools/kb-reconcile-prefilter.js +13 -9
  291. package/dist/tools/kb-resolve-contradiction.d.ts +11 -7
  292. package/dist/tools/kb-resolve-contradiction.js +10 -8
  293. package/dist/tools/kb-session-prime.d.ts +14 -7
  294. package/dist/tools/kb-session-prime.js +44 -44
  295. package/dist/tools/kb-setup.d.ts +11 -4
  296. package/dist/tools/kb-setup.js +146 -27
  297. package/dist/tools/kb-stats.d.ts +11 -10
  298. package/dist/tools/kb-stats.js +84 -82
  299. package/dist/tools/list-members.d.ts +2 -2
  300. package/dist/tools/list-members.js +6 -2
  301. package/dist/tools/member-detail.d.ts +5 -2
  302. package/dist/tools/member-detail.js +105 -17
  303. package/dist/tools/member-reservation.d.ts +60 -3
  304. package/dist/tools/member-reservation.js +61 -20
  305. package/dist/tools/provision-auth.d.ts +118 -1
  306. package/dist/tools/provision-auth.js +402 -92
  307. package/dist/tools/provision-vcs-auth.d.ts +93 -3
  308. package/dist/tools/provision-vcs-auth.js +209 -49
  309. package/dist/tools/receive-files.js +3 -1
  310. package/dist/tools/register-member.d.ts +44 -15
  311. package/dist/tools/register-member.js +175 -70
  312. package/dist/tools/remove-member.js +118 -15
  313. package/dist/tools/send-email.d.ts +2 -2
  314. package/dist/tools/send-files.js +6 -4
  315. package/dist/tools/session-stats.d.ts +17 -0
  316. package/dist/tools/session-stats.js +27 -0
  317. package/dist/tools/setup-git-app.js +11 -7
  318. package/dist/tools/shutdown-server.d.ts +2 -0
  319. package/dist/tools/shutdown-server.js +28 -1
  320. package/dist/tools/update-agent-cli.d.ts +19 -0
  321. package/dist/tools/update-agent-cli.js +59 -2
  322. package/dist/tools/update-member.d.ts +23 -17
  323. package/dist/tools/update-member.js +181 -18
  324. package/dist/tools/vcs-credential-exec.d.ts +127 -0
  325. package/dist/tools/vcs-credential-exec.js +203 -0
  326. package/dist/types.d.ts +111 -1
  327. package/dist/utils/agent-helpers.js +2 -0
  328. package/dist/utils/auth-env.d.ts +15 -4
  329. package/dist/utils/auth-env.js +52 -23
  330. package/dist/utils/find-on-path.d.ts +37 -0
  331. package/dist/utils/find-on-path.js +85 -0
  332. package/dist/utils/log-helpers.d.ts +37 -0
  333. package/dist/utils/log-helpers.js +108 -22
  334. package/dist/utils/owner-only-fs.d.ts +56 -0
  335. package/dist/utils/owner-only-fs.js +98 -0
  336. package/dist/utils/process-utils.d.ts +28 -0
  337. package/dist/utils/process-utils.js +68 -0
  338. package/dist/utils/prompt-errors.js +11 -2
  339. package/dist/utils/session-caller.d.ts +4 -2
  340. package/dist/utils/session-caller.js +3 -2
  341. package/dist/utils/shell-escape.d.ts +58 -3
  342. package/dist/utils/shell-escape.js +91 -5
  343. package/dist/utils/ssh-error-messages.js +3 -0
  344. package/dist/utils/vcs-provider-detect.d.ts +65 -0
  345. package/dist/utils/vcs-provider-detect.js +109 -0
  346. package/dist/utils/workspace-trust.d.ts +26 -0
  347. package/dist/utils/workspace-trust.js +91 -1
  348. package/dist/workflows/auto-sprint.js +397 -56
  349. package/package.json +15 -10
  350. package/packages/apra-fleet-client/package.json +2 -2
  351. package/packages/apra-fleet-client/src/client/api.mjs +864 -31
  352. package/packages/apra-fleet-client/src/client/auto-start.mjs +434 -0
  353. package/packages/apra-fleet-client/src/client/client.mjs +9 -0
  354. package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
  355. package/packages/apra-fleet-client/src/client/factory.mjs +23 -4
  356. package/packages/apra-fleet-client/src/client/reconnecting-transport.mjs +137 -0
  357. package/packages/apra-fleet-client/src/client/server-resolution.mjs +267 -30
  358. package/packages/apra-fleet-client/src/client/transport.mjs +37 -3
  359. package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
  360. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +87 -14
  361. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +35 -9
  362. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +63 -11
  363. package/packages/apra-fleet-se/apra-pm/agents/doer.md +99 -41
  364. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +47 -27
  365. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +38 -10
  366. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +37 -7
  367. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +145 -32
  368. package/packages/apra-fleet-se/apra-pm/agents/planner.md +180 -69
  369. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +98 -64
  370. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +117 -45
  371. package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +1 -1
  372. package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +32 -0
  373. package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +1 -5
  374. package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
  375. package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +1 -1
  376. package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +41 -7
  377. package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +62 -3
  378. package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +4 -4
  379. package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -3
  380. package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -2
  381. package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +4 -2
  382. package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +29 -14
  383. package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +1 -0
  384. package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +5 -5
  385. package/packages/apra-fleet-se/bin/cli.mjs +326 -48
  386. package/packages/apra-fleet-se/bin/serve.mjs +218 -11
  387. package/packages/apra-fleet-se/fleet-sprint/abort.mjs +517 -0
  388. package/packages/apra-fleet-se/fleet-sprint/backlog-role.mjs +93 -0
  389. package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +646 -0
  390. package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +825 -0
  391. package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +217 -0
  392. package/packages/apra-fleet-se/fleet-sprint/beads-memory-hygiene.mjs +201 -0
  393. package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +745 -0
  394. package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +447 -0
  395. package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
  396. package/packages/apra-fleet-se/fleet-sprint/ci-gate.mjs +353 -0
  397. package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +20 -0
  398. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +121 -15
  399. package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +539 -0
  400. package/packages/apra-fleet-se/fleet-sprint/dispatch-accounting.mjs +270 -0
  401. package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +204 -0
  402. package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1310 -0
  403. package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
  404. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +53 -15
  405. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +281 -0
  406. package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +1 -1
  407. package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +3 -3
  408. package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
  409. package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
  410. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1327 -44
  411. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +470 -4
  412. package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
  413. package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
  414. package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
  415. package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +747 -0
  416. package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +543 -0
  417. package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +613 -0
  418. package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
  419. package/packages/apra-fleet-se/fleet-sprint/kb-hints.mjs +181 -0
  420. package/packages/apra-fleet-se/fleet-sprint/kb-injection.mjs +64 -0
  421. package/packages/apra-fleet-se/fleet-sprint/kb-maintainer.mjs +298 -0
  422. package/packages/apra-fleet-se/fleet-sprint/kb.mjs +1684 -0
  423. package/packages/apra-fleet-se/fleet-sprint/lower-quality.mjs +39 -0
  424. package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
  425. package/packages/apra-fleet-se/fleet-sprint/member-align.mjs +391 -0
  426. package/packages/apra-fleet-se/fleet-sprint/member-call.mjs +374 -0
  427. package/packages/apra-fleet-se/fleet-sprint/member-init-probe.mjs +644 -0
  428. package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +699 -0
  429. package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +802 -0
  430. package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
  431. package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
  432. package/packages/apra-fleet-se/fleet-sprint/orphan-reclaim.mjs +153 -0
  433. package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
  434. package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +218 -0
  435. package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +869 -0
  436. package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +295 -0
  437. package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +466 -0
  438. package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +212 -0
  439. package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
  440. package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +395 -0
  441. package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +345 -0
  442. package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +264 -0
  443. package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +179 -0
  444. package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +230 -0
  445. package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +365 -0
  446. package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +259 -0
  447. package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +617 -0
  448. package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1434 -0
  449. package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
  450. package/packages/apra-fleet-se/fleet-sprint/runner.js +2289 -9928
  451. package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +24 -0
  452. package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +147 -12
  453. package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +111 -0
  454. package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +347 -0
  455. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +48 -6
  456. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +98 -25
  457. package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +590 -0
  458. package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +339 -0
  459. package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +185 -0
  460. package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
  461. package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +218 -0
  462. package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1445 -0
  463. package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +284 -23
  464. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +170 -21
  465. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
  466. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +354 -0
  467. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +189 -16
  468. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +9 -4
  469. package/packages/apra-fleet-se/fleet-sprint/verify-block.mjs +152 -0
  470. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +311 -22
  471. package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
  472. package/packages/apra-fleet-se/package.json +2 -2
  473. package/packages/apra-fleet-se/src/supervisor/api.mjs +919 -0
  474. package/packages/apra-fleet-se/src/supervisor/backlog-member.mjs +332 -0
  475. package/packages/apra-fleet-se/src/supervisor/backlog.mjs +982 -0
  476. package/packages/apra-fleet-se/src/supervisor/beads-identity.mjs +246 -0
  477. package/packages/apra-fleet-se/src/supervisor/beads-view.mjs +438 -0
  478. package/packages/apra-fleet-se/src/supervisor/child-port.mjs +36 -0
  479. package/packages/apra-fleet-se/src/supervisor/dashboard.mjs +1659 -0
  480. package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +350 -0
  481. package/packages/apra-fleet-se/src/supervisor/dolt-orphan-sweep.mjs +338 -0
  482. package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +279 -0
  483. package/packages/apra-fleet-se/src/supervisor/history-view.mjs +276 -0
  484. package/packages/apra-fleet-se/src/supervisor/history.mjs +328 -0
  485. package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +521 -0
  486. package/packages/apra-fleet-se/src/supervisor/launch-form.mjs +444 -0
  487. package/packages/apra-fleet-se/src/supervisor/ledger.mjs +629 -0
  488. package/packages/apra-fleet-se/src/supervisor/lib/exec-bd.mjs +303 -0
  489. package/packages/apra-fleet-se/src/supervisor/log-timestamp.mjs +51 -0
  490. package/packages/apra-fleet-se/src/supervisor/log-view.mjs +159 -0
  491. package/packages/apra-fleet-se/src/supervisor/proxy.mjs +474 -0
  492. package/packages/apra-fleet-se/src/supervisor/readopt.mjs +136 -0
  493. package/packages/apra-fleet-se/src/supervisor/reconcile.mjs +263 -0
  494. package/packages/apra-fleet-se/src/supervisor/rename-with-retry.mjs +87 -0
  495. package/packages/apra-fleet-se/src/supervisor/scope-overlap.mjs +327 -0
  496. package/packages/apra-fleet-se/src/supervisor/self-log.mjs +133 -0
  497. package/packages/apra-fleet-se/src/supervisor/server.mjs +399 -0
  498. package/packages/apra-fleet-se/src/supervisor/spawner.mjs +542 -0
  499. package/packages/apra-fleet-se/src/supervisor/sprint-identity.mjs +96 -0
  500. package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +987 -0
  501. package/packages/apra-fleet-workflow/package.json +1 -1
  502. package/packages/apra-fleet-workflow/src/viewer/index.mjs +81 -15
  503. package/packages/apra-fleet-workflow/src/viewer/run-summary.mjs +127 -0
  504. package/packages/apra-fleet-workflow/src/workflow/index.mjs +118 -10
  505. package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +75 -25
  506. package/skills/fleet/SKILL.md +8 -8
  507. package/skills/fleet/auth-azdevops.md +14 -3
  508. package/skills/fleet/auth-bitbucket.md +2 -2
  509. package/skills/fleet/auth-github.md +5 -4
  510. package/skills/fleet/onboarding.md +3 -3
  511. package/skills/fleet/permissions.md +14 -1
  512. package/skills/fleet/profiles/node.json +1 -1
  513. package/skills/fleet/profiles/tag-kb-reconciler.json +2 -6
  514. package/skills/fleet/troubleshooting.md +3 -3
  515. package/version.json +1 -1
  516. package/dist/cli/agent-transform.d.ts.map +0 -1
  517. package/dist/cli/agent-transform.js.map +0 -1
  518. package/dist/cli/auth.d.ts.map +0 -1
  519. package/dist/cli/auth.js.map +0 -1
  520. package/dist/cli/config.d.ts.map +0 -1
  521. package/dist/cli/config.js.map +0 -1
  522. package/dist/cli/dolt-install.d.ts.map +0 -1
  523. package/dist/cli/dolt-install.js.map +0 -1
  524. package/dist/cli/install-guard.d.ts.map +0 -1
  525. package/dist/cli/install-guard.js.map +0 -1
  526. package/dist/cli/install.d.ts.map +0 -1
  527. package/dist/cli/install.js.map +0 -1
  528. package/dist/cli/join.d.ts.map +0 -1
  529. package/dist/cli/join.js.map +0 -1
  530. package/dist/cli/kb-commit.d.ts.map +0 -1
  531. package/dist/cli/kb-commit.js.map +0 -1
  532. package/dist/cli/kb-directives.d.ts.map +0 -1
  533. package/dist/cli/kb-directives.js.map +0 -1
  534. package/dist/cli/kb-import.d.ts.map +0 -1
  535. package/dist/cli/kb-import.js.map +0 -1
  536. package/dist/cli/register-member.d.ts.map +0 -1
  537. package/dist/cli/register-member.js.map +0 -1
  538. package/dist/cli/restart.d.ts.map +0 -1
  539. package/dist/cli/restart.js.map +0 -1
  540. package/dist/cli/secret.d.ts.map +0 -1
  541. package/dist/cli/secret.js.map +0 -1
  542. package/dist/cli/spoke.d.ts.map +0 -1
  543. package/dist/cli/spoke.js.map +0 -1
  544. package/dist/cli/start.d.ts.map +0 -1
  545. package/dist/cli/start.js.map +0 -1
  546. package/dist/cli/status.d.ts.map +0 -1
  547. package/dist/cli/status.js.map +0 -1
  548. package/dist/cli/stop.d.ts.map +0 -1
  549. package/dist/cli/stop.js.map +0 -1
  550. package/dist/cli/uninstall.d.ts.map +0 -1
  551. package/dist/cli/uninstall.js.map +0 -1
  552. package/dist/cli/update.d.ts.map +0 -1
  553. package/dist/cli/update.js.map +0 -1
  554. package/dist/cli/watch.d.ts.map +0 -1
  555. package/dist/cli/watch.js.map +0 -1
  556. package/dist/cli/workflow-assets.d.ts.map +0 -1
  557. package/dist/cli/workflow-assets.js.map +0 -1
  558. package/dist/cli/workflow.d.ts.map +0 -1
  559. package/dist/cli/workflow.js.map +0 -1
  560. package/dist/commands/kb-server.d.ts.map +0 -1
  561. package/dist/commands/kb-server.js.map +0 -1
  562. package/dist/delivery-mode.d.ts.map +0 -1
  563. package/dist/delivery-mode.js.map +0 -1
  564. package/dist/hub-service/activity.d.ts.map +0 -1
  565. package/dist/hub-service/activity.js.map +0 -1
  566. package/dist/hub-service/audit-log.d.ts.map +0 -1
  567. package/dist/hub-service/audit-log.js.map +0 -1
  568. package/dist/hub-service/db/pool.d.ts.map +0 -1
  569. package/dist/hub-service/db/pool.js.map +0 -1
  570. package/dist/hub-service/enrollment.d.ts.map +0 -1
  571. package/dist/hub-service/enrollment.js.map +0 -1
  572. package/dist/hub-service/envelope-routes.d.ts.map +0 -1
  573. package/dist/hub-service/envelope-routes.js.map +0 -1
  574. package/dist/hub-service/handlers/installers.d.ts.map +0 -1
  575. package/dist/hub-service/handlers/installers.js.map +0 -1
  576. package/dist/hub-service/http-server.d.ts.map +0 -1
  577. package/dist/hub-service/http-server.js.map +0 -1
  578. package/dist/hub-service/hub-jwt.d.ts.map +0 -1
  579. package/dist/hub-service/hub-jwt.js.map +0 -1
  580. package/dist/hub-service/jwt-revocation.d.ts.map +0 -1
  581. package/dist/hub-service/jwt-revocation.js.map +0 -1
  582. package/dist/hub-service/machines.d.ts.map +0 -1
  583. package/dist/hub-service/machines.js.map +0 -1
  584. package/dist/hub-service/main.d.ts.map +0 -1
  585. package/dist/hub-service/main.js.map +0 -1
  586. package/dist/hub-service/member-tokens.d.ts.map +0 -1
  587. package/dist/hub-service/member-tokens.js.map +0 -1
  588. package/dist/hub-service/member-view.d.ts.map +0 -1
  589. package/dist/hub-service/member-view.js.map +0 -1
  590. package/dist/hub-service/members.d.ts.map +0 -1
  591. package/dist/hub-service/members.js.map +0 -1
  592. package/dist/hub-service/presence.d.ts.map +0 -1
  593. package/dist/hub-service/presence.js.map +0 -1
  594. package/dist/hub-service/project-view.d.ts.map +0 -1
  595. package/dist/hub-service/project-view.js.map +0 -1
  596. package/dist/hub-service/projects.d.ts.map +0 -1
  597. package/dist/hub-service/projects.js.map +0 -1
  598. package/dist/hub-service/relay-queue.d.ts.map +0 -1
  599. package/dist/hub-service/relay-queue.js.map +0 -1
  600. package/dist/hub-service/session-jwt.d.ts.map +0 -1
  601. package/dist/hub-service/session-jwt.js.map +0 -1
  602. package/dist/hub-service/usage.d.ts.map +0 -1
  603. package/dist/hub-service/usage.js.map +0 -1
  604. package/dist/hub-service/users.d.ts.map +0 -1
  605. package/dist/hub-service/users.js.map +0 -1
  606. package/dist/hub-service/workspaces.d.ts.map +0 -1
  607. package/dist/hub-service/workspaces.js.map +0 -1
  608. package/dist/index.d.ts.map +0 -1
  609. package/dist/index.js.map +0 -1
  610. package/dist/onboarding/text.d.ts.map +0 -1
  611. package/dist/onboarding/text.js.map +0 -1
  612. package/dist/os/git-bash-candidates.d.ts.map +0 -1
  613. package/dist/os/git-bash-candidates.js.map +0 -1
  614. package/dist/os/index.d.ts.map +0 -1
  615. package/dist/os/index.js.map +0 -1
  616. package/dist/os/linux.d.ts.map +0 -1
  617. package/dist/os/linux.js.map +0 -1
  618. package/dist/os/macos.d.ts.map +0 -1
  619. package/dist/os/macos.js.map +0 -1
  620. package/dist/os/os-commands.d.ts.map +0 -1
  621. package/dist/os/os-commands.js.map +0 -1
  622. package/dist/os/windows-gitbash.d.ts.map +0 -1
  623. package/dist/os/windows-gitbash.js.map +0 -1
  624. package/dist/os/windows-wrapper.d.ts.map +0 -1
  625. package/dist/os/windows-wrapper.js.map +0 -1
  626. package/dist/os/windows.d.ts.map +0 -1
  627. package/dist/os/windows.js.map +0 -1
  628. package/dist/paths.d.ts.map +0 -1
  629. package/dist/paths.js.map +0 -1
  630. package/dist/providers/agy.d.ts.map +0 -1
  631. package/dist/providers/agy.js.map +0 -1
  632. package/dist/providers/claude.d.ts.map +0 -1
  633. package/dist/providers/claude.js.map +0 -1
  634. package/dist/providers/codex.d.ts.map +0 -1
  635. package/dist/providers/codex.js.map +0 -1
  636. package/dist/providers/copilot.d.ts.map +0 -1
  637. package/dist/providers/copilot.js.map +0 -1
  638. package/dist/providers/email/headers.d.ts.map +0 -1
  639. package/dist/providers/email/headers.js.map +0 -1
  640. package/dist/providers/email/index.d.ts.map +0 -1
  641. package/dist/providers/email/index.js.map +0 -1
  642. package/dist/providers/email/provider.d.ts.map +0 -1
  643. package/dist/providers/email/provider.js.map +0 -1
  644. package/dist/providers/email/sendgrid.d.ts.map +0 -1
  645. package/dist/providers/email/sendgrid.js.map +0 -1
  646. package/dist/providers/email/smtp.d.ts.map +0 -1
  647. package/dist/providers/email/smtp.js.map +0 -1
  648. package/dist/providers/index.d.ts.map +0 -1
  649. package/dist/providers/index.js.map +0 -1
  650. package/dist/providers/none.d.ts.map +0 -1
  651. package/dist/providers/none.js.map +0 -1
  652. package/dist/providers/opencode.d.ts.map +0 -1
  653. package/dist/providers/opencode.js.map +0 -1
  654. package/dist/providers/provider.d.ts.map +0 -1
  655. package/dist/providers/provider.js.map +0 -1
  656. package/dist/services/agent-provisioner.d.ts.map +0 -1
  657. package/dist/services/agent-provisioner.js.map +0 -1
  658. package/dist/services/auth-socket.d.ts.map +0 -1
  659. package/dist/services/auth-socket.js.map +0 -1
  660. package/dist/services/auth-web.d.ts.map +0 -1
  661. package/dist/services/auth-web.js.map +0 -1
  662. package/dist/services/budget-awareness.d.ts.map +0 -1
  663. package/dist/services/budget-awareness.js.map +0 -1
  664. package/dist/services/cloud/activity.d.ts.map +0 -1
  665. package/dist/services/cloud/activity.js.map +0 -1
  666. package/dist/services/cloud/aws.d.ts.map +0 -1
  667. package/dist/services/cloud/aws.js.map +0 -1
  668. package/dist/services/cloud/cost.d.ts.map +0 -1
  669. package/dist/services/cloud/cost.js.map +0 -1
  670. package/dist/services/cloud/idle-manager.d.ts.map +0 -1
  671. package/dist/services/cloud/idle-manager.js.map +0 -1
  672. package/dist/services/cloud/lifecycle.d.ts.map +0 -1
  673. package/dist/services/cloud/lifecycle.js.map +0 -1
  674. package/dist/services/cloud/task-wrapper.d.ts.map +0 -1
  675. package/dist/services/cloud/task-wrapper.js.map +0 -1
  676. package/dist/services/cloud/types.d.ts.map +0 -1
  677. package/dist/services/cloud/types.js.map +0 -1
  678. package/dist/services/cloud-sync.d.ts.map +0 -1
  679. package/dist/services/cloud-sync.js.map +0 -1
  680. package/dist/services/context-admission.d.ts.map +0 -1
  681. package/dist/services/context-admission.js.map +0 -1
  682. package/dist/services/credential-cleanup.d.ts.map +0 -1
  683. package/dist/services/credential-cleanup.js.map +0 -1
  684. package/dist/services/credential-store.d.ts.map +0 -1
  685. package/dist/services/credential-store.js.map +0 -1
  686. package/dist/services/event-bus.d.ts.map +0 -1
  687. package/dist/services/event-bus.js.map +0 -1
  688. package/dist/services/file-chunker.d.ts.map +0 -1
  689. package/dist/services/file-chunker.js.map +0 -1
  690. package/dist/services/file-transfer-relay.d.ts.map +0 -1
  691. package/dist/services/file-transfer-relay.js.map +0 -1
  692. package/dist/services/file-transfer.d.ts.map +0 -1
  693. package/dist/services/file-transfer.js.map +0 -1
  694. package/dist/services/git-config.d.ts.map +0 -1
  695. package/dist/services/git-config.js.map +0 -1
  696. package/dist/services/github-app.d.ts.map +0 -1
  697. package/dist/services/github-app.js.map +0 -1
  698. package/dist/services/http-transport.d.ts.map +0 -1
  699. package/dist/services/http-transport.js.map +0 -1
  700. package/dist/services/hub-client.d.ts.map +0 -1
  701. package/dist/services/hub-client.js.map +0 -1
  702. package/dist/services/icons.d.ts.map +0 -1
  703. package/dist/services/icons.js.map +0 -1
  704. package/dist/services/jwt.d.ts.map +0 -1
  705. package/dist/services/jwt.js.map +0 -1
  706. package/dist/services/knowledge/audn.d.ts.map +0 -1
  707. package/dist/services/knowledge/audn.js.map +0 -1
  708. package/dist/services/knowledge/file-hash.d.ts.map +0 -1
  709. package/dist/services/knowledge/file-hash.js.map +0 -1
  710. package/dist/services/knowledge/http-provider.d.ts.map +0 -1
  711. package/dist/services/knowledge/http-provider.js.map +0 -1
  712. package/dist/services/knowledge/kb-providers.d.ts.map +0 -1
  713. package/dist/services/knowledge/kb-providers.js.map +0 -1
  714. package/dist/services/knowledge/kb-scope-input.d.ts +0 -5
  715. package/dist/services/knowledge/kb-scope-input.d.ts.map +0 -1
  716. package/dist/services/knowledge/kb-scope-input.js +0 -11
  717. package/dist/services/knowledge/kb-scope-input.js.map +0 -1
  718. package/dist/services/knowledge/kb-service.d.ts.map +0 -1
  719. package/dist/services/knowledge/kb-service.js.map +0 -1
  720. package/dist/services/knowledge/path-validation.d.ts.map +0 -1
  721. package/dist/services/knowledge/path-validation.js.map +0 -1
  722. package/dist/services/knowledge/pre-init.d.ts.map +0 -1
  723. package/dist/services/knowledge/pre-init.js.map +0 -1
  724. package/dist/services/knowledge/project-slug.d.ts.map +0 -1
  725. package/dist/services/knowledge/project-slug.js.map +0 -1
  726. package/dist/services/knowledge/sqlite-provider.d.ts.map +0 -1
  727. package/dist/services/knowledge/sqlite-provider.js.map +0 -1
  728. package/dist/services/knowledge/types.d.ts.map +0 -1
  729. package/dist/services/knowledge/types.js.map +0 -1
  730. package/dist/services/known-hosts.d.ts.map +0 -1
  731. package/dist/services/known-hosts.js.map +0 -1
  732. package/dist/services/known-sessions.d.ts.map +0 -1
  733. package/dist/services/known-sessions.js.map +0 -1
  734. package/dist/services/member-home.d.ts.map +0 -1
  735. package/dist/services/member-home.js.map +0 -1
  736. package/dist/services/member-remote-url.d.ts.map +0 -1
  737. package/dist/services/member-remote-url.js.map +0 -1
  738. package/dist/services/model-pricing.d.ts.map +0 -1
  739. package/dist/services/model-pricing.js.map +0 -1
  740. package/dist/services/onboarding.d.ts.map +0 -1
  741. package/dist/services/onboarding.js.map +0 -1
  742. package/dist/services/orphan-recovery.d.ts.map +0 -1
  743. package/dist/services/orphan-recovery.js.map +0 -1
  744. package/dist/services/pending-responses.d.ts.map +0 -1
  745. package/dist/services/pending-responses.js.map +0 -1
  746. package/dist/services/preflight-check.d.ts.map +0 -1
  747. package/dist/services/preflight-check.js.map +0 -1
  748. package/dist/services/registry.d.ts.map +0 -1
  749. package/dist/services/registry.js.map +0 -1
  750. package/dist/services/relay-context.d.ts.map +0 -1
  751. package/dist/services/relay-context.js.map +0 -1
  752. package/dist/services/relay-executor.d.ts.map +0 -1
  753. package/dist/services/relay-executor.js.map +0 -1
  754. package/dist/services/relay-request.d.ts.map +0 -1
  755. package/dist/services/relay-request.js.map +0 -1
  756. package/dist/services/relay-strategy.d.ts.map +0 -1
  757. package/dist/services/relay-strategy.js.map +0 -1
  758. package/dist/services/service-manager/index.d.ts.map +0 -1
  759. package/dist/services/service-manager/index.js.map +0 -1
  760. package/dist/services/service-manager/linux.d.ts.map +0 -1
  761. package/dist/services/service-manager/linux.js.map +0 -1
  762. package/dist/services/service-manager/macos.d.ts.map +0 -1
  763. package/dist/services/service-manager/macos.js.map +0 -1
  764. package/dist/services/service-manager/types.d.ts.map +0 -1
  765. package/dist/services/service-manager/types.js.map +0 -1
  766. package/dist/services/service-manager/windows.d.ts.map +0 -1
  767. package/dist/services/service-manager/windows.js.map +0 -1
  768. package/dist/services/session-registry.d.ts.map +0 -1
  769. package/dist/services/session-registry.js.map +0 -1
  770. package/dist/services/sftp.d.ts.map +0 -1
  771. package/dist/services/sftp.js.map +0 -1
  772. package/dist/services/shell-probe.d.ts.map +0 -1
  773. package/dist/services/shell-probe.js.map +0 -1
  774. package/dist/services/singleton.d.ts.map +0 -1
  775. package/dist/services/singleton.js.map +0 -1
  776. package/dist/services/sprint-coordination.d.ts.map +0 -1
  777. package/dist/services/sprint-coordination.js.map +0 -1
  778. package/dist/services/ssh.d.ts.map +0 -1
  779. package/dist/services/ssh.js.map +0 -1
  780. package/dist/services/stall/find-log-file.d.ts.map +0 -1
  781. package/dist/services/stall/find-log-file.js.map +0 -1
  782. package/dist/services/stall/index.d.ts.map +0 -1
  783. package/dist/services/stall/index.js.map +0 -1
  784. package/dist/services/stall/log-path-resolver.d.ts.map +0 -1
  785. package/dist/services/stall/log-path-resolver.js.map +0 -1
  786. package/dist/services/stall/read-log-tail.d.ts.map +0 -1
  787. package/dist/services/stall/read-log-tail.js.map +0 -1
  788. package/dist/services/stall/stall-detector.d.ts.map +0 -1
  789. package/dist/services/stall/stall-detector.js.map +0 -1
  790. package/dist/services/stall/stall-poller.d.ts.map +0 -1
  791. package/dist/services/stall/stall-poller.js.map +0 -1
  792. package/dist/services/stall/time-utils.d.ts.map +0 -1
  793. package/dist/services/stall/time-utils.js.map +0 -1
  794. package/dist/services/statusline.d.ts.map +0 -1
  795. package/dist/services/statusline.js.map +0 -1
  796. package/dist/services/strategy.d.ts.map +0 -1
  797. package/dist/services/strategy.js.map +0 -1
  798. package/dist/services/substitution-engine.d.ts.map +0 -1
  799. package/dist/services/substitution-engine.js.map +0 -1
  800. package/dist/services/task-cleanup.d.ts.map +0 -1
  801. package/dist/services/task-cleanup.js.map +0 -1
  802. package/dist/services/token-issuer.d.ts.map +0 -1
  803. package/dist/services/token-issuer.js.map +0 -1
  804. package/dist/services/tool-registry.d.ts.map +0 -1
  805. package/dist/services/tool-registry.js.map +0 -1
  806. package/dist/services/update-check.d.ts.map +0 -1
  807. package/dist/services/update-check.js.map +0 -1
  808. package/dist/services/user-config.d.ts.map +0 -1
  809. package/dist/services/user-config.js.map +0 -1
  810. package/dist/services/vcs/azure-devops.d.ts.map +0 -1
  811. package/dist/services/vcs/azure-devops.js.map +0 -1
  812. package/dist/services/vcs/bitbucket.d.ts.map +0 -1
  813. package/dist/services/vcs/bitbucket.js.map +0 -1
  814. package/dist/services/vcs/constants.d.ts.map +0 -1
  815. package/dist/services/vcs/constants.js.map +0 -1
  816. package/dist/services/vcs/github.d.ts.map +0 -1
  817. package/dist/services/vcs/github.js.map +0 -1
  818. package/dist/services/vcs/types.d.ts.map +0 -1
  819. package/dist/services/vcs/types.js.map +0 -1
  820. package/dist/services/version-check.d.ts.map +0 -1
  821. package/dist/services/version-check.js.map +0 -1
  822. package/dist/services/watch/fleet-log.d.ts.map +0 -1
  823. package/dist/services/watch/fleet-log.js.map +0 -1
  824. package/dist/services/watch/project-resolver.d.ts.map +0 -1
  825. package/dist/services/watch/project-resolver.js.map +0 -1
  826. package/dist/services/watch/transcript-formatter.d.ts.map +0 -1
  827. package/dist/services/watch/transcript-formatter.js.map +0 -1
  828. package/dist/smoke-test.d.ts.map +0 -1
  829. package/dist/smoke-test.js.map +0 -1
  830. package/dist/tools/check-status.d.ts.map +0 -1
  831. package/dist/tools/check-status.js.map +0 -1
  832. package/dist/tools/child-id-allocator.d.ts.map +0 -1
  833. package/dist/tools/child-id-allocator.js.map +0 -1
  834. package/dist/tools/cloud-control.d.ts.map +0 -1
  835. package/dist/tools/cloud-control.js.map +0 -1
  836. package/dist/tools/code-intelligence-codebase-memory.d.ts.map +0 -1
  837. package/dist/tools/code-intelligence-codebase-memory.js.map +0 -1
  838. package/dist/tools/code-intelligence-freshness.d.ts.map +0 -1
  839. package/dist/tools/code-intelligence-freshness.js.map +0 -1
  840. package/dist/tools/code-intelligence-gitnexus.d.ts.map +0 -1
  841. package/dist/tools/code-intelligence-gitnexus.js.map +0 -1
  842. package/dist/tools/code-intelligence-kb-enrich.d.ts.map +0 -1
  843. package/dist/tools/code-intelligence-kb-enrich.js.map +0 -1
  844. package/dist/tools/code-intelligence-reindex.d.ts.map +0 -1
  845. package/dist/tools/code-intelligence-reindex.js.map +0 -1
  846. package/dist/tools/code-intelligence-telemetry.d.ts.map +0 -1
  847. package/dist/tools/code-intelligence-telemetry.js.map +0 -1
  848. package/dist/tools/code-intelligence-tests.d.ts.map +0 -1
  849. package/dist/tools/code-intelligence-tests.js.map +0 -1
  850. package/dist/tools/code-intelligence.d.ts.map +0 -1
  851. package/dist/tools/code-intelligence.js.map +0 -1
  852. package/dist/tools/compose-permissions.d.ts.map +0 -1
  853. package/dist/tools/compose-permissions.js.map +0 -1
  854. package/dist/tools/credential-store-delete.d.ts.map +0 -1
  855. package/dist/tools/credential-store-delete.js.map +0 -1
  856. package/dist/tools/credential-store-list.d.ts.map +0 -1
  857. package/dist/tools/credential-store-list.js.map +0 -1
  858. package/dist/tools/credential-store-set.d.ts.map +0 -1
  859. package/dist/tools/credential-store-set.js.map +0 -1
  860. package/dist/tools/credential-store-update.d.ts.map +0 -1
  861. package/dist/tools/credential-store-update.js.map +0 -1
  862. package/dist/tools/dolt-push-mutex.d.ts.map +0 -1
  863. package/dist/tools/dolt-push-mutex.js.map +0 -1
  864. package/dist/tools/execute-command.d.ts.map +0 -1
  865. package/dist/tools/execute-command.js.map +0 -1
  866. package/dist/tools/execute-prompt.d.ts.map +0 -1
  867. package/dist/tools/execute-prompt.js.map +0 -1
  868. package/dist/tools/get-member-model-pricing.d.ts.map +0 -1
  869. package/dist/tools/get-member-model-pricing.js.map +0 -1
  870. package/dist/tools/kb-capture.d.ts.map +0 -1
  871. package/dist/tools/kb-capture.js.map +0 -1
  872. package/dist/tools/kb-context.d.ts.map +0 -1
  873. package/dist/tools/kb-context.js.map +0 -1
  874. package/dist/tools/kb-export.d.ts.map +0 -1
  875. package/dist/tools/kb-export.js.map +0 -1
  876. package/dist/tools/kb-feedback.d.ts.map +0 -1
  877. package/dist/tools/kb-feedback.js.map +0 -1
  878. package/dist/tools/kb-freshness-sweep.d.ts.map +0 -1
  879. package/dist/tools/kb-freshness-sweep.js.map +0 -1
  880. package/dist/tools/kb-harvest.d.ts.map +0 -1
  881. package/dist/tools/kb-harvest.js.map +0 -1
  882. package/dist/tools/kb-import.d.ts.map +0 -1
  883. package/dist/tools/kb-import.js.map +0 -1
  884. package/dist/tools/kb-invalidate.d.ts.map +0 -1
  885. package/dist/tools/kb-invalidate.js.map +0 -1
  886. package/dist/tools/kb-list.d.ts.map +0 -1
  887. package/dist/tools/kb-list.js.map +0 -1
  888. package/dist/tools/kb-promote.d.ts.map +0 -1
  889. package/dist/tools/kb-promote.js.map +0 -1
  890. package/dist/tools/kb-query.d.ts.map +0 -1
  891. package/dist/tools/kb-query.js.map +0 -1
  892. package/dist/tools/kb-reconcile-prefilter.d.ts.map +0 -1
  893. package/dist/tools/kb-reconcile-prefilter.js.map +0 -1
  894. package/dist/tools/kb-resolve-contradiction.d.ts.map +0 -1
  895. package/dist/tools/kb-resolve-contradiction.js.map +0 -1
  896. package/dist/tools/kb-session-prime.d.ts.map +0 -1
  897. package/dist/tools/kb-session-prime.js.map +0 -1
  898. package/dist/tools/kb-setup.d.ts.map +0 -1
  899. package/dist/tools/kb-setup.js.map +0 -1
  900. package/dist/tools/kb-stats.d.ts.map +0 -1
  901. package/dist/tools/kb-stats.js.map +0 -1
  902. package/dist/tools/list-members.d.ts.map +0 -1
  903. package/dist/tools/list-members.js.map +0 -1
  904. package/dist/tools/member-detail.d.ts.map +0 -1
  905. package/dist/tools/member-detail.js.map +0 -1
  906. package/dist/tools/member-reservation.d.ts.map +0 -1
  907. package/dist/tools/member-reservation.js.map +0 -1
  908. package/dist/tools/monitor-task.d.ts.map +0 -1
  909. package/dist/tools/monitor-task.js.map +0 -1
  910. package/dist/tools/provision-auth.d.ts.map +0 -1
  911. package/dist/tools/provision-auth.js.map +0 -1
  912. package/dist/tools/provision-vcs-auth.d.ts.map +0 -1
  913. package/dist/tools/provision-vcs-auth.js.map +0 -1
  914. package/dist/tools/receive-files.d.ts.map +0 -1
  915. package/dist/tools/receive-files.js.map +0 -1
  916. package/dist/tools/register-member.d.ts.map +0 -1
  917. package/dist/tools/register-member.js.map +0 -1
  918. package/dist/tools/remove-member.d.ts.map +0 -1
  919. package/dist/tools/remove-member.js.map +0 -1
  920. package/dist/tools/report-status.d.ts.map +0 -1
  921. package/dist/tools/report-status.js.map +0 -1
  922. package/dist/tools/respond-to-message.d.ts.map +0 -1
  923. package/dist/tools/respond-to-message.js.map +0 -1
  924. package/dist/tools/revoke-vcs-auth.d.ts.map +0 -1
  925. package/dist/tools/revoke-vcs-auth.js.map +0 -1
  926. package/dist/tools/send-email.d.ts.map +0 -1
  927. package/dist/tools/send-email.js.map +0 -1
  928. package/dist/tools/send-files.d.ts.map +0 -1
  929. package/dist/tools/send-files.js.map +0 -1
  930. package/dist/tools/send-message.d.ts.map +0 -1
  931. package/dist/tools/send-message.js.map +0 -1
  932. package/dist/tools/setup-git-app.d.ts.map +0 -1
  933. package/dist/tools/setup-git-app.js.map +0 -1
  934. package/dist/tools/setup-ssh-key.d.ts.map +0 -1
  935. package/dist/tools/setup-ssh-key.js.map +0 -1
  936. package/dist/tools/shutdown-server.d.ts.map +0 -1
  937. package/dist/tools/shutdown-server.js.map +0 -1
  938. package/dist/tools/stop-prompt.d.ts.map +0 -1
  939. package/dist/tools/stop-prompt.js.map +0 -1
  940. package/dist/tools/update-agent-cli.d.ts.map +0 -1
  941. package/dist/tools/update-agent-cli.js.map +0 -1
  942. package/dist/tools/update-member.d.ts.map +0 -1
  943. package/dist/tools/update-member.js.map +0 -1
  944. package/dist/tools/version.d.ts.map +0 -1
  945. package/dist/tools/version.js.map +0 -1
  946. package/dist/types.d.ts.map +0 -1
  947. package/dist/types.js.map +0 -1
  948. package/dist/utils/agent-helpers.d.ts.map +0 -1
  949. package/dist/utils/agent-helpers.js.map +0 -1
  950. package/dist/utils/ansi.d.ts.map +0 -1
  951. package/dist/utils/ansi.js.map +0 -1
  952. package/dist/utils/auth-env.d.ts.map +0 -1
  953. package/dist/utils/auth-env.js.map +0 -1
  954. package/dist/utils/collect-secret.d.ts.map +0 -1
  955. package/dist/utils/collect-secret.js.map +0 -1
  956. package/dist/utils/credential-validation.d.ts.map +0 -1
  957. package/dist/utils/credential-validation.js.map +0 -1
  958. package/dist/utils/crypto.d.ts.map +0 -1
  959. package/dist/utils/crypto.js.map +0 -1
  960. package/dist/utils/deep-merge.d.ts.map +0 -1
  961. package/dist/utils/deep-merge.js.map +0 -1
  962. package/dist/utils/file-permissions.d.ts.map +0 -1
  963. package/dist/utils/file-permissions.js.map +0 -1
  964. package/dist/utils/gpu-parser.d.ts.map +0 -1
  965. package/dist/utils/gpu-parser.js.map +0 -1
  966. package/dist/utils/log-helpers.d.ts.map +0 -1
  967. package/dist/utils/log-helpers.js.map +0 -1
  968. package/dist/utils/oob-timeout.d.ts.map +0 -1
  969. package/dist/utils/oob-timeout.js.map +0 -1
  970. package/dist/utils/opencode-model-validation.d.ts.map +0 -1
  971. package/dist/utils/opencode-model-validation.js.map +0 -1
  972. package/dist/utils/pid-helpers.d.ts.map +0 -1
  973. package/dist/utils/pid-helpers.js.map +0 -1
  974. package/dist/utils/platform.d.ts.map +0 -1
  975. package/dist/utils/platform.js.map +0 -1
  976. package/dist/utils/process-utils.d.ts.map +0 -1
  977. package/dist/utils/process-utils.js.map +0 -1
  978. package/dist/utils/prompt-errors.d.ts.map +0 -1
  979. package/dist/utils/prompt-errors.js.map +0 -1
  980. package/dist/utils/resolve-member.d.ts.map +0 -1
  981. package/dist/utils/resolve-member.js.map +0 -1
  982. package/dist/utils/secure-input.d.ts.map +0 -1
  983. package/dist/utils/secure-input.js.map +0 -1
  984. package/dist/utils/session-caller.d.ts.map +0 -1
  985. package/dist/utils/session-caller.js.map +0 -1
  986. package/dist/utils/shell-escape.d.ts.map +0 -1
  987. package/dist/utils/shell-escape.js.map +0 -1
  988. package/dist/utils/skill-matrix.d.ts.map +0 -1
  989. package/dist/utils/skill-matrix.js.map +0 -1
  990. package/dist/utils/ssh-error-messages.d.ts.map +0 -1
  991. package/dist/utils/ssh-error-messages.js.map +0 -1
  992. package/dist/utils/work-folder-validation.d.ts.map +0 -1
  993. package/dist/utils/work-folder-validation.js.map +0 -1
  994. package/dist/utils/workspace-trust.d.ts.map +0 -1
  995. package/dist/utils/workspace-trust.js.map +0 -1
  996. package/dist/version.d.ts.map +0 -1
  997. package/dist/version.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { joinForOS, resolveHomeDir } from './provider.js';
1
+ import { joinForOS, resolveHomeDir, defaultUsageLimitSignal, suggestedGrantsForDenial } from './provider.js';
2
2
  import { classifyPromptError } from '../utils/prompt-errors.js';
3
3
  import { escapeDoubleQuoted } from '../os/os-commands.js';
4
4
  import { wrapPowerShellEncoded } from '../os/windows.js';
@@ -6,18 +6,52 @@ import { stripAnsi } from '../utils/ansi.js';
6
6
  import { logWarn } from '../utils/log-helpers.js';
7
7
  import { getModelOverride } from '../services/user-config.js';
8
8
  import { transformAgentForAgy } from '../cli/agent-transform.js';
9
+ import { MEMBER_ALLOWED_TOOLS, MEMBER_DENIED_TOOLS } from '../services/member-tool-allowlist.js';
10
+ import { agyMemberDenyRules, joinMemberPath, pruneLegacyMcpInMemberFile, readMemberJson, writeMemberJson, writeSecretBearingConfig, MemberConfigNotJsonError, MEMBER_MCP_SERVER_NAME, } from '../services/member-config-io.js';
11
+ import { isPosixShell } from '../utils/agent-helpers.js';
9
12
  import fs from 'node:fs';
10
13
  import path from 'node:path';
11
- import os from 'node:os';
12
- const AGY_MODEL_FOR_TIER = {
13
- cheap: 'Gemini 3.5 Flash (Medium)',
14
- standard: 'Gemini 3.1 Pro (Low)',
15
- premium: 'Claude Opus 4.6 (Thinking)',
14
+ /**
15
+ * SINGLE source of truth for AGY's tier -> model mapping, keyed by the STABLE
16
+ * slug ids `agy models` prints in its first column (verified accepted by
17
+ * `agy --model <slug>` on 1.2.8).
18
+ *
19
+ * This used to be two maps that drifted: display names ("Gemini 3.5 Flash
20
+ * (Medium)") for dispatch and slugs ("gemini-3.5-flash-lite") for
21
+ * modelTiers()/modelForTier(). Both catalogs went stale, and because the doer
22
+ * runs on the CHEAP tier, EVERY doer dispatch in an agy sprint came back as
23
+ * invalid model selection (--model "Gemini 3.5 Flash (Medium)"): model ...
24
+ * is not recognized as a known model or custom model in settings
25
+ * -- which the engine then reported as unparseable structured output, three
26
+ * rounds in a row, with no code ever written. Slugs are preferred over display
27
+ * names precisely because they are the stable identifier, and keeping ONE map
28
+ * removes the drift that caused this.
29
+ */
30
+ export const AGY_MODEL_FOR_TIER = {
31
+ cheap: 'gemini-3.8-flash-low',
32
+ standard: 'gemini-3.8-flash-high',
33
+ premium: 'gemini-3.1-pro-high',
16
34
  };
17
35
  // Paths to the fleet-installed agy helper scripts on the member machine.
18
36
  // Unix (bash): uses $HOME; Windows (PowerShell): uses $env:USERPROFILE.
19
37
  const SCRIPTS_UNIX = '$HOME/.apra-fleet/scripts';
20
38
  const SCRIPTS_WIN = '$env:USERPROFILE\\.apra-fleet\\scripts';
39
+ /**
40
+ * Wrap a JavaScript snippet for remote node execution across member operating systems.
41
+ * On Windows, wraps as PowerShell here-string encoded in base64 (-EncodedCommand)
42
+ * targeting `node --input-type=commonjs -` so that no outer shell (PowerShell,
43
+ * cmd.exe, or MSYS2/Git Bash) can re-parse or unescape backslashes, quotes, or
44
+ * regexes in the script.
45
+ * On POSIX (Linux/macOS), delivers via verbatim heredoc to `node --input-type=commonjs -`.
46
+ * Passing `--input-type=commonjs` explicitly prevents Node 22+ from treating stdin as TypeScript.
47
+ */
48
+ export function buildAgyNodeCommand(jsCode, agentOs = 'linux', eofMarker = 'FLEET_NODE_EOF') {
49
+ if (agentOs === 'windows') {
50
+ const psScript = `$code = @'\n${jsCode}\n'@\n$code | node --input-type=commonjs -`;
51
+ return wrapPowerShellEncoded(psScript);
52
+ }
53
+ return `cat << '${eofMarker}' | node --input-type=commonjs -\n${jsCode}\n${eofMarker}`;
54
+ }
21
55
  export class AgyProvider {
22
56
  name = 'agy';
23
57
  processName = 'agy';
@@ -55,8 +89,15 @@ export class AgyProvider {
55
89
  return 'premium';
56
90
  return 'standard';
57
91
  }
92
+ resolveDisplayModel(model, tier) {
93
+ if (model && model !== 'cheap' && model !== 'standard' && model !== 'premium') {
94
+ return model;
95
+ }
96
+ const resolvedTier = model ?? tier ?? 'standard';
97
+ return getModelOverride('agy', resolvedTier) ?? AGY_MODEL_FOR_TIER[resolvedTier];
98
+ }
58
99
  buildPromptCommand(opts) {
59
- const { folder, promptFile, sessionId, resuming, unattended, inv, model, tier: inputTier, agentName } = opts;
100
+ const { folder, promptFile, sessionId, resuming, unattended, inv, model, tier: inputTier, agentName, projectId } = opts;
60
101
  const escapedFolder = escapeDoubleQuoted(folder);
61
102
  const normalizedFolder = folder.replace(/\\/g, '/');
62
103
  const fullPromptPath = path.posix.join(normalizedFolder, promptFile);
@@ -65,9 +106,16 @@ export class AgyProvider {
65
106
  instruction = `[${inv}] ${instruction}`;
66
107
  }
67
108
  // Write per-workspace model override before launching agy.
68
- const tier = inputTier ?? this.resolveTierFromModel(model);
69
- const displayModel = getModelOverride('agy', tier) ?? AGY_MODEL_FOR_TIER[tier];
70
- let cmd = `cd "${escapedFolder}" && agy --model "${escapeDoubleQuoted(displayModel)}" --output-format json`;
109
+ const displayModel = this.resolveDisplayModel(model, inputTier);
110
+ // --add-dir is REQUIRED, not cosmetic: AGY does not adopt the process's
111
+ // working directory as its workspace. A bare `cd <folder> && agy -p ...`
112
+ // starts with NO active workspace, so the model cannot see the repo at all
113
+ // and falls back to shelling out from ~/.gemini/antigravity-cli/scratch --
114
+ // which then trips the headless permission wall on the first run_command.
115
+ // (Live-verified on agy 1.2.8: the same prompt fails without --add-dir and
116
+ // succeeds with it.) The `cd` is kept so relative paths a dispatched agent
117
+ // builds itself still resolve.
118
+ let cmd = `cd "${escapedFolder}" && agy ${this.workspaceDirFlag(escapedFolder)} ${this.projectFlag(projectId)} --model "${escapeDoubleQuoted(displayModel)}" --output-format json`;
71
119
  if (agentName) {
72
120
  cmd += ` --agent "${escapeDoubleQuoted(agentName)}"`;
73
121
  }
@@ -83,8 +131,10 @@ export class AgyProvider {
83
131
  const permFlag = this.resolvePermissionFlag(unattended);
84
132
  if (permFlag)
85
133
  cmd += ` ${permFlag}`;
86
- // After agy exits, read its transcript from disk (primary output channel --
87
- // agy writes its response to CONOUT$, not stdout, so file I/O is required).
134
+ // After agy exits, also print its transcript from disk. The JSON result
135
+ // usually arrives on stdout (observed under gitbash on Windows too), but
136
+ // agy can write to CONOUT$ instead, and the transcript is also where a
137
+ // permission denial names its concrete target (detectAgyPermissionDenial).
88
138
  const transcriptScript = `${SCRIPTS_UNIX}/agy-transcript-reader.js`;
89
139
  const convArg = sessionId ? `"${escapeDoubleQuoted(sessionId)}"` : '""';
90
140
  const folderArg = `"${escapeDoubleQuoted(folder)}"`;
@@ -94,6 +144,21 @@ export class AgyProvider {
94
144
  skipPermissionsFlag() {
95
145
  return '--dangerously-skip-permissions';
96
146
  }
147
+ /** `--project <id>` binds the run to the member's own agy project, whose
148
+ * permissionGrants compose_permissions writes. Without it agy runs under the
149
+ * machine-wide default-cli-project (docs/agy-provider.md
150
+ * section 1), so a missing id is a hard error, never an omitted flag. */
151
+ projectFlag(projectId) {
152
+ if (!projectId || !/^[A-Za-z0-9][A-Za-z0-9-]*$/.test(projectId)) {
153
+ throw new Error('agy: refusing to dispatch without a valid agy project id (--project); run compose_permissions to provision one');
154
+ }
155
+ return `--project "${projectId}"`;
156
+ }
157
+ /** AGY's workspace is set by --add-dir, never inherited from the process cwd.
158
+ * See the comment in buildPromptCommand for why this is load-bearing. */
159
+ workspaceDirFlag(escapedFolder) {
160
+ return `--add-dir "${escapedFolder}"`;
161
+ }
97
162
  permissionModeAutoFlag() {
98
163
  return '--mode accept-edits';
99
164
  }
@@ -118,7 +183,18 @@ export class AgyProvider {
118
183
  // default (false/undefined) and 'auto' both resolve to the same baseline.
119
184
  return this.workspaceEditPermissionFlag() ?? '';
120
185
  }
121
- parseResponse(result) {
186
+ /** Parses the run's result and, when agy refused a tool call for lack of a
187
+ * grant, attaches the denial (see detectAgyPermissionDenial). A headless
188
+ * denial exits 0 with status SUCCESS and an empty response, so without this
189
+ * it is indistinguishable from a blank reply. */
190
+ parseResponse(result, ctx) {
191
+ const parsed = this.parseResult(result);
192
+ const denial = detectAgyPermissionDenial(result, ctx?.agentOs);
193
+ if (denial)
194
+ parsed.permissionDenial = denial;
195
+ return parsed;
196
+ }
197
+ parseResult(result) {
122
198
  const raw = result.stdout;
123
199
  let extractedSessionId;
124
200
  const sessionMatch = raw.match(/FLEET_SESSION_ID:([^\r\n]+)/);
@@ -150,6 +226,21 @@ export class AgyProvider {
150
226
  catch { /* keep looking */ }
151
227
  }
152
228
  }
229
+ if (!parsedObj) {
230
+ const firstBrace = strippedForJson.indexOf('{');
231
+ const lastBrace = strippedForJson.lastIndexOf('}');
232
+ if (firstBrace !== -1 && lastBrace > firstBrace) {
233
+ try {
234
+ const candidate = JSON.parse(strippedForJson.slice(firstBrace, lastBrace + 1));
235
+ const isEnvelopeStatus = candidate && (candidate.status === 'SUCCESS' || candidate.status === 'ERROR');
236
+ const hasEnvelopeKeys = candidate && typeof candidate === 'object' && ('conversation_id' in candidate || isEnvelopeStatus) && ('response' in candidate || 'error' in candidate);
237
+ if (hasEnvelopeKeys) {
238
+ parsedObj = candidate;
239
+ }
240
+ }
241
+ catch { /* keep looking */ }
242
+ }
243
+ }
153
244
  if (!parsedObj) {
154
245
  const jsonMatch = strippedForJson.match(/\{[\s\S]*?"response"\s*:[\s\S]*?\}/);
155
246
  if (jsonMatch) {
@@ -198,7 +289,7 @@ export class AgyProvider {
198
289
  if (sessionId === undefined && typeof entry.conversation_id === 'string' && entry.conversation_id.trim()) {
199
290
  sessionId = entry.conversation_id.trim();
200
291
  }
201
- const isModelTurn = entry.source === 'MODEL' || entry.type === 'PLANNER_RESPONSE' || entry.type === 'GENERIC' || entry.type === 'MODEL_RESPONSE';
292
+ const isModelTurn = (entry.source === 'MODEL' || entry.type === 'PLANNER_RESPONSE' || entry.type === 'MODEL_RESPONSE') && entry.type !== 'GENERIC' && entry.source !== 'SYSTEM';
202
293
  if (isModelTurn &&
203
294
  entry.status === 'DONE' &&
204
295
  typeof entry.content === 'string' &&
@@ -234,6 +325,15 @@ export class AgyProvider {
234
325
  usage: undefined,
235
326
  };
236
327
  }
328
+ // apra-fleet-hzeb.1: AGY has no distinct usage-limit event surface, so key off
329
+ // the raw output using the shared quota detector (guessed resume window).
330
+ // A successful dispatch (code 0 and !isError) must NEVER be classified as a
331
+ // usage limit, even if stdout transcripts happen to mention 429 in token metrics.
332
+ detectUsageLimit(result, parsed) {
333
+ if (result.code === 0 && !parsed.isError)
334
+ return null;
335
+ return defaultUsageLimitSignal(result.stderr || (parsed.isError ? parsed.result : ''));
336
+ }
237
337
  supportsResume() {
238
338
  return true;
239
339
  }
@@ -243,6 +343,14 @@ export class AgyProvider {
243
343
  sessionIdStrategy() {
244
344
  return { type: 'provider-minted' };
245
345
  }
346
+ // apra-fleet-25yl.2.1: like Claude, an AGY dispatch is batch/CONOUT$-only --
347
+ // the exec channel carries no mid-turn signal, so a `timeout_s`-sized
348
+ // rolling deadline there is a false kill. AGY's working mechanism is the
349
+ // StallDetector watching its brain/transcript directory (resolveSessionLogDir
350
+ // below returns a real path), which still gets `timeout_s` as thresholdMs.
351
+ execTimeoutSource() {
352
+ return 'total_ceiling';
353
+ }
246
354
  resolveSessionLogPath(sessionId, _workFolder, homeDir, targetOs) {
247
355
  const home = resolveHomeDir(homeDir);
248
356
  if (!home)
@@ -264,18 +372,10 @@ export class AgyProvider {
264
372
  return `--conversation "${escapeDoubleQuoted(sessionId)}"`;
265
373
  }
266
374
  modelTiers() {
267
- return {
268
- cheap: 'gemini-3.5-flash-lite',
269
- standard: 'gemini-3.5-flash',
270
- premium: 'claude-sonnet-4.6',
271
- };
375
+ return { ...AGY_MODEL_FOR_TIER };
272
376
  }
273
377
  modelForTier(tier) {
274
- if (tier === 'cheap')
275
- return 'gemini-3.5-flash-lite';
276
- if (tier === 'premium')
277
- return 'claude-sonnet-4.6';
278
- return 'gemini-3.5-flash';
378
+ return AGY_MODEL_FOR_TIER[tier];
279
379
  }
280
380
  modelFlag(model) {
281
381
  return '';
@@ -293,12 +393,130 @@ export class AgyProvider {
293
393
  classifyError(output) {
294
394
  return classifyPromptError(output);
295
395
  }
296
- permissionConfigPaths() {
297
- return ['.gemini/antigravity-cli/settings.json'];
396
+ /** The member's own agy project file, named by the id `agy --new-project`
397
+ * created for it (Agent.agyProjectId). ensureAgyProject must have run first;
398
+ * a member without an id has no file fleet may write. */
399
+ permissionConfigPaths(agent) {
400
+ const id = agent?.agyProjectId;
401
+ if (!id) {
402
+ throw new Error('agy: member has no agy project id -- provision it (ensureAgyProject) before composing permissions');
403
+ }
404
+ return [`~/.gemini/config/projects/${id}.json`];
298
405
  }
299
- composePermissionConfig(_role, allow = []) {
300
- const agyAllow = convertClaudeAllowToAgyPermissions(allow);
301
- return [{ permissions: { allow: agyAllow }, mcpServers: { 'apra-fleet': { disabled: true } }, skillOverrides: { pm: 'off', fleet: 'off' } }];
406
+ /** Only `permissionGrants.permissionGrants.{allow,deny}` -- deliverConfigFile
407
+ * deep-merges this into the file agy created, so the id, name and
408
+ * projectResources agy wrote are kept as they are. */
409
+ composePermissionConfig(_role, allow = [], agent, opts = {}) {
410
+ this.permissionConfigPaths(agent);
411
+ const agyAllow = formatAgyPermissionRules(convertClaudeAllowToAgyPermissions(allow, {
412
+ os: agent?.os,
413
+ homeDir: opts.memberHomeDir,
414
+ warnings: opts.warnings,
415
+ }));
416
+ return [{
417
+ permissionGrants: {
418
+ permissionGrants: {
419
+ allow: agyAllow,
420
+ deny: AGY_ORCHESTRATOR_DENY_RULES,
421
+ },
422
+ },
423
+ }];
424
+ }
425
+ /** agy configures MCP servers in machine-global ~/.gemini/config/mcp_config.json.
426
+ * Writes the member's MCP URL (with ?member=<uuid>) so the member connects to the
427
+ * fleet MCP server with member scope and proper KB/code identity. */
428
+ async syncMemberMcpEntry(ctx) {
429
+ if (!ctx.memberHomeDir) {
430
+ throw new Error('agy: the member home directory could not be resolved, so mcp_config.json cannot be checked');
431
+ }
432
+ const isWindows = ctx.agentOs === 'windows';
433
+ const posix = isPosixShell(isWindows, ctx.shell);
434
+ const file = joinMemberPath(ctx.memberHomeDir.trim(), '.gemini/config/mcp_config.json', isWindows, ctx.shell);
435
+ const pruned = await pruneLegacyMcpInMemberFile(ctx.execCommand, file, posix);
436
+ let detail;
437
+ if (ctx.url !== null) {
438
+ let config;
439
+ try {
440
+ config = await readMemberJson(ctx.execCommand, file, posix);
441
+ }
442
+ catch (e) {
443
+ if (e instanceof MemberConfigNotJsonError) {
444
+ throw new MemberConfigNotJsonError(file, 'is not strict JSON', 'agy-config-unparseable');
445
+ }
446
+ throw e;
447
+ }
448
+ const mcpServers = (config.mcpServers && typeof config.mcpServers === 'object' && !Array.isArray(config.mcpServers))
449
+ ? config.mcpServers
450
+ : {};
451
+ const cur = mcpServers[MEMBER_MCP_SERVER_NAME];
452
+ if (cur && typeof cur.url === 'string' && !cur.url.includes('member=')) {
453
+ detail = `agy: preserved user-configured ${MEMBER_MCP_SERVER_NAME} in ${file}`;
454
+ }
455
+ else {
456
+ const wanted = {
457
+ url: ctx.url,
458
+ ...(ctx.headers && Object.keys(ctx.headers).length > 0 ? { headers: ctx.headers } : {}),
459
+ };
460
+ const current = !!cur && typeof cur === 'object' && JSON.stringify(cur) === JSON.stringify(wanted);
461
+ if (current && !pruned) {
462
+ detail = `agy: ${file} already up to date`;
463
+ }
464
+ else {
465
+ mcpServers[MEMBER_MCP_SERVER_NAME] = wanted;
466
+ config.mcpServers = mcpServers;
467
+ if (ctx.headers && Object.keys(ctx.headers).length > 0) {
468
+ await writeSecretBearingConfig(ctx, file, JSON.stringify(config, null, 2) + '\n', posix);
469
+ }
470
+ else {
471
+ await writeMemberJson(ctx.execCommand, file, config, posix);
472
+ }
473
+ detail = `agy: wrote ${MEMBER_MCP_SERVER_NAME} in ${file}`;
474
+ }
475
+ }
476
+ }
477
+ else if (ctx.removeOnlyOwnEntry) {
478
+ let config;
479
+ try {
480
+ config = await readMemberJson(ctx.execCommand, file, posix);
481
+ }
482
+ catch {
483
+ config = {};
484
+ }
485
+ const mcpServers = (config.mcpServers && typeof config.mcpServers === 'object' && !Array.isArray(config.mcpServers))
486
+ ? config.mcpServers
487
+ : {};
488
+ const cur = mcpServers[MEMBER_MCP_SERVER_NAME];
489
+ if (cur && typeof cur.url === 'string' && cur.url.includes(`member=${encodeURIComponent(ctx.agent.id)}`)) {
490
+ delete mcpServers[MEMBER_MCP_SERVER_NAME];
491
+ if (Object.keys(mcpServers).length === 0) {
492
+ delete config.mcpServers;
493
+ }
494
+ else {
495
+ config.mcpServers = mcpServers;
496
+ }
497
+ await writeMemberJson(ctx.execCommand, file, config, posix);
498
+ detail = `agy: removed ${MEMBER_MCP_SERVER_NAME} from ${file}`;
499
+ }
500
+ else {
501
+ detail = pruned ? `agy: pruned apra-fleet-member from ${file}` : 'agy: no member MCP entry to remove';
502
+ }
503
+ }
504
+ else {
505
+ detail = pruned ? `agy: pruned apra-fleet-member from ${file}` : 'agy: no per-project MCP config; nothing to write';
506
+ }
507
+ return {
508
+ workFolderFiles: [],
509
+ detail,
510
+ };
511
+ }
512
+ async preparePermissionsDelivery(_agent, execCommand, memberHomeDir, agentOs = 'linux', shell) {
513
+ const warnings = [];
514
+ const skillsResult = await checkAgyMemberSkills(execCommand, memberHomeDir, agentOs, shell);
515
+ if (skillsResult?.warning) {
516
+ logWarn('agy', skillsResult.warning);
517
+ warnings.push(skillsResult.warning);
518
+ }
519
+ return warnings;
302
520
  }
303
521
  supportsOAuthCopy() {
304
522
  return false;
@@ -323,8 +541,7 @@ export class AgyProvider {
323
541
  }
324
542
  wrapWindowsPrompt(setupCmd, filePath, argList, sessionId, model, tier) {
325
543
  // Write per-workspace model override before launching agy (mirrors buildPromptCommand).
326
- const resolvedTier = tier ?? this.resolveTierFromModel(model);
327
- const displayModel = getModelOverride('agy', resolvedTier) ?? AGY_MODEL_FOR_TIER[resolvedTier];
544
+ const displayModel = this.resolveDisplayModel(model, tier);
328
545
  let cmd = `${setupCmd}Write-Output "FLEET_PID:$pid"; ${filePath} --model "${escapeDoubleQuoted(displayModel)}" ${argList}`;
329
546
  // After agy exits, read its conversation transcript via the installed helper script.
330
547
  // Since wrapWindowsPrompt doesn't receive folder directly, pass empty string for argv[2]
@@ -340,47 +557,443 @@ export class AgyProvider {
340
557
  headlessInvocation(promptLiteral) {
341
558
  return `-p "${promptLiteral}"`;
342
559
  }
343
- async registerMcpEndpoint(opts) {
344
- // AGY has no `agy mcp` CLI verb (`agy help` lists: changelog, help, install, models,
345
- // plugin(s), update -- no mcp verb) and no project/user scope distinction -- it reads
346
- // MCP server config from a single centralized, machine-global file. See
347
- // docs/member-onboarding-journey.md section 3a for the live-verified investigation.
348
- // Merge under mcpServers.<name>, preserving any sibling entries (mirrors the
349
- // uninstall-time precision-cleanup pattern in src/cli/uninstall.ts).
350
- const configDir = path.join(os.homedir(), '.gemini', 'config');
351
- const configFile = path.join(configDir, 'mcp_config.json');
352
- fs.mkdirSync(configDir, { recursive: true });
353
- let settings = {};
354
- if (fs.existsSync(configFile)) {
560
+ async ensureWorkspaceTrusted(_workFolder, _execCommand, _agentOs, _shell) {
561
+ // Live-verified (docs/agy-provider.md section 5): a
562
+ // headless run with --project enforces the project's grants in a folder
563
+ // fleet never seeded into trustedWorkspaces, so there is nothing to seed.
564
+ return { seeded: false, detail: 'agy: no workspace trust needed -- grants bind via --project' };
565
+ }
566
+ }
567
+ // --- Permission denials -----------------------------------------------------
568
+ //
569
+ // A headless agy run that needs a grant it does not have exits 0 and reports
570
+ // the refusal in three places (docs/agy-provider.md section 4):
571
+ // 1. the --output-format json result: "denied_actions":[{"action":"command",...}]
572
+ // (with "status":"SUCCESS" and usually "response":"");
573
+ // 2. stderr: a tool required the "command" permission that headless mode
574
+ // cannot prompt for, so it was auto-denied ...;
575
+ // 3. the transcript (printed between FLEET_TRANSCRIPT_START/END by
576
+ // agy-transcript-reader.js): an ERROR step
577
+ // permission check failed for command "git status --short --branch": user denied ...
578
+ // (Linux/macOS name a shell command "unsandboxed" there: permission check
579
+ // failed for unsandboxed "whoami": user denied ...).
580
+ const AGY_STDERR_DENIAL_RE = /a tool required the "([a-z_]+)" permission that headless mode cannot prompt for/g;
581
+ const AGY_TRANSCRIPT_DENIAL_RES = [
582
+ /permission check failed for ([a-z_]+) "([\s\S]*?)": user denied/,
583
+ /user denied permission for ([a-z_]+)\(([^)]*)\)/,
584
+ ];
585
+ const SHELL_CHAIN_RE = /[|;`]|&&|\$\(/;
586
+ function stripTranscript(text) {
587
+ return text.replace(/FLEET_TRANSCRIPT_START[\s\S]*?FLEET_TRANSCRIPT_END/g, '');
588
+ }
589
+ const SHELL_SEQUENCE_RE = /[|;`]|&&/;
590
+ const PLAIN_COMMAND_WORD_RE = /^[\w.+-]+$/;
591
+ /** The compose_permissions grants that allow one denied call, delegated to shared suggestedGrantsForDenial. */
592
+ function suggestedGrantsFor(item) {
593
+ return suggestedGrantsForDenial(item);
594
+ }
595
+ function cleanArg(val) {
596
+ if (typeof val !== 'string' || !val.trim())
597
+ return undefined;
598
+ let clean = val.trim();
599
+ if (clean.startsWith('"') && clean.endsWith('"') && clean.length >= 2) {
600
+ try {
601
+ clean = JSON.parse(clean);
602
+ }
603
+ catch {
604
+ clean = clean.slice(1, -1);
605
+ }
606
+ }
607
+ clean = clean.replace(/^"+|"+$/g, '').trim();
608
+ return clean || undefined;
609
+ }
610
+ /** Declarative registry mapping AGY tool calls to denied actions and concrete targets. */
611
+ const TOOL_CALL_EXTRACTORS = [
612
+ {
613
+ action: 'command',
614
+ reportedMatches: ['command', 'unsandboxed'],
615
+ matches: (name) => name === 'run_command' || name === 'execute_command' || name === 'bash',
616
+ extractTarget: (args) => cleanArg(args.CommandLine || args.command || args.cmd),
617
+ },
618
+ {
619
+ action: 'write_file',
620
+ reportedMatches: ['write_file', 'filesystem'],
621
+ matches: (name) => name === 'write_to_file' || name === 'replace_file_content' || name === 'edit_file',
622
+ extractTarget: (args) => cleanArg(args.TargetFile || args.path || args.file_path),
623
+ },
624
+ {
625
+ action: 'read_file',
626
+ reportedMatches: ['read_file', 'filesystem'],
627
+ matches: (name) => name === 'view_file' || name === 'read_file',
628
+ extractTarget: (args) => cleanArg(args.AbsolutePath || args.path || args.file_path),
629
+ },
630
+ {
631
+ action: 'mcp',
632
+ reportedMatches: ['mcp'],
633
+ matches: (name) => name === 'call_mcp_tool' || name.startsWith('mcp_') || name.startsWith('mcp__'),
634
+ extractTarget: (args, name) => {
635
+ if (name === 'call_mcp_tool') {
636
+ const s = cleanArg(args.ServerName || args.server_name);
637
+ const t = cleanArg(args.ToolName || args.tool_name);
638
+ return s && t ? `${s}/${t}` : undefined;
639
+ }
640
+ const clean = name.replace(/^mcp_+/, '');
641
+ const sep = clean.indexOf('__');
642
+ if (sep > 0)
643
+ return `${clean.slice(0, sep)}/${clean.slice(sep + 2)}`;
644
+ const singleSep = clean.indexOf('_');
645
+ if (singleSep > 0)
646
+ return `${clean.slice(0, singleSep)}/${clean.slice(singleSep + 1)}`;
647
+ return clean;
648
+ },
649
+ },
650
+ {
651
+ action: 'read_url',
652
+ reportedMatches: ['read_url', 'execute_url'],
653
+ matches: (name) => name === 'read_url_content' || name === 'read_browser_page' || name === 'search_web',
654
+ extractTarget: (args) => cleanArg(args.Url || args.url || args.query),
655
+ },
656
+ ];
657
+ /**
658
+ * Detects an agy permission denial in a dispatch's output. The JSON result is
659
+ * authoritative when present: a non-empty denied_actions is a denial whatever
660
+ * its status, and a result without it is not (older transcript steps are
661
+ * ignored). Without a JSON result, the stderr auto-denied line or a
662
+ * transcript ERROR step from the current turn counts. Targets always come
663
+ * from the current turn's transcript steps.
664
+ */
665
+ export function detectAgyPermissionDenial(result, agentOs) {
666
+ const stdout = stripAnsi(result.stdout ?? '');
667
+ const outside = stripTranscript(stdout);
668
+ const signals = [];
669
+ // 1. JSON result envelope(s) outside the transcript section.
670
+ let sawEnvelope = false;
671
+ const jsonActions = [];
672
+ for (const line of outside.split(/\r?\n/)) {
673
+ const l = line.trim();
674
+ const start = l.indexOf('{');
675
+ if (start < 0 || !l.endsWith('}'))
676
+ continue;
677
+ let obj;
678
+ try {
679
+ obj = JSON.parse(l.slice(start));
680
+ }
681
+ catch {
682
+ continue;
683
+ }
684
+ if (!obj || typeof obj !== 'object')
685
+ continue;
686
+ if ('conversation_id' in obj || 'denied_actions' in obj || obj.status === 'SUCCESS' || obj.status === 'ERROR')
687
+ sawEnvelope = true;
688
+ if (Array.isArray(obj.denied_actions)) {
689
+ for (const d of obj.denied_actions) {
690
+ const action = typeof d === 'string' ? d : (d && typeof d.action === 'string' ? d.action : undefined);
691
+ if (action)
692
+ jsonActions.push(action);
693
+ }
694
+ }
695
+ }
696
+ if (jsonActions.length)
697
+ signals.push('result_json');
698
+ // 2. stderr (and, defensively, stdout outside the transcript).
699
+ const stderrActions = [];
700
+ for (const text of [result.stderr ?? '', outside]) {
701
+ for (const m of text.matchAll(AGY_STDERR_DENIAL_RE))
702
+ stderrActions.push(m[1]);
703
+ }
704
+ if (stderrActions.length)
705
+ signals.push('stderr');
706
+ // 3. Transcript ERROR steps of the current turn (after the last user input).
707
+ const transcriptItems = [];
708
+ const section = /FLEET_TRANSCRIPT_START([\s\S]*?)FLEET_TRANSCRIPT_END/.exec(stdout)?.[1];
709
+ if (section) {
710
+ const entries = [];
711
+ for (const line of section.split(/\r?\n/)) {
712
+ const l = line.trim();
713
+ if (!l.startsWith('{'))
714
+ continue;
355
715
  try {
356
- settings = JSON.parse(fs.readFileSync(configFile, 'utf-8'));
716
+ entries.push(JSON.parse(l));
357
717
  }
358
- catch {
359
- // malformed file -- start fresh rather than write on top of unparseable state
360
- settings = {};
718
+ catch { /* skip */ }
719
+ }
720
+ let from = 0;
721
+ entries.forEach((e, i) => { if (e && e.type === 'USER_INPUT')
722
+ from = i + 1; });
723
+ for (const e of entries.slice(from)) {
724
+ if (!e || e.status !== 'ERROR' || typeof e.error !== 'string')
725
+ continue;
726
+ for (const re of AGY_TRANSCRIPT_DENIAL_RES) {
727
+ const m = re.exec(e.error);
728
+ if (m) {
729
+ transcriptItems.push({ action: m[1], target: m[2] });
730
+ break;
731
+ }
732
+ }
733
+ }
734
+ if (transcriptItems.length === 0 && (jsonActions.length > 0 || stderrActions.length > 0)) {
735
+ // When AGY auto-denies a tool in headless mode, it terminates immediately
736
+ // without writing an ERROR step. Extract the denied action's target from the
737
+ // last model turn's pending tool call in this turn that matches the reported denied actions.
738
+ const reported = new Set([...jsonActions, ...stderrActions]);
739
+ for (let i = entries.length - 1; i >= from; i--) {
740
+ const e = entries[i];
741
+ if (e && Array.isArray(e.tool_calls) && e.tool_calls.length > 0) {
742
+ for (const call of e.tool_calls) {
743
+ const name = call.name;
744
+ const args = (call.args || {});
745
+ for (const extractor of TOOL_CALL_EXTRACTORS) {
746
+ if (extractor.matches(name) && extractor.reportedMatches.some(r => reported.has(r))) {
747
+ const target = extractor.extractTarget(args, name);
748
+ if (target) {
749
+ transcriptItems.push({ action: extractor.action, target });
750
+ break;
751
+ }
752
+ }
753
+ }
754
+ }
755
+ if (transcriptItems.length > 0)
756
+ break;
757
+ }
361
758
  }
362
759
  }
363
- const mcpServers = settings.mcpServers ?? {};
364
- mcpServers['apra-fleet-member'] = {
365
- type: 'http',
366
- url: opts.url,
367
- headers: { Authorization: `Bearer ${opts.token}` },
760
+ }
761
+ if (transcriptItems.length)
762
+ signals.push('transcript');
763
+ const denied = jsonActions.length > 0 || stderrActions.length > 0 || (!sawEnvelope && transcriptItems.length > 0);
764
+ if (!denied)
765
+ return undefined;
766
+ const denials = [];
767
+ const seen = new Set();
768
+ const add = (item) => {
769
+ const key = `${item.action}\u0000${item.target ?? ''}`;
770
+ if (!seen.has(key)) {
771
+ seen.add(key);
772
+ denials.push(item);
773
+ }
774
+ };
775
+ transcriptItems.forEach(add);
776
+ for (const action of [...jsonActions, ...stderrActions]) {
777
+ if (!denials.some(d => d.action === action))
778
+ add({ action });
779
+ }
780
+ const actions = [...new Set(denials.map(d => d.action))];
781
+ const perDenial = denials.map(d => suggestedGrantsForDenial(d));
782
+ denials.forEach((d, i) => { d.suggestedGrants = perDenial[i]; });
783
+ const primary = [...new Set(perDenial.map(g => g[0]).filter((g) => !!g))];
784
+ const narrow = [...new Set(perDenial.flatMap(g => g.slice(1)))].filter(g => !primary.includes(g));
785
+ const suggestedGrants = [...primary, ...narrow];
786
+ const what = denials.map(d => (d.target ? `${d.action} "${d.target}"` : d.action)).join(', ');
787
+ let hint = `agy auto-denied ${what} (headless mode cannot prompt for permission).`;
788
+ if (suggestedGrants.length) {
789
+ hint += ` Grant it with compose_permissions grant: ${JSON.stringify(primary)} and retry.`;
790
+ if (narrow.length)
791
+ hint += ` Narrower alternative (this exact command line only): ${JSON.stringify(narrow)}.`;
792
+ }
793
+ else {
794
+ hint += ' No compose_permissions grant maps to this action automatically; grant it on the member by hand or escalate.';
795
+ }
796
+ if (actions.includes('command') || actions.includes('unsandboxed')) {
797
+ hint += agentOs === 'windows'
798
+ ? ' On Windows, Bash(<bin>:*) composes to command(<bin>) plus command(regex:<bin> .*), which allows <bin> with any arguments.'
799
+ : ' Bash(<bin>:*) composes to command(<bin>) plus command(regex:<bin> .*): command(<bin>) matches <bin> and its arguments by word prefix, and a command line with $(...), backticks, brace expansion or redirections needs the regex rule, which matches the full line.';
800
+ }
801
+ // A refusal of a fleet tool outside the member allowlist hit one of the deny
802
+ // rules compose writes on purpose (agyMemberDenyRules): member tool policy,
803
+ // never a missing grant. One such call makes the whole denial non-healable
804
+ // with no suggested grants, exactly like the Claude provider, so a complete
805
+ // reply is a warning and the heal stops not_healable instead of granting.
806
+ const policyRules = new Set(agyMemberDenyRules());
807
+ const policyCalls = denials.filter(d => d.action === 'mcp' && !!d.target && policyRules.has(`mcp(${d.target.trim()})`));
808
+ if (policyCalls.length > 0) {
809
+ for (const d of denials)
810
+ d.suggestedGrants = [];
811
+ const tools = [...new Set(policyCalls.map(d => d.target.trim()))].join(', ');
812
+ const policyHint = `agy refused ${what}: ${tools} ${policyCalls.length === 1 ? 'is a fleet tool' : 'are fleet tools'} outside the member tool allowlist, denied by the member's own permission config on purpose. A member session may only use the knowledge-bank and code-intelligence tools; no grant is ever added for this. Do the work without ${policyCalls.length === 1 ? 'that tool' : 'those tools'}.`;
813
+ return { actions, denials, suggestedGrants: [], hint: policyHint, signals, healable: false, cause: 'policy_deny' };
814
+ }
815
+ return { actions, denials, suggestedGrants, hint, signals };
816
+ }
817
+ // Derived from the shared member allowlist (src/services/member-tool-allowlist.ts)
818
+ // rather than hand-listed: agy members get exactly the base member allowlist,
819
+ // and the agy orchestrator denies every other registered tool. agy members are
820
+ // not channel-capable, so MEMBER_CHANNEL_TOOLS (respond_to_message) stays denied.
821
+ export const AGY_MEMBER_ALLOWED_TOOLS = [...MEMBER_ALLOWED_TOOLS];
822
+ export const AGY_ORCHESTRATOR_DENIED_TOOLS = [...MEMBER_DENIED_TOOLS];
823
+ // Exactly the complement of the member allowlist on the apra-fleet server. The
824
+ // retired apra-fleet-member alias is no longer denied here: compose prunes that
825
+ // entry from agy's mcp_config.json instead (syncMemberMcpEntry).
826
+ export const AGY_ORCHESTRATOR_DENY_RULES = agyMemberDenyRules();
827
+ export async function checkAgyMemberSkills(execCommand, memberHomeDir, agentOs = 'linux', shell) {
828
+ const jsCode = `const fs = require('fs');
829
+ const path = require('path');
830
+ const home = ${memberHomeDir ? JSON.stringify(memberHomeDir) : 'process.env.HOME || process.env.USERPROFILE'};
831
+ const skillsDir = path.join(home, '.gemini', 'antigravity-cli', 'skills');
832
+ const pmInstalled = fs.existsSync(path.join(skillsDir, 'pm'));
833
+ const fleetInstalled = fs.existsSync(path.join(skillsDir, 'fleet'));
834
+ console.log(JSON.stringify({ pmInstalled, fleetInstalled, skillsDir }));
835
+ `;
836
+ const cmd = buildAgyNodeCommand(jsCode, agentOs, 'FLEET_SKILLS_EOF');
837
+ let result;
838
+ try {
839
+ result = await execCommand(cmd, 5000);
840
+ }
841
+ catch (err) {
842
+ const detail = err?.message || String(err);
843
+ return {
844
+ installed: [],
845
+ probeFailed: true,
846
+ warning: `[fleet:warn] agy: member skills check probe could not run (${detail}). Global skill isolation status unverified.`,
368
847
  };
369
- settings.mcpServers = mcpServers;
370
- fs.writeFileSync(configFile, JSON.stringify(settings, null, 2) + '\n');
848
+ }
849
+ if (result.code !== 0) {
850
+ const errOutput = (result.stderr || result.stdout || '').trim();
851
+ const detail = errOutput ? `exit code ${result.code}: ${errOutput}` : `exit code ${result.code}`;
371
852
  return {
372
- mechanism: 'config-file-merge',
373
- detail: `merged apra-fleet-member into ${configFile} (mcpServers.apra-fleet-member)`,
853
+ installed: [],
854
+ probeFailed: true,
855
+ warning: `[fleet:warn] agy: member skills check probe could not run (${detail}). Global skill isolation status unverified.`,
374
856
  };
375
857
  }
376
- async ensureWorkspaceTrusted(_workFolder, _execCommand, _agentOs, _shell) {
377
- // apra-fleet-eft.40 provider trust matrix: AGY has NO per-project trust concept -- its
378
- // config is machine-global (live-verified, docs/member-onboarding-journey.md section
379
- // 3a). No-op.
380
- return { seeded: false, detail: 'agy: no per-project trust concept -- machine-global config' };
858
+ const raw = result.stdout ? result.stdout.trim() : '';
859
+ if (!raw) {
860
+ return {
861
+ installed: [],
862
+ probeFailed: true,
863
+ warning: `[fleet:warn] agy: member skills check probe could not run (empty output). Global skill isolation status unverified.`,
864
+ };
865
+ }
866
+ try {
867
+ const parsed = JSON.parse(raw);
868
+ if (!parsed || typeof parsed !== 'object') {
869
+ return {
870
+ installed: [],
871
+ probeFailed: true,
872
+ warning: `[fleet:warn] agy: member skills check probe could not run (non-object JSON output). Global skill isolation status unverified.`,
873
+ };
874
+ }
875
+ const installed = [];
876
+ if (parsed.pmInstalled)
877
+ installed.push('pm');
878
+ if (parsed.fleetInstalled)
879
+ installed.push('fleet');
880
+ const skillsDir = typeof parsed.skillsDir === 'string' ? parsed.skillsDir : undefined;
881
+ if (installed.length > 0) {
882
+ const list = installed.join(', ');
883
+ const loc = skillsDir ? ` in ${skillsDir}` : '';
884
+ return {
885
+ installed,
886
+ skillsDir,
887
+ probeFailed: false,
888
+ warning: `[fleet:warn] agy: AGY provider has no per-member skill isolation mechanism. Global skill(s) [${list}] are installed${loc} and will be visible to this member.`,
889
+ };
890
+ }
891
+ return {
892
+ installed: [],
893
+ skillsDir,
894
+ probeFailed: false,
895
+ };
896
+ }
897
+ catch (e) {
898
+ return {
899
+ installed: [],
900
+ probeFailed: true,
901
+ warning: `[fleet:warn] agy: member skills check probe could not run (unparseable output: ${raw}). Global skill isolation status unverified.`,
902
+ };
903
+ }
904
+ }
905
+ export function checkAgyGlobalSkillsWarning(homeDir) {
906
+ const home = resolveHomeDir(homeDir);
907
+ if (!home)
908
+ return null;
909
+ const skillsDir = path.join(home, '.gemini', 'antigravity-cli', 'skills');
910
+ const pmInstalled = fs.existsSync(path.join(skillsDir, 'pm'));
911
+ const fleetInstalled = fs.existsSync(path.join(skillsDir, 'fleet'));
912
+ if (pmInstalled || fleetInstalled) {
913
+ const list = [pmInstalled && 'pm', fleetInstalled && 'fleet'].filter(Boolean).join(', ');
914
+ return `[fleet:warn] agy: AGY provider has no per-member skill isolation mechanism. Global skill(s) [${list}] are installed in ${skillsDir} and will be visible to AGY members.`;
915
+ }
916
+ return null;
917
+ }
918
+ /** The ONLY actions AGY accepts in `permissions.allow`. Taken verbatim from the
919
+ * CLI's own validation regex (agy 1.2.8):
920
+ * ^(command|read_file|write_file|read_url|mcp|execute_url|unsandboxed)\s*\(.*\)$
921
+ * `custom`, `invoke_subagent` and `send_message` are NOT permission actions --
922
+ * the latter two are AGY *tool* names with no permission gate of their own --
923
+ * so rules carrying them are dropped at serialization time rather than written
924
+ * as entries AGY would reject. */
925
+ const AGY_PERMISSION_ACTIONS = new Set(['command', 'read_file', 'write_file', 'read_url', 'mcp', 'execute_url', 'unsandboxed']);
926
+ /**
927
+ * Render structured rules into the ONLY shape AGY's permission parser
928
+ * accepts: a flat array of `action(target)` STRINGS in permissionGrants.allow.
929
+ *
930
+ * Before this, fleet wrote the `{ action, target }` objects straight through.
931
+ * AGY silently ignored every one of them, so a headless `-p` dispatch behaved
932
+ * as if the member had no grants at all and died on the first tool call with
933
+ * "a tool required the \"command\" permission that headless mode cannot prompt
934
+ * for, so it was auto-denied" -- the failure this function exists to prevent.
935
+ *
936
+ * Rules whose action is outside AGY's vocabulary are dropped with a warning:
937
+ * writing entries its parser rejects causes validation failure.
938
+ * The dropped tokens are already surfaced by
939
+ * convertClaudeAllowToAgyPermissions' own warnings for manual escalation.
940
+ */
941
+ export function formatAgyPermissionRules(rules) {
942
+ const out = [];
943
+ for (const rule of rules) {
944
+ if (!AGY_PERMISSION_ACTIONS.has(rule.action)) {
945
+ console.warn(`[agy] dropping permission rule "${rule.action}(${rule.target})": AGY's permissions.allow accepts only ${[...AGY_PERMISSION_ACTIONS].join(', ')}.`);
946
+ continue;
947
+ }
948
+ const entry = `${rule.action}(${rule.target})`;
949
+ if (!out.includes(entry))
950
+ out.push(entry);
381
951
  }
952
+ return out;
382
953
  }
383
- export function convertClaudeAllowToAgyPermissions(allow) {
954
+ const PATH_SCOPED_READ_RE = /^(?:Read|Glob|Grep)\((.+)\)$/;
955
+ const PATH_SCOPED_WRITE_RE = /^(?:Write|Edit)\((.+)\)$/;
956
+ /** Escapes regex metacharacters so a literal command prefix can sit inside an
957
+ * agy `regex:` target. Spaces are kept. */
958
+ export function escapeAgyRegex(s) {
959
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
960
+ }
961
+ /** The agy `command` targets for one Claude command prefix, on every OS. agy
962
+ * prefix-matches `command(git)` word by word only for a command line it can
963
+ * split into words: on Windows that excludes most lines (PowerShell/cmd), and
964
+ * on Linux/macOS a line with command substitution, backticks, brace expansion
965
+ * or fd redirections disables prefix matching. A `regex:` target is matched
966
+ * against the full raw line (docs/agy-provider.md section 3),
967
+ * so a prefix grant becomes the bare command plus a regex for any arguments.
968
+ * A command deny rule must be built here too, so it matches full lines. */
969
+ export function agyCommandRules(cmd) {
970
+ if (cmd === '*')
971
+ return ['*'];
972
+ return [cmd, `regex:${escapeAgyRegex(cmd)} .*`];
973
+ }
974
+ /** Reduces a Claude path pattern to the plain path agy's read_file/write_file
975
+ * targets take (agy has no globs and grants a directory recursively): a
976
+ * leading `~` becomes the member's home directory, a trailing `/**` or `/*`
977
+ * becomes the directory itself, and a bare `*`/`**` is the global wildcard.
978
+ * A glob anywhere else cannot be expressed: no target is returned and the
979
+ * caller drops the grant with a warning. */
980
+ function agyPathTarget(item, opts) {
981
+ let inner = item.slice(item.indexOf('(') + 1, -1).trim();
982
+ if (inner === '*' || inner === '**')
983
+ return { target: '*' };
984
+ if (inner === '~' || inner.startsWith('~/') || inner.startsWith('~\\')) {
985
+ if (!opts.homeDir)
986
+ return { reason: 'the member home directory is unknown, so ~ cannot be resolved' };
987
+ const home = opts.homeDir.replace(/\\/g, '/').replace(/\/+$/, '');
988
+ inner = inner === '~' ? home : `${home}/${inner.slice(2).replace(/\\/g, '/')}`;
989
+ }
990
+ const stripped = inner.replace(/[\\/]\*{1,2}$/, '');
991
+ if (/[*?]/.test(stripped))
992
+ return { reason: 'agy path targets cannot hold a glob' };
993
+ const trimmed = stripped.replace(/[\\/]+$/, '');
994
+ return { target: trimmed || '*' };
995
+ }
996
+ export function convertClaudeAllowToAgyPermissions(allow, opts = {}) {
384
997
  const rules = [];
385
998
  const added = new Set();
386
999
  const addRule = (action, target) => {
@@ -390,6 +1003,23 @@ export function convertClaudeAllowToAgyPermissions(allow) {
390
1003
  rules.push({ action, target });
391
1004
  }
392
1005
  };
1006
+ const addPathRule = (action, item) => {
1007
+ const { target, reason } = agyPathTarget(item, opts);
1008
+ if (target !== undefined) {
1009
+ addRule(action, target);
1010
+ return;
1011
+ }
1012
+ const line = `agy: dropped "${item}" -- ${reason}; grant a directory or an exact path instead.`;
1013
+ console.warn(`[fleet:warn] ${line}`);
1014
+ if (opts.warnings && !opts.warnings.includes(line))
1015
+ opts.warnings.push(line);
1016
+ };
1017
+ const addDropWarning = (item, reason) => {
1018
+ const line = `agy: dropped "${item}" -- ${reason}`;
1019
+ console.warn(`[fleet:warn] ${line}`);
1020
+ if (opts.warnings && !opts.warnings.includes(line))
1021
+ opts.warnings.push(line);
1022
+ };
393
1023
  for (const item of allow) {
394
1024
  if (item === 'Read' || item === 'Glob' || item === 'Grep') {
395
1025
  addRule('read_file', '*');
@@ -397,18 +1027,36 @@ export function convertClaudeAllowToAgyPermissions(allow) {
397
1027
  else if (item === 'Write' || item === 'Edit') {
398
1028
  addRule('write_file', '*');
399
1029
  }
400
- else if (item === 'Agent') {
1030
+ else if (PATH_SCOPED_READ_RE.test(item)) {
1031
+ // Path-scoped Claude grant, e.g. Read(/home/u/.claude/skills/**). AGY
1032
+ // targets are path PREFIXES (`read_file(/Users/alice/notes)`), so the
1033
+ // trailing glob is stripped; a bare `Read`/`Write` (no argument) is
1034
+ // unrestricted in Claude and keeps mapping to '*' above.
1035
+ addPathRule('read_file', item);
1036
+ }
1037
+ else if (PATH_SCOPED_WRITE_RE.test(item)) {
1038
+ addPathRule('write_file', item);
1039
+ }
1040
+ else if (item === 'Agent' || item.startsWith('Agent(')) {
401
1041
  addRule('invoke_subagent', '*');
402
1042
  addRule('send_message', '*');
1043
+ addDropWarning(item, 'AGY permissions.allow has no subagent action; subagents are not gated by permissions.allow.');
403
1044
  }
404
1045
  else if (item.startsWith('Bash(')) {
405
- const match = item.match(/^Bash\(([^:*]+)(?::|\s|\*|\))/);
406
- if (match && match[1]) {
407
- const cmdName = match[1].trim();
408
- addRule('command', cmdName === '*' ? '*' : cmdName);
1046
+ const inner = item.endsWith(')') ? item.slice(5, -1).trim() : '';
1047
+ if (inner && !inner.includes('*')) {
1048
+ // Exact grant (no wildcard): that command line only, no widening.
1049
+ addRule('command', inner);
409
1050
  }
410
1051
  else {
411
- addRule('command', '*');
1052
+ const match = item.match(/^Bash\(([^:*]+)(?::|\s|\*|\))/);
1053
+ if (match && match[1]) {
1054
+ for (const t of agyCommandRules(match[1].trim()))
1055
+ addRule('command', t);
1056
+ }
1057
+ else {
1058
+ addRule('command', '*');
1059
+ }
412
1060
  }
413
1061
  }
414
1062
  else if (item === 'Bash') {
@@ -422,31 +1070,38 @@ export function convertClaudeAllowToAgyPermissions(allow) {
422
1070
  addRule('mcp', '*');
423
1071
  }
424
1072
  else if (item.startsWith('mcp__')) {
425
- // Claude's real MCP permission-string format is `mcp__<server>__<tool>` (e.g.
426
- // "mcp__apra-fleet__kb_capture") -- NOT the fictional `Mcp(name)` shape above.
427
- // AGY's own permission model is server-granular, not per-tool (see the 'mcp'
428
- // action's target). The 'apra-fleet' server deliberately colocates safe
429
- // read-only KB tools (kb_query, kb_capture, ...) alongside destructive
430
- // fleet-admin tools (remove_member, shutdown_server, credential_store_*) --
431
- // see src/services/tool-registry.ts's registerAllTools. Auto-collapsing a
432
- // narrow per-tool Claude grant like "mcp__apra-fleet__kb_query" into a
433
- // server-level AGY rule would silently hand that member blanket access to
434
- // every tool on the server, not just the one requested -- a real privilege
435
- // escalation, not a convenience gap. Until the MCP surface is split by trust
436
- // tier (or AGY gains per-tool granularity), do NOT auto-grant here; surface it
437
- // so a human can escalate deliberately, same as the NEVER_AUTO_GRANT pattern
438
- // in compose-permissions.ts.
1073
+ // Claude's real MCP permission-string format is `mcp__<server>__<tool>`
1074
+ // (e.g. "mcp__apra-fleet__kb_capture") -- NOT the fictional `Mcp(name)`
1075
+ // shape above. AGY expresses the SAME per-tool granularity as
1076
+ // `mcp(<server>/<tool>)` (its own docs: "mcp(<server_name>/<tool_name>)
1077
+ // e.g. mcp(buganizer/get_bugs)", and a denial reads
1078
+ // `user denied permission for mcp(apra-fleet/kb_session_prime)`), so the
1079
+ // two map across exactly, with no widening.
1080
+ //
1081
+ // This previously refused to map at all, on the belief that AGY was
1082
+ // server-granular only -- which WOULD have been a privilege escalation,
1083
+ // since the 'apra-fleet' server colocates safe read-only KB tools with
1084
+ // destructive fleet-admin ones (remove_member, shutdown_server,
1085
+ // credential_store_*; see src/services/tool-registry.ts). That belief is
1086
+ // wrong for AGY 1.2.8, and the cost of the workaround was real: the
1087
+ // deployer's Step 0 kb_session_prime was auto-denied in headless mode,
1088
+ // taking the whole Deploy phase down with it. Note what is NOT done here:
1089
+ // a bare server-level `mcp(apra-fleet)` is still never emitted.
439
1090
  const rest = item.slice('mcp__'.length);
440
1091
  const sep = rest.indexOf('__');
441
- const server = sep >= 0 ? rest.slice(0, sep) : rest;
442
- console.warn(`[agy] refusing to auto-grant mcp permission "${item}": AGY has no per-tool MCP granularity, only server-level ("${server}"), and that server also exposes destructive tools. Escalate manually if this member genuinely needs it.`);
443
- addRule('custom', item);
1092
+ if (sep < 0) {
1093
+ addDropWarning(item, 'unmapped mcp permission token (expected mcp__<server>__<tool>); grant a supported AGY permission instead.');
1094
+ addRule('custom', item);
1095
+ }
1096
+ else {
1097
+ addRule('mcp', `${rest.slice(0, sep)}/${rest.slice(sep + 2)}`);
1098
+ }
444
1099
  }
445
1100
  else if (item === 'Web' || item === 'Fetch' || item === 'WebSearch') {
446
1101
  addRule('read_url', '*');
447
1102
  }
448
1103
  else {
449
- console.warn(`[agy] warning: unmapped permission token "${item}"`);
1104
+ addDropWarning(item, 'unmapped permission token; grant a supported AGY permission instead.');
450
1105
  addRule('custom', item);
451
1106
  }
452
1107
  }