clikcode 1.0.4 → 1.0.5

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 (323) hide show
  1. package/README.md +25 -14
  2. package/dist/chunk-23TDEBGZ.js +71 -0
  3. package/dist/chunk-25T3GVS7.js +425 -0
  4. package/dist/chunk-2BBELGHY.js +11 -0
  5. package/dist/chunk-2EOL5PZL.js +208 -0
  6. package/dist/chunk-2GAB36IE.js +26 -0
  7. package/dist/chunk-2OLS7V66.js +2440 -0
  8. package/dist/chunk-2QFO2URB.js +179 -0
  9. package/dist/chunk-2QWPQRSU.js +254 -0
  10. package/dist/chunk-2YPAPAR3.js +184 -0
  11. package/dist/chunk-2ZAG5372.js +33 -0
  12. package/dist/chunk-32IKAIZC.js +12507 -0
  13. package/dist/chunk-34AZEGYW.js +95 -0
  14. package/dist/chunk-34JQYQCA.js +175 -0
  15. package/dist/chunk-34ZISPAO.js +67 -0
  16. package/dist/chunk-3AAAARE6.js +46 -0
  17. package/dist/chunk-3AJ6Q3OY.js +510 -0
  18. package/dist/chunk-3B2CHX7M.js +884 -0
  19. package/dist/chunk-3BUFORRX.js +59 -0
  20. package/dist/chunk-3QLHYYFK.js +30 -0
  21. package/dist/chunk-3RXBMYKZ.js +140 -0
  22. package/dist/chunk-3TFNIJWS.js +52 -0
  23. package/dist/chunk-3W3IPDFP.js +119 -0
  24. package/dist/chunk-3WMS7SEE.js +417 -0
  25. package/dist/chunk-435ZNSZ3.js +23 -0
  26. package/dist/chunk-4AQ5NINV.js +39 -0
  27. package/dist/chunk-4GVEJ5FK.js +168 -0
  28. package/dist/chunk-4GXAO3UY.js +262 -0
  29. package/dist/chunk-4L2ZZM4Q.js +332 -0
  30. package/dist/chunk-4LPDG57B.js +17 -0
  31. package/dist/chunk-4NN3XQQT.js +223 -0
  32. package/dist/chunk-4QZEZME7.js +54 -0
  33. package/dist/chunk-4R6CSC3S.js +38 -0
  34. package/dist/chunk-4RHXTL3W.js +514 -0
  35. package/dist/chunk-4SJMPTVQ.js +18 -0
  36. package/dist/chunk-4VY7G6TX.js +114 -0
  37. package/dist/chunk-5642PBF7.js +124 -0
  38. package/dist/chunk-5B6TVO4A.js +33 -0
  39. package/dist/chunk-5BJLDUPL.js +62 -0
  40. package/dist/chunk-5HMFFJWU.js +19 -0
  41. package/dist/chunk-5IKLK33T.js +69 -0
  42. package/dist/chunk-5NQ5FFMX.js +44 -0
  43. package/dist/chunk-5QNNW5L6.js +176 -0
  44. package/dist/chunk-5SM5UAWN.js +239 -0
  45. package/dist/chunk-5WYJTA6O.js +74 -0
  46. package/dist/chunk-5ZSR2Y5T.js +227 -0
  47. package/dist/chunk-5ZWUM5GH.js +39 -0
  48. package/dist/chunk-64E7D4HY.js +364 -0
  49. package/dist/chunk-6CK466BC.js +99 -0
  50. package/dist/chunk-6ES45HHO.js +138 -0
  51. package/dist/chunk-6HYEZFGL.js +277 -0
  52. package/dist/chunk-6Y7HLXGW.js +29 -0
  53. package/dist/chunk-6YKK4FYR.js +258 -0
  54. package/dist/chunk-74WNMLMS.js +117 -0
  55. package/dist/chunk-7AULZ7OD.js +55 -0
  56. package/dist/chunk-7DOKGSUN.js +101 -0
  57. package/dist/chunk-7IH5LTIZ.js +195 -0
  58. package/dist/chunk-7ISTS5NS.js +21 -0
  59. package/dist/chunk-7NMUTGOW.js +527 -0
  60. package/dist/chunk-7PNHUZEL.js +153 -0
  61. package/dist/chunk-7TSQLONI.js +88 -0
  62. package/dist/chunk-AE7TOLD5.js +30 -0
  63. package/dist/chunk-AEMHSXKA.js +130 -0
  64. package/dist/chunk-AKRYTS2D.js +211 -0
  65. package/dist/chunk-AMNSE36L.js +59 -0
  66. package/dist/chunk-AZVD74ZV.js +23 -0
  67. package/dist/chunk-B35DVOTK.js +1981 -0
  68. package/dist/chunk-B4HNJRAH.js +626 -0
  69. package/dist/chunk-B5WYPPHS.js +13 -0
  70. package/dist/chunk-BBOVDXQM.js +59 -0
  71. package/dist/chunk-BD3ECZLK.js +62 -0
  72. package/dist/chunk-BDGSOT74.js +4578 -0
  73. package/dist/chunk-BF5VEOPK.js +31 -0
  74. package/dist/chunk-BFFRW4XH.js +47 -0
  75. package/dist/chunk-BFPC6PEW.js +208 -0
  76. package/dist/chunk-BGEMY2JJ.js +376 -0
  77. package/dist/chunk-BISGNHKD.js +35 -0
  78. package/dist/chunk-BMRAEBRY.js +21 -0
  79. package/dist/chunk-BNTXAZXW.js +127 -0
  80. package/dist/chunk-BOQBXGSN.js +75 -0
  81. package/dist/chunk-BTJDSTQP.js +213 -0
  82. package/dist/chunk-BUOPJQP5.js +218 -0
  83. package/dist/chunk-BXFJS65Q.js +52 -0
  84. package/dist/chunk-BXPQFSX5.js +59 -0
  85. package/dist/chunk-C57LIWNY.js +1269 -0
  86. package/dist/chunk-C6YVCCWR.js +74 -0
  87. package/dist/chunk-CAADDF6M.js +167 -0
  88. package/dist/chunk-CBANJFBO.js +69 -0
  89. package/dist/chunk-CERF3RIB.js +597 -0
  90. package/dist/chunk-COAS5ETR.js +46 -0
  91. package/dist/chunk-CQ7J6UQ7.js +78 -0
  92. package/dist/chunk-CRUVYGO2.js +26 -0
  93. package/dist/chunk-CVFVFRGN.js +58 -0
  94. package/dist/chunk-D2UK66HM.js +37 -0
  95. package/dist/chunk-D2W7SA4R.js +18 -0
  96. package/dist/chunk-DA44ZENT.js +501 -0
  97. package/dist/chunk-DAJ76TOC.js +99 -0
  98. package/dist/chunk-DCZ6CIUM.js +147 -0
  99. package/dist/chunk-DF35KMXM.js +1314 -0
  100. package/dist/chunk-DGASQT26.js +151 -0
  101. package/dist/chunk-DJT57C5P.js +55 -0
  102. package/dist/chunk-DKDPZTD3.js +44 -0
  103. package/dist/chunk-DQYVQ2N7.js +77 -0
  104. package/dist/chunk-DRTP2RTY.js +266 -0
  105. package/dist/chunk-DW2BMUKY.js +61 -0
  106. package/dist/chunk-DW5T5ZVU.js +307 -0
  107. package/dist/chunk-DXKNDNFC.js +164 -0
  108. package/dist/chunk-DZEQ7UYR.js +291 -0
  109. package/dist/chunk-E4F4OUAC.js +463 -0
  110. package/dist/chunk-EE4B6A7W.js +69 -0
  111. package/dist/chunk-EISKIYWG.js +23 -0
  112. package/dist/chunk-EKAQK7UQ.js +235 -0
  113. package/dist/chunk-EOBTJV32.js +123 -0
  114. package/dist/chunk-ESF3DIZY.js +325 -0
  115. package/dist/chunk-EVOHOZ4U.js +45 -0
  116. package/dist/chunk-EXN4KHLB.js +110 -0
  117. package/dist/chunk-F252T6Y3.js +78 -0
  118. package/dist/chunk-F3DP4ZA2.js +40 -0
  119. package/dist/chunk-F6F47QAY.js +58 -0
  120. package/dist/chunk-FA3Y23ZW.js +57 -0
  121. package/dist/chunk-FBKXE4EJ.js +640 -0
  122. package/dist/chunk-FCGEB3H6.js +23 -0
  123. package/dist/chunk-FF7ZVYJF.js +3732 -0
  124. package/dist/chunk-FFGKN6L3.js +39 -0
  125. package/dist/chunk-FFGU4GCC.js +94 -0
  126. package/dist/chunk-FSFDAOVP.js +74 -0
  127. package/dist/chunk-FT5TX7OX.js +1573 -0
  128. package/dist/chunk-G3QP67Z7.js +232 -0
  129. package/dist/chunk-G5ORJKV2.js +179 -0
  130. package/dist/chunk-GFNC62PE.js +111 -0
  131. package/dist/chunk-GGK43Q3N.js +67 -0
  132. package/dist/chunk-GGYKY4GF.js +11537 -0
  133. package/dist/chunk-GGYNHGNJ.js +55 -0
  134. package/dist/chunk-GLY7RM3C.js +354 -0
  135. package/dist/chunk-GQBZU6EO.js +20 -0
  136. package/dist/chunk-GSXENUZL.js +9 -0
  137. package/dist/chunk-GTOAT5D3.js +40 -0
  138. package/dist/chunk-GWCMDPQU.js +1007 -0
  139. package/dist/chunk-GXYSMYHJ.js +152 -0
  140. package/dist/chunk-GYMAI5NY.js +14 -0
  141. package/dist/chunk-H2VZMKPE.js +30 -0
  142. package/dist/chunk-H4THUNBM.js +2091 -0
  143. package/dist/chunk-HGRVSNUZ.js +361 -0
  144. package/dist/chunk-HI4VY473.js +27 -0
  145. package/dist/chunk-HOJRSD3Q.js +447 -0
  146. package/dist/chunk-HRX25W35.js +82 -0
  147. package/dist/chunk-HSE4AQYV.js +55 -0
  148. package/dist/chunk-HU5SSUFX.js +383 -0
  149. package/dist/chunk-I3GDBJLH.js +196 -0
  150. package/dist/chunk-I75EDU75.js +684 -0
  151. package/dist/chunk-IBA7DMIO.js +20 -0
  152. package/dist/chunk-IC6N4NZA.js +231 -0
  153. package/dist/chunk-IF43HIGV.js +284 -0
  154. package/dist/chunk-IGZ6C2MC.js +439 -0
  155. package/dist/chunk-IMLTL2MY.js +192 -0
  156. package/dist/chunk-IMZL6SGR.js +33 -0
  157. package/dist/chunk-IS4USJPY.js +516 -0
  158. package/dist/chunk-ISFSPN2F.js +82 -0
  159. package/dist/chunk-IXE7GTFI.js +55 -0
  160. package/dist/chunk-IZ77QJQG.js +36 -0
  161. package/dist/chunk-J2PACWRQ.js +34 -0
  162. package/dist/chunk-J6EGFVQX.js +180 -0
  163. package/dist/chunk-JEKOD43D.js +22 -0
  164. package/dist/chunk-JGIWATSG.js +30 -0
  165. package/dist/chunk-JYBONKD4.js +43 -0
  166. package/dist/chunk-K2NLG2HK.js +454 -0
  167. package/dist/chunk-KCQ4TBLS.js +164 -0
  168. package/dist/chunk-KD5KIVMS.js +176 -0
  169. package/dist/chunk-KHW6TX6I.js +63 -0
  170. package/dist/chunk-KI5GZFCE.js +520 -0
  171. package/dist/chunk-KN34B7NO.js +105 -0
  172. package/dist/chunk-KYUHIFP3.js +136 -0
  173. package/dist/chunk-KZL5VS4B.js +300 -0
  174. package/dist/chunk-L3VW3QIH.js +48 -0
  175. package/dist/chunk-LA6MG4ET.js +2110 -0
  176. package/dist/chunk-LAVFOA3S.js +66 -0
  177. package/dist/chunk-LB4OA77N.js +13 -0
  178. package/dist/chunk-LBFRF2K4.js +196 -0
  179. package/dist/chunk-LM6EIA4B.js +93 -0
  180. package/dist/chunk-LPCNRGJ7.js +692 -0
  181. package/dist/chunk-LSLNL5T3.js +168 -0
  182. package/dist/chunk-LVRRWP4W.js +568 -0
  183. package/dist/chunk-LWCFBRHL.js +33 -0
  184. package/dist/chunk-LXFTMGZZ.js +166 -0
  185. package/dist/chunk-M33LVA4M.js +151 -0
  186. package/dist/chunk-M3FO5UMK.js +4944 -0
  187. package/dist/chunk-M5QNDBAY.js +66 -0
  188. package/dist/chunk-M6ND6KBE.js +1291 -0
  189. package/dist/chunk-M7H3WQTE.js +76 -0
  190. package/dist/chunk-MCBRVPA7.js +191 -0
  191. package/dist/chunk-MCSDWZET.js +91 -0
  192. package/dist/chunk-MDT5XDXL.js +289 -0
  193. package/dist/chunk-MJG3IQY4.js +91 -0
  194. package/dist/chunk-MOU3N2UL.js +44 -0
  195. package/dist/chunk-MP4KZOQC.js +3451 -0
  196. package/dist/chunk-MPAJ446F.js +66 -0
  197. package/dist/chunk-MVJZZ6AL.js +16 -0
  198. package/dist/chunk-MXS6S2PY.js +253 -0
  199. package/dist/chunk-N3SFDYM7.js +291 -0
  200. package/dist/chunk-NAOX3JUB.js +13 -0
  201. package/dist/chunk-NEKKIBCX.js +283 -0
  202. package/dist/chunk-NKDATMEM.js +133 -0
  203. package/dist/chunk-NR4FMC4K.js +395 -0
  204. package/dist/chunk-NSOHOJBR.js +221 -0
  205. package/dist/chunk-NTDB6QKF.js +29 -0
  206. package/dist/chunk-NWEYRBWK.js +25 -0
  207. package/dist/chunk-O2YSNYWD.js +23 -0
  208. package/dist/chunk-O3EW7LAY.js +54 -0
  209. package/dist/chunk-O7BNJIXU.js +366 -0
  210. package/dist/chunk-OARL2NXZ.js +116 -0
  211. package/dist/chunk-OHKZUEJW.js +351 -0
  212. package/dist/chunk-OKU45BXA.js +647 -0
  213. package/dist/chunk-OL4JBD3J.js +59 -0
  214. package/dist/chunk-OLUO5DDR.js +192 -0
  215. package/dist/chunk-OQ245JLA.js +196 -0
  216. package/dist/chunk-P72UZAQI.js +289 -0
  217. package/dist/chunk-PAL2ENB6.js +20 -0
  218. package/dist/chunk-PAXYQZH7.js +53 -0
  219. package/dist/chunk-PDPEM5VW.js +51 -0
  220. package/dist/chunk-PEWCDI2C.js +668 -0
  221. package/dist/chunk-PGZ54EDX.js +27 -0
  222. package/dist/chunk-PRWVLDZF.js +73 -0
  223. package/dist/chunk-PSQQ75VJ.js +52 -0
  224. package/dist/chunk-PUOVIFHW.js +118 -0
  225. package/dist/chunk-PWBF2X3V.js +107 -0
  226. package/dist/chunk-PWXII6HF.js +43 -0
  227. package/dist/chunk-Q35VLJRT.js +80 -0
  228. package/dist/chunk-QJP7EYGL.js +128 -0
  229. package/dist/chunk-QPQKX2MK.js +8836 -0
  230. package/dist/chunk-QQRLPY25.js +1053 -0
  231. package/dist/chunk-QUS4ER2W.js +407 -0
  232. package/dist/chunk-QYHI3YET.js +29 -0
  233. package/dist/chunk-QYRU2UQI.js +32 -0
  234. package/dist/chunk-R6XVVQGC.js +13 -0
  235. package/dist/chunk-R7QN6ONS.js +483 -0
  236. package/dist/chunk-RD23MPGC.js +221 -0
  237. package/dist/chunk-RDDWQBEM.js +185 -0
  238. package/dist/chunk-RDLLDYFO.js +104 -0
  239. package/dist/chunk-RE4TGORR.js +84 -0
  240. package/dist/chunk-RJLHVYQY.js +217 -0
  241. package/dist/chunk-RJLPTWHW.js +905 -0
  242. package/dist/chunk-RKUVLRZI.js +295 -0
  243. package/dist/chunk-ROGXPGYR.js +37 -0
  244. package/dist/chunk-RSZGEL5U.js +163 -0
  245. package/dist/chunk-RVUOIJXN.js +909 -0
  246. package/dist/chunk-RW7F4JRP.js +11 -0
  247. package/dist/chunk-S4UO3AO3.js +53 -0
  248. package/dist/chunk-S5JAAF6S.js +585 -0
  249. package/dist/chunk-SNU37TQI.js +56 -0
  250. package/dist/chunk-SQVUDO2O.js +31 -0
  251. package/dist/chunk-SYVHIYQT.js +66 -0
  252. package/dist/chunk-SZBQMTG2.js +85 -0
  253. package/dist/chunk-T5VCXA3J.js +25 -0
  254. package/dist/chunk-TK6NSP56.js +30 -0
  255. package/dist/chunk-TKWVMA6L.js +22 -0
  256. package/dist/chunk-TQDKJHWX.js +59 -0
  257. package/dist/chunk-TQDM7S5N.js +127 -0
  258. package/dist/chunk-TULAXS77.js +23 -0
  259. package/dist/chunk-TVT45XNH.js +4625 -0
  260. package/dist/chunk-TWCVV2JO.js +467 -0
  261. package/dist/chunk-U4DKAD6S.js +47 -0
  262. package/dist/chunk-UA5K2BTI.js +564 -0
  263. package/dist/chunk-UAMKCMOK.js +40 -0
  264. package/dist/chunk-UBMVADBF.js +51 -0
  265. package/dist/chunk-UFQ5A5PW.js +645 -0
  266. package/dist/chunk-UOD2SOLL.js +1301 -0
  267. package/dist/chunk-UTSB4LOW.js +156 -0
  268. package/dist/chunk-UVXNIUTN.js +412 -0
  269. package/dist/chunk-UXVPXYPE.js +90 -0
  270. package/dist/chunk-UYEEMIWR.js +374 -0
  271. package/dist/chunk-VBGM5ZBW.js +54 -0
  272. package/dist/chunk-VEWPCZPG.js +762 -0
  273. package/dist/chunk-VIRDLZ5E.js +108 -0
  274. package/dist/chunk-VMPO7WKN.js +52 -0
  275. package/dist/chunk-W2NVSDO5.js +5122 -0
  276. package/dist/chunk-W3YYPBEA.js +176 -0
  277. package/dist/chunk-W5AYOICN.js +280 -0
  278. package/dist/chunk-W5GZOIUF.js +27 -0
  279. package/dist/chunk-WHKNLZ3C.js +76 -0
  280. package/dist/chunk-WKBEPPQ5.js +1409 -0
  281. package/dist/chunk-WM3Z6QKQ.js +151 -0
  282. package/dist/chunk-WMI2TPMA.js +31 -0
  283. package/dist/chunk-WNX5VD7S.js +150 -0
  284. package/dist/chunk-WOVTYST3.js +60 -0
  285. package/dist/chunk-WPB5WEZJ.js +546 -0
  286. package/dist/chunk-WUO5EOAT.js +44 -0
  287. package/dist/chunk-WWLJMP6D.js +133 -0
  288. package/dist/chunk-WZMLH3XP.js +58 -0
  289. package/dist/chunk-WZYVLUVQ.js +79 -0
  290. package/dist/chunk-X2OCPVU5.js +135 -0
  291. package/dist/chunk-X3CL6DTR.js +95 -0
  292. package/dist/chunk-X6WF7JEV.js +354 -0
  293. package/dist/chunk-XAHGBPWT.js +44 -0
  294. package/dist/chunk-XCKQ5BM2.js +228 -0
  295. package/dist/chunk-XIBYREEY.js +106 -0
  296. package/dist/chunk-XKW5NDMR.js +378 -0
  297. package/dist/chunk-XRDALAO3.js +100 -0
  298. package/dist/chunk-XUP22EAS.js +41 -0
  299. package/dist/chunk-XWAC3MKW.js +243 -0
  300. package/dist/chunk-Y3R7JMXB.js +59 -0
  301. package/dist/chunk-Y54LTP4W.js +82 -0
  302. package/dist/chunk-Y7UECI4M.js +99 -0
  303. package/dist/chunk-YACGDFHC.js +47 -0
  304. package/dist/chunk-YHNIQPKY.js +71 -0
  305. package/dist/chunk-YMBR6HYP.js +111 -0
  306. package/dist/chunk-YMCH3L2S.js +26 -0
  307. package/dist/chunk-Z4ZU6T7V.js +99 -0
  308. package/dist/chunk-ZDPF67ZZ.js +173 -0
  309. package/dist/chunk-ZFC2Q67K.js +101 -0
  310. package/dist/chunk-ZGHNNSCT.js +114 -0
  311. package/dist/chunk-ZGX3ERAT.js +173 -0
  312. package/dist/chunk-ZI3YHEBY.js +37 -0
  313. package/dist/chunk-ZN7G6JLS.js +639 -0
  314. package/dist/chunk-ZNPFQMXT.js +47 -0
  315. package/dist/chunk-ZOU3LV4U.js +63 -0
  316. package/dist/chunk-ZT7B4H2V.js +117 -0
  317. package/dist/chunk-ZZCBDNZI.js +58 -0
  318. package/dist/cli.js +494 -112923
  319. package/dist/computer-tools.js +36642 -21259
  320. package/dist/harness-catalog.cjs +88 -43
  321. package/dist/index.js +1 -1
  322. package/dist/local-model-supervisor.cjs +555 -0
  323. package/package.json +3 -4
@@ -0,0 +1,639 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ nativeProfileEnvironment,
5
+ readProfileKey
6
+ } from "./chunk-ZGX3ERAT.js";
7
+ import {
8
+ KEYRING_DEADLINE_MS,
9
+ PROBE_DEADLINE_MS,
10
+ resolveBinaryPath,
11
+ runVendorCommand,
12
+ vendorCommandText
13
+ } from "./chunk-DF35KMXM.js";
14
+ import {
15
+ sleep
16
+ } from "./chunk-YMCH3L2S.js";
17
+ import {
18
+ stripAnsi
19
+ } from "./chunk-G3QP67Z7.js";
20
+ import {
21
+ quiet
22
+ } from "./chunk-RDDWQBEM.js";
23
+
24
+ // src/harness/accounts/vendor-identity.ts
25
+ import { createHash } from "node:crypto";
26
+ import { readdir, readFile as readFile2, stat } from "node:fs/promises";
27
+ import { homedir as homedir2 } from "node:os";
28
+ import { join as join3 } from "node:path";
29
+
30
+ // src/harness/accounts/mistral-vibe-identity.ts
31
+ import { access, realpath } from "node:fs/promises";
32
+ import { dirname, join } from "node:path";
33
+ var IDENTITY_SCRIPT = String.raw`
34
+ import json, os, sys, urllib.request
35
+
36
+ profile = os.environ.get("VIBE_HOME")
37
+ key = None if profile else os.environ.get("MISTRAL_API_KEY")
38
+ if not key:
39
+ paths = [os.path.join(profile, ".env")] if profile else [os.path.join(os.path.expanduser("~/.vibe"), ".env")]
40
+ for path in paths:
41
+ try:
42
+ with open(path, encoding="utf-8") as env_file:
43
+ for line in env_file:
44
+ line = line.strip()
45
+ if line.startswith("MISTRAL_API_KEY="):
46
+ key = line.split("=", 1)[1].strip().strip("\"'")
47
+ break
48
+ except OSError:
49
+ pass
50
+ if key:
51
+ break
52
+ if not key and not profile:
53
+ try:
54
+ import keyring
55
+ key = keyring.get_password("ai.mistral.vibe", "MISTRAL_API_KEY")
56
+ except Exception:
57
+ key = None
58
+ if key:
59
+ request = urllib.request.Request("https://api.mistral.ai/v1/users/me", headers={"Authorization": "Bearer " + key})
60
+ try:
61
+ with urllib.request.urlopen(request, timeout=8) as response:
62
+ email = json.load(response).get("email")
63
+ if isinstance(email, str) and email.strip():
64
+ print(json.dumps({"email": email.strip()}))
65
+ except Exception:
66
+ pass
67
+ `;
68
+ var CAPTURE_SCRIPT = String.raw`
69
+ import os, pathlib, tempfile
70
+ key = None
71
+ profile = pathlib.Path(os.environ["VIBE_HOME"])
72
+ try:
73
+ for line in (profile / ".env").read_text().splitlines():
74
+ if line.startswith("MISTRAL_API_KEY="):
75
+ key = line.split("=", 1)[1].strip().strip("\"'")
76
+ break
77
+ except OSError:
78
+ pass
79
+ try:
80
+ if not key:
81
+ import keyring
82
+ key = keyring.get_password("ai.mistral.vibe", "MISTRAL_API_KEY")
83
+ except Exception:
84
+ pass
85
+ if not key:
86
+ key = os.environ.get("MISTRAL_API_KEY")
87
+ if not key:
88
+ raise SystemExit(2)
89
+ profile.mkdir(mode=0o700, parents=True, exist_ok=True)
90
+ env_file = profile / ".env"
91
+ existing = env_file.read_text() if env_file.exists() else ""
92
+ lines = [line for line in existing.splitlines() if not line.startswith("MISTRAL_API_KEY=")]
93
+ lines.append("MISTRAL_API_KEY=" + repr(key))
94
+ fd, temporary = tempfile.mkstemp(dir=str(profile), prefix=".env.")
95
+ try:
96
+ os.fchmod(fd, 0o600)
97
+ with os.fdopen(fd, "w") as output:
98
+ output.write("\n".join(lines) + "\n")
99
+ os.replace(temporary, env_file)
100
+ finally:
101
+ if os.path.exists(temporary): os.unlink(temporary)
102
+ print('{"email":"__credential_captured__"}')
103
+ `;
104
+ function pythonExecutable(vibePath) {
105
+ const directory = dirname(vibePath);
106
+ return join(directory, process.platform === "win32" ? "python.exe" : "python");
107
+ }
108
+ async function runVibePython(script, profilePath) {
109
+ try {
110
+ const binary = await resolveBinaryPath("vibe");
111
+ if (!binary) return void 0;
112
+ const python = pythonExecutable(await realpath(binary));
113
+ if (!python) return void 0;
114
+ await access(python);
115
+ const outcome = await runVendorCommand({
116
+ gate: { inert: "keyring read", keyring: true },
117
+ binary: python,
118
+ argv: ["-c", script],
119
+ environment: profilePath ? { VIBE_HOME: profilePath } : {},
120
+ deadlineMs: KEYRING_DEADLINE_MS
121
+ });
122
+ let result;
123
+ if (outcome.status === "ok") {
124
+ try {
125
+ const parsed = JSON.parse(outcome.value.stdout.trim());
126
+ result = typeof parsed.email === "string" ? parsed.email : void 0;
127
+ } catch {
128
+ result = void 0;
129
+ }
130
+ }
131
+ return result;
132
+ } catch {
133
+ return void 0;
134
+ }
135
+ }
136
+ async function captureMistralVibeCredential(profilePath) {
137
+ return await runVibePython(CAPTURE_SCRIPT, profilePath) === "__credential_captured__";
138
+ }
139
+ async function mistralVibeAccountEmail(profilePath) {
140
+ return runVibePython(IDENTITY_SCRIPT, profilePath);
141
+ }
142
+
143
+ // src/harness/accounts/droid-identity.ts
144
+ import { createDecipheriv } from "node:crypto";
145
+ import { readFile } from "node:fs/promises";
146
+ import { homedir } from "node:os";
147
+ import { join as join2 } from "node:path";
148
+ function emailIn(value) {
149
+ return typeof value === "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value.trim()) ? value.trim() : void 0;
150
+ }
151
+ function droidCredentialEmail(encrypted, key) {
152
+ try {
153
+ const parts = encrypted.trim().split(":");
154
+ if (parts.length !== 3 || key.length !== 32) return void 0;
155
+ const [iv, tag, data] = parts.map((part) => Buffer.from(part, "base64"));
156
+ if (iv.length !== 16 || tag.length !== 16) return void 0;
157
+ const decipher = createDecipheriv("aes-256-gcm", key, iv);
158
+ decipher.setAuthTag(tag);
159
+ const record = JSON.parse(Buffer.concat([decipher.update(data), decipher.final()]).toString("utf8"));
160
+ const payload = typeof record.access_token === "string" ? record.access_token.split(".")[1] : void 0;
161
+ if (!payload) return void 0;
162
+ return emailIn(JSON.parse(Buffer.from(payload, "base64url").toString("utf8")).email);
163
+ } catch {
164
+ return void 0;
165
+ }
166
+ }
167
+ var SECRET_SERVICE_LOOKUP = String.raw`
168
+ import sys
169
+ import gi
170
+ gi.require_version("Secret", "1")
171
+ from gi.repository import Secret
172
+ schema = Secret.Schema.new("org.freedesktop.Secret.Generic", Secret.SchemaFlags.DONT_MATCH_NAME,
173
+ {"service": Secret.SchemaAttributeType.STRING, "account": Secret.SchemaAttributeType.STRING})
174
+ service = Secret.Service.get_sync(Secret.ServiceFlags.OPEN_SESSION, None)
175
+ items = service.search_sync(schema, {"service": "Factory CLI", "account": "auth-encryption-key"}, Secret.SearchFlags.LOAD_SECRETS, None)
176
+ for item in items:
177
+ value = item.get_secret()
178
+ if value is not None:
179
+ sys.stdout.write(value.get_text() or "")
180
+ break
181
+ `;
182
+ function keyringKey() {
183
+ if (process.platform !== "linux") return Promise.resolve(void 0);
184
+ return runVendorCommand({
185
+ gate: { inert: "keyring read", keyring: true },
186
+ binary: "python3",
187
+ argv: ["-c", SECRET_SERVICE_LOOKUP],
188
+ environment: {},
189
+ deadlineMs: KEYRING_DEADLINE_MS
190
+ }).then((outcome) => {
191
+ const stdout = outcome.status === "ok" ? outcome.value.stdout.trim() : "";
192
+ const key = stdout ? Buffer.from(stdout, "base64") : void 0;
193
+ return key?.length === 32 ? key : void 0;
194
+ });
195
+ }
196
+ async function droidAccountEmail(profilePath) {
197
+ const dir = profilePath ? join2(profilePath, ".factory") : process.env.FACTORY_HOME_OVERRIDE?.trim() || join2(homedir(), ".factory");
198
+ const read2 = (name) => readFile(join2(dir, name), "utf8").catch(quiet("harness/accounts/droid-identity"));
199
+ const [keyring, keyFile, file] = await Promise.all([read2("auth.v2.keyring"), read2("auth.v2.key"), read2("auth.v2.file")]);
200
+ if (file && keyFile) {
201
+ const found = droidCredentialEmail(file, Buffer.from(keyFile.trim(), "base64"));
202
+ if (found) return found;
203
+ }
204
+ if (keyring) {
205
+ const key = await keyringKey();
206
+ if (key) return droidCredentialEmail(keyring, key);
207
+ }
208
+ return void 0;
209
+ }
210
+
211
+ // src/harness/accounts/vendor-identity.ts
212
+ function emailAfter(text2, label) {
213
+ for (const line of stripAnsi(text2).split(/\r?\n/)) {
214
+ const match = label.exec(line);
215
+ if (match) return emailIn(line.slice(match.index + match[0].length).trim().split(/\s+/)[0]);
216
+ }
217
+ return void 0;
218
+ }
219
+ function json(text2) {
220
+ try {
221
+ return JSON.parse(text2);
222
+ } catch {
223
+ return void 0;
224
+ }
225
+ }
226
+ function text(value) {
227
+ return emailIn(value);
228
+ }
229
+ function parseKiroWhoami(text2) {
230
+ return emailIn(json(text2)?.email);
231
+ }
232
+ function parseKiloProfile(text2) {
233
+ return emailIn(json(text2)?.email);
234
+ }
235
+ function parseAmpUsage(text2) {
236
+ return emailAfter(text2, /Signed in as\s+/i);
237
+ }
238
+ function parseCommandCodeWhoami(text2) {
239
+ return emailAfter(text2, /\bEmail:\s*/);
240
+ }
241
+ function parseDevinAuthStatus(text2) {
242
+ return emailAfter(text2, /^\s*Email:\s*/);
243
+ }
244
+ function parseClineProviders(text2) {
245
+ const parsed = json(text2);
246
+ return emailIn(parsed?.providers?.cline?.settings?.auth?.metadata?.userInfo?.email);
247
+ }
248
+ function parseJunieCredentials(text2) {
249
+ const parsed = json(text2);
250
+ const stored = parsed?.secrets?.find((item) => item?.key === "jb-account-stored")?.secret;
251
+ if (typeof stored !== "string") return void 0;
252
+ return emailIn(json(stored)?.jbAccount?.email);
253
+ }
254
+ function parseCopilotConfig(text2) {
255
+ const parsed = json(text2.replace(/^\s*\/\/.*$/gm, ""));
256
+ const login = parsed?.lastLoggedInUser?.login;
257
+ if (typeof login !== "string" || !login.trim()) return void 0;
258
+ const host = parsed?.lastLoggedInUser?.host;
259
+ if (typeof host !== "string" || !host.trim()) return login.trim();
260
+ try {
261
+ const name = new URL(host).hostname.toLowerCase();
262
+ return name === "github.com" ? login.trim() : `${login.trim()}@${name}`;
263
+ } catch {
264
+ return void 0;
265
+ }
266
+ }
267
+ function parseOpenHandsUser(text2) {
268
+ return emailIn(json(text2)?.email);
269
+ }
270
+ async function capture(harness, profilePath, argv) {
271
+ const environment = profilePath && harness.profileEnv ? nativeProfileEnvironment({ env: harness.profileEnv, path: profilePath }) : {};
272
+ return vendorCommandText({ gate: harness, argv, environment, deadlineMs: PROBE_DEADLINE_MS });
273
+ }
274
+ async function openHandsEmail(profilePath) {
275
+ const dir = process.env.OPENHANDS_PERSISTENCE_DIR && !profilePath ? process.env.OPENHANDS_PERSISTENCE_DIR : join3(profilePath ?? homedir2(), ".openhands");
276
+ const key = (await readFile2(join3(dir, "cloud", "api_key.txt"), "utf8")).trim();
277
+ if (!key) return void 0;
278
+ const base = (process.env.OPENHANDS_CLOUD_URL || "https://app.all-hands.dev").replace(/\/+$/, "");
279
+ const response = await fetch(`${base}/api/v1/users/me`, {
280
+ headers: { Authorization: `Bearer ${key}`, Accept: "application/json" }
281
+ });
282
+ return response.ok ? parseOpenHandsUser(await response.text()) : void 0;
283
+ }
284
+ function parseKimiUserInfo(text2) {
285
+ const parsed = json(text2);
286
+ return typeof parsed?.user_id === "string" ? emailIn(parsed.email) : void 0;
287
+ }
288
+ function kimiBaseUrl(configToml) {
289
+ const section = /^\[providers\."managed:kimi-code"\]\s*$([\s\S]*?)(?=^\[|(?![\s\S]))/m.exec(configToml)?.[1];
290
+ const url = section && /^\s*base_url\s*=\s*"([^"]+)"/m.exec(section)?.[1];
291
+ return url && /^https:\/\//.test(url) ? url.replace(/\/+$/, "") : void 0;
292
+ }
293
+ async function kimiEmail(profilePath) {
294
+ const home = profilePath ? join3(profilePath, ".kimi-code") : process.env.KIMI_CODE_HOME || join3(homedir2(), ".kimi-code");
295
+ const dir = join3(home, "credentials");
296
+ const names = (await readdir(dir).catch(() => [])).filter((name) => name.endsWith(".json"));
297
+ const config = await readFile2(join3(home, "config.toml"), "utf8").catch(() => "");
298
+ const now = Date.now() / 1e3;
299
+ for (const name of names) {
300
+ const record = json(await readFile2(join3(dir, name), "utf8").catch(() => ""));
301
+ const token = record?.access_token;
302
+ if (typeof token !== "string" || typeof record?.expires_at !== "number" || record.expires_at < now + 30) continue;
303
+ const region = jwtClaims(token)?.region;
304
+ const base = kimiBaseUrl(config) ?? (region === "overseas" ? "https://api.kimi.ai/coding/v1" : "https://api.kimi.com/coding/v1");
305
+ const response = await fetch(`${base}/me`, {
306
+ headers: { Authorization: `Bearer ${token}`, Accept: "application/json" }
307
+ });
308
+ const found = response.ok ? parseKimiUserInfo(await response.text()) : void 0;
309
+ if (found) return found;
310
+ }
311
+ return void 0;
312
+ }
313
+ function parseMiniMaxUserInfo(text2) {
314
+ const parsed = json(text2);
315
+ const info = parsed?.data?.userInfo ?? parsed?.data?.user_info ?? parsed?.userInfo ?? parsed?.user_info;
316
+ if (!info || typeof info !== "object") return void 0;
317
+ for (const key of ["userEmail", "email", "userMail", "user_email"]) {
318
+ const found = emailIn(info[key]);
319
+ if (found) return found;
320
+ }
321
+ return void 0;
322
+ }
323
+ var md5 = (value) => createHash("md5").update(value).digest("hex");
324
+ async function miniMaxEmail(profilePath) {
325
+ const root = join3(profilePath ?? homedir2(), ".minimax", "auth", "prod");
326
+ for (const region of ["en", "cn"]) {
327
+ const clients = await readdir(join3(root, region)).catch(() => []);
328
+ for (const client of clients) {
329
+ const file = json(await readFile2(join3(root, region, client, "auth.json"), "utf8").catch(() => ""));
330
+ for (const record of Object.values(file?.records ?? {})) {
331
+ const token = record?.accessToken;
332
+ if (typeof token !== "string" || typeof record.expiresAtMs !== "number" || record.expiresAtMs < Date.now() + 3e4) continue;
333
+ const now = Date.now();
334
+ const url = new URL("/v1/api/user/info", region === "cn" ? "https://agent.minimaxi.com" : "https://agent.minimax.io");
335
+ const lang = region === "cn" ? "zh" : "en";
336
+ url.search = new URLSearchParams({
337
+ device_platform: "mcode",
338
+ biz_id: "3",
339
+ app_id: "3001",
340
+ version_code: "22201",
341
+ unix: String(now),
342
+ timezone_offset: String(-(/* @__PURE__ */ new Date()).getTimezoneOffset() * 60),
343
+ sys_language: lang,
344
+ lang,
345
+ device_id: "0",
346
+ os_name: process.platform,
347
+ browser_name: "mcode",
348
+ user_id: "0",
349
+ client: "mcode"
350
+ }).toString();
351
+ const seconds = Math.floor(now / 1e3);
352
+ const response = await fetch(url, {
353
+ headers: {
354
+ Accept: "application/json",
355
+ "User-Agent": "MiniMaxCode",
356
+ Authorization: `Bearer ${token}`,
357
+ yy: md5(`${encodeURIComponent(`${url.pathname}${url.search}`)}_{}${md5(String(now))}ooui`),
358
+ "x-timestamp": String(seconds),
359
+ "x-signature": md5(`${seconds}I*7Cf%WZ#S&%1RlZJ&C2`)
360
+ }
361
+ });
362
+ const found = response.ok ? parseMiniMaxUserInfo(await response.text()) : void 0;
363
+ if (found) return found;
364
+ }
365
+ }
366
+ }
367
+ return void 0;
368
+ }
369
+ function parseAugmentModels(text2) {
370
+ return emailIn(json(text2)?.user?.email);
371
+ }
372
+ async function augmentEmail(profilePath) {
373
+ const session = json(await readFile2(join3(profilePath ?? homedir2(), ".augment", "session.json"), "utf8"));
374
+ if (typeof session?.accessToken !== "string" || typeof session.tenantURL !== "string") return void 0;
375
+ const tenant = new URL(session.tenantURL);
376
+ if (tenant.protocol !== "https:" || !/(^|\.)augmentcode\.com$/.test(tenant.hostname)) return void 0;
377
+ const response = await fetch(new URL("get-models", tenant.href.endsWith("/") ? tenant.href : `${tenant.href}/`), {
378
+ method: "POST",
379
+ headers: { Authorization: `Bearer ${session.accessToken}`, "Content-Type": "application/json", Accept: "application/json" },
380
+ body: "{}"
381
+ });
382
+ return response.ok ? parseAugmentModels(await response.text()) : void 0;
383
+ }
384
+ function parseCommandCodeApiWhoami(text2) {
385
+ return emailIn(json(text2)?.user?.email);
386
+ }
387
+ async function commandCodeEmail(harness, profilePath) {
388
+ const auth = json(await readFile2(join3(profilePath ?? homedir2(), ".commandcode", "auth.json"), "utf8").catch(() => ""));
389
+ if (typeof auth?.apiKey === "string" && auth.apiKey) {
390
+ const response = await fetch("https://api.commandcode.ai/alpha/whoami", {
391
+ headers: { Authorization: `Bearer ${auth.apiKey}`, Accept: "application/json" }
392
+ }).catch(quiet("harness/accounts/vendor-identity"));
393
+ const found = response?.ok ? parseCommandCodeApiWhoami(await response.text()) : void 0;
394
+ if (found) return found;
395
+ }
396
+ return parseCommandCodeWhoami(await capture(harness, profilePath, ["whoami"]));
397
+ }
398
+ function parseHermesNousAuth(authJson) {
399
+ const nous = json(authJson)?.providers?.nous;
400
+ const claims = jwtClaims(nous?.access_token);
401
+ return typeof claims?.iss === "string" && /^https:\/\/portal\.nousresearch\.com\/?$/.test(claims.iss) ? text(claims.email) : void 0;
402
+ }
403
+ function codexIdTokenEmail(authJson) {
404
+ const claims = jwtClaims(json(authJson)?.tokens?.id_token);
405
+ return text(claims?.email);
406
+ }
407
+ function jwtClaims(token) {
408
+ const payload = typeof token === "string" ? token.split(".")[1] : void 0;
409
+ if (!payload) return void 0;
410
+ const padded = payload + "=".repeat((4 - payload.length % 4) % 4);
411
+ const claims = json(Buffer.from(padded, "base64url").toString("utf8"));
412
+ return claims && typeof claims === "object" ? claims : void 0;
413
+ }
414
+ function antigravityIdTokenEmail(tokenJson) {
415
+ const claims = jwtClaims(json(tokenJson)?.id_token);
416
+ if (claims?.iss !== "https://accounts.google.com" && claims?.iss !== "accounts.google.com") return void 0;
417
+ return claims.email_verified === false ? void 0 : text(claims.email);
418
+ }
419
+ async function antigravityEmail(profilePath) {
420
+ const tokenFile = join3(profilePath ?? homedir2(), ".gemini", "antigravity-cli", "antigravity-oauth-token");
421
+ const fromToken = await readFile2(tokenFile, "utf8").then(antigravityIdTokenEmail, () => void 0);
422
+ if (fromToken) return fromToken;
423
+ const logDir = join3(profilePath ?? homedir2(), ".gemini", "antigravity-cli", "log");
424
+ for (let attempt = 0; attempt < 12; attempt++) {
425
+ const entries = await readdir(logDir, { withFileTypes: true }).catch(() => []);
426
+ const logs = (await Promise.all(entries.filter((entry) => entry.isFile() && entry.name.endsWith(".log")).map(async (entry) => {
427
+ const full = join3(logDir, entry.name);
428
+ const info = await stat(full).catch(quiet("harness/accounts/vendor-identity"));
429
+ return info ? { full, mtime: info.mtimeMs } : void 0;
430
+ }))).filter((item) => Boolean(item)).sort((left, right) => right.mtime - left.mtime);
431
+ for (const { full } of logs.slice(0, 3)) {
432
+ const content = await readFile2(full, "utf8").catch(() => "");
433
+ const match = /OAuth: authenticated successfully as ([^\s,]+@[^\s,]+)/.exec(content);
434
+ if (match) return match[1];
435
+ }
436
+ if (attempt < 11) await sleep(600);
437
+ }
438
+ return void 0;
439
+ }
440
+ var ask = (argv, parse) => async (harness, profilePath) => parse(await capture(harness, profilePath, argv));
441
+ var read = (paths, parse) => async (_harness, profilePath) => {
442
+ for (const path of paths(profilePath)) {
443
+ const found = await readFile2(path, "utf8").then(parse, () => void 0);
444
+ if (found) return found;
445
+ }
446
+ return void 0;
447
+ };
448
+ var under = (profilePath, fallback) => profilePath ?? join3(homedir2(), fallback);
449
+ var IDENTITY = {
450
+ // `claude auth status` prints JSON with this profile's own email.
451
+ claude: ask(["auth", "status"], (output) => text(json(output)?.email)),
452
+ kiro: ask(["whoami", "--format", "json"], parseKiroWhoami),
453
+ kilo: ask(["profile", "--json"], parseKiloProfile),
454
+ amp: ask(["usage"], parseAmpUsage),
455
+ command: commandCodeEmail,
456
+ devin: ask(["auth", "status"], parseDevinAuthStatus),
457
+ codex: read((profilePath) => [join3(under(profilePath, ".codex"), "auth.json")], codexIdTokenEmail),
458
+ // google_accounts.json names the signed-in Google account in `active`.
459
+ gemini: read(
460
+ (profilePath) => [join3(profilePath ?? homedir2(), ".gemini", "google_accounts.json")],
461
+ (contents) => text(json(contents)?.active)
462
+ ),
463
+ // auth.json is keyed by issuer::uuid; each entry carries a plain `email`.
464
+ grok: read((profilePath) => [join3(profilePath ?? homedir2(), ".grok", "auth.json")], (contents) => {
465
+ const entries = Object.values(json(contents) ?? {});
466
+ const emails = [...new Set(entries.map((entry) => text(entry?.email)?.toLowerCase()).filter((value) => Boolean(value)))];
467
+ return emails.length === 1 ? emails[0] : void 0;
468
+ }),
469
+ // cli-config.json's authInfo.email, under XDG_CONFIG_HOME when that is set
470
+ // -- which every ClikCode account profile sets -- and in ~/.cursor otherwise.
471
+ cursor: read((profilePath) => {
472
+ const home = profilePath ?? homedir2();
473
+ const config = profilePath ? join3(profilePath, ".config") : process.env.XDG_CONFIG_HOME || join3(home, ".config");
474
+ return [join3(config, "cursor", "cli-config.json"), join3(home, ".cursor", "cli-config.json")];
475
+ }, (contents) => text(json(contents)?.authInfo?.email)),
476
+ cline: read((profilePath) => [join3(profilePath ?? homedir2(), ".cline", "data", "settings", "providers.json")], parseClineProviders),
477
+ junie: read((profilePath) => [join3(profilePath ?? homedir2(), ".junie", "secure_credentials.json")], parseJunieCredentials),
478
+ copilot: read((profilePath) => [join3(under(profilePath, ".copilot"), "config.json")], parseCopilotConfig),
479
+ openhands: (_harness, profilePath) => openHandsEmail(profilePath),
480
+ vibe: (_harness, profilePath) => mistralVibeAccountEmail(profilePath),
481
+ antigravity: (_harness, profilePath) => antigravityEmail(profilePath),
482
+ kimi: (_harness, profilePath) => kimiEmail(profilePath),
483
+ mcode: (_harness, profilePath) => miniMaxEmail(profilePath),
484
+ droid: (_harness, profilePath) => droidAccountEmail(profilePath),
485
+ auggie: (_harness, profilePath) => augmentEmail(profilePath),
486
+ // HERMES_HOME is the profile itself; auth.json sits at its root.
487
+ hermes: read((profilePath) => [join3(profilePath ?? (process.env.HERMES_HOME || join3(homedir2(), ".hermes")), "auth.json")], parseHermesNousAuth)
488
+ };
489
+ var CREDENTIAL_CAPTURE = {
490
+ vibe: captureMistralVibeCredential
491
+ };
492
+ function vendorCredentialCapture(harness) {
493
+ return CREDENTIAL_CAPTURE[harness.command];
494
+ }
495
+ async function vendorAccountEmail(harness, profilePath) {
496
+ try {
497
+ return await IDENTITY[harness.command]?.(harness, profilePath);
498
+ } catch {
499
+ }
500
+ return void 0;
501
+ }
502
+
503
+ // src/harness/accounts/api-key-identity.ts
504
+ function json2(text2) {
505
+ try {
506
+ return JSON.parse(text2);
507
+ } catch {
508
+ return void 0;
509
+ }
510
+ }
511
+ function parseOpenAiMe(text2) {
512
+ const parsed = json2(text2);
513
+ return parsed?.object === void 0 || parsed.object === "user" ? emailIn(parsed?.email) : void 0;
514
+ }
515
+ function parseMistralMe(text2) {
516
+ return emailIn(json2(text2)?.email);
517
+ }
518
+ function parseCursorMe(text2) {
519
+ return emailIn(json2(text2)?.userEmail);
520
+ }
521
+ function parseClineMe(text2) {
522
+ const parsed = json2(text2);
523
+ if (parsed?.success === false) return void 0;
524
+ return emailIn(parsed?.data?.email ?? parsed?.email);
525
+ }
526
+ function parseFireworksAccounts(text2) {
527
+ const accounts = json2(text2)?.accounts;
528
+ if (!Array.isArray(accounts) || accounts.length !== 1) return void 0;
529
+ return emailIn(accounts[0]?.email);
530
+ }
531
+ var bearer = (url, parse) => async (key) => {
532
+ const response = await fetch(url, {
533
+ headers: { Authorization: `Bearer ${key}`, Accept: "application/json" }
534
+ });
535
+ return response.ok ? parse(await response.text()) : void 0;
536
+ };
537
+ var READERS = {
538
+ openai: bearer("https://api.openai.com/v1/me", parseOpenAiMe),
539
+ mistral: bearer("https://api.mistral.ai/v1/users/me", parseMistralMe),
540
+ cursor: bearer("https://api.cursor.com/v1/me", parseCursorMe),
541
+ "command-code": bearer("https://api.commandcode.ai/alpha/whoami", parseCommandCodeApiWhoami),
542
+ cline: bearer("https://api.cline.bot/api/v1/users/me", parseClineMe),
543
+ fireworks: bearer("https://api.fireworks.ai/v1/accounts", parseFireworksAccounts),
544
+ // Kimi Code's own profile call (see vendor-identity.ts); a Moonshot
545
+ // platform key is refused there and names no one.
546
+ kimi: bearer("https://api.kimi.com/coding/v1/me", parseKimiUserInfo),
547
+ // Amp publishes no key endpoint; its own `amp usage` reads AMP_API_KEY
548
+ // before its stored login and opens with "Signed in as <email>".
549
+ amp: async (key, harness) => harness?.keyIdentityArgv && harness.authEnv?.[0] ? parseAmpUsage(await vendorCommandText({ gate: harness, argv: harness.keyIdentityArgv, environment: { [harness.authEnv[0]]: key }, deadlineMs: PROBE_DEADLINE_MS })) : void 0
550
+ };
551
+ var BY_ENV = {
552
+ OPENAI_API_KEY: "openai",
553
+ MISTRAL_API_KEY: "mistral",
554
+ CURSOR_API_KEY: "cursor",
555
+ COMMAND_CODE_API_KEY: "command-code",
556
+ CLINE_API_KEY: "cline",
557
+ FIREWORKS_API_KEY: "fireworks",
558
+ KIMI_API_KEY: "kimi",
559
+ AMP_API_KEY: "amp"
560
+ };
561
+ var BY_PROVIDER = {
562
+ openai: "openai",
563
+ mistral: "mistral",
564
+ "mistral-vibe": "mistral",
565
+ cursor: "cursor",
566
+ "command-code": "command-code",
567
+ cline: "cline",
568
+ fireworks: "fireworks",
569
+ kimi: "kimi",
570
+ amp: "amp"
571
+ };
572
+ function apiKeyIdentityVendor(provider, envName) {
573
+ if (BY_ENV[envName]) return BY_ENV[envName];
574
+ return KNOWN_KEY_ENV.has(envName) ? void 0 : BY_PROVIDER[provider];
575
+ }
576
+ var KNOWN_KEY_ENV = /* @__PURE__ */ new Set([
577
+ "ANTHROPIC_API_KEY",
578
+ "GEMINI_API_KEY",
579
+ "GOOGLE_API_KEY",
580
+ "XAI_API_KEY",
581
+ "GROK_API_KEY",
582
+ "OPENROUTER_API_KEY",
583
+ "DEEPSEEK_API_KEY",
584
+ "MOONSHOT_API_KEY",
585
+ "MINIMAX_API_KEY",
586
+ "MCODE_PROVIDER_API_KEY",
587
+ "ZAI_API_KEY",
588
+ "DASHSCOPE_API_KEY",
589
+ "GROQ_API_KEY",
590
+ "TOGETHER_API_KEY",
591
+ "FACTORY_API_KEY",
592
+ "LLM_API_KEY"
593
+ ]);
594
+ async function apiKeyAccountEmail(options) {
595
+ const key = options.key?.trim();
596
+ const vendor = key ? apiKeyIdentityVendor(options.provider, options.envName) : void 0;
597
+ if (!key || !vendor) return void 0;
598
+ try {
599
+ return await READERS[vendor](key, options.harness);
600
+ } catch {
601
+ }
602
+ return void 0;
603
+ }
604
+
605
+ // src/harness/accounts/labels.ts
606
+ async function deriveAccountLabel(harness, profilePath) {
607
+ const [saved] = Object.entries(readProfileKey(profilePath));
608
+ if (saved) return apiKeyAccountEmail({ provider: harness.provider, envName: saved[0], key: saved[1], harness });
609
+ return vendorAccountEmail(harness, profilePath);
610
+ }
611
+ async function matchingVendorAccount(accounts, harness, identity, exceptId) {
612
+ const candidates = accounts.filter((account) => account.id !== exceptId && account.provider === harness.provider && account.authKind === "vendor-cli");
613
+ const wanted = identity.toLowerCase();
614
+ candidates.sort((left, right) => Number(right.label.toLowerCase() === wanted) - Number(left.label.toLowerCase() === wanted));
615
+ for (const account of candidates) {
616
+ const actual = await deriveAccountLabel(harness, account.nativeProfile?.path);
617
+ if (actual?.toLowerCase() === wanted) return account;
618
+ if (!actual && account.label.toLowerCase() === wanted) return account;
619
+ }
620
+ return void 0;
621
+ }
622
+ function nameAccount(accounts, harness, preferred, exceptId) {
623
+ const used = (label) => accounts.some((account) => account.id !== exceptId && account.provider === harness.provider && account.label.toLowerCase() === label.toLowerCase());
624
+ const named = preferred && preferred.toLowerCase() !== harness.displayName.toLowerCase() ? preferred : void 0;
625
+ const first = named ?? harness.displayName;
626
+ if (!used(first)) return first;
627
+ for (let number = 2; ; number += 1) {
628
+ const candidate = named ? `${named} (${number})` : `${harness.displayName} ${number}`;
629
+ if (!used(candidate)) return candidate;
630
+ }
631
+ }
632
+
633
+ export {
634
+ vendorCredentialCapture,
635
+ apiKeyAccountEmail,
636
+ deriveAccountLabel,
637
+ matchingVendorAccount,
638
+ nameAccount
639
+ };
@@ -0,0 +1,47 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ acceptGatewayUncensoredTerms,
5
+ gatewayUncensoredConsent
6
+ } from "./chunk-W5AYOICN.js";
7
+ import "./chunk-2OLS7V66.js";
8
+ import "./chunk-2QWPQRSU.js";
9
+ import "./chunk-IS4USJPY.js";
10
+ import "./chunk-2BBELGHY.js";
11
+ import "./chunk-QYHI3YET.js";
12
+ import "./chunk-4LPDG57B.js";
13
+ import "./chunk-TQDM7S5N.js";
14
+ import "./chunk-TQDKJHWX.js";
15
+ import "./chunk-GQBZU6EO.js";
16
+ import "./chunk-F252T6Y3.js";
17
+ import "./chunk-PEWCDI2C.js";
18
+ import "./chunk-TULAXS77.js";
19
+ import "./chunk-NWEYRBWK.js";
20
+ import "./chunk-YMCH3L2S.js";
21
+ import {
22
+ emitResult
23
+ } from "./chunk-JGIWATSG.js";
24
+ import "./chunk-5B6TVO4A.js";
25
+ import "./chunk-NAOX3JUB.js";
26
+ import "./chunk-GGYKY4GF.js";
27
+ import "./chunk-PAXYQZH7.js";
28
+ import "./chunk-4L2ZZM4Q.js";
29
+ import "./chunk-F6F47QAY.js";
30
+ import "./chunk-RDDWQBEM.js";
31
+ import "./chunk-MPAJ446F.js";
32
+ import "./chunk-CBANJFBO.js";
33
+ import "./chunk-PWXII6HF.js";
34
+
35
+ // src/commands/gateway-agreement.ts
36
+ async function gatewayAgreement(config, options) {
37
+ const consent = await gatewayUncensoredConsent({ config });
38
+ if (options.acceptVersion !== void 0 && options.acceptVersion !== consent.version) {
39
+ throw new Error("The agreement version has changed. Read `clikcode gateway agreement` and accept its current version.");
40
+ }
41
+ const result = options.acceptVersion === void 0 ? consent : await acceptGatewayUncensoredTerms(options.acceptVersion, { config });
42
+ if (options.acceptVersion !== void 0 && !result.accepted) throw new Error("The current agreement was not recorded. Review it and try again.");
43
+ emitResult(result);
44
+ }
45
+ export {
46
+ gatewayAgreement
47
+ };