@runcofactor/cli 0.52.0 → 0.53.0

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 (225) hide show
  1. package/README.md +2 -0
  2. package/dist/{account-3ZG24MOE.js → account-MRZ54P5P.js} +5 -5
  3. package/dist/{alert-5G7PTAX2.js → alert-XBHELHEI.js} +8 -8
  4. package/dist/{api-catalog-IBYAFKKQ.js → api-catalog-GWYRX53L.js} +5 -5
  5. package/dist/{api-key-UXC44BDR.js → api-key-FH6JN447.js} +5 -5
  6. package/dist/{attachment-T6IRFQW3.js → attachment-J7GRVT5F.js} +5 -5
  7. package/dist/{auth-SHOCJE6Z.js → auth-VZZQXRDR.js} +3 -3
  8. package/dist/{benchmark-NJ2U6VTC.js → benchmark-A3SNDARF.js} +5 -5
  9. package/dist/{blackcat-RQJVFGXQ.js → blackcat-UM6TBQBN.js} +3 -3
  10. package/dist/{chunk-DHAGRM2F.js → chunk-33U56YGD.js} +14 -5
  11. package/dist/{chunk-DHAGRM2F.js.map → chunk-33U56YGD.js.map} +1 -1
  12. package/dist/{chunk-M752EUK3.js → chunk-3JU4UYYN.js} +5 -5
  13. package/dist/{chunk-G6BCST3G.js → chunk-3ZOUNCA5.js} +7 -7
  14. package/dist/{chunk-76Z6E7XX.js → chunk-4UZN6TVT.js} +74 -131
  15. package/dist/chunk-4UZN6TVT.js.map +1 -0
  16. package/dist/{chunk-ABT3BLRC.js → chunk-5TKXHS3X.js} +3 -3
  17. package/dist/{chunk-QCYSONXI.js → chunk-CRYHWO4M.js} +2 -2
  18. package/dist/{chunk-QTYUM4ZB.js → chunk-EJ3ZPH5U.js} +23 -187
  19. package/dist/chunk-EJ3ZPH5U.js.map +1 -0
  20. package/dist/{chunk-I5RHTCPY.js → chunk-EL6KJ4PO.js} +4 -4
  21. package/dist/{chunk-ZL4O6C42.js → chunk-HXBK3AGD.js} +2 -2
  22. package/dist/{chunk-PRERH4DN.js → chunk-I2SOHQ2C.js} +3 -3
  23. package/dist/{chunk-CYSPCGO6.js → chunk-JEHHEMUL.js} +5 -5
  24. package/dist/{chunk-LIEADTEF.js → chunk-LJFVRJCA.js} +2 -2
  25. package/dist/{chunk-UEJ2HTKU.js → chunk-MJVUMVLO.js} +19 -1
  26. package/dist/chunk-MJVUMVLO.js.map +1 -0
  27. package/dist/chunk-N55RKCGR.js +24 -0
  28. package/dist/chunk-N55RKCGR.js.map +1 -0
  29. package/dist/{chunk-PHNH3CEU.js → chunk-O4Z44BR7.js} +5 -5
  30. package/dist/{chunk-QA37WVF6.js → chunk-OQFCZERZ.js} +6 -6
  31. package/dist/{chunk-EUVB6Y3C.js → chunk-P7L5KELH.js} +8 -8
  32. package/dist/chunk-P7L5KELH.js.map +1 -0
  33. package/dist/{chunk-Z3MDQSZG.js → chunk-PJFFGQSB.js} +2 -2
  34. package/dist/{chunk-IY3ZK46I.js → chunk-QOVJUSSL.js} +2 -2
  35. package/dist/{chunk-RPJMQBB5.js → chunk-QXU4G4YN.js} +3 -3
  36. package/dist/{chunk-SZSTJIYU.js → chunk-RRSUKARV.js} +4 -4
  37. package/dist/{chunk-775FI436.js → chunk-RVD6J6IZ.js} +2 -2
  38. package/dist/{chunk-5UUIBY6E.js → chunk-TAVBFLCR.js} +3 -3
  39. package/dist/{chunk-ROX7N3RK.js → chunk-V7HB5LAU.js} +10 -7
  40. package/dist/chunk-V7HB5LAU.js.map +1 -0
  41. package/dist/{chunk-LL6TSQWV.js → chunk-VKZOHJCE.js} +3 -3
  42. package/dist/chunk-VKZOHJCE.js.map +1 -0
  43. package/dist/{chunk-3HI6QC4V.js → chunk-WRBU6TX7.js} +2 -2
  44. package/dist/{proofs-TXJGAP5F.js → chunk-X7SUSIY3.js} +118 -20
  45. package/dist/chunk-X7SUSIY3.js.map +1 -0
  46. package/dist/{chunk-BF3IPGMP.js → chunk-XSSZMG65.js} +4 -4
  47. package/dist/{credential-TWSWV64F.js → credential-4RFRU6OH.js} +5 -5
  48. package/dist/{credential-template-XO5D5AI3.js → credential-template-36PFUTBN.js} +5 -5
  49. package/dist/{digest-SLEFOLPV.js → digest-THMKFMP7.js} +8 -8
  50. package/dist/{docs-IDC4V4WQ.js → docs-ZGM53L67.js} +5 -5
  51. package/dist/{doctor-SDAYEA6C.js → doctor-Z2XBGBM3.js} +3 -3
  52. package/dist/{environment-VBUIBQ6O.js → environment-5YVZXBN7.js} +7 -7
  53. package/dist/eval-SO5TPD37.js +1177 -0
  54. package/dist/eval-SO5TPD37.js.map +1 -0
  55. package/dist/{exploration-IREIR5PO.js → exploration-GZ4WUJJH.js} +5 -5
  56. package/dist/{exploratory-test-4Q7BMEFT.js → exploratory-test-Y7P4ZDLD.js} +5 -5
  57. package/dist/{external-run-S7LULKPT.js → external-run-IJGGZOGI.js} +7 -7
  58. package/dist/{feature-flag-IASHTUGU.js → feature-flag-UH6Z7774.js} +5 -5
  59. package/dist/{flow-IBEZFZTU.js → flow-MRWAQYZZ.js} +5 -5
  60. package/dist/{github-HAEZRULP.js → github-VDJU3PU3.js} +6 -6
  61. package/dist/index.js +101 -82
  62. package/dist/index.js.map +1 -1
  63. package/dist/{init-LT2TZMQY.js → init-CROSTPA6.js} +5 -5
  64. package/dist/{install-RTEYH6TK.js → install-ECR7OLAY.js} +5 -5
  65. package/dist/{issues-5GE277R2.js → issues-K5TL2S4Z.js} +7 -7
  66. package/dist/{knobs-AMIWGYUZ.js → knobs-OKQFBQLK.js} +5 -5
  67. package/dist/{landing-3VLVVQL5.js → landing-XANIBPVM.js} +7 -7
  68. package/dist/{list-GDJR6UY6.js → list-64GX47Q4.js} +5 -5
  69. package/dist/{local-4R6GVW7U.js → local-QMQY2ZUX.js} +7 -7
  70. package/dist/{login-IXVAWTLO.js → login-I7UQ3GTM.js} +5 -5
  71. package/dist/{mcp-BM2MJWX4.js → mcp-XZV63DX5.js} +11 -11
  72. package/dist/{mcp-BM2MJWX4.js.map → mcp-XZV63DX5.js.map} +1 -1
  73. package/dist/{metrics-SSIP5CEB.js → metrics-KBTQ3KGZ.js} +5 -5
  74. package/dist/{monitor-ESZYHXT2.js → monitor-UGWY43IU.js} +5 -5
  75. package/dist/perf-CCHWHCSR.js +961 -0
  76. package/dist/perf-CCHWHCSR.js.map +1 -0
  77. package/dist/{product-VCGUV5TH.js → product-KLG2ZTHC.js} +5 -5
  78. package/dist/{product-map-AXKZNQDM.js → product-map-AMEZ76EQ.js} +5 -5
  79. package/dist/{prompts-FVPSON2N.js → prompts-ZVQNGL7X.js} +5 -5
  80. package/dist/proofs-QCNSQAPX.js +20 -0
  81. package/dist/{property-XEPCC7KQ.js → property-PJDQFHAL.js} +6 -6
  82. package/dist/{psql-JKF3OYYJ.js → psql-AURAN27C.js} +5 -5
  83. package/dist/{record-REQ37S54.js → record-SYWBTUOB.js} +6 -6
  84. package/dist/{redis-WGHT2GJB.js → redis-2H752SKO.js} +5 -5
  85. package/dist/{release-SNDIVIA6.js → release-OSIYUXSC.js} +5 -5
  86. package/dist/{runbook-XFJG2LFC.js → runbook-7LVHF6KV.js} +5 -5
  87. package/dist/{sandbox-DYCKLCMY.js → sandbox-TJQPMRGS.js} +18 -30
  88. package/dist/sandbox-TJQPMRGS.js.map +1 -0
  89. package/dist/{scenarios-PVHCKP55.js → scenarios-P2ABU4HK.js} +5 -5
  90. package/dist/{schedule-DGC7CX23.js → schedule-XLS56NP5.js} +8 -8
  91. package/dist/{session-ERGUFDDI.js → session-ACSFC3UB.js} +8 -8
  92. package/dist/{skill-6QO2E3TB.js → skill-F7I5P6AI.js} +43 -28
  93. package/dist/{skill-6QO2E3TB.js.map → skill-F7I5P6AI.js.map} +1 -1
  94. package/dist/{slack-WE7THLLH.js → slack-ZEK4GRND.js} +6 -6
  95. package/dist/{spec-SEOY7N3L.js → spec-XPIRRSV6.js} +5 -5
  96. package/dist/{src-CCK3TKBX.js → src-N7ZCYCXU.js} +4 -4
  97. package/dist/{src-AEWV5HYH.js → src-XSBBMVGW.js} +3 -3
  98. package/dist/{start-EPGLHTND.js → start-DKWLOQI6.js} +5 -5
  99. package/dist/{status-DTE2GXM2.js → status-K7KH5DI3.js} +5 -5
  100. package/dist/{tag-GIFEWGBL.js → tag-2Y3OMQQC.js} +6 -6
  101. package/dist/{task-VLJCHSFB.js → task-4PIOC4QV.js} +6 -6
  102. package/dist/{teams-J2OOJBL4.js → teams-KUM56BE2.js} +83 -47
  103. package/dist/teams-KUM56BE2.js.map +1 -0
  104. package/dist/{test-suite-CTACGIAZ.js → test-suite-SW25YGJV.js} +138 -96
  105. package/dist/test-suite-SW25YGJV.js.map +1 -0
  106. package/dist/{trace-RWQDYL4K.js → trace-QPXHYBLA.js} +7 -7
  107. package/dist/{triage-6UAXLCGU.js → triage-EZABRZZM.js} +6 -6
  108. package/dist/trigger-7C7KX5KH.js +137 -0
  109. package/dist/trigger-7C7KX5KH.js.map +1 -0
  110. package/dist/{update-check-QRREAM3N.js → update-check-E3X7UIY6.js} +3 -3
  111. package/dist/{upgrade-5Y655TQ6.js → upgrade-EJGTMW44.js} +4 -4
  112. package/dist/{usage-KCXFY46V.js → usage-GZCQDULF.js} +7 -7
  113. package/dist/{utilities-SUON2KZK.js → utilities-RIITD53A.js} +6 -6
  114. package/dist/{visual-GJZVJC32.js → visual-FH67OKS2.js} +5 -5
  115. package/dist/{workflow-R5QAXWBX.js → workflow-34YJZ2QQ.js} +38 -86
  116. package/dist/workflow-34YJZ2QQ.js.map +1 -0
  117. package/dist/{workflow-cache-PFBTWLGM.js → workflow-cache-YQ3BGJIG.js} +17 -17
  118. package/dist/{workflow-cache-convergence-resolve-UZGRPC3B.js → workflow-cache-convergence-resolve-SPLBRSNK.js} +5 -5
  119. package/dist/{workflow-debug-RACNWWOL.js → workflow-debug-HZB7TJGK.js} +10 -10
  120. package/dist/workflow-debug-HZB7TJGK.js.map +1 -0
  121. package/dist/{workflow-feedback-RJIQ5R3R.js → workflow-feedback-6UOTIWIQ.js} +5 -5
  122. package/dist/{workflow-fork-LINDCYJ3.js → workflow-fork-IDYHAHCX.js} +5 -5
  123. package/dist/workflow-promotion-U6WYFY5U.js +62 -0
  124. package/dist/workflow-promotion-U6WYFY5U.js.map +1 -0
  125. package/dist/{workflow-proposals-E4EXKAGM.js → workflow-proposals-MMVNIQT3.js} +5 -5
  126. package/dist/{workflow-revisions-5M6APN6R.js → workflow-revisions-BPUOLCZB.js} +5 -5
  127. package/dist/{workflow-status-7KL73WS2.js → workflow-status-RA3IEMEW.js} +5 -5
  128. package/package.json +3 -2
  129. package/dist/chat-target-IZ7YLLU3.js +0 -502
  130. package/dist/chat-target-IZ7YLLU3.js.map +0 -1
  131. package/dist/chunk-76Z6E7XX.js.map +0 -1
  132. package/dist/chunk-EUVB6Y3C.js.map +0 -1
  133. package/dist/chunk-LL6TSQWV.js.map +0 -1
  134. package/dist/chunk-QTYUM4ZB.js.map +0 -1
  135. package/dist/chunk-ROX7N3RK.js.map +0 -1
  136. package/dist/chunk-UEJ2HTKU.js.map +0 -1
  137. package/dist/proofs-TXJGAP5F.js.map +0 -1
  138. package/dist/sandbox-DYCKLCMY.js.map +0 -1
  139. package/dist/teams-J2OOJBL4.js.map +0 -1
  140. package/dist/test-suite-CTACGIAZ.js.map +0 -1
  141. package/dist/workflow-R5QAXWBX.js.map +0 -1
  142. /package/dist/{account-3ZG24MOE.js.map → account-MRZ54P5P.js.map} +0 -0
  143. /package/dist/{alert-5G7PTAX2.js.map → alert-XBHELHEI.js.map} +0 -0
  144. /package/dist/{api-catalog-IBYAFKKQ.js.map → api-catalog-GWYRX53L.js.map} +0 -0
  145. /package/dist/{api-key-UXC44BDR.js.map → api-key-FH6JN447.js.map} +0 -0
  146. /package/dist/{attachment-T6IRFQW3.js.map → attachment-J7GRVT5F.js.map} +0 -0
  147. /package/dist/{auth-SHOCJE6Z.js.map → auth-VZZQXRDR.js.map} +0 -0
  148. /package/dist/{benchmark-NJ2U6VTC.js.map → benchmark-A3SNDARF.js.map} +0 -0
  149. /package/dist/{blackcat-RQJVFGXQ.js.map → blackcat-UM6TBQBN.js.map} +0 -0
  150. /package/dist/{chunk-M752EUK3.js.map → chunk-3JU4UYYN.js.map} +0 -0
  151. /package/dist/{chunk-G6BCST3G.js.map → chunk-3ZOUNCA5.js.map} +0 -0
  152. /package/dist/{chunk-ABT3BLRC.js.map → chunk-5TKXHS3X.js.map} +0 -0
  153. /package/dist/{chunk-QCYSONXI.js.map → chunk-CRYHWO4M.js.map} +0 -0
  154. /package/dist/{chunk-I5RHTCPY.js.map → chunk-EL6KJ4PO.js.map} +0 -0
  155. /package/dist/{chunk-ZL4O6C42.js.map → chunk-HXBK3AGD.js.map} +0 -0
  156. /package/dist/{chunk-PRERH4DN.js.map → chunk-I2SOHQ2C.js.map} +0 -0
  157. /package/dist/{chunk-CYSPCGO6.js.map → chunk-JEHHEMUL.js.map} +0 -0
  158. /package/dist/{chunk-LIEADTEF.js.map → chunk-LJFVRJCA.js.map} +0 -0
  159. /package/dist/{chunk-PHNH3CEU.js.map → chunk-O4Z44BR7.js.map} +0 -0
  160. /package/dist/{chunk-QA37WVF6.js.map → chunk-OQFCZERZ.js.map} +0 -0
  161. /package/dist/{chunk-Z3MDQSZG.js.map → chunk-PJFFGQSB.js.map} +0 -0
  162. /package/dist/{chunk-IY3ZK46I.js.map → chunk-QOVJUSSL.js.map} +0 -0
  163. /package/dist/{chunk-RPJMQBB5.js.map → chunk-QXU4G4YN.js.map} +0 -0
  164. /package/dist/{chunk-SZSTJIYU.js.map → chunk-RRSUKARV.js.map} +0 -0
  165. /package/dist/{chunk-775FI436.js.map → chunk-RVD6J6IZ.js.map} +0 -0
  166. /package/dist/{chunk-5UUIBY6E.js.map → chunk-TAVBFLCR.js.map} +0 -0
  167. /package/dist/{chunk-3HI6QC4V.js.map → chunk-WRBU6TX7.js.map} +0 -0
  168. /package/dist/{chunk-BF3IPGMP.js.map → chunk-XSSZMG65.js.map} +0 -0
  169. /package/dist/{credential-TWSWV64F.js.map → credential-4RFRU6OH.js.map} +0 -0
  170. /package/dist/{credential-template-XO5D5AI3.js.map → credential-template-36PFUTBN.js.map} +0 -0
  171. /package/dist/{digest-SLEFOLPV.js.map → digest-THMKFMP7.js.map} +0 -0
  172. /package/dist/{docs-IDC4V4WQ.js.map → docs-ZGM53L67.js.map} +0 -0
  173. /package/dist/{doctor-SDAYEA6C.js.map → doctor-Z2XBGBM3.js.map} +0 -0
  174. /package/dist/{environment-VBUIBQ6O.js.map → environment-5YVZXBN7.js.map} +0 -0
  175. /package/dist/{exploration-IREIR5PO.js.map → exploration-GZ4WUJJH.js.map} +0 -0
  176. /package/dist/{exploratory-test-4Q7BMEFT.js.map → exploratory-test-Y7P4ZDLD.js.map} +0 -0
  177. /package/dist/{external-run-S7LULKPT.js.map → external-run-IJGGZOGI.js.map} +0 -0
  178. /package/dist/{feature-flag-IASHTUGU.js.map → feature-flag-UH6Z7774.js.map} +0 -0
  179. /package/dist/{flow-IBEZFZTU.js.map → flow-MRWAQYZZ.js.map} +0 -0
  180. /package/dist/{github-HAEZRULP.js.map → github-VDJU3PU3.js.map} +0 -0
  181. /package/dist/{init-LT2TZMQY.js.map → init-CROSTPA6.js.map} +0 -0
  182. /package/dist/{install-RTEYH6TK.js.map → install-ECR7OLAY.js.map} +0 -0
  183. /package/dist/{issues-5GE277R2.js.map → issues-K5TL2S4Z.js.map} +0 -0
  184. /package/dist/{knobs-AMIWGYUZ.js.map → knobs-OKQFBQLK.js.map} +0 -0
  185. /package/dist/{landing-3VLVVQL5.js.map → landing-XANIBPVM.js.map} +0 -0
  186. /package/dist/{list-GDJR6UY6.js.map → list-64GX47Q4.js.map} +0 -0
  187. /package/dist/{local-4R6GVW7U.js.map → local-QMQY2ZUX.js.map} +0 -0
  188. /package/dist/{login-IXVAWTLO.js.map → login-I7UQ3GTM.js.map} +0 -0
  189. /package/dist/{metrics-SSIP5CEB.js.map → metrics-KBTQ3KGZ.js.map} +0 -0
  190. /package/dist/{monitor-ESZYHXT2.js.map → monitor-UGWY43IU.js.map} +0 -0
  191. /package/dist/{product-VCGUV5TH.js.map → product-KLG2ZTHC.js.map} +0 -0
  192. /package/dist/{product-map-AXKZNQDM.js.map → product-map-AMEZ76EQ.js.map} +0 -0
  193. /package/dist/{prompts-FVPSON2N.js.map → prompts-ZVQNGL7X.js.map} +0 -0
  194. /package/dist/{src-AEWV5HYH.js.map → proofs-QCNSQAPX.js.map} +0 -0
  195. /package/dist/{property-XEPCC7KQ.js.map → property-PJDQFHAL.js.map} +0 -0
  196. /package/dist/{psql-JKF3OYYJ.js.map → psql-AURAN27C.js.map} +0 -0
  197. /package/dist/{record-REQ37S54.js.map → record-SYWBTUOB.js.map} +0 -0
  198. /package/dist/{redis-WGHT2GJB.js.map → redis-2H752SKO.js.map} +0 -0
  199. /package/dist/{release-SNDIVIA6.js.map → release-OSIYUXSC.js.map} +0 -0
  200. /package/dist/{runbook-XFJG2LFC.js.map → runbook-7LVHF6KV.js.map} +0 -0
  201. /package/dist/{scenarios-PVHCKP55.js.map → scenarios-P2ABU4HK.js.map} +0 -0
  202. /package/dist/{schedule-DGC7CX23.js.map → schedule-XLS56NP5.js.map} +0 -0
  203. /package/dist/{session-ERGUFDDI.js.map → session-ACSFC3UB.js.map} +0 -0
  204. /package/dist/{slack-WE7THLLH.js.map → slack-ZEK4GRND.js.map} +0 -0
  205. /package/dist/{spec-SEOY7N3L.js.map → spec-XPIRRSV6.js.map} +0 -0
  206. /package/dist/{src-CCK3TKBX.js.map → src-N7ZCYCXU.js.map} +0 -0
  207. /package/dist/{tag-GIFEWGBL.js.map → src-XSBBMVGW.js.map} +0 -0
  208. /package/dist/{start-EPGLHTND.js.map → start-DKWLOQI6.js.map} +0 -0
  209. /package/dist/{status-DTE2GXM2.js.map → status-K7KH5DI3.js.map} +0 -0
  210. /package/dist/{trace-RWQDYL4K.js.map → tag-2Y3OMQQC.js.map} +0 -0
  211. /package/dist/{task-VLJCHSFB.js.map → task-4PIOC4QV.js.map} +0 -0
  212. /package/dist/{triage-6UAXLCGU.js.map → trace-QPXHYBLA.js.map} +0 -0
  213. /package/dist/{update-check-QRREAM3N.js.map → triage-EZABRZZM.js.map} +0 -0
  214. /package/dist/{upgrade-5Y655TQ6.js.map → update-check-E3X7UIY6.js.map} +0 -0
  215. /package/dist/{utilities-SUON2KZK.js.map → upgrade-EJGTMW44.js.map} +0 -0
  216. /package/dist/{usage-KCXFY46V.js.map → usage-GZCQDULF.js.map} +0 -0
  217. /package/dist/{workflow-debug-RACNWWOL.js.map → utilities-RIITD53A.js.map} +0 -0
  218. /package/dist/{visual-GJZVJC32.js.map → visual-FH67OKS2.js.map} +0 -0
  219. /package/dist/{workflow-cache-PFBTWLGM.js.map → workflow-cache-YQ3BGJIG.js.map} +0 -0
  220. /package/dist/{workflow-cache-convergence-resolve-UZGRPC3B.js.map → workflow-cache-convergence-resolve-SPLBRSNK.js.map} +0 -0
  221. /package/dist/{workflow-feedback-RJIQ5R3R.js.map → workflow-feedback-6UOTIWIQ.js.map} +0 -0
  222. /package/dist/{workflow-fork-LINDCYJ3.js.map → workflow-fork-IDYHAHCX.js.map} +0 -0
  223. /package/dist/{workflow-proposals-E4EXKAGM.js.map → workflow-proposals-MMVNIQT3.js.map} +0 -0
  224. /package/dist/{workflow-revisions-5M6APN6R.js.map → workflow-revisions-BPUOLCZB.js.map} +0 -0
  225. /package/dist/{workflow-status-7KL73WS2.js.map → workflow-status-RA3IEMEW.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../mcp-tools/src/issue-evidence.ts","../../mcp-tools/src/issue-comments.ts","../../mcp-tools/src/context.ts","../../mcp-tools/src/api-client.ts","../../mcp-tools/src/tool-helpers.ts","../../mcp-tools/src/instructions.ts","../../mcp-tools/src/registry.ts","../../mcp-tools/src/teams-channels.ts","../../mcp-tools/src/annotations.ts","../../mcp-tools/src/api-tool.ts","../../mcp-tools/src/groups/workflows.ts","../../mcp-tools/src/groups/workflow-proposals.ts","../../mcp-tools/src/groups/workflow-runs.ts","../../mcp-tools/src/groups/test-suites.ts","../../mcp-tools/src/groups/credentials.ts","../../mcp-tools/src/groups/issues.ts","../../mcp-tools/src/groups/product-map.ts","../../mcp-tools/src/groups/workflow-lifecycle.ts","../../mcp-tools/src/groups/workflow-authoring.ts","../../mcp-tools/src/groups/test-suite-management.ts","../../mcp-tools/src/groups/issues-management.ts","../../mcp-tools/src/groups/tags.ts","../../mcp-tools/src/groups/content.ts","../../mcp-tools/src/groups/body.ts","../../mcp-tools/src/groups/applications.ts","../../mcp-tools/src/groups/personas.ts","../../mcp-tools/src/groups/product-map-edit.ts","../../mcp-tools/src/groups/api-catalog.ts","../../mcp-tools/src/groups/automation-rules.ts","../../mcp-tools/src/groups/schedules.ts","../../mcp-tools/src/groups/alerts.ts","../../mcp-tools/src/groups/releases.ts","../../mcp-tools/src/groups/runbooks.ts","../../mcp-tools/src/groups/exploration.ts","../../mcp-tools/src/groups/teams.ts","../../mcp-tools/src/groups/sandbox.ts","../../mcp-tools/src/groups/index.ts"],"sourcesContent":["/**\n * Issue evidence shared by `cofactor issues get|create|bump|update` and the\n * `cofactor_issues_*` MCP tools, so both read and write it the same way.\n *\n * Reading: an occurrence's `diagnosticJson.evidence` is the list the web app\n * renders as evidence cards. Evidence belongs to the occurrence that produced\n * it — a later sighting (`issues bump`) has its own, often empty, list — so it\n * is grouped by occurrence, newest first, across the occurrences the detail\n * route returns (its default page, the 10 newest). Media fields hold S3\n * storage keys; each becomes a signed link through the same `/screenshots/*`\n * redirect the web app's `<img>` tags use (it authorizes the key against the\n * caller's org and 302s to a presigned URL).\n *\n * Writing: a screenshot is uploaded to `POST /v2/issues/evidence-media` and\n * cited as the item's `frameStorageKey`. Edits address items by the 1-based\n * numbers the read side prints, and the API takes the occurrence's whole\n * list, so callers read the list, apply the edits here, and send the result.\n *\n * @module issue-evidence\n */\n\nimport type { FailureDiagnosticEvidence, IssueEvidenceKind } from '@chatsdet/types/issues';\n\n/* ── Reading ──────────────────────────────────────────────────────────── */\n\n/** The evidence fields that hold a storage key, by the name they get in `urls`. */\nexport const MEDIA_FIELDS = {\n frame: 'frameStorageKey',\n clip: 'clipStorageKey',\n beforeFrame: 'beforeFrameStorageKey',\n afterFrame: 'afterFrameStorageKey',\n} as const satisfies Record<string, keyof FailureDiagnosticEvidence>;\n\nexport type MediaName = keyof typeof MEDIA_FIELDS;\nexport const MEDIA_NAMES = Object.keys(MEDIA_FIELDS) as MediaName[];\n\nexport type EvidenceView = FailureDiagnosticEvidence & {\n /** 1-based position within its occurrence, as edits address it. */\n index: number;\n /** Signed links (about 1 hour) for each media key the item carries. */\n urls: Partial<Record<MediaName, string>>;\n /**\n * Why a media key could not be signed or saved. Manual filings could cite\n * any key before keys were checked against the org, and the redirect route\n * refuses another org's key (403), so one bad key reports here instead of\n * failing the whole read.\n */\n mediaErrors?: Partial<Record<MediaName, string>>;\n};\n\nexport type OccurrenceEvidence = {\n occurrenceId: string;\n detectedAt: string;\n items: EvidenceView[];\n};\n\ntype OccurrenceWithEvidence = {\n id: string;\n detectedAt: string;\n diagnosticJson: { evidence: FailureDiagnosticEvidence[] } | null;\n};\n\n/** Per-request bound for media calls, as `cofactor teams`'s manual-redirect call uses. */\nexport const MEDIA_TIMEOUT_MS = 30_000;\n\nexport const describeError = (err: unknown) => (err instanceof Error ? err.message : String(err));\n\n/** Resolve a storage key to its presigned URL via the org-authorized redirect route. */\nasync function signedUrl(\n apiUrl: string,\n token: string,\n key: string\n): Promise<{ url: string } | { error: string }> {\n let res: Response;\n try {\n res = await fetch(`${apiUrl}/screenshots/${encodeURIComponent(key)}`, {\n headers: { Authorization: `Bearer ${token}` },\n redirect: 'manual',\n signal: AbortSignal.timeout(MEDIA_TIMEOUT_MS),\n });\n } catch (err) {\n return { error: `could not sign ${key} (${describeError(err)})` };\n }\n const location = res.headers.get('location');\n return res.status === 302 && location\n ? { url: location }\n : { error: `could not sign ${key} (HTTP ${res.status})` };\n}\n\n/**\n * How many media links one read signs, and how many at once. The detail page\n * spans 10 occurrences of up to 50 items with up to 4 media keys each, so an\n * unbounded read could fire hundreds of redirect calls in a burst; links past\n * the cap are reported on their item instead.\n */\nconst MAX_SIGNED_MEDIA = 50;\nconst SIGN_CONCURRENCY = 6;\n\n/** Run `fn` over `items` with at most `limit` calls in flight, keeping order. */\nasync function mapWithConcurrency<T, R>(items: T[], limit: number, fn: (item: T) => Promise<R>): Promise<R[]> {\n const results = new Array<R>(items.length);\n let next = 0;\n const worker = async () => {\n while (next < items.length) {\n const i = next++;\n results[i] = await fn(items[i]!);\n }\n };\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));\n return results;\n}\n\n/** Number each occurrence's evidence items and attach signed links for their media keys. */\nexport async function resolveEvidence(\n apiUrl: string,\n token: string,\n occurrences: OccurrenceWithEvidence[]\n): Promise<OccurrenceEvidence[]> {\n const groups: OccurrenceEvidence[] = occurrences.flatMap((occ) =>\n occ.diagnosticJson && occ.diagnosticJson.evidence.length > 0\n ? [\n {\n occurrenceId: occ.id,\n detectedAt: occ.detectedAt,\n items: occ.diagnosticJson.evidence.map((item, i) => ({ index: i + 1, ...item, urls: {} })),\n },\n ]\n : []\n );\n const media = groups.flatMap((group) =>\n group.items.flatMap((view) =>\n MEDIA_NAMES.flatMap((name) => {\n const key = view[MEDIA_FIELDS[name]];\n return key ? [{ view, name, key }] : [];\n })\n )\n );\n const signed = await mapWithConcurrency(media.slice(0, MAX_SIGNED_MEDIA), SIGN_CONCURRENCY, ({ key }) =>\n signedUrl(apiUrl, token, key)\n );\n media.forEach(({ view, name }, i) => {\n const result = signed[i] ?? { error: `not signed: over the ${MAX_SIGNED_MEDIA} links signed per read` };\n if ('url' in result) view.urls[name] = result.url;\n else view.mediaErrors = { ...view.mediaErrors, [name]: result.error };\n });\n return groups;\n}\n\n/* ── Writing ──────────────────────────────────────────────────────────── */\n\n/**\n * Kinds an agent or person can add. `before_after` and `history_comparison`\n * are derived by the diagnostic pipeline from run videos and run history, so\n * they are not written by hand.\n */\nexport const WRITABLE_EVIDENCE_KINDS = [\n 'visual',\n 'timeline_event',\n 'network_error',\n 'console_error',\n 'agent_thought',\n 'code_reference',\n 'log_reference',\n] as const satisfies readonly IssueEvidenceKind[];\n\nexport type WritableKind = (typeof WRITABLE_EVIDENCE_KINDS)[number];\n\n/** The kind, or an error naming the kinds that may be written. */\nexport function writableKind(kind: string): WritableKind {\n const type = WRITABLE_EVIDENCE_KINDS.find((candidate) => candidate === kind.trim());\n if (!type) {\n throw new Error(\n `evidence kind \"${kind}\" is not one you can add. Use one of: ${WRITABLE_EVIDENCE_KINDS.join(', ')}.`\n );\n }\n return type;\n}\n\n/** Image types an evidence screenshot may be (the upload route accepts the same). */\nexport const EVIDENCE_IMAGE_TYPES = {\n 'image/png': '.png',\n 'image/jpeg': '.jpg',\n 'image/webp': '.webp',\n 'image/gif': '.gif',\n} as const;\n\nexport type EvidenceImageType = keyof typeof EVIDENCE_IMAGE_TYPES;\n\n/** Upload a screenshot; returns the storage key to cite as `frameStorageKey`. */\nexport async function uploadEvidenceImage(\n apiUrl: string,\n token: string,\n image: { bytes: Uint8Array<ArrayBuffer>; type: EvidenceImageType; filename: string }\n): Promise<string> {\n const form = new FormData();\n form.append('file', new Blob([image.bytes], { type: image.type }), image.filename);\n const res = await fetch(`${apiUrl}/v2/issues/evidence-media`, {\n method: 'POST',\n headers: { Authorization: `Bearer ${token}` },\n body: form,\n });\n const body = (await res.json().catch(() => null)) as\n | { ok: boolean; error?: string; data?: { storageKey: string } }\n | null;\n if (!res.ok || !body?.ok || !body.data) {\n throw new Error(`could not upload screenshot ${image.filename}: ${body?.error ?? `HTTP ${res.status}`}`);\n }\n return body.data.storageKey;\n}\n\n/** Evidence edits by the numbers the read side prints. */\nexport type EvidenceEdits = {\n replace: Map<number, FailureDiagnosticEvidence>;\n remove: Set<number>;\n add: FailureDiagnosticEvidence[];\n};\n\n/**\n * Check every replace / remove number (as given: a flag value or a tool\n * argument) against an occurrence with `count` items, before anything is\n * uploaded or written; returns them as numbers.\n */\nexport function checkEvidenceNumbers(\n count: number,\n replace: unknown[],\n remove: unknown[]\n): { replace: number[]; remove: number[] } {\n const seen = new Set<number>();\n const check = (raw: unknown) => {\n const n = typeof raw === 'number' ? raw : /^\\d+$/.test(String(raw)) ? Number(raw) : NaN;\n if (!Number.isInteger(n) || n < 1 || n > count) {\n throw new Error(\n `${String(raw)} is not an evidence number on this occurrence (it has ${count}; see the issue's evidence list).`\n );\n }\n if (seen.has(n)) throw new Error(`evidence ${n} is edited more than once.`);\n seen.add(n);\n return n;\n };\n const removed = remove.map(check);\n return { replace: replace.map(check), remove: removed };\n}\n\n/**\n * Apply replace / remove / add to the current list. Every number refers to the\n * list as the read side printed it, so replacements and removals resolve\n * against the original positions and additions go at the end.\n */\nexport function editEvidence(\n current: FailureDiagnosticEvidence[],\n edits: EvidenceEdits\n): FailureDiagnosticEvidence[] {\n const kept = current\n .map((item, i) => edits.replace.get(i + 1) ?? item)\n .filter((_, i) => !edits.remove.has(i + 1));\n return [...kept, ...edits.add];\n}\n","/**\n * Issue comments, shared by `cofactor issues get|comment` and the MCP issue\n * tools. Both go through `GET|POST /v2/issues/:issueId/comments`, so the API's\n * org scoping and the 4000-character limit apply unchanged.\n *\n * @module\n */\n\nimport type { IssueComment, PaginatedIssueCommentsResponse } from '@chatsdet/types/issues';\n\n/** The comments route's largest page; `get` shows the newest this many. */\nconst ISSUE_COMMENTS_PAGE_SIZE = 200;\n\n/** A comment as `get` shows it: no org or property ids. */\ntype IssueCommentView = Pick<IssueComment, 'id' | 'body' | 'createdAt'> & {\n author: string | null;\n};\n\nexport type IssueCommentsView = {\n /** Newest first, as the API orders them. */\n comments: IssueCommentView[];\n /** All comments on the issue, which can exceed `comments`. */\n total: number;\n};\n\n/** `GET /v2/issues/:issueId/comments` as the API returns it. */\nexport type IssueCommentsEnvelope = { ok: boolean; error?: string } & PaginatedIssueCommentsResponse;\n\nexport function issueCommentsPath(issueId: string): string {\n return `/v2/issues/${issueId}/comments?pageSize=${ISSUE_COMMENTS_PAGE_SIZE}`;\n}\n\nexport function toCommentsView(page: PaginatedIssueCommentsResponse): IssueCommentsView {\n return {\n comments: page.data.map((comment) => ({\n id: comment.id,\n author: comment.author?.displayName ?? comment.author?.primaryEmail ?? null,\n body: comment.body,\n createdAt: comment.createdAt,\n })),\n total: page.pagination.totalItems,\n };\n}\n","import { AsyncLocalStorage } from 'node:async_hooks';\n\n/**\n * Per-request context for MCP tool handlers. Threaded via AsyncLocalStorage so\n * handler bodies don't have to take ctx as a parameter — `mcpApiRequest()`\n * pulls it from `currentToolCtx()`.\n */\nexport type ToolCtx = {\n apiUrl: string;\n apiToken: string;\n};\n\nconst storage = new AsyncLocalStorage<ToolCtx>();\n\nexport function withToolCtx<T>(ctx: ToolCtx, fn: () => Promise<T>): Promise<T> {\n return storage.run(ctx, fn);\n}\n\nexport function currentToolCtx(): ToolCtx | undefined {\n return storage.getStore();\n}\n","import { currentToolCtx } from './context';\n\nconst DEFAULT_TIMEOUT_MS = 30_000;\nconst MAX_ERROR_TEXT = 2000;\n\n/**\n * Authenticated API request. Pulls `{ apiUrl, apiToken }` from the\n * AsyncLocalStorage-backed ToolCtx — every tool handler runs inside a\n * `withToolCtx()` frame set up by the registry dispatcher.\n *\n * Throws on non-2xx with a prefixed message MCP clients can pattern-match\n * (`[unauthorized]`, `[timeout]`, `[http-N]`).\n */\nexport async function mcpApiRequest<T>(\n method: string,\n path: string,\n body?: Record<string, unknown>,\n timeoutMs = DEFAULT_TIMEOUT_MS\n): Promise<T> {\n const ctx = currentToolCtx();\n if (!ctx) {\n throw new Error('[no-context] mcpApiRequest called outside of withToolCtx()');\n }\n\n const url = `${ctx.apiUrl}${path}`;\n let res: Response;\n try {\n res = await fetch(url, {\n method,\n headers: {\n Authorization: `Bearer ${ctx.apiToken}`,\n 'Content-Type': 'application/json',\n },\n signal: AbortSignal.timeout(timeoutMs),\n ...(body ? { body: JSON.stringify(body) } : {}),\n });\n } catch (err) {\n if (err instanceof Error && err.name === 'TimeoutError') {\n throw new Error(`[timeout] upstream API did not respond within ${timeoutMs}ms`);\n }\n throw new Error(`[network] ${err instanceof Error ? err.message : String(err)}`);\n }\n\n if (!res.ok) {\n if (res.status === 401) {\n throw new Error('[unauthorized] Your session may have expired.');\n }\n const text = await res.text().catch(() => '');\n const shown = text.length > MAX_ERROR_TEXT ? `${text.slice(0, MAX_ERROR_TEXT)}…` : text;\n throw new Error(`[http-${res.status}] ${shown || res.statusText}`);\n }\n\n return (await res.json()) as T;\n}\n","export function toolText(text: string) {\n return { content: [{ type: 'text' as const, text }] };\n}\n\nexport function toolJson(data: unknown) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }] };\n}\n","/**\n * Server instructions shared by the hosted and stdio MCP servers.\n *\n * Claude Code defers MCP tools: at session start it loads only tool names and\n * these instructions, then searches tool descriptions on demand. So this text\n * is what tells the model that Cofactor exists and when to look for its tools.\n * Clients cap it (4,096 chars; 2,048 before Claude Code 2.1.296), so the\n * routing comes first and the whole string is length-tested.\n *\n * @module\n */\n\n/**\n * One entry per `cofactor_<family>_*` tool prefix. `apps/mcp/test/tools.test.ts` fails when a\n * tool's family is missing here, so the instructions cannot drift from the tools.\n */\nexport const TOOL_FAMILIES = [\n ['workflow', 'tests (workflows): author, run, approve, promote, pause, archive, revisions, cache'],\n ['test_suite', 'suites and suite runs, failure diagnostics and steps'],\n ['external_run', 'runs from CI or external callers: get, rerun, cancel, diagnosis'],\n ['triage', 'failure triage for a run'],\n ['issues', 'issues found by tests: list, get (with evidence and comments), create, bump, update, comment, merge, close'],\n ['product_map', 'product map: areas, capabilities, rules, coverage, CAP-/ARE- codes'],\n ['application', 'applications, their repos and settings'],\n ['environment', 'application environments'],\n ['credential', 'test credentials (secrets never returned)'],\n ['persona', 'personas and their variables'],\n ['api_catalog', 'API catalog sources and endpoints'],\n ['schedule', 'scheduled suite runs'],\n ['alert', 'alerts: manage, fire now, their runs'],\n ['monitor', 'monitors'],\n ['runbook', 'runbooks and their runs'],\n ['release', 'release QA: trigger, status, latest deploy'],\n ['exploration', 'exploratory testing runs and cycles'],\n ['tag', 'tags on issues, workflows, attachments'],\n ['attachment', 'attachments'],\n ['prompts', 'saved prompts'],\n ['utilities', 'gists, hosted objects, email/Slack to members'],\n ['digest', 'digests'],\n ['sandbox', 'set up an application\\'s sandboxes, claim one, run commands in it, sandbox secrets'],\n ['teams', 'Microsoft Teams integration status'],\n ['orgs', 'organizations and members'],\n] as const;\n\nconst FAMILY_LINES = TOOL_FAMILIES.map(([family, what]) => `- cofactor_${family}_*: ${what}`).join('\\n');\n\nexport const COFACTOR_MCP_INSTRUCTIONS = `Cofactor is an AI QA platform. It runs browser tests (\"workflows\") against a customer's web apps, groups them into suites, turns failures into issues, and maps product behavior to coverage. Use these tools whenever the user mentions Cofactor, their tests, test runs, suites, flaky or failing tests, issues, the product map, or a release check. Every tool acts on the signed-in organization and is named cofactor_<resource>_<verb>.\n\nTool families (search for the family, then the verb):\n${FAMILY_LINES}\n\nHow to work:\n- Start with list/get tools to find ids (UUIDs, or prefixed ids like parea_/pcap_), then act. Never invent an id.\n- Any tool with a confirm parameter (deletes, archives, approvals, outbound URLs or destinations, replacing sets, and anything that sends messages, runs commands, or hits a customer system) needs confirm=true, passed only after the user has said yes to that exact action in this conversation, never on your own. Approval means a human verified the test checks the right thing; ask first.\n- Writes change real data. Prefer proposals (cofactor_workflow_proposals_*, or sync with propose=true) over overwriting a test, and fork before large edits.\n- Results are JSON. When a call returns ok: false, report the error to the user instead of retrying blindly; some tools need an organization feature that may not be enabled.\n- Not available here: agent tasks, knobs and feature flags. Tell the user to use the cofactor CLI for those.`;\n","import type { ToolCallResult, ToolDefinition, ToolGroup } from './types';\nimport { type ToolCtx, withToolCtx } from './context';\nimport { toolText } from './tool-helpers';\n\nexport type Registry = {\n list(): ToolDefinition[];\n call(tool: string, args: Record<string, unknown>, ctx: ToolCtx): Promise<ToolCallResult>;\n};\n\n/**\n * Claude Code shows a permission prompt on every call to a tool carrying this\n * hint, even in bypass mode. A tool that takes `confirm` is one the user must\n * approve, and a model can pass `confirm: true` on its own, so the prompt is\n * the real gate and `confirm` stays for clients that ignore the hint. This\n * includes cofactor_workflow_patch, whose optional `confirm` is the route to\n * approval, so every patch prompts. The key is from Claude Code's docs and has\n * not been observed in a live client yet.\n */\nconst REQUIRES_USER_INTERACTION = { 'anthropic/requiresUserInteraction': true };\n\nfunction withApprovalHint(tool: ToolDefinition): ToolDefinition {\n return 'confirm' in (tool.inputSchema.properties ?? {})\n ? { ...tool, _meta: REQUIRES_USER_INTERACTION }\n : tool;\n}\n\n/**\n * Bundle a set of ToolGroups into a Registry. The Registry runs each tool call\n * inside an `AsyncLocalStorage` frame so handler bodies can call\n * `mcpApiRequest()` without taking ctx as a parameter.\n */\nexport function buildRegistry(groups: ToolGroup[]): Registry {\n return {\n list() {\n return groups.flatMap((g) => g.definitions()).map(withApprovalHint);\n },\n\n async call(tool, args, ctx) {\n return withToolCtx(ctx, async () => {\n for (const group of groups) {\n const result = await group.handle(tool, args);\n if (result) return result;\n }\n return toolText(`Unknown tool: ${tool}`);\n });\n },\n };\n}\n","/**\n * Microsoft Teams channel resolution shared by the CLI (`--teams` on alerts and\n * area settings) and the MCP alert tools: name → reference against the channels\n * the Cofactor app is installed in (`GET /integrations/teams/channels`).\n *\n * @module teams-channels\n */\n\nexport interface TeamsChannel {\n channelRef: string;\n name: string;\n parentName?: string;\n}\n\n/** The fields of `GET /integrations/teams/connection` that say why no channel is available. */\nexport interface TeamsAvailability {\n isFlagEnabled: boolean;\n isBound: boolean;\n}\n\n/**\n * Why an organization has no Teams channel to send to, when\n * `GET /integrations/teams/channels` came back empty.\n */\nexport function teamsUnavailableMessage(connection: TeamsAvailability): string {\n if (!connection.isFlagEnabled) {\n return \"Microsoft Teams isn't enabled for this organization (the chat.teams feature is off), so there is no Teams channel to send to.\";\n }\n if (!connection.isBound) {\n return \"Microsoft Teams isn't connected. Run `cofactor teams install`, add the Cofactor app to a channel, then retry.\";\n }\n return \"The Cofactor app isn't in any Teams channel yet. Add it to a channel in Teams, then retry.\";\n}\n\n/**\n * Resolve Teams channel values to references, the one path the CLI and the MCP\n * alert tools share. Loads the installed channels; when there are none, loads\n * the connection to say why ({@link teamsUnavailableMessage}).\n */\nexport async function resolveTeamsChannelRefs(\n values: string[],\n load: { channels(): Promise<TeamsChannel[]>; availability(): Promise<TeamsAvailability> }\n): Promise<{ ok: true; channelRefs: string[] } | { ok: false; error: string }> {\n if (values.length === 0) return { ok: true, channelRefs: [] };\n const channels = await load.channels();\n if (channels.length === 0) return { ok: false, error: teamsUnavailableMessage(await load.availability()) };\n const channelRefs: string[] = [];\n for (const value of values) {\n const resolved = resolveTeamsChannel(value, channels);\n if (!resolved.ok) return resolved;\n channelRefs.push(resolved.channelRef);\n }\n return { ok: true, channelRefs };\n}\n\n/**\n * Resolve a Teams channel value against the channels the Cofactor Teams app is\n * installed in (`cofactor teams channels`, MCP `cofactor_teams_channels`): an installed channel\n * reference passes through; otherwise the value is a channel name\n * (case-insensitive) or `Team/Channel` when the name alone is ambiguous.\n * An empty list is explained by {@link resolveTeamsChannelRefs}.\n */\nexport function resolveTeamsChannel(\n value: string,\n channels: TeamsChannel[]\n): { ok: true; channelRef: string } | { ok: false; error: string } {\n if (channels.some((c) => c.channelRef === value)) return { ok: true, channelRef: value };\n\n const wanted = value.toLowerCase();\n const qualified = (c: TeamsChannel) => (c.parentName ? `${c.parentName}/${c.name}` : c.name);\n const matches = channels.filter(\n (c) => c.name.toLowerCase() === wanted || qualified(c).toLowerCase() === wanted\n );\n if (matches.length === 1) return { ok: true, channelRef: matches[0]!.channelRef };\n if (matches.length > 1) {\n return {\n ok: false,\n error: `Teams channel \"${value}\" matches more than one channel: ${matches.map(qualified).join(', ')}. Pass Team/Channel or the reference from \"cofactor teams channels\".`,\n };\n }\n return {\n ok: false,\n error: `Teams channel \"${value}\" not found. Pass a name or reference from \"cofactor teams channels\" (the Cofactor app must be added to the channel).`,\n };\n}\n","/**\n * Tool metadata shared by every MCP tool: a human-readable title plus the four\n * MCP behavior hints clients use to decide what needs confirmation.\n *\n * Every tool talks only to the Cofactor API (`openWorldHint: false`). Pick the\n * helper that matches what the handler does:\n *\n * - `readOnly` — never changes anything.\n * - `additive` — creates or triggers something without altering existing data.\n * - `modifying` — updates, replaces, or discards existing data.\n *\n * `idempotent` is true when repeating the exact same call leaves the same state.\n */\n\nexport type ToolAnnotations = {\n readOnlyHint: boolean;\n destructiveHint: boolean;\n idempotentHint: boolean;\n openWorldHint: boolean;\n};\n\nexport type ToolMeta = { title: string; annotations: ToolAnnotations };\n\nexport function readOnly(title: string): ToolMeta {\n return {\n title,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n };\n}\n\nexport function additive(title: string, idempotent: boolean): ToolMeta {\n return {\n title,\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: idempotent,\n openWorldHint: false,\n },\n };\n}\n\nexport function modifying(title: string, idempotent: boolean): ToolMeta {\n return {\n title,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: idempotent,\n openWorldHint: false,\n },\n };\n}\n","/**\n * Declarative MCP tools that are each one authenticated Cofactor API call.\n *\n * A tool is its definition (name, title/annotations, description, input schema)\n * plus `request(args)`, which says which API call the arguments map to. The\n * group's handler runs that call and returns the API's JSON unchanged, so most\n * tools need no handler code. `request` may be async when building the call\n * needs a lookup first (e.g. resolving a channel name to its reference).\n */\n\nimport { mcpApiRequest } from './api-client';\nimport { toolJson } from './tool-helpers';\nimport type { ToolDefinition, ToolGroup } from './types';\n\nexport type ApiRequest = {\n method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n path: string;\n body?: Record<string, unknown>;\n /** Overrides the default API call timeout, for calls that wait on a customer system. */\n timeoutMs?: number;\n};\n\nexport type ApiTool = ToolDefinition & {\n /** Maps the tool arguments to the API call. Throw (or reject) to refuse the arguments. */\n request(args: Record<string, unknown>): ApiRequest | Promise<ApiRequest>;\n /** Narrows a successful API response before it reaches the model; omit to return it unchanged. */\n narrow?(result: unknown): unknown;\n};\n\nexport function apiToolGroup(id: string, tools: ApiTool[]): ToolGroup {\n return {\n id,\n definitions: () => tools.map(({ request: _request, narrow: _narrow, ...definition }) => definition),\n async handle(tool, args) {\n const entry = tools.find((t) => t.name === tool);\n if (!entry) return null;\n try {\n const { method, path, body, timeoutMs } = await entry.request(args);\n const result = await mcpApiRequest<unknown>(method, path, body, timeoutMs);\n return toolJson(entry.narrow ? entry.narrow(result) : result);\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n },\n };\n}\n\n/** A required, non-empty string argument, returned as-is (for request bodies). */\nexport function requireString(value: unknown, name: string): string {\n if (typeof value !== 'string' || value.length === 0) {\n throw new Error(`${name} is required`);\n }\n return value;\n}\n\n/**\n * One URL path segment from a tool argument; refuses values that could change\n * the route. `encodeURIComponent` leaves \".\" and \"..\" untouched and `fetch`\n * collapses them, so `/a/../b` would silently become `/b`.\n */\nexport function pathSeg(value: unknown, name: string): string {\n const segment = requireString(value, name);\n if (segment === '.' || segment === '..') throw new Error(`${name} is not a valid id`);\n return encodeURIComponent(segment);\n}\n\n/** A positive-integer path segment (revision numbers and the like). */\nexport function pathInt(value: unknown, name: string): string {\n if (!Number.isInteger(value) || (value as number) < 1) {\n throw new Error(`${name} must be a positive integer`);\n }\n return String(value);\n}\n\n/** Appends the defined, non-empty params to `path` as a query string. */\nexport function withQuery(path: string, params: Record<string, unknown>): string {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null && value !== '') query.set(key, String(value));\n }\n const qs = query.toString();\n return qs ? `${path}?${qs}` : path;\n}\n\n/** Input-schema property for destructive tools: the caller must pass `confirm: true`. */\nexport const CONFIRM_PROPERTY = {\n type: 'boolean',\n description:\n 'Must be true to proceed. Set it only after the user has explicitly approved this action.',\n} as const;\n\n/** The CLI asks for `--yes`; the MCP equivalent is an explicit `confirm: true`. */\nexport function requireConfirm(args: Record<string, unknown>, action: string): void {\n if (args.confirm !== true) {\n throw new Error(\n `Refusing to ${action} without confirm: true. Ask the user to approve it, then call again with confirm=true.`\n );\n }\n}\n","/**\n * MCP tools for workflow management.\n *\n * Mirrors `cofactor workflow list` and `cofactor workflow get`.\n *\n * @module\n */\n\nimport { WORKFLOW_FLOW_TYPES } from '@chatsdet/types';\nimport { mcpApiRequest } from '../api-client';\nimport { toolJson } from '../tool-helpers';\nimport { additive, modifying, readOnly } from '../annotations';\nimport { CONFIRM_PROPERTY, pathSeg, requireConfirm } from '../api-tool';\n\nexport function getWorkflowToolDefinitions() {\n return [\n {\n name: 'cofactor_workflow_list',\n ...readOnly('List workflows'),\n description:\n 'List workflows in the current organization. Supports filtering by name, type, and status with pagination.',\n inputSchema: {\n type: 'object',\n properties: {\n search: {\n type: 'string',\n description: 'Search workflows by name',\n },\n flowType: {\n type: 'string',\n enum: [...WORKFLOW_FLOW_TYPES],\n description: 'Filter by flow type',\n },\n status: {\n type: 'string',\n enum: ['draft', 'approved'],\n description:\n \"Filter by approval status. 'draft' = not yet approved; 'approved' = a human verified the test checks the right thing. Suite inclusion is the separate `promotion` axis (promoted/paused, managed via `cofactor workflow promote|pause`), and reliability (passing/flaky/degraded) is the separate `health` dimension.\",\n },\n page: {\n type: 'number',\n description: 'Page number (default: 1)',\n },\n pageSize: {\n type: 'number',\n description: 'Page size (default: 25)',\n },\n },\n },\n },\n {\n name: 'cofactor_workflow_get',\n ...readOnly('Get a workflow'),\n description:\n 'Get a workflow definition with its steps, nodes, and configuration details.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID',\n },\n },\n required: ['workflowId'],\n },\n },\n {\n name: 'cofactor_workflow_patch',\n ...modifying('Update a workflow', true),\n description:\n 'Update workflow properties using merge-patch. Only provided fields are updated; omitted fields are left unchanged.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID',\n },\n name: {\n type: 'string',\n description: 'New workflow name',\n },\n description: {\n type: 'string',\n description:\n 'New description: the spirit of the test in one or two plain sentences. No capability codes, preconditions, issue ids, status, step narration or raw IDs.',\n },\n preflight: {\n type: 'string',\n description:\n 'New preflight notes: what the test depends on (pre-existing data it reads, flags, third-party systems). A short markdown bullet list; name things, never raw IDs. An empty string clears them.',\n },\n cleanup: {\n type: 'string',\n description: \"New cleanup notes: how the test's side effects get reset. A short markdown bullet list; name things, never raw IDs. An empty string clears them.\",\n },\n status: {\n type: 'string',\n enum: ['draft', 'approved'],\n description:\n \"New approval status. 'approved' asserts a HUMAN verified this test checks the right thing — only set it when the user has personally confirmed. Approval does NOT put the test into suites; suite inclusion is the separate promote/pause axis (use `cofactor workflow promote|pause`). Reliability is tracked automatically by the `health` dimension.\",\n },\n flowType: {\n type: 'string',\n enum: [...WORKFLOW_FLOW_TYPES],\n description: 'New flow type',\n },\n confirm: {\n ...CONFIRM_PROPERTY,\n description: `${CONFIRM_PROPERTY.description} Required when setting status; the same gate as cofactor_workflow_approve.`,\n },\n },\n required: ['workflowId'],\n },\n },\n {\n name: 'cofactor_workflow_run',\n ...additive('Run a workflow', false),\n description:\n 'Trigger a workflow execution. Returns the run ID for tracking status via cofactor_workflow_runs_get.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID to execute',\n },\n },\n required: ['workflowId'],\n },\n },\n {\n name: 'cofactor_workflow_sync',\n ...modifying('Replace the nodes and edges of a workflow', true),\n description:\n 'Atomically replace all nodes and edges in a workflow. Automatically creates a draft snapshot of the current state before overwriting so changes can be reverted. Use cofactor_workflow_get to read the current DAG first, modify nodes/edges, then sync back. When using propose=true on an existing workflow, REUSE each existing node\\'s `id` for steps you keep (omit `id` only for genuinely new steps). Without ID reuse the proposal will diff as a full rewrite — every step shown as Removed+Added in the review UI even when only configs changed.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID',\n },\n nodes: {\n type: 'array',\n description: 'Array of node objects with id, nodeType, orderIndex, configJson',\n items: { type: 'object' },\n },\n edges: {\n type: 'array',\n description: 'Array of edge objects with id, sourceNodeId, targetNodeId, edgeType',\n items: { type: 'object' },\n },\n createSnapshot: {\n type: 'boolean',\n description: 'Create a draft snapshot before syncing (default: true)',\n default: true,\n },\n propose: {\n type: 'boolean',\n description: 'Create a proposal instead of applying directly. The proposal can be reviewed and accepted/rejected via the UI. IMPORTANT: when proposing on an existing workflow, reuse each existing node\\'s `id` for steps you intend to keep — only omit `id` for genuinely new steps. Otherwise the diff will show every step as Removed+Added.',\n default: false,\n },\n proposalTitle: {\n type: 'string',\n description: 'Title for the proposal (used with propose: true)',\n },\n proposalDescription: {\n type: 'string',\n description: 'Description/rationale for the proposal (used with propose: true)',\n },\n },\n required: ['workflowId', 'nodes', 'edges'],\n },\n },\n ];\n}\n\nexport async function handleWorkflowTool(\n tool: string,\n args: Record<string, unknown>\n) {\n if (tool === 'cofactor_workflow_list') {\n try {\n const params = new URLSearchParams();\n if (args.search) params.set('search', String(args.search));\n if (args.flowType) params.set('flowType', String(args.flowType));\n if (args.status) params.set('status', String(args.status));\n if (args.page) params.set('page', String(args.page));\n if (args.pageSize) params.set('pageSize', String(args.pageSize));\n\n const qs = params.toString();\n const path = `/workflows${qs ? `?${qs}` : ''}`;\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: unknown[];\n pagination: unknown;\n }>('GET', path);\n\n if (!result.ok) {\n return toolJson({ ok: false, error: result.error ?? 'Unknown error' });\n }\n\n return toolJson({ ok: true, data: result.data, pagination: result.pagination });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_workflow_get') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const result = await mcpApiRequest<{\n ok?: boolean;\n error?: string;\n workflow?: unknown;\n targetOrgId?: string;\n targetOrgName?: string;\n }>('GET', `/workflows/${workflowId}`);\n\n if (result.error) {\n return toolJson({ ok: false, error: result.error });\n }\n\n return toolJson({ ok: true, workflow: result.workflow });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_workflow_patch') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n if (args.status !== undefined) {\n // Approval asserts a human verified the test; setting it here must clear the same gate as cofactor_workflow_approve.\n if (args.status !== 'draft' && args.status !== 'approved') {\n throw new Error(\"status must be 'draft' or 'approved'\");\n }\n requireConfirm(args, 'change the approval status of this workflow');\n }\n const body: Record<string, unknown> = {};\n if (args.name) body.name = String(args.name);\n if (args.description) body.description = String(args.description);\n // An empty string (or null) clears the notes, like `workflow patch --preflight \"\"`.\n if (args.preflight !== undefined) body.preflight = typeof args.preflight === 'string' && args.preflight !== '' ? args.preflight : null;\n if (args.cleanup !== undefined) body.cleanup = typeof args.cleanup === 'string' && args.cleanup !== '' ? args.cleanup : null;\n if (args.status) body.status = String(args.status);\n if (args.flowType) body.flowType = String(args.flowType);\n\n const result = await mcpApiRequest<{\n ok?: boolean;\n error?: string;\n workflow?: unknown;\n }>('PUT', `/workflows/${workflowId}`, body);\n\n if (result.error) {\n return toolJson({ ok: false, error: result.error });\n }\n\n return toolJson({ ok: true, workflow: result.workflow });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_workflow_run') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n\n const result = await mcpApiRequest<{\n ok?: boolean;\n error?: string;\n runId?: string;\n streamId?: string;\n }>('POST', `/workflows/${workflowId}/execute`);\n\n if (result.error) {\n return toolJson({ ok: false, error: result.error });\n }\n\n return toolJson({ ok: true, runId: result.runId, streamId: result.streamId });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_workflow_sync') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const nodes = args.nodes as unknown[];\n const edges = args.edges as unknown[];\n\n // --propose: create a proposal instead of applying directly\n if (args.propose) {\n const title = (args.proposalTitle as string) ?? `Sync proposal (${nodes.length} nodes)`;\n const description = (args.proposalDescription as string) ?? null;\n\n const result = await mcpApiRequest<{\n ok?: boolean;\n error?: string;\n data?: { id: string; title: string; status: string };\n }>('POST', `/workflows/${workflowId}/proposals`, {\n title,\n description,\n snapshotJson: { nodes, edges },\n source: 'api',\n });\n\n if (result.error) {\n return toolJson({ ok: false, error: result.error });\n }\n\n return toolJson({\n ok: true,\n proposalId: result.data?.id,\n title: result.data?.title,\n status: result.data?.status,\n });\n }\n\n const createSnapshot = args.createSnapshot !== false;\n\n const result = await mcpApiRequest<{\n ok?: boolean;\n error?: string;\n snapshotVersion?: string;\n }>('PUT', `/workflows/${workflowId}/draft-state`, {\n nodes,\n edges,\n createSnapshot,\n });\n\n if (result.error) {\n return toolJson({ ok: false, error: result.error });\n }\n\n return toolJson({\n ok: true,\n ...(result.snapshotVersion ? { snapshotVersion: result.snapshotVersion } : {}),\n });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n return null;\n}\n","/**\n * MCP tools for workflow proposals: list / get / diff / accept / reject /\n * revert. Mirrors `cofactor workflow proposals <verb>` with the same JSON\n * output shape so agents get identical responses whether they shell-out or\n * call MCP directly.\n *\n * @module\n */\n\nimport {\n diffSnapshots,\n fromApiSnapshot,\n type SnapshotDiff,\n} from '@chatsdet/workflow-diff';\nimport { mcpApiRequest } from '../api-client';\nimport { toolJson } from '../tool-helpers';\nimport { modifying, readOnly } from '../annotations';\nimport { pathSeg } from '../api-tool';\n\n// Types duplicated here to avoid the MCP server importing from the CLI's\n// `workflow-proposals.ts` which would pull in TTY-detection + process.exit\n// paths that don't belong in MCP land.\ninterface ProposalSummary {\n id: string;\n workflowId: string;\n title: string;\n description: string | null;\n source: string;\n status: string;\n createdByUserId: string | null;\n decidedByUserId: string | null;\n decidedAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface ProposalDetail extends ProposalSummary {\n snapshotJson: {\n nodes?: Array<{ id: string; nodeType: string; orderIndex?: number; configJson?: Record<string, unknown> }>;\n edges?: Array<{ id: string; sourceNodeId: string; targetNodeId: string; edgeType?: string | null }>;\n };\n sourceMetadata: Record<string, unknown> | null;\n}\n\ninterface WorkflowDetail {\n id: string;\n nodes: Array<{ id: string; nodeType: string; orderIndex?: number; configJson?: Record<string, unknown> }>;\n edges: Array<{ id: string; sourceNodeId: string; targetNodeId: string; edgeType?: string | null }>;\n}\n\nexport function getWorkflowProposalsToolDefinitions() {\n return [\n {\n name: 'cofactor_workflow_proposals_list',\n ...readOnly('List workflow proposals'),\n description:\n 'List workflow proposals. By default returns pending proposals; pass status=\"all\" for every status.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: { type: 'string', description: 'Workflow UUID' },\n status: {\n type: 'string',\n enum: ['pending', 'accepted', 'rejected', 'stale', 'all'],\n description: 'Filter by status (default: pending)',\n },\n },\n required: ['workflowId'],\n },\n },\n {\n name: 'cofactor_workflow_proposals_get',\n ...readOnly('Get a workflow proposal'),\n description: 'Fetch a proposal including its full snapshot JSON.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: { type: 'string' },\n proposalId: { type: 'string' },\n },\n required: ['workflowId', 'proposalId'],\n },\n },\n {\n name: 'cofactor_workflow_proposals_diff',\n ...readOnly('Diff a workflow proposal'),\n description:\n 'Compute a per-node diff between a proposal and the current workflow draft. Returns summary counts plus per-field changes for changed nodes.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: { type: 'string' },\n proposalId: { type: 'string' },\n },\n required: ['workflowId', 'proposalId'],\n },\n },\n {\n name: 'cofactor_workflow_proposals_accept',\n ...modifying('Accept a workflow proposal', false),\n description:\n 'Apply a proposal to the workflow draft. Omit acceptedNodeIds for atomic (all-or-nothing) accept; provide it to cherry-pick a subset.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: { type: 'string' },\n proposalId: { type: 'string' },\n acceptedNodeIds: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Optional: node ids from the diff to include. Omit for atomic accept of every change.',\n },\n },\n required: ['workflowId', 'proposalId'],\n },\n },\n {\n name: 'cofactor_workflow_proposals_reject',\n ...modifying('Reject a workflow proposal', true),\n description: 'Reject a pending proposal. Does not change the workflow draft.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: { type: 'string' },\n proposalId: { type: 'string' },\n },\n required: ['workflowId', 'proposalId'],\n },\n },\n {\n name: 'cofactor_workflow_proposals_revert',\n ...modifying('Revert a workflow proposal', false),\n description:\n 'Revert a previously-accepted proposal back to pending. Only the user who accepted it may revert.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: { type: 'string' },\n proposalId: { type: 'string' },\n },\n required: ['workflowId', 'proposalId'],\n },\n },\n ];\n}\n\nexport async function handleWorkflowProposalsTool(\n tool: string,\n args: Record<string, unknown>,\n) {\n if (!tool.startsWith('cofactor_workflow_proposals_')) return null;\n\n try {\n switch (tool) {\n case 'cofactor_workflow_proposals_list':\n return await listProposals(args);\n case 'cofactor_workflow_proposals_get':\n return await getProposal(args);\n case 'cofactor_workflow_proposals_diff':\n return await diffProposal(args);\n case 'cofactor_workflow_proposals_accept':\n return await acceptProposal(args);\n case 'cofactor_workflow_proposals_reject':\n return await rejectProposal(args);\n case 'cofactor_workflow_proposals_revert':\n return await revertProposal(args);\n default:\n return null;\n }\n } catch (err) {\n return toolJson({\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n}\n\n// ── Tool implementations ─────────────────────────────────────────────────\n\nasync function listProposals(args: Record<string, unknown>) {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const status = typeof args.status === 'string' ? args.status : 'pending';\n const query = status === 'all' ? '' : `?status=${encodeURIComponent(status)}`;\n const res = await mcpApiRequest<{\n ok: boolean;\n data?: ProposalSummary[];\n error?: string;\n }>('GET', `/workflows/${workflowId}/proposals${query}`);\n return toolJson({\n ok: res.ok,\n workflowId,\n count: res.data?.length ?? 0,\n proposals: res.data ?? [],\n error: res.error,\n });\n}\n\nasync function getProposal(args: Record<string, unknown>) {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const proposalId = pathSeg(args.proposalId, 'proposalId');\n const res = await mcpApiRequest<{\n ok: boolean;\n data?: ProposalDetail;\n error?: string;\n }>('GET', `/workflows/${workflowId}/proposals/${proposalId}`);\n return toolJson(res);\n}\n\nasync function diffProposal(args: Record<string, unknown>) {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const proposalId = pathSeg(args.proposalId, 'proposalId');\n const [propRes, wfRes] = await Promise.all([\n mcpApiRequest<{ ok: boolean; data?: ProposalDetail; error?: string }>(\n 'GET',\n `/workflows/${workflowId}/proposals/${proposalId}`,\n ),\n mcpApiRequest<{ ok: boolean; workflow?: WorkflowDetail; error?: string }>(\n 'GET',\n `/workflows/${workflowId}`,\n ),\n ]);\n if (!propRes.ok || !propRes.data) {\n return toolJson({ ok: false, error: propRes.error ?? 'proposal not found' });\n }\n if (!wfRes.workflow) {\n return toolJson({ ok: false, error: wfRes.error ?? 'workflow not found' });\n }\n const current = fromApiSnapshot({\n nodes: wfRes.workflow.nodes,\n edges: wfRes.workflow.edges,\n });\n const proposed = fromApiSnapshot(propRes.data.snapshotJson);\n const diff = diffSnapshots(current, proposed);\n return toolJson(buildDiffPayload(propRes.data, diff));\n}\n\nasync function acceptProposal(args: Record<string, unknown>) {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const proposalId = pathSeg(args.proposalId, 'proposalId');\n const acceptedNodeIds = Array.isArray(args.acceptedNodeIds)\n ? (args.acceptedNodeIds as string[]).filter((s) => typeof s === 'string')\n : null;\n const body = acceptedNodeIds\n ? { selection: { acceptedNodeIds } }\n : undefined;\n const res = await mcpApiRequest<{ ok: boolean; error?: string }>(\n 'POST',\n `/workflows/${workflowId}/proposals/${proposalId}/accept`,\n body,\n );\n return toolJson({\n ...res,\n workflowId,\n proposalId,\n partial: acceptedNodeIds !== null,\n });\n}\n\nasync function rejectProposal(args: Record<string, unknown>) {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const proposalId = pathSeg(args.proposalId, 'proposalId');\n const res = await mcpApiRequest<{ ok: boolean; error?: string }>(\n 'POST',\n `/workflows/${workflowId}/proposals/${proposalId}/reject`,\n );\n return toolJson({ ...res, workflowId, proposalId });\n}\n\nasync function revertProposal(args: Record<string, unknown>) {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const proposalId = pathSeg(args.proposalId, 'proposalId');\n const res = await mcpApiRequest<{ ok: boolean; error?: string }>(\n 'POST',\n `/workflows/${workflowId}/proposals/${proposalId}/revert`,\n );\n return toolJson({ ...res, workflowId, proposalId });\n}\n\n// ── Diff payload shaper (shared shape with the CLI) ──────────────────────\n\nfunction buildDiffPayload(proposal: ProposalDetail, diff: SnapshotDiff) {\n return {\n proposal: {\n id: proposal.id,\n title: proposal.title,\n source: proposal.source,\n status: proposal.status,\n stale: proposal.status === 'stale',\n createdAt: proposal.createdAt,\n decidedAt: proposal.decidedAt,\n },\n summary: {\n addedNodes: diff.addedNodes.length,\n removedNodes: diff.removedNodes.length,\n changedNodes: diff.changedNodes.length,\n addedEdges: diff.addedEdges.length,\n removedEdges: diff.removedEdges.length,\n touchedCount: diff.touchedCount,\n isEmpty: diff.isEmpty,\n },\n nodes: {\n added: diff.addedNodes.map((n) => ({\n id: n.id,\n nodeType: n.nodeType,\n configJson: n.configJson,\n })),\n removed: diff.removedNodes.map((n) => ({\n id: n.id,\n nodeType: n.nodeType,\n configJson: n.configJson,\n })),\n changed: diff.changedNodes.map((c) => ({\n id: c.id,\n nodeType: c.nodeType,\n typeChanged: c.typeChanged,\n beforeType: c.beforeType,\n afterType: c.afterType,\n fieldChanges: c.fieldChanges,\n })),\n },\n edges: {\n added: diff.addedEdges.map((e) => ({\n sourceNodeId: e.sourceNodeId,\n targetNodeId: e.targetNodeId,\n edgeType: e.edgeType ?? null,\n })),\n removed: diff.removedEdges.map((e) => ({\n sourceNodeId: e.sourceNodeId,\n targetNodeId: e.targetNodeId,\n edgeType: e.edgeType ?? null,\n })),\n },\n };\n}\n","/**\n * MCP tools for workflow run results.\n *\n * Mirrors `cofactor workflow runs list`, `get`, and `diagnostics`.\n *\n * @module\n */\n\nimport { mcpApiRequest } from '../api-client';\nimport { toolJson } from '../tool-helpers';\nimport { readOnly } from '../annotations';\nimport { pathSeg } from '../api-tool';\n\nexport function getWorkflowRunsToolDefinitions() {\n return [\n {\n name: 'cofactor_workflow_runs_list',\n ...readOnly('List workflow runs'),\n description:\n 'List runs for a specific workflow with status, duration, and pagination.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID',\n },\n page: {\n type: 'number',\n description: 'Page number (default: 1)',\n },\n pageSize: {\n type: 'number',\n description: 'Page size (default: 10)',\n },\n mode: {\n type: 'string',\n enum: ['browser', 'api'],\n description: 'Filter by run mode',\n },\n },\n required: ['workflowId'],\n },\n },\n {\n name: 'cofactor_workflow_runs_get',\n ...readOnly('Get a workflow run'),\n description:\n 'Get workflow run detail including steps, status, duration, and error messages. Also serves as a status check for in-progress runs.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID',\n },\n runId: {\n type: 'string',\n description: 'The workflow run UUID',\n },\n },\n required: ['workflowId', 'runId'],\n },\n },\n {\n name: 'cofactor_workflow_runs_diagnostics',\n ...readOnly('Diagnose a workflow run'),\n description:\n 'Get failure diagnostic for a workflow run. Returns AI-generated analysis if available, otherwise falls back to console logs and network requests.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID',\n },\n runId: {\n type: 'string',\n description: 'The workflow run UUID',\n },\n },\n required: ['workflowId', 'runId'],\n },\n },\n ];\n}\n\nexport async function handleWorkflowRunsTool(\n tool: string,\n args: Record<string, unknown>\n) {\n if (tool === 'cofactor_workflow_runs_list') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const params = new URLSearchParams();\n params.set('page', String(args.page ?? 1));\n params.set('pageSize', String(args.pageSize ?? 10));\n if (args.mode) params.set('mode', String(args.mode));\n\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: { runs: unknown[] };\n pagination: unknown;\n }>('GET', `/workflows/${workflowId}/runs?${params}`);\n\n if (!result.ok) {\n return toolJson({ ok: false, error: result.error ?? 'Unknown error' });\n }\n\n return toolJson({ ok: true, runs: result.data.runs, pagination: result.pagination });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_workflow_runs_get') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const runId = pathSeg(args.runId, 'runId');\n\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: unknown;\n }>('GET', `/workflows/${workflowId}/runs/${runId}`);\n\n if (!result.ok) {\n return toolJson({ ok: false, error: result.error ?? 'Unknown error' });\n }\n\n return toolJson({ ok: true, data: result.data });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_workflow_runs_diagnostics') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const runId = pathSeg(args.runId, 'runId');\n\n // Try AI failure diagnostic first\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: unknown;\n }>('GET', `/workflows/${workflowId}/runs/${runId}/failure-diagnostic`);\n\n if (result.ok && result.data) {\n return toolJson({ ok: true, data: result.data });\n }\n\n // Fall back to raw diagnostics\n const rawResult = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n consoleLogs: unknown[];\n networkRequests: unknown[];\n }>('GET', `/workflows/${workflowId}/runs/${runId}/diagnostics`);\n\n if (!rawResult.ok) {\n return toolJson({ ok: true, data: null, message: 'No diagnostic available' });\n }\n\n return toolJson({\n ok: true,\n consoleLogs: rawResult.consoleLogs,\n networkRequests: rawResult.networkRequests,\n });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n return null;\n}\n","/**\n * MCP tools for test suite (workflow test execution) results and triggering.\n *\n * Mirrors `cofactor test-suite run`, `list`, `get`, `diagnostics`, and `steps`.\n *\n * @module\n */\n\nimport { mcpApiRequest } from '../api-client';\nimport { toolJson } from '../tool-helpers';\nimport { additive, readOnly } from '../annotations';\nimport { pathSeg } from '../api-tool';\n\nexport function getTestSuiteToolDefinitions() {\n return [\n {\n name: 'cofactor_test_suite_run',\n ...additive('Run a test suite', false),\n description:\n 'Trigger a test suite execution. Returns the suite ID and job ID. Use cofactor_test_suite_get to check results after triggering.',\n inputSchema: {\n type: 'object',\n properties: {\n tag: {\n type: 'string',\n description: 'Filter workflows by tag',\n },\n namePattern: {\n type: 'string',\n description: 'Filter workflows by name pattern (regex)',\n },\n propertyId: {\n type: 'string',\n description: 'Target a specific property by UUID',\n },\n environmentId: {\n type: 'string',\n description: 'Target a specific environment by UUID',\n },\n },\n },\n },\n {\n name: 'cofactor_test_suite_list',\n ...readOnly('List test suite executions'),\n description:\n 'List recent test suite executions with pass/fail counts, ordered by most recent first.',\n inputSchema: {\n type: 'object',\n properties: {\n page: {\n type: 'number',\n description: 'Page number (default: 1)',\n },\n pageSize: {\n type: 'number',\n description: 'Page size (default: 20)',\n },\n },\n },\n },\n {\n name: 'cofactor_test_suite_get',\n ...readOnly('Get a test suite execution'),\n description:\n 'Get test suite detail including all individual test runs and their results.',\n inputSchema: {\n type: 'object',\n properties: {\n executionId: {\n type: 'string',\n description: 'The test execution UUID',\n },\n },\n required: ['executionId'],\n },\n },\n {\n name: 'cofactor_test_suite_diagnostics',\n ...readOnly('Diagnose a test in a suite run'),\n description:\n 'Get the AI-generated failure diagnostic (test suite run triage) for a specific workflow run, including root cause analysis and recommendations.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID',\n },\n runId: {\n type: 'string',\n description: 'The workflow run UUID',\n },\n },\n required: ['workflowId', 'runId'],\n },\n },\n {\n name: 'cofactor_test_suite_steps',\n ...readOnly('Get the steps of a test in a suite run'),\n description:\n 'Get the individual steps of a workflow run in a test suite, with their status, duration, and error messages.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: {\n type: 'string',\n description: 'The workflow UUID',\n },\n runId: {\n type: 'string',\n description: 'The workflow run UUID',\n },\n },\n required: ['workflowId', 'runId'],\n },\n },\n ];\n}\n\nexport async function handleTestSuiteTool(\n tool: string,\n args: Record<string, unknown>\n) {\n if (tool === 'cofactor_test_suite_run') {\n try {\n const params = new URLSearchParams();\n if (args.tag) params.set('tag', String(args.tag));\n if (args.namePattern) params.set('namePattern', String(args.namePattern));\n\n const queryStr = params.toString();\n const path = `/workflows/test-runs${queryStr ? `?${queryStr}` : ''}`;\n\n const body: Record<string, string> = {};\n if (args.propertyId) body.propertyId = String(args.propertyId);\n if (args.environmentId) body.environmentId = String(args.environmentId);\n\n const data = await mcpApiRequest<{\n ok: boolean;\n suiteId?: string;\n jobId?: string;\n appUrl?: string;\n error?: string;\n }>('POST', path, body);\n\n if (!data.ok) {\n return toolJson({ ok: false, error: data.error ?? 'Unknown error' });\n }\n\n return toolJson({\n ok: true,\n suiteId: data.suiteId,\n jobId: data.jobId,\n appUrl: data.appUrl,\n message: `Test suite triggered. Use cofactor_test_suite_get or cofactor_test_suite_list to check results.`,\n });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_test_suite_list') {\n try {\n const params = new URLSearchParams();\n params.set('page', String(args.page ?? 1));\n params.set('pageSize', String(args.pageSize ?? 20));\n params.set('sortBy', 'createdAt');\n params.set('sortOrder', 'desc');\n\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: unknown[];\n pagination: unknown;\n }>('GET', `/workflows/test-executions?${params}`);\n\n if (!result.ok) {\n return toolJson({ ok: false, error: result.error ?? 'Unknown error' });\n }\n\n return toolJson({ ok: true, data: result.data, pagination: result.pagination });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_test_suite_get') {\n try {\n const executionId = pathSeg(args.executionId, 'executionId');\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n execution: unknown;\n testRuns: unknown[];\n }>('GET', `/workflows/test-executions/${executionId}`);\n\n if (!result.ok) {\n return toolJson({ ok: false, error: result.error ?? 'Unknown error' });\n }\n\n return toolJson({ ok: true, execution: result.execution, testRuns: result.testRuns });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_test_suite_diagnostics') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const runId = pathSeg(args.runId, 'runId');\n\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: unknown;\n }>('GET', `/workflows/${workflowId}/runs/${runId}/failure-diagnostic`);\n\n if (!result.ok) {\n return toolJson({ ok: false, error: result.error ?? 'Unknown error' });\n }\n\n return toolJson({ ok: true, data: result.data });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_test_suite_steps') {\n try {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const runId = pathSeg(args.runId, 'runId');\n\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: unknown;\n }>('GET', `/workflows/${workflowId}/runs/${runId}`);\n\n if (!result.ok) {\n return toolJson({ ok: false, error: result.error ?? 'Unknown error' });\n }\n\n return toolJson({ ok: true, data: result.data });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n return null;\n}\n","/**\n * MCP tools for credential management.\n *\n * Mirrors `cofactor credential list`.\n *\n * @module\n */\n\nimport { mcpApiRequest } from '../api-client';\nimport { toolJson } from '../tool-helpers';\nimport { readOnly } from '../annotations';\n\nexport function getCredentialToolDefinitions() {\n return [\n {\n name: 'cofactor_credential_list',\n ...readOnly('List credentials'),\n description:\n 'List credentials in the current organization with their property and environment info.',\n inputSchema: {\n type: 'object',\n properties: {\n property: {\n type: 'string',\n description: 'Filter by property name or ID',\n },\n },\n },\n },\n ];\n}\n\nexport async function handleCredentialTool(\n tool: string,\n args: Record<string, unknown>\n) {\n if (tool === 'cofactor_credential_list') {\n try {\n const result = await mcpApiRequest<{\n ok: boolean;\n items: Array<{\n id: string;\n name: string;\n propertyId: string;\n propertyName?: string;\n propertyBaseUrl?: string;\n environmentId?: string | null;\n environmentName?: string | null;\n isEphemeral?: boolean;\n }>;\n }>('GET', '/org/credentials');\n\n let items = result.items ?? [];\n\n // Filter out ephemeral credentials\n items = items.filter((c) => !c.isEphemeral);\n\n // Apply property filter if provided\n if (args.property) {\n const filter = String(args.property).toLowerCase();\n items = items.filter(\n (c) =>\n c.propertyId === args.property ||\n (c.propertyName && c.propertyName.toLowerCase().includes(filter))\n );\n }\n\n return toolJson({ ok: true, credentials: items });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n return null;\n}\n","/**\n * MCP tools for issue management.\n *\n * Mirrors `cofactor issues list` and `cofactor issues get`.\n *\n * @module\n */\n\nimport type { FailureDiagnosticEvidence } from '@chatsdet/types/issues';\nimport { issueCommentsPath, toCommentsView, type IssueCommentsEnvelope } from '../issue-comments';\nimport { mcpApiRequest } from '../api-client';\nimport { currentToolCtx } from '../context';\nimport { toolJson } from '../tool-helpers';\nimport { readOnly } from '../annotations';\nimport { pathSeg } from '../api-tool';\nimport { describeError, resolveEvidence, type OccurrenceEvidence } from '../issue-evidence';\nimport type { ToolCallResult, ToolContentBlock } from '../types';\n\n/**\n * Screenshots returned inline as image blocks, so an agent can look without\n * downloading. Capped so a heavily evidenced issue stays a reasonable\n * response: the first few still frames, each under a size limit, fetched\n * together under a short timeout. Clips are never inlined; every item keeps\n * its signed links either way, and a frame that is not inlined says why.\n */\nconst MAX_INLINE_IMAGES = 4;\nconst MAX_INLINE_IMAGE_BYTES = 512 * 1024;\nconst INLINE_TIMEOUT_MS = 10_000;\nconst STILL_FRAMES = ['frame', 'beforeFrame', 'afterFrame'] as const;\n\nasync function inlineScreenshots(groups: OccurrenceEvidence[]): Promise<ToolContentBlock[]> {\n const candidates = groups\n .flatMap((group) =>\n group.items.flatMap((item) =>\n STILL_FRAMES.flatMap((name) => {\n const url = item.urls[name];\n return url ? [{ label: `Occurrence ${group.occurrenceId}, evidence ${item.index} (${name})`, url }] : [];\n })\n )\n )\n .slice(0, MAX_INLINE_IMAGES);\n const fetched = await Promise.all(candidates.map(({ url }) => fetchImage(url)));\n return candidates.flatMap(({ label }, i): ToolContentBlock[] => {\n const image = fetched[i]!;\n return 'error' in image\n ? [{ type: 'text', text: `${label}: not inlined (${image.error}); use its signed link.` }]\n : [{ type: 'text', text: `${label}:` }, { type: 'image', ...image }];\n });\n}\n\n/** The image at a signed link as base64, or why it is not inlined. */\nasync function fetchImage(url: string): Promise<{ data: string; mimeType: string } | { error: string }> {\n let res: Response;\n try {\n res = await fetch(url, { redirect: 'error', signal: AbortSignal.timeout(INLINE_TIMEOUT_MS) });\n } catch (err) {\n return { error: describeError(err) };\n }\n const mimeType = res.headers.get('content-type')?.split(';')[0]?.trim() ?? '';\n if (!res.ok || !mimeType.startsWith('image/')) {\n await res.body?.cancel();\n return { error: res.ok ? `not an image (${mimeType || 'no type'})` : `HTTP ${res.status}` };\n }\n const tooLarge = { error: `over ${MAX_INLINE_IMAGE_BYTES / 1024} KB` };\n if (!res.body) return { error: 'empty response' };\n if (Number(res.headers.get('content-length') ?? 0) > MAX_INLINE_IMAGE_BYTES) {\n await res.body.cancel();\n return tooLarge;\n }\n // Read with a hard cap: Content-Length can be absent, so stop at the limit.\n const reader = res.body.getReader();\n const chunks: Uint8Array[] = [];\n let size = 0;\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n size += value.byteLength;\n if (size > MAX_INLINE_IMAGE_BYTES) {\n await reader.cancel();\n return tooLarge;\n }\n chunks.push(value);\n }\n } catch (err) {\n // The 10s timeout also bounds the body read.\n return { error: describeError(err) };\n }\n const bytes = Buffer.concat(chunks);\n return { data: bytes.toString('base64'), mimeType };\n}\n\n/**\n * The detail response without each occurrence's `diagnosticJson.evidence`,\n * which `evidence` carries numbered and with signed links.\n */\nfunction withoutRawEvidence<T extends { diagnosticJson?: unknown } | null | undefined>(occurrence: T): T {\n if (!occurrence || typeof occurrence.diagnosticJson !== 'object' || occurrence.diagnosticJson === null) {\n return occurrence;\n }\n const { evidence: _evidence, ...diagnosticJson } = occurrence.diagnosticJson as Record<string, unknown>;\n return { ...occurrence, diagnosticJson };\n}\n\nexport function getIssueToolDefinitions() {\n return [\n {\n name: 'cofactor_issues_list',\n ...readOnly('List issues'),\n description:\n 'List and search issues in the current organization. Supports full-text search, severity/status filtering, and pagination.',\n inputSchema: {\n type: 'object',\n properties: {\n search: {\n type: 'string',\n description: 'Full-text search query',\n },\n severity: {\n type: 'string',\n enum: ['low', 'medium', 'high', 'unknown'],\n description: 'Filter by severity level',\n },\n statuses: {\n type: 'string',\n description: 'Comma-separated status filter: open, closed, not_a_bug',\n },\n propertyId: {\n type: 'string',\n description: 'Filter by property UUID',\n },\n page: {\n type: 'number',\n description: 'Page number (default: 1)',\n },\n pageSize: {\n type: 'number',\n description: 'Page size (default: 25)',\n },\n },\n },\n },\n {\n name: 'cofactor_issues_get',\n ...readOnly('Get an issue'),\n description:\n 'Get issue detail with linked product-map capabilities and rules (productMapLinks), and diagnostics: console errors and network failures from the latest occurrence, and `evidence` — every evidence item on the 10 newest occurrences, grouped by occurrence, numbered as cofactor_issues_update addresses them, with signed links (about 1 hour) for screenshots and clips — up to 50 links per call; the rest report on their item (signed links need a signed-in session, not an API key). The first few screenshots are also returned inline as images. Occurrences omit their raw evidence list; use `evidence`. Also returns `comments` (the newest 200, newest first) with `total`; add one with cofactor_issues_comment.',\n inputSchema: {\n type: 'object',\n properties: {\n issueId: {\n type: 'string',\n description: 'The issue UUID',\n },\n },\n required: ['issueId'],\n },\n },\n ];\n}\n\nexport async function handleIssueTool(\n tool: string,\n args: Record<string, unknown>\n) {\n if (tool === 'cofactor_issues_list') {\n try {\n const params = new URLSearchParams();\n if (args.search) params.set('search', String(args.search));\n if (args.severity) params.set('severity', String(args.severity));\n if (args.statuses) params.set('statuses', String(args.statuses));\n if (args.propertyId) params.set('propertyId', String(args.propertyId));\n if (args.page) params.set('page', String(args.page));\n if (args.pageSize) params.set('pageSize', String(args.pageSize));\n\n const qs = params.toString();\n const path = `/v2/issues${qs ? `?${qs}` : ''}`;\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: unknown[];\n pagination: unknown;\n }>('GET', path);\n\n if (!result.ok) {\n return toolJson({ ok: false, error: result.error ?? 'Unknown error' });\n }\n\n return toolJson({ ok: true, data: result.data, pagination: result.pagination });\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n if (tool === 'cofactor_issues_get') {\n try {\n const issueId = pathSeg(args.issueId, 'issueId');\n\n const detailResult = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data: {\n issue: { id: string; latestOccurrence?: { id: string; diagnosticJson?: unknown } | null };\n occurrences: Array<{\n id: string;\n detectedAt: string;\n diagnosticJson: { evidence: FailureDiagnosticEvidence[] } | null;\n }>;\n commentCount: number;\n };\n }>('GET', `/v2/issues/${issueId}`);\n\n if (!detailResult.ok) {\n return toolJson({ ok: false, error: detailResult.error ?? 'Unknown error' });\n }\n\n const { issue } = detailResult.data;\n const occ = issue.latestOccurrence;\n\n let consoleErrors: unknown[] = [];\n let networkErrors: unknown[] = [];\n\n if (occ) {\n try {\n const [consoleRes, networkRes] = await Promise.all([\n mcpApiRequest<{ ok: boolean; data: unknown[] }>(\n 'GET',\n `/v2/issues/${issueId}/occurrences/${pathSeg(occ.id, 'occurrenceId')}/console-logs`\n ),\n mcpApiRequest<{ ok: boolean; data: unknown[] }>(\n 'GET',\n `/v2/issues/${issueId}/occurrences/${pathSeg(occ.id, 'occurrenceId')}/network-requests`\n ),\n ]);\n\n if (consoleRes.ok && Array.isArray(consoleRes.data)) {\n consoleErrors = (consoleRes.data as Array<{ type: string }>).filter(\n (e) => e.type === 'error'\n );\n }\n\n if (networkRes.ok && Array.isArray(networkRes.data)) {\n networkErrors = (networkRes.data as Array<{ status: number | null }>).filter(\n (e) => e.status === null || e.status === 0 || (e.status !== null && e.status >= 400)\n );\n }\n } catch {\n // Diagnostics are best-effort\n }\n }\n\n const commentsResult = await mcpApiRequest<IssueCommentsEnvelope>(\n 'GET',\n issueCommentsPath(issueId)\n );\n if (!commentsResult.ok) {\n return toolJson({ ok: false, error: commentsResult.error ?? 'Unknown error' });\n }\n\n const ctx = currentToolCtx();\n if (!ctx) throw new Error('[no-context] cofactor_issues_get called outside of withToolCtx()');\n const evidence = await resolveEvidence(ctx.apiUrl, ctx.apiToken, detailResult.data.occurrences);\n\n const result: ToolCallResult = toolJson({\n ok: true,\n ...detailResult.data,\n issue: { ...issue, latestOccurrence: withoutRawEvidence(issue.latestOccurrence) },\n occurrences: detailResult.data.occurrences.map(withoutRawEvidence),\n evidence,\n ...toCommentsView(commentsResult),\n consoleErrors,\n networkErrors,\n });\n result.content.push(...(await inlineScreenshots(evidence)));\n return result;\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n return null;\n}\n","/**\n * MCP tools for the Product Map — what an application does (areas →\n * capabilities) and which flows cover it.\n *\n * Mirrors `cofactor product-map`. Product Map is GA and uses the normal\n * authenticated organization permissions.\n *\n * Everything is addressed by **natural code** (`ARE-CMM`, `CAP-CMM-001`)\n * because that is what a coding agent can carry between a ticket, a spec, and a\n * tool call without inventing an id. `cofactor_product_map_resolve_code` exists\n * for the case that matters: a code cited before a capability moved is retired,\n * not gone, and resolving it tells the agent what it became.\n *\n * These are HTTP-only and deliberately distinct from the in-API planner tools\n * in `apps/api/src/product-map/agent-tools.ts` — those run inside a planning\n * job with an orgId in scope; these run from any MCP host with an API token.\n * The read surface here is wider: the planner has no coverage read and no\n * single-capability detail read.\n *\n * @module\n */\n\nimport { mcpApiRequest } from '../api-client';\nimport { toolJson } from '../tool-helpers';\nimport { additive, modifying, readOnly } from '../annotations';\n\n/** Shared prose so every code-taking parameter documents the same contract. */\nconst CODE_PARAM =\n 'Natural code (ARE-CMM for an area, CAP-CMM-001 for a capability) or a prefixed id ' +\n '(parea_…, pcap_…). Codes retired by a move still resolve.';\n\nexport function getProductMapToolDefinitions() {\n return [\n {\n name: 'cofactor_product_map_get',\n ...readOnly('Get the product map'),\n description:\n 'Get the complete product map for an application: every area and capability with its ' +\n 'natural code, lifecycle status, importance, and coverage status, plus unassigned capabilities and the ' +\n 'count of approved flows linked to nothing. Call this before proposing a new capability ' +\n 'so you reuse an existing one by code instead of creating a near-duplicate.',\n inputSchema: {\n type: 'object',\n properties: {\n propertyId: {\n type: 'string',\n description: 'Application (property) id, prefixed (prop_…) or UUID',\n },\n },\n required: ['propertyId'],\n },\n },\n {\n name: 'cofactor_product_map_coverage',\n ...readOnly('Get product map coverage'),\n description:\n 'Aggregate test-coverage rollup for the product map: how many capabilities have at least ' +\n 'one linked flow (the headline metric), how many also have a recent pass, and how many ' +\n 'approved flows are linked to nothing. Broken down by area when scoped to one application. ' +\n 'Always report the unmapped-flow count alongside any coverage figure — coverage is always ' +\n 'coverage of the known map.',\n inputSchema: {\n type: 'object',\n properties: {\n propertyId: {\n type: 'string',\n description: 'Application id; omit for an org-wide rollup',\n },\n days: {\n type: 'number',\n description: 'Days of history to include (1–365, default 30)',\n },\n },\n },\n },\n {\n name: 'cofactor_product_map_resolve_code',\n ...readOnly('Resolve a product map code'),\n description:\n 'Resolve a product map code (ARE-, CAP-) to the area or capability it names, including codes retired by a ' +\n 'move or an area rename. Returns `retired: true` plus the entity\\'s code today when the ' +\n 'code you cited is stale — use this before reporting that a code \"does not exist\".',\n inputSchema: {\n type: 'object',\n properties: {\n code: { type: 'string', description: 'e.g. CAP-CMM-001 or ARE-CMM' },\n propertyId: {\n type: 'string',\n description:\n 'Application id. Strongly advised: codes are unique per application, so an ' +\n 'org-wide lookup that matches twice is an error rather than a guess.',\n },\n },\n required: ['code'],\n },\n },\n {\n name: 'cofactor_product_map_get_capability',\n ...readOnly('Get a product map capability'),\n description:\n 'Get one product map capability in full: its lifecycle status, markdown body, importance, live rules with their status, node/assertion links and gap/unproven/proven coverage from the latest finished run, linked flows ' +\n '(by name and health), any codes it previously held, and its revision history.',\n inputSchema: {\n type: 'object',\n properties: {\n code: { type: 'string', description: CODE_PARAM },\n propertyId: { type: 'string', description: 'Application id, to disambiguate the code' },\n },\n required: ['code'],\n },\n },\n {\n name: 'cofactor_product_map_link_flows',\n ...additive('Link workflows to a capability', true),\n description:\n 'Link workflows (flows) to a product map capability. Additive — existing links are preserved. Use this to record ' +\n 'that a flow you just authored covers a capability.',\n inputSchema: {\n type: 'object',\n properties: {\n code: { type: 'string', description: CODE_PARAM },\n workflowIds: {\n type: 'array',\n items: { type: 'string' },\n description: 'Prefixed flow ids (wf_…)',\n },\n propertyId: { type: 'string', description: 'Application id, to disambiguate the code' },\n },\n required: ['code', 'workflowIds'],\n },\n },\n {\n name: 'cofactor_product_map_unlink_flows',\n ...modifying('Unlink workflows from a capability', true),\n description:\n 'Remove workflow (flow) links from a product map capability. Subtractive — links not named are preserved.',\n inputSchema: {\n type: 'object',\n properties: {\n code: { type: 'string', description: CODE_PARAM },\n workflowIds: {\n type: 'array',\n items: { type: 'string' },\n description: 'Prefixed flow ids (wf_…)',\n },\n propertyId: { type: 'string', description: 'Application id, to disambiguate the code' },\n },\n required: ['code', 'workflowIds'],\n },\n },\n ];\n}\n\ntype LookupData = {\n entityType: 'area' | 'capability';\n id: string;\n propertyId: string;\n currentCode: string | null;\n status: string;\n retired: boolean;\n};\n\ntype CapabilityDetail = {\n status: string;\n id: string;\n code: string | null;\n title: string;\n rules: Array<{\n id: string;\n coverage: 'gap' | 'unproven' | 'proven';\n links: Array<{\n workflowId: string;\n workflowTitle: string;\n nodeId: string;\n nodeTitle: string;\n nodeType: string;\n assertionId: string | null;\n assertionText: string | null;\n }>;\n }>;\n previousCodes: string[];\n activeWorkflowIds: string[];\n activeWorkflows: Array<{ workflowId: string; name: string; health: string }>;\n};\n\nasync function lookupCode(code: string, propertyId?: string) {\n const params = new URLSearchParams({ code });\n if (propertyId) params.set('propertyId', propertyId);\n return mcpApiRequest<{ ok: boolean; error?: string; data?: LookupData }>(\n 'GET',\n `/product-map/lookup?${params}`\n );\n}\n\n/**\n * Resolve a code (or pass a prefixed id through) to a capability id, carrying\n * the \"this was renumbered\" fact forward so the caller can surface it.\n */\nasync function resolveCapabilityId(\n code: string,\n propertyId?: string\n): Promise<{ id: string; renamedFrom?: string; currentCode?: string | null } | { error: string }> {\n if (code.startsWith('pcap_')) return { id: code };\n const result = await lookupCode(code, propertyId);\n if (!result.ok || !result.data) return { error: result.error ?? `No capability matches ${code}` };\n if (result.data.entityType !== 'capability') {\n return { error: `${code} names an area, not a capability` };\n }\n return result.data.retired\n ? { id: result.data.id, renamedFrom: code.toUpperCase(), currentCode: result.data.currentCode }\n : { id: result.data.id };\n}\n\nasync function getCapabilityDetail(id: string) {\n return mcpApiRequest<{ ok: boolean; error?: string; data?: CapabilityDetail }>(\n 'GET',\n `/product-map/capabilities/${encodeURIComponent(id)}`\n );\n}\n\n/**\n * `PUT .../workflows` replaces the whole link set, so an additive tool has to\n * read the current set and send the union. A tool that PUT its argument\n * directly would silently drop every other link — see the CLI's\n * `applyLinkDelta` for the same reasoning.\n */\nasync function editLinks(\n args: Record<string, unknown>,\n operation: 'link' | 'unlink'\n) {\n const resolved = await resolveCapabilityId(\n String(args.code),\n args.propertyId ? String(args.propertyId) : undefined\n );\n if ('error' in resolved) return toolJson({ ok: false, error: resolved.error });\n\n const detail = await getCapabilityDetail(resolved.id);\n if (!detail.ok || !detail.data) {\n return toolJson({ ok: false, error: detail.error ?? 'Failed to load the capability' });\n }\n\n const delta = (args.workflowIds as string[]) ?? [];\n const next = new Set(detail.data.activeWorkflowIds);\n for (const id of delta) {\n if (operation === 'link') next.add(id);\n else next.delete(id);\n }\n\n const result = await mcpApiRequest<{\n ok: boolean;\n error?: string;\n data?: { inserted: string[]; unsuppressed: string[]; tombstoned: string[] };\n }>('PUT', `/product-map/capabilities/${encodeURIComponent(resolved.id)}/workflows`, {\n workflowIds: [...next],\n });\n if (!result.ok) return toolJson({ ok: false, error: result.error ?? `Failed to ${operation}` });\n\n return toolJson({\n ok: true,\n ...(resolved.renamedFrom\n ? { note: `${resolved.renamedFrom} was renumbered — it is now ${resolved.currentCode}` }\n : {}),\n linkedCount: next.size,\n changed: result.data,\n });\n}\n\nexport async function handleProductMapTool(tool: string, args: Record<string, unknown>) {\n try {\n switch (tool) {\n case 'cofactor_product_map_get': {\n const result = await mcpApiRequest<{ ok: boolean; error?: string; data?: unknown }>(\n 'GET',\n `/product-map?propertyId=${encodeURIComponent(String(args.propertyId))}`\n );\n return result.ok\n ? toolJson({ ok: true, data: result.data })\n : toolJson({ ok: false, error: result.error ?? 'Failed to load the product map' });\n }\n\n case 'cofactor_product_map_coverage': {\n const params = new URLSearchParams();\n if (args.propertyId) params.set('propertyId', String(args.propertyId));\n if (args.days) params.set('days', String(args.days));\n const qs = params.toString();\n const result = await mcpApiRequest<{ ok: boolean; error?: string; data?: unknown }>(\n 'GET',\n `/product-map/coverage${qs ? `?${qs}` : ''}`\n );\n return result.ok\n ? toolJson({ ok: true, data: result.data })\n : toolJson({ ok: false, error: result.error ?? 'Failed to load coverage' });\n }\n\n case 'cofactor_product_map_resolve_code': {\n const result = await lookupCode(\n String(args.code),\n args.propertyId ? String(args.propertyId) : undefined\n );\n return result.ok && result.data\n ? toolJson({ ok: true, data: result.data })\n : toolJson({ ok: false, error: result.error ?? 'No area or capability matches that code' });\n }\n\n case 'cofactor_product_map_get_capability': {\n const resolved = await resolveCapabilityId(\n String(args.code),\n args.propertyId ? String(args.propertyId) : undefined\n );\n if ('error' in resolved) return toolJson({ ok: false, error: resolved.error });\n const detail = await getCapabilityDetail(resolved.id);\n if (!detail.ok || !detail.data) {\n return toolJson({ ok: false, error: detail.error ?? 'Failed to load the capability' });\n }\n return toolJson({\n ok: true,\n ...(resolved.renamedFrom\n ? { note: `${resolved.renamedFrom} was renumbered — it is now ${resolved.currentCode}` }\n : {}),\n data: detail.data,\n });\n }\n\n case 'cofactor_product_map_link_flows':\n return editLinks(args, 'link');\n\n case 'cofactor_product_map_unlink_flows':\n return editLinks(args, 'unlink');\n\n default:\n return toolJson({ ok: false, error: `Unknown product-map tool: ${tool}` });\n }\n } catch (err) {\n return toolJson({ ok: false, error: err instanceof Error ? err.message : String(err) });\n }\n}\n","/**\n * MCP tools for the workflow lifecycle: approve, promote, pause, archive,\n * management status, events, revisions, node toggles, and fork.\n *\n * Mirrors `cofactor workflow approve|promote|pause|unpause|archive|unarchive|\n * status|events|revisions|node|fork`. The CLI's `--yes` becomes `confirm: true`.\n *\n * @module\n */\n\nimport { WORKFLOW_MANAGEMENT_STATUSES } from '@chatsdet/types';\nimport { additive, modifying, readOnly } from '../annotations';\nimport {\n type ApiTool,\n CONFIRM_PROPERTY,\n apiToolGroup,\n pathInt,\n pathSeg,\n requireConfirm,\n withQuery,\n} from '../api-tool';\n\nconst WORKFLOW_ID = { type: 'string', description: 'The workflow UUID' } as const;\nconst REASON = { type: 'string', description: 'Why, recorded on the workflow event timeline' } as const;\n\nfunction optionalReason(args: Record<string, unknown>) {\n return args.reason ? { reason: String(args.reason) } : {};\n}\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_workflow_approve',\n ...modifying('Approve a workflow', true),\n description:\n 'Mark a test as approved. Approval asserts that a HUMAN has verified the test checks the right thing, so only call this after the user has personally confirmed that, and pass confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { workflowId: WORKFLOW_ID, confirm: CONFIRM_PROPERTY },\n required: ['workflowId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'approve this workflow');\n return { method: 'POST', path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/approve`, body: {} };\n },\n },\n {\n name: 'cofactor_workflow_promote',\n ...modifying('Promote a workflow into test suites', true),\n description:\n 'Include an approved workflow in test suites. Needs a successful run first unless force=true, and the workflow must be approved (approval cannot be forced). This route is for orgs on the legacy promotion model; orgs on the eligibility model manage suite inclusion with cofactor_workflow_status_set or pause/unpause instead.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n force: { type: 'boolean', description: 'Promote even without a successful run' },\n },\n required: ['workflowId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/promote`,\n body: args.force ? { force: true } : {},\n }),\n },\n {\n name: 'cofactor_workflow_pause',\n ...modifying('Pause a workflow', true),\n description: 'Pause a workflow so test suites skip it.',\n inputSchema: {\n type: 'object',\n properties: { workflowId: WORKFLOW_ID, reason: REASON },\n required: ['workflowId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/pause`,\n body: optionalReason(args),\n }),\n },\n {\n name: 'cofactor_workflow_unpause',\n ...modifying('Unpause a workflow', true),\n description: 'Resume a paused workflow so test suites include it again.',\n inputSchema: {\n type: 'object',\n properties: { workflowId: WORKFLOW_ID, reason: REASON },\n required: ['workflowId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/unpause`,\n body: optionalReason(args),\n }),\n },\n {\n name: 'cofactor_workflow_archive',\n ...modifying('Archive a workflow', true),\n description:\n 'Archive a workflow: it is hidden from lists and skipped by test suites. Reversible with cofactor_workflow_unarchive. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { workflowId: WORKFLOW_ID, confirm: CONFIRM_PROPERTY },\n required: ['workflowId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'archive this workflow');\n return { method: 'DELETE', path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}` };\n },\n },\n {\n name: 'cofactor_workflow_unarchive',\n ...modifying('Restore an archived workflow', true),\n description: 'Restore an archived workflow.',\n inputSchema: {\n type: 'object',\n properties: { workflowId: WORKFLOW_ID },\n required: ['workflowId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/unarchive`,\n body: {},\n }),\n },\n {\n name: 'cofactor_workflow_status_set',\n ...modifying('Set a workflow management status', true),\n description:\n 'Set the management status of a workflow (statuses other than active exclude it from suite runs). Records an event on the timeline.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n status: { type: 'string', enum: [...WORKFLOW_MANAGEMENT_STATUSES], description: 'New status' },\n reason: REASON,\n },\n required: ['workflowId', 'status'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/status`,\n body: { status: args.status, ...optionalReason(args) },\n }),\n },\n {\n name: 'cofactor_workflow_events_list',\n ...readOnly('List workflow events'),\n description: 'The audit timeline of a workflow: status changes, pauses, node toggles, and more.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n limit: { type: 'number', description: 'Maximum number of events to return' },\n },\n required: ['workflowId'],\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery(`/workflows/${pathSeg(args.workflowId, 'workflowId')}/events`, {\n limit: args.limit,\n }),\n }),\n },\n {\n name: 'cofactor_workflow_revisions_list',\n ...readOnly('List workflow revisions'),\n description: \"List a workflow's definition history, newest first, with cursor paging.\",\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n limit: { type: 'number', description: 'Maximum number of revisions to return' },\n before: { type: 'integer', minimum: 1, description: 'Return revisions older than this revision number' },\n },\n required: ['workflowId'],\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery(`/workflows/${pathSeg(args.workflowId, 'workflowId')}/revisions`, {\n limit: args.limit,\n before: args.before,\n }),\n }),\n },\n {\n name: 'cofactor_workflow_revisions_get',\n ...readOnly('Get a workflow revision'),\n description: 'Get one historical revision of a workflow definition.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n revisionNumber: { type: 'integer', minimum: 1, description: 'The revision number' },\n },\n required: ['workflowId', 'revisionNumber'],\n },\n request: (args) => ({\n method: 'GET',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/revisions/${pathInt(args.revisionNumber, 'revisionNumber')}`,\n }),\n },\n {\n name: 'cofactor_workflow_revisions_restore',\n ...modifying('Restore a workflow revision', true),\n description:\n 'Restore the workflow definition to a historical revision. The current definition is saved as a new revision, so this can be undone by restoring again.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n revisionNumber: { type: 'integer', minimum: 1, description: 'The revision number to restore' },\n },\n required: ['workflowId', 'revisionNumber'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/revisions/${pathInt(args.revisionNumber, 'revisionNumber')}/restore`,\n }),\n },\n {\n name: 'cofactor_workflow_node_deactivate',\n ...modifying('Deactivate a workflow node', true),\n description:\n 'Deactivate a node so runs skip it (step status \"skipped\"). Audited: records an event with the reason.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n nodeId: { type: 'string', description: 'The node UUID' },\n reason: REASON,\n },\n required: ['workflowId', 'nodeId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/nodes/${pathSeg(args.nodeId, 'nodeId')}/deactivate`,\n body: optionalReason(args),\n }),\n },\n {\n name: 'cofactor_workflow_node_activate',\n ...modifying('Activate a workflow node', true),\n description: 'Re-activate a deactivated node. Audited: records an event with the reason.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n nodeId: { type: 'string', description: 'The node UUID' },\n reason: REASON,\n },\n required: ['workflowId', 'nodeId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/nodes/${pathSeg(args.nodeId, 'nodeId')}/activate`,\n body: optionalReason(args),\n }),\n },\n {\n name: 'cofactor_workflow_fork',\n ...additive('Fork a workflow', false),\n description:\n 'Create an editable fork of a workflow, to author changes without touching the original. Returns the fork.',\n inputSchema: {\n type: 'object',\n properties: { workflowId: WORKFLOW_ID },\n required: ['workflowId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/fork`,\n }),\n },\n];\n\nexport const workflowLifecycleGroup = apiToolGroup('workflow-lifecycle', tools);\n","/**\n * MCP tools for authoring a workflow after it exists: cache control, the\n * auto-maintain feedback loop, and API sequences.\n *\n * Mirrors `cofactor workflow cache status|pin|unpin|optimize|clear`,\n * `workflow feedback list|answer`, and `workflow api-sequence get|update|\n * execute|delete|set-api-only`. The CLI resolves a sequence id from a workflow\n * id before each api-sequence verb; here `cofactor_workflow_api_sequence_get`\n * is that lookup and the other tools take the `sequenceId` it returns.\n *\n * Skipped: `workflow create` (resolves credentials and applies tags with extra\n * requests), `cache optimize-dry|substrate|locator|commit` (local files).\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport {\n type ApiTool,\n CONFIRM_PROPERTY,\n apiToolGroup,\n pathSeg,\n requireConfirm,\n} from '../api-tool';\n\nconst WORKFLOW_ID = { type: 'string', description: 'The workflow UUID' } as const;\nconst SEQUENCE_ID = {\n type: 'string',\n description: 'The API sequence UUID (from cofactor_workflow_api_sequence_get)',\n} as const;\n\nconst CACHE_CLEAR_SELECTORS = ['nodeId', 'belowVersion', 'staleOnly', 'mode'] as const;\n\n/** Mirrors the CLI's `buildCacheClearBody`: exactly one selector, `hard` resets the workflow. */\nfunction cacheClearRequest(args: Record<string, unknown>) {\n const workflowId = pathSeg(args.workflowId, 'workflowId');\n const given = CACHE_CLEAR_SELECTORS.filter((k) => args[k] !== undefined && args[k] !== false);\n if (given.length !== 1) {\n throw new Error('Provide exactly one of nodeId, belowVersion, staleOnly, or mode');\n }\n if (args.mode === 'hard') {\n requireConfirm(args, 'hard reset this workflow (deletes all cached actions and playbook steps)');\n return { method: 'POST' as const, path: `/workflows/${workflowId}/reset` };\n }\n const body: Record<string, unknown> = {};\n if (args.nodeId !== undefined) body.nodeId = args.nodeId;\n if (args.belowVersion !== undefined) {\n if (!Number.isInteger(args.belowVersion) || (args.belowVersion as number) <= 0) {\n throw new Error('belowVersion must be a positive integer');\n }\n body.belowVersion = args.belowVersion;\n }\n if (args.staleOnly === true) body.staleOnly = true;\n if (args.mode !== undefined) {\n if (args.mode !== 'all') throw new Error('mode must be \"all\" or \"hard\"');\n body.mode = 'all';\n }\n return { method: 'POST' as const, path: `/workflows/${workflowId}/cache-clear`, body };\n}\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_workflow_cache_status',\n ...readOnly('Get workflow cache status'),\n description: 'Cache health of a workflow: per-node cache coverage and pin state.',\n inputSchema: { type: 'object', properties: { workflowId: WORKFLOW_ID }, required: ['workflowId'] },\n request: (args) => ({\n method: 'GET',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/cache-status`,\n }),\n },\n {\n name: 'cofactor_workflow_cache_pin',\n ...modifying('Pin a workflow cache', true),\n description: 'Pin the workflow cache: it becomes read-only at runtime and is recached offline.',\n inputSchema: { type: 'object', properties: { workflowId: WORKFLOW_ID }, required: ['workflowId'] },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/cache-pin`,\n }),\n },\n {\n name: 'cofactor_workflow_cache_unpin',\n ...modifying('Unpin a workflow cache', true),\n description:\n 'Unpin the workflow cache. It may stay effectively pinned by auto-maintain. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { workflowId: WORKFLOW_ID, confirm: CONFIRM_PROPERTY },\n required: ['workflowId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'unpin this workflow cache');\n return {\n method: 'DELETE',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/cache-pin`,\n };\n },\n },\n {\n name: 'cofactor_workflow_cache_optimize',\n ...additive('Optimize a workflow cache', false),\n description:\n 'Enqueue the cache optimizer job, which harvests a run into cache playbooks. Returns the job and run ids.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n runId: { type: 'string', description: 'Run to harvest (default: the latest suitable run)' },\n },\n required: ['workflowId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/optimize-cache`,\n body: args.runId ? { runId: String(args.runId) } : {},\n }),\n },\n {\n name: 'cofactor_workflow_cache_clear',\n ...modifying('Clear workflow cache rows', true),\n description:\n 'Invalidate cached actions. Give exactly one of: nodeId (one node), belowVersion (rows older than that version), staleOnly, or mode. mode=\"all\" invalidates every row; mode=\"hard\" is the Reset flow button: deletes all cached actions, removes playbook steps from every node and clears lastRunId, cannot be undone, and requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n nodeId: { type: 'string', description: 'Clear only this node' },\n belowVersion: { type: 'integer', minimum: 1, description: 'Clear rows below this version' },\n staleOnly: { type: 'boolean', description: 'Clear only stale rows' },\n mode: { type: 'string', enum: ['all', 'hard'], description: 'Clear everything (all) or hard reset (hard)' },\n confirm: { ...CONFIRM_PROPERTY, description: `${CONFIRM_PROPERTY.description} Only needed for mode=\"hard\".` },\n },\n required: ['workflowId'],\n },\n request: cacheClearRequest,\n },\n {\n name: 'cofactor_workflow_feedback_list',\n ...readOnly('List workflow maintenance feedback'),\n description:\n 'The pending maintenance feedback request for a workflow (if any) plus answered and canceled history. The maintenance agent parks a convergence run with a question when it cannot tell whether a change is intentional or a bug.',\n inputSchema: { type: 'object', properties: { workflowId: WORKFLOW_ID }, required: ['workflowId'] },\n request: (args) => ({\n method: 'GET',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/maintenance-feedback`,\n }),\n },\n {\n name: 'cofactor_workflow_feedback_answer',\n ...modifying('Answer workflow maintenance feedback', false),\n description:\n 'Answer a pending maintenance feedback request. This resumes the parked convergence run with the decision, so only answer on the user’s say-so.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n requestId: { type: 'string', description: 'The feedback request id' },\n answer: { type: 'string', enum: ['intentional', 'bug'], description: 'Whether the observed change is intentional or a bug' },\n explanation: { type: 'string', description: 'Why, in plain text' },\n },\n required: ['workflowId', 'requestId', 'answer', 'explanation'],\n },\n request: (args) => {\n if (args.answer !== 'intentional' && args.answer !== 'bug') {\n throw new Error('answer must be \"intentional\" or \"bug\"');\n }\n if (typeof args.explanation !== 'string' || !args.explanation) {\n throw new Error('explanation is required');\n }\n return {\n method: 'POST',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/maintenance-feedback/${pathSeg(args.requestId, 'requestId')}/answer`,\n body: { answer: args.answer, explanation: args.explanation },\n };\n },\n },\n {\n name: 'cofactor_workflow_api_sequence_get',\n // Not readOnly: when the workflow has none, the server adopts a single api_sequence node into a sequence.\n ...additive('Get the API sequence of a workflow', true),\n description:\n 'The API sequence attached to an api-only workflow: its id, status, credential and config (steps, exports). Fails with a 404 when the workflow has none. Use its id as sequenceId for the other api-sequence tools.',\n inputSchema: { type: 'object', properties: { workflowId: WORKFLOW_ID }, required: ['workflowId'] },\n request: (args) => ({\n method: 'GET',\n path: `/api-sequences/by-workflow/${pathSeg(args.workflowId, 'workflowId')}`,\n }),\n },\n {\n name: 'cofactor_workflow_api_sequence_update',\n ...modifying('Replace an API sequence config', true),\n description:\n 'Replace the whole config of an API sequence. A config is { steps: [...], description?, stopOnFailure?, exports? }. An invalid config returns the validation issues.',\n inputSchema: {\n type: 'object',\n properties: {\n sequenceId: SEQUENCE_ID,\n config: {\n type: 'object',\n description: 'The new config: { steps: [...], description?, stopOnFailure?, exports? }',\n properties: { steps: { type: 'array', items: { type: 'object' } } },\n required: ['steps'],\n },\n },\n required: ['sequenceId', 'config'],\n },\n request: (args) => {\n const config = args.config as { steps?: unknown } | undefined;\n if (!config || !Array.isArray(config.steps)) throw new Error('config must have a \"steps\" array');\n return {\n method: 'PUT',\n path: `/api-sequences/${pathSeg(args.sequenceId, 'sequenceId')}/config`,\n body: { config },\n };\n },\n },\n {\n name: 'cofactor_workflow_api_sequence_execute',\n ...additive('Execute an API sequence', false),\n description: 'Run an API sequence. Returns { runId, status }.',\n inputSchema: { type: 'object', properties: { sequenceId: SEQUENCE_ID }, required: ['sequenceId'] },\n request: (args) => ({\n method: 'POST',\n path: `/api-sequences/${pathSeg(args.sequenceId, 'sequenceId')}/execute`,\n }),\n },\n {\n name: 'cofactor_workflow_api_sequence_delete',\n ...modifying('Delete an API sequence', true),\n description:\n 'Delete the API sequence record and reset the workflow ready-to-promote state. The workflow itself is kept. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { sequenceId: SEQUENCE_ID, confirm: CONFIRM_PROPERTY },\n required: ['sequenceId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this API sequence');\n return {\n method: 'DELETE',\n path: `/api-sequences/${pathSeg(args.sequenceId, 'sequenceId')}`,\n };\n },\n },\n {\n name: 'cofactor_workflow_api_sequence_set_api_only',\n ...modifying('Set a workflow API-only flag', true),\n description: 'Turn the workflow apiOnly flag on or off.',\n inputSchema: {\n type: 'object',\n properties: {\n workflowId: WORKFLOW_ID,\n apiOnly: { type: 'boolean', description: 'true to make the workflow api-only, false to turn it off' },\n },\n required: ['workflowId', 'apiOnly'],\n },\n request: (args) => {\n if (typeof args.apiOnly !== 'boolean') throw new Error('apiOnly is required');\n return {\n method: 'PUT',\n path: `/workflows/${pathSeg(args.workflowId, 'workflowId')}/api-only`,\n body: { apiOnly: args.apiOnly },\n };\n },\n },\n];\n\nexport const workflowAuthoringGroup = apiToolGroup('workflow-authoring', tools);\n","/**\n * MCP tools for managing test suites, external (customer-repo) runs, and\n * triage.\n *\n * Mirrors `cofactor test-suite suites|create|update|delete|members|set-members|\n * area settings|disable|enable`, `external-run get|diagnosis|rerun|cancel|\n * triage`, and `triage get`. The CLI resolves suite names and flow names to ids\n * first; here the caller passes ids. The CLI's `--yes` becomes `confirm: true`.\n *\n * Skipped: `test-suite create --kind external` and the runner flags of\n * `update` (name lookups plus several requests), `external-run trace|artifacts\n * download` (local files), `external-run failures|skips|artifacts list` (the\n * CLI filters the payload of cofactor_external_run_get), `triage failures`\n * (filters the payload of cofactor_triage_get), `triage wait` (polling).\n * `test-suite executions` is the existing cofactor_test_suite_list.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport {\n type ApiTool,\n CONFIRM_PROPERTY,\n apiToolGroup,\n pathSeg,\n requireConfirm,\n requireString,\n withQuery,\n} from '../api-tool';\n\nconst SUITE_ID = { type: 'string', description: 'The test suite UUID (from cofactor_test_suite_suites)' } as const;\nconst RUN_ID = { type: 'string', description: 'The external run UUID' } as const;\nconst FAILURE_MODE = {\n type: 'string',\n enum: ['continue', 'stop_on_layer_failure'],\n description: 'Whether later layers still run after a layer fails',\n} as const;\n\nfunction suiteWriteBody(args: Record<string, unknown>): Record<string, unknown> {\n const body: Record<string, unknown> = {};\n if (args.name !== undefined) body.name = args.name;\n if (args.description !== undefined) body.description = args.description;\n if (args.failureMode !== undefined) {\n if (args.failureMode !== 'continue' && args.failureMode !== 'stop_on_layer_failure') {\n throw new Error('failureMode must be \"continue\" or \"stop_on_layer_failure\"');\n }\n body.failureMode = args.failureMode;\n }\n return body;\n}\n\nfunction flowIdList(value: unknown, name: string): string[] {\n if (!Array.isArray(value) || value.some((v) => typeof v !== 'string' || !v)) {\n throw new Error(`${name} must be an array of flow UUIDs`);\n }\n return value as string[];\n}\n\n/** Mirrors the CLI's `buildAreaSettingsBody`: `slack`/`email` replace the area's alert destinations. */\nfunction areaSettingsBody(args: Record<string, unknown>): Record<string, unknown> {\n const slack = typeof args.slack === 'string' && args.slack ? args.slack : undefined;\n const emails = typeof args.email === 'string' && args.email ? args.email : undefined;\n const clear = args.noAlerts === true;\n if (clear && (slack || emails)) throw new Error('noAlerts cannot be combined with slack or email');\n if (args.triage !== undefined && args.triage !== 'on' && args.triage !== 'off') {\n throw new Error('triage must be \"on\" or \"off\"');\n }\n const steps = [\n ...(slack ? [{ channel: 'slack', on: ['success', 'failure'], slackChannelId: slack }] : []),\n ...(emails\n ? [\n {\n channel: 'email',\n on: ['success', 'failure'],\n recipients: emails.split(',').map((e) => e.trim()).filter(Boolean),\n },\n ]\n : []),\n ];\n const body = {\n ...(steps.length || clear ? { alertConfig: { steps } } : {}),\n ...(args.triage !== undefined ? { triageEnabled: args.triage === 'on' } : {}),\n };\n if (Object.keys(body).length === 0) {\n throw new Error('Pass slack, email, noAlerts and/or triage');\n }\n return body;\n}\n\nfunction areaPath(args: Record<string, unknown>, tail: string): string {\n return `/test-suites/${pathSeg(args.suiteId, 'suiteId')}/external-runner/areas/${tail}`;\n}\n\nconst AREA = {\n type: 'string',\n description: 'The area: its full path or its last segment, as in cofactor_test_suite_run',\n} as const;\n\n/** Mirrors `external-run rerun`: failedOnly / areaIndex / selection / clearSelection are alternatives. */\nfunction rerunBody(args: Record<string, unknown>): Record<string, unknown> {\n const clear = args.clearSelection === true;\n const hasSelection = Boolean(args.specPath || args.grep);\n const areaIndex = args.areaIndex;\n if (args.failedOnly && (clear || hasSelection)) {\n throw new Error('failedOnly cannot be combined with specPath, grep or clearSelection');\n }\n if (clear && hasSelection) throw new Error('clearSelection cannot be combined with specPath or grep');\n if (areaIndex !== undefined && (clear || hasSelection)) {\n throw new Error('areaIndex cannot be combined with specPath, grep or clearSelection');\n }\n if (args.failedOnly) return { failedOnly: true, ...(areaIndex !== undefined ? { areaIndex } : {}) };\n if (areaIndex !== undefined) return { areaIndex };\n if (clear) return { selection: { specPath: null, grep: null } };\n if (hasSelection) {\n return {\n selection: {\n ...(args.specPath ? { specPath: args.specPath } : {}),\n ...(args.grep ? { grep: args.grep } : {}),\n },\n };\n }\n return {};\n}\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_test_suite_suites',\n ...readOnly('List test suites'),\n description:\n 'List the named test suite definitions (not executions; see cofactor_test_suite_list). Test suites require the suite-builder org feature.',\n inputSchema: { type: 'object', properties: {} },\n request: () => ({ method: 'GET', path: '/test-suites' }),\n },\n {\n name: 'cofactor_test_suite_create',\n ...additive('Create a test suite', false),\n description:\n 'Create a native test suite. Add flows afterwards with cofactor_test_suite_set_members. External suites are not supported here.',\n inputSchema: {\n type: 'object',\n properties: {\n name: { type: 'string', description: 'Suite name' },\n description: { type: 'string', description: 'Suite description' },\n failureMode: FAILURE_MODE,\n },\n required: ['name'],\n },\n request: (args) => {\n const body = suiteWriteBody(args);\n if (typeof body.name !== 'string' || !body.name.trim()) throw new Error('name is required');\n return { method: 'POST', path: '/test-suites', body };\n },\n },\n {\n name: 'cofactor_test_suite_update',\n ...modifying('Update a test suite', true),\n description:\n 'Update a suite’s name, description or failure mode; only the given fields change. An empty description clears it.',\n inputSchema: {\n type: 'object',\n properties: {\n suiteId: SUITE_ID,\n name: { type: 'string', description: 'New name' },\n description: { type: 'string', description: 'New description (empty clears it)' },\n failureMode: FAILURE_MODE,\n },\n required: ['suiteId'],\n },\n request: (args) => {\n const body = suiteWriteBody(args);\n if (Object.keys(body).length === 0) {\n throw new Error('Provide at least one of name, description, failureMode');\n }\n return { method: 'PATCH', path: `/test-suites/${pathSeg(args.suiteId, 'suiteId')}`, body };\n },\n },\n {\n name: 'cofactor_test_suite_delete',\n ...modifying('Delete a test suite', true),\n description:\n 'Delete a test suite. Automations and CLI runs pointing at it will fail afterwards. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { suiteId: SUITE_ID, confirm: CONFIRM_PROPERTY },\n required: ['suiteId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this test suite');\n return { method: 'DELETE', path: `/test-suites/${pathSeg(args.suiteId, 'suiteId')}` };\n },\n },\n {\n name: 'cofactor_test_suite_members',\n ...readOnly('List test suite members'),\n description: 'A suite’s detail including its members by layer (layerIndex null means staging).',\n inputSchema: { type: 'object', properties: { suiteId: SUITE_ID }, required: ['suiteId'] },\n request: (args) => ({ method: 'GET', path: `/test-suites/${pathSeg(args.suiteId, 'suiteId')}` }),\n },\n {\n name: 'cofactor_test_suite_set_members',\n ...modifying('Replace test suite members', true),\n description:\n 'FULL REPLACE of a suite’s members: anything not listed is removed. layers is an ordered list of layers, each a list of flow UUIDs; staging flows are kept but excluded from runs. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n suiteId: SUITE_ID,\n layers: {\n type: 'array',\n items: { type: 'array', items: { type: 'string' } },\n description: 'Layers in run order, each an array of flow UUIDs',\n },\n staging: { type: 'array', items: { type: 'string' }, description: 'Flow UUIDs excluded from runs' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['suiteId', 'layers', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'replace all members of this test suite');\n if (!Array.isArray(args.layers)) throw new Error('layers must be an array of arrays of flow UUIDs');\n const layers = args.layers.map((layer) => flowIdList(layer, 'each layer'));\n const staging = args.staging === undefined ? [] : flowIdList(args.staging, 'staging');\n if (layers.length === 0 && staging.length === 0) throw new Error('Nothing to set');\n return {\n method: 'PUT',\n path: `/test-suites/${pathSeg(args.suiteId, 'suiteId')}/members`,\n body: { layers, staging },\n };\n },\n },\n {\n name: 'cofactor_test_suite_area_settings',\n ...modifying('Set external suite area settings', true),\n description:\n 'Set an external suite area’s own alerts and triage. slack and/or email REPLACE all of the area’s alert destinations (alerts on success and failure); noAlerts clears them; triage turns the area’s triage on or off. Omitted settings are left as they are. Alert destinations are an outward channel (emails/Slack), so this requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n suiteId: SUITE_ID,\n area: AREA,\n slack: { type: 'string', description: 'Slack channel id to alert' },\n email: { type: 'string', description: 'Comma-separated email addresses to alert' },\n noAlerts: { type: 'boolean', description: 'Clear all alert destinations' },\n triage: { type: 'string', enum: ['on', 'off'], description: 'Turn area triage on or off' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['suiteId', 'area', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'change this area\\'s alert settings');\n return {\n method: 'PATCH',\n path: areaPath(args, 'settings'),\n body: { area: requireString(args.area, 'area'), ...areaSettingsBody(args) },\n };\n },\n },\n {\n name: 'cofactor_test_suite_area_disable',\n ...modifying('Turn off an external suite area', true),\n description: 'Turn an external suite area off: it is kept but not run.',\n inputSchema: {\n type: 'object',\n properties: { suiteId: SUITE_ID, area: AREA },\n required: ['suiteId', 'area'],\n },\n request: (args) => ({\n method: 'PUT',\n path: areaPath(args, 'disabled'),\n body: { path: requireString(args.area, 'area'), disabled: true },\n }),\n },\n {\n name: 'cofactor_test_suite_area_enable',\n ...modifying('Turn on an external suite area', true),\n description: 'Turn a previously disabled external suite area back on.',\n inputSchema: {\n type: 'object',\n properties: { suiteId: SUITE_ID, area: AREA },\n required: ['suiteId', 'area'],\n },\n request: (args) => ({\n method: 'PUT',\n path: areaPath(args, 'disabled'),\n body: { path: requireString(args.area, 'area'), disabled: false },\n }),\n },\n {\n name: 'cofactor_external_run_get',\n ...readOnly('Get an external run'),\n description:\n 'The materialized data of an external run: its items, scenarios with verdicts (filter for failed or flaky), skips, and artifacts.',\n inputSchema: { type: 'object', properties: { runId: RUN_ID }, required: ['runId'] },\n request: (args) => ({\n method: 'GET',\n path: `/external-tests/runs/${pathSeg(args.runId, 'runId')}/debug/materialize-data`,\n }),\n },\n {\n name: 'cofactor_external_run_item_get',\n ...readOnly('Get an external run test'),\n description: 'One test of an external run with all its attempts, steps and errors.',\n inputSchema: {\n type: 'object',\n properties: { runId: RUN_ID, itemId: { type: 'string', description: 'The run item UUID' } },\n required: ['runId', 'itemId'],\n },\n request: (args) => ({\n method: 'GET',\n path: `/external-tests/runs/${pathSeg(args.runId, 'runId')}/items/${pathSeg(args.itemId, 'itemId')}`,\n }),\n },\n {\n name: 'cofactor_external_run_diagnosis',\n ...readOnly('Get an external run failure diagnosis'),\n description:\n 'The failure diagnosis of one failed attempt (a failed item id from cofactor_external_run_get). data is null when none exists yet; start one with cofactor_external_run_diagnosis_retrigger.',\n inputSchema: {\n type: 'object',\n properties: {\n runId: RUN_ID,\n itemId: { type: 'string', description: 'The failed run item UUID' },\n thoughts: { type: 'boolean', description: 'Include the agent reasoning trace' },\n },\n required: ['runId', 'itemId'],\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery(\n `/external-tests/runs/${pathSeg(args.runId, 'runId')}/items/${pathSeg(args.itemId, 'itemId')}/failure-diagnostic`,\n { includeThoughts: args.thoughts ? 'true' : undefined }\n ),\n }),\n },\n {\n name: 'cofactor_external_run_diagnosis_retrigger',\n ...additive('Start an external run failure diagnosis', false),\n description:\n 'Queue a new failure diagnosis for a failed attempt of an external run. If one is already running the API reports it; read the result later with cofactor_external_run_diagnosis.',\n inputSchema: {\n type: 'object',\n properties: { runId: RUN_ID, itemId: { type: 'string', description: 'The failed run item UUID' } },\n required: ['runId', 'itemId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/external-tests/runs/${pathSeg(args.runId, 'runId')}/items/${pathSeg(args.itemId, 'itemId')}/failure-diagnostic`,\n }),\n },\n {\n name: 'cofactor_external_run_triage',\n ...readOnly('Get external run triage'),\n description: 'The triage of an external run: ranked findings with the failing runs each cites. triage is null until a run with failures finishes.',\n inputSchema: { type: 'object', properties: { runId: RUN_ID }, required: ['runId'] },\n request: (args) => ({\n method: 'GET',\n path: `/triage/by-external-run/${pathSeg(args.runId, 'runId')}`,\n }),\n },\n {\n name: 'cofactor_external_run_cancel',\n ...modifying('Cancel an external run', true),\n description: 'Cancel an external run and request its containers to stop.',\n inputSchema: { type: 'object', properties: { runId: RUN_ID }, required: ['runId'] },\n request: (args) => ({\n method: 'POST',\n path: `/external-tests/runs/${pathSeg(args.runId, 'runId')}/cancel`,\n }),\n },\n {\n name: 'cofactor_external_run_rerun',\n ...additive('Rerun an external run', false),\n description:\n 'Start a new external run from a previous one and return its runId. With no options it reruns the same selection. Options are alternatives: failedOnly (optionally with areaIndex), areaIndex alone, specPath and/or grep (new selection), or clearSelection.',\n inputSchema: {\n type: 'object',\n properties: {\n runId: RUN_ID,\n failedOnly: { type: 'boolean', description: 'Rerun only the failed tests' },\n areaIndex: { type: 'integer', minimum: 1, description: 'Rerun one area of the previous run (its index in the run’s areas)' },\n specPath: { type: 'string', description: 'Spec path to run instead' },\n grep: { type: 'string', description: 'Test name filter to run instead' },\n clearSelection: { type: 'boolean', description: 'Drop the run’s spec/grep selection and run everything' },\n },\n required: ['runId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/external-tests/runs/${pathSeg(args.runId, 'runId')}/rerun`,\n body: rerunBody(args),\n }),\n },\n {\n name: 'cofactor_triage_get',\n ...readOnly('Get test suite triage'),\n description:\n 'The triage of a test suite execution: ranked failure findings, each with the failing runs it cites and how many are new. triage is null until it exists.',\n inputSchema: {\n type: 'object',\n properties: { executionId: { type: 'string', description: 'The test execution UUID' } },\n required: ['executionId'],\n },\n request: (args) => ({\n method: 'GET',\n path: `/triage/by-execution/${pathSeg(args.executionId, 'executionId')}`,\n }),\n },\n];\n\nexport const testSuiteManagementGroup = apiToolGroup('test-suite-management', tools);\n","/**\n * MCP tools for issue writes: file, add a sighting, edit, close, reopen, merge.\n *\n * Mirrors `cofactor issues create|bump|update|comment|link|unlink|close|reopen|merge`. Reads live in\n * `issues.ts`. `issues tag` resolves tag names client-side over several\n * requests, so it is not a tool: use `cofactor_tag_assign` with tag IDs.\n *\n * Evidence items take a new screenshot as base64 image data, because MCP\n * clients can't hand over local files. It is uploaded through the same\n * `POST /v2/issues/evidence-media` route the CLI's `--screenshot` uses, so the\n * same type, size and org checks apply. An item may instead keep a screenshot\n * the issue already has by citing its `frameStorageKey`; the API refuses a\n * key outside the org. Uploads happen before the write, so a refused write\n * leaves its upload unreferenced (as with the CLI).\n *\n * @module\n */\n\nimport type { FailureDiagnosticEvidence } from '@chatsdet/types/issues';\nimport { additive, modifying, readOnly } from '../annotations';\nimport { type ApiTool, apiToolGroup, pathSeg, requireString, withQuery } from '../api-tool';\nimport { mcpApiRequest } from '../api-client';\nimport { currentToolCtx } from '../context';\nimport {\n EVIDENCE_IMAGE_TYPES,\n WRITABLE_EVIDENCE_KINDS,\n checkEvidenceNumbers,\n editEvidence,\n uploadEvidenceImage,\n writableKind,\n type EvidenceImageType,\n type WritableKind,\n} from '../issue-evidence';\n\nconst ISSUE_ID = { type: 'string', description: 'The issue UUID' } as const;\n\n/** The detail route's largest occurrence page, so occurrenceId can name any recent one. */\nconst OCCURRENCE_PAGE_SIZE = 200;\n\nconst EVIDENCE_ITEM = {\n type: 'object',\n properties: {\n type: { type: 'string', enum: [...WRITABLE_EVIDENCE_KINDS], description: 'Evidence kind' },\n description: { type: 'string', description: 'One sentence saying what this evidence shows' },\n detail: { type: 'string', description: 'Supporting detail (error text, request, values)' },\n frameStorageKey: {\n type: 'string',\n description:\n \"Keep a screenshot the issue already has: the item's frameStorageKey from cofactor_issues_get (instead of screenshot)\",\n },\n screenshot: {\n type: 'object',\n description: 'A new screenshot for this item, uploaded and stored as its frame (10 MB max)',\n properties: {\n data: { type: 'string', description: 'Base64-encoded image bytes' },\n mimeType: { type: 'string', enum: Object.keys(EVIDENCE_IMAGE_TYPES) },\n },\n required: ['data', 'mimeType'],\n },\n },\n required: ['type', 'description'],\n} as const;\n\nconst SIGHTING_PROPERTIES = {\n url: { type: 'string', description: 'Page where the bug lives (or was seen again)' },\n body: { type: 'string', description: 'Freeform Markdown report' },\n runId: {\n type: 'string',\n description: 'Link a workflow run; its fast video and trace are attached server-side',\n },\n assertionKey: {\n type: 'string',\n description:\n 'Link the issue to that failing assertion of runId, so its next failure is recognized as already filed. Requires runId.',\n },\n codeRefs: {\n type: 'array',\n items: { type: 'string' },\n description: 'Defect locations as path or path:line',\n },\n repo: { type: 'string', description: 'Repository for codeRefs' },\n commit: { type: 'string', description: 'Commit for codeRefs' },\n sentry: {\n type: 'array',\n items: { type: 'string' },\n description: 'Sentry issue/trace IDs or URLs',\n },\n logQueries: { type: 'array', items: { type: 'string' }, description: 'Log queries to attach' },\n logSystem: {\n type: 'string',\n enum: ['sentry', 'cloudwatch', 'datadog', 'other'],\n description: 'System the logQueries run against (default other)',\n },\n evidence: { type: 'array', items: EVIDENCE_ITEM, description: 'Evidence items to attach' },\n} as const;\n\nconst LINK_PROPERTIES = {\n capability: {\n type: 'string',\n description:\n 'Product-map capability the bug breaks: a CAP-… code (resolved within the issue\\'s application) or a pcap_ id',\n },\n rule: {\n type: 'string',\n description: 'Narrow the link to one of the capability\\'s rules (a prule_ id). Requires capability.',\n },\n} as const;\n\n/** `{ capability, rule? }` from the flat tool args, or null when neither is given. */\nfunction linkTarget(args: Record<string, unknown>): Record<string, unknown> | null {\n if (args.rule && !args.capability) throw new Error('rule requires capability');\n if (!args.capability) return null;\n return { capability: String(args.capability), ...(args.rule ? { rule: String(args.rule) } : {}) };\n}\n\nfunction requiredLinkTarget(args: Record<string, unknown>): Record<string, unknown> {\n const target = linkTarget(args);\n if (!target) throw new Error('capability is required');\n return target;\n}\n\n/** The `productMapLink` field of a create/bump body, when a capability is given. */\nfunction productMapLink(args: Record<string, unknown>): Record<string, unknown> {\n const target = linkTarget(args);\n return target ? { productMapLink: target } : {};\n}\n\nfunction strings(value: unknown): string[] {\n return Array.isArray(value) ? value.map(String) : [];\n}\n\n/** Same evidence shape the CLI builds from --code-ref / --sentry / --log-query. */\nfunction buildEvidence(args: Record<string, unknown>): Record<string, unknown>[] {\n const evidence: Record<string, unknown>[] = [];\n for (const ref of strings(args.codeRefs)) {\n const match = ref.match(/^(.*?):(\\d+)$/);\n evidence.push({\n type: 'code_reference',\n description: ref,\n path: match ? match[1] : ref,\n ...(match ? { line: Number.parseInt(match[2]!, 10) } : {}),\n ...(args.repo ? { repo: String(args.repo) } : {}),\n ...(args.commit ? { commit: String(args.commit) } : {}),\n });\n }\n for (const value of strings(args.sentry)) {\n evidence.push({\n type: 'log_reference',\n logSystem: 'sentry',\n description: `Sentry ${value}`,\n ...(/^https?:\\/\\//.test(value) ? { url: value } : { logId: value }),\n });\n }\n const logSystem = args.logSystem ? String(args.logSystem) : 'other';\n for (const query of strings(args.logQueries)) {\n evidence.push({ type: 'log_reference', logSystem, description: 'Log query', query });\n }\n return evidence;\n}\n\n/** The upload route's 10 MB limit, as base64 length, so an oversized image is refused before decoding. */\nconst MAX_SCREENSHOT_BASE64_LENGTH = 4 * Math.ceil((10 * 1024 * 1024) / 3);\nconst IMAGE_TYPES = Object.keys(EVIDENCE_IMAGE_TYPES) as EvidenceImageType[];\n\ntype EvidenceItemArg = {\n type: WritableKind;\n description: string;\n detail?: string;\n frameStorageKey?: string;\n screenshot?: { data: string; mimeType: EvidenceImageType };\n};\n\n/** Validate evidence item arguments up front, before anything is uploaded or written. */\nfunction evidenceItems(value: unknown, name: string): EvidenceItemArg[] {\n if (value === undefined) return [];\n if (!Array.isArray(value)) throw new Error(`${name} must be an array of evidence items`);\n return value.map((raw, i) => {\n const at = `${name}[${i}]`;\n const item = (raw ?? {}) as Record<string, unknown>;\n const parsed: EvidenceItemArg = {\n type: writableKind(requireString(item.type, `${at}.type`)),\n description: requireString(item.description, `${at}.description`),\n ...(typeof item.detail === 'string' && item.detail ? { detail: item.detail } : {}),\n };\n if (item.frameStorageKey !== undefined && item.screenshot !== undefined) {\n throw new Error(`${at} takes frameStorageKey or screenshot, not both`);\n }\n if (item.frameStorageKey !== undefined) {\n parsed.frameStorageKey = requireString(item.frameStorageKey, `${at}.frameStorageKey`);\n }\n if (item.screenshot !== undefined) {\n const screenshot = (item.screenshot ?? {}) as Record<string, unknown>;\n const data = requireString(screenshot.data, `${at}.screenshot.data`);\n if (data.length > MAX_SCREENSHOT_BASE64_LENGTH) throw new Error(`${at}.screenshot is over the 10 MB limit`);\n const mimeType = IMAGE_TYPES.find((type) => type === screenshot.mimeType);\n if (!mimeType) throw new Error(`${at}.screenshot.mimeType must be one of ${IMAGE_TYPES.join(', ')}`);\n parsed.screenshot = { data, mimeType };\n }\n return parsed;\n });\n}\n\n/** Upload each item's new screenshot (in order) and return the items as stored evidence. */\nasync function storeEvidence(items: EvidenceItemArg[]): Promise<FailureDiagnosticEvidence[]> {\n const ctx = currentToolCtx();\n if (!ctx) throw new Error('[no-context] evidence upload called outside of withToolCtx()');\n const out: FailureDiagnosticEvidence[] = [];\n for (const [i, { screenshot, ...item }] of items.entries()) {\n if (!screenshot) {\n out.push(item);\n continue;\n }\n const frameStorageKey = await uploadEvidenceImage(ctx.apiUrl, ctx.apiToken, {\n bytes: new Uint8Array(Buffer.from(screenshot.data, 'base64')),\n type: screenshot.mimeType,\n filename: `evidence-${i + 1}${EVIDENCE_IMAGE_TYPES[screenshot.mimeType]}`,\n });\n out.push({ ...item, frameStorageKey });\n }\n return out;\n}\n\nasync function sightingBody(args: Record<string, unknown>): Promise<Record<string, unknown>> {\n if (args.assertionKey && !args.runId) throw new Error('assertionKey requires runId');\n const items = evidenceItems(args.evidence, 'evidence');\n const evidence = [...buildEvidence(args), ...(await storeEvidence(items))];\n return {\n primaryUrl: args.url,\n ...(args.body ? { body: args.body } : {}),\n ...(args.runId ? { runId: args.runId } : {}),\n ...(args.assertionKey ? { subjectAssertionKey: args.assertionKey } : {}),\n ...(evidence.length ? { evidence } : {}),\n ...productMapLink(args),\n };\n}\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_issues_check_duplicates',\n ...readOnly('Check for duplicate issues'),\n description:\n 'Search existing issues by title (up to 10) before filing a new one. Equivalent to `cofactor issues create --check`.',\n inputSchema: {\n type: 'object',\n properties: { title: { type: 'string', description: 'The prospective issue title' } },\n required: ['title'],\n },\n request: (args) => {\n if (!args.title) throw new Error('title is required');\n return { method: 'GET', path: withQuery('/v2/issues', { search: args.title, pageSize: 10 }) };\n },\n },\n {\n name: 'cofactor_issues_create',\n ...additive('File an issue', false),\n description:\n 'File a new issue. Check for duplicates first with cofactor_issues_check_duplicates, and prefer cofactor_issues_bump when the bug is already filed.',\n inputSchema: {\n type: 'object',\n properties: {\n title: { type: 'string', description: 'Issue title' },\n applicationId: { type: 'string', description: 'The application (property) UUID' },\n severity: {\n type: 'string',\n enum: ['low', 'medium', 'high', 'unknown'],\n description: 'Severity (default medium)',\n },\n category: {\n type: 'string',\n description: 'Issue category key (default business_logic_failure)',\n },\n ...SIGHTING_PROPERTIES,\n ...LINK_PROPERTIES,\n },\n required: ['title', 'applicationId', 'url'],\n },\n request: async (args) => {\n if (!args.title) throw new Error('title is required');\n if (!args.applicationId) throw new Error('applicationId is required');\n if (!args.url) throw new Error('url is required');\n return {\n method: 'POST',\n path: '/v2/issues',\n body: {\n propertyId: args.applicationId,\n issueTitle: args.title,\n issueSeverity: args.severity ?? 'medium',\n issueCategoryKey: args.category ?? 'business_logic_failure',\n ...(await sightingBody(args)),\n },\n };\n },\n },\n {\n name: 'cofactor_issues_bump',\n ...additive('Add a sighting to an issue', false),\n description: 'Record that an existing issue was seen again, optionally with a run and evidence.',\n inputSchema: {\n type: 'object',\n properties: { issueId: ISSUE_ID, ...SIGHTING_PROPERTIES, ...LINK_PROPERTIES },\n required: ['issueId', 'url'],\n },\n request: async (args) => {\n if (!args.url) throw new Error('url is required');\n return {\n method: 'POST',\n path: `/v2/issues/${pathSeg(args.issueId, 'issueId')}/occurrences`,\n body: await sightingBody(args),\n };\n },\n },\n {\n name: 'cofactor_issues_update',\n ...modifying('Edit an issue occurrence', false),\n description:\n \"Edit one occurrence of an issue: replace its summary or repro steps, and add, replace, or remove evidence items by the numbers cofactor_issues_get shows. Targets the latest occurrence unless occurrenceId names another (evidence usually lives on the diagnosed one). Evidence can't be edited while the occurrence is being diagnosed or after its diagnosis failed. Each edit is recorded in the issue's audit history.\",\n inputSchema: {\n type: 'object',\n properties: {\n issueId: ISSUE_ID,\n occurrenceId: { type: 'string', description: 'The occurrence to edit (default: the latest)' },\n summary: { type: 'string', description: 'New summary (Markdown)' },\n reproSteps: { type: 'string', description: 'New reproduction steps (Markdown)' },\n addEvidence: { type: 'array', items: EVIDENCE_ITEM, description: 'Evidence items to add' },\n replaceEvidence: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n number: { type: 'number', description: 'The item number to replace, from cofactor_issues_get' },\n item: EVIDENCE_ITEM,\n },\n required: ['number', 'item'],\n },\n description:\n \"Items to replace whole; to keep the item's screenshot, pass its frameStorageKey from cofactor_issues_get\",\n },\n removeEvidence: {\n type: 'array',\n items: { type: 'number' },\n description: 'Item numbers to remove, from cofactor_issues_get',\n },\n },\n required: ['issueId'],\n },\n request: async (args) => {\n const issueId = pathSeg(args.issueId, 'issueId');\n const add = evidenceItems(args.addEvidence, 'addEvidence');\n const arrayArg = (value: unknown, name: string): unknown[] => {\n if (value === undefined) return [];\n if (!Array.isArray(value)) throw new Error(`${name} must be an array`);\n return value;\n };\n const replaceArgs = arrayArg(args.replaceEvidence, 'replaceEvidence') as Array<{\n number?: unknown;\n item?: unknown;\n } | null>;\n const replaceItems = evidenceItems(replaceArgs.map((entry) => entry?.item), 'replaceEvidence');\n const removeArgs = arrayArg(args.removeEvidence, 'removeEvidence');\n const editsEvidence = add.length > 0 || replaceItems.length > 0 || removeArgs.length > 0;\n if (args.summary === undefined && args.reproSteps === undefined && !editsEvidence) {\n throw new Error('nothing to update: pass summary, reproSteps, addEvidence, replaceEvidence, or removeEvidence');\n }\n const body: Record<string, unknown> = {\n ...(args.summary !== undefined ? { summary: args.summary } : {}),\n ...(args.reproSteps !== undefined ? { reproSteps: args.reproSteps } : {}),\n };\n\n // The detail read is needed to default to the latest occurrence and to\n // read the list evidence edits apply to.\n let occurrenceId =\n args.occurrenceId === undefined ? undefined : requireString(args.occurrenceId, 'occurrenceId');\n if (occurrenceId === undefined || editsEvidence) {\n const detail = await mcpApiRequest<{\n data: {\n issue: { latestOccurrence: { id: string } | null };\n occurrences: Array<{ id: string; diagnosticJson: { evidence: FailureDiagnosticEvidence[] } | null }>;\n };\n }>('GET', `/v2/issues/${issueId}?occurrencePageSize=${OCCURRENCE_PAGE_SIZE}`);\n occurrenceId ??= detail.data.issue.latestOccurrence?.id;\n if (!occurrenceId) throw new Error('this issue has no occurrences to edit');\n if (editsEvidence) {\n const occurrence = detail.data.occurrences.find((occ) => occ.id === occurrenceId);\n if (!occurrence) {\n throw new Error(`occurrence ${occurrenceId} is not among the ${OCCURRENCE_PAGE_SIZE} newest of this issue`);\n }\n const current = occurrence.diagnosticJson?.evidence ?? [];\n const numbers = checkEvidenceNumbers(\n current.length,\n replaceArgs.map((entry) => entry?.number),\n removeArgs\n );\n const stored = await storeEvidence([...replaceItems, ...add]);\n body.evidence = editEvidence(current, {\n replace: new Map(numbers.replace.map((n, i) => [n, stored[i]!])),\n remove: new Set(numbers.remove),\n add: stored.slice(numbers.replace.length),\n });\n }\n }\n return {\n method: 'PATCH',\n path: `/v2/issues/${issueId}/occurrences/${pathSeg(occurrenceId, 'occurrenceId')}`,\n body,\n };\n },\n },\n {\n name: 'cofactor_issues_comment',\n ...additive('Comment on an issue', false),\n description:\n 'Add a comment to an issue (up to 4000 characters). Read comments back with cofactor_issues_get. Equivalent to `cofactor issues comment`.',\n inputSchema: {\n type: 'object',\n properties: { issueId: ISSUE_ID, body: { type: 'string', description: 'The comment text' } },\n required: ['issueId', 'body'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/v2/issues/${pathSeg(args.issueId, 'issueId')}/comments`,\n body: { body: requireString(args.body, 'body') },\n }),\n },\n {\n name: 'cofactor_issues_link',\n ...additive('Link an issue to the product map', true),\n description:\n 'Link an issue to the product-map capability (and optionally the rule) it breaks. Re-linking is a no-op. Equivalent to `cofactor issues link`.',\n inputSchema: {\n type: 'object',\n properties: { issueId: ISSUE_ID, ...LINK_PROPERTIES },\n required: ['issueId', 'capability'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/v2/issues/${pathSeg(args.issueId, 'issueId')}/product-map-links`,\n body: requiredLinkTarget(args),\n }),\n },\n {\n name: 'cofactor_issues_unlink',\n ...modifying('Unlink an issue from the product map', true),\n description:\n 'Remove an issue\\'s link to a capability: without rule, every link to that capability (rule links included); with rule, only that rule\\'s link. Equivalent to `cofactor issues unlink`.',\n inputSchema: {\n type: 'object',\n properties: { issueId: ISSUE_ID, ...LINK_PROPERTIES },\n required: ['issueId', 'capability'],\n },\n request: (args) => ({\n method: 'DELETE',\n path: `/v2/issues/${pathSeg(args.issueId, 'issueId')}/product-map-links`,\n body: requiredLinkTarget(args),\n }),\n },\n {\n name: 'cofactor_issues_unlink_workflow',\n ...modifying('Unlink an issue from its workflow', true),\n description:\n 'Detach an issue from the workflow it was filed against: clears the workflow and resets the subject to the whole workflow (drops the node or assertion). Equivalent to `cofactor issues unlink-workflow`.',\n inputSchema: {\n type: 'object',\n properties: { issueId: ISSUE_ID },\n required: ['issueId'],\n },\n request: (args) => ({\n method: 'DELETE',\n path: `/v2/issues/${pathSeg(args.issueId, 'issueId')}/workflow`,\n }),\n },\n {\n name: 'cofactor_issues_close',\n ...modifying('Close an issue', true),\n description:\n 'Close an issue, or mark it not-a-bug (notABug=true, which requires a reason that is recorded as the intended behavior).',\n inputSchema: {\n type: 'object',\n properties: {\n issueId: ISSUE_ID,\n notABug: { type: 'boolean', description: 'Mark as not-a-bug instead of closed' },\n reason: { type: 'string', description: 'Why it is working as intended (required with notABug)' },\n },\n required: ['issueId'],\n },\n request: (args) => {\n const reason = typeof args.reason === 'string' ? args.reason.trim() : '';\n if (args.notABug && !reason) throw new Error('notABug requires a reason');\n return {\n method: 'PATCH',\n path: `/issues/${pathSeg(args.issueId, 'issueId')}/status`,\n body: args.notABug\n ? { status: 'not_a_bug', intendedBehavior: reason }\n : { status: 'closed' },\n };\n },\n },\n {\n name: 'cofactor_issues_reopen',\n ...modifying('Reopen an issue', true),\n description: 'Reopen a closed issue (clears a duplicate link).',\n inputSchema: {\n type: 'object',\n properties: { issueId: ISSUE_ID },\n required: ['issueId'],\n },\n request: (args) => ({\n method: 'PATCH',\n path: `/issues/${pathSeg(args.issueId, 'issueId')}/status`,\n body: { status: 'open' },\n }),\n },\n {\n name: 'cofactor_issues_merge',\n ...modifying('Merge a duplicate issue', true),\n description:\n 'Close one issue as a duplicate of a canonical issue: its tags are copied to the canonical issue and later sightings land there. Call once per duplicate.',\n inputSchema: {\n type: 'object',\n properties: {\n duplicateId: { type: 'string', description: 'The duplicate issue UUID to close' },\n canonicalId: { type: 'string', description: 'The canonical issue UUID to keep' },\n },\n required: ['duplicateId', 'canonicalId'],\n },\n request: (args) => {\n if (!args.canonicalId) throw new Error('canonicalId is required');\n return {\n method: 'POST',\n path: `/v2/issues/${pathSeg(args.duplicateId, 'duplicateId')}/duplicate`,\n body: { canonicalIssueId: args.canonicalId },\n };\n },\n },\n];\n\nexport const issuesManagementGroup = apiToolGroup('issues-management', tools);\n","/**\n * MCP tools for tags: CRUD, assignment to entities, and per-entity lookup.\n *\n * Mirrors `cofactor tag list|create|update|delete|assign|for`.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport {\n type ApiTool,\n CONFIRM_PROPERTY,\n apiToolGroup,\n pathSeg,\n requireConfirm,\n} from '../api-tool';\n\nconst TAG_COLORS = [\n 'red',\n 'orange',\n 'yellow',\n 'green',\n 'teal',\n 'blue',\n 'indigo',\n 'purple',\n 'pink',\n 'gray',\n] as const;\nconst ENTITY_TYPES = ['issue', 'workflow', 'attachment'] as const;\n\nconst TAG_ID = { type: 'string', description: 'The tag UUID' } as const;\nconst COLOR = { type: 'string', enum: [...TAG_COLORS], description: 'Tag color' } as const;\nconst DESCRIPTION = { type: 'string', description: 'Tag description' } as const;\nconst ENTITY_TYPE = { type: 'string', enum: [...ENTITY_TYPES], description: 'Kind of entity' } as const;\nconst ENTITY_ID = { type: 'string', description: 'The entity UUID' } as const;\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_tag_list',\n ...readOnly('List tags'),\n description: 'List the organization tags, optionally with usage statistics.',\n inputSchema: {\n type: 'object',\n properties: { withStats: { type: 'boolean', description: 'Include per-tag usage counts' } },\n },\n request: (args) => ({ method: 'GET', path: args.withStats ? '/org/tags/stats' : '/org/tags' }),\n },\n {\n name: 'cofactor_tag_create',\n ...additive('Create a tag', false),\n description: 'Create a tag with a name and color.',\n inputSchema: {\n type: 'object',\n properties: { name: { type: 'string', description: 'Tag name' }, color: COLOR, description: DESCRIPTION },\n required: ['name', 'color'],\n },\n request: (args) => ({\n method: 'POST',\n path: '/org/tags',\n body: { name: args.name, color: args.color, ...(args.description ? { description: args.description } : {}) },\n }),\n },\n {\n name: 'cofactor_tag_update',\n ...modifying('Update a tag', true),\n description: 'Rename a tag or change its color or description. Pass at least one field.',\n inputSchema: {\n type: 'object',\n properties: { tagId: TAG_ID, name: { type: 'string', description: 'New name' }, color: COLOR, description: DESCRIPTION },\n required: ['tagId'],\n },\n request: (args) => {\n const body: Record<string, unknown> = {};\n if (args.name) body.name = args.name;\n if (args.color) body.color = args.color;\n if (args.description !== undefined) body.description = args.description;\n if (Object.keys(body).length === 0) {\n throw new Error('Provide at least one of: name, color, description');\n }\n return { method: 'PUT', path: `/org/tags/${pathSeg(args.tagId, 'tagId')}`, body };\n },\n },\n {\n name: 'cofactor_tag_delete',\n ...modifying('Delete a tag', true),\n description: 'Delete a tag. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { tagId: TAG_ID, confirm: CONFIRM_PROPERTY },\n required: ['tagId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this tag');\n return { method: 'DELETE', path: `/org/tags/${pathSeg(args.tagId, 'tagId')}` };\n },\n },\n {\n name: 'cofactor_tag_assign',\n ...modifying('Set the tags on an entity', true),\n description:\n 'Replace the full set of tags on an issue, workflow, or attachment with the given tag IDs (an empty list clears them all). Read the current tags first with cofactor_tag_for to add or remove one. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n entityType: ENTITY_TYPE,\n entityId: ENTITY_ID,\n tagIds: { type: 'array', items: { type: 'string' }, description: 'The complete list of tag UUIDs' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['entityType', 'entityId', 'tagIds', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'replace the tags on this entity');\n if (!Array.isArray(args.tagIds)) throw new Error('tagIds is required');\n return {\n method: 'PUT',\n path: '/org/tags/entity',\n body: { entityType: args.entityType, entityId: args.entityId, tagIds: args.tagIds },\n };\n },\n },\n {\n name: 'cofactor_tag_for',\n ...readOnly('List tags on an entity'),\n description: 'List the tags currently on an issue, workflow, or attachment.',\n inputSchema: {\n type: 'object',\n properties: { entityType: ENTITY_TYPE, entityId: ENTITY_ID },\n required: ['entityType', 'entityId'],\n },\n request: (args) => ({\n method: 'GET',\n path: `/org/tags/entity/${pathSeg(args.entityType, 'entityType')}/${pathSeg(args.entityId, 'entityId')}`,\n }),\n },\n];\n\nexport const tagsGroup = apiToolGroup('tags', tools);\n","/**\n * MCP tools for organization content: attachments, digests, prompt library,\n * org info, gists, and stored objects.\n *\n * Mirrors `cofactor attachment list|get|delete`, `digest list|get`,\n * `prompts list|get|create|update|delete`, `orgs` / `orgs members`, and\n * `utilities gist create|list|get|delete` / `utilities object list|url|delete`\n * / `utilities email|slack`. Uploads are not tools. Prompt and gist content is\n * passed inline rather than read from files. Email and Slack go to org members\n * only (the API refuses anyone else) and need confirm=true.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport {\n type ApiTool,\n CONFIRM_PROPERTY,\n apiToolGroup,\n pathSeg,\n requireConfirm,\n requireString,\n withQuery,\n} from '../api-tool';\n\nconst RECIPIENTS = {\n type: 'array',\n items: { type: 'string' },\n minItems: 1,\n maxItems: 50,\n description: 'Organization members to send to, each by email address or display name (see cofactor_orgs_members_list)',\n} as const;\n\nconst PAGE = { type: 'number', description: 'Page number (default 1)' } as const;\nconst PAGE_SIZE = { type: 'number', description: 'Page size (default 25)' } as const;\nconst idProp = (what: string) => ({ type: 'string', description: `The ${what} id` }) as const;\n\nconst tools: ApiTool[] = [\n // Attachments\n {\n name: 'cofactor_attachment_list',\n ...readOnly('List attachments'),\n description: 'List uploaded attachments.',\n inputSchema: {\n type: 'object',\n properties: {\n kind: { type: 'string', enum: ['all', 'image', 'pdf', 'spreadsheet', 'data'], description: 'Filter by kind (default all)' },\n search: { type: 'string', description: 'Search by filename' },\n page: PAGE,\n pageSize: PAGE_SIZE,\n },\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery('/org/attachments', {\n kind: args.kind,\n search: args.search,\n page: args.page,\n pageSize: args.pageSize,\n }),\n }),\n },\n {\n name: 'cofactor_attachment_get',\n ...readOnly('Get an attachment'),\n description: 'Get attachment metadata, or with url=true a signed download URL.',\n inputSchema: {\n type: 'object',\n properties: {\n attachmentId: idProp('attachment'),\n url: { type: 'boolean', description: 'Return a signed URL instead of metadata' },\n },\n required: ['attachmentId'],\n },\n request: (args) =>\n args.url\n ? { method: 'GET', path: `/org/attachments/${pathSeg(args.attachmentId, 'attachmentId')}/url` }\n : {\n // No by-id metadata endpoint exists; the CLI uses bulk resolve (a read).\n method: 'POST',\n path: '/org/attachments/resolve',\n body: { ids: [requireString(args.attachmentId, 'attachmentId')] },\n },\n },\n {\n name: 'cofactor_attachment_delete',\n ...modifying('Delete an attachment', true),\n description: 'Soft-delete an attachment. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { attachmentId: idProp('attachment'), confirm: CONFIRM_PROPERTY },\n required: ['attachmentId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this attachment');\n return { method: 'DELETE', path: `/org/attachments/${pathSeg(args.attachmentId, 'attachmentId')}` };\n },\n },\n // Digests\n {\n name: 'cofactor_digest_list',\n ...readOnly('List digests'),\n description: 'List generated digests, newest first.',\n inputSchema: { type: 'object', properties: { page: PAGE, pageSize: PAGE_SIZE } },\n request: (args) => ({\n method: 'GET',\n path: withQuery('/digests', { page: args.page, pageSize: args.pageSize }),\n }),\n },\n {\n name: 'cofactor_digest_get',\n ...readOnly('Get a digest'),\n description: 'Get one digest with its full detail.',\n inputSchema: {\n type: 'object',\n properties: { digestId: idProp('digest (dig_ id or UUID)') },\n required: ['digestId'],\n },\n request: (args) => ({ method: 'GET', path: `/digests/${pathSeg(args.digestId, 'digestId')}` }),\n },\n // Prompt library\n {\n name: 'cofactor_prompts_list',\n ...readOnly('List prompts'),\n description: 'List the global prompts plus the organization prompts.',\n inputSchema: { type: 'object', properties: {} },\n request: () => ({ method: 'GET', path: '/prompts' }),\n },\n {\n name: 'cofactor_prompts_get',\n ...readOnly('Get a prompt'),\n description: 'Get a prompt, including its content, by slug or id.',\n inputSchema: {\n type: 'object',\n properties: { prompt: { type: 'string', description: 'The prompt slug or id' } },\n required: ['prompt'],\n },\n request: (args) => ({ method: 'GET', path: `/prompts/${pathSeg(args.prompt, 'prompt')}` }),\n },\n {\n name: 'cofactor_prompts_create',\n ...additive('Create a prompt', false),\n description: 'Create a prompt in the organization library. global=true creates a Cofactor-wide prompt (superadmin only).',\n inputSchema: {\n type: 'object',\n properties: {\n title: { type: 'string', description: 'Prompt title' },\n content: { type: 'string', description: 'Prompt content (Markdown)' },\n description: { type: 'string', description: 'Short description' },\n global: { type: 'boolean', description: 'Create a global prompt (superadmin only)' },\n },\n required: ['title', 'content'],\n },\n request: (args) => ({\n method: 'POST',\n path: '/prompts',\n body: {\n title: args.title,\n content: args.content,\n scope: args.global ? 'global' : 'org',\n ...(args.description ? { description: args.description } : {}),\n },\n }),\n },\n {\n name: 'cofactor_prompts_update',\n ...modifying('Update a prompt', true),\n description:\n 'Patch a prompt: only the fields you pass change. globalTags sets the tags of a global prompt (superadmin only; [] clears them).',\n inputSchema: {\n type: 'object',\n properties: {\n promptId: idProp('prompt'),\n title: { type: 'string', description: 'New title' },\n content: { type: 'string', description: 'New content (Markdown)' },\n description: { type: 'string', description: 'New description' },\n globalTags: { type: 'array', items: { type: 'string' }, description: 'Replacement tags for a global prompt' },\n },\n required: ['promptId'],\n },\n request: (args) => {\n const body: Record<string, unknown> = {};\n for (const key of ['content', 'title', 'description', 'globalTags'] as const) {\n if (args[key] !== undefined) body[key] = args[key];\n }\n if (Object.keys(body).length === 0) throw new Error('Nothing to update');\n return { method: 'PUT', path: `/prompts/${pathSeg(args.promptId, 'promptId')}`, body };\n },\n },\n {\n name: 'cofactor_prompts_delete',\n ...modifying('Delete a prompt', true),\n description: 'Delete one of the organization prompts. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { promptId: idProp('prompt'), confirm: CONFIRM_PROPERTY },\n required: ['promptId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this prompt');\n return { method: 'DELETE', path: `/prompts/${pathSeg(args.promptId, 'promptId')}` };\n },\n },\n // Organizations\n {\n name: 'cofactor_orgs_list',\n ...readOnly('List organizations'),\n description: 'List the organizations the current user belongs to.',\n inputSchema: { type: 'object', properties: {} },\n request: () => ({ method: 'GET', path: '/cli-login/orgs' }),\n },\n {\n name: 'cofactor_orgs_members_list',\n ...readOnly('List organization members'),\n description: 'List members of the current organization with their role and whether Slack is linked.',\n inputSchema: { type: 'object', properties: {} },\n request: () => ({ method: 'GET', path: '/org/members' }),\n },\n // Gists\n {\n name: 'cofactor_utilities_gist_create',\n ...additive('Create a gist', false),\n description:\n 'Publish a gist: text or Markdown viewable in the web app. Private by default; visibility=public makes it reachable by link without login.',\n inputSchema: {\n type: 'object',\n properties: {\n title: { type: 'string', description: 'Gist title (default \"Untitled gist\")' },\n content: { type: 'string', description: 'The gist content' },\n format: { type: 'string', enum: ['markdown', 'text'], description: 'Content format (default markdown)' },\n visibility: { type: 'string', enum: ['private', 'public'], description: 'Visibility (default private)' },\n ttlSeconds: { type: 'number', description: 'Expire after this many seconds' },\n },\n required: ['content'],\n },\n request: (args) => {\n if (typeof args.content !== 'string') throw new Error('content is required');\n return {\n method: 'POST',\n path: '/org/utilities/gists',\n body: {\n title: args.title || 'Untitled gist',\n content: args.content,\n format: args.format ?? 'markdown',\n visibility: args.visibility ?? 'private',\n ...(args.ttlSeconds ? { ttlSeconds: args.ttlSeconds } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_utilities_gist_list',\n ...readOnly('List gists'),\n description: 'List gists, optionally filtered by search text.',\n inputSchema: {\n type: 'object',\n properties: { search: { type: 'string', description: 'Search query' } },\n },\n request: (args) => ({ method: 'GET', path: withQuery('/org/utilities/gists', { search: args.search }) }),\n },\n {\n name: 'cofactor_utilities_gist_get',\n ...readOnly('Get a gist'),\n description: 'Get a gist with its content and link.',\n inputSchema: {\n type: 'object',\n properties: { gistId: idProp('gist') },\n required: ['gistId'],\n },\n request: (args) => ({ method: 'GET', path: `/org/utilities/gists/${pathSeg(args.gistId, 'gistId')}` }),\n },\n {\n name: 'cofactor_utilities_gist_delete',\n ...modifying('Delete a gist', true),\n description: 'Delete a gist. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { gistId: idProp('gist'), confirm: CONFIRM_PROPERTY },\n required: ['gistId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this gist');\n return { method: 'DELETE', path: `/org/utilities/gists/${pathSeg(args.gistId, 'gistId')}` };\n },\n },\n // Messaging\n {\n name: 'cofactor_utilities_email_send',\n ...additive('Email organization members', false),\n description:\n 'Send a one-off email to members of this organization. Recipients outside the organization are refused. Show the user the full text before asking for confirm. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n recipients: RECIPIENTS,\n subject: { type: 'string', description: 'Subject (up to 200 characters)' },\n body: { type: 'string', description: 'Plain-text body' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['recipients', 'subject', 'body', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'email these people');\n return {\n method: 'POST',\n path: '/org/utilities/email',\n body: {\n recipients: args.recipients,\n subject: requireString(args.subject, 'subject'),\n body: requireString(args.body, 'body'),\n },\n };\n },\n },\n {\n name: 'cofactor_utilities_slack_send',\n ...additive('Slack-message organization members', false),\n description:\n 'Send a one-off Slack direct message to members of this organization who have linked Slack. Recipients outside the organization are refused. Show the user the full text before asking for confirm. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n recipients: RECIPIENTS,\n body: { type: 'string', description: 'Message text' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['recipients', 'body', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'Slack-message these people');\n return {\n method: 'POST',\n path: '/org/utilities/slack',\n body: { recipients: args.recipients, body: requireString(args.body, 'body') },\n };\n },\n },\n // Objects\n {\n name: 'cofactor_utilities_object_list',\n ...readOnly('List stored objects'),\n description: 'List uploaded objects (images, videos, files).',\n inputSchema: {\n type: 'object',\n properties: {\n kind: { type: 'string', enum: ['image', 'video', 'data', 'all'], description: 'Filter by kind' },\n search: { type: 'string', description: 'Search query' },\n },\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery('/org/utilities/objects', { kind: args.kind, search: args.search }),\n }),\n },\n {\n name: 'cofactor_utilities_object_url',\n ...readOnly('Get a stored object link'),\n description: 'Get a shareable or signed link for an object; download=true forces a download.',\n inputSchema: {\n type: 'object',\n properties: {\n objectId: idProp('object'),\n download: { type: 'boolean', description: 'Link that downloads instead of displaying' },\n },\n required: ['objectId'],\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery(`/org/utilities/objects/${pathSeg(args.objectId, 'objectId')}/url`, {\n dl: args.download ? 1 : undefined,\n }),\n }),\n },\n {\n name: 'cofactor_utilities_object_delete',\n ...modifying('Delete a stored object', true),\n description: 'Delete an uploaded object. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { objectId: idProp('object'), confirm: CONFIRM_PROPERTY },\n required: ['objectId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this object');\n return { method: 'DELETE', path: `/org/utilities/objects/${pathSeg(args.objectId, 'objectId')}` };\n },\n },\n];\n\nexport const contentGroup = apiToolGroup('content', tools);\n","/** Builds a request body from the listed tool arguments, omitting the ones the caller left out. */\nexport function pickDefined(\n args: Record<string, unknown>,\n keys: readonly string[]\n): Record<string, unknown> {\n const body: Record<string, unknown> = {};\n for (const key of keys) {\n if (args[key] !== undefined) body[key] = args[key];\n }\n return body;\n}\n","/**\n * MCP tools for application setup: applications, their GitHub repo links, and\n * their environments.\n *\n * Mirrors `cofactor application list|create|update|repo link|update|unlink` and\n * `cofactor environment list|create|set-default`. The CLI resolves names to ids\n * with an extra list call; these tools take ids, so each is one request.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport { type ApiTool, CONFIRM_PROPERTY, apiToolGroup, pathSeg, requireConfirm } from '../api-tool';\nimport { pickDefined } from './body';\n\nconst APPLICATION_ID = {\n type: 'string',\n description: 'Application UUID, as returned by cofactor_application_list (a raw UUID, not a prop_... id)',\n} as const;\nconst ENVIRONMENT_ID = {\n type: 'string',\n description: 'The environment id (from cofactor_environment_list)',\n} as const;\n\nconst applicationTools: ApiTool[] = [\n {\n name: 'cofactor_application_list',\n ...readOnly('List applications'),\n description: 'List the applications in the current organization with their ids and base URLs.',\n inputSchema: { type: 'object', properties: {} },\n request: () => ({ method: 'GET', path: '/org/properties' }),\n },\n {\n name: 'cofactor_application_create',\n ...additive('Create an application', false),\n description:\n 'Create an application with a default \"production\" environment at the given base URL. Environment variables are declared here by name; their values are set per environment.',\n inputSchema: {\n type: 'object',\n properties: {\n name: { type: 'string', description: 'Application name' },\n baseUrl: { type: 'string', description: 'Application base URL' },\n description: { type: 'string', description: 'Optional description' },\n agentContext: { type: 'string', description: 'Optional agent context (max 8000 chars)' },\n loginPath: {\n type: 'string',\n description: 'Relative login page path appended to the environment URL, e.g. /login',\n },\n envVarDefinitions: {\n type: 'array',\n description:\n 'Per-environment variables to declare; injected at run time as $var.ENV.<name>',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n sensitive: { type: 'boolean', description: 'Mask the value everywhere it is shown' },\n },\n required: ['name'],\n },\n },\n },\n required: ['name', 'baseUrl'],\n },\n request: (args) => ({\n method: 'POST',\n path: '/org/properties',\n body: {\n name: args.name,\n defaultEnvironment: { name: 'production', url: args.baseUrl },\n ...pickDefined(args, ['description', 'agentContext', 'loginPath', 'envVarDefinitions']),\n },\n }),\n },\n {\n name: 'cofactor_application_update',\n ...modifying('Update an application', true),\n description:\n 'Update application settings. Pass only the fields to change; an empty loginPath clears it.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n loginPath: { type: 'string', description: 'Relative login page path (empty string clears it)' },\n description: { type: 'string', description: 'The description' },\n agentContext: { type: 'string', description: 'The agent context' },\n },\n required: ['applicationId'],\n },\n request: (args) => ({\n method: 'PUT',\n path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}`,\n body: pickDefined(args, ['loginPath', 'description', 'agentContext']),\n }),\n },\n {\n name: 'cofactor_application_repo_link',\n ...additive('Link a GitHub repo to an application', false),\n description: 'Link a GitHub repo to an application so the planner agent can read its source.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n repo: { type: 'string', description: 'Repo full name, owner/name' },\n role: { type: 'string', description: 'Conventional role, e.g. frontend or backend' },\n rootDir: { type: 'string', description: 'Monorepo subdirectory hint' },\n agentHint: { type: 'string', description: 'Free-form hint for the planner agent' },\n },\n required: ['applicationId', 'repo'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/github-repos`,\n body: { repoFullName: args.repo, ...pickDefined(args, ['role', 'rootDir', 'agentHint']) },\n }),\n },\n {\n name: 'cofactor_application_repo_update',\n ...modifying('Update an application repo link', true),\n description: 'Update the role, root directory, or agent hint of an existing repo link.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n repoId: { type: 'string', description: 'The repo link UUID' },\n role: { type: 'string', description: 'Conventional role, e.g. frontend or backend' },\n rootDir: { type: 'string', description: 'Monorepo subdirectory hint' },\n agentHint: { type: 'string', description: 'Free-form hint for the planner agent' },\n },\n required: ['applicationId', 'repoId'],\n },\n request: (args) => ({\n method: 'PATCH',\n path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/github-repos/${pathSeg(args.repoId, 'repoId')}`,\n body: pickDefined(args, ['role', 'rootDir', 'agentHint']),\n }),\n },\n {\n name: 'cofactor_application_repo_unlink',\n ...modifying('Unlink a GitHub repo from an application', true),\n description: 'Remove the link between a GitHub repo and an application. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n repo: { type: 'string', description: 'Repo full name, owner/name' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['applicationId', 'repo', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'unlink this repository');\n return {\n method: 'DELETE',\n path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/github-repos/${pathSeg(args.repo, 'repo')}`,\n };\n },\n },\n];\n\nconst environmentTools: ApiTool[] = [\n {\n name: 'cofactor_environment_list',\n ...readOnly('List environments'),\n description:\n 'List the environments of an application, including type, URL, default flag, and variable values (sensitive values arrive masked).',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID },\n required: ['applicationId'],\n },\n request: (args) => ({\n method: 'GET',\n path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/environments`,\n }),\n },\n {\n name: 'cofactor_environment_create',\n ...additive('Create an environment', false),\n description:\n 'Create an environment for an application. Needs a url unless type is sandbox, which needs sandboxTemplateId. Sandboxes v2 environments come from the repo definition, not from here.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n name: { type: 'string', description: 'Environment name' },\n type: {\n type: 'string',\n enum: ['permanent', 'ephemeral', 'local', 'sandbox'],\n description: 'Environment type (default permanent)',\n },\n url: { type: 'string', description: 'Base URL; required unless type is sandbox' },\n sandboxTemplateId: { type: 'string', description: 'Backing template UUID; required for type sandbox' },\n loginPath: { type: 'string', description: 'Per-environment login path override' },\n description: { type: 'string', description: 'Optional description' },\n environmentKindId: { type: 'string', description: 'Shared deployment stage id (UUID)' },\n environmentKindName: {\n type: 'string',\n description: 'Shared deployment stage by name, e.g. staging; use instead of environmentKindId',\n },\n isDefault: { type: 'boolean', description: 'Make this the application default environment' },\n },\n required: ['applicationId', 'name'],\n },\n request: (args) => {\n const type = args.type ?? 'permanent';\n if (type === 'sandbox' && !args.sandboxTemplateId) {\n throw new Error('type sandbox needs sandboxTemplateId');\n }\n if (type !== 'sandbox' && !args.url) throw new Error(`url is required for type ${String(type)}`);\n return {\n method: 'POST',\n path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/environments`,\n body: {\n name: args.name,\n type,\n ...pickDefined(args, [\n 'url',\n 'sandboxTemplateId',\n 'loginPath',\n 'description',\n 'environmentKindId',\n 'environmentKindName',\n ]),\n ...(args.isDefault ? { isDefault: true } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_environment_set_default',\n ...modifying('Set the default environment', true),\n description: 'Make an environment the default for its application.',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID, environmentId: ENVIRONMENT_ID },\n required: ['applicationId', 'environmentId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/environments/${pathSeg(args.environmentId, 'environmentId')}/set-default`,\n }),\n },\n];\n\nexport const applicationsGroup = apiToolGroup('applications', applicationTools);\nexport const environmentsGroup = apiToolGroup('environments', environmentTools);\n","/**\n * MCP tools for personas (credential templates) and credentials.\n *\n * Mirrors `cofactor persona list|create|show|rename|delete|link|unlink` and\n * `cofactor credential get|create|update`. The credential list stays in\n * `credentials.ts`. Secret values accepted here are stored encrypted and are\n * never echoed back by these tools.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport { type ApiTool, CONFIRM_PROPERTY, apiToolGroup, pathSeg, requireConfirm } from '../api-tool';\nimport { pickDefined } from './body';\n\nconst APPLICATION_ID = {\n type: 'string',\n description: 'Application UUID, as returned by cofactor_application_list (a raw UUID, not a prop_... id)',\n} as const;\nconst PERSONA_ID = { type: 'string', description: 'The persona id' } as const;\nconst CREDENTIAL_ID = { type: 'string', description: 'The credential id' } as const;\nconst SECRET = 'value is stored as a secret; never echo it back';\n\nfunction personaPath(args: Record<string, unknown>): string {\n return `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/credential-templates`;\n}\n\nfunction credentialsPath(args: Record<string, unknown>): string {\n return `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/credentials`;\n}\n\n/**\n * The credential `data` fields that are safe to show. The API returns the\n * decrypted `data` to any org member (the CLI prints it); a model's context\n * is a wider audience than a terminal, so password, mfaSecret, apiKey and\n * custom headers are dropped here.\n */\nconst SHOWN_CREDENTIAL_DATA = ['username', 'email', 'user', 'name', 'startUrl', 'signInButtonSelector'];\n\nfunction withoutSecrets(result: unknown): unknown {\n const body = result as { credential?: { data?: unknown; metadata?: unknown } };\n if (!body.credential) return result;\n const data = body.credential.data;\n const shown =\n data !== null && typeof data === 'object'\n ? Object.fromEntries(Object.entries(data).filter(([key]) => SHOWN_CREDENTIAL_DATA.includes(key)))\n : {};\n // metadata (API-login token request templates) can hold literal secrets, so it is dropped whole.\n const { metadata: _metadata, ...rest } = body.credential;\n return { ...body, credential: { ...rest, data: shown } };\n}\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_persona_list',\n ...readOnly('List personas'),\n description: 'List the personas (logical user identities) on an application.',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID },\n required: ['applicationId'],\n },\n request: (args) => ({ method: 'GET', path: personaPath(args) }),\n },\n {\n name: 'cofactor_persona_create',\n ...additive('Create a persona', false),\n description:\n 'Create a persona on an application. Declared variables are filled per credential and injected at run time as $var.USER.<name>.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n name: { type: 'string', description: 'Persona name' },\n description: { type: 'string', description: 'Optional description' },\n variableDefinitions: {\n type: 'array',\n description: 'Variables the persona declares',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n description: { type: 'string' },\n sensitive: { type: 'boolean', description: 'Mask the value everywhere it is shown' },\n },\n required: ['name'],\n },\n },\n },\n required: ['applicationId', 'name'],\n },\n request: (args) => ({\n method: 'POST',\n path: personaPath(args),\n body: {\n name: args.name,\n description: args.description ?? null,\n ...pickDefined(args, ['variableDefinitions']),\n },\n }),\n },\n {\n name: 'cofactor_persona_show',\n ...readOnly('Show a persona'),\n description: 'Show a persona with its declared variables and credential bindings.',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID, personaId: PERSONA_ID },\n required: ['applicationId', 'personaId'],\n },\n request: (args) => ({\n method: 'GET',\n path: `${personaPath(args)}/${pathSeg(args.personaId, 'personaId')}`,\n }),\n },\n {\n name: 'cofactor_persona_rename',\n ...modifying('Rename a persona', true),\n description: 'Rename a persona.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n personaId: PERSONA_ID,\n name: { type: 'string', description: 'The new name' },\n },\n required: ['applicationId', 'personaId', 'name'],\n },\n request: (args) => ({\n method: 'PATCH',\n path: `${personaPath(args)}/${pathSeg(args.personaId, 'personaId')}`,\n body: { name: args.name },\n }),\n },\n {\n name: 'cofactor_persona_delete',\n ...modifying('Delete a persona', true),\n description: 'Delete a persona and its credential bindings. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID, personaId: PERSONA_ID, confirm: CONFIRM_PROPERTY },\n required: ['applicationId', 'personaId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this persona');\n return {\n method: 'DELETE',\n path: `${personaPath(args)}/${pathSeg(args.personaId, 'personaId')}`,\n };\n },\n },\n {\n name: 'cofactor_persona_link',\n ...additive('Link a credential to a persona', true),\n description: 'Bind a credential to a persona.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n personaId: PERSONA_ID,\n credentialId: CREDENTIAL_ID,\n },\n required: ['applicationId', 'personaId', 'credentialId'],\n },\n request: (args) => ({\n method: 'POST',\n path: `${personaPath(args)}/${pathSeg(args.personaId, 'personaId')}/bindings`,\n body: { credentialId: args.credentialId },\n }),\n },\n {\n name: 'cofactor_persona_unlink',\n ...modifying('Unlink a credential from a persona', true),\n description: 'Remove the binding between a credential and a persona. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n personaId: PERSONA_ID,\n credentialId: CREDENTIAL_ID,\n confirm: CONFIRM_PROPERTY,\n },\n required: ['applicationId', 'personaId', 'credentialId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'unlink this credential from the persona');\n return {\n method: 'DELETE',\n path: `${personaPath(args)}/${pathSeg(args.personaId, 'personaId')}/bindings/${pathSeg(args.credentialId, 'credentialId')}`,\n };\n },\n },\n {\n name: 'cofactor_credential_get',\n ...readOnly('Get a credential'),\n description:\n 'Get one credential: login URL, login instructions, session verification guidance, role, persona binding, and the non-secret login fields (username or email). Passwords, MFA seeds, API keys, custom headers, and API-login metadata are never returned here, sensitive persona variable values are masked, and free-text fields (notes, login instructions) are returned as stored.',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID, credentialId: CREDENTIAL_ID },\n required: ['applicationId', 'credentialId'],\n },\n request: (args) => ({\n method: 'GET',\n path: `${credentialsPath(args)}/${pathSeg(args.credentialId, 'credentialId')}`,\n }),\n narrow: withoutSecrets,\n },\n {\n name: 'cofactor_credential_create',\n ...additive('Create a credential', false),\n description:\n 'Create a credential on an application. Either pass username/password/apiKey/mfaSecret, or set testSignIn=true with email and testUserName (Cofactor signs the test user in as the app\\'s OIDC provider). Secrets are stored encrypted and never returned.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n name: { type: 'string', description: 'Credential name' },\n loginInstructions: { type: 'string', description: 'Login instructions' },\n sessionVerificationGuidance: {\n type: 'string',\n description: 'What usable authenticated access looks like',\n },\n username: { type: 'string', description: 'Username (stored encrypted)' },\n password: { type: 'string', description: `Password; ${SECRET}` },\n apiKey: { type: 'string', description: `API key; ${SECRET}` },\n mfaSecret: { type: 'string', description: `MFA seed; ${SECRET}` },\n variableValues: {\n type: 'object',\n additionalProperties: { type: 'string' },\n description: `Values for the bound persona's variables (name to value); ${SECRET}`,\n },\n testSignIn: {\n type: 'boolean',\n description: 'Create a Test sign-in credential instead of a username/password one',\n },\n email: { type: 'string', description: \"Test sign-in only: the test user's email\" },\n testUserName: { type: 'string', description: \"Test sign-in only: the test user's display name\" },\n startUrl: {\n type: 'string',\n description: 'Test sign-in only: path or https URL that starts \"Sign in with Cofactor\"',\n },\n signInButtonSelector: {\n type: 'string',\n description: 'Test sign-in only: selector of a sign-in button to click on the start page',\n },\n },\n required: ['applicationId', 'name'],\n },\n request: (args) => {\n const testSignInOnly = ['email', 'testUserName', 'startUrl', 'signInButtonSelector'];\n const secretOnly = ['username', 'password', 'apiKey', 'mfaSecret'];\n const testSignIn = args.testSignIn === true;\n if (!testSignIn && testSignInOnly.some((k) => args[k] !== undefined)) {\n throw new Error(`${testSignInOnly.join(', ')} only apply with testSignIn=true`);\n }\n if (testSignIn && secretOnly.some((k) => args[k] !== undefined)) {\n throw new Error('testSignIn takes email and testUserName, not username/password/apiKey/mfaSecret');\n }\n const data = testSignIn\n ? {\n email: args.email,\n name: args.testUserName,\n startUrl: args.startUrl,\n signInButtonSelector: args.signInButtonSelector,\n }\n : pickDefined(args, secretOnly);\n return {\n method: 'POST',\n path: credentialsPath(args),\n body: {\n name: args.name,\n data,\n ...(testSignIn ? { authProvider: 'test_sign_in' } : {}),\n ...pickDefined(args, ['loginInstructions', 'sessionVerificationGuidance', 'variableValues']),\n },\n };\n },\n },\n {\n name: 'cofactor_credential_update',\n ...modifying('Update a credential', true),\n description:\n 'Update credential fields. Pass only what should change. Set sessionVerificationGuidance to null to clear it.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n credentialId: CREDENTIAL_ID,\n name: { type: 'string', description: 'The credential name' },\n role: { type: 'string', enum: ['admin', 'user', 'viewer', 'custom'], description: 'The role' },\n loginInstructions: { type: 'string', description: 'Login instructions' },\n sessionVerificationGuidance: {\n type: ['string', 'null'],\n description: 'What usable authenticated access looks like; null clears it',\n },\n variableValues: {\n type: 'object',\n additionalProperties: { type: 'string' },\n description: `Values for the bound persona's variables (name to value); ${SECRET}`,\n },\n },\n required: ['applicationId', 'credentialId'],\n },\n request: (args) => ({\n method: 'PUT',\n path: `${credentialsPath(args)}/${pathSeg(args.credentialId, 'credentialId')}`,\n body: pickDefined(args, [\n 'name',\n 'role',\n 'loginInstructions',\n 'sessionVerificationGuidance',\n 'variableValues',\n ]),\n }),\n },\n];\n\nexport const personasGroup = apiToolGroup('personas', tools);\n","/**\n * MCP tools that edit the product map: areas, capabilities, and rules.\n *\n * Mirrors `cofactor product-map area|capability|rule ...`. The CLI resolves\n * natural codes (ARE-..., CAP-...) with an extra lookup request; these tools\n * take prefixed ids (`parea_...`, `pcap_...`, `prule_...`), so each is one\n * request. Resolve a code first with `cofactor_product_map_resolve_code`.\n * `product-map wipe` is deliberately CLI-only. Reads and flow links live in\n * `product-map.ts`.\n *\n * @module\n */\n\nimport { PRODUCT_MAP_STATUSES } from '@chatsdet/types';\nimport { additive, modifying } from '../annotations';\nimport { type ApiTool, CONFIRM_PROPERTY, apiToolGroup, pathSeg, requireConfirm } from '../api-tool';\nimport { pickDefined } from './body';\n\nconst AREA_ID = {\n type: 'string',\n description: 'The area id (parea_...); resolve a code with cofactor_product_map_resolve_code',\n} as const;\nconst CAPABILITY_ID = {\n type: 'string',\n description: 'The capability id (pcap_...); resolve a code with cofactor_product_map_resolve_code',\n} as const;\nconst RULE_ID = { type: 'string', description: 'The rule id (prule_...)' } as const;\n\nconst STAGE = {\n type: 'string',\n enum: PRODUCT_MAP_STATUSES,\n description: 'Lifecycle stage; new items default to in_dev. A child cannot exceed its parent.',\n} as const;\nconst stageBody = (args: Record<string, unknown>) =>\n args.stage === undefined ? {} : { status: args.stage };\n\nconst IMPORTANCE = {\n type: 'string',\n enum: ['p0', 'p1', 'p2', 'p3'],\n description: 'Importance, p0 highest',\n} as const;\nconst nullableText = (what: string) =>\n ({ type: ['string', 'null'], description: `${what}; null clears it` }) as const;\n\nconst CAPABILITY_FIELDS = ['description', 'importance', 'bodyMd', 'entryUrlPattern', 'setupMd', 'openQuestionsMd'];\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_product_map_area_create',\n ...additive('Create a product map area', false),\n description: 'Create an area in an application\\'s product map. The area gets its ARE- code.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: { type: 'string', description: 'The application id' },\n stage: STAGE,\n title: { type: 'string', description: 'Area title' },\n description: { type: 'string', description: 'Optional description' },\n },\n required: ['applicationId', 'title'],\n },\n request: (args) => ({\n method: 'POST',\n path: '/product-map/areas',\n body: { ...stageBody(args), propertyId: args.applicationId, title: args.title, ...pickDefined(args, ['description']) },\n }),\n },\n {\n name: 'cofactor_product_map_area_update',\n ...modifying('Update a product map area', true),\n description:\n 'Update a product map area. Changing its code re-prefixes its capabilities; their old codes still resolve.',\n inputSchema: {\n type: 'object',\n properties: {\n areaId: AREA_ID,\n stage: STAGE,\n title: { type: 'string', description: 'Area title' },\n code: { type: 'string', description: 'Area code stem, e.g. CMM' },\n description: { type: 'string', description: 'Description' },\n },\n required: ['areaId'],\n },\n request: (args) => ({\n method: 'PATCH',\n path: `/product-map/areas/${pathSeg(args.areaId, 'areaId')}`,\n body: { ...pickDefined(args, ['title', 'code', 'description']), ...stageBody(args) },\n }),\n },\n {\n name: 'cofactor_product_map_area_deprecate',\n ...modifying('Deprecate a product map area', true),\n description:\n 'Deprecate a product map area after its capabilities are deprecated. Its code stays reserved. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { areaId: AREA_ID, confirm: CONFIRM_PROPERTY },\n required: ['areaId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'deprecate this area');\n return { method: 'DELETE', path: `/product-map/areas/${pathSeg(args.areaId, 'areaId')}` };\n },\n },\n {\n name: 'cofactor_product_map_capability_create',\n ...additive('Create a product map capability', false),\n description:\n 'Create a product map capability in an area. Without an areaId it is created unassigned and has no code. The body is in the product\\'s voice; tester notes go to setupMd, openQuestionsMd, or blockedReason.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: { type: 'string', description: 'The application id' },\n areaId: AREA_ID,\n stage: STAGE,\n title: { type: 'string', description: 'Capability title' },\n description: { type: 'string', description: 'Short description' },\n importance: IMPORTANCE,\n bodyMd: { type: 'string', description: 'Markdown body' },\n entryUrlPattern: { type: 'string', description: 'URL pattern where the capability starts' },\n setupMd: { type: 'string', description: 'Markdown setup notes for testers' },\n openQuestionsMd: { type: 'string', description: 'Markdown open questions' },\n },\n required: ['applicationId', 'title'],\n },\n request: (args) => ({\n method: 'POST',\n path: '/product-map/capabilities',\n body: {\n ...stageBody(args),\n propertyId: args.applicationId,\n areaId: args.areaId ?? null,\n title: args.title,\n ...pickDefined(args, CAPABILITY_FIELDS),\n },\n }),\n },\n {\n name: 'cofactor_product_map_capability_update',\n ...modifying('Update a product map capability', true),\n description: 'Update a product map capability. Pass only the fields to change; null clears an optional text field.',\n inputSchema: {\n type: 'object',\n properties: {\n capabilityId: CAPABILITY_ID,\n stage: STAGE,\n title: { type: 'string', description: 'Capability title' },\n description: { type: 'string', description: 'Short description' },\n importance: IMPORTANCE,\n bodyMd: nullableText('Markdown body'),\n entryUrlPattern: nullableText('URL pattern where the capability starts'),\n setupMd: nullableText('Markdown setup notes for testers'),\n openQuestionsMd: nullableText('Markdown open questions'),\n blockedReason: nullableText('Why the capability cannot be tested yet'),\n },\n required: ['capabilityId'],\n },\n request: (args) => ({\n method: 'PATCH',\n path: `/product-map/capabilities/${pathSeg(args.capabilityId, 'capabilityId')}`,\n body: { ...pickDefined(args, ['title', 'blockedReason', ...CAPABILITY_FIELDS]), ...stageBody(args) },\n }),\n },\n {\n name: 'cofactor_product_map_capability_move',\n ...modifying('Move a product map capability', true),\n description:\n 'Move a product map capability to another area, or to Unassigned with areaId null (it then has no code but still resolves). The old code keeps resolving. Optionally position it before or after a sibling.',\n inputSchema: {\n type: 'object',\n properties: {\n capabilityId: CAPABILITY_ID,\n areaId: {\n type: ['string', 'null'],\n description: 'The target area id (parea_...), or null for Unassigned',\n },\n beforeCapabilityId: { type: 'string', description: 'Place it before this capability (pcap_...)' },\n afterCapabilityId: { type: 'string', description: 'Place it after this capability (pcap_...)' },\n },\n required: ['capabilityId', 'areaId'],\n },\n request: (args) => {\n if (args.areaId === undefined) throw new Error('areaId is required (null moves to Unassigned)');\n return {\n method: 'POST',\n path: `/product-map/capabilities/${pathSeg(args.capabilityId, 'capabilityId')}/move`,\n body: { areaId: args.areaId, ...pickDefined(args, ['beforeCapabilityId', 'afterCapabilityId']) },\n };\n },\n },\n {\n name: 'cofactor_product_map_capability_deprecate',\n ...modifying('Deprecate a product map capability', true),\n description: 'Deprecate a product map capability. Its code stays reserved and still resolves. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { capabilityId: CAPABILITY_ID, confirm: CONFIRM_PROPERTY },\n required: ['capabilityId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'deprecate this capability');\n return {\n method: 'DELETE',\n path: `/product-map/capabilities/${pathSeg(args.capabilityId, 'capabilityId')}`,\n };\n },\n },\n {\n name: 'cofactor_product_map_rule_add',\n ...additive('Add a capability rule', false),\n description: 'Add a rule (a statement of expected behavior) to a product map capability.',\n inputSchema: {\n type: 'object',\n properties: {\n capabilityId: CAPABILITY_ID,\n stage: STAGE,\n statement: { type: 'string', description: 'The rule statement' },\n },\n required: ['capabilityId', 'statement'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/product-map/capabilities/${pathSeg(args.capabilityId, 'capabilityId')}/rules`,\n body: { statement: args.statement, ...stageBody(args) },\n }),\n },\n {\n name: 'cofactor_product_map_rule_update',\n ...modifying('Update a capability rule', true),\n description: 'Change the statement or lifecycle stage of a product map rule.',\n inputSchema: {\n type: 'object',\n properties: { ruleId: RULE_ID, stage: STAGE, statement: { type: 'string', description: 'The new statement' } },\n required: ['ruleId'],\n },\n request: (args) => ({\n method: 'PATCH',\n path: `/product-map/rules/${pathSeg(args.ruleId, 'ruleId')}`,\n body: { ...pickDefined(args, ['statement']), ...stageBody(args) },\n }),\n },\n ...(['link', 'unlink'] as const).map(\n (action): ApiTool => ({\n name: `cofactor_product_map_rule_${action}`,\n ...(action === 'link'\n ? additive('Link rule evidence', true)\n : modifying('Unlink rule evidence', true)),\n description: `${action === 'link' ? 'Link' : 'Unlink'} a rule to a workflow node or authored assertion in the same application. Idempotent. Deprecated rules cannot be linked.`,\n inputSchema: {\n type: 'object',\n properties: {\n ruleId: RULE_ID,\n workflowId: { type: 'string', description: 'Workflow id (wf_...)' },\n nodeId: { type: 'string', description: 'Node UUID in that workflow' },\n assertionId: {\n type: 'string',\n description: 'Optional inline assertion UUID, or the standalone assertion node UUID',\n },\n },\n required: ['ruleId', 'workflowId', 'nodeId'],\n },\n request: (args) => ({\n method: action === 'link' ? 'POST' : 'DELETE',\n path: `/product-map/rules/${pathSeg(args.ruleId, 'ruleId')}/links`,\n body: pickDefined(args, ['workflowId', 'nodeId', 'assertionId']),\n }),\n })\n ),\n {\n name: 'cofactor_product_map_rule_remove',\n ...modifying('Remove a capability rule', true),\n description: 'Deprecate a product map rule. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { ruleId: RULE_ID, confirm: CONFIRM_PROPERTY },\n required: ['ruleId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'deprecate this rule');\n return { method: 'DELETE', path: `/product-map/rules/${pathSeg(args.ruleId, 'ruleId')}` };\n },\n },\n];\n\nexport const productMapEditGroup = apiToolGroup('product-map-edit', tools);\n","/**\n * MCP tools for the API catalog: sources (OpenAPI/Postman imports) and\n * endpoints (individual requests).\n *\n * Mirrors `cofactor api-catalog sources list|get|create|patch|refresh|delete`\n * and `endpoints list|get|create|patch|delete|delete-many|domains|test`. The CLI's\n * `--from-file` JSON input becomes the tool arguments. `endpoints test` fires a\n * real request at the customer's application, so it needs confirm=true.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport { type ApiTool, CONFIRM_PROPERTY, apiToolGroup, pathSeg, requireConfirm, requireString, withQuery } from '../api-tool';\nimport { pickDefined } from './body';\n\nconst SOURCE_ID = { type: 'string', description: 'The catalog source id' } as const;\nconst ENDPOINT_ID = {\n type: 'string',\n description: 'The catalog endpoint id: a raw endpoint UUID (not a prefixed id)',\n} as const;\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_api_catalog_sources_list',\n ...readOnly('List API catalog sources'),\n description: 'List API catalog sources (OpenAPI / Postman imports) with their sync status.',\n inputSchema: { type: 'object', properties: {} },\n request: () => ({ method: 'GET', path: '/api-catalog-sources' }),\n },\n {\n name: 'cofactor_api_catalog_sources_get',\n ...readOnly('Get an API catalog source'),\n description: 'Get one API catalog source.',\n inputSchema: { type: 'object', properties: { sourceId: SOURCE_ID }, required: ['sourceId'] },\n request: (args) => ({\n method: 'GET',\n path: `/api-catalog-sources/${pathSeg(args.sourceId, 'sourceId')}`,\n }),\n },\n {\n name: 'cofactor_api_catalog_sources_create',\n ...additive('Create an API catalog source', false),\n description:\n 'Create a catalog source from a schema URL and run the initial import. The server fetches the URL. Requires confirm=true because the server fetches the URL.',\n inputSchema: {\n type: 'object',\n properties: {\n url: { type: 'string', description: 'URL of the OpenAPI / Postman schema' },\n applicationId: { type: 'string', description: 'The application the endpoints belong to' },\n formatId: { type: 'string', description: 'Detected schema format id' },\n formatLabel: { type: 'string', description: 'Detected schema format label' },\n baseUrl: { type: 'string', description: 'Base URL the endpoints are called against' },\n name: { type: 'string', description: 'Optional source name' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['url', 'applicationId', 'formatId', 'formatLabel', 'baseUrl', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'have the server fetch this API schema URL');\n return {\n method: 'POST',\n path: '/api-catalog-sources',\n body: {\n propertyId: requireString(args.applicationId, 'applicationId'),\n ...pickDefined(args, ['url', 'formatId', 'formatLabel', 'baseUrl', 'name']),\n },\n };\n },\n },\n {\n name: 'cofactor_api_catalog_sources_patch',\n ...modifying('Update an API catalog source', true),\n description: 'Update a catalog source\\'s name or base URL. Requires confirm=true because the base URL is where the server sends later API calls.',\n inputSchema: {\n type: 'object',\n properties: {\n sourceId: SOURCE_ID,\n name: { type: 'string', description: 'Source name' },\n baseUrl: { type: 'string', description: 'Base URL' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['sourceId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'have the server fetch this API schema URL');\n return {\n method: 'PATCH',\n path: `/api-catalog-sources/${pathSeg(args.sourceId, 'sourceId')}`,\n body: pickDefined(args, ['name', 'baseUrl']),\n };\n },\n },\n {\n name: 'cofactor_api_catalog_sources_refresh',\n ...modifying('Refresh an API catalog source', true),\n description: 'Re-fetch an API catalog source\\'s schema and re-sync its endpoints. Requires confirm=true because the server fetches the URL.',\n inputSchema: {\n type: 'object',\n properties: { sourceId: SOURCE_ID, confirm: CONFIRM_PROPERTY },\n required: ['sourceId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'have the server fetch this API schema URL');\n return { method: 'POST', path: `/api-catalog-sources/${pathSeg(args.sourceId, 'sourceId')}/refresh` };\n },\n },\n {\n name: 'cofactor_api_catalog_sources_delete',\n ...modifying('Delete an API catalog source', true),\n description: 'Delete a catalog source AND every endpoint it imported. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { sourceId: SOURCE_ID, confirm: CONFIRM_PROPERTY },\n required: ['sourceId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this catalog source');\n return { method: 'DELETE', path: `/api-catalog-sources/${pathSeg(args.sourceId, 'sourceId')}` };\n },\n },\n {\n name: 'cofactor_api_catalog_endpoints_list',\n ...readOnly('List API catalog endpoints'),\n description: 'List or search catalog endpoints, with paging.',\n inputSchema: {\n type: 'object',\n properties: {\n search: { type: 'string', description: 'Search text' },\n applicationId: { type: 'string', description: 'Filter by application id' },\n method: { type: 'string', description: 'Filter by HTTP method' },\n page: { type: 'number', description: 'Page number' },\n pageSize: { type: 'number', description: 'Page size' },\n },\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery('/api-requests', {\n search: args.search,\n propertyId: args.applicationId,\n method: args.method,\n page: args.page,\n pageSize: args.pageSize,\n }),\n }),\n },\n {\n name: 'cofactor_api_catalog_endpoints_get',\n ...readOnly('Get an API catalog endpoint'),\n description: 'Get one catalog endpoint.',\n inputSchema: { type: 'object', properties: { endpointId: ENDPOINT_ID }, required: ['endpointId'] },\n request: (args) => ({\n method: 'GET',\n path: `/api-requests/${pathSeg(args.endpointId, 'endpointId')}`,\n }),\n },\n {\n name: 'cofactor_api_catalog_endpoints_create',\n ...additive('Create an API catalog endpoint', false),\n description: 'Create a manual catalog endpoint for an application.',\n inputSchema: {\n type: 'object',\n properties: {\n method: { type: 'string', description: 'HTTP method' },\n url: { type: 'string', description: 'Endpoint URL' },\n applicationId: { type: 'string', description: 'The application id' },\n name: { type: 'string', description: 'Optional endpoint name' },\n },\n required: ['method', 'url', 'applicationId'],\n },\n request: (args) => ({\n method: 'POST',\n path: '/api-requests',\n body: { propertyId: requireString(args.applicationId, 'applicationId'), ...pickDefined(args, ['method', 'url', 'name']) },\n }),\n },\n {\n name: 'cofactor_api_catalog_endpoints_patch',\n ...modifying('Update an API catalog endpoint', true),\n description: 'Update a catalog endpoint\\'s name, query parameter schema, request schema, or request sample.',\n inputSchema: {\n type: 'object',\n properties: {\n endpointId: ENDPOINT_ID,\n name: { type: ['string', 'null'], description: 'Endpoint name' },\n queryParamSchema: {\n type: ['array', 'null'],\n items: { type: 'object' },\n description: 'Query parameter definitions',\n },\n requestSchema: { description: 'JSON schema of the request body' },\n requestSample: { type: ['string', 'null'], description: 'Sample request body' },\n },\n required: ['endpointId'],\n },\n request: (args) => ({\n method: 'PATCH',\n path: `/api-requests/${pathSeg(args.endpointId, 'endpointId')}`,\n body: pickDefined(args, ['name', 'queryParamSchema', 'requestSchema', 'requestSample']),\n }),\n },\n {\n name: 'cofactor_api_catalog_endpoints_delete',\n ...modifying('Delete an API catalog endpoint', true),\n description: 'Delete one catalog endpoint. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { endpointId: ENDPOINT_ID, confirm: CONFIRM_PROPERTY },\n required: ['endpointId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this catalog endpoint');\n pathSeg(args.endpointId, 'endpointId');\n return {\n method: 'DELETE',\n path: '/api-requests/bulk',\n body: { ids: [String(args.endpointId)] },\n };\n },\n },\n {\n name: 'cofactor_api_catalog_endpoints_delete_many',\n ...modifying('Delete many API catalog endpoints', true),\n description: 'Delete several catalog endpoints at once. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n endpointIds: {\n type: 'array',\n items: { type: 'string' },\n minItems: 1,\n maxItems: 100,\n description:\n 'The endpoint ids: raw endpoint UUIDs (not prefixed ids); check the returned `deleted` count — unknown ids are ignored',\n },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['endpointIds', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete these catalog endpoints');\n if (!Array.isArray(args.endpointIds) || args.endpointIds.length === 0) {\n throw new Error('endpointIds is required');\n }\n return { method: 'DELETE', path: '/api-requests/bulk', body: { ids: args.endpointIds } };\n },\n },\n {\n name: 'cofactor_api_catalog_endpoints_test',\n ...additive('Test an API catalog endpoint', false),\n description:\n 'Run a catalog endpoint against its application and return the response. This sends a real request to the customer\\'s application, returns the live response (which can include tokens or personal data) and saves its shape on the endpoint. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { endpointId: ENDPOINT_ID, confirm: CONFIRM_PROPERTY },\n required: ['endpointId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'send a real request to the application for this endpoint');\n return { method: 'POST', path: `/api-requests/${pathSeg(args.endpointId, 'endpointId')}/test` };\n },\n },\n {\n name: 'cofactor_api_catalog_endpoints_domains',\n ...readOnly('List API catalog domains'),\n description: 'List the distinct domains across catalog endpoints.',\n inputSchema: { type: 'object', properties: {} },\n request: () => ({ method: 'GET', path: '/api-requests/domains' }),\n },\n];\n\nexport const apiCatalogGroup = apiToolGroup('api-catalog', tools);\n","/**\n * Shared pieces of the schedule and alert tools. Both are rows of the org\n * automation API (`/org/automation/rules`); they differ in which fields they\n * expose and which `actionType` their list filters on.\n *\n * @module\n */\n\nimport { pathSeg, withQuery, type ApiRequest } from '../api-tool';\n\nexport const RULES_PATH = '/org/automation/rules';\nconst EXECUTIONS_PATH = '/org/automation/executions';\n\nexport const RULE_ID = { type: 'string', description: 'The rule id (UUID)' } as const;\nexport const NAME = { type: 'string', description: 'Name (1-100 characters)' } as const;\nexport const DESCRIPTION = { type: 'string', description: 'Description (up to 500 characters)' } as const;\nexport const DISABLED = { type: 'boolean', description: 'Create the rule paused' } as const;\n\nexport const TIMING_PROPERTIES = {\n cron: { type: 'string', description: 'Cron expression, e.g. \"0 3 * * *\". Choose at most one of cron, at, every.' },\n at: { type: 'string', description: 'Daily at a 24-hour time, HH:mm, e.g. \"02:00\"' },\n every: { type: 'string', description: 'Interval such as \"30m\" or \"2h\"' },\n timezone: { type: 'string', description: 'IANA timezone for the timing (default UTC)' },\n} as const;\n\nexport const FILTER_OPERATORS = [\n 'equals',\n 'not_equals',\n 'contains',\n 'starts_with',\n 'ends_with',\n 'matches',\n 'in',\n] as const;\n\n/** The `triggerConfig` for cron/at/every args, or undefined when none is given. */\nexport function buildTimingConfig(args: Record<string, unknown>) {\n const { cron, at, every } = args;\n const timezone = typeof args.timezone === 'string' && args.timezone ? args.timezone : 'UTC';\n const provided = [cron, at, every].filter((v) => v !== undefined);\n if (provided.length === 0) return undefined;\n if (provided.length > 1) throw new Error('Use only one of cron, at, every.');\n if (cron !== undefined) {\n return { scheduleType: 'cron', scheduleConfig: { pattern: String(cron), timezone } };\n }\n if (at !== undefined) {\n if (!/^\\d{1,2}:\\d{2}$/.test(String(at))) throw new Error('at must be HH:mm (24-hour), e.g. 02:00.');\n return { scheduleType: 'simple', scheduleConfig: { time: String(at), timezone } };\n }\n const match = /^(\\d+)\\s*(m|min|minutes?|h|hours?)$/i.exec(String(every).trim());\n if (!match) throw new Error('every must look like \"30m\" or \"2h\".');\n const amount = Number.parseInt(match[1], 10);\n const ms = match[2].toLowerCase().startsWith('h') ? amount * 3_600_000 : amount * 60_000;\n if (ms <= 0) throw new Error('every must be a positive duration.');\n return { scheduleType: 'interval', scheduleConfig: { intervalMs: ms, timezone } };\n}\n\nexport function listRules(\n args: Record<string, unknown>,\n filter: Record<string, string>\n): ApiRequest {\n return {\n method: 'GET',\n path: withQuery(RULES_PATH, {\n ...filter,\n enabled: args.enabled === true || args.enabled === false ? String(args.enabled) : undefined,\n page: args.page,\n pageSize: args.pageSize ?? 50,\n }),\n };\n}\n\nexport function listExecutions(args: Record<string, unknown>): ApiRequest {\n pathSeg(args.ruleId, 'ruleId');\n return {\n method: 'GET',\n path: withQuery(EXECUTIONS_PATH, {\n ruleId: args.ruleId,\n pageSize: args.pageSize ?? 20,\n status: args.status,\n page: args.page,\n }),\n };\n}\n\nexport const LIST_PROPERTIES = {\n enabled: { type: 'boolean', description: 'Only enabled (true) or only paused (false) rules' },\n page: { type: 'number', description: 'Page number' },\n pageSize: { type: 'number', description: 'Rules per page (default 50, max 100)' },\n} as const;\n\nexport const RUNS_PROPERTIES = {\n ruleId: { type: 'string', description: 'The rule id (a UUID)' },\n status: {\n type: 'string',\n enum: ['pending', 'scheduled', 'running', 'completed', 'failed', 'canceled', 'superseded'],\n description: 'Only executions with this status',\n },\n page: { type: 'number', description: 'Page number' },\n pageSize: { type: 'number', description: 'Executions per page (default 20)' },\n} as const;\n\nexport function ruleRequest(\n method: ApiRequest['method'],\n args: Record<string, unknown>,\n suffix = '',\n body?: Record<string, unknown>\n): ApiRequest {\n return { method, path: `${RULES_PATH}/${pathSeg(args.ruleId, 'ruleId')}${suffix}`, ...(body ? { body } : {}) };\n}\n","/**\n * MCP tools for scheduled test-suite runs. Mirrors `cofactor schedule suite\n * list|get|create|edit|pause|resume|delete|run|runs`. Not covered: the CLI's\n * natural-language `--schedule` (needs a second parse request); use cron, at,\n * or every.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport { type ApiTool, CONFIRM_PROPERTY, apiToolGroup, requireConfirm } from '../api-tool';\nimport type { JsonSchema } from '../types';\nimport {\n DESCRIPTION,\n DISABLED,\n LIST_PROPERTIES,\n NAME,\n RULE_ID,\n RULES_PATH,\n RUNS_PROPERTIES,\n TIMING_PROPERTIES,\n buildTimingConfig,\n listExecutions,\n listRules,\n ruleRequest,\n} from './automation-rules';\n\nconst ACTION_TYPE = 'workflow.run-tests';\n\nconst TARGET_PROPERTIES = {\n suiteId: { type: 'string', description: 'A persisted named test suite id. Choose exactly one of suiteId, tags, allPublished.' },\n tags: { type: 'array', items: { type: 'string' }, description: 'Run workflows with these tags' },\n allPublished: { type: 'boolean', description: 'Run all eligible published workflows' },\n propertyId: { type: 'string', description: 'Restrict to one application (UUID)' },\n environmentId: { type: 'string', description: 'Force an environment (UUID)' },\n} as const;\n\n/** The suite-selection args as `actionConfig`, or null when none is chosen. */\nfunction buildTarget(args: Record<string, unknown>): Record<string, unknown> | null {\n const tags = Array.isArray(args.tags) ? args.tags.map(String) : [];\n const chosen = [Boolean(args.suiteId), tags.length > 0, args.allPublished === true].filter(Boolean).length;\n if (chosen === 0) return null;\n if (chosen > 1) throw new Error('Choose exactly one of suiteId, tags, allPublished.');\n const config: Record<string, unknown> = {};\n if (args.suiteId) config.suite_id = args.suiteId;\n else if (tags.length > 0) config.tags = tags;\n if (args.propertyId) config.property_id = args.propertyId;\n if (args.environmentId) config.environment_id = args.environmentId;\n return config;\n}\n\nconst ruleOnly: JsonSchema = { type: 'object', properties: { ruleId: RULE_ID }, required: ['ruleId'] };\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_schedule_suite_list',\n ...readOnly('List scheduled suite runs'),\n description: 'List scheduled test-suite runs.',\n inputSchema: { type: 'object', properties: { ...LIST_PROPERTIES } },\n request: (args) => listRules(args, { triggerSource: 'schedule', actionType: ACTION_TYPE }),\n },\n {\n name: 'cofactor_schedule_suite_get',\n ...readOnly('Get a scheduled suite run'),\n description: 'Get one scheduled test-suite run, including its timing and alert steps.',\n inputSchema: ruleOnly,\n request: (args) => ruleRequest('GET', args),\n },\n {\n name: 'cofactor_schedule_suite_create',\n ...additive('Create a scheduled suite run', false),\n description:\n 'Create a recurring test-suite run. Requires a name, exactly one target (suiteId, tags, or allPublished) and exactly one timing (cron, at, or every).',\n inputSchema: {\n type: 'object',\n properties: { name: NAME, description: DESCRIPTION, disabled: DISABLED, ...TARGET_PROPERTIES, ...TIMING_PROPERTIES },\n required: ['name'],\n },\n request: (args) => {\n const actionConfig = buildTarget(args);\n if (actionConfig === null) throw new Error('A target is required: suiteId, tags, or allPublished.');\n const triggerConfig = buildTimingConfig(args);\n if (!triggerConfig) throw new Error('A schedule is required: cron, at, or every.');\n return {\n method: 'POST',\n path: RULES_PATH,\n body: {\n name: args.name,\n enabled: args.disabled !== true,\n triggerSource: 'schedule',\n triggerEvent: 'scheduled',\n triggerConfig,\n actionType: ACTION_TYPE,\n actionConfig,\n ...(args.description !== undefined ? { description: args.description } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_schedule_suite_edit',\n ...modifying('Edit a scheduled suite run', true),\n description:\n 'Change a scheduled suite run. Only the fields you pass change; passing a target or timing replaces the whole target or timing. When you change the target, pass suiteId, tags, or allPublished; propertyId/environmentId alone are ignored.',\n inputSchema: {\n type: 'object',\n properties: { ruleId: RULE_ID, name: NAME, description: DESCRIPTION, ...TARGET_PROPERTIES, ...TIMING_PROPERTIES },\n required: ['ruleId'],\n },\n request: (args) => {\n const body: Record<string, unknown> = {};\n if (args.name !== undefined) body.name = args.name;\n if (args.description !== undefined) body.description = args.description;\n const actionConfig = buildTarget(args);\n if (actionConfig !== null) body.actionConfig = actionConfig;\n const triggerConfig = buildTimingConfig(args);\n if (triggerConfig) body.triggerConfig = triggerConfig;\n if (Object.keys(body).length === 0) throw new Error('No changes supplied.');\n return ruleRequest('PUT', args, '', body);\n },\n },\n {\n name: 'cofactor_schedule_suite_pause',\n ...modifying('Pause a scheduled suite run', true),\n description: 'Pause (disable) a scheduled suite run.',\n inputSchema: ruleOnly,\n request: (args) => ruleRequest('PUT', args, '', { enabled: false }),\n },\n {\n name: 'cofactor_schedule_suite_resume',\n ...modifying('Resume a scheduled suite run', true),\n description: 'Resume (enable) a paused scheduled suite run.',\n inputSchema: ruleOnly,\n request: (args) => ruleRequest('PUT', args, '', { enabled: true }),\n },\n {\n name: 'cofactor_schedule_suite_delete',\n ...modifying('Delete a scheduled suite run', true),\n description: 'Permanently delete a scheduled suite run. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { ruleId: RULE_ID, confirm: CONFIRM_PROPERTY },\n required: ['ruleId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this schedule');\n return ruleRequest('DELETE', args);\n },\n },\n {\n name: 'cofactor_schedule_suite_run',\n ...additive('Run a scheduled suite now', false),\n description: 'Run a scheduled suite run immediately. Returns the execution id.',\n inputSchema: ruleOnly,\n request: (args) => ruleRequest('POST', args, '/run'),\n },\n {\n name: 'cofactor_schedule_suite_runs',\n ...readOnly('List scheduled suite executions'),\n description: 'List recent executions of a scheduled suite run.',\n inputSchema: { type: 'object', properties: { ...RUNS_PROPERTIES }, required: ['ruleId'] },\n request: listExecutions,\n },\n];\n\nexport const schedulesGroup = apiToolGroup('schedules', tools);\n","/**\n * MCP tools for notify-only alerts. Mirrors `cofactor alert\n * list|get|create|edit|pause|resume|run|delete|runs|deliveries`. Not covered:\n * the CLI's `--on-schedule` attach (read-modify-write) and natural-language\n * `--schedule`. Slack channels are passed as ids (C...):\n * `cofactor_utilities_slack_send` and the API take ids, and no MCP tool lists\n * Slack channels to look a name up in. Teams channels take a name like\n * `cofactor alert --teams`, since `cofactor_teams_channels` lists them\n * ({@link resolveTeamsChannelRefs}).\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport {\n type ApiTool,\n CONFIRM_PROPERTY,\n apiToolGroup,\n pathSeg,\n requireConfirm,\n withQuery,\n} from '../api-tool';\nimport { mcpApiRequest } from '../api-client';\nimport { type TeamsAvailability, type TeamsChannel, resolveTeamsChannelRefs } from '../teams-channels';\nimport type { JsonSchema } from '../types';\nimport {\n DESCRIPTION,\n DISABLED,\n FILTER_OPERATORS,\n LIST_PROPERTIES,\n NAME,\n RULE_ID,\n RULES_PATH,\n RUNS_PROPERTIES,\n TIMING_PROPERTIES,\n buildTimingConfig,\n listExecutions,\n listRules,\n ruleRequest,\n} from './automation-rules';\n\nconst ACTION_TYPE = 'notify';\nconst SYSTEM_EVENTS = [\n 'test_suite.completed',\n 'release_qa.completed',\n 'maintenance_feedback_requested',\n 'ticket_tester.dispatched',\n];\nconst INFORMATIONAL_EVENTS = ['maintenance_feedback_requested', 'ticket_tester.dispatched'];\n\nconst ALERT_PROPERTIES = {\n event: {\n type: 'string',\n enum: SYSTEM_EVENTS,\n description: 'System event that fires the alert (default test_suite.completed). Ignored when cron, at, or every is set.',\n },\n emails: { type: 'array', items: { type: 'string' }, description: 'Email recipients' },\n slackChannelIds: { type: 'array', items: { type: 'string' }, description: 'Slack channel ids (C...)' },\n teamsChannels: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Microsoft Teams channels: a channel name, Team/Channel, or a reference from cofactor_teams_channels. Needs the chat.teams feature and the Cofactor app in the channel.',\n },\n when: {\n type: 'array',\n items: { type: 'string', enum: ['success', 'failure'] },\n description: 'When to fire. Defaults to failure only (success and failure for maintenance_feedback_requested and ticket_tester.dispatched).',\n },\n filters: {\n type: 'array',\n description: 'Only fire when every condition holds',\n items: {\n type: 'object',\n properties: {\n field: { type: 'string' },\n operator: { type: 'string', enum: [...FILTER_OPERATORS] },\n value: { description: 'A string, or an array of strings for the \"in\" operator' },\n },\n required: ['field', 'operator', 'value'],\n },\n },\n ...TIMING_PROPERTIES,\n} as const;\n\nfunction stringList(value: unknown): string[] {\n return Array.isArray(value) ? value.map(String) : [];\n}\n\nfunction parseWhen(args: Record<string, unknown>, event: string): ('success' | 'failure')[] {\n const when = stringList(args.when);\n if (when.length === 0) return INFORMATIONAL_EVENTS.includes(event) ? ['success', 'failure'] : ['failure'];\n for (const v of when) {\n if (v !== 'success' && v !== 'failure') throw new Error('when must contain \"success\" and/or \"failure\".');\n }\n return when as ('success' | 'failure')[];\n}\n\n/** Teams channel names → references, against the channels the app is installed in; throws why not. */\nasync function teamsChannelRefs(values: string[]): Promise<string[]> {\n const resolved = await resolveTeamsChannelRefs(values, {\n channels: async () => (await mcpApiRequest<{ channels: TeamsChannel[] }>('GET', '/integrations/teams/channels')).channels,\n availability: () => mcpApiRequest<TeamsAvailability>('GET', '/integrations/teams/connection'),\n });\n if (!resolved.ok) throw new Error(resolved.error);\n return resolved.channelRefs;\n}\n\nconst CHANNEL_ARGS = ['emails', 'slackChannelIds', 'teamsChannels'];\nconst hasChannelArgs = (args: Record<string, unknown>) => CHANNEL_ARGS.some((key) => stringList(args[key]).length > 0);\n\n/** `alertConfig.steps` from the channel args, or null when no channel is given. */\nasync function buildSteps(args: Record<string, unknown>, event: string) {\n if (!hasChannelArgs(args)) return null;\n const emails = stringList(args.emails);\n const slack = stringList(args.slackChannelIds);\n const teams = await teamsChannelRefs(stringList(args.teamsChannels));\n const on = parseWhen(args, event);\n return [\n ...(emails.length > 0 ? [{ channel: 'email', on, recipients: emails }] : []),\n ...slack.map((slackChannelId) => ({ channel: 'slack', on, slackChannelId })),\n ...teams.map((teamsChannelRef) => ({ channel: 'teams', on, teamsChannelRef })),\n ];\n}\n\n/** Timing args make a schedule trigger; otherwise a system event. */\nfunction buildTrigger(args: Record<string, unknown>) {\n const triggerConfig = buildTimingConfig(args);\n if (triggerConfig) return { triggerSource: 'schedule', triggerEvent: 'scheduled', triggerConfig };\n const event = typeof args.event === 'string' ? args.event : 'test_suite.completed';\n if (!SYSTEM_EVENTS.includes(event)) throw new Error(`event must be one of: ${SYSTEM_EVENTS.join(', ')}`);\n return { triggerSource: 'system', triggerEvent: event };\n}\n\nconst ruleOnly: JsonSchema = { type: 'object', properties: { ruleId: RULE_ID }, required: ['ruleId'] };\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_alert_list',\n ...readOnly('List alerts'),\n description: 'List notify-only alerts.',\n inputSchema: { type: 'object', properties: { ...LIST_PROPERTIES } },\n request: (args) => listRules(args, { actionType: ACTION_TYPE }),\n },\n {\n name: 'cofactor_alert_get',\n ...readOnly('Get an alert'),\n description: 'Get one alert, including its trigger and channels.',\n inputSchema: ruleOnly,\n request: (args) => ruleRequest('GET', args),\n },\n {\n name: 'cofactor_alert_create',\n ...additive('Create an alert', false),\n description:\n 'Create a notify-only alert that emails, Slacks or posts to Microsoft Teams when a system event fires (default: after a test suite completes) or on a schedule. Requires a name and at least one of emails, slackChannelIds or teamsChannels. Requires confirm=true because it sets who is notified.',\n inputSchema: {\n type: 'object',\n properties: { name: NAME, description: DESCRIPTION, disabled: DISABLED, ...ALERT_PROPERTIES, confirm: CONFIRM_PROPERTY },\n required: ['name', 'confirm'],\n },\n request: async (args) => {\n requireConfirm(args, 'save this alert (it notifies the recipients you set)');\n const trigger = buildTrigger(args);\n const steps = await buildSteps(args, trigger.triggerEvent);\n if (steps === null) throw new Error('At least one channel is required: emails, slackChannelIds or teamsChannels.');\n const filters = Array.isArray(args.filters) ? args.filters : [];\n return {\n method: 'POST',\n path: RULES_PATH,\n body: {\n name: args.name,\n enabled: args.disabled !== true,\n ...trigger,\n actionType: ACTION_TYPE,\n actionConfig: {},\n alertConfig: { steps },\n ...(args.description !== undefined ? { description: args.description } : {}),\n ...(filters.length > 0 ? { filterConfig: { conditions: filters } } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_alert_edit',\n ...modifying('Edit an alert', true),\n description:\n 'Change an alert. Only the fields you pass change. Passing emails, slackChannelIds or teamsChannels replaces all channels, and then when is required. Passing event or timing replaces the trigger. Requires confirm=true because it sets who is notified.',\n inputSchema: {\n type: 'object',\n properties: { ruleId: RULE_ID, name: NAME, description: DESCRIPTION, ...ALERT_PROPERTIES, confirm: CONFIRM_PROPERTY },\n required: ['ruleId', 'confirm'],\n },\n request: async (args) => {\n requireConfirm(args, 'save this alert (it notifies the recipients you set)');\n const body: Record<string, unknown> = {};\n if (args.name !== undefined) body.name = args.name;\n if (args.description !== undefined) body.description = args.description;\n const retrigger = args.event !== undefined || ['cron', 'at', 'every'].some((k) => args[k] !== undefined);\n const trigger = retrigger ? buildTrigger(args) : undefined;\n if (trigger) Object.assign(body, trigger);\n if (hasChannelArgs(args) && !trigger && stringList(args.when).length === 0) {\n throw new Error('when is required when replacing channels without changing the trigger.');\n }\n const steps = await buildSteps(args, trigger?.triggerEvent ?? 'test_suite.completed');\n if (steps !== null) body.alertConfig = { steps };\n const filters = Array.isArray(args.filters) ? args.filters : [];\n if (filters.length > 0) body.filterConfig = { conditions: filters };\n if (Object.keys(body).length === 0) throw new Error('No changes supplied.');\n return ruleRequest('PUT', args, '', body);\n },\n },\n {\n name: 'cofactor_alert_pause',\n ...modifying('Pause an alert', true),\n description: 'Pause (disable) an alert.',\n inputSchema: ruleOnly,\n request: (args) => ruleRequest('PUT', args, '', { enabled: false }),\n },\n {\n name: 'cofactor_alert_resume',\n ...modifying('Resume an alert', true),\n description: 'Resume (enable) a paused alert.',\n inputSchema: ruleOnly,\n request: (args) => ruleRequest('PUT', args, '', { enabled: true }),\n },\n {\n name: 'cofactor_alert_run',\n ...additive('Fire an alert now', false),\n description:\n 'Fire an alert now instead of waiting for its trigger. Pass an alert\\'s id; the API fires whatever rule it is given. This sends its real email, Slack and Teams messages. Some rules are admin-managed and the API refuses members. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { ruleId: RULE_ID, confirm: CONFIRM_PROPERTY },\n required: ['ruleId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'fire this alert, which sends its real notifications');\n return ruleRequest('POST', args, '/run');\n },\n },\n {\n name: 'cofactor_alert_delete',\n ...modifying('Delete an alert', true),\n description: 'Permanently delete an alert. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { ruleId: RULE_ID, confirm: CONFIRM_PROPERTY },\n required: ['ruleId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'delete this alert');\n return ruleRequest('DELETE', args);\n },\n },\n {\n name: 'cofactor_alert_runs',\n ...readOnly('List alert firings'),\n description: 'List recent firings of an alert.',\n inputSchema: { type: 'object', properties: { ...RUNS_PROPERTIES }, required: ['ruleId'] },\n request: listExecutions,\n },\n {\n name: 'cofactor_alert_deliveries',\n ...readOnly('List alert deliveries'),\n description:\n 'List recent sends of an alert, newest first: each with its status (completed, failed with the send error, or pending), destination, and the run it reported. A suite completion alert records no firings, so this is where its sends show.',\n inputSchema: {\n type: 'object',\n properties: {\n ruleId: RULE_ID,\n limit: { type: 'number', description: 'Deliveries to return (1-100, default 20)' },\n },\n required: ['ruleId'],\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery(`${RULES_PATH}/${pathSeg(args.ruleId, 'ruleId')}/deliveries`, { limit: args.limit }),\n }),\n },\n];\n\nexport const alertsGroup = apiToolGroup('alerts', tools);\n","/**\n * MCP tools for Release QA. Mirrors `cofactor release trigger|status|\n * latest-deploy|transcript`. Not covered: `run` (polls), `mark-deploy`\n * (production bookkeeping), and `reply` (mirrored to Slack). Trigger and status\n * use `/release-qa/runs`, not the API-key-only `/api/v1/release-qa/*` routes.\n *\n * @module\n */\n\nimport { additive, readOnly } from '../annotations';\nimport { type ApiTool, apiToolGroup, pathSeg, requireString, withQuery } from '../api-tool';\n\nconst APPLICATION_ID = { type: 'string', description: 'Application (property) UUID' } as const;\nconst RUN_ID = { type: 'string', description: 'The release QA run id (UUID)' } as const;\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_release_trigger',\n ...additive('Trigger a release QA run', false),\n description: 'Start a Release QA run for an application. Returns the run; use run.id with cofactor_release_status. Requires the Release QA org feature.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n credentialIds: { type: 'array', items: { type: 'string' }, description: 'Credential UUIDs to use' },\n },\n required: ['applicationId'],\n },\n request: (args) => {\n const credentialIds = Array.isArray(args.credentialIds) ? args.credentialIds.map(String) : [];\n return {\n method: 'POST',\n // Not /api/v1/release-qa/trigger: that route is API-key-only, and the MCP calls with a user JWT.\n path: '/release-qa/runs',\n body: {\n propertyId: requireString(args.applicationId, 'applicationId'),\n ...(credentialIds.length > 0 ? { credentialIds } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_release_status',\n ...readOnly('Get a release QA run status'),\n description: 'Status of a Release QA run: verdict, commits analyzed, testers, issues, and regression results. Requires the Release QA org feature.',\n inputSchema: { type: 'object', properties: { runId: RUN_ID }, required: ['runId'] },\n request: (args) => ({ method: 'GET', path: `/release-qa/runs/${pathSeg(args.runId, 'runId')}` }),\n },\n {\n name: 'cofactor_release_latest_deploy',\n ...readOnly('Get the latest deployment'),\n description: 'The latest confirmed deployment of an application for a stage (default production).',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID, stage: { type: 'string', description: 'Stage name (default production)' } },\n required: ['applicationId'],\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery('/api/v1/deployments/latest', {\n propertyId: requireString(args.applicationId, 'applicationId'),\n stage: args.stage ?? 'production',\n }),\n }),\n },\n {\n name: 'cofactor_release_transcript',\n ...readOnly('Get a release agent transcript'),\n description: \"The release agent's status, open questions, and message transcript for a Release QA run.\",\n inputSchema: { type: 'object', properties: { runId: RUN_ID }, required: ['runId'] },\n request: (args) => ({ method: 'GET', path: `/api/v1/release-qa/runs/${pathSeg(args.runId, 'runId')}/agent` }),\n },\n];\n\nexport const releasesGroup = apiToolGroup('releases', tools);\n","/**\n * MCP tools for runbooks and stage monitors. Mirrors `cofactor runbook\n * list|runs|logs` and `cofactor monitor list|status`. Not covered: `runbook\n * run` (resolves the slug with a list request first, can be destructive, and\n * may poll).\n *\n * @module\n */\n\nimport { readOnly } from '../annotations';\nimport { type ApiTool, apiToolGroup, pathSeg } from '../api-tool';\nimport type { JsonSchema } from '../types';\n\nconst APPLICATION_ID = { type: 'string', description: 'Application (property) UUID' } as const;\n\nconst applicationOnly: JsonSchema = {\n type: 'object',\n properties: { applicationId: APPLICATION_ID },\n required: ['applicationId'],\n};\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_runbook_list',\n ...readOnly('List runbooks'),\n description: 'List the runbooks discovered for an application.',\n inputSchema: applicationOnly,\n request: (args) => ({ method: 'GET', path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/runbooks` }),\n },\n {\n name: 'cofactor_runbook_runs',\n ...readOnly('List runbook runs'),\n description: 'List recent runbook runs for an application.',\n inputSchema: applicationOnly,\n request: (args) => ({ method: 'GET', path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/runbook-runs` }),\n },\n {\n name: 'cofactor_runbook_logs',\n ...readOnly('Get runbook run logs'),\n description: 'Get one runbook run with its status, exit code, and logs.',\n inputSchema: {\n type: 'object',\n properties: { runId: { type: 'string', description: 'The runbook run id' } },\n required: ['runId'],\n },\n request: (args) => ({ method: 'GET', path: `/org/runbook-runs/${pathSeg(args.runId, 'runId')}` }),\n },\n {\n name: 'cofactor_monitor_list',\n ...readOnly('List stage monitors'),\n description: 'List the stage monitors discovered for an application.',\n inputSchema: applicationOnly,\n request: (args) => ({ method: 'GET', path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/monitors` }),\n },\n {\n name: 'cofactor_monitor_status',\n ...readOnly('Get a stage monitor status'),\n description: \"Fetch a live status read for one stage's monitor.\",\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID, stage: { type: 'string', description: 'The stage name' } },\n required: ['applicationId', 'stage'],\n },\n request: (args) => ({\n method: 'GET',\n path: `/org/properties/${pathSeg(args.applicationId, 'applicationId')}/monitors/${pathSeg(args.stage, 'stage')}/status`,\n }),\n },\n];\n\nexport const runbooksGroup = apiToolGroup('runbooks', tools);\n","/**\n * MCP tools for exploration cycles. Mirrors `cofactor exploration\n * run|cancel|cycles|cycle`; the application is passed by UUID.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport { type ApiTool, apiToolGroup, pathSeg, requireString, withQuery } from '../api-tool';\nimport type { JsonSchema } from '../types';\n\nconst APPLICATION_ID = { type: 'string', description: 'Application (property) UUID' } as const;\nconst CYCLE_ID = { type: 'string', description: 'The exploration cycle id (excy_...)' } as const;\nconst cycleOnly: JsonSchema = { type: 'object', properties: { cycleId: CYCLE_ID }, required: ['cycleId'] };\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_exploration_run',\n ...additive('Start exploration cycles', false),\n description:\n 'Start an exploration cycle now; with cycles > 1 they run back to back. The application must have been onboarded. If a cycle is already running, returns it with alreadyRunning=true. Requires the exploration org feature.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n cycles: { type: 'number', description: 'Number of cycles, 1 to 100 (default 1)' },\n credentialIds: { type: 'array', items: { type: 'string' }, description: 'Credential ids to explore with' },\n },\n required: ['applicationId'],\n },\n request: (args) => {\n const cycles = args.cycles === undefined ? 1 : Number(args.cycles);\n if (!Number.isInteger(cycles) || cycles < 1 || cycles > 100) {\n throw new Error('cycles must be a whole number from 1 to 100');\n }\n const credentialIds = Array.isArray(args.credentialIds) ? args.credentialIds.map(String) : [];\n return {\n method: 'POST',\n path: '/exploration/run',\n body: {\n propertyId: requireString(args.applicationId, 'applicationId'),\n cycles,\n ...(credentialIds.length > 0 ? { credentialIds } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_exploration_cancel',\n ...modifying('Cancel an exploration cycle', true),\n description: 'Stop a running exploration cycle. Stops its worker runs and drops any queued cycles. Requires the exploration org feature.',\n inputSchema: cycleOnly,\n request: (args) => ({ method: 'POST', path: `/exploration/cycles/${pathSeg(args.cycleId, 'cycleId')}/cancel` }),\n },\n {\n name: 'cofactor_exploration_cycles',\n ...readOnly('List exploration cycles'),\n description: 'List recent exploration cycles for an application. Requires the exploration org feature.',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID, limit: { type: 'number', description: 'Maximum cycles (default 20)' } },\n required: ['applicationId'],\n },\n request: (args) => ({\n method: 'GET',\n path: withQuery('/exploration/cycles', {\n propertyId: requireString(args.applicationId, 'applicationId'),\n pageSize: args.limit ?? 20,\n }),\n }),\n },\n {\n name: 'cofactor_exploration_cycle',\n ...readOnly('Get an exploration cycle'),\n description: 'One exploration cycle: summary, workers, map changes, and leads. Requires the exploration org feature.',\n inputSchema: cycleOnly,\n request: (args) => ({ method: 'GET', path: `/exploration/cycles/${pathSeg(args.cycleId, 'cycleId')}` }),\n },\n];\n\nexport const explorationGroup = apiToolGroup('exploration', tools);\n","/**\n * MCP tools for reading the Microsoft Teams connection. Mirrors `cofactor teams\n * status|channels`. Install, bind, and disconnect change the connection and are\n * not exposed.\n *\n * @module\n */\n\nimport { readOnly } from '../annotations';\nimport { type ApiTool, apiToolGroup } from '../api-tool';\n\nconst none = { type: 'object', properties: {} } as const;\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_teams_status',\n ...readOnly('Get the Teams connection'),\n description:\n 'The organization\\'s Microsoft Teams connection state: tenantId, teamsAppId, isBound, isInCatalog, isFlagEnabled, installCount. Installed channels come from cofactor_teams_channels. Requires the chat.teams org feature.',\n inputSchema: none,\n request: () => ({ method: 'GET', path: '/integrations/teams/connection' }),\n },\n {\n name: 'cofactor_teams_channels',\n ...readOnly('List Teams channels'),\n description: 'Channels the Cofactor app is installed in, with the references alerts use. Requires the chat.teams org feature.',\n inputSchema: none,\n request: () => ({ method: 'GET', path: '/integrations/teams/channels' }),\n },\n];\n\nexport const teamsGroup = apiToolGroup('teams', tools);\n","/**\n * MCP tools for setting up an application's sandboxes, claiming one, running\n * commands in it, and managing the application's sandbox secrets.\n *\n * Mirrors `cofactor sandbox envs|connect|claim|show|exec|secret`, plus the two\n * calls `verify-env` makes per environment (`auth-check`, `destroy`), so an\n * agent can compose verify-env itself. Left to the CLI: `push` (it reads an\n * image from a local Docker daemon), `validate` (it reads a local file offline)\n * and `github connect` (a browser handoff).\n *\n * Claim never waits: it returns the sandbox id and the agent polls\n * `cofactor_sandbox_get` until status is ready or failed.\n *\n * `exec` only enqueues the command (the CLI then polls), so the result is read\n * with `cofactor_sandbox_run_get`. Secret values go in as a tool argument\n * instead of stdin; no tool returns one. Exec output is masked of literal secret\n * values only, so a command can still reveal one; the exec description says so.\n *\n * @module\n */\n\nimport { additive, modifying, readOnly } from '../annotations';\nimport { type ApiTool, CONFIRM_PROPERTY, apiToolGroup, pathSeg, requireConfirm, requireString, withQuery } from '../api-tool';\n\nconst SANDBOX_ID = { type: 'string', description: 'The claimed sandbox id (UUID)' } as const;\nconst APPLICATION_ID = { type: 'string', description: 'The application id (UUID)' } as const;\nconst SECRET_NAME = {\n type: 'string',\n description: 'Environment variable name: letters A-Z, digits and underscores',\n} as const;\nconst SECRET_ENVIRONMENT = {\n type: 'string',\n description: 'The application environment name the secret applies to; omit for all environments',\n} as const;\n\nfunction secretPath(args: Record<string, unknown>): string {\n return `/org/applications/${pathSeg(args.applicationId, 'applicationId')}/sandbox/secrets`;\n}\n\nconst tools: ApiTool[] = [\n {\n name: 'cofactor_sandbox_application_get',\n ...readOnly('Get an application\\'s sandbox setup'),\n description:\n 'Get an application\\'s sandbox setup: whether it is connected to a repository or pushed, its default version, and the environments, personas, actions and emulation its cofactor.sandbox.yaml declares (cofactor sandbox envs). Use it to check the result of cofactor_sandbox_connect.',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID },\n required: ['applicationId'],\n },\n request: (args) => ({ method: 'GET', path: `/org/applications/${pathSeg(args.applicationId, 'applicationId')}/sandbox` }),\n },\n {\n name: 'cofactor_sandbox_connect',\n ...modifying('Connect an application to a repository for sandboxes', true),\n description:\n 'Build an existing application\\'s sandboxes from the cofactor.sandbox.yaml in a GitHub repository directory (cofactor sandbox connect), replacing any earlier connection. The repository must already be reachable by Cofactor\\'s GitHub App; if it is not, the error says so, and the user must run `cofactor github connect` (a browser step). Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n repo: { type: 'string', description: 'GitHub repository as owner/name' },\n definitionDir: { type: 'string', description: 'Directory in the repository holding cofactor.sandbox.yaml (default \".\")' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['applicationId', 'repo', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'connect this application to the repository');\n return {\n method: 'PUT',\n path: `/org/applications/${pathSeg(args.applicationId, 'applicationId')}/sandbox`,\n body: {\n repo: requireString(args.repo, 'repo'),\n ...(typeof args.definitionDir === 'string' && args.definitionDir ? { definitionDir: args.definitionDir } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_sandbox_claim',\n ...additive('Claim a sandbox', false),\n description:\n 'Claim a sandbox of an application\\'s environment at a version (cofactor sandbox claim). Returns the sandbox id right away; poll cofactor_sandbox_get until its status is ready or failed. The sandbox is leased to the caller until destroyed or its lease ends, so destroy it with cofactor_sandbox_destroy when done.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n environment: { type: 'string', description: 'Environment name from cofactor_sandbox_application_get (default \"default\")' },\n version: { type: 'string', description: 'Commit SHA (repository-connected) or push id/tag (pushed); the default version when omitted' },\n timeoutSeconds: { type: 'number', description: 'Fail the claim if not ready by then (60 to 86400, default 7200)' },\n },\n required: ['applicationId'],\n },\n request: (args) => ({\n method: 'POST',\n path: '/org/sandboxes-v2/sandboxes',\n body: {\n applicationId: requireString(args.applicationId, 'applicationId'),\n ...(typeof args.environment === 'string' && args.environment ? { environment: args.environment } : {}),\n ...(typeof args.version === 'string' && args.version ? { version: args.version } : {}),\n ...(args.timeoutSeconds !== undefined ? { timeoutSeconds: args.timeoutSeconds } : {}),\n },\n }),\n },\n {\n name: 'cofactor_sandbox_get',\n ...readOnly('Get a sandbox'),\n description:\n 'Get a claimed sandbox (cofactor sandbox show): status (claiming, ready, failed), error, ready time, personas, seed outputs, sign-in URL, and its actions and operations. Poll it after cofactor_sandbox_claim.',\n inputSchema: {\n type: 'object',\n properties: { sandboxId: SANDBOX_ID },\n required: ['sandboxId'],\n },\n request: (args) => ({ method: 'GET', path: `/org/sandboxes-v2/sandboxes/${pathSeg(args.sandboxId, 'sandboxId')}` }),\n },\n {\n name: 'cofactor_sandbox_auth_check',\n ...additive('Check a persona signs in', true),\n description:\n 'Sign one persona in to a ready sandbox the way a Login step would, and report whether it worked (the check cofactor sandbox verify-env runs per persona). To verify an environment: claim it, wait until ready, run this for each persona from cofactor_sandbox_get, then destroy the sandbox.',\n inputSchema: {\n type: 'object',\n properties: { sandboxId: SANDBOX_ID, persona: { type: 'string', description: 'Persona name from the sandbox\\'s personas' } },\n required: ['sandboxId', 'persona'],\n },\n request: (args) => ({\n method: 'POST',\n path: `/org/sandboxes-v2/sandboxes/${pathSeg(args.sandboxId, 'sandboxId')}/auth-check`,\n body: { persona: requireString(args.persona, 'persona') },\n // The API waits on the script (up to 60 s) and the sandbox connection.\n timeoutMs: 90_000,\n }),\n },\n {\n name: 'cofactor_sandbox_destroy',\n ...modifying('Destroy a sandbox', true),\n description: 'Destroy a claimed sandbox and everything in it (cofactor sandbox destroy). Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: { sandboxId: SANDBOX_ID, confirm: CONFIRM_PROPERTY },\n required: ['sandboxId', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'destroy this sandbox');\n return { method: 'DELETE', path: `/org/sandboxes-v2/sandboxes/${pathSeg(args.sandboxId, 'sandboxId')}` };\n },\n },\n {\n name: 'cofactor_sandbox_exec',\n ...modifying('Run a command in a sandbox', false),\n description:\n 'Run one shell command in a claimed, ready sandbox. Returns a run id right away; read the exit code and the last 4000 characters of stdout and stderr with cofactor_sandbox_run_get until its status is no longer running. The command can change anything in the sandbox, and its output can reveal the sandbox\\'s secrets (the API only masks literal values), so never surface secret values. Show the user the exact command before asking for confirm. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n sandboxId: SANDBOX_ID,\n command: { type: 'string', description: 'Shell command; quote pipes and redirects yourself' },\n timeoutSeconds: { type: 'number', description: 'Kill the command after this many seconds (default 300, max 1800)' },\n confirm: CONFIRM_PROPERTY,\n },\n required: ['sandboxId', 'command', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'run this command in the sandbox');\n return {\n method: 'POST',\n path: `/org/sandboxes-v2/sandboxes/${pathSeg(args.sandboxId, 'sandboxId')}/exec`,\n body: {\n command: requireString(args.command, 'command'),\n ...(args.timeoutSeconds !== undefined ? { timeoutSeconds: args.timeoutSeconds } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_sandbox_run_get',\n ...readOnly('Get a sandbox run'),\n description:\n 'Get a sandbox run (an exec or an action): status running, succeeded or failed, exit code, output tails, and error. Poll it after cofactor_sandbox_exec.',\n inputSchema: {\n type: 'object',\n properties: { runId: { type: 'string', description: 'The run id returned by cofactor_sandbox_exec (UUID)' } },\n required: ['runId'],\n },\n request: (args) => ({ method: 'GET', path: `/org/sandboxes-v2/runs/${pathSeg(args.runId, 'runId')}` }),\n },\n {\n name: 'cofactor_sandbox_secret_list',\n ...readOnly('List sandbox secrets'),\n description: 'List the names, scopes, and update times of an application\\'s sandbox secrets. Values are never returned.',\n inputSchema: {\n type: 'object',\n properties: { applicationId: APPLICATION_ID },\n required: ['applicationId'],\n },\n request: (args) => ({ method: 'GET', path: secretPath(args) }),\n },\n {\n name: 'cofactor_sandbox_secret_set',\n ...modifying('Set a sandbox secret', true),\n description:\n 'Set a third-party secret (an API key and the like) for an application\\'s sandboxes, replacing any value already set for that name and scope. The value is stored encrypted and never returned (the value does appear in this conversation, so prefer the CLI for production secrets). Only pass a value the user gave you for this purpose. Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n name: SECRET_NAME,\n value: { type: 'string', description: 'The secret value; stored encrypted, never echoed back' },\n environment: SECRET_ENVIRONMENT,\n confirm: CONFIRM_PROPERTY,\n },\n required: ['applicationId', 'name', 'value', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'set this sandbox secret');\n return {\n method: 'PUT',\n path: `${secretPath(args)}/${pathSeg(args.name, 'name')}`,\n body: {\n value: requireString(args.value, 'value'),\n ...(typeof args.environment === 'string' && args.environment ? { environment: args.environment } : {}),\n },\n };\n },\n },\n {\n name: 'cofactor_sandbox_secret_remove',\n ...modifying('Remove a sandbox secret', true),\n description: 'Remove a sandbox secret at one scope (all environments, or one environment). Requires confirm=true.',\n inputSchema: {\n type: 'object',\n properties: {\n applicationId: APPLICATION_ID,\n name: SECRET_NAME,\n environment: SECRET_ENVIRONMENT,\n confirm: CONFIRM_PROPERTY,\n },\n required: ['applicationId', 'name', 'confirm'],\n },\n request: (args) => {\n requireConfirm(args, 'remove this sandbox secret');\n return {\n method: 'DELETE',\n path: withQuery(`${secretPath(args)}/${pathSeg(args.name, 'name')}`, { environment: args.environment }),\n };\n },\n },\n];\n\nexport const sandboxGroup = apiToolGroup('sandbox', tools);\n","import type { ToolGroup } from '../types';\nimport { getWorkflowToolDefinitions, handleWorkflowTool } from './workflows';\nimport {\n getWorkflowProposalsToolDefinitions,\n handleWorkflowProposalsTool,\n} from './workflow-proposals';\nimport { getWorkflowRunsToolDefinitions, handleWorkflowRunsTool } from './workflow-runs';\nimport { getTestSuiteToolDefinitions, handleTestSuiteTool } from './test-suites';\nimport { getCredentialToolDefinitions, handleCredentialTool } from './credentials';\nimport { getIssueToolDefinitions, handleIssueTool } from './issues';\nimport { getProductMapToolDefinitions, handleProductMapTool } from './product-map';\nimport { workflowLifecycleGroup } from './workflow-lifecycle';\nimport { workflowAuthoringGroup } from './workflow-authoring';\nimport { testSuiteManagementGroup } from './test-suite-management';\nimport { issuesManagementGroup } from './issues-management';\nimport { tagsGroup } from './tags';\nimport { contentGroup } from './content';\nimport { applicationsGroup, environmentsGroup } from './applications';\nimport { personasGroup } from './personas';\nimport { productMapEditGroup } from './product-map-edit';\nimport { apiCatalogGroup } from './api-catalog';\nimport { schedulesGroup } from './schedules';\nimport { alertsGroup } from './alerts';\nimport { releasesGroup } from './releases';\nimport { runbooksGroup } from './runbooks';\nimport { explorationGroup } from './exploration';\nimport { teamsGroup } from './teams';\nimport { sandboxGroup } from './sandbox';\n\nexport const workflowsGroup: ToolGroup = {\n id: 'workflows',\n definitions: getWorkflowToolDefinitions,\n handle: (tool, args) => handleWorkflowTool(tool, args),\n};\n\nexport const workflowProposalsGroup: ToolGroup = {\n id: 'workflow-proposals',\n definitions: getWorkflowProposalsToolDefinitions,\n handle: (tool, args) => handleWorkflowProposalsTool(tool, args),\n};\n\nexport const workflowRunsGroup: ToolGroup = {\n id: 'workflow-runs',\n definitions: getWorkflowRunsToolDefinitions,\n handle: (tool, args) => handleWorkflowRunsTool(tool, args),\n};\n\nexport const testSuitesGroup: ToolGroup = {\n id: 'test-suites',\n definitions: getTestSuiteToolDefinitions,\n handle: (tool, args) => handleTestSuiteTool(tool, args),\n};\n\nexport const credentialsGroup: ToolGroup = {\n id: 'credentials',\n definitions: getCredentialToolDefinitions,\n handle: (tool, args) => handleCredentialTool(tool, args),\n};\n\nexport const issuesGroup: ToolGroup = {\n id: 'issues',\n definitions: getIssueToolDefinitions,\n handle: (tool, args) => handleIssueTool(tool, args),\n};\n\nexport const productMapGroup: ToolGroup = {\n id: 'product-map',\n definitions: getProductMapToolDefinitions,\n handle: (tool, args) => handleProductMapTool(tool, args),\n};\n\n/**\n * All HTTP-only groups (no daemon, no CLI auth state). Safe to use from any\n * MCP host that has an `apiToken` for the Cofactor API.\n */\nexport const sharedGroups: ToolGroup[] = [\n workflowsGroup,\n workflowLifecycleGroup,\n workflowAuthoringGroup,\n issuesManagementGroup,\n tagsGroup,\n contentGroup,\n applicationsGroup,\n environmentsGroup,\n personasGroup,\n productMapEditGroup,\n apiCatalogGroup,\n schedulesGroup,\n alertsGroup,\n releasesGroup,\n runbooksGroup,\n explorationGroup,\n teamsGroup,\n sandboxGroup,\n workflowProposalsGroup,\n workflowRunsGroup,\n testSuitesGroup,\n testSuiteManagementGroup,\n credentialsGroup,\n issuesGroup,\n productMapGroup,\n];\n"],"mappings":";;;;;;;;;;;;AA0BO,IAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AACd;AAGO,IAAM,cAAc,OAAO,KAAK,YAAY;AA6B5C,IAAM,mBAAmB;AAEzB,IAAM,gBAAgB,CAAC,QAAkB,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAG/F,eAAe,UACb,QACA,OACA,KAC8C;AAC9C,MAAI;AACJ,MAAI;AACF,UAAM,MAAM,MAAM,GAAG,MAAM,gBAAgB,mBAAmB,GAAG,CAAC,IAAI;AAAA,MACpE,SAAS,EAAE,eAAe,UAAU,KAAK,GAAG;AAAA,MAC5C,UAAU;AAAA,MACV,QAAQ,YAAY,QAAQ,gBAAgB;AAAA,IAC9C,CAAC;AAAA,EACH,SAAS,KAAK;AACZ,WAAO,EAAE,OAAO,kBAAkB,GAAG,KAAK,cAAc,GAAG,CAAC,IAAI;AAAA,EAClE;AACA,QAAM,WAAW,IAAI,QAAQ,IAAI,UAAU;AAC3C,SAAO,IAAI,WAAW,OAAO,WACzB,EAAE,KAAK,SAAS,IAChB,EAAE,OAAO,kBAAkB,GAAG,UAAU,IAAI,MAAM,IAAI;AAC5D;AAQA,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;AAGzB,eAAe,mBAAyB,OAAY,OAAe,IAA2C;AAC5G,QAAM,UAAU,IAAI,MAAS,MAAM,MAAM;AACzC,MAAI,OAAO;AACX,QAAM,SAAS,YAAY;AACzB,WAAO,OAAO,MAAM,QAAQ;AAC1B,YAAM,IAAI;AACV,cAAQ,CAAC,IAAI,MAAM,G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MAAM,IAAI;AAC3D;AAEO,IAAM,kBAA6B;AAAA,EACxC,IAAI;AAAA,EACJ,aAAa;AAAA,EACb,QAAQ,CAAC,MAAM,SAAS,oBAAoB,MAAM,IAAI;AACxD;AAEO,IAAM,mBAA8B;AAAA,EACzC,IAAI;AAAA,EACJ,aAAa;AAAA,EACb,QAAQ,CAAC,MAAM,SAAS,qBAAqB,MAAM,IAAI;AACzD;AAEO,IAAM,cAAyB;AAAA,EACpC,IAAI;AAAA,EACJ,aAAa;AAAA,EACb,QAAQ,CAAC,MAAM,SAAS,gBAAgB,MAAM,IAAI;AACpD;AAEO,IAAM,kBAA6B;AAAA,EACxC,IAAI;AAAA,EACJ,aAAa;AAAA,EACb,QAAQ,CAAC,MAAM,SAAS,qBAAqB,MAAM,IAAI;AACzD;AAMO,IAAM,eAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["tools","result","WORKFLOW_ID","tools","tools","tools","tools","tools","APPLICATION_ID","tools","tools","tools","RULE_ID","DESCRIPTION","RULE_ID","tools","DESCRIPTION","ACTION_TYPE","ruleOnly","RULE_ID","tools","DESCRIPTION","APPLICATION_ID","RUN_ID","tools","APPLICATION_ID","tools","APPLICATION_ID","tools","tools","APPLICATION_ID","tools"]}