@runcofactor/cli 0.55.0 → 0.56.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 (248) hide show
  1. package/dist/{account-RHHS7HT4.js → account-CZYZD2JS.js} +5 -5
  2. package/dist/{alert-B5WEOKHP.js → alert-JQ4SDEB7.js} +8 -8
  3. package/dist/{api-catalog-UXONX3BR.js → api-catalog-IWQC35P2.js} +5 -5
  4. package/dist/{api-key-J3A4TJKN.js → api-key-GUDXIIEA.js} +5 -5
  5. package/dist/{attachment-ZQW7DR4G.js → attachment-CPZYOBUB.js} +5 -5
  6. package/dist/{auth-HQGKUZBS.js → auth-DS6MBVEI.js} +3 -3
  7. package/dist/{benchmark-TIKJA32J.js → benchmark-6HPCIQHD.js} +5 -5
  8. package/dist/{blackcat-Z5LNV2GS.js → blackcat-V3L63WFE.js} +3 -3
  9. package/dist/{chunk-JQG3V5E3.js → chunk-2E3STBHS.js} +2 -2
  10. package/dist/{chunk-KL2ARGH6.js → chunk-2OHYMT3A.js} +3 -3
  11. package/dist/{chunk-KL2ARGH6.js.map → chunk-2OHYMT3A.js.map} +1 -1
  12. package/dist/{chunk-W6DL4IP6.js → chunk-3LGCHNBC.js} +2 -2
  13. package/dist/{chunk-BJHAVM7Z.js → chunk-4MFMPC5P.js} +46 -2
  14. package/dist/chunk-4MFMPC5P.js.map +1 -0
  15. package/dist/{chunk-MB4FS35J.js → chunk-56HFZHQM.js} +8 -8
  16. package/dist/{chunk-CZDQVQ57.js → chunk-5OYWNS6D.js} +20 -9
  17. package/dist/chunk-5OYWNS6D.js.map +1 -0
  18. package/dist/{chunk-YTXZUWMN.js → chunk-62EXS76C.js} +6 -6
  19. package/dist/{chunk-QVMGXMP5.js → chunk-6ILWJFKY.js} +368 -6
  20. package/dist/chunk-6ILWJFKY.js.map +1 -0
  21. package/dist/{chunk-6X6ZTDXP.js → chunk-BDOL622T.js} +4 -4
  22. package/dist/{chunk-L4JQ236V.js → chunk-C3CXVX2B.js} +4 -4
  23. package/dist/{chunk-33U56YGD.js → chunk-CWICLBLU.js} +2 -1
  24. package/dist/{chunk-33U56YGD.js.map → chunk-CWICLBLU.js.map} +1 -1
  25. package/dist/{chunk-XM3WTJ7Y.js → chunk-DEVD2WD2.js} +2 -2
  26. package/dist/{chunk-WWUEKQLR.js → chunk-EWK44F6V.js} +3 -3
  27. package/dist/chunk-EWK44F6V.js.map +1 -0
  28. package/dist/{chunk-CQSQNDMV.js → chunk-FNHPTTRF.js} +7 -5
  29. package/dist/chunk-FNHPTTRF.js.map +1 -0
  30. package/dist/{chunk-Z72GWGH2.js → chunk-GCD4EHCD.js} +6 -6
  31. package/dist/{chunk-3KBYI6RR.js → chunk-H6ZMKNP7.js} +3 -3
  32. package/dist/{chunk-5OKCT6LF.js → chunk-IEWAH7W3.js} +5 -5
  33. package/dist/{chunk-TGI2AAOZ.js → chunk-IV4HRGKX.js} +77 -12
  34. package/dist/chunk-IV4HRGKX.js.map +1 -0
  35. package/dist/{chunk-635IQV6B.js → chunk-J2ZQULU3.js} +2 -2
  36. package/dist/{chunk-ZZZ33KTO.js → chunk-K2IDR6FR.js} +3 -3
  37. package/dist/{chunk-YEH7UIUY.js → chunk-KTZRI27M.js} +4 -4
  38. package/dist/{chunk-RV7FZ4ID.js → chunk-L644NMDI.js} +3 -3
  39. package/dist/{chunk-RV7FZ4ID.js.map → chunk-L644NMDI.js.map} +1 -1
  40. package/dist/{chunk-3TZABC7D.js → chunk-LFT7GUWS.js} +63 -17
  41. package/dist/chunk-LFT7GUWS.js.map +1 -0
  42. package/dist/{chunk-QHRWXCON.js → chunk-O7B2IYCZ.js} +11 -11
  43. package/dist/chunk-O7B2IYCZ.js.map +1 -0
  44. package/dist/{chunk-U3MRXQZS.js → chunk-RHWPZKRV.js} +24 -1
  45. package/dist/chunk-RHWPZKRV.js.map +1 -0
  46. package/dist/{chunk-OU4I3MEH.js → chunk-UJSW72LG.js} +3 -3
  47. package/dist/{chunk-R2CRH6JQ.js → chunk-VACACCD6.js} +3 -3
  48. package/dist/{chunk-EGWVL5XA.js → chunk-VMAR67FF.js} +2 -2
  49. package/dist/{chunk-ZH7HWVEE.js → chunk-VMJ7TBVM.js} +2 -2
  50. package/dist/chunk-WRRA4ATV.js +332 -0
  51. package/dist/chunk-WRRA4ATV.js.map +1 -0
  52. package/dist/{chunk-XWJJYZQC.js → chunk-XHEVDABB.js} +2 -2
  53. package/dist/{chunk-SCQVBLNR.js → chunk-XHGF6VC6.js} +4 -4
  54. package/dist/{credential-2IEZDTH3.js → credential-GJW7LGYP.js} +5 -5
  55. package/dist/{credential-template-S5WSOI3P.js → credential-template-UWBYKKWD.js} +5 -5
  56. package/dist/dev-PBW7BSOD.js +605 -0
  57. package/dist/dev-PBW7BSOD.js.map +1 -0
  58. package/dist/{digest-HQGL7H6E.js → digest-XEHGCJM4.js} +8 -8
  59. package/dist/{docs-CJQZVERZ.js → docs-KH4BCEQF.js} +5 -5
  60. package/dist/{doctor-EGK5AB77.js → doctor-FOXXE5SK.js} +3 -3
  61. package/dist/{environment-MWVXYEDU.js → environment-EBDPQTIS.js} +7 -7
  62. package/dist/{eval-F4NORBQI.js → eval-QZSSEICV.js} +67 -27
  63. package/dist/eval-QZSSEICV.js.map +1 -0
  64. package/dist/{exploration-JC7R7KTJ.js → exploration-LCGKRGOQ.js} +5 -5
  65. package/dist/{exploratory-test-BHK5FTMJ.js → exploratory-test-SGECQGIX.js} +6 -6
  66. package/dist/{external-run-UL5CKG54.js → external-run-2AJAI5O7.js} +9 -9
  67. package/dist/{feature-flag-NMO25TZN.js → feature-flag-P7N4WQIH.js} +5 -5
  68. package/dist/{feedback-3JNPSUXS.js → feedback-LAT7TQ2T.js} +6 -6
  69. package/dist/{flow-AYE4RTZN.js → flow-NH2DC6AP.js} +5 -5
  70. package/dist/{github-DM2DCXRY.js → github-FCEKBLXI.js} +6 -6
  71. package/dist/index.js +106 -408
  72. package/dist/index.js.map +1 -1
  73. package/dist/{init-CPDT5XAU.js → init-5U5EZOAW.js} +5 -5
  74. package/dist/{install-JZRNCHMO.js → install-X3UNVXKY.js} +5 -5
  75. package/dist/{issues-GRFJB52C.js → issues-4P6I3YQW.js} +8 -8
  76. package/dist/{knobs-3Y4QXWAD.js → knobs-JKTWJ6ZG.js} +5 -5
  77. package/dist/{landing-ABYL5WVG.js → landing-6AGLKI66.js} +7 -7
  78. package/dist/{list-WG5QB4NK.js → list-TWP2RP33.js} +5 -5
  79. package/dist/{local-KX24OR5Z.js → local-D75QE5TB.js} +7 -7
  80. package/dist/{login-MLJQAIFK.js → login-RBET4TIP.js} +5 -5
  81. package/dist/{mcp-DDTO54XD.js → mcp-562SUUMK.js} +11 -11
  82. package/dist/{metrics-BJLLOSPQ.js → metrics-4WF2GEPA.js} +5 -5
  83. package/dist/{monitor-E2CKGHPM.js → monitor-WJXH54H2.js} +5 -5
  84. package/dist/{perf-IX7JOMUE.js → perf-C6N6P7YG.js} +12 -361
  85. package/dist/perf-C6N6P7YG.js.map +1 -0
  86. package/dist/{product-2ECWM2JN.js → product-CYEQ7HOB.js} +5 -5
  87. package/dist/{product-map-O542LZQL.js → product-map-MSDLIFZY.js} +7 -7
  88. package/dist/{prompts-Y7O4XJ5P.js → prompts-ME53WPN4.js} +5 -5
  89. package/dist/{proofs-TNOBLSRP.js → proofs-D3G6ZUFP.js} +11 -9
  90. package/dist/{property-TZCGOZQG.js → property-5GLJNAVB.js} +29 -10
  91. package/dist/property-5GLJNAVB.js.map +1 -0
  92. package/dist/{psql-M66YSUXW.js → psql-EXAUDU3W.js} +5 -5
  93. package/dist/{record-3JINBRAR.js → record-EE7NGNKY.js} +6 -6
  94. package/dist/{redis-FOIBINYA.js → redis-M4EYWKOJ.js} +5 -5
  95. package/dist/{release-B4VWMVEI.js → release-4KUWVWWC.js} +5 -5
  96. package/dist/{runbook-EYMSE37E.js → runbook-AHU77ANQ.js} +5 -5
  97. package/dist/{sandbox-R6EMGOKR.js → sandbox-FBLJEYA2.js} +1910 -1629
  98. package/dist/sandbox-FBLJEYA2.js.map +1 -0
  99. package/dist/{scenarios-W7YNLBVO.js → scenarios-TU656T2B.js} +5 -5
  100. package/dist/{schedule-EDHQJUUZ.js → schedule-DXJI6SYO.js} +8 -8
  101. package/dist/{session-4N62APNQ.js → session-RUFTJHF4.js} +10 -10
  102. package/dist/{skill-XFGMNOVM.js → skill-ZK76GQ47.js} +7 -7
  103. package/dist/{skill-XFGMNOVM.js.map → skill-ZK76GQ47.js.map} +1 -1
  104. package/dist/skills/cofactor-debug-run/SKILL.md +2 -1
  105. package/dist/skills/cofactor-debug-run/history/2.0.10.md +320 -0
  106. package/dist/skills/cofactor-debug-run/version.json +1 -1
  107. package/dist/{slack-RUAXG6TB.js → slack-M3OKDVMY.js} +6 -6
  108. package/dist/{spec-ZZKMW7ER.js → spec-5MXEBLYR.js} +5 -5
  109. package/dist/{src-OKSAEHQS.js → src-2X5OQRPJ.js} +4 -4
  110. package/dist/{src-DGIVA22K.js → src-72EFBA2R.js} +3 -3
  111. package/dist/{src-ECZWYNSV.js → src-KH6WSBJV.js} +5 -5
  112. package/dist/{src-CQ2YAW7F.js → src-VLV36QYH.js} +127 -20
  113. package/dist/src-VLV36QYH.js.map +1 -0
  114. package/dist/{start-OCZGILRL.js → start-PDYBRB5T.js} +5 -5
  115. package/dist/{status-YTJ6YITG.js → status-VMVPVCDA.js} +5 -5
  116. package/dist/{tag-KBG4SWRL.js → tag-7KTDLPVU.js} +6 -6
  117. package/dist/{task-O6XRMHYE.js → task-QLFYZNKR.js} +6 -6
  118. package/dist/{teams-NFUHS7XI.js → teams-Y7BXCY6P.js} +7 -7
  119. package/dist/{test-suite-6BH3DESN.js → test-suite-6U22AYFG.js} +15 -14
  120. package/dist/test-suite-6U22AYFG.js.map +1 -0
  121. package/dist/{tickets-JU2STK4B.js → tickets-CQDJDNPY.js} +5 -5
  122. package/dist/{trace-NMSGKASJ.js → trace-QDORWXYX.js} +8 -8
  123. package/dist/{triage-JGECJJU5.js → triage-GY7M3UGG.js} +6 -6
  124. package/dist/{trigger-OSPEVCCQ.js → trigger-DLFAORX4.js} +9 -9
  125. package/dist/{update-check-FNP6RFZO.js → update-check-ES6XQ7OF.js} +4 -4
  126. package/dist/{upgrade-3PPBXFAT.js → upgrade-WKEOW5GS.js} +5 -5
  127. package/dist/{usage-QMCU2JIO.js → usage-E6FDTR3W.js} +7 -7
  128. package/dist/{utilities-7VHWTSJT.js → utilities-4Z6YX3L5.js} +6 -6
  129. package/dist/{visual-WIZSPTVK.js → visual-TA6LPVDJ.js} +5 -5
  130. package/dist/{workflow-23HKTJLS.js → workflow-B5FXS2CJ.js} +58 -31
  131. package/dist/workflow-B5FXS2CJ.js.map +1 -0
  132. package/dist/{workflow-cache-ACGM3BOI.js → workflow-cache-MNLEMRMM.js} +16 -16
  133. package/dist/{workflow-cache-convergence-resolve-KEQDQMKL.js → workflow-cache-convergence-resolve-G5HJM6MF.js} +5 -5
  134. package/dist/{workflow-debug-TVLBNRCB.js → workflow-debug-TNBUGSBK.js} +11 -11
  135. package/dist/{workflow-feedback-GB5VPGE2.js → workflow-feedback-G2ZXAUGI.js} +5 -5
  136. package/dist/{workflow-fork-2IPJNR76.js → workflow-fork-6HHOMC2D.js} +5 -5
  137. package/dist/{workflow-promotion-QEQUXVUT.js → workflow-promotion-RG7L6JZT.js} +5 -5
  138. package/dist/{workflow-proposals-KHGTPMD4.js → workflow-proposals-ZNF2F3UE.js} +5 -5
  139. package/dist/{workflow-revisions-F5KQEEXB.js → workflow-revisions-TP64Z6FO.js} +5 -5
  140. package/dist/{workflow-status-66HC5MEA.js → workflow-status-5RG3JX56.js} +5 -5
  141. package/package.json +3 -2
  142. package/dist/chunk-3TZABC7D.js.map +0 -1
  143. package/dist/chunk-BJHAVM7Z.js.map +0 -1
  144. package/dist/chunk-CQSQNDMV.js.map +0 -1
  145. package/dist/chunk-CZDQVQ57.js.map +0 -1
  146. package/dist/chunk-QHRWXCON.js.map +0 -1
  147. package/dist/chunk-QVMGXMP5.js.map +0 -1
  148. package/dist/chunk-TGI2AAOZ.js.map +0 -1
  149. package/dist/chunk-U3MRXQZS.js.map +0 -1
  150. package/dist/chunk-WWUEKQLR.js.map +0 -1
  151. package/dist/eval-F4NORBQI.js.map +0 -1
  152. package/dist/perf-IX7JOMUE.js.map +0 -1
  153. package/dist/property-TZCGOZQG.js.map +0 -1
  154. package/dist/sandbox-R6EMGOKR.js.map +0 -1
  155. package/dist/src-CQ2YAW7F.js.map +0 -1
  156. package/dist/test-suite-6BH3DESN.js.map +0 -1
  157. package/dist/workflow-23HKTJLS.js.map +0 -1
  158. /package/dist/{account-RHHS7HT4.js.map → account-CZYZD2JS.js.map} +0 -0
  159. /package/dist/{alert-B5WEOKHP.js.map → alert-JQ4SDEB7.js.map} +0 -0
  160. /package/dist/{api-catalog-UXONX3BR.js.map → api-catalog-IWQC35P2.js.map} +0 -0
  161. /package/dist/{api-key-J3A4TJKN.js.map → api-key-GUDXIIEA.js.map} +0 -0
  162. /package/dist/{attachment-ZQW7DR4G.js.map → attachment-CPZYOBUB.js.map} +0 -0
  163. /package/dist/{auth-HQGKUZBS.js.map → auth-DS6MBVEI.js.map} +0 -0
  164. /package/dist/{benchmark-TIKJA32J.js.map → benchmark-6HPCIQHD.js.map} +0 -0
  165. /package/dist/{blackcat-Z5LNV2GS.js.map → blackcat-V3L63WFE.js.map} +0 -0
  166. /package/dist/{chunk-JQG3V5E3.js.map → chunk-2E3STBHS.js.map} +0 -0
  167. /package/dist/{chunk-W6DL4IP6.js.map → chunk-3LGCHNBC.js.map} +0 -0
  168. /package/dist/{chunk-MB4FS35J.js.map → chunk-56HFZHQM.js.map} +0 -0
  169. /package/dist/{chunk-YTXZUWMN.js.map → chunk-62EXS76C.js.map} +0 -0
  170. /package/dist/{chunk-6X6ZTDXP.js.map → chunk-BDOL622T.js.map} +0 -0
  171. /package/dist/{chunk-L4JQ236V.js.map → chunk-C3CXVX2B.js.map} +0 -0
  172. /package/dist/{chunk-XM3WTJ7Y.js.map → chunk-DEVD2WD2.js.map} +0 -0
  173. /package/dist/{chunk-Z72GWGH2.js.map → chunk-GCD4EHCD.js.map} +0 -0
  174. /package/dist/{chunk-3KBYI6RR.js.map → chunk-H6ZMKNP7.js.map} +0 -0
  175. /package/dist/{chunk-5OKCT6LF.js.map → chunk-IEWAH7W3.js.map} +0 -0
  176. /package/dist/{chunk-635IQV6B.js.map → chunk-J2ZQULU3.js.map} +0 -0
  177. /package/dist/{chunk-ZZZ33KTO.js.map → chunk-K2IDR6FR.js.map} +0 -0
  178. /package/dist/{chunk-YEH7UIUY.js.map → chunk-KTZRI27M.js.map} +0 -0
  179. /package/dist/{chunk-OU4I3MEH.js.map → chunk-UJSW72LG.js.map} +0 -0
  180. /package/dist/{chunk-R2CRH6JQ.js.map → chunk-VACACCD6.js.map} +0 -0
  181. /package/dist/{chunk-EGWVL5XA.js.map → chunk-VMAR67FF.js.map} +0 -0
  182. /package/dist/{chunk-ZH7HWVEE.js.map → chunk-VMJ7TBVM.js.map} +0 -0
  183. /package/dist/{chunk-XWJJYZQC.js.map → chunk-XHEVDABB.js.map} +0 -0
  184. /package/dist/{chunk-SCQVBLNR.js.map → chunk-XHGF6VC6.js.map} +0 -0
  185. /package/dist/{credential-2IEZDTH3.js.map → credential-GJW7LGYP.js.map} +0 -0
  186. /package/dist/{credential-template-S5WSOI3P.js.map → credential-template-UWBYKKWD.js.map} +0 -0
  187. /package/dist/{digest-HQGL7H6E.js.map → digest-XEHGCJM4.js.map} +0 -0
  188. /package/dist/{docs-CJQZVERZ.js.map → docs-KH4BCEQF.js.map} +0 -0
  189. /package/dist/{doctor-EGK5AB77.js.map → doctor-FOXXE5SK.js.map} +0 -0
  190. /package/dist/{environment-MWVXYEDU.js.map → environment-EBDPQTIS.js.map} +0 -0
  191. /package/dist/{exploration-JC7R7KTJ.js.map → exploration-LCGKRGOQ.js.map} +0 -0
  192. /package/dist/{exploratory-test-BHK5FTMJ.js.map → exploratory-test-SGECQGIX.js.map} +0 -0
  193. /package/dist/{external-run-UL5CKG54.js.map → external-run-2AJAI5O7.js.map} +0 -0
  194. /package/dist/{feature-flag-NMO25TZN.js.map → feature-flag-P7N4WQIH.js.map} +0 -0
  195. /package/dist/{feedback-3JNPSUXS.js.map → feedback-LAT7TQ2T.js.map} +0 -0
  196. /package/dist/{flow-AYE4RTZN.js.map → flow-NH2DC6AP.js.map} +0 -0
  197. /package/dist/{github-DM2DCXRY.js.map → github-FCEKBLXI.js.map} +0 -0
  198. /package/dist/{init-CPDT5XAU.js.map → init-5U5EZOAW.js.map} +0 -0
  199. /package/dist/{install-JZRNCHMO.js.map → install-X3UNVXKY.js.map} +0 -0
  200. /package/dist/{issues-GRFJB52C.js.map → issues-4P6I3YQW.js.map} +0 -0
  201. /package/dist/{knobs-3Y4QXWAD.js.map → knobs-JKTWJ6ZG.js.map} +0 -0
  202. /package/dist/{landing-ABYL5WVG.js.map → landing-6AGLKI66.js.map} +0 -0
  203. /package/dist/{list-WG5QB4NK.js.map → list-TWP2RP33.js.map} +0 -0
  204. /package/dist/{local-KX24OR5Z.js.map → local-D75QE5TB.js.map} +0 -0
  205. /package/dist/{login-MLJQAIFK.js.map → login-RBET4TIP.js.map} +0 -0
  206. /package/dist/{mcp-DDTO54XD.js.map → mcp-562SUUMK.js.map} +0 -0
  207. /package/dist/{metrics-BJLLOSPQ.js.map → metrics-4WF2GEPA.js.map} +0 -0
  208. /package/dist/{monitor-E2CKGHPM.js.map → monitor-WJXH54H2.js.map} +0 -0
  209. /package/dist/{product-2ECWM2JN.js.map → product-CYEQ7HOB.js.map} +0 -0
  210. /package/dist/{product-map-O542LZQL.js.map → product-map-MSDLIFZY.js.map} +0 -0
  211. /package/dist/{prompts-Y7O4XJ5P.js.map → prompts-ME53WPN4.js.map} +0 -0
  212. /package/dist/{proofs-TNOBLSRP.js.map → proofs-D3G6ZUFP.js.map} +0 -0
  213. /package/dist/{psql-M66YSUXW.js.map → psql-EXAUDU3W.js.map} +0 -0
  214. /package/dist/{record-3JINBRAR.js.map → record-EE7NGNKY.js.map} +0 -0
  215. /package/dist/{redis-FOIBINYA.js.map → redis-M4EYWKOJ.js.map} +0 -0
  216. /package/dist/{release-B4VWMVEI.js.map → release-4KUWVWWC.js.map} +0 -0
  217. /package/dist/{runbook-EYMSE37E.js.map → runbook-AHU77ANQ.js.map} +0 -0
  218. /package/dist/{scenarios-W7YNLBVO.js.map → scenarios-TU656T2B.js.map} +0 -0
  219. /package/dist/{schedule-EDHQJUUZ.js.map → schedule-DXJI6SYO.js.map} +0 -0
  220. /package/dist/{session-4N62APNQ.js.map → session-RUFTJHF4.js.map} +0 -0
  221. /package/dist/{slack-RUAXG6TB.js.map → slack-M3OKDVMY.js.map} +0 -0
  222. /package/dist/{spec-ZZKMW7ER.js.map → spec-5MXEBLYR.js.map} +0 -0
  223. /package/dist/{src-DGIVA22K.js.map → src-2X5OQRPJ.js.map} +0 -0
  224. /package/dist/{src-ECZWYNSV.js.map → src-72EFBA2R.js.map} +0 -0
  225. /package/dist/{src-OKSAEHQS.js.map → src-KH6WSBJV.js.map} +0 -0
  226. /package/dist/{start-OCZGILRL.js.map → start-PDYBRB5T.js.map} +0 -0
  227. /package/dist/{status-YTJ6YITG.js.map → status-VMVPVCDA.js.map} +0 -0
  228. /package/dist/{tag-KBG4SWRL.js.map → tag-7KTDLPVU.js.map} +0 -0
  229. /package/dist/{task-O6XRMHYE.js.map → task-QLFYZNKR.js.map} +0 -0
  230. /package/dist/{teams-NFUHS7XI.js.map → teams-Y7BXCY6P.js.map} +0 -0
  231. /package/dist/{tickets-JU2STK4B.js.map → tickets-CQDJDNPY.js.map} +0 -0
  232. /package/dist/{trace-NMSGKASJ.js.map → trace-QDORWXYX.js.map} +0 -0
  233. /package/dist/{triage-JGECJJU5.js.map → triage-GY7M3UGG.js.map} +0 -0
  234. /package/dist/{trigger-OSPEVCCQ.js.map → trigger-DLFAORX4.js.map} +0 -0
  235. /package/dist/{update-check-FNP6RFZO.js.map → update-check-ES6XQ7OF.js.map} +0 -0
  236. /package/dist/{upgrade-3PPBXFAT.js.map → upgrade-WKEOW5GS.js.map} +0 -0
  237. /package/dist/{usage-QMCU2JIO.js.map → usage-E6FDTR3W.js.map} +0 -0
  238. /package/dist/{utilities-7VHWTSJT.js.map → utilities-4Z6YX3L5.js.map} +0 -0
  239. /package/dist/{visual-WIZSPTVK.js.map → visual-TA6LPVDJ.js.map} +0 -0
  240. /package/dist/{workflow-cache-ACGM3BOI.js.map → workflow-cache-MNLEMRMM.js.map} +0 -0
  241. /package/dist/{workflow-cache-convergence-resolve-KEQDQMKL.js.map → workflow-cache-convergence-resolve-G5HJM6MF.js.map} +0 -0
  242. /package/dist/{workflow-debug-TVLBNRCB.js.map → workflow-debug-TNBUGSBK.js.map} +0 -0
  243. /package/dist/{workflow-feedback-GB5VPGE2.js.map → workflow-feedback-G2ZXAUGI.js.map} +0 -0
  244. /package/dist/{workflow-fork-2IPJNR76.js.map → workflow-fork-6HHOMC2D.js.map} +0 -0
  245. /package/dist/{workflow-promotion-QEQUXVUT.js.map → workflow-promotion-RG7L6JZT.js.map} +0 -0
  246. /package/dist/{workflow-proposals-KHGTPMD4.js.map → workflow-proposals-ZNF2F3UE.js.map} +0 -0
  247. /package/dist/{workflow-revisions-F5KQEEXB.js.map → workflow-revisions-TP64Z6FO.js.map} +0 -0
  248. /package/dist/{workflow-status-66HC5MEA.js.map → workflow-status-5RG3JX56.js.map} +0 -0
@@ -0,0 +1,605 @@
1
+ import { createRequire as __cr } from "module"; import { fileURLToPath as __fup } from "url"; import { dirname as __dn } from "path"; const require = __cr(import.meta.url); const __filename = __fup(import.meta.url); const __dirname = __dn(__filename);
2
+ import {
3
+ ProcessExitSignal
4
+ } from "./chunk-WRRA4ATV.js";
5
+ import {
6
+ apiRequest,
7
+ getPositionalArg
8
+ } from "./chunk-EWK44F6V.js";
9
+ import "./chunk-W7CFLOEI.js";
10
+ import "./chunk-S3Q7MDCS.js";
11
+ import {
12
+ GLOBAL_VALUE_FLAGS,
13
+ getArgValue,
14
+ hasFlag,
15
+ resolveConfig
16
+ } from "./chunk-4MFMPC5P.js";
17
+ import {
18
+ writeRawOutput
19
+ } from "./chunk-2OHYMT3A.js";
20
+ import "./chunk-RHWPZKRV.js";
21
+ import "./chunk-TOWZAG3I.js";
22
+
23
+ // src/dev.ts
24
+ import { execFileSync } from "child_process";
25
+ import path2 from "path";
26
+ import process2 from "process";
27
+ import { stripVTControlCharacters } from "util";
28
+
29
+ // ../sandbox-helper/src/ade-manifest.ts
30
+ import { parse, stringify } from "yaml";
31
+ import { z } from "zod";
32
+ var ADE_MANIFEST_FILE = "cofactor.ade.yaml";
33
+ var KIB = 1024;
34
+ var ADE_TEXT_MAX_BYTES = 32 * KIB;
35
+ var ADE_SETUP_MAX_BYTES = 96 * KIB;
36
+ var NAME = /^[a-z][a-z0-9-]{0,31}$/;
37
+ var GITHUB_REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
38
+ var repoPath = z.string().min(1).refine(
39
+ (value) => !value.startsWith("/") && value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== ".."),
40
+ "must be a relative path inside the repo"
41
+ );
42
+ var command = z.string().trim().min(1);
43
+ var repoSchema = z.strictObject({
44
+ github: z.string().regex(GITHUB_REPO, "must be owner/name on github.com").refine((value) => value.split("/").every((segment) => segment !== "." && segment !== ".."), "must be owner/name on github.com"),
45
+ install: z.array(command)
46
+ });
47
+ var agentSchema = z.strictObject({
48
+ install: command,
49
+ run: command,
50
+ /** The headless command for `--task`; an agent without one is interactive-only. */
51
+ task: command.optional()
52
+ });
53
+ var ADE_MAX_SHAPE = { vcpus: 14, memory_mib: 30720 };
54
+ var largestShape = `the largest template a Blackcat worker can build is ${ADE_MAX_SHAPE.vcpus} vCPU / ${ADE_MAX_SHAPE.memory_mib} MiB`;
55
+ var memoryMib = z.number().int().min(1024).max(ADE_MAX_SHAPE.memory_mib, `at most ${ADE_MAX_SHAPE.memory_mib}: ${largestShape}`).refine((value) => value % 128 === 0, "must be a multiple of 128");
56
+ var adeManifestSchema = z.strictObject({
57
+ version: z.literal(1),
58
+ name: z.string().regex(NAME, "must be lowercase letters, digits and -, starting with a letter (at most 32)"),
59
+ resources: z.strictObject({
60
+ vcpus: z.number().int().min(1).max(ADE_MAX_SHAPE.vcpus, `at most ${ADE_MAX_SHAPE.vcpus}: ${largestShape}`),
61
+ memory_mib: memoryMib,
62
+ disk_gib: z.number().int().min(1).max(256)
63
+ }),
64
+ /** Root commands run once per template version at build; absent when the base image's toolchain is enough. */
65
+ setup: z.array(command).optional(),
66
+ repos: z.array(repoSchema).min(1).superRefine((repos, ctx) => {
67
+ const seen = /* @__PURE__ */ new Set();
68
+ repos.forEach((repo, index) => {
69
+ const name = repo.github.split("/")[1] ?? "";
70
+ if (seen.has(name)) {
71
+ ctx.addIssue({ code: "custom", path: [index, "github"], message: `another repo is also named ${name}: both would be /workspace/${name}` });
72
+ }
73
+ seen.add(name);
74
+ });
75
+ }),
76
+ agents: z.record(z.string().regex(NAME, "agent names must be lowercase letters, digits and -"), agentSchema).refine((agents) => Object.keys(agents).length > 0, "list at least one agent"),
77
+ setup_prompt: repoPath,
78
+ guidance: repoPath
79
+ });
80
+ function validateAdeManifest(yamlText) {
81
+ let raw;
82
+ try {
83
+ raw = parse(yamlText);
84
+ } catch (error) {
85
+ return { issues: [{ path: "", message: `invalid YAML: ${error instanceof Error ? error.message : String(error)}` }] };
86
+ }
87
+ const parsed = adeManifestSchema.safeParse(raw);
88
+ if (!parsed.success) {
89
+ return { issues: parsed.error.issues.map((issue) => ({ path: issue.path.map(String).join(".") || "(root)", message: issue.message })) };
90
+ }
91
+ return { manifest: parsed.data, issues: [] };
92
+ }
93
+
94
+ // src/dev-ssh.ts
95
+ import { spawnSync } from "child_process";
96
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, renameSync, writeFileSync } from "fs";
97
+ import os from "os";
98
+ import path from "path";
99
+ import process from "process";
100
+
101
+ // ../ade-relay-protocol/src/index.ts
102
+ import { createHmac, timingSafeEqual } from "crypto";
103
+ var ADE_SSH_SUBPROTOCOL = "ade-ssh.v1";
104
+
105
+ // src/dev-ssh.ts
106
+ var adeDir = () => path.join(os.homedir(), ".config", "cofactor", "ade");
107
+ var keyPath = () => path.join(adeDir(), "id_ed25519");
108
+ var knownHostsPath = () => path.join(adeDir(), "known_hosts");
109
+ var grantsPath = () => path.join(adeDir(), "grants.json");
110
+ var sshConfigDir = () => path.join(os.homedir(), ".ssh", "config.d");
111
+ var sshConfigPath = () => path.join(sshConfigDir(), "cofactor-ade");
112
+ var REGRANT_BEFORE_MS = 36e5;
113
+ var PROXY_ATTEMPTS = 5;
114
+ var RELAY_CLOSE_HINTS = {
115
+ 4001: "the relay restarted; run `cofactor dev attach` again",
116
+ 4410: "the session has ended (`cofactor dev list --all`)",
117
+ 4502: "the box could not be reached; it is being woken, so try again in a minute",
118
+ 4503: "the Cofactor API did not answer; try again shortly"
119
+ };
120
+ var MAX_BUFFERED_STDIN = 1024 * 1024;
121
+ var SESSION_ID = /^ades_([1-9A-HJ-NP-Za-km-z]{8})[1-9A-HJ-NP-Za-km-z]*$/;
122
+ var shellQuote = (value) => `'${value.replaceAll("'", `'\\''`)}'`;
123
+ function adeHostAlias(sessionId) {
124
+ const match = SESSION_ID.exec(sessionId);
125
+ if (!match) throw new Error(`not an ADE session id: ${JSON.stringify(sessionId)}`);
126
+ return `ade-${match[1]}`;
127
+ }
128
+ function isTicketSafeUrl(url) {
129
+ try {
130
+ const parsed = new URL(url);
131
+ return parsed.protocol === "wss:" || parsed.protocol === "ws:" && ["localhost", "127.0.0.1", "[::1]"].includes(parsed.hostname);
132
+ } catch {
133
+ return false;
134
+ }
135
+ }
136
+ function writeAtomic(file, content, mode) {
137
+ const temp = `${file}.${process.pid}.tmp`;
138
+ writeFileSync(temp, content, { mode });
139
+ renameSync(temp, file);
140
+ }
141
+ function ensureMachineKey() {
142
+ mkdirSync(adeDir(), { recursive: true, mode: 448 });
143
+ if (!existsSync(keyPath())) {
144
+ const made = spawnSync("ssh-keygen", ["-q", "-t", "ed25519", "-N", "", "-C", `cofactor-ade@${os.hostname()}`, "-f", keyPath()], {
145
+ stdio: ["ignore", "ignore", "inherit"]
146
+ });
147
+ if (made.error || made.status !== 0) throw new Error("ssh-keygen failed: install the OpenSSH client and retry");
148
+ }
149
+ return readFileSync(`${keyPath()}.pub`, "utf8").trim();
150
+ }
151
+ function readGrants() {
152
+ try {
153
+ return JSON.parse(readFileSync(grantsPath(), "utf8"));
154
+ } catch {
155
+ return {};
156
+ }
157
+ }
158
+ function replaceEntry(existing, alias, entry, isOwn) {
159
+ const kept = existing.split("\n").filter((line) => line.trim() !== "" && !isOwn(line));
160
+ return [...kept, entry].join("\n") + "\n";
161
+ }
162
+ function sshConfigBlock(alias, sessionId, user, envArgs2) {
163
+ adeHostAlias(sessionId);
164
+ if (envArgs2.some((arg) => /[\r\n]/.test(arg))) throw new Error("a CLI flag value with a line break cannot go into the SSH config");
165
+ return [
166
+ `Host ${alias}`,
167
+ ` HostName ${alias}`,
168
+ ` User ${user}`,
169
+ ` IdentityFile "${keyPath()}"`,
170
+ " IdentitiesOnly yes",
171
+ ` UserKnownHostsFile "${knownHostsPath()}"`,
172
+ " StrictHostKeyChecking yes",
173
+ " ForwardAgent no",
174
+ " ServerAliveInterval 30",
175
+ " ServerAliveCountMax 4",
176
+ // `%` would be one of ssh's own tokens (`%h`); `%%` is a literal one.
177
+ ` ProxyCommand cofactor dev proxy ${[sessionId, ...envArgs2].map(shellQuote).join(" ").replaceAll("%", "%%")}`
178
+ ].join("\n");
179
+ }
180
+ function ensureSshInclude() {
181
+ const link = path.join(os.homedir(), ".ssh", "config");
182
+ const isLink = lstatSync(link, { throwIfNoEntry: false })?.isSymbolicLink() ?? false;
183
+ const config = isLink ? path.resolve(path.dirname(link), readlinkSync(link)) : link;
184
+ mkdirSync(sshConfigDir(), { recursive: true, mode: 448 });
185
+ const existing = existsSync(config) ? readFileSync(config, "utf8") : "";
186
+ if (/^\s*Include\s+config\.d\/\*\s*$/m.test(existing)) return;
187
+ try {
188
+ writeAtomic(config, `Include config.d/*
189
+
190
+ ${existing}`, 384);
191
+ } catch (error) {
192
+ throw new Error(`could not add \`Include config.d/*\` to ${config} (${error instanceof Error ? error.message : String(error)}); add it at the top yourself, then retry`);
193
+ }
194
+ }
195
+ async function grantAndConfigure(apiUrl, token, sessionId, envArgs2) {
196
+ const publicKey = ensureMachineKey();
197
+ const result = await apiRequest(apiUrl, token, "POST", `/org/ade/sessions/${encodeURIComponent(sessionId)}/ssh-grant`, {
198
+ publicKey
199
+ });
200
+ if (!result.ok || !result.data) throw new Error(result.error ?? "the SSH grant failed");
201
+ const { user, hostKey, expiresAt } = result.data;
202
+ if (!/^ssh-ed25519 [A-Za-z0-9+/=]+(?: \S*)?$/.test(hostKey)) throw new Error("the box returned an unexpected host key");
203
+ if (!/^[a-z_][a-z0-9_-]{0,31}$/.test(user)) throw new Error("the box returned an unexpected login user");
204
+ const alias = adeHostAlias(sessionId);
205
+ const known = existsSync(knownHostsPath()) ? readFileSync(knownHostsPath(), "utf8") : "";
206
+ const pinned = hostKey.split(" ").slice(0, 2).join(" ");
207
+ writeAtomic(knownHostsPath(), replaceEntry(known, alias, `${alias} ${pinned}`, (line) => line.startsWith(`${alias} `)), 384);
208
+ ensureSshInclude();
209
+ const config = existsSync(sshConfigPath()) ? readFileSync(sshConfigPath(), "utf8") : "";
210
+ const blocks = config.split(/\n(?=Host )/).filter((block) => block.trim() !== "" && !block.startsWith(`Host ${alias}
211
+ `));
212
+ writeAtomic(sshConfigPath(), [...blocks.map((block) => block.trimEnd()), sshConfigBlock(alias, sessionId, user, envArgs2)].join("\n\n") + "\n", 384);
213
+ writeAtomic(grantsPath(), JSON.stringify({ ...readGrants(), [sessionId]: { user, hostKey: pinned, expiresAt } }, null, 2), 384);
214
+ return alias;
215
+ }
216
+ function attachSsh(alias) {
217
+ const ssh = spawnSync("ssh", ["-t", alias, "tmux", "attach-session", "-t", "ade"], { stdio: "inherit" });
218
+ if (ssh.error) throw new Error(`ssh failed to start: ${ssh.error.message}`);
219
+ return ssh.status ?? 1;
220
+ }
221
+ async function runProxy(apiUrl, token, sessionId, envArgs2) {
222
+ const grant = readGrants()[sessionId];
223
+ if (!grant || new Date(grant.expiresAt).getTime() - Date.now() < REGRANT_BEFORE_MS) {
224
+ await grantAndConfigure(apiUrl, token, sessionId, envArgs2);
225
+ }
226
+ let resolveFinished = () => void 0;
227
+ const finished = new Promise((resolve) => {
228
+ resolveFinished = resolve;
229
+ });
230
+ const finish = (status) => {
231
+ process.stdin.destroy();
232
+ resolveFinished(status);
233
+ };
234
+ const buffered = [];
235
+ let bufferedBytes = 0;
236
+ let socket = null;
237
+ let stdinEnded = false;
238
+ process.stdin.on("data", (chunk) => {
239
+ if (socket?.readyState === WebSocket.OPEN) {
240
+ socket.send(new Uint8Array(chunk));
241
+ return;
242
+ }
243
+ bufferedBytes += chunk.length;
244
+ if (bufferedBytes > MAX_BUFFERED_STDIN) {
245
+ console.error("cofactor dev proxy: ssh sent too much before the relay answered");
246
+ finish(1);
247
+ return;
248
+ }
249
+ buffered.push(chunk);
250
+ });
251
+ process.stdin.on("end", () => {
252
+ stdinEnded = true;
253
+ socket?.close(1e3);
254
+ });
255
+ const connect = async (attempt) => {
256
+ const ticket = await apiRequest(apiUrl, token, "POST", `/org/ade/sessions/${encodeURIComponent(sessionId)}/relay-ticket`);
257
+ if (!ticket.ok || !ticket.data) {
258
+ console.error(`cofactor dev proxy: ${ticket.error ?? "no relay ticket"}`);
259
+ finish(1);
260
+ return;
261
+ }
262
+ if (!isTicketSafeUrl(ticket.data.url)) {
263
+ console.error("cofactor dev proxy: the API returned a relay URL that is not wss://; refusing to send the ticket");
264
+ finish(1);
265
+ return;
266
+ }
267
+ const ws = new WebSocket(ticket.data.url, [ADE_SSH_SUBPROTOCOL, ticket.data.ticket]);
268
+ ws.binaryType = "arraybuffer";
269
+ ws.onopen = () => {
270
+ socket = ws;
271
+ for (const chunk of buffered.splice(0)) ws.send(new Uint8Array(chunk));
272
+ if (stdinEnded) ws.close(1e3);
273
+ };
274
+ ws.onmessage = (event) => {
275
+ process.stdout.write(Buffer.from(event.data));
276
+ };
277
+ ws.onclose = (event) => {
278
+ if (socket === ws) {
279
+ if (event.code !== 1e3) {
280
+ console.error(`cofactor dev proxy: the relay closed the connection (${event.code}${event.reason ? `: ${event.reason}` : ""})`);
281
+ const hint = RELAY_CLOSE_HINTS[event.code];
282
+ if (hint) console.error(`cofactor dev proxy: ${hint}`);
283
+ }
284
+ finish(event.code === 1e3 ? 0 : 1);
285
+ return;
286
+ }
287
+ if (attempt >= PROXY_ATTEMPTS) {
288
+ console.error(`cofactor dev proxy: could not reach the relay after ${PROXY_ATTEMPTS} attempts`);
289
+ finish(1);
290
+ return;
291
+ }
292
+ setTimeout(() => {
293
+ connect(attempt + 1).catch((error) => {
294
+ if (error instanceof ProcessExitSignal) {
295
+ finish(error.exitCode);
296
+ return;
297
+ }
298
+ console.error(`cofactor dev proxy: ${error instanceof Error ? error.message : String(error)}`);
299
+ finish(1);
300
+ });
301
+ }, attempt * 500);
302
+ };
303
+ };
304
+ await connect(1);
305
+ return finished;
306
+ }
307
+
308
+ // src/dev.ts
309
+ var POLL_MS = 5e3;
310
+ var DESTROY_WAIT_MS = 16 * 6e4;
311
+ var DEV_VALUE_FLAGS = [...GLOBAL_VALUE_FLAGS, "--template"];
312
+ function printHelp() {
313
+ console.log(
314
+ [
315
+ "Usage: cofactor dev [<sub-command>] [options]",
316
+ "",
317
+ "Dev environments (ADEs): remote sandboxes a coding agent works in.",
318
+ "",
319
+ "Sub-commands:",
320
+ " (none) [--template <name>] Claim a session, follow it, and attach once it is ready. --template is required when the org has several",
321
+ " attach [<id>] SSH into a session (your only live one by default) from this machine. Makes",
322
+ " ~/.config/cofactor/ade/id_ed25519 (no passphrase) once; each grant lasts 12 h",
323
+ " proxy <id> The SSH ProxyCommand `cofactor dev attach` writes; not run by hand",
324
+ " list [--all] Your sessions: status, phase, size, lease end, last event; --all adds those ended in 7 days",
325
+ " destroy <id> End a session (its home is saved), wait for it, and print the result",
326
+ ` template publish [<path>] Admin. Publish a pushed ${ADE_MANIFEST_FILE} (default: the repo root's) and wait for its build`,
327
+ " template list Template versions: status, source commit, setup-prompt hash, error",
328
+ "",
329
+ "Options:",
330
+ " --json Output raw JSON (list, template list)",
331
+ " --env <env> Target environment (prod, dev, local)"
332
+ ].join("\n")
333
+ );
334
+ }
335
+ function fail(message) {
336
+ console.error(`Error: ${message}`);
337
+ process2.exit(1);
338
+ }
339
+ var git = (cwd, ...args) => execFileSync("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
340
+ function githubRepoOf(url) {
341
+ const match = url.match(/^(?:https:\/\/github\.com\/|git@github\.com:|ssh:\/\/git@github\.com\/)([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?)(?:\.git)?\/?$/);
342
+ return match ? match[1] : null;
343
+ }
344
+ function publishedRepo(root, commit) {
345
+ let upstream;
346
+ try {
347
+ upstream = git(root, "rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}").trim();
348
+ } catch {
349
+ fail("this branch has no upstream: push it first (git push -u)");
350
+ }
351
+ try {
352
+ git(root, "merge-base", "--is-ancestor", commit, "@{u}");
353
+ } catch {
354
+ fail(`HEAD (${commit.slice(0, 12)}) is not on ${upstream}: push it first`);
355
+ }
356
+ const remote = upstream.split("/")[0];
357
+ const repo = githubRepoOf(git(root, "remote", "get-url", remote).trim());
358
+ if (!repo) fail(`the ${remote} remote is not a github.com repository`);
359
+ return repo;
360
+ }
361
+ function committed(root, commit, file) {
362
+ try {
363
+ return git(root, "show", `${commit}:${file}`);
364
+ } catch {
365
+ fail(`${file} is not committed at ${commit.slice(0, 12)} (paths in ${ADE_MANIFEST_FILE} are relative to the repo root)`);
366
+ }
367
+ }
368
+ async function allPages(apiUrl, token, route, what) {
369
+ const items = [];
370
+ let cursor = null;
371
+ do {
372
+ const separator = route.includes("?") ? "&" : "?";
373
+ const query = `${separator}limit=100${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ""}`;
374
+ const page = await apiRequest(apiUrl, token, "GET", `${route}${query}`);
375
+ if (!page.ok || !page.data) fail(page.error ?? `could not list ${what}`);
376
+ items.push(...page.data);
377
+ cursor = page.nextCursor ?? null;
378
+ } while (cursor);
379
+ return items;
380
+ }
381
+ var allTemplates = (apiUrl, token) => allPages(apiUrl, token, "/org/ade/templates", "templates");
382
+ function printVersion(template) {
383
+ const source = `${template.sourceRepo}@${template.sourceCommit.slice(0, 12)}`;
384
+ console.log(
385
+ `${template.name} v${template.version} ${template.status.padEnd(8)} ${source} base v${template.baseVersion} setup-prompt ${template.setupPromptSha256.slice(0, 12)}`
386
+ );
387
+ if (template.status === "failed" && template.error) console.log(` ${template.error.trim().split("\n").slice(-20).join("\n ")}`);
388
+ }
389
+ async function publish(argv, apiUrl, token) {
390
+ const given = getPositionalArg(argv, GLOBAL_VALUE_FLAGS);
391
+ const start = given ? path2.dirname(path2.resolve(given)) : process2.cwd();
392
+ let root;
393
+ try {
394
+ root = git(start, "rev-parse", "--show-toplevel").trim();
395
+ } catch {
396
+ fail(`${start} is not inside a git repository`);
397
+ }
398
+ const yamlFile = given ? path2.relative(root, path2.resolve(given)) : ADE_MANIFEST_FILE;
399
+ if (yamlFile.startsWith("..")) fail(`${given} is outside the repository at ${root}`);
400
+ const commit = git(root, "rev-parse", "HEAD").trim();
401
+ const yaml = committed(root, commit, yamlFile);
402
+ const { manifest, issues } = validateAdeManifest(yaml);
403
+ if (!manifest) {
404
+ console.error(`Error: ${yamlFile} is invalid:`);
405
+ for (const issue of issues) console.error(` ${issue.path}: ${issue.message}`);
406
+ process2.exit(1);
407
+ }
408
+ const repo = publishedRepo(root, commit);
409
+ if (git(root, "status", "--porcelain", "--", yamlFile, manifest.setup_prompt, manifest.guidance).trim() !== "") {
410
+ console.error(`Note: uncommitted changes to the template's files are not published; publishing them as of ${commit.slice(0, 12)}.`);
411
+ }
412
+ const result = await apiRequest(apiUrl, token, "POST", "/org/ade/templates/publish", {
413
+ yaml,
414
+ setupPrompt: committed(root, commit, manifest.setup_prompt),
415
+ guidance: committed(root, commit, manifest.guidance),
416
+ repo,
417
+ commit
418
+ });
419
+ if (!result.ok || !result.data) {
420
+ console.error(`Error: ${result.error ?? "publish failed"}`);
421
+ for (const issue of result.issues ?? []) console.error(` ${issue.path}: ${issue.message}`);
422
+ process2.exit(1);
423
+ }
424
+ const { id, name, version } = result.data;
425
+ console.log(`Published ${name} v${version} (${id}) from ${repo}@${commit.slice(0, 12)}; building\u2026`);
426
+ console.log("Ctrl-C stops waiting; the build carries on (`cofactor dev template list`).");
427
+ const started = Date.now();
428
+ for (; ; ) {
429
+ await new Promise((resolve) => setTimeout(resolve, POLL_MS));
430
+ const current = await apiRequest(apiUrl, token, "GET", `/org/ade/templates/${id}`);
431
+ if (!current.ok || !current.data) {
432
+ fail(`could not read the build's status (${current.error ?? "unknown error"}); it carries on: check \`cofactor dev template list\``);
433
+ }
434
+ if (current.data.status === "building") continue;
435
+ console.log(`${current.data.status === "ready" ? "\u2713" : "\u2717"} after ${Math.round((Date.now() - started) / 1e3)} s`);
436
+ printVersion(current.data);
437
+ if (current.data.status === "failed") process2.exit(1);
438
+ return;
439
+ }
440
+ }
441
+ async function list(argv, apiUrl, token) {
442
+ const templates = await allTemplates(apiUrl, token);
443
+ if (hasFlag(argv, "--json")) {
444
+ writeRawOutput(JSON.stringify(templates, null, 2));
445
+ return;
446
+ }
447
+ if (templates.length === 0) {
448
+ console.log("No ADE templates yet. Publish one with `cofactor dev template publish`.");
449
+ return;
450
+ }
451
+ for (const template of templates) printVersion(template);
452
+ }
453
+ var guestText = (value) => (
454
+ // eslint-disable-next-line no-control-regex -- C0 and C1 controls are exactly what is stripped
455
+ value ? stripVTControlCharacters(value).replace(/[\u0000-\u001f\u007f-\u009f]/g, " ") : ""
456
+ );
457
+ function printSession(session) {
458
+ const size = `${session.vcpus}c/${Math.round(session.memoryMib / 1024)}G`;
459
+ const lease = session.leaseCapAt ? ` lease ends ${session.leaseCapAt}` : "";
460
+ console.log(`${session.id} ${session.status.padEnd(12)} ${session.phase ?? "-"} ${size}${lease}`);
461
+ if (session.lastEvent?.identity) console.log(` logged in as ${guestText(session.lastEvent.identity)}`);
462
+ if (session.lastEvent?.branches?.length) console.log(` branches: ${session.lastEvent.branches.map(guestText).join(", ")}`);
463
+ if (session.lastEvent?.error) console.log(` ${guestText(session.lastEvent.error)}`);
464
+ if (session.endReason) console.log(` ended: ${session.endReason}${session.endDetail ? ` (${session.endDetail})` : ""}`);
465
+ }
466
+ async function templateToClaim(argv, apiUrl, token) {
467
+ const given = getArgValue(argv, "--template");
468
+ if (given) return given;
469
+ const names = new Set((await allTemplates(apiUrl, token)).map((template) => template.name));
470
+ if (names.size === 1) return [...names][0];
471
+ if (names.size === 0) fail("this org has no ADE template yet: an admin publishes one with `cofactor dev template publish`");
472
+ fail(`this org has several ADE templates; pass --template <name> (one of: ${[...names].sort().join(", ")})`);
473
+ }
474
+ var ATTACHABLE_PHASES = /* @__PURE__ */ new Set(["home_mounted", "setup_done", "needs_user", "repos_synced", "agent_started"]);
475
+ var ATTACH_WAIT_MS = 70 * 6e4;
476
+ function envArgs(argv) {
477
+ const out = [];
478
+ for (const flag of ["--env", "--api-url", "--org", "--target-org"]) {
479
+ const value = getArgValue(argv, flag);
480
+ if (value) out.push(flag, value);
481
+ }
482
+ return out;
483
+ }
484
+ async function followUntilAttachable(apiUrl, token, id) {
485
+ const sessionPath = `/org/ade/sessions/${encodeURIComponent(id)}`;
486
+ const deadline = Date.now() + ATTACH_WAIT_MS;
487
+ let shown = "";
488
+ for (; ; ) {
489
+ const current = await apiRequest(apiUrl, token, "GET", sessionPath);
490
+ if (!current.ok || !current.data) fail(current.error ?? "could not read the session");
491
+ const session = current.data;
492
+ const state = `${session.status}${session.phase ? ` (${session.phase})` : ""}`;
493
+ if (state !== shown) {
494
+ console.log(` ${state}`);
495
+ shown = state;
496
+ }
497
+ if (session.status === "ending" || session.status === "ended") {
498
+ printSession(session);
499
+ process2.exit(1);
500
+ }
501
+ if (session.status === "running" || session.phase && ATTACHABLE_PHASES.has(session.phase)) return session;
502
+ if (Date.now() > deadline) fail(`${id} is still ${state}; it carries on: check \`cofactor dev list\``);
503
+ await new Promise((resolve) => setTimeout(resolve, 3e3));
504
+ }
505
+ }
506
+ async function attach(id, argv, apiUrl, token) {
507
+ await followUntilAttachable(apiUrl, token, id);
508
+ const alias = await grantAndConfigure(apiUrl, token, id, envArgs(argv)).catch((error) => fail(error instanceof Error ? error.message : String(error)));
509
+ console.log(`Attaching to ${id} (ssh ${alias}). Detach with Ctrl-b d; reattach with \`cofactor dev attach ${id}\`.`);
510
+ process2.exit(attachSsh(alias));
511
+ }
512
+ async function claim(argv, apiUrl, token) {
513
+ const template = await templateToClaim(argv, apiUrl, token);
514
+ const result = await apiRequest(apiUrl, token, "POST", "/org/ade/sessions", { template });
515
+ if (!result.ok || !result.data) fail(result.error ?? "the claim failed");
516
+ console.log(`Claimed ${result.data.id} from ${template}. Ctrl-C stops following; the session carries on.`);
517
+ await attach(result.data.id, argv, apiUrl, token);
518
+ }
519
+ async function sessionToAttach(argv, apiUrl, token) {
520
+ const given = getPositionalArg(argv, DEV_VALUE_FLAGS);
521
+ if (given) return given;
522
+ const live = await allPages(apiUrl, token, "/org/ade/sessions", "sessions");
523
+ if (live.length === 1) return live[0].id;
524
+ if (live.length === 0) fail("you have no live ADE session: claim one with `cofactor dev`");
525
+ fail(`you have several live sessions; pass one: ${live.map((session) => session.id).join(", ")}`);
526
+ }
527
+ async function listSessions(argv, apiUrl, token) {
528
+ const all = hasFlag(argv, "--all");
529
+ const sessions = await allPages(apiUrl, token, all ? "/org/ade/sessions?all=true" : "/org/ade/sessions", "sessions");
530
+ if (hasFlag(argv, "--json")) {
531
+ writeRawOutput(JSON.stringify(sessions, null, 2));
532
+ return;
533
+ }
534
+ if (sessions.length === 0) {
535
+ console.log(all ? "No ADE sessions in the last 7 days." : "No live ADE sessions. Claim one with `cofactor dev`.");
536
+ return;
537
+ }
538
+ for (const session of sessions) printSession(session);
539
+ }
540
+ async function destroy(argv, apiUrl, token) {
541
+ const id = getPositionalArg(argv, DEV_VALUE_FLAGS);
542
+ if (!id) fail("usage: cofactor dev destroy <id>");
543
+ const sessionPath = `/org/ade/sessions/${encodeURIComponent(id)}`;
544
+ const result = await apiRequest(apiUrl, token, "DELETE", sessionPath);
545
+ if (!result.ok || !result.data) fail(result.error ?? "the destroy failed");
546
+ console.log(`Ending ${id}\u2026`);
547
+ const deadline = Date.now() + DESTROY_WAIT_MS;
548
+ let session = result.data;
549
+ while (session.status !== "ended") {
550
+ if (Date.now() > deadline) fail(`${id} is still ${session.status}; it carries on: check \`cofactor dev list --all\``);
551
+ await new Promise((resolve) => setTimeout(resolve, 3e3));
552
+ const current = await apiRequest(apiUrl, token, "GET", sessionPath);
553
+ if (!current.ok || !current.data) fail(current.error ?? "could not read the session");
554
+ session = current.data;
555
+ }
556
+ printSession(session);
557
+ if (session.endDetail === "final save failed") console.log("Warning: the final save of the home failed; changes since its last save are lost.");
558
+ }
559
+ async function runDev(argv) {
560
+ const [group, subCommand, ...rest] = argv;
561
+ if (group === "help" || hasFlag(argv, "--help", "-h")) {
562
+ printHelp();
563
+ return;
564
+ }
565
+ if (group === void 0 || group.startsWith("--")) {
566
+ const { apiUrl: apiUrl2, token: token2 } = await resolveConfig(argv);
567
+ await claim(argv, apiUrl2, token2);
568
+ return;
569
+ }
570
+ if (group === "attach" || group === "proxy") {
571
+ const args = argv.slice(1);
572
+ const { apiUrl: apiUrl2, token: token2 } = await resolveConfig(args);
573
+ if (group === "attach") {
574
+ await attach(await sessionToAttach(args, apiUrl2, token2), args, apiUrl2, token2);
575
+ return;
576
+ }
577
+ const id = getPositionalArg(args, DEV_VALUE_FLAGS);
578
+ if (!id) fail("usage: cofactor dev proxy <id>");
579
+ const status = await runProxy(apiUrl2, token2, id, envArgs(args)).catch((error) => {
580
+ if (error instanceof ProcessExitSignal) throw error;
581
+ console.error(`cofactor dev proxy: ${error instanceof Error ? error.message : String(error)}`);
582
+ return 1;
583
+ });
584
+ process2.exit(status);
585
+ }
586
+ if (group === "list" || group === "destroy") {
587
+ const args = argv.slice(1);
588
+ const { apiUrl: apiUrl2, token: token2 } = await resolveConfig(args);
589
+ if (group === "list") await listSessions(args, apiUrl2, token2);
590
+ else await destroy(args, apiUrl2, token2);
591
+ return;
592
+ }
593
+ if (group !== "template" || subCommand !== "publish" && subCommand !== "list") {
594
+ console.error(`Unknown dev sub-command: ${[group, subCommand].filter(Boolean).join(" ")}`);
595
+ printHelp();
596
+ process2.exit(1);
597
+ }
598
+ const { apiUrl, token } = await resolveConfig(rest);
599
+ if (subCommand === "publish") await publish(rest, apiUrl, token);
600
+ else await list(rest, apiUrl, token);
601
+ }
602
+ export {
603
+ runDev
604
+ };
605
+ //# sourceMappingURL=dev-PBW7BSOD.js.map