@evalops/maestro 0.10.50 → 0.10.51

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 (406) hide show
  1. package/dist/agent/agent-outcome.d.ts +54 -0
  2. package/dist/agent/agent-outcome.d.ts.map +1 -0
  3. package/dist/agent/agent-outcome.js +142 -0
  4. package/dist/agent/agent-outcome.js.map +1 -0
  5. package/dist/agent/agent-resume.d.ts.map +1 -1
  6. package/dist/agent/agent-resume.js +3 -3
  7. package/dist/agent/agent-resume.js.map +1 -1
  8. package/dist/agent/agent-run-summary.d.ts +37 -0
  9. package/dist/agent/agent-run-summary.d.ts.map +1 -0
  10. package/dist/agent/agent-run-summary.js +15 -0
  11. package/dist/agent/agent-run-summary.js.map +1 -0
  12. package/dist/agent/agent-work-board.d.ts +82 -0
  13. package/dist/agent/agent-work-board.d.ts.map +1 -0
  14. package/dist/agent/agent-work-board.js +312 -0
  15. package/dist/agent/agent-work-board.js.map +1 -0
  16. package/dist/agent/auto-compaction.d.ts +7 -2
  17. package/dist/agent/auto-compaction.d.ts.map +1 -1
  18. package/dist/agent/auto-compaction.js +23 -10
  19. package/dist/agent/auto-compaction.js.map +1 -1
  20. package/dist/agent/mission-artifacts.d.ts +62 -0
  21. package/dist/agent/mission-artifacts.d.ts.map +1 -0
  22. package/dist/agent/mission-artifacts.js +438 -0
  23. package/dist/agent/mission-artifacts.js.map +1 -0
  24. package/dist/agent/mission-manifest.d.ts +139 -3
  25. package/dist/agent/mission-manifest.d.ts.map +1 -1
  26. package/dist/agent/mission-manifest.js +549 -3
  27. package/dist/agent/mission-manifest.js.map +1 -1
  28. package/dist/agent/mission-store.d.ts +80 -0
  29. package/dist/agent/mission-store.d.ts.map +1 -0
  30. package/dist/agent/mission-store.js +603 -0
  31. package/dist/agent/mission-store.js.map +1 -0
  32. package/dist/agent/modes.d.ts +2 -2
  33. package/dist/agent/modes.d.ts.map +1 -1
  34. package/dist/agent/modes.js +10 -3
  35. package/dist/agent/modes.js.map +1 -1
  36. package/dist/agent/providers/codex-app-server.d.ts.map +1 -1
  37. package/dist/agent/providers/codex-app-server.js +1 -3
  38. package/dist/agent/providers/codex-app-server.js.map +1 -1
  39. package/dist/agent/providers/google-gemini-cli.js +203 -107
  40. package/dist/agent/providers/google.js +100 -41
  41. package/dist/agent/providers/scripted.d.ts.map +1 -1
  42. package/dist/agent/providers/scripted.js +1 -3
  43. package/dist/agent/providers/scripted.js.map +1 -1
  44. package/dist/agent/providers/validation.d.ts.map +1 -1
  45. package/dist/agent/providers/validation.js +1 -3
  46. package/dist/agent/providers/validation.js.map +1 -1
  47. package/dist/agent/providers/vertex.js +203 -107
  48. package/dist/agent/snapshot-store.d.ts +32 -0
  49. package/dist/agent/snapshot-store.d.ts.map +1 -0
  50. package/dist/agent/snapshot-store.js +195 -0
  51. package/dist/agent/snapshot-store.js.map +1 -0
  52. package/dist/agent/specialist-profiles.d.ts +36 -0
  53. package/dist/agent/specialist-profiles.d.ts.map +1 -0
  54. package/dist/agent/specialist-profiles.js +159 -0
  55. package/dist/agent/specialist-profiles.js.map +1 -0
  56. package/dist/agent/subagent-specs.d.ts +4 -1
  57. package/dist/agent/subagent-specs.d.ts.map +1 -1
  58. package/dist/agent/subagent-specs.js +81 -8
  59. package/dist/agent/subagent-specs.js.map +1 -1
  60. package/dist/agent/swarm/coverage-gate.d.ts +37 -0
  61. package/dist/agent/swarm/coverage-gate.d.ts.map +1 -0
  62. package/dist/agent/swarm/coverage-gate.js +48 -0
  63. package/dist/agent/swarm/coverage-gate.js.map +1 -0
  64. package/dist/agent/swarm/executor.d.ts +1 -0
  65. package/dist/agent/swarm/executor.d.ts.map +1 -1
  66. package/dist/agent/swarm/executor.js +151 -15
  67. package/dist/agent/swarm/executor.js.map +1 -1
  68. package/dist/agent/swarm/orchestrator-prompt.d.ts +25 -0
  69. package/dist/agent/swarm/orchestrator-prompt.d.ts.map +1 -0
  70. package/dist/agent/swarm/orchestrator-prompt.js +48 -0
  71. package/dist/agent/swarm/orchestrator-prompt.js.map +1 -0
  72. package/dist/agent/swarm/plan-parser.d.ts.map +1 -1
  73. package/dist/agent/swarm/plan-parser.js +27 -2
  74. package/dist/agent/swarm/plan-parser.js.map +1 -1
  75. package/dist/agent/swarm/types.d.ts +17 -0
  76. package/dist/agent/swarm/types.d.ts.map +1 -1
  77. package/dist/agent/swarm/types.js.map +1 -1
  78. package/dist/agent/swarm/validation-directive.d.ts +21 -0
  79. package/dist/agent/swarm/validation-directive.d.ts.map +1 -0
  80. package/dist/agent/swarm/validation-directive.js +25 -0
  81. package/dist/agent/swarm/validation-directive.js.map +1 -0
  82. package/dist/agent/transport/tool-execution-bridge.d.ts.map +1 -1
  83. package/dist/agent/transport/tool-execution-bridge.js +4 -1
  84. package/dist/agent/transport/tool-execution-bridge.js.map +1 -1
  85. package/dist/api/enterprise-routes.d.ts.map +1 -1
  86. package/dist/api/enterprise-routes.js +87 -10
  87. package/dist/api/enterprise-routes.js.map +1 -1
  88. package/dist/api/org-settings-merge.d.ts +12 -0
  89. package/dist/api/org-settings-merge.d.ts.map +1 -0
  90. package/dist/api/org-settings-merge.js +38 -0
  91. package/dist/api/org-settings-merge.js.map +1 -0
  92. package/dist/api/user-settings-merge.d.ts +16 -0
  93. package/dist/api/user-settings-merge.d.ts.map +1 -0
  94. package/dist/api/user-settings-merge.js +37 -0
  95. package/dist/api/user-settings-merge.js.map +1 -0
  96. package/dist/app-server/daemon-lifecycle-api.d.ts.map +1 -1
  97. package/dist/app-server/daemon-lifecycle-api.js +1 -3
  98. package/dist/app-server/daemon-lifecycle-api.js.map +1 -1
  99. package/dist/app-server/external-agent-import-api.d.ts.map +1 -1
  100. package/dist/app-server/external-agent-import-api.js +1 -3
  101. package/dist/app-server/external-agent-import-api.js.map +1 -1
  102. package/dist/app-server/network-governance-api.d.ts.map +1 -1
  103. package/dist/app-server/network-governance-api.js +1 -3
  104. package/dist/app-server/network-governance-api.js.map +1 -1
  105. package/dist/app-server/plugin-bundle-api.d.ts.map +1 -1
  106. package/dist/app-server/plugin-bundle-api.js +1 -3
  107. package/dist/app-server/plugin-bundle-api.js.map +1 -1
  108. package/dist/app-server/policy-control-api.d.ts.map +1 -1
  109. package/dist/app-server/policy-control-api.js +1 -3
  110. package/dist/app-server/policy-control-api.js.map +1 -1
  111. package/dist/app-server/protocol-modes-api.d.ts.map +1 -1
  112. package/dist/app-server/protocol-modes-api.js +1 -3
  113. package/dist/app-server/protocol-modes-api.js.map +1 -1
  114. package/dist/cli/args.d.ts +2 -0
  115. package/dist/cli/args.d.ts.map +1 -1
  116. package/dist/cli/args.js +15 -0
  117. package/dist/cli/args.js.map +1 -1
  118. package/dist/cli/commands/a2a.d.ts.map +1 -1
  119. package/dist/cli/commands/a2a.js +1 -3
  120. package/dist/cli/commands/a2a.js.map +1 -1
  121. package/dist/cli/commands/agents.d.ts +4 -0
  122. package/dist/cli/commands/agents.d.ts.map +1 -1
  123. package/dist/cli/commands/agents.js +149 -0
  124. package/dist/cli/commands/agents.js.map +1 -1
  125. package/dist/cli/commands/mission.d.ts +4 -0
  126. package/dist/cli/commands/mission.d.ts.map +1 -0
  127. package/dist/cli/commands/mission.js +196 -0
  128. package/dist/cli/commands/mission.js.map +1 -0
  129. package/dist/cli/commands/value.d.ts +10 -0
  130. package/dist/cli/commands/value.d.ts.map +1 -0
  131. package/dist/cli/commands/value.js +33 -0
  132. package/dist/cli/commands/value.js.map +1 -0
  133. package/dist/cli/headless-protocol.d.ts.map +1 -1
  134. package/dist/cli/headless-protocol.js +1 -3
  135. package/dist/cli/headless-protocol.js.map +1 -1
  136. package/dist/cli/help.d.ts.map +1 -1
  137. package/dist/cli/help.js +10 -0
  138. package/dist/cli/help.js.map +1 -1
  139. package/dist/cli/system-prompt.d.ts.map +1 -1
  140. package/dist/cli/system-prompt.js +38 -7
  141. package/dist/cli/system-prompt.js.map +1 -1
  142. package/dist/cli-runtime.js +7756 -2800
  143. package/dist/cli-tui/client-tools/client-tool-controller.d.ts.map +1 -1
  144. package/dist/cli-tui/client-tools/client-tool-controller.js +1 -3
  145. package/dist/cli-tui/client-tools/client-tool-controller.js.map +1 -1
  146. package/dist/cli-tui/commands/undo-handlers.d.ts.map +1 -1
  147. package/dist/cli-tui/commands/undo-handlers.js +7 -2
  148. package/dist/cli-tui/commands/undo-handlers.js.map +1 -1
  149. package/dist/cli-tui/tui-renderer/skills-controller.d.ts +3 -0
  150. package/dist/cli-tui/tui-renderer/skills-controller.d.ts.map +1 -1
  151. package/dist/cli-tui/tui-renderer/skills-controller.js +77 -33
  152. package/dist/cli-tui/tui-renderer/skills-controller.js.map +1 -1
  153. package/dist/codex/app-server-client.d.ts.map +1 -1
  154. package/dist/codex/app-server-client.js +1 -3
  155. package/dist/codex/app-server-client.js.map +1 -1
  156. package/dist/codex/compatibility.d.ts.map +1 -1
  157. package/dist/codex/compatibility.js +1 -3
  158. package/dist/codex/compatibility.js.map +1 -1
  159. package/dist/codex/subagent-dispatch-table.d.ts +8 -0
  160. package/dist/codex/subagent-dispatch-table.d.ts.map +1 -1
  161. package/dist/codex/subagent-dispatch-table.js +23 -0
  162. package/dist/codex/subagent-dispatch-table.js.map +1 -1
  163. package/dist/context/manifest.d.ts.map +1 -1
  164. package/dist/context/manifest.js +1 -3
  165. package/dist/context/manifest.js.map +1 -1
  166. package/dist/conversation/render-model.d.ts +0 -36
  167. package/dist/conversation/render-model.d.ts.map +1 -1
  168. package/dist/conversation/render-model.js +1 -3
  169. package/dist/conversation/render-model.js.map +1 -1
  170. package/dist/customer-value/ambient-learning.d.ts +75 -0
  171. package/dist/customer-value/ambient-learning.d.ts.map +1 -0
  172. package/dist/customer-value/ambient-learning.js +472 -0
  173. package/dist/customer-value/ambient-learning.js.map +1 -0
  174. package/dist/customer-value/internal-helpers.d.ts +13 -0
  175. package/dist/customer-value/internal-helpers.d.ts.map +1 -0
  176. package/dist/customer-value/internal-helpers.js +70 -0
  177. package/dist/customer-value/internal-helpers.js.map +1 -0
  178. package/dist/customer-value/report.d.ts +282 -0
  179. package/dist/customer-value/report.d.ts.map +1 -0
  180. package/dist/customer-value/report.js +2085 -0
  181. package/dist/customer-value/report.js.map +1 -0
  182. package/dist/db/schema.d.ts +5 -1
  183. package/dist/db/schema.d.ts.map +1 -1
  184. package/dist/db/schema.js.map +1 -1
  185. package/dist/evalops/agent-bootstrap.d.ts.map +1 -1
  186. package/dist/evalops/agent-bootstrap.js +1 -3
  187. package/dist/evalops/agent-bootstrap.js.map +1 -1
  188. package/dist/evalops/agent-mcp-metadata.d.ts.map +1 -1
  189. package/dist/evalops/agent-mcp-metadata.js +1 -3
  190. package/dist/evalops/agent-mcp-metadata.js.map +1 -1
  191. package/dist/index.d.ts +1 -0
  192. package/dist/index.d.ts.map +1 -1
  193. package/dist/index.js +1 -0
  194. package/dist/index.js.map +1 -1
  195. package/dist/installers/maestro-review-workflow.d.ts +38 -0
  196. package/dist/installers/maestro-review-workflow.d.ts.map +1 -0
  197. package/dist/installers/maestro-review-workflow.js +163 -0
  198. package/dist/installers/maestro-review-workflow.js.map +1 -0
  199. package/dist/load-env.d.ts.map +1 -1
  200. package/dist/load-env.js +2 -1
  201. package/dist/load-env.js.map +1 -1
  202. package/dist/main.d.ts.map +1 -1
  203. package/dist/main.js +92 -3
  204. package/dist/main.js.map +1 -1
  205. package/dist/mcp/config.d.ts.map +1 -1
  206. package/dist/mcp/config.js +1 -3
  207. package/dist/mcp/config.js.map +1 -1
  208. package/dist/mcp/elicitation.d.ts.map +1 -1
  209. package/dist/mcp/elicitation.js +1 -3
  210. package/dist/mcp/elicitation.js.map +1 -1
  211. package/dist/mcp/official-registry.d.ts.map +1 -1
  212. package/dist/mcp/official-registry.js +1 -3
  213. package/dist/mcp/official-registry.js.map +1 -1
  214. package/dist/mcp/workspace-trust.d.ts.map +1 -1
  215. package/dist/mcp/workspace-trust.js +1 -3
  216. package/dist/mcp/workspace-trust.js.map +1 -1
  217. package/dist/memory/service-client.d.ts.map +1 -1
  218. package/dist/memory/service-client.js +1 -3
  219. package/dist/memory/service-client.js.map +1 -1
  220. package/dist/models/config-loader.d.ts.map +1 -1
  221. package/dist/models/config-loader.js +1 -3
  222. package/dist/models/config-loader.js.map +1 -1
  223. package/dist/node_modules/@evalops/contracts/dist/index.d.ts +1 -0
  224. package/dist/node_modules/@evalops/contracts/dist/index.d.ts.map +1 -1
  225. package/dist/node_modules/@evalops/contracts/dist/index.js +1 -0
  226. package/dist/node_modules/@evalops/contracts/dist/index.js.map +1 -1
  227. package/dist/node_modules/@evalops/contracts/dist/maestro-settings.d.ts +61 -0
  228. package/dist/node_modules/@evalops/contracts/dist/maestro-settings.d.ts.map +1 -0
  229. package/dist/node_modules/@evalops/contracts/dist/maestro-settings.js +183 -0
  230. package/dist/node_modules/@evalops/contracts/dist/maestro-settings.js.map +1 -0
  231. package/dist/node_modules/@evalops/contracts/package.json +1 -1
  232. package/dist/node_modules/@evalops/tui/package.json +1 -1
  233. package/dist/oauth/connectors.d.ts.map +1 -1
  234. package/dist/oauth/connectors.js +1 -3
  235. package/dist/oauth/connectors.js.map +1 -1
  236. package/dist/oauth/evalops.d.ts.map +1 -1
  237. package/dist/oauth/evalops.js +1 -3
  238. package/dist/oauth/evalops.js.map +1 -1
  239. package/dist/platform/a2a-client.d.ts.map +1 -1
  240. package/dist/platform/a2a-client.js +1 -3
  241. package/dist/platform/a2a-client.js.map +1 -1
  242. package/dist/platform/a2a-cockpit.d.ts +1 -0
  243. package/dist/platform/a2a-cockpit.d.ts.map +1 -1
  244. package/dist/platform/a2a-cockpit.js +42 -11
  245. package/dist/platform/a2a-cockpit.js.map +1 -1
  246. package/dist/platform/a2a-completion-audit.d.ts +1 -1
  247. package/dist/platform/a2a-completion-audit.d.ts.map +1 -1
  248. package/dist/platform/a2a-completion-audit.js +7 -11
  249. package/dist/platform/a2a-completion-audit.js.map +1 -1
  250. package/dist/platform/a2a-maestro-peer.js +16 -0
  251. package/dist/platform/a2a-maestro-peer.js.map +1 -1
  252. package/dist/platform/a2a-peer-pairing.d.ts.map +1 -1
  253. package/dist/platform/a2a-peer-pairing.js +1 -3
  254. package/dist/platform/a2a-peer-pairing.js.map +1 -1
  255. package/dist/platform/a2a-peer-registry.d.ts.map +1 -1
  256. package/dist/platform/a2a-peer-registry.js +1 -3
  257. package/dist/platform/a2a-peer-registry.js.map +1 -1
  258. package/dist/platform/a2a-task-ledger.d.ts +20 -0
  259. package/dist/platform/a2a-task-ledger.d.ts.map +1 -1
  260. package/dist/platform/a2a-task-ledger.js +207 -11
  261. package/dist/platform/a2a-task-ledger.js.map +1 -1
  262. package/dist/platform/a2a-work-graph.d.ts.map +1 -1
  263. package/dist/platform/a2a-work-graph.js +1 -3
  264. package/dist/platform/a2a-work-graph.js.map +1 -1
  265. package/dist/platform/operating-layer.d.ts.map +1 -1
  266. package/dist/platform/operating-layer.js +14 -8
  267. package/dist/platform/operating-layer.js.map +1 -1
  268. package/dist/platform/tool-execution-client.d.ts.map +1 -1
  269. package/dist/platform/tool-execution-client.js +19 -2
  270. package/dist/platform/tool-execution-client.js.map +1 -1
  271. package/dist/providers/auth.d.ts.map +1 -1
  272. package/dist/providers/auth.js +1 -3
  273. package/dist/providers/auth.js.map +1 -1
  274. package/dist/runtime/env.d.ts +9 -1
  275. package/dist/runtime/env.d.ts.map +1 -1
  276. package/dist/runtime/env.js +63 -1
  277. package/dist/runtime/env.js.map +1 -1
  278. package/dist/safety/policy.d.ts.map +1 -1
  279. package/dist/safety/policy.js +1 -4
  280. package/dist/safety/policy.js.map +1 -1
  281. package/dist/sandbox/docker-sandbox.d.ts.map +1 -1
  282. package/dist/sandbox/docker-sandbox.js +6 -1
  283. package/dist/sandbox/docker-sandbox.js.map +1 -1
  284. package/dist/server/handlers/hosted-runner-drain.d.ts.map +1 -1
  285. package/dist/server/handlers/hosted-runner-drain.js +1 -3
  286. package/dist/server/handlers/hosted-runner-drain.js.map +1 -1
  287. package/dist/server/handlers/platform-a2a-push.d.ts.map +1 -1
  288. package/dist/server/handlers/platform-a2a-push.js +53 -2
  289. package/dist/server/handlers/platform-a2a-push.js.map +1 -1
  290. package/dist/server/handlers/runtime-app-server-ws.d.ts.map +1 -1
  291. package/dist/server/handlers/runtime-app-server-ws.js +1 -3
  292. package/dist/server/handlers/runtime-app-server-ws.js.map +1 -1
  293. package/dist/server/headless-runtime-service.d.ts +16 -0
  294. package/dist/server/headless-runtime-service.d.ts.map +1 -1
  295. package/dist/server/headless-runtime-service.js +232 -206
  296. package/dist/server/headless-runtime-service.js.map +1 -1
  297. package/dist/server/hosted-agent-runtime-progress.d.ts.map +1 -1
  298. package/dist/server/hosted-agent-runtime-progress.js +12 -3
  299. package/dist/server/hosted-agent-runtime-progress.js.map +1 -1
  300. package/dist/server/pending-request-payload.d.ts.map +1 -1
  301. package/dist/server/pending-request-payload.js +1 -3
  302. package/dist/server/pending-request-payload.js.map +1 -1
  303. package/dist/server/route-auth.d.ts.map +1 -1
  304. package/dist/server/route-auth.js +2 -0
  305. package/dist/server/route-auth.js.map +1 -1
  306. package/dist/server/session-serialization.d.ts.map +1 -1
  307. package/dist/server/session-serialization.js +1 -3
  308. package/dist/server/session-serialization.js.map +1 -1
  309. package/dist/services/compliance/normalize.d.ts.map +1 -1
  310. package/dist/services/compliance/normalize.js +1 -3
  311. package/dist/services/compliance/normalize.js.map +1 -1
  312. package/dist/services/intelligent-router/normalize.d.ts.map +1 -1
  313. package/dist/services/intelligent-router/normalize.js +1 -3
  314. package/dist/services/intelligent-router/normalize.js.map +1 -1
  315. package/dist/services/revenue-attribution/normalize.d.ts.map +1 -1
  316. package/dist/services/revenue-attribution/normalize.js +1 -3
  317. package/dist/services/revenue-attribution/normalize.js.map +1 -1
  318. package/dist/services/traces/normalize.d.ts.map +1 -1
  319. package/dist/services/traces/normalize.js +1 -3
  320. package/dist/services/traces/normalize.js.map +1 -1
  321. package/dist/services/workspace-config/normalize.d.ts.map +1 -1
  322. package/dist/services/workspace-config/normalize.js +1 -3
  323. package/dist/services/workspace-config/normalize.js.map +1 -1
  324. package/dist/skills/composer.d.ts.map +1 -1
  325. package/dist/skills/composer.js +13 -1
  326. package/dist/skills/composer.js.map +1 -1
  327. package/dist/skills/index.d.ts +1 -0
  328. package/dist/skills/index.d.ts.map +1 -1
  329. package/dist/skills/index.js +1 -0
  330. package/dist/skills/index.js.map +1 -1
  331. package/dist/skills/learned-guidelines.d.ts +33 -0
  332. package/dist/skills/learned-guidelines.d.ts.map +1 -0
  333. package/dist/skills/learned-guidelines.js +291 -0
  334. package/dist/skills/learned-guidelines.js.map +1 -0
  335. package/dist/skills/linter.d.ts.map +1 -1
  336. package/dist/skills/linter.js +1 -3
  337. package/dist/skills/linter.js.map +1 -1
  338. package/dist/skills/runtime-activation.d.ts +1 -0
  339. package/dist/skills/runtime-activation.d.ts.map +1 -1
  340. package/dist/skills/runtime-activation.js +2 -3
  341. package/dist/skills/runtime-activation.js.map +1 -1
  342. package/dist/skills/tool.d.ts.map +1 -1
  343. package/dist/skills/tool.js +26 -21
  344. package/dist/skills/tool.js.map +1 -1
  345. package/dist/skills/trust-cache.d.ts +7 -0
  346. package/dist/skills/trust-cache.d.ts.map +1 -1
  347. package/dist/skills/trust-cache.js +16 -0
  348. package/dist/skills/trust-cache.js.map +1 -1
  349. package/dist/telemetry/agent-workforce-native-event.d.ts.map +1 -1
  350. package/dist/telemetry/agent-workforce-native-event.js +1 -3
  351. package/dist/telemetry/agent-workforce-native-event.js.map +1 -1
  352. package/dist/telemetry/maestro-event-bus.d.ts.map +1 -1
  353. package/dist/telemetry/maestro-event-bus.js +42 -81
  354. package/dist/telemetry/maestro-event-bus.js.map +1 -1
  355. package/dist/telemetry/maestro-platform-replay-fixture.d.ts.map +1 -1
  356. package/dist/telemetry/maestro-platform-replay-fixture.js +1 -3
  357. package/dist/telemetry/maestro-platform-replay-fixture.js.map +1 -1
  358. package/dist/telemetry.d.ts.map +1 -1
  359. package/dist/telemetry.js +54 -43
  360. package/dist/telemetry.js.map +1 -1
  361. package/dist/theme/theme-loader.d.ts.map +1 -1
  362. package/dist/theme/theme-loader.js +1 -3
  363. package/dist/theme/theme-loader.js.map +1 -1
  364. package/dist/tools/apply-patch.d.ts.map +1 -1
  365. package/dist/tools/apply-patch.js +76 -8
  366. package/dist/tools/apply-patch.js.map +1 -1
  367. package/dist/tools/diff-preview.d.ts.map +1 -1
  368. package/dist/tools/diff-preview.js +10 -1
  369. package/dist/tools/diff-preview.js.map +1 -1
  370. package/dist/tools/edit.d.ts.map +1 -1
  371. package/dist/tools/edit.js +17 -0
  372. package/dist/tools/edit.js.map +1 -1
  373. package/dist/tools/write.d.ts.map +1 -1
  374. package/dist/tools/write.js +9 -0
  375. package/dist/tools/write.js.map +1 -1
  376. package/dist/undo/tracker.d.ts +5 -0
  377. package/dist/undo/tracker.d.ts.map +1 -1
  378. package/dist/undo/tracker.js +13 -0
  379. package/dist/undo/tracker.js.map +1 -1
  380. package/dist/utils/fs.d.ts +1 -1
  381. package/dist/utils/fs.d.ts.map +1 -1
  382. package/dist/utils/fs.js +29 -2
  383. package/dist/utils/fs.js.map +1 -1
  384. package/dist/utils/git-stash.d.ts.map +1 -1
  385. package/dist/utils/git-stash.js +15 -8
  386. package/dist/utils/git-stash.js.map +1 -1
  387. package/dist/utils/json.d.ts +11 -0
  388. package/dist/utils/json.d.ts.map +1 -1
  389. package/dist/utils/json.js +9 -0
  390. package/dist/utils/json.js.map +1 -1
  391. package/dist/utils/shell-env.d.ts.map +1 -1
  392. package/dist/utils/shell-env.js +2 -0
  393. package/dist/utils/shell-env.js.map +1 -1
  394. package/dist/utils/url-extractor-git.d.ts +26 -0
  395. package/dist/utils/url-extractor-git.d.ts.map +1 -0
  396. package/dist/utils/url-extractor-git.js +259 -0
  397. package/dist/utils/url-extractor-git.js.map +1 -0
  398. package/dist/utils/url-extractor.d.ts.map +1 -1
  399. package/dist/utils/url-extractor.js +23 -251
  400. package/dist/utils/url-extractor.js.map +1 -1
  401. package/dist/version.json +2 -2
  402. package/package.json +310 -306
  403. package/skills/incident-triage/SKILL.md +19 -1
  404. package/skills/install-code-review/SKILL.md +69 -0
  405. package/skills/security-review/SKILL.md +68 -0
  406. package/skills/security-review/reference/rubric.md +85 -0
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-specs.js","sourceRoot":"","sources":["../../src/agent/subagent-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E,MAAM,MAAM,GAAG,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAcpD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,kCAAkC;IAClC,IAAI,EAAE;QACL,MAAM;QACN,MAAM;QACN,MAAM;QACN,QAAQ;QACR,kBAAkB;QAClB,MAAM;QACN,QAAQ;KACR;IACD,8BAA8B;IAC9B,KAAK,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC;IACxD,sBAAsB;IACtB,KAAK,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACnC,6BAA6B;IAC7B,GAAG,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,YAAY,CAAC;IAC5C,wBAAwB;IACxB,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;IACjC,mBAAmB;IACnB,MAAM,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC;IACxC,qBAAqB;IACrB,QAAQ,EAAE,CAAC,QAAQ,CAAC;CACX,CAAC;AAEX;;GAEG;AACH,SAAS,mBAAmB,CAC3B,GAAG,UAA4C;IAE/C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,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AED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,QAAsB,EACtB,SAAgC;IAEhC,OAAO;QACN,GAAG,cAAc,CAAC,QAAQ,CAAC;QAC3B,GAAG,SAAS;QACZ,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,QAAQ;QAC9C,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,sBAAsB;KAC5D,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAA2B;IACvD,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,IAAI,CAAC,mBAAmB,KAAK,SAAS,IAAI,IAAI,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;QAC5E,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["/**\n * Subagent Tool Specifications\n *\n * Defines different subagent types and what tools they have access to.\n * This enables fine-grained control over capabilities for different agent contexts:\n * - explorer: Read-only exploration of codebase\n * - planner: Can read and use todo, but no file modifications\n * - coder: Full coding capabilities\n * - reviewer: Read-only with web access for reviewing code\n * - researcher: Web search and fetch focused\n *\n * Inspired by Amp's subagentSpec/subagentType system.\n */\n\nimport { createLogger } from \"../utils/logger.js\";\nimport { normalizeToolNameForSafety } from \"../utils/safety-normalization.js\";\n\nconst logger = createLogger(\"agent:subagent-specs\");\n\n/**\n * Available subagent types.\n */\nexport type SubagentType =\n\t| \"explorer\"\n\t| \"planner\"\n\t| \"coder\"\n\t| \"reviewer\"\n\t| \"researcher\"\n\t| \"minimal\"\n\t| \"custom\";\n\n/**\n * Tool categories for easier specification.\n */\nexport const TOOL_CATEGORIES = {\n\t/** Read-only file system tools */\n\tread: [\n\t\t\"read\",\n\t\t\"list\",\n\t\t\"find\",\n\t\t\"search\",\n\t\t\"parallel_ripgrep\",\n\t\t\"diff\",\n\t\t\"status\",\n\t],\n\t/** File modification tools */\n\twrite: [\"apply_patch\", \"edit\", \"write\", \"notebook_edit\"],\n\t/** Shell execution */\n\tshell: [\"bash\", \"background_tasks\"],\n\t/** Web and external tools */\n\tweb: [\"websearch\", \"webfetch\", \"codesearch\"],\n\t/** Interactive tools */\n\tinteractive: [\"ask_user\", \"todo\"],\n\t/** GitHub tools */\n\tgithub: [\"gh_pr\", \"gh_issue\", \"gh_repo\"],\n\t/** Advanced tools */\n\tadvanced: [\"oracle\"],\n} as const;\n\n/**\n * Get all tool names from categories.\n */\nfunction toolsFromCategories(\n\t...categories: (keyof typeof TOOL_CATEGORIES)[]\n): string[] {\n\tconst tools: string[] = [];\n\tfor (const cat of categories) {\n\t\ttools.push(...TOOL_CATEGORIES[cat]);\n\t}\n\treturn [...new Set(tools)];\n}\n\n/**\n * Subagent specification defining capabilities.\n */\nexport interface SubagentSpec {\n\t/** Display name */\n\tdisplayName: string;\n\t/** Description of what this subagent is for */\n\tdescription: string;\n\t/** Tools that are allowed (whitelist) */\n\tallowedTools: string[];\n\t/** Tools that are explicitly denied (takes precedence) */\n\tdeniedTools?: string[];\n\t/** Whether MCP servers can provide additional tools */\n\tallowMcp: boolean;\n\t/** Whether toolbox tools are allowed */\n\tallowToolbox: boolean;\n\t/** Maximum number of tool calls per turn */\n\tmaxToolCallsPerTurn?: number;\n\t/** Whether dangerous operations require extra confirmation */\n\trequireConfirmation?: boolean;\n}\n\n/**\n * Default subagent specifications.\n */\nexport const SUBAGENT_SPECS: Record<SubagentType, SubagentSpec> = {\n\texplorer: {\n\t\tdisplayName: \"Explorer\",\n\t\tdescription: \"Read-only codebase exploration - can search and read files\",\n\t\tallowedTools: toolsFromCategories(\"read\", \"advanced\"),\n\t\tdeniedTools: [\"oracle\"], // Explorers shouldn't invoke oracle\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 20,\n\t\trequireConfirmation: false,\n\t},\n\tplanner: {\n\t\tdisplayName: \"Planner\",\n\t\tdescription: \"Planning mode - can read files and manage todos\",\n\t\tallowedTools: [...toolsFromCategories(\"read\", \"interactive\")],\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 15,\n\t\trequireConfirmation: false,\n\t},\n\tcoder: {\n\t\tdisplayName: \"Coder\",\n\t\tdescription: \"Full coding capabilities - can read, write, and execute\",\n\t\tallowedTools: toolsFromCategories(\n\t\t\t\"read\",\n\t\t\t\"write\",\n\t\t\t\"shell\",\n\t\t\t\"interactive\",\n\t\t\t\"github\",\n\t\t\t\"advanced\",\n\t\t),\n\t\tallowMcp: true,\n\t\tallowToolbox: true,\n\t\tmaxToolCallsPerTurn: 30,\n\t\trequireConfirmation: true,\n\t},\n\treviewer: {\n\t\tdisplayName: \"Reviewer\",\n\t\tdescription: \"Code review mode - can read files and search web\",\n\t\tallowedTools: [...toolsFromCategories(\"read\", \"web\"), \"ask_user\"],\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 15,\n\t\trequireConfirmation: false,\n\t},\n\tresearcher: {\n\t\tdisplayName: \"Researcher\",\n\t\tdescription: \"Research mode - focused on web search and analysis\",\n\t\tallowedTools: [...toolsFromCategories(\"web\", \"read\"), \"ask_user\", \"todo\"],\n\t\tallowMcp: true,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 20,\n\t\trequireConfirmation: false,\n\t},\n\tminimal: {\n\t\tdisplayName: \"Minimal\",\n\t\tdescription: \"Minimal capabilities - only basic read operations\",\n\t\tallowedTools: [\"read\", \"list\", \"search\"],\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 10,\n\t\trequireConfirmation: false,\n\t},\n\tcustom: {\n\t\tdisplayName: \"Custom\",\n\t\tdescription: \"User-defined tool specification\",\n\t\tallowedTools: toolsFromCategories(\n\t\t\t\"read\",\n\t\t\t\"write\",\n\t\t\t\"shell\",\n\t\t\t\"interactive\",\n\t\t\t\"advanced\",\n\t\t),\n\t\tallowMcp: true,\n\t\tallowToolbox: true,\n\t\trequireConfirmation: true,\n\t},\n};\n\n/**\n * Get specification for a subagent type.\n */\nexport function getSubagentSpec(type: SubagentType): SubagentSpec {\n\treturn SUBAGENT_SPECS[type];\n}\n\n/**\n * Check if a tool is allowed for a subagent type.\n */\nexport function isToolAllowed(\n\ttoolName: string,\n\ttype: SubagentType,\n\tcustomSpec?: Partial<SubagentSpec>,\n): boolean {\n\tconst spec = customSpec\n\t\t? { ...SUBAGENT_SPECS[type], ...customSpec }\n\t\t: SUBAGENT_SPECS[type];\n\tconst normalizedToolName = normalizeToolNameForSafety(toolName);\n\tconst deniedTools = spec.deniedTools?.map(normalizeToolNameForSafety) ?? [];\n\tconst allowedTools = spec.allowedTools.map(normalizeToolNameForSafety);\n\n\t// Denied tools take precedence\n\tif (deniedTools.includes(normalizedToolName)) {\n\t\treturn false;\n\t}\n\n\t// Check if in allowed list\n\treturn allowedTools.includes(normalizedToolName);\n}\n\n/**\n * Get the list of allowed tools for a subagent type.\n */\nexport function getAllowedTools(\n\ttype: SubagentType,\n\tcustomSpec?: Partial<SubagentSpec>,\n): string[] {\n\tconst spec = customSpec\n\t\t? { ...SUBAGENT_SPECS[type], ...customSpec }\n\t\t: SUBAGENT_SPECS[type];\n\n\tlet tools = spec.allowedTools.map(normalizeToolNameForSafety);\n\n\t// Remove denied tools\n\tif (spec.deniedTools) {\n\t\tconst deniedTools = new Set(\n\t\t\tspec.deniedTools.map(normalizeToolNameForSafety),\n\t\t);\n\t\ttools = tools.filter((t) => !deniedTools.has(t));\n\t}\n\n\treturn [...new Set(tools)];\n}\n\n/**\n * Filter a list of tools based on subagent spec.\n */\nexport function filterToolsForSubagent<T extends { name: string }>(\n\ttools: T[],\n\ttype: SubagentType,\n\tcustomSpec?: Partial<SubagentSpec>,\n): T[] {\n\tconst allowedTools = getAllowedTools(type, customSpec);\n\n\treturn tools.filter((tool) => {\n\t\tconst toolName = normalizeToolNameForSafety(tool.name);\n\t\treturn allowedTools.includes(toolName);\n\t});\n}\n\n/**\n * Current subagent type for the session.\n */\nlet currentSubagentType: SubagentType = \"coder\";\n\n/**\n * Get the current subagent type.\n */\nexport function getCurrentSubagentType(): SubagentType {\n\treturn currentSubagentType;\n}\n\n/**\n * Set the current subagent type.\n */\nexport function setCurrentSubagentType(type: SubagentType): void {\n\tlogger.info(\"Setting subagent type\", { type });\n\tcurrentSubagentType = type;\n}\n\n/**\n * Parse subagent type from string.\n */\nexport function parseSubagentType(typeStr: string): SubagentType | null {\n\tconst normalized = normalizeToolNameForSafety(typeStr);\n\tif (normalized in SUBAGENT_SPECS) {\n\t\treturn normalized as SubagentType;\n\t}\n\treturn null;\n}\n\n/**\n * Get subagent type from environment variable.\n */\nexport function getSubagentTypeFromEnv(): SubagentType {\n\tconst envType = process.env.MAESTRO_SUBAGENT_TYPE?.toLowerCase();\n\tif (envType && envType in SUBAGENT_SPECS) {\n\t\treturn envType as SubagentType;\n\t}\n\treturn \"coder\";\n}\n\n/**\n * Format subagent type for display.\n */\nexport function formatSubagentDisplay(type: SubagentType): string {\n\tconst spec = getSubagentSpec(type);\n\treturn `${spec.displayName} - ${spec.description}`;\n}\n\n/**\n * Get all available subagent types with their specs.\n */\nexport function getAllSubagentTypes(): Array<{\n\ttype: SubagentType;\n\tspec: SubagentSpec;\n}> {\n\treturn (Object.entries(SUBAGENT_SPECS) as [SubagentType, SubagentSpec][]).map(\n\t\t([type, spec]) => ({\n\t\t\ttype,\n\t\t\tspec,\n\t\t}),\n\t);\n}\n\n/**\n * Create a custom subagent spec by merging with a base type.\n */\nexport function createCustomSpec(\n\tbaseType: SubagentType,\n\toverrides: Partial<SubagentSpec>,\n): SubagentSpec {\n\treturn {\n\t\t...SUBAGENT_SPECS[baseType],\n\t\t...overrides,\n\t\tdisplayName: overrides.displayName ?? \"Custom\",\n\t\tdescription: overrides.description ?? \"Custom configuration\",\n\t};\n}\n\n/**\n * Validate a subagent spec.\n */\nexport function validateSpec(spec: Partial<SubagentSpec>): string[] {\n\tconst errors: string[] = [];\n\n\tif (spec.allowedTools && spec.allowedTools.length === 0) {\n\t\terrors.push(\"allowedTools cannot be empty\");\n\t}\n\n\tif (spec.maxToolCallsPerTurn !== undefined && spec.maxToolCallsPerTurn < 1) {\n\t\terrors.push(\"maxToolCallsPerTurn must be at least 1\");\n\t}\n\n\treturn errors;\n}\n"]}
1
+ {"version":3,"file":"subagent-specs.js","sourceRoot":"","sources":["../../src/agent/subagent-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E,MAAM,MAAM,GAAG,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAgBpD,MAAM,yBAAyB,GAAiC;IAC/D,aAAa,EAAE,OAAO;IACtB,aAAa,EAAE,UAAU;IACzB,aAAa,EAAE,aAAa;IAC5B,YAAY,EAAE,YAAY;IAC1B,eAAe,EAAE,UAAU;IAC3B,kBAAkB,EAAE,OAAO;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,kCAAkC;IAClC,IAAI,EAAE;QACL,MAAM;QACN,MAAM;QACN,MAAM;QACN,QAAQ;QACR,kBAAkB;QAClB,MAAM;QACN,QAAQ;KACR;IACD,8BAA8B;IAC9B,KAAK,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC;IACxD,sBAAsB;IACtB,KAAK,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACnC,6BAA6B;IAC7B,GAAG,EA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AAI,EAAE,CAAC,IAAI,OAAO,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAkB;IACvD,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,GAAG,IAAI,CAAC,WAAW,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IAIlC,OAAQ,MAAM,CAAC,OAAO,CAAC,cAAc,CAAoC,CAAC,GAAG,CAC5E,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAClB,IAAI;QACJ,IAAI;KACJ,CAAC,CACF,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,QAAsB,EACtB,SAAgC;IAEhC,OAAO;QACN,GAAG,cAAc,CAAC,QAAQ,CAAC;QAC3B,GAAG,SAAS;QACZ,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,QAAQ;QAC9C,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,sBAAsB;KAC5D,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAA2B;IACvD,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,IAAI,CAAC,mBAAmB,KAAK,SAAS,IAAI,IAAI,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;QAC5E,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["/**\n * Subagent Tool Specifications\n *\n * Defines different subagent types and what tools they have access to.\n * This enables fine-grained control over capabilities for different agent contexts:\n * - explorer: Read-only exploration of codebase\n * - planner: Can read and use todo, but no file modifications\n * - coder: Full coding capabilities\n * - reviewer: Read-only with web access for reviewing code\n * - researcher: Web search and fetch focused\n * - browser-qa: Browser-based product QA with screenshots and repro evidence\n *\n * Inspired by Amp's subagentSpec/subagentType system.\n */\n\nimport { codexSubagentLaneForType } from \"../codex/subagent-dispatch-table.js\";\nimport { createLogger } from \"../utils/logger.js\";\nimport { normalizeToolNameForSafety } from \"../utils/safety-normalization.js\";\n\nconst logger = createLogger(\"agent:subagent-specs\");\n\n/**\n * Available subagent types.\n */\nexport type SubagentType =\n\t| \"explorer\"\n\t| \"planner\"\n\t| \"coder\"\n\t| \"reviewer\"\n\t| \"test-runner\"\n\t| \"researcher\"\n\t| \"browser-qa\"\n\t| \"minimal\"\n\t| \"custom\";\n\nconst CODEX_LANE_SUBAGENT_TYPES: Record<string, SubagentType> = {\n\t\"code-writer\": \"coder\",\n\t\"code-review\": \"reviewer\",\n\t\"test-runner\": \"test-runner\",\n\t\"browser-qa\": \"browser-qa\",\n\t\"repo-explorer\": \"explorer\",\n\t\"release-shepherd\": \"coder\",\n};\n\n/**\n * Tool categories for easier specification.\n */\nexport const TOOL_CATEGORIES = {\n\t/** Read-only file system tools */\n\tread: [\n\t\t\"read\",\n\t\t\"list\",\n\t\t\"find\",\n\t\t\"search\",\n\t\t\"parallel_ripgrep\",\n\t\t\"diff\",\n\t\t\"status\",\n\t],\n\t/** File modification tools */\n\twrite: [\"apply_patch\", \"edit\", \"write\", \"notebook_edit\"],\n\t/** Shell execution */\n\tshell: [\"bash\", \"background_tasks\"],\n\t/** Web and external tools */\n\tweb: [\"websearch\", \"webfetch\", \"codesearch\"],\n\t/** Browser/product QA tools */\n\tbrowser: [\n\t\t\"agent_browser\",\n\t\t\"browser_open\",\n\t\t\"browser_snapshot\",\n\t\t\"browser_click\",\n\t\t\"browser_fill\",\n\t\t\"browser_type\",\n\t\t\"browser_screenshot\",\n\t\t\"browser_console\",\n\t\t\"browser_record\",\n\t\t\"read_page\",\n\t\t\"search_page\",\n\t\t\"find_on_page\",\n\t\t\"extract_links\",\n\t\t\"wait_for_selector\",\n\t\t\"click_element\",\n\t\t\"type_text\",\n\t\t\"scroll_page\",\n\t\t\"select_element\",\n\t\t\"navigate_to\",\n\t\t\"open_links_in_tabs\",\n\t\t\"highlight_element\",\n\t\t\"browser_operator\",\n\t\t\"mouse_action\",\n\t\t\"pointer_action\",\n\t\t\"keyboard_action\",\n\t\t\"extract_table_data\",\n\t\t\"capture_network\",\n\t\t\"capture_console_errors\",\n\t\t\"collect_diagnostics\",\n\t\t\"extract_document\",\n\t\t\"capture_screenshot\",\n\t\t\"native_click\",\n\t\t\"native_type\",\n\t\t\"native_press\",\n\t\t\"native_key_down\",\n\t\t\"native_key_up\",\n\t],\n\t/** Interactive tools */\n\tinteractive: [\"ask_user\", \"todo\"],\n\t/** GitHub tools */\n\tgithub: [\"gh_pr\", \"gh_issue\", \"gh_repo\"],\n\t/** Advanced tools */\n\tadvanced: [\"oracle\"],\n} as const;\n\n/**\n * Get all tool names from categories.\n */\nfunction toolsFromCategories(\n\t...categories: (keyof typeof TOOL_CATEGORIES)[]\n): string[] {\n\tconst tools: string[] = [];\n\tfor (const cat of categories) {\n\t\ttools.push(...TOOL_CATEGORIES[cat]);\n\t}\n\treturn [...new Set(tools)];\n}\n\n/**\n * Subagent specification defining capabilities.\n */\nexport interface SubagentSpec {\n\t/** Display name */\n\tdisplayName: string;\n\t/** Description of what this subagent is for */\n\tdescription: string;\n\t/** Tools that are allowed (whitelist) */\n\tallowedTools: string[];\n\t/** Tools that are explicitly denied (takes precedence) */\n\tdeniedTools?: string[];\n\t/** Whether MCP servers can provide additional tools */\n\tallowMcp: boolean;\n\t/** Whether toolbox tools are allowed */\n\tallowToolbox: boolean;\n\t/** Maximum number of tool calls per turn */\n\tmaxToolCallsPerTurn?: number;\n\t/** Whether dangerous operations require extra confirmation */\n\trequireConfirmation?: boolean;\n}\n\n/**\n * Default subagent specifications.\n */\nexport const SUBAGENT_SPECS: Record<SubagentType, SubagentSpec> = {\n\texplorer: {\n\t\tdisplayName: \"Explorer\",\n\t\tdescription: \"Read-only codebase exploration - can search and read files\",\n\t\tallowedTools: toolsFromCategories(\"read\", \"advanced\"),\n\t\tdeniedTools: [\"oracle\"], // Explorers shouldn't invoke oracle\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 20,\n\t\trequireConfirmation: false,\n\t},\n\tplanner: {\n\t\tdisplayName: \"Planner\",\n\t\tdescription: \"Planning mode - can read files and manage todos\",\n\t\tallowedTools: [...toolsFromCategories(\"read\", \"interactive\")],\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 15,\n\t\trequireConfirmation: false,\n\t},\n\tcoder: {\n\t\tdisplayName: \"Coder\",\n\t\tdescription: \"Full coding capabilities - can read, write, and execute\",\n\t\tallowedTools: toolsFromCategories(\n\t\t\t\"read\",\n\t\t\t\"write\",\n\t\t\t\"shell\",\n\t\t\t\"interactive\",\n\t\t\t\"github\",\n\t\t\t\"advanced\",\n\t\t),\n\t\tallowMcp: true,\n\t\tallowToolbox: true,\n\t\tmaxToolCallsPerTurn: 30,\n\t\trequireConfirmation: true,\n\t},\n\treviewer: {\n\t\tdisplayName: \"Reviewer\",\n\t\tdescription: \"Code review mode - can read files and search web\",\n\t\tallowedTools: [...toolsFromCategories(\"read\", \"web\"), \"ask_user\"],\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 15,\n\t\trequireConfirmation: false,\n\t},\n\t\"test-runner\": {\n\t\tdisplayName: \"Test Runner\",\n\t\tdescription: \"Test execution mode - can run checks and inspect results\",\n\t\tallowedTools: [\n\t\t\t...toolsFromCategories(\"read\", \"shell\", \"interactive\"),\n\t\t\t\"webfetch\",\n\t\t],\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 20,\n\t\trequireConfirmation: false,\n\t},\n\tresearcher: {\n\t\tdisplayName: \"Researcher\",\n\t\tdescription: \"Research mode - focused on web search and analysis\",\n\t\tallowedTools: [...toolsFromCategories(\"web\", \"read\"), \"ask_user\", \"todo\"],\n\t\tallowMcp: true,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 20,\n\t\trequireConfirmation: false,\n\t},\n\t\"browser-qa\": {\n\t\tdisplayName: \"Browser QA\",\n\t\tdescription:\n\t\t\t\"Product QA mode - explores web surfaces and captures repro evidence\",\n\t\tallowedTools: [\n\t\t\t...toolsFromCategories(\"read\", \"web\", \"browser\"),\n\t\t\t\"bash\",\n\t\t\t\"ask_user\",\n\t\t\t\"todo\",\n\t\t],\n\t\tallowMcp: true,\n\t\tallowToolbox: true,\n\t\tmaxToolCallsPerTurn: 25,\n\t\trequireConfirmation: false,\n\t},\n\tminimal: {\n\t\tdisplayName: \"Minimal\",\n\t\tdescription: \"Minimal capabilities - only basic read operations\",\n\t\tallowedTools: [\"read\", \"list\", \"search\"],\n\t\tallowMcp: false,\n\t\tallowToolbox: false,\n\t\tmaxToolCallsPerTurn: 10,\n\t\trequireConfirmation: false,\n\t},\n\tcustom: {\n\t\tdisplayName: \"Custom\",\n\t\tdescription: \"User-defined tool specification\",\n\t\tallowedTools: toolsFromCategories(\n\t\t\t\"read\",\n\t\t\t\"write\",\n\t\t\t\"shell\",\n\t\t\t\"interactive\",\n\t\t\t\"advanced\",\n\t\t),\n\t\tallowMcp: true,\n\t\tallowToolbox: true,\n\t\trequireConfirmation: true,\n\t},\n};\n\n/**\n * Get specification for a subagent type.\n */\nexport function getSubagentSpec(type: SubagentType): SubagentSpec {\n\treturn SUBAGENT_SPECS[type];\n}\n\n/**\n * Check if a tool is allowed for a subagent type.\n */\nexport function isToolAllowed(\n\ttoolName: string,\n\ttype: SubagentType,\n\tcustomSpec?: Partial<SubagentSpec>,\n): boolean {\n\tconst spec = customSpec\n\t\t? { ...SUBAGENT_SPECS[type], ...customSpec }\n\t\t: SUBAGENT_SPECS[type];\n\tconst normalizedToolName = normalizeToolNameForSafety(toolName);\n\tconst deniedTools = spec.deniedTools?.map(normalizeToolNameForSafety) ?? [];\n\tconst allowedTools = spec.allowedTools.map(normalizeToolNameForSafety);\n\n\t// Denied tools take precedence\n\tif (deniedTools.includes(normalizedToolName)) {\n\t\treturn false;\n\t}\n\n\t// Check if in allowed list\n\treturn allowedTools.includes(normalizedToolName);\n}\n\n/**\n * Get the list of allowed tools for a subagent type.\n */\nexport function getAllowedTools(\n\ttype: SubagentType,\n\tcustomSpec?: Partial<SubagentSpec>,\n): string[] {\n\tconst spec = customSpec\n\t\t? { ...SUBAGENT_SPECS[type], ...customSpec }\n\t\t: SUBAGENT_SPECS[type];\n\n\tlet tools = spec.allowedTools.map(normalizeToolNameForSafety);\n\n\t// Remove denied tools\n\tif (spec.deniedTools) {\n\t\tconst deniedTools = new Set(\n\t\t\tspec.deniedTools.map(normalizeToolNameForSafety),\n\t\t);\n\t\ttools = tools.filter((t) => !deniedTools.has(t));\n\t}\n\n\treturn [...new Set(tools)];\n}\n\n/**\n * Filter a list of tools based on subagent spec.\n */\nexport function filterToolsForSubagent<T extends { name: string }>(\n\ttools: T[],\n\ttype: SubagentType,\n\tcustomSpec?: Partial<SubagentSpec>,\n): T[] {\n\tconst allowedTools = getAllowedTools(type, customSpec);\n\n\treturn tools.filter((tool) => {\n\t\tconst toolName = normalizeToolNameForSafety(tool.name);\n\t\treturn allowedTools.includes(toolName);\n\t});\n}\n\n/**\n * Current subagent type for the session.\n */\nlet currentSubagentType: SubagentType = \"coder\";\n\n/**\n * Get the current subagent type.\n */\nexport function getCurrentSubagentType(): SubagentType {\n\treturn currentSubagentType;\n}\n\n/**\n * Set the current subagent type.\n */\nexport function setCurrentSubagentType(type: SubagentType): void {\n\tlogger.info(\"Setting subagent type\", { type });\n\tcurrentSubagentType = type;\n}\n\n/**\n * Parse subagent type from string.\n */\nexport function parseSubagentType(typeStr: string): SubagentType | null {\n\tconst normalized = normalizeToolNameForSafety(typeStr);\n\tconst hyphenated = normalized.replace(/_/g, \"-\");\n\tif (hyphenated in SUBAGENT_SPECS) {\n\t\treturn hyphenated as SubagentType;\n\t}\n\tconst lane = codexSubagentLaneForType(typeStr);\n\treturn lane ? (CODEX_LANE_SUBAGENT_TYPES[lane.laneId] ?? null) : null;\n}\n\n/**\n * Get subagent type from environment variable.\n */\nexport function getSubagentTypeFromEnv(): SubagentType {\n\treturn parseSubagentType(process.env.MAESTRO_SUBAGENT_TYPE ?? \"\") ?? \"coder\";\n}\n\n/**\n * Format subagent type for display.\n */\nexport function formatSubagentDisplay(type: SubagentType): string {\n\tconst spec = getSubagentSpec(type);\n\treturn `${spec.displayName} - ${spec.description}`;\n}\n\n/**\n * Get all available subagent types with their specs.\n */\nexport function getAllSubagentTypes(): Array<{\n\ttype: SubagentType;\n\tspec: SubagentSpec;\n}> {\n\treturn (Object.entries(SUBAGENT_SPECS) as [SubagentType, SubagentSpec][]).map(\n\t\t([type, spec]) => ({\n\t\t\ttype,\n\t\t\tspec,\n\t\t}),\n\t);\n}\n\n/**\n * Create a custom subagent spec by merging with a base type.\n */\nexport function createCustomSpec(\n\tbaseType: SubagentType,\n\toverrides: Partial<SubagentSpec>,\n): SubagentSpec {\n\treturn {\n\t\t...SUBAGENT_SPECS[baseType],\n\t\t...overrides,\n\t\tdisplayName: overrides.displayName ?? \"Custom\",\n\t\tdescription: overrides.description ?? \"Custom configuration\",\n\t};\n}\n\n/**\n * Validate a subagent spec.\n */\nexport function validateSpec(spec: Partial<SubagentSpec>): string[] {\n\tconst errors: string[] = [];\n\n\tif (spec.allowedTools && spec.allowedTools.length === 0) {\n\t\terrors.push(\"allowedTools cannot be empty\");\n\t}\n\n\tif (spec.maxToolCallsPerTurn !== undefined && spec.maxToolCallsPerTurn < 1) {\n\t\terrors.push(\"maxToolCallsPerTurn must be at least 1\");\n\t}\n\n\treturn errors;\n}\n"]}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Swarm coverage gate
3
+ *
4
+ * Pre-dispatch check that refuses to start a swarm until its validation
5
+ * contract is fully covered: every assertion claimed by exactly one feature,
6
+ * no duplicate claims, and no claim referencing an unknown assertion.
7
+ *
8
+ * The gate is opt-in: a swarm configured without a validation contract passes
9
+ * unconditionally, preserving existing behavior. When a contract is present,
10
+ * the orchestrator must supply feature claims that cover it (see
11
+ * ./orchestrator-prompt.ts).
12
+ */
13
+ import { type CoverageReport, type FeatureClaim, type ValidationContract } from "../validation-contract.js";
14
+ export interface SwarmCoverageGateInput {
15
+ /** Mission validation contract; when absent the gate passes unconditionally. */
16
+ validationContract?: ValidationContract;
17
+ /** Feature claims to evaluate against the contract. */
18
+ featureClaims?: FeatureClaim[];
19
+ }
20
+ export interface SwarmCoverageGateResult {
21
+ /** True when there is no contract to gate, or coverage is complete. */
22
+ ok: boolean;
23
+ /** Coverage report, present only when a contract was evaluated. */
24
+ report?: CoverageReport;
25
+ /** Actionable failure message, present only when ok is false. */
26
+ message?: string;
27
+ }
28
+ /**
29
+ * Render an actionable, single-string explanation of why coverage failed.
30
+ */
31
+ export declare function formatCoverageGateFailure(report: CoverageReport): string;
32
+ /**
33
+ * Evaluate the coverage gate for a swarm. Passes unconditionally when no
34
+ * validation contract is configured.
35
+ */
36
+ export declare function evaluateSwarmCoverageGate(input: SwarmCoverageGateInput): SwarmCoverageGateResult;
37
+ //# sourceMappingURL=coverage-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-gate.d.ts","sourceRoot":"","sources":["../../../src/agent/swarm/coverage-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAEvB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,sBAAsB;IACtC,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,uDAAuD;IACvD,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACvC,uEAAuE;IACvE,EAAE,EAAE,OAAO,CAAC;IACZ,mEAAmE;IACnE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAuBxE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,sBAAsB,GAC3B,uBAAuB,CAUzB"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Swarm coverage gate
3
+ *
4
+ * Pre-dispatch check that refuses to start a swarm until its validation
5
+ * contract is fully covered: every assertion claimed by exactly one feature,
6
+ * no duplicate claims, and no claim referencing an unknown assertion.
7
+ *
8
+ * The gate is opt-in: a swarm configured without a validation contract passes
9
+ * unconditionally, preserving existing behavior. When a contract is present,
10
+ * the orchestrator must supply feature claims that cover it (see
11
+ * ./orchestrator-prompt.ts).
12
+ */
13
+ import { checkCoverage, } from "../validation-contract.js";
14
+ /**
15
+ * Render an actionable, single-string explanation of why coverage failed.
16
+ */
17
+ export function formatCoverageGateFailure(report) {
18
+ const parts = [
19
+ "Swarm refused to start: the validation contract is not fully covered.",
20
+ ];
21
+ if (report.orphans.length > 0) {
22
+ parts.push(`Unclaimed assertions (no feature fulfills them): ${report.orphans.join(", ")}.`);
23
+ }
24
+ if (report.duplicates.length > 0) {
25
+ parts.push(`Assertions claimed more than once or duplicated in the contract: ${report.duplicates.join(", ")}.`);
26
+ }
27
+ if (report.unknownAssertions.length > 0) {
28
+ parts.push(`Features reference assertions absent from the contract: ${report.unknownAssertions.join(", ")}.`);
29
+ }
30
+ parts.push("Every assertion must be claimed by exactly one feature before work begins.");
31
+ return parts.join(" ");
32
+ }
33
+ /**
34
+ * Evaluate the coverage gate for a swarm. Passes unconditionally when no
35
+ * validation contract is configured.
36
+ */
37
+ export function evaluateSwarmCoverageGate(input) {
38
+ const { validationContract, featureClaims } = input;
39
+ if (!validationContract) {
40
+ return { ok: true };
41
+ }
42
+ const report = checkCoverage(validationContract, featureClaims ?? []);
43
+ if (report.ok) {
44
+ return { ok: true, report };
45
+ }
46
+ return { ok: false, report, message: formatCoverageGateFailure(report) };
47
+ }
48
+ //# sourceMappingURL=coverage-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-gate.js","sourceRoot":"","sources":["../../../src/agent/swarm/coverage-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAIN,aAAa,GACb,MAAM,2BAA2B,CAAC;AAkBnC;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAsB;IAC/D,MAAM,KAAK,GAAa;QACvB,uEAAuE;KACvE,CAAC;IACF,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CACT,oDAAoD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAChF,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,KAAK,CAAC,IAAI,CACT,oEAAoE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACnG,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,KAAK,CAAC,IAAI,CACT,2DAA2D,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACjG,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CACT,4EAA4E,CAC5E,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACxC,KAA6B;IAE7B,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACpD,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACzB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,MAAM,GAAG,aAAa,CAAC,kBAAkB,EAAE,aAAa,IAAI,EAAE,CAAC,CAAC;IACtE,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB,CAAC,MAAM,CAAC,EAAE,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * Swarm coverage gate\n *\n * Pre-dispatch check that refuses to start a swarm until its validation\n * contract is fully covered: every assertion claimed by exactly one feature,\n * no duplicate claims, and no claim referencing an unknown assertion.\n *\n * The gate is opt-in: a swarm configured without a validation contract passes\n * unconditionally, preserving existing behavior. When a contract is present,\n * the orchestrator must supply feature claims that cover it (see\n * ./orchestrator-prompt.ts).\n */\n\nimport {\n\ttype CoverageReport,\n\ttype FeatureClaim,\n\ttype ValidationContract,\n\tcheckCoverage,\n} from \"../validation-contract.js\";\n\nexport interface SwarmCoverageGateInput {\n\t/** Mission validation contract; when absent the gate passes unconditionally. */\n\tvalidationContract?: ValidationContract;\n\t/** Feature claims to evaluate against the contract. */\n\tfeatureClaims?: FeatureClaim[];\n}\n\nexport interface SwarmCoverageGateResult {\n\t/** True when there is no contract to gate, or coverage is complete. */\n\tok: boolean;\n\t/** Coverage report, present only when a contract was evaluated. */\n\treport?: CoverageReport;\n\t/** Actionable failure message, present only when ok is false. */\n\tmessage?: string;\n}\n\n/**\n * Render an actionable, single-string explanation of why coverage failed.\n */\nexport function formatCoverageGateFailure(report: CoverageReport): string {\n\tconst parts: string[] = [\n\t\t\"Swarm refused to start: the validation contract is not fully covered.\",\n\t];\n\tif (report.orphans.length > 0) {\n\t\tparts.push(\n\t\t\t`Unclaimed assertions (no feature fulfills them): ${report.orphans.join(\", \")}.`,\n\t\t);\n\t}\n\tif (report.duplicates.length > 0) {\n\t\tparts.push(\n\t\t\t`Assertions claimed more than once or duplicated in the contract: ${report.duplicates.join(\", \")}.`,\n\t\t);\n\t}\n\tif (report.unknownAssertions.length > 0) {\n\t\tparts.push(\n\t\t\t`Features reference assertions absent from the contract: ${report.unknownAssertions.join(\", \")}.`,\n\t\t);\n\t}\n\tparts.push(\n\t\t\"Every assertion must be claimed by exactly one feature before work begins.\",\n\t);\n\treturn parts.join(\" \");\n}\n\n/**\n * Evaluate the coverage gate for a swarm. Passes unconditionally when no\n * validation contract is configured.\n */\nexport function evaluateSwarmCoverageGate(\n\tinput: SwarmCoverageGateInput,\n): SwarmCoverageGateResult {\n\tconst { validationContract, featureClaims } = input;\n\tif (!validationContract) {\n\t\treturn { ok: true };\n\t}\n\tconst report = checkCoverage(validationContract, featureClaims ?? []);\n\tif (report.ok) {\n\t\treturn { ok: true, report };\n\t}\n\treturn { ok: false, report, message: formatCoverageGateFailure(report) };\n}\n"]}
@@ -63,6 +63,7 @@ export declare class SwarmExecutor {
63
63
  private selectA2APeerName;
64
64
  private resolveA2ASkillId;
65
65
  private resolveA2ATaskClass;
66
+ private resolveA2ARole;
66
67
  private teammateIndex;
67
68
  private nextA2ARouteIndex;
68
69
  private defaultA2ADiscoveryLimit;
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/agent/swarm/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyDH,OAAO,KAAK,EAEX,WAAW,EAEX,iBAAiB,EACjB,UAAU,EAKV,MAAM,YAAY,CAAC;AAwVpB;;GAEG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAwC;IACzD,OAAO,CAAC,cAAc,CAAgD;IACtE,O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C,wBAAwB;YAQlB,aAAa;YAwVb,gBAAgB;IAmM9B,OAAO,CAAC,4BAA4B;IAmDpC,OAAO,CAAC,4BAA4B;YAuEtB,mBAAmB;IA+BjC,OAAO,CAAC,mBAAmB;IA8D3B,OAAO,CAAC,eAAe;YAuDT,uBAAuB;YAyCvB,wBAAwB;IAsBtC;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAe5B;AA4CD;;GAEG;AACH,wBAAsB,YAAY,CACjC,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,UAAU,CAAC,CAMrB"}
@@ -11,7 +11,7 @@ import { unlinkSync, writeFileSync } from "node:fs";
11
11
  import { tmpdir } from "node:os";
12
12
  import { join } from "node:path";
13
13
  import { formatDelegation } from "@evalops/contracts";
14
- import { codexSubagentTypeA2ASkillID } from "../../codex/subagent-dispatch-table.js";
14
+ import { codexSubagentSkillToken, codexSubagentTypeA2ASkillID, } from "../../codex/subagent-dispatch-table.js";
15
15
  import { buildEvalOpsDelegationEnvironment, issueEvalOpsDelegationToken, } from "../../oauth/index.js";
16
16
  import { rankA2ACapabilityPeers } from "../../platform/a2a-capability-market.js";
17
17
  import { buildA2AUserMessage, cancelA2ATask, getA2ATask, normalizeA2ABaseUrl, resolveA2AServiceConfig, sendA2AMessage, } from "../../platform/a2a-client.js";
@@ -23,8 +23,13 @@ import { getEnvValue, trimString } from "../../platform/client.js";
23
23
  import { recordA2ADelegationTelemetry as recordA2ADelegationTelemetryEvent, recordSubagentDispatch, } from "../../telemetry.js";
24
24
  import { createLogger } from "../../utils/logger.js";
25
25
  import { sanitizeWithStaticMask } from "../../utils/secret-redactor.js";
26
+ import { detectMissionSessionRole } from "../mission-artifacts.js";
26
27
  import { parseMode, resolveSubagentDispatch, } from "../modes.js";
28
+ import { applySpecialistProfileToPrompt, resolveSpecialistProfile, } from "../specialist-profiles.js";
29
+ import { parseSubagentType } from "../subagent-specs.js";
30
+ import { evaluateSwarmCoverageGate } from "./coverage-gate.js";
27
31
  import { publishSwarmRuntimeEvent } from "./runtime-events.js";
32
+ import { buildSwarmValidationDirective } from "./validation-directive.js";
28
33
  const logger = createLogger("agent:swarm:executor");
29
34
  /** Default timeout per task (5 minutes) */
30
35
  const DEFAULT_TASK_TIMEOUT_MS = 5 * 60 * 1000;
@@ -41,6 +46,7 @@ const A2A_SKILL_PRIMARY_TASK_CLASSES = new Map([
41
46
  ["maestro.subagent.code-writer", "code.implementation"],
42
47
  ["maestro.subagent.code-review", "code.review"],
43
48
  ["maestro.subagent.test-runner", "test.execution"],
49
+ ["maestro.subagent.browser-qa", "product.qa"],
44
50
  ["maestro.subagent.repo-explorer", "repo.inspect"],
45
51
  ["maestro.subagent.release-shepherd", "release.follow-through"],
46
52
  ]);
@@ -57,10 +63,18 @@ const SWARM_SUBAGENT_TASK_CLASSES = new Map([
57
63
  ["test", "test.execution"],
58
64
  ["ci", "test.execution"],
59
65
  ["ci-monitor", "test.execution"],
66
+ ["test-runner", "test.execution"],
67
+ ["browser-qa", "product.qa"],
68
+ ["browser", "product.qa"],
69
+ ["dogfood", "product.qa"],
70
+ ["product-qa", "product.qa"],
71
+ ["e2e-qa", "browser.e2e"],
72
+ ["ux-qa", "ux.repro"],
60
73
  ["planner", "agent.delegation"],
61
74
  ["minimal", "agent.delegation"],
62
75
  ["custom", "agent.delegation"],
63
76
  ]);
77
+ const A2A_SUBAGENT_TASK_CLASS_OVERRIDES = new Set(["e2e-qa", "ux-qa"]);
64
78
  /** Teammate name prefixes for friendly identification */
65
79
  const TEAMMATE_NAMES = [
66
80
  "Alpha",
@@ -141,6 +155,13 @@ function cloneConfig(config) {
141
155
  }
142
156
  : undefined,
143
157
  tasks: config.tasks.map(cloneTask),
158
+ validationContract: config.validationContract
159
+ ? structuredClone(config.validationContract)
160
+ : undefined,
161
+ featureClaims: config.featureClaims?.map((claim) => ({
162
+ ...claim,
163
+ fulfills: [...claim.fulfills],
164
+ })),
144
165
  };
145
166
  }
146
167
  function cloneState(state) {
@@ -280,6 +301,9 @@ function buildDispatchEnv(dispatch, reasoningEffortOverride, runtimeSelection) {
280
301
  }
281
302
  return env;
282
303
  }
304
+ function resolveMissionRoleForTeammate() {
305
+ return detectMissionSessionRole() === "validator" ? "validator" : "worker";
306
+ }
283
307
  /**
284
308
  * SwarmExecutor manages a swarm of parallel agent instances.
285
309
  */
@@ -421,6 +445,30 @@ export class SwarmExecutor {
421
445
  * Execute the swarm - runs all tasks with available teammates.
422
446
  */
423
447
  async execute() {
448
+ // Pre-dispatch coverage gate: refuse to start when a validation contract
449
+ // is configured but its assertions are not fully covered by feature
450
+ // claims. No-ops when no contract is configured.
451
+ const coverage = evaluateSwarmCoverageGate({
452
+ validationContract: this.state.config.validationContract,
453
+ featureClaims: this.state.config.featureClaims,
454
+ });
455
+ if (!coverage.ok) {
456
+ const error = coverage.message ?? "Swarm coverage gate failed";
457
+ this.state.status = "failed";
458
+ this.state.error = error;
459
+ this.state.completedAt = Date.now();
460
+ this.emit({
461
+ type: "swarm_fail",
462
+ swarmId: this.state.id,
463
+ error,
464
+ });
465
+ this.emit({
466
+ type: "swarm_complete",
467
+ swarmId: this.state.id,
468
+ state: cloneState(this.state),
469
+ });
470
+ return cloneState(this.state);
471
+ }
424
472
  this.state.status = "running";
425
473
  this.emit({
426
474
  type: "swarm_start",
@@ -554,9 +602,11 @@ export class SwarmExecutor {
554
602
  async buildTeammateEnv(teammate, task, dispatch, runtimeSelection) {
555
603
  const baseEnv = {
556
604
  ...process.env,
605
+ MAESTRO_MISSION_WORKER: "1",
557
606
  MAESTRO_SWARM_MODE: "1",
558
607
  MAESTRO_SWARM_ID: this.state.id,
559
608
  MAESTRO_TEAMMATE_ID: teammate.id,
609
+ MAESTRO_MISSION_ROLE: resolveMissionRoleForTeammate(),
560
610
  ...buildDispatchEnv(dispatch, this.state.config.reasoningEffort, runtimeSelection),
561
611
  };
562
612
  try {
@@ -591,7 +641,11 @@ export class SwarmExecutor {
591
641
  }
592
642
  resolveTaskDispatch(task, teammate, options = {}) {
593
643
  const startedAt = Date.now();
594
- const subagentType = task.subagentType ?? this.state.config.subagentType;
644
+ const requestedSubagentType = task.subagentType ?? this.state.config.subagentType;
645
+ if (!requestedSubagentType) {
646
+ return null;
647
+ }
648
+ const subagentType = parseSubagentType(requestedSubagentType);
595
649
  if (!subagentType) {
596
650
  return null;
597
651
  }
@@ -706,7 +760,7 @@ export class SwarmExecutor {
706
760
  config: peer.config,
707
761
  skillId,
708
762
  taskClass: this.resolveA2ATaskClass(task, options, skillId),
709
- role: options.role ?? task.subagentType,
763
+ role: this.resolveA2ARole(task, options),
710
764
  tasksPath: options.tasksPath,
711
765
  peerEndpointHash: hashA2AEndpointUrlForTelemetry(peer.config.baseUrl),
712
766
  source: "registry",
@@ -769,7 +823,7 @@ export class SwarmExecutor {
769
823
  config,
770
824
  skillId: selectedSkillId,
771
825
  taskClass: this.resolveA2ATaskClass(task, options, selectedSkillId),
772
- role: options.role ?? task.subagentType,
826
+ role: this.resolveA2ARole(task, options),
773
827
  tasksPath: options.tasksPath,
774
828
  peerAgentId: candidate.agent.id,
775
829
  peerEndpointHash: endpointHash,
@@ -829,20 +883,44 @@ export class SwarmExecutor {
829
883
  return peer?.entry.skills?.[0]?.id;
830
884
  }
831
885
  resolveA2ATaskClass(task, options, skillId) {
886
+ const explicitSkill = trimString(task.a2aSkillId) ?? trimString(options.skillId);
887
+ const requestedSubagentType = trimString(task.subagentType ?? this.state.config.subagentType);
888
+ const normalizedRequestedSubagentType = codexSubagentSkillToken(requestedSubagentType);
889
+ const parsedSubagentType = requestedSubagentType
890
+ ? parseSubagentType(requestedSubagentType)
891
+ : undefined;
892
+ const subagentType = parsedSubagentType ?? normalizedRequestedSubagentType;
893
+ const mappedSubagentTaskClass = normalizedRequestedSubagentType
894
+ ? (SWARM_SUBAGENT_TASK_CLASSES.get(normalizedRequestedSubagentType) ??
895
+ (parsedSubagentType
896
+ ? SWARM_SUBAGENT_TASK_CLASSES.get(parsedSubagentType)
897
+ : undefined))
898
+ : undefined;
899
+ if (mappedSubagentTaskClass &&
900
+ normalizedRequestedSubagentType &&
901
+ A2A_SUBAGENT_TASK_CLASS_OVERRIDES.has(normalizedRequestedSubagentType)) {
902
+ return mappedSubagentTaskClass;
903
+ }
832
904
  const mappedSkillTaskClass = skillId
833
905
  ? A2A_SKILL_PRIMARY_TASK_CLASSES.get(skillId)
834
906
  : undefined;
835
907
  if (mappedSkillTaskClass) {
836
908
  return mappedSkillTaskClass;
837
909
  }
838
- if (skillId &&
839
- (trimString(task.a2aSkillId) || trimString(options.skillId))) {
910
+ if (skillId && explicitSkill) {
840
911
  return undefined;
841
912
  }
842
- const subagentType = trimString(task.subagentType ?? this.state.config.subagentType);
843
- return ((subagentType
844
- ? SWARM_SUBAGENT_TASK_CLASSES.get(subagentType)
845
- : undefined) ?? subagentType);
913
+ return mappedSubagentTaskClass ?? subagentType ?? requestedSubagentType;
914
+ }
915
+ resolveA2ARole(task, options) {
916
+ const configuredRole = trimString(options.role);
917
+ if (configuredRole) {
918
+ return parseSubagentType(configuredRole) ?? configuredRole;
919
+ }
920
+ const requestedSubagentType = trimString(task.subagentType ?? this.state.config.subagentType);
921
+ return requestedSubagentType
922
+ ? (parseSubagentType(requestedSubagentType) ?? requestedSubagentType)
923
+ : undefined;
846
924
  }
847
925
  teammateIndex(teammate) {
848
926
  const index = this.state.teammates.findIndex((item) => item.id === teammate.id);
@@ -858,18 +936,64 @@ export class SwarmExecutor {
858
936
  }
859
937
  async spawnTeammate(teammate, task) {
860
938
  const tmpFile = join(tmpdir(), `${this.state.id}-${toSafeTaskTempBasename(task.id)}`);
939
+ const specialistProfile = task.specialistProfile
940
+ ? resolveSpecialistProfile(task.specialistProfile, this.state.config.cwd)
941
+ : null;
942
+ if (task.specialistProfile && !specialistProfile) {
943
+ throw new Error(`specialist profile not found or invalid: ${task.specialistProfile}`);
944
+ }
861
945
  const delegationPrompt = {
862
946
  goal: `Complete swarm task ${task.id} as teammate "${teammate.name}".`,
863
947
  context: `You are teammate "${teammate.name}" in swarm ${this.state.id}, working from plan file ${this.state.config.planFile}.`,
864
- task: task.prompt,
948
+ task: applySpecialistProfileToPrompt(task.prompt, specialistProfile),
865
949
  evidence: task.files?.length
866
950
  ? task.files.map((file) => `Relevant file: ${file}`)
867
951
  : [],
868
- validation: "Make the requested changes directly, add or update focused tests when behavior changes, and run the relevant verification before finishing.",
952
+ validation: buildSwarmValidationDirective(task.mocksAllowed),
869
953
  stoppingCondition: "Stop when the assigned task is complete and report what changed, what you verified, and any blockers. Do not broaden into unrelated tasks.",
870
954
  };
871
955
  const prompt = formatDelegation(delegationPrompt);
956
+ const requestedSubagentType = task.subagentType ?? this.state.config.subagentType;
872
957
  writeFileSync(tmpFile, prompt);
958
+ if (requestedSubagentType && !parseSubagentType(requestedSubagentType)) {
959
+ try {
960
+ unlinkSync(tmpFile);
961
+ }
962
+ catch {
963
+ // Ignore cleanup errors
964
+ }
965
+ const error = `Invalid subagent type: ${requestedSubagentType}`;
966
+ this.state.activeTasks.delete(task.id);
967
+ this.state.failedTasks.add(task.id);
968
+ if (!this.state.config.continueOnFailure) {
969
+ this.state.status = "failed";
970
+ }
971
+ teammate.status = "failed";
972
+ teammate.error = error;
973
+ teammate.completedAt = Date.now();
974
+ teammate.currentTask = undefined;
975
+ this.emit({
976
+ type: "task_fail",
977
+ swarmId: this.state.id,
978
+ teammateId: teammate.id,
979
+ taskId: task.id,
980
+ error,
981
+ });
982
+ this.emit({
983
+ type: "teammate_complete",
984
+ swarmId: this.state.id,
985
+ teammate,
986
+ });
987
+ if (this.state.status === "running" &&
988
+ (this.state.pendingTasks.length > 0 ||
989
+ this.state.activeTasks.size > 0) &&
990
+ this.state.config.continueOnFailure) {
991
+ teammate.status = "pending";
992
+ teammate.error = undefined;
993
+ teammate.completedAt = undefined;
994
+ }
995
+ return;
996
+ }
873
997
  const a2aConfig = this.resolveA2AConfig();
874
998
  if (a2aConfig) {
875
999
  void this.spawnA2ATeammate(teammate, task, prompt, tmpFile, a2aConfig);
@@ -1153,7 +1277,7 @@ export class SwarmExecutor {
1153
1277
  route,
1154
1278
  taskId: sent.task.id,
1155
1279
  });
1156
- await this.recordA2ASwarmTaskStart(route, task, sent.task, {
1280
+ await this.recordA2ASwarmTaskStart(route, task, sent.task, prompt, {
1157
1281
  messageId,
1158
1282
  contextId,
1159
1283
  });
@@ -1273,6 +1397,7 @@ export class SwarmExecutor {
1273
1397
  });
1274
1398
  }
1275
1399
  buildA2ASwarmMessageMetadata(teammate, task, route) {
1400
+ const missionRole = resolveMissionRoleForTeammate();
1276
1401
  const currentDelegationId = `${this.state.id}:${task.id}`;
1277
1402
  const contextId = `maestro-swarm:${this.state.id}:${task.id}`;
1278
1403
  const lineage = {
@@ -1292,6 +1417,8 @@ export class SwarmExecutor {
1292
1417
  cwd: this.state.config.cwd,
1293
1418
  taskId: task.id,
1294
1419
  swarmId: this.state.id,
1420
+ missionRole,
1421
+ env: { MAESTRO_MISSION_ROLE: missionRole },
1295
1422
  }
1296
1423
  : undefined;
1297
1424
  const peerControl = {
@@ -1303,6 +1430,11 @@ export class SwarmExecutor {
1303
1430
  controlModes: ["followup", "steer", "interrupt", "cancel"],
1304
1431
  evidenceRequired: ["status", "artifact", "task", "workGraph"],
1305
1432
  };
1433
+ const validationPolicy = {
1434
+ schema: "evalops.maestro.swarm-validation-policy.v1",
1435
+ mocksAllowed: task.mocksAllowed === true,
1436
+ mode: task.mocksAllowed === true ? "mocks-allowed" : "real-integrations",
1437
+ };
1306
1438
  return {
1307
1439
  requestKind: "maestro-swarm-task",
1308
1440
  transport: "a2a",
@@ -1311,6 +1443,8 @@ export class SwarmExecutor {
1311
1443
  teammateId: teammate.id,
1312
1444
  teammateName: teammate.name,
1313
1445
  taskId: task.id,
1446
+ missionRole,
1447
+ validation: validationPolicy,
1314
1448
  ...(route.skillId ? { a2aSkillId: route.skillId } : {}),
1315
1449
  ...(task.files?.length ? { files: task.files } : {}),
1316
1450
  swarm: lineage,
@@ -1319,8 +1453,10 @@ export class SwarmExecutor {
1319
1453
  transport: "a2a",
1320
1454
  peer: route.name,
1321
1455
  peerControl,
1456
+ validation: validationPolicy,
1322
1457
  },
1323
1458
  "evalops.peerControl": peerControl,
1459
+ "evalops.validation": validationPolicy,
1324
1460
  ...(subagentRequest
1325
1461
  ? { "evalops.subagentRequest": subagentRequest }
1326
1462
  : {}),
@@ -1445,14 +1581,14 @@ export class SwarmExecutor {
1445
1581
  teammate.a2a = undefined;
1446
1582
  }
1447
1583
  }
1448
- async recordA2ASwarmTaskStart(route, task, remoteTask, ids) {
1584
+ async recordA2ASwarmTaskStart(route, task, remoteTask, delegatedPrompt, ids) {
1449
1585
  try {
1450
1586
  await recordA2ATaskStart({
1451
1587
  path: route.tasksPath,
1452
1588
  peer: route.name,
1453
1589
  peerDisplayName: route.displayName,
1454
1590
  task: remoteTask,
1455
- text: task.prompt,
1591
+ text: delegatedPrompt,
1456
1592
  messageId: ids.messageId,
1457
1593
  contextId: remoteTask.contextId ?? ids.contextId,
1458
1594
  kind: "delegation",