clikcode 1.0.3 → 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 +498 -112593
  319. package/dist/computer-tools.js +36642 -21258
  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,73 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ mergeVault,
5
+ snapshotVault
6
+ } from "./chunk-I75EDU75.js";
7
+ import "./chunk-4L2ZZM4Q.js";
8
+ import "./chunk-F6F47QAY.js";
9
+ import "./chunk-RDDWQBEM.js";
10
+ import "./chunk-MPAJ446F.js";
11
+ import {
12
+ scrubSecrets
13
+ } from "./chunk-CBANJFBO.js";
14
+ import "./chunk-PWXII6HF.js";
15
+
16
+ // src/agent/computer/vault-sync.ts
17
+ import { spawn } from "node:child_process";
18
+ async function exchangeVault(stateDir, incoming) {
19
+ const before = await snapshotVault(stateDir);
20
+ await mergeVault(stateDir, JSON.parse(incoming));
21
+ return JSON.stringify(before);
22
+ }
23
+ function describeReply(text) {
24
+ const size = `${text.length} characters`;
25
+ if (!text.trim()) return "it was empty";
26
+ try {
27
+ const parsed = JSON.parse(text);
28
+ const doc = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
29
+ if (doc && doc.status === "error" && typeof doc.message === "string" && !("secrets" in doc) && !("items" in doc)) return `its error: ${scrubSecrets(doc.message).replace(/\s+/g, " ").slice(0, 160)}`;
30
+ return `${size} of JSON (${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}), not a v1 vault`;
31
+ } catch {
32
+ return `${size}, not JSON`;
33
+ }
34
+ }
35
+ async function syncVault(stateDir, transport) {
36
+ const mine = await snapshotVault(stateDir);
37
+ let reply, last = "";
38
+ for (let attempt = 0; attempt < 2 && !reply; attempt++) {
39
+ last = await transport(JSON.stringify(mine));
40
+ try {
41
+ const parsed = JSON.parse(last);
42
+ if (parsed?.v === 1 && Array.isArray(parsed.secrets)) reply = parsed;
43
+ } catch {
44
+ }
45
+ }
46
+ if (!reply) throw new Error(`The other computer answered with something that is not a vault (${describeReply(last)}). Its answer is not shown: it may hold secrets. Run \`clikcode computer secrets --exchange\` there by hand to see what it says.`);
47
+ const received = await mergeVault(stateDir, reply);
48
+ const theirs = new Set(reply.secrets.map((secret) => secret.name.toLowerCase()));
49
+ const sent = { added: mine.secrets.filter((secret) => !theirs.has(secret.name.toLowerCase())).length, updated: 0, same: mine.secrets.filter((secret) => theirs.has(secret.name.toLowerCase())).length };
50
+ return { sent, received };
51
+ }
52
+ function tailscaleTransport(target) {
53
+ if (!/^[\w.-]+@[\w.-]+$/.test(target)) throw new Error("Name the other computer as user@host, for example chronos@macbook.");
54
+ const remote = 'PATH="$HOME/.local/bin:$HOME/.local/share/clikcode/node/bin:$PATH" clikcode computer secrets --exchange';
55
+ return (payload) => new Promise((resolve, reject) => {
56
+ const child = spawn("tailscale", ["ssh", target, remote], { stdio: ["pipe", "pipe", "pipe"] });
57
+ let out = "", err = "";
58
+ child.stdout.on("data", (chunk) => {
59
+ out += String(chunk);
60
+ });
61
+ child.stderr.on("data", (chunk) => {
62
+ err += String(chunk);
63
+ });
64
+ child.on("error", (error) => reject(new Error(`tailscale could not be run: ${error.message}`)));
65
+ child.on("close", (code) => code === 0 && out.trim() ? resolve(out) : reject(new Error(`The other computer did not answer (${code}). ${err.trim().split("\n").slice(-2).join(" ")}`.trim())));
66
+ child.stdin.end(payload);
67
+ });
68
+ }
69
+ export {
70
+ exchangeVault,
71
+ syncVault,
72
+ tailscaleTransport
73
+ };
@@ -0,0 +1,52 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ VENDOR_MFA_DESTINATION,
5
+ addDestination,
6
+ connectionState,
7
+ customAuthBody,
8
+ declaredAuthKind,
9
+ declaredConnectionValues,
10
+ declaredCustomProps,
11
+ describeKnown,
12
+ destinationProblem,
13
+ firstJsonObject,
14
+ loadDestinations,
15
+ normalizeSendTo,
16
+ removeDestination,
17
+ sendToDestinations,
18
+ slotsOf,
19
+ vendorMfaAccountFor,
20
+ vendorMfaAccounts,
21
+ vendorMfaCode
22
+ } from "./chunk-B4HNJRAH.js";
23
+ import "./chunk-PWBF2X3V.js";
24
+ import "./chunk-YMCH3L2S.js";
25
+ import "./chunk-I75EDU75.js";
26
+ import "./chunk-PAXYQZH7.js";
27
+ import "./chunk-4L2ZZM4Q.js";
28
+ import "./chunk-F6F47QAY.js";
29
+ import "./chunk-RDDWQBEM.js";
30
+ import "./chunk-MPAJ446F.js";
31
+ import "./chunk-CBANJFBO.js";
32
+ import "./chunk-PWXII6HF.js";
33
+ export {
34
+ VENDOR_MFA_DESTINATION,
35
+ addDestination,
36
+ connectionState,
37
+ customAuthBody,
38
+ declaredAuthKind,
39
+ declaredConnectionValues,
40
+ declaredCustomProps,
41
+ describeKnown,
42
+ destinationProblem,
43
+ firstJsonObject,
44
+ loadDestinations,
45
+ normalizeSendTo,
46
+ removeDestination,
47
+ sendToDestinations,
48
+ slotsOf,
49
+ vendorMfaAccountFor,
50
+ vendorMfaAccounts,
51
+ vendorMfaCode
52
+ };
@@ -0,0 +1,118 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ nativeTranscriptReader
5
+ } from "./chunk-M3FO5UMK.js";
6
+ import {
7
+ readClaudeFsTranscriptForSync,
8
+ reconcileNativeTranscript
9
+ } from "./chunk-CERF3RIB.js";
10
+ import {
11
+ nativeProfileEnvironment
12
+ } from "./chunk-ZGX3ERAT.js";
13
+ import {
14
+ readTurnMarks,
15
+ sessionTranscriptMessages
16
+ } from "./chunk-FF7ZVYJF.js";
17
+ import {
18
+ boundTurnActivities,
19
+ readTurnActivities
20
+ } from "./chunk-3B2CHX7M.js";
21
+ import {
22
+ allLocalHarnesses,
23
+ harnessSupportsEffort,
24
+ harnessSupportsPermissionMode,
25
+ localHarnessForCommand
26
+ } from "./chunk-KYUHIFP3.js";
27
+
28
+ // src/turn/handoff.ts
29
+ function carriedHandoffSettings(source, target, defaults, efforts) {
30
+ const effort = source.effort && harnessSupportsEffort(target) && (!efforts?.length || efforts.includes(source.effort)) ? source.effort : harnessSupportsEffort(target) ? defaults.effort : "";
31
+ const from = source.nativeHarness ? localHarnessForCommand(source.nativeHarness) : void 0;
32
+ const permissionMode = source.permissionMode ? carriedPermissionMode(from, source.permissionMode, target, defaults.permissionMode) : defaults.permissionMode;
33
+ return { ...defaults, effort, permissionMode };
34
+ }
35
+ var PERMISSION_NAME_LEVEL = { ask: 0, auto: 1, bypass: 2 };
36
+ function permissionSignature(harness, mode) {
37
+ const argv = harness.permissionArgv?.[mode]?.argv ?? [];
38
+ const env = harness.permissionEnv?.[mode] ?? {};
39
+ if (!argv.length && !Object.keys(env).length) return void 0;
40
+ return JSON.stringify({ argv, env: Object.entries(env).sort(([left], [right]) => left.localeCompare(right)) });
41
+ }
42
+ function permissionLevel(harness, mode, catalog = allLocalHarnesses()) {
43
+ let level = PERMISSION_NAME_LEVEL[mode];
44
+ const signature = permissionSignature(harness, mode);
45
+ if (!signature) return level;
46
+ for (const other of catalog) {
47
+ for (const otherMode of other.permissionModes ?? []) {
48
+ if (permissionSignature(other, otherMode) === signature) level = Math.max(level, PERMISSION_NAME_LEVEL[otherMode]);
49
+ }
50
+ }
51
+ return level;
52
+ }
53
+ function carriedPermissionMode(from, mode, target, fallback, catalog = allLocalHarnesses()) {
54
+ const sourceLevel = from ? permissionLevel(from, mode, catalog) : PERMISSION_NAME_LEVEL[mode];
55
+ const sourceSignature = from ? permissionSignature(from, mode) : void 0;
56
+ const offered = (target.permissionModes ?? []).filter((candidate) => harnessSupportsPermissionMode(target, candidate)).map((candidate) => ({ mode: candidate, level: permissionLevel(target, candidate, catalog) }));
57
+ const same = sourceSignature ? offered.find((candidate) => permissionSignature(target, candidate.mode) === sourceSignature) : void 0;
58
+ if (same) return same.mode;
59
+ const allowed = offered.filter((candidate) => candidate.level <= sourceLevel).sort((left, right) => right.level - left.level || Number(right.mode === mode) - Number(left.mode === mode));
60
+ if (allowed[0]) return allowed[0].mode;
61
+ if (!offered.length) return fallback;
62
+ const fallbackLevel = offered.find((candidate) => candidate.mode === fallback)?.level;
63
+ if (fallbackLevel !== void 0 && fallbackLevel <= sourceLevel) return fallback;
64
+ return [...offered].sort((left, right) => left.level - right.level)[0].mode;
65
+ }
66
+ function carriedHandoffModel(source, targetModels, fallback) {
67
+ for (const model of [source.model, source.reported?.model]) {
68
+ if (model && targetModels.includes(model)) return model;
69
+ }
70
+ return fallback;
71
+ }
72
+ async function synchronizeNativeTranscript(state, session) {
73
+ if (!session.nativeHarness || !session.nativeSessionId) return false;
74
+ const harness = localHarnessForCommand(session.nativeHarness);
75
+ const reader = harness ? nativeTranscriptReader(harness) : void 0;
76
+ if (!harness || !reader) return false;
77
+ const account = session.accountId ? state.accounts.find((item) => item.id === session.accountId) : void 0;
78
+ const workspace = session.workspace ?? process.cwd();
79
+ const environment = nativeProfileEnvironment(account?.nativeProfile);
80
+ const source = await (harness.command === "claude" ? readClaudeFsTranscriptForSync(session.nativeSessionId, workspace, session.messages ?? [], environment) : reader(harness, session.nativeSessionId, workspace, environment)).catch(() => []);
81
+ const { messages: merged, appendedFrom } = reconcileNativeTranscript(session.messages ?? [], source);
82
+ const cached = session.messages ?? [];
83
+ if (merged.length === cached.length && merged.every((message, index) => message.role === cached[index]?.role && message.content === cached[index]?.content)) return false;
84
+ session.messages = merged;
85
+ if (session.pendingTurn) {
86
+ const appended = merged.slice(appendedFrom);
87
+ const promptIndex = appended.findIndex((message) => message.role === "user" && message.content.trim() === session.pendingTurn.prompt.trim());
88
+ if (promptIndex >= 0) {
89
+ const answerIndex = appended.findIndex((message, index) => index > promptIndex && message.role === "assistant");
90
+ if (answerIndex >= 0) {
91
+ const answer = session.messages[appendedFrom + answerIndex];
92
+ const activities = readTurnActivities(session.pendingTurn.activities, session.pendingTurn.response?.length ?? 0);
93
+ const marks = readTurnMarks(session.pendingTurn.marks);
94
+ if (marks.length) {
95
+ answer.marks = [...readTurnMarks(answer.marks), ...marks.map((mark) => ({ ...mark, responseOffset: Math.min(mark.responseOffset, answer.content.length) }))];
96
+ }
97
+ if (activities.length) answer.activities = boundTurnActivities([
98
+ ...readTurnActivities(answer.activities, answer.content.length),
99
+ ...activities.map((activity) => ({ ...activity, responseOffset: Math.min(activity.responseOffset, answer.content.length) }))
100
+ ]);
101
+ } else {
102
+ const checkpointAnswer = sessionTranscriptMessages({ ...session, messages: [] }).find((message) => message.role === "assistant");
103
+ if (checkpointAnswer) session.messages.push(checkpointAnswer);
104
+ }
105
+ delete session.pendingTurn;
106
+ }
107
+ }
108
+ session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
109
+ return true;
110
+ }
111
+
112
+ export {
113
+ carriedHandoffSettings,
114
+ permissionLevel,
115
+ carriedPermissionMode,
116
+ carriedHandoffModel,
117
+ synchronizeNativeTranscript
118
+ };
@@ -0,0 +1,107 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+
4
+ // src/agent/computer/run-cli.ts
5
+ import { spawn } from "node:child_process";
6
+ var KILL_GRACE_MS = 3e3;
7
+ var DRAIN_MS = 1e3;
8
+ var live = /* @__PURE__ */ new Set();
9
+ var exitHookInstalled = false;
10
+ function killOnExit(child) {
11
+ live.add(child);
12
+ const untrack = () => {
13
+ live.delete(child);
14
+ };
15
+ child.once("exit", untrack);
16
+ if (!exitHookInstalled) {
17
+ exitHookInstalled = true;
18
+ process.once("exit", () => {
19
+ for (const running of live) signalTree(running, "SIGKILL");
20
+ });
21
+ }
22
+ return untrack;
23
+ }
24
+ function stopTree(child, graceMs = KILL_GRACE_MS) {
25
+ if (child.exitCode !== null || child.signalCode !== null) return;
26
+ signalTree(child, "SIGTERM");
27
+ const timer = setTimeout(() => signalTree(child, "SIGKILL"), graceMs);
28
+ timer.unref?.();
29
+ child.once("exit", () => clearTimeout(timer));
30
+ }
31
+ function signalTree(child, signal) {
32
+ if (child.pid === void 0) return;
33
+ if (process.platform !== "win32") {
34
+ try {
35
+ process.kill(-child.pid, signal);
36
+ return;
37
+ } catch {
38
+ }
39
+ }
40
+ try {
41
+ child.kill(signal);
42
+ } catch {
43
+ }
44
+ }
45
+ function runCli(command, argv, options = {}) {
46
+ if (options.signal?.aborted) return Promise.resolve({ code: null, text: "", missing: false });
47
+ return new Promise((resolve) => {
48
+ const child = spawn(command, argv, { stdio: [options.stdin === void 0 ? "ignore" : "pipe", "pipe", "pipe"], windowsHide: true, detached: process.platform !== "win32" });
49
+ killOnExit(child);
50
+ let text = "";
51
+ let settled = false;
52
+ let exited = false;
53
+ let killTimer;
54
+ let drainTimer;
55
+ const keep = options.maxChars ?? 2e5;
56
+ const stop = () => {
57
+ if (exited || killTimer) return;
58
+ signalTree(child, "SIGTERM");
59
+ killTimer = setTimeout(() => signalTree(child, "SIGKILL"), options.graceMs ?? KILL_GRACE_MS);
60
+ killTimer.unref?.();
61
+ };
62
+ const timer = setTimeout(stop, options.timeoutMs ?? 9e4);
63
+ options.signal?.addEventListener("abort", stop, { once: true });
64
+ const finish = (result) => {
65
+ if (settled) return;
66
+ settled = true;
67
+ clearTimeout(timer);
68
+ if (drainTimer) clearTimeout(drainTimer);
69
+ options.signal?.removeEventListener("abort", stop);
70
+ child.stdout?.destroy();
71
+ child.stderr?.destroy();
72
+ resolve(result);
73
+ };
74
+ child.stdout.on("data", (chunk) => {
75
+ text = (text + String(chunk)).slice(-keep);
76
+ });
77
+ child.stderr.on("data", (chunk) => {
78
+ text = (text + String(chunk)).slice(-keep);
79
+ });
80
+ if (options.stdin !== void 0) {
81
+ child.stdin.on("error", () => void 0);
82
+ child.stdin.end(options.stdin);
83
+ }
84
+ child.once("error", (error) => {
85
+ if (killTimer) clearTimeout(killTimer);
86
+ finish({ code: null, text: "", missing: error.code === "ENOENT" });
87
+ });
88
+ child.once("exit", (code) => {
89
+ exited = true;
90
+ if (killTimer) clearTimeout(killTimer);
91
+ if (process.platform !== "win32" && child.pid !== void 0) {
92
+ try {
93
+ process.kill(-child.pid, "SIGKILL");
94
+ } catch {
95
+ }
96
+ }
97
+ drainTimer = setTimeout(() => finish({ code, text, missing: false }), DRAIN_MS);
98
+ child.once("close", () => finish({ code, text, missing: false }));
99
+ });
100
+ });
101
+ }
102
+
103
+ export {
104
+ killOnExit,
105
+ stopTree,
106
+ runCli
107
+ };
@@ -0,0 +1,43 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
+ }) : x)(function(x) {
12
+ if (typeof require !== "undefined") return require.apply(this, arguments);
13
+ throw Error('Dynamic require of "' + x + '" is not supported');
14
+ });
15
+ var __commonJS = (cb, mod) => function __require2() {
16
+ try {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ } catch (e) {
19
+ throw mod = 0, e;
20
+ }
21
+ };
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (let key of __getOwnPropNames(from))
25
+ if (!__hasOwnProp.call(to, key) && key !== except)
26
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27
+ }
28
+ return to;
29
+ };
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31
+ // If the importer is in node compatibility mode or this is not an ESM
32
+ // file that has been converted to a CommonJS file using a Babel-
33
+ // compatible transform (i.e. "__esModule" has not been set), then set
34
+ // "default" to the CommonJS "module.exports" for node compatibility.
35
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
36
+ mod
37
+ ));
38
+
39
+ export {
40
+ __require,
41
+ __commonJS,
42
+ __toESM
43
+ };
@@ -0,0 +1,80 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ CredentialError,
5
+ UNKNOWN_ACCOUNT,
6
+ allSavedLogins,
7
+ auditVault,
8
+ backfillSecretMeta,
9
+ canonicalSecretName,
10
+ deleteNamedSecret,
11
+ forgetSavedLogins,
12
+ lockCredentialVault,
13
+ loginLabel,
14
+ mergeVault,
15
+ namedSecretInfo,
16
+ namedSecretNames,
17
+ pinEarlierToken,
18
+ pinnedToken,
19
+ readNamedSecret,
20
+ readVaultRecords,
21
+ removeSavedLogin,
22
+ removeVaultRecord,
23
+ restoreVault,
24
+ sameSite,
25
+ saveGeneratedToken,
26
+ saveLoginFields,
27
+ saveNamedSecret,
28
+ saveSignInMethod,
29
+ savedLoginFields,
30
+ savedLoginsForSite,
31
+ setLoginRejected,
32
+ setSecretUrl,
33
+ siteKey,
34
+ siteName,
35
+ snapshotVault,
36
+ unreadableLoginIds,
37
+ writeVaultRecord
38
+ } from "./chunk-I75EDU75.js";
39
+ import "./chunk-4L2ZZM4Q.js";
40
+ import "./chunk-F6F47QAY.js";
41
+ import "./chunk-RDDWQBEM.js";
42
+ import "./chunk-MPAJ446F.js";
43
+ import "./chunk-CBANJFBO.js";
44
+ import "./chunk-PWXII6HF.js";
45
+ export {
46
+ CredentialError,
47
+ UNKNOWN_ACCOUNT,
48
+ allSavedLogins,
49
+ auditVault,
50
+ backfillSecretMeta,
51
+ canonicalSecretName,
52
+ deleteNamedSecret,
53
+ forgetSavedLogins,
54
+ lockCredentialVault,
55
+ loginLabel,
56
+ mergeVault,
57
+ namedSecretInfo,
58
+ namedSecretNames,
59
+ pinEarlierToken,
60
+ pinnedToken,
61
+ readNamedSecret,
62
+ readVaultRecords,
63
+ removeSavedLogin,
64
+ removeVaultRecord,
65
+ restoreVault,
66
+ sameSite,
67
+ saveGeneratedToken,
68
+ saveLoginFields,
69
+ saveNamedSecret,
70
+ saveSignInMethod,
71
+ savedLoginFields,
72
+ savedLoginsForSite,
73
+ setLoginRejected,
74
+ setSecretUrl,
75
+ siteKey,
76
+ siteName,
77
+ snapshotVault,
78
+ unreadableLoginIds,
79
+ writeVaultRecord
80
+ };
@@ -0,0 +1,128 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ queryAcp
5
+ } from "./chunk-ESF3DIZY.js";
6
+ import {
7
+ atomicWriteFile
8
+ } from "./chunk-F6F47QAY.js";
9
+ import {
10
+ quiet
11
+ } from "./chunk-RDDWQBEM.js";
12
+ import {
13
+ stateDirectory
14
+ } from "./chunk-MPAJ446F.js";
15
+
16
+ // src/harness/accounts/goose-discovery.ts
17
+ import { readFile, stat } from "node:fs/promises";
18
+ import { homedir } from "node:os";
19
+ import { join } from "node:path";
20
+ var GOOSE_DRIVEN_HARNESSES = {
21
+ "claude-code": "claude",
22
+ "claude-acp": "claude",
23
+ codex: "codex",
24
+ "codex-acp": "codex",
25
+ "gemini-cli": "gemini",
26
+ "cursor-agent": "cursor",
27
+ "copilot-acp": "copilot",
28
+ "amp-acp": "amp",
29
+ "pi-acp": "pi"
30
+ };
31
+ function gooseProviders(status, ...catalogs) {
32
+ const names = /* @__PURE__ */ new Map();
33
+ for (const catalog of catalogs) {
34
+ for (const entry of catalog?.providers ?? []) {
35
+ const { providerId, name } = entry ?? {};
36
+ if (typeof providerId === "string" && typeof name === "string" && name) names.set(providerId, name);
37
+ }
38
+ }
39
+ const providers = [];
40
+ for (const entry of status?.statuses ?? []) {
41
+ const { providerId, isConfigured } = entry ?? {};
42
+ if (typeof providerId !== "string" || !providerId) continue;
43
+ providers.push({ id: providerId, label: names.get(providerId) ?? providerId, configured: isConfigured === true });
44
+ }
45
+ return providers;
46
+ }
47
+ var COMMON = ["anthropic", "openai", "chatgpt_codex", "github_copilot", "google", "gemini_oauth", "openrouter", "claude-acp", "codex-acp", "ollama"];
48
+ function gooseConnect(providers) {
49
+ const rank = (id) => {
50
+ const index = COMMON.indexOf(id);
51
+ return index < 0 ? COMMON.length : index;
52
+ };
53
+ return providers.filter((provider) => !provider.configured).map((provider) => ({
54
+ id: provider.id,
55
+ label: provider.label,
56
+ detail: "set up in goose configure",
57
+ argv: ["configure"]
58
+ })).sort((left, right) => rank(left.id) - rank(right.id) || left.label.localeCompare(right.label));
59
+ }
60
+ function gooseModelsDevModels(cacheJson, providerId) {
61
+ try {
62
+ const cache = JSON.parse(cacheJson);
63
+ return Object.keys(cache[providerId]?.models ?? {}).map((model) => `${providerId}/${model}`);
64
+ } catch {
65
+ return [];
66
+ }
67
+ }
68
+ function providerKeyNames(environment = process.env) {
69
+ return Object.keys(environment).filter((name) => /_API_KEY$/.test(name) && environment[name]?.trim()).sort();
70
+ }
71
+ function withoutEmptyKeys(binary, argv) {
72
+ const empty = Object.keys(process.env).filter((name) => /_API_KEY$/.test(name) && !process.env[name]?.trim());
73
+ if (!empty.length || process.platform === "win32") return { binary, argv: [...argv] };
74
+ return { binary: "env", argv: [...empty.flatMap((name) => ["-u", name]), binary, ...argv] };
75
+ }
76
+ async function discoverGooseProviders(harness, environment) {
77
+ const launch = withoutEmptyKeys(harness.binary, harness.acp?.argv ?? ["acp"]);
78
+ return queryAcp(launch.binary, launch.argv, environment, async (request) => {
79
+ const status = await request("_goose/unstable/providers/config/status");
80
+ const setup = await request("_goose/unstable/providers/setup/catalog/list").catch(quiet("harness/accounts/goose-discovery"));
81
+ const catalog = await request("_goose/unstable/providers/catalog/list").catch(quiet("harness/accounts/goose-discovery"));
82
+ return gooseProviders(status, setup, catalog);
83
+ }, void 0, { gate: harness });
84
+ }
85
+ function modelsDevFiles() {
86
+ const cacheRoot = process.env.XDG_CACHE_HOME?.trim() || join(homedir(), ".cache");
87
+ return [join(cacheRoot, "opencode", "models.json"), join(stateDirectory(), "models-dev.json")];
88
+ }
89
+ async function modelsDevCache() {
90
+ const [opencodeFile, own] = modelsDevFiles();
91
+ const opencode = await readFile(opencodeFile, "utf8").catch(() => "");
92
+ if (opencode) return opencode;
93
+ const kept = await stat(own).catch(quiet("harness/accounts/goose-discovery"));
94
+ if (kept && Date.now() - kept.mtimeMs < 24 * 60 * 6e4) return readFile(own, "utf8").catch(() => "");
95
+ try {
96
+ const response = await fetch("https://models.dev/api.json");
97
+ if (!response.ok) throw new Error(String(response.status));
98
+ const body = await response.text();
99
+ await atomicWriteFile(own, body).catch(quiet("harness/accounts/goose-discovery"));
100
+ return body;
101
+ } catch {
102
+ return kept ? readFile(own, "utf8").catch(() => "") : "";
103
+ }
104
+ }
105
+ function modelsDevProvider(cacheJson, providerId) {
106
+ try {
107
+ const provider = JSON.parse(cacheJson)[providerId];
108
+ const entries = Object.entries(provider?.models ?? {});
109
+ return {
110
+ models: entries.map(([id]) => id),
111
+ labels: Object.fromEntries(entries.filter(([, model]) => typeof model.name === "string").map(([id, model]) => [id, model.name]))
112
+ };
113
+ } catch {
114
+ return { models: [], labels: {} };
115
+ }
116
+ }
117
+
118
+ export {
119
+ GOOSE_DRIVEN_HARNESSES,
120
+ gooseProviders,
121
+ gooseConnect,
122
+ gooseModelsDevModels,
123
+ providerKeyNames,
124
+ discoverGooseProviders,
125
+ modelsDevFiles,
126
+ modelsDevCache,
127
+ modelsDevProvider
128
+ };