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.
- package/README.md +25 -14
- package/dist/chunk-23TDEBGZ.js +71 -0
- package/dist/chunk-25T3GVS7.js +425 -0
- package/dist/chunk-2BBELGHY.js +11 -0
- package/dist/chunk-2EOL5PZL.js +208 -0
- package/dist/chunk-2GAB36IE.js +26 -0
- package/dist/chunk-2OLS7V66.js +2440 -0
- package/dist/chunk-2QFO2URB.js +179 -0
- package/dist/chunk-2QWPQRSU.js +254 -0
- package/dist/chunk-2YPAPAR3.js +184 -0
- package/dist/chunk-2ZAG5372.js +33 -0
- package/dist/chunk-32IKAIZC.js +12507 -0
- package/dist/chunk-34AZEGYW.js +95 -0
- package/dist/chunk-34JQYQCA.js +175 -0
- package/dist/chunk-34ZISPAO.js +67 -0
- package/dist/chunk-3AAAARE6.js +46 -0
- package/dist/chunk-3AJ6Q3OY.js +510 -0
- package/dist/chunk-3B2CHX7M.js +884 -0
- package/dist/chunk-3BUFORRX.js +59 -0
- package/dist/chunk-3QLHYYFK.js +30 -0
- package/dist/chunk-3RXBMYKZ.js +140 -0
- package/dist/chunk-3TFNIJWS.js +52 -0
- package/dist/chunk-3W3IPDFP.js +119 -0
- package/dist/chunk-3WMS7SEE.js +417 -0
- package/dist/chunk-435ZNSZ3.js +23 -0
- package/dist/chunk-4AQ5NINV.js +39 -0
- package/dist/chunk-4GVEJ5FK.js +168 -0
- package/dist/chunk-4GXAO3UY.js +262 -0
- package/dist/chunk-4L2ZZM4Q.js +332 -0
- package/dist/chunk-4LPDG57B.js +17 -0
- package/dist/chunk-4NN3XQQT.js +223 -0
- package/dist/chunk-4QZEZME7.js +54 -0
- package/dist/chunk-4R6CSC3S.js +38 -0
- package/dist/chunk-4RHXTL3W.js +514 -0
- package/dist/chunk-4SJMPTVQ.js +18 -0
- package/dist/chunk-4VY7G6TX.js +114 -0
- package/dist/chunk-5642PBF7.js +124 -0
- package/dist/chunk-5B6TVO4A.js +33 -0
- package/dist/chunk-5BJLDUPL.js +62 -0
- package/dist/chunk-5HMFFJWU.js +19 -0
- package/dist/chunk-5IKLK33T.js +69 -0
- package/dist/chunk-5NQ5FFMX.js +44 -0
- package/dist/chunk-5QNNW5L6.js +176 -0
- package/dist/chunk-5SM5UAWN.js +239 -0
- package/dist/chunk-5WYJTA6O.js +74 -0
- package/dist/chunk-5ZSR2Y5T.js +227 -0
- package/dist/chunk-5ZWUM5GH.js +39 -0
- package/dist/chunk-64E7D4HY.js +364 -0
- package/dist/chunk-6CK466BC.js +99 -0
- package/dist/chunk-6ES45HHO.js +138 -0
- package/dist/chunk-6HYEZFGL.js +277 -0
- package/dist/chunk-6Y7HLXGW.js +29 -0
- package/dist/chunk-6YKK4FYR.js +258 -0
- package/dist/chunk-74WNMLMS.js +117 -0
- package/dist/chunk-7AULZ7OD.js +55 -0
- package/dist/chunk-7DOKGSUN.js +101 -0
- package/dist/chunk-7IH5LTIZ.js +195 -0
- package/dist/chunk-7ISTS5NS.js +21 -0
- package/dist/chunk-7NMUTGOW.js +527 -0
- package/dist/chunk-7PNHUZEL.js +153 -0
- package/dist/chunk-7TSQLONI.js +88 -0
- package/dist/chunk-AE7TOLD5.js +30 -0
- package/dist/chunk-AEMHSXKA.js +130 -0
- package/dist/chunk-AKRYTS2D.js +211 -0
- package/dist/chunk-AMNSE36L.js +59 -0
- package/dist/chunk-AZVD74ZV.js +23 -0
- package/dist/chunk-B35DVOTK.js +1981 -0
- package/dist/chunk-B4HNJRAH.js +626 -0
- package/dist/chunk-B5WYPPHS.js +13 -0
- package/dist/chunk-BBOVDXQM.js +59 -0
- package/dist/chunk-BD3ECZLK.js +62 -0
- package/dist/chunk-BDGSOT74.js +4578 -0
- package/dist/chunk-BF5VEOPK.js +31 -0
- package/dist/chunk-BFFRW4XH.js +47 -0
- package/dist/chunk-BFPC6PEW.js +208 -0
- package/dist/chunk-BGEMY2JJ.js +376 -0
- package/dist/chunk-BISGNHKD.js +35 -0
- package/dist/chunk-BMRAEBRY.js +21 -0
- package/dist/chunk-BNTXAZXW.js +127 -0
- package/dist/chunk-BOQBXGSN.js +75 -0
- package/dist/chunk-BTJDSTQP.js +213 -0
- package/dist/chunk-BUOPJQP5.js +218 -0
- package/dist/chunk-BXFJS65Q.js +52 -0
- package/dist/chunk-BXPQFSX5.js +59 -0
- package/dist/chunk-C57LIWNY.js +1269 -0
- package/dist/chunk-C6YVCCWR.js +74 -0
- package/dist/chunk-CAADDF6M.js +167 -0
- package/dist/chunk-CBANJFBO.js +69 -0
- package/dist/chunk-CERF3RIB.js +597 -0
- package/dist/chunk-COAS5ETR.js +46 -0
- package/dist/chunk-CQ7J6UQ7.js +78 -0
- package/dist/chunk-CRUVYGO2.js +26 -0
- package/dist/chunk-CVFVFRGN.js +58 -0
- package/dist/chunk-D2UK66HM.js +37 -0
- package/dist/chunk-D2W7SA4R.js +18 -0
- package/dist/chunk-DA44ZENT.js +501 -0
- package/dist/chunk-DAJ76TOC.js +99 -0
- package/dist/chunk-DCZ6CIUM.js +147 -0
- package/dist/chunk-DF35KMXM.js +1314 -0
- package/dist/chunk-DGASQT26.js +151 -0
- package/dist/chunk-DJT57C5P.js +55 -0
- package/dist/chunk-DKDPZTD3.js +44 -0
- package/dist/chunk-DQYVQ2N7.js +77 -0
- package/dist/chunk-DRTP2RTY.js +266 -0
- package/dist/chunk-DW2BMUKY.js +61 -0
- package/dist/chunk-DW5T5ZVU.js +307 -0
- package/dist/chunk-DXKNDNFC.js +164 -0
- package/dist/chunk-DZEQ7UYR.js +291 -0
- package/dist/chunk-E4F4OUAC.js +463 -0
- package/dist/chunk-EE4B6A7W.js +69 -0
- package/dist/chunk-EISKIYWG.js +23 -0
- package/dist/chunk-EKAQK7UQ.js +235 -0
- package/dist/chunk-EOBTJV32.js +123 -0
- package/dist/chunk-ESF3DIZY.js +325 -0
- package/dist/chunk-EVOHOZ4U.js +45 -0
- package/dist/chunk-EXN4KHLB.js +110 -0
- package/dist/chunk-F252T6Y3.js +78 -0
- package/dist/chunk-F3DP4ZA2.js +40 -0
- package/dist/chunk-F6F47QAY.js +58 -0
- package/dist/chunk-FA3Y23ZW.js +57 -0
- package/dist/chunk-FBKXE4EJ.js +640 -0
- package/dist/chunk-FCGEB3H6.js +23 -0
- package/dist/chunk-FF7ZVYJF.js +3732 -0
- package/dist/chunk-FFGKN6L3.js +39 -0
- package/dist/chunk-FFGU4GCC.js +94 -0
- package/dist/chunk-FSFDAOVP.js +74 -0
- package/dist/chunk-FT5TX7OX.js +1573 -0
- package/dist/chunk-G3QP67Z7.js +232 -0
- package/dist/chunk-G5ORJKV2.js +179 -0
- package/dist/chunk-GFNC62PE.js +111 -0
- package/dist/chunk-GGK43Q3N.js +67 -0
- package/dist/chunk-GGYKY4GF.js +11537 -0
- package/dist/chunk-GGYNHGNJ.js +55 -0
- package/dist/chunk-GLY7RM3C.js +354 -0
- package/dist/chunk-GQBZU6EO.js +20 -0
- package/dist/chunk-GSXENUZL.js +9 -0
- package/dist/chunk-GTOAT5D3.js +40 -0
- package/dist/chunk-GWCMDPQU.js +1007 -0
- package/dist/chunk-GXYSMYHJ.js +152 -0
- package/dist/chunk-GYMAI5NY.js +14 -0
- package/dist/chunk-H2VZMKPE.js +30 -0
- package/dist/chunk-H4THUNBM.js +2091 -0
- package/dist/chunk-HGRVSNUZ.js +361 -0
- package/dist/chunk-HI4VY473.js +27 -0
- package/dist/chunk-HOJRSD3Q.js +447 -0
- package/dist/chunk-HRX25W35.js +82 -0
- package/dist/chunk-HSE4AQYV.js +55 -0
- package/dist/chunk-HU5SSUFX.js +383 -0
- package/dist/chunk-I3GDBJLH.js +196 -0
- package/dist/chunk-I75EDU75.js +684 -0
- package/dist/chunk-IBA7DMIO.js +20 -0
- package/dist/chunk-IC6N4NZA.js +231 -0
- package/dist/chunk-IF43HIGV.js +284 -0
- package/dist/chunk-IGZ6C2MC.js +439 -0
- package/dist/chunk-IMLTL2MY.js +192 -0
- package/dist/chunk-IMZL6SGR.js +33 -0
- package/dist/chunk-IS4USJPY.js +516 -0
- package/dist/chunk-ISFSPN2F.js +82 -0
- package/dist/chunk-IXE7GTFI.js +55 -0
- package/dist/chunk-IZ77QJQG.js +36 -0
- package/dist/chunk-J2PACWRQ.js +34 -0
- package/dist/chunk-J6EGFVQX.js +180 -0
- package/dist/chunk-JEKOD43D.js +22 -0
- package/dist/chunk-JGIWATSG.js +30 -0
- package/dist/chunk-JYBONKD4.js +43 -0
- package/dist/chunk-K2NLG2HK.js +454 -0
- package/dist/chunk-KCQ4TBLS.js +164 -0
- package/dist/chunk-KD5KIVMS.js +176 -0
- package/dist/chunk-KHW6TX6I.js +63 -0
- package/dist/chunk-KI5GZFCE.js +520 -0
- package/dist/chunk-KN34B7NO.js +105 -0
- package/dist/chunk-KYUHIFP3.js +136 -0
- package/dist/chunk-KZL5VS4B.js +300 -0
- package/dist/chunk-L3VW3QIH.js +48 -0
- package/dist/chunk-LA6MG4ET.js +2110 -0
- package/dist/chunk-LAVFOA3S.js +66 -0
- package/dist/chunk-LB4OA77N.js +13 -0
- package/dist/chunk-LBFRF2K4.js +196 -0
- package/dist/chunk-LM6EIA4B.js +93 -0
- package/dist/chunk-LPCNRGJ7.js +692 -0
- package/dist/chunk-LSLNL5T3.js +168 -0
- package/dist/chunk-LVRRWP4W.js +568 -0
- package/dist/chunk-LWCFBRHL.js +33 -0
- package/dist/chunk-LXFTMGZZ.js +166 -0
- package/dist/chunk-M33LVA4M.js +151 -0
- package/dist/chunk-M3FO5UMK.js +4944 -0
- package/dist/chunk-M5QNDBAY.js +66 -0
- package/dist/chunk-M6ND6KBE.js +1291 -0
- package/dist/chunk-M7H3WQTE.js +76 -0
- package/dist/chunk-MCBRVPA7.js +191 -0
- package/dist/chunk-MCSDWZET.js +91 -0
- package/dist/chunk-MDT5XDXL.js +289 -0
- package/dist/chunk-MJG3IQY4.js +91 -0
- package/dist/chunk-MOU3N2UL.js +44 -0
- package/dist/chunk-MP4KZOQC.js +3451 -0
- package/dist/chunk-MPAJ446F.js +66 -0
- package/dist/chunk-MVJZZ6AL.js +16 -0
- package/dist/chunk-MXS6S2PY.js +253 -0
- package/dist/chunk-N3SFDYM7.js +291 -0
- package/dist/chunk-NAOX3JUB.js +13 -0
- package/dist/chunk-NEKKIBCX.js +283 -0
- package/dist/chunk-NKDATMEM.js +133 -0
- package/dist/chunk-NR4FMC4K.js +395 -0
- package/dist/chunk-NSOHOJBR.js +221 -0
- package/dist/chunk-NTDB6QKF.js +29 -0
- package/dist/chunk-NWEYRBWK.js +25 -0
- package/dist/chunk-O2YSNYWD.js +23 -0
- package/dist/chunk-O3EW7LAY.js +54 -0
- package/dist/chunk-O7BNJIXU.js +366 -0
- package/dist/chunk-OARL2NXZ.js +116 -0
- package/dist/chunk-OHKZUEJW.js +351 -0
- package/dist/chunk-OKU45BXA.js +647 -0
- package/dist/chunk-OL4JBD3J.js +59 -0
- package/dist/chunk-OLUO5DDR.js +192 -0
- package/dist/chunk-OQ245JLA.js +196 -0
- package/dist/chunk-P72UZAQI.js +289 -0
- package/dist/chunk-PAL2ENB6.js +20 -0
- package/dist/chunk-PAXYQZH7.js +53 -0
- package/dist/chunk-PDPEM5VW.js +51 -0
- package/dist/chunk-PEWCDI2C.js +668 -0
- package/dist/chunk-PGZ54EDX.js +27 -0
- package/dist/chunk-PRWVLDZF.js +73 -0
- package/dist/chunk-PSQQ75VJ.js +52 -0
- package/dist/chunk-PUOVIFHW.js +118 -0
- package/dist/chunk-PWBF2X3V.js +107 -0
- package/dist/chunk-PWXII6HF.js +43 -0
- package/dist/chunk-Q35VLJRT.js +80 -0
- package/dist/chunk-QJP7EYGL.js +128 -0
- package/dist/chunk-QPQKX2MK.js +8836 -0
- package/dist/chunk-QQRLPY25.js +1053 -0
- package/dist/chunk-QUS4ER2W.js +407 -0
- package/dist/chunk-QYHI3YET.js +29 -0
- package/dist/chunk-QYRU2UQI.js +32 -0
- package/dist/chunk-R6XVVQGC.js +13 -0
- package/dist/chunk-R7QN6ONS.js +483 -0
- package/dist/chunk-RD23MPGC.js +221 -0
- package/dist/chunk-RDDWQBEM.js +185 -0
- package/dist/chunk-RDLLDYFO.js +104 -0
- package/dist/chunk-RE4TGORR.js +84 -0
- package/dist/chunk-RJLHVYQY.js +217 -0
- package/dist/chunk-RJLPTWHW.js +905 -0
- package/dist/chunk-RKUVLRZI.js +295 -0
- package/dist/chunk-ROGXPGYR.js +37 -0
- package/dist/chunk-RSZGEL5U.js +163 -0
- package/dist/chunk-RVUOIJXN.js +909 -0
- package/dist/chunk-RW7F4JRP.js +11 -0
- package/dist/chunk-S4UO3AO3.js +53 -0
- package/dist/chunk-S5JAAF6S.js +585 -0
- package/dist/chunk-SNU37TQI.js +56 -0
- package/dist/chunk-SQVUDO2O.js +31 -0
- package/dist/chunk-SYVHIYQT.js +66 -0
- package/dist/chunk-SZBQMTG2.js +85 -0
- package/dist/chunk-T5VCXA3J.js +25 -0
- package/dist/chunk-TK6NSP56.js +30 -0
- package/dist/chunk-TKWVMA6L.js +22 -0
- package/dist/chunk-TQDKJHWX.js +59 -0
- package/dist/chunk-TQDM7S5N.js +127 -0
- package/dist/chunk-TULAXS77.js +23 -0
- package/dist/chunk-TVT45XNH.js +4625 -0
- package/dist/chunk-TWCVV2JO.js +467 -0
- package/dist/chunk-U4DKAD6S.js +47 -0
- package/dist/chunk-UA5K2BTI.js +564 -0
- package/dist/chunk-UAMKCMOK.js +40 -0
- package/dist/chunk-UBMVADBF.js +51 -0
- package/dist/chunk-UFQ5A5PW.js +645 -0
- package/dist/chunk-UOD2SOLL.js +1301 -0
- package/dist/chunk-UTSB4LOW.js +156 -0
- package/dist/chunk-UVXNIUTN.js +412 -0
- package/dist/chunk-UXVPXYPE.js +90 -0
- package/dist/chunk-UYEEMIWR.js +374 -0
- package/dist/chunk-VBGM5ZBW.js +54 -0
- package/dist/chunk-VEWPCZPG.js +762 -0
- package/dist/chunk-VIRDLZ5E.js +108 -0
- package/dist/chunk-VMPO7WKN.js +52 -0
- package/dist/chunk-W2NVSDO5.js +5122 -0
- package/dist/chunk-W3YYPBEA.js +176 -0
- package/dist/chunk-W5AYOICN.js +280 -0
- package/dist/chunk-W5GZOIUF.js +27 -0
- package/dist/chunk-WHKNLZ3C.js +76 -0
- package/dist/chunk-WKBEPPQ5.js +1409 -0
- package/dist/chunk-WM3Z6QKQ.js +151 -0
- package/dist/chunk-WMI2TPMA.js +31 -0
- package/dist/chunk-WNX5VD7S.js +150 -0
- package/dist/chunk-WOVTYST3.js +60 -0
- package/dist/chunk-WPB5WEZJ.js +546 -0
- package/dist/chunk-WUO5EOAT.js +44 -0
- package/dist/chunk-WWLJMP6D.js +133 -0
- package/dist/chunk-WZMLH3XP.js +58 -0
- package/dist/chunk-WZYVLUVQ.js +79 -0
- package/dist/chunk-X2OCPVU5.js +135 -0
- package/dist/chunk-X3CL6DTR.js +95 -0
- package/dist/chunk-X6WF7JEV.js +354 -0
- package/dist/chunk-XAHGBPWT.js +44 -0
- package/dist/chunk-XCKQ5BM2.js +228 -0
- package/dist/chunk-XIBYREEY.js +106 -0
- package/dist/chunk-XKW5NDMR.js +378 -0
- package/dist/chunk-XRDALAO3.js +100 -0
- package/dist/chunk-XUP22EAS.js +41 -0
- package/dist/chunk-XWAC3MKW.js +243 -0
- package/dist/chunk-Y3R7JMXB.js +59 -0
- package/dist/chunk-Y54LTP4W.js +82 -0
- package/dist/chunk-Y7UECI4M.js +99 -0
- package/dist/chunk-YACGDFHC.js +47 -0
- package/dist/chunk-YHNIQPKY.js +71 -0
- package/dist/chunk-YMBR6HYP.js +111 -0
- package/dist/chunk-YMCH3L2S.js +26 -0
- package/dist/chunk-Z4ZU6T7V.js +99 -0
- package/dist/chunk-ZDPF67ZZ.js +173 -0
- package/dist/chunk-ZFC2Q67K.js +101 -0
- package/dist/chunk-ZGHNNSCT.js +114 -0
- package/dist/chunk-ZGX3ERAT.js +173 -0
- package/dist/chunk-ZI3YHEBY.js +37 -0
- package/dist/chunk-ZN7G6JLS.js +639 -0
- package/dist/chunk-ZNPFQMXT.js +47 -0
- package/dist/chunk-ZOU3LV4U.js +63 -0
- package/dist/chunk-ZT7B4H2V.js +117 -0
- package/dist/chunk-ZZCBDNZI.js +58 -0
- package/dist/cli.js +498 -112593
- package/dist/computer-tools.js +36642 -21258
- package/dist/harness-catalog.cjs +88 -43
- package/dist/index.js +1 -1
- package/dist/local-model-supervisor.cjs +555 -0
- package/package.json +3 -4
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
WAYLAND_DRIVER_VERSION,
|
|
5
|
+
driverHome,
|
|
6
|
+
driverVersionNotice,
|
|
7
|
+
findDriverBinary,
|
|
8
|
+
waylandSession
|
|
9
|
+
} from "./chunk-OHKZUEJW.js";
|
|
10
|
+
import "./chunk-74WNMLMS.js";
|
|
11
|
+
import "./chunk-GLY7RM3C.js";
|
|
12
|
+
import "./chunk-UA5K2BTI.js";
|
|
13
|
+
import "./chunk-DQYVQ2N7.js";
|
|
14
|
+
import {
|
|
15
|
+
installerEnv
|
|
16
|
+
} from "./chunk-OL4JBD3J.js";
|
|
17
|
+
import "./chunk-IGZ6C2MC.js";
|
|
18
|
+
import "./chunk-4NN3XQQT.js";
|
|
19
|
+
import "./chunk-WPB5WEZJ.js";
|
|
20
|
+
import "./chunk-GYMAI5NY.js";
|
|
21
|
+
import "./chunk-XIBYREEY.js";
|
|
22
|
+
import "./chunk-MCBRVPA7.js";
|
|
23
|
+
import {
|
|
24
|
+
sleep
|
|
25
|
+
} from "./chunk-YMCH3L2S.js";
|
|
26
|
+
import {
|
|
27
|
+
emitResult
|
|
28
|
+
} from "./chunk-JGIWATSG.js";
|
|
29
|
+
import {
|
|
30
|
+
isJsonDefaultMode
|
|
31
|
+
} from "./chunk-5B6TVO4A.js";
|
|
32
|
+
import "./chunk-NAOX3JUB.js";
|
|
33
|
+
import "./chunk-F6F47QAY.js";
|
|
34
|
+
import {
|
|
35
|
+
quiet
|
|
36
|
+
} from "./chunk-RDDWQBEM.js";
|
|
37
|
+
import "./chunk-MPAJ446F.js";
|
|
38
|
+
import "./chunk-CBANJFBO.js";
|
|
39
|
+
import "./chunk-PWXII6HF.js";
|
|
40
|
+
|
|
41
|
+
// src/commands/computer-driver.ts
|
|
42
|
+
import { execFile } from "node:child_process";
|
|
43
|
+
import { join as join2 } from "node:path";
|
|
44
|
+
|
|
45
|
+
// src/agent/computer/driver-install.ts
|
|
46
|
+
import { createHash } from "node:crypto";
|
|
47
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
48
|
+
import { chmod, lstat, mkdir, mkdtemp, readdir, readFile, readlink, realpath, rename, rmdir, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
49
|
+
import { homedir } from "node:os";
|
|
50
|
+
import { basename, dirname, join } from "node:path";
|
|
51
|
+
import { Readable } from "node:stream";
|
|
52
|
+
import { pipeline } from "node:stream/promises";
|
|
53
|
+
var DRIVER_REPO = "trycua/cua";
|
|
54
|
+
var TAG_PREFIX = "cua-driver-rs-v";
|
|
55
|
+
var WITHDRAWN = /* @__PURE__ */ new Set(["0.28.3"]);
|
|
56
|
+
var CHECKSUMS_REQUIRED_FROM = "0.31.0";
|
|
57
|
+
var COSIGN_ISSUER = "https://token.actions.githubusercontent.com";
|
|
58
|
+
var KEEP_RELEASES = 3;
|
|
59
|
+
var BAKED_SOURCE = `https://raw.githubusercontent.com/${DRIVER_REPO}/main/libs/cua-driver/scripts/_install-rust.sh`;
|
|
60
|
+
var OFFICIAL_INSTALLER = "https://cua.ai/driver/install.sh";
|
|
61
|
+
function driverTarget(platform = process.platform, arch = process.arch) {
|
|
62
|
+
const x64 = arch === "x64", arm = arch === "arm64";
|
|
63
|
+
if (platform === "linux" && (x64 || arm)) return { platform, label: x64 ? "linux-x86_64" : "linux-arm64", triple: x64 ? "x86_64-unknown-linux-gnu" : "aarch64-unknown-linux-gnu", binary: "cua-driver", ext: "tar.gz" };
|
|
64
|
+
if (platform === "win32" && (x64 || arm)) return { platform, label: x64 ? "windows-x86_64" : "windows-arm64", triple: x64 ? "x86_64-pc-windows-msvc" : "aarch64-pc-windows-msvc", binary: "cua-driver.exe", ext: "zip" };
|
|
65
|
+
if (platform === "darwin" && (x64 || arm)) return { platform, label: x64 ? "darwin-x86_64" : "darwin-arm64", triple: x64 ? "x86_64-apple-darwin" : "aarch64-apple-darwin", binary: "cua-driver", ext: "tar.gz" };
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
function assetName(version, target) {
|
|
69
|
+
return target.platform === "linux" ? `cua-driver-rs-${version}-${target.label}-binary.tar.gz` : `cua-driver-rs-${version}-${target.label}.${target.ext}`;
|
|
70
|
+
}
|
|
71
|
+
var releaseTag = (version) => `${TAG_PREFIX}${version}`;
|
|
72
|
+
var releaseUrl = (version, name) => `https://github.com/${DRIVER_REPO}/releases/download/${releaseTag(version)}/${name}`;
|
|
73
|
+
var releaseDirName = (version, target) => `${version}-${target.triple}`;
|
|
74
|
+
var VERSION = /^\d+\.\d+\.\d+$/;
|
|
75
|
+
function compareVersions(a, b) {
|
|
76
|
+
const x = a.split(".").map(Number), y = b.split(".").map(Number);
|
|
77
|
+
for (let i = 0; i < 3; i++) if ((x[i] ?? 0) !== (y[i] ?? 0)) return (x[i] ?? 0) - (y[i] ?? 0);
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
var versionOf = (output) => output.match(/(\d+\.\d+\.\d+)/)?.[1];
|
|
81
|
+
function parseChecksums(text) {
|
|
82
|
+
const sums = /* @__PURE__ */ new Map();
|
|
83
|
+
for (const line of text.split("\n")) {
|
|
84
|
+
const match = line.trim().match(/^([0-9a-f]{64})\s+\*?(\S+)$/i);
|
|
85
|
+
if (match) sums.set(match[2], match[1].toLowerCase());
|
|
86
|
+
}
|
|
87
|
+
return sums;
|
|
88
|
+
}
|
|
89
|
+
async function defaultDeps(log) {
|
|
90
|
+
const { execFile: execFile2, spawn } = await import("node:child_process");
|
|
91
|
+
return {
|
|
92
|
+
fetch,
|
|
93
|
+
log,
|
|
94
|
+
platform: process.platform,
|
|
95
|
+
arch: process.arch,
|
|
96
|
+
env: process.env,
|
|
97
|
+
home: driverHome(),
|
|
98
|
+
binDir: join(homedir(), ".local", "bin"),
|
|
99
|
+
run: (command, args, options) => new Promise((resolve) => execFile2(command, args, { timeout: options?.timeoutMs ?? 12e4, maxBuffer: 16 * 1024 * 1024, env: options?.env ?? process.env }, (error, stdout, stderr) => {
|
|
100
|
+
const code = error ? typeof error.code === "number" ? error.code : 1 : 0;
|
|
101
|
+
resolve({ code, stdout: String(stdout), stderr: String(stderr) + (error && code === 1 && !stderr ? error.message : "") });
|
|
102
|
+
})),
|
|
103
|
+
runVisible: (command, args, env) => new Promise((resolve) => {
|
|
104
|
+
const child = spawn(command, args, { stdio: "inherit", env });
|
|
105
|
+
child.once("error", () => resolve(1));
|
|
106
|
+
child.once("exit", (code) => resolve(code ?? 1));
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async function fetchRetry(deps, url, init) {
|
|
111
|
+
let last;
|
|
112
|
+
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
113
|
+
try {
|
|
114
|
+
const response = await deps.fetch(url, { redirect: "follow", ...init });
|
|
115
|
+
if (response.status === 404 || response.ok) return response;
|
|
116
|
+
if (![408, 429].includes(response.status) && response.status < 500) return response;
|
|
117
|
+
last = new Error(`HTTP ${response.status}`);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
last = error;
|
|
120
|
+
}
|
|
121
|
+
if (attempt < 3) await sleep(attempt * 500);
|
|
122
|
+
}
|
|
123
|
+
throw new Error(`Could not reach ${new URL(url).host}: ${last instanceof Error ? last.message : String(last)}`);
|
|
124
|
+
}
|
|
125
|
+
async function exists(url, deps) {
|
|
126
|
+
try {
|
|
127
|
+
return (await deps.fetch(url, { method: "HEAD", redirect: "follow" })).ok;
|
|
128
|
+
} catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function latestDriverVersion(deps, target) {
|
|
133
|
+
const fromGh = await deps.run("gh", ["release", "list", "-R", DRIVER_REPO, "--limit", "400", "--exclude-drafts", "--json", "tagName", "--jq", ".[].tagName"], { timeoutMs: 3e4 });
|
|
134
|
+
if (fromGh.code === 0) {
|
|
135
|
+
const versions = fromGh.stdout.split("\n").map((tag) => tag.trim()).filter((tag) => tag.startsWith(TAG_PREFIX)).map((tag) => tag.slice(TAG_PREFIX.length)).filter((version) => VERSION.test(version) && !WITHDRAWN.has(version));
|
|
136
|
+
const newest = versions.sort(compareVersions).at(-1);
|
|
137
|
+
if (newest) return { version: newest, source: "gh release list" };
|
|
138
|
+
}
|
|
139
|
+
const page = await fetchRetry(deps, BAKED_SOURCE);
|
|
140
|
+
const baked = page.ok ? (await page.text()).match(/CUA_DRIVER_RS_BAKED_VERSION="(\d+\.\d+\.\d+)"/)?.[1] : void 0;
|
|
141
|
+
if (!baked) throw new Error("Could not find the latest cua-driver version (GitHub did not answer). Name one: clikcode computer driver install --version 0.38.0");
|
|
142
|
+
const [major, minor] = baked.split(".").map(Number);
|
|
143
|
+
const candidates = [];
|
|
144
|
+
for (let m = minor; m <= minor + 3; m++) for (let p = 0; p <= 4; p++) candidates.push(`${major}.${m}.${p}`);
|
|
145
|
+
const ahead = candidates.filter((version) => compareVersions(version, baked) > 0 && !WITHDRAWN.has(version));
|
|
146
|
+
const published = (await Promise.all(ahead.map(async (version) => await exists(releaseUrl(version, assetName(version, target)), deps) ? version : void 0))).filter((version) => Boolean(version));
|
|
147
|
+
return { version: [baked, ...published].sort(compareVersions).at(-1), source: "the published installer" };
|
|
148
|
+
}
|
|
149
|
+
var packagesDir = (deps) => join(deps.home, "packages");
|
|
150
|
+
async function linkTarget(path) {
|
|
151
|
+
try {
|
|
152
|
+
return basename((await readlink(path)).replace(/[\\/]+$/, ""));
|
|
153
|
+
} catch {
|
|
154
|
+
return void 0;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function installedReleases(deps, target) {
|
|
158
|
+
const releases = join(packagesDir(deps), "releases");
|
|
159
|
+
const names = await readdir(releases).catch(() => []);
|
|
160
|
+
const suffix = `-${target.triple}`;
|
|
161
|
+
const versions = names.filter((name) => name.endsWith(suffix) && VERSION.test(name.slice(0, -suffix.length))).map((name) => ({ version: name.slice(0, -suffix.length), dir: join(releases, name) })).sort((a, b) => compareVersions(b.version, a.version));
|
|
162
|
+
const current = await linkTarget(join(packagesDir(deps), "current"));
|
|
163
|
+
const previous = (await readFile(join(packagesDir(deps), "clikcode-previous"), "utf8").catch(() => "")).trim() || void 0;
|
|
164
|
+
return { versions, ...current ? { current } : {}, ...previous ? { previous } : {} };
|
|
165
|
+
}
|
|
166
|
+
async function sha256(path) {
|
|
167
|
+
const hash = createHash("sha256");
|
|
168
|
+
await pipeline(createReadStream(path), async (source) => {
|
|
169
|
+
for await (const chunk of source) hash.update(chunk);
|
|
170
|
+
});
|
|
171
|
+
return hash.digest("hex");
|
|
172
|
+
}
|
|
173
|
+
async function download(deps, url, to) {
|
|
174
|
+
const response = await fetchRetry(deps, url);
|
|
175
|
+
if (response.status === 404) throw new Error(`Not found: ${url}`);
|
|
176
|
+
if (!response.ok || !response.body) throw new Error(`Download failed (HTTP ${response.status}): ${url}`);
|
|
177
|
+
await pipeline(Readable.fromWeb(response.body), createWriteStream(to));
|
|
178
|
+
}
|
|
179
|
+
async function verifyArchive(deps, version, name, archive, work) {
|
|
180
|
+
let sums;
|
|
181
|
+
for (const file of ["SHA256SUMS", "checksums.txt"]) {
|
|
182
|
+
const response2 = await fetchRetry(deps, releaseUrl(version, file));
|
|
183
|
+
if (response2.ok) {
|
|
184
|
+
sums = parseChecksums(await response2.text());
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const required = compareVersions(version, CHECKSUMS_REQUIRED_FROM) >= 0;
|
|
189
|
+
const expected = sums?.get(name);
|
|
190
|
+
if (!expected) {
|
|
191
|
+
if (required || sums) throw new Error(`Release ${version} does not list a checksum for ${name}; refusing to install it.`);
|
|
192
|
+
throw new Error(`Release ${version} publishes no checksums; refusing to install it unverified. Choose ${CHECKSUMS_REQUIRED_FROM} or newer.`);
|
|
193
|
+
}
|
|
194
|
+
const actual = await sha256(archive);
|
|
195
|
+
if (actual !== expected) throw new Error(`${name} does not match the release's checksum (expected ${expected}, got ${actual}); refusing to install it.`);
|
|
196
|
+
deps.log(`verified ${name} against the release checksums`);
|
|
197
|
+
const bundle = join(work, `${name}.sigstore.json`);
|
|
198
|
+
const response = await fetchRetry(deps, releaseUrl(version, `${name}.sigstore.json`));
|
|
199
|
+
if (!response.ok) {
|
|
200
|
+
deps.log("no Sigstore signature published for this archive; checksum only");
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
await writeFile(bundle, Buffer.from(await response.arrayBuffer()));
|
|
204
|
+
const cosign = await deps.run("cosign", ["version"], { timeoutMs: 1e4 });
|
|
205
|
+
if (cosign.code !== 0) {
|
|
206
|
+
deps.log("cosign is not installed, so the Sigstore signature was not checked (the checksum was); install cosign to verify signatures");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const verified = await deps.run("cosign", ["verify-blob", "--bundle", bundle, "--certificate-identity", `https://github.com/${DRIVER_REPO}/.github/workflows/cd-rust-cua-driver.yml@refs/tags/${releaseTag(version)}`, "--certificate-oidc-issuer", COSIGN_ISSUER, archive], { timeoutMs: 6e4 });
|
|
210
|
+
if (verified.code !== 0) throw new Error(`The Sigstore signature of ${name} did not verify for ${releaseTag(version)}; refusing to install it.`);
|
|
211
|
+
deps.log(`verified the Sigstore signature of ${name}`);
|
|
212
|
+
}
|
|
213
|
+
async function pointCurrent(deps, dirName) {
|
|
214
|
+
const packages = packagesDir(deps);
|
|
215
|
+
const current = join(packages, "current");
|
|
216
|
+
const fresh = join(packages, `.current.${process.pid}`);
|
|
217
|
+
await rm(fresh, { recursive: true, force: true });
|
|
218
|
+
if (deps.platform === "win32") {
|
|
219
|
+
await symlink(join(packages, "releases", dirName), fresh, "junction");
|
|
220
|
+
if (await lstat(current).then(() => true, () => false)) await unlink(current).catch(() => rmdir(current));
|
|
221
|
+
await rename(fresh, current);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
await symlink(join("releases", dirName), fresh);
|
|
225
|
+
await rename(fresh, current);
|
|
226
|
+
}
|
|
227
|
+
async function linkVisible(deps, target) {
|
|
228
|
+
if (deps.platform === "win32") return void 0;
|
|
229
|
+
const link = join(deps.binDir, target.binary);
|
|
230
|
+
const via = join(packagesDir(deps), "current", target.binary);
|
|
231
|
+
const existing = await lstat(link).catch(quiet("agent/computer/driver-install"));
|
|
232
|
+
if (existing && !existing.isSymbolicLink()) return `${link} is a real file, so it was left alone; ClikCode uses ${via}`;
|
|
233
|
+
await mkdir(deps.binDir, { recursive: true });
|
|
234
|
+
await rm(link, { force: true });
|
|
235
|
+
await symlink(via, link);
|
|
236
|
+
return void 0;
|
|
237
|
+
}
|
|
238
|
+
async function prune(deps, target, keep) {
|
|
239
|
+
const { versions } = await installedReleases(deps, target);
|
|
240
|
+
const survivors = /* @__PURE__ */ new Set([...keep, ...versions.slice(0, KEEP_RELEASES).map((entry) => basename(entry.dir))]);
|
|
241
|
+
for (const entry of versions) if (!survivors.has(basename(entry.dir))) await rm(entry.dir, { recursive: true, force: true });
|
|
242
|
+
}
|
|
243
|
+
async function runningVersion(deps, binary) {
|
|
244
|
+
const result = await deps.run(binary, ["--version"], { timeoutMs: 15e3 });
|
|
245
|
+
return result.code === 0 ? versionOf(result.stdout) : void 0;
|
|
246
|
+
}
|
|
247
|
+
async function installViaOfficialScript(deps, version) {
|
|
248
|
+
const response = await fetchRetry(deps, OFFICIAL_INSTALLER);
|
|
249
|
+
if (!response.ok) throw new Error(`Could not download Cua's installer from ${OFFICIAL_INSTALLER} (HTTP ${response.status}).`);
|
|
250
|
+
const script = await response.text();
|
|
251
|
+
deps.log(`running Cua's macOS installer, pinned to ${version}`);
|
|
252
|
+
const code = await deps.runVisible("/bin/bash", ["-c", script, "cua-driver-install"], installerEnv(deps.env, { CUA_DRIVER_RS_VERSION: version }));
|
|
253
|
+
if (code !== 0) throw new Error(`Cua's installer exited with ${code}.`);
|
|
254
|
+
return { action: "delegated", version, notes: ["Accessibility and Screen Recording must be granted once: run `cua-driver permissions grant`."] };
|
|
255
|
+
}
|
|
256
|
+
async function installDriver(deps, options = {}) {
|
|
257
|
+
const target = driverTarget(deps.platform, deps.arch);
|
|
258
|
+
if (!target) throw new Error(`Cua ships no cua-driver for ${deps.platform} ${deps.arch}.`);
|
|
259
|
+
let version = options.version?.replace(/^(cua-driver-rs-)?v/, "");
|
|
260
|
+
if (version !== void 0 && !VERSION.test(version)) throw new Error("A version looks like 0.38.0.");
|
|
261
|
+
if (version && WITHDRAWN.has(version)) throw new Error(`Cua withdrew ${version}; choose another.`);
|
|
262
|
+
if (!version) {
|
|
263
|
+
const found = await latestDriverVersion(deps, target);
|
|
264
|
+
version = found.version;
|
|
265
|
+
deps.log(`latest cua-driver is ${version} (from ${found.source})`);
|
|
266
|
+
}
|
|
267
|
+
const binary = findDriverBinary(deps.env, deps.platform);
|
|
268
|
+
const installed = binary ? await runningVersion(deps, binary) : void 0;
|
|
269
|
+
if (installed && !options.force) {
|
|
270
|
+
if (installed === version) return { action: "up-to-date", version, notes: [] };
|
|
271
|
+
if (!options.version && compareVersions(installed, version) > 0) return { action: "newer-installed", version: installed, notes: [`Installed ${installed} is newer than the newest release found (${version}); nothing to do.`] };
|
|
272
|
+
}
|
|
273
|
+
if (target.platform === "darwin") return installViaOfficialScript(deps, version);
|
|
274
|
+
const packages = packagesDir(deps);
|
|
275
|
+
const releases = join(packages, "releases");
|
|
276
|
+
const dirName = releaseDirName(version, target);
|
|
277
|
+
const finalDir = join(releases, dirName);
|
|
278
|
+
await mkdir(releases, { recursive: true });
|
|
279
|
+
const notes = [];
|
|
280
|
+
const before = await installedReleases(deps, target);
|
|
281
|
+
if (!await stat(join(finalDir, target.binary)).then(() => true, () => false) || options.force) {
|
|
282
|
+
const name = assetName(version, target);
|
|
283
|
+
const work = await mkdtemp(join(packages, ".install-"));
|
|
284
|
+
try {
|
|
285
|
+
const archive = join(work, name);
|
|
286
|
+
deps.log(`downloading ${releaseUrl(version, name)}`);
|
|
287
|
+
await download(deps, releaseUrl(version, name), archive);
|
|
288
|
+
await verifyArchive(deps, version, name, archive, work);
|
|
289
|
+
const unpacked = join(work, "unpacked");
|
|
290
|
+
await mkdir(unpacked);
|
|
291
|
+
const extract = await deps.run("tar", ["-xf", archive, "-C", unpacked], { timeoutMs: 12e4 });
|
|
292
|
+
if (extract.code !== 0) throw new Error(`Could not unpack ${name}: ${extract.stderr.trim().slice(0, 300)}`);
|
|
293
|
+
const root = await stat(join(unpacked, target.binary)).then(() => true, () => false) ? unpacked : (await Promise.all((await readdir(unpacked)).map(async (entry) => await stat(join(unpacked, entry, target.binary)).then(() => true, () => false) ? join(unpacked, entry) : void 0))).find(Boolean);
|
|
294
|
+
if (!root) throw new Error(`${name} does not contain ${target.binary}.`);
|
|
295
|
+
if (target.platform !== "win32") await chmod(join(root, target.binary), 493);
|
|
296
|
+
await rm(finalDir, { recursive: true, force: true });
|
|
297
|
+
await rename(root, finalDir);
|
|
298
|
+
} finally {
|
|
299
|
+
await rm(work, { recursive: true, force: true });
|
|
300
|
+
}
|
|
301
|
+
const running = await runningVersion(deps, join(finalDir, target.binary));
|
|
302
|
+
if (running !== version) {
|
|
303
|
+
await rm(finalDir, { recursive: true, force: true });
|
|
304
|
+
throw new Error(`The downloaded cua-driver did not run as ${version} (it said ${running ?? "nothing"}); the install was not changed.`);
|
|
305
|
+
}
|
|
306
|
+
} else deps.log(`${dirName} is already unpacked`);
|
|
307
|
+
if (before.current && before.current !== dirName) await writeFile(join(packages, "clikcode-previous"), `${before.current}
|
|
308
|
+
`);
|
|
309
|
+
await pointCurrent(deps, dirName);
|
|
310
|
+
deps.log(`current -> releases/${dirName}`);
|
|
311
|
+
const visible = await linkVisible(deps, target);
|
|
312
|
+
if (visible) notes.push(visible);
|
|
313
|
+
await prune(deps, target, /* @__PURE__ */ new Set([dirName, ...before.current ? [before.current] : []]));
|
|
314
|
+
notes.push("Restart ClikCode sessions that were using the desktop tool, and any `cua-driver serve` daemon, to run the new version.");
|
|
315
|
+
return { action: "installed", version, dir: finalDir, ...before.current && before.current !== dirName ? { previous: before.current } : {}, notes };
|
|
316
|
+
}
|
|
317
|
+
async function rollbackDriver(deps) {
|
|
318
|
+
const target = driverTarget(deps.platform, deps.arch);
|
|
319
|
+
if (!target) throw new Error(`Cua ships no cua-driver for ${deps.platform} ${deps.arch}.`);
|
|
320
|
+
if (target.platform === "darwin") throw new Error("On macOS, roll back by installing the older release: clikcode computer driver install --version <older>.");
|
|
321
|
+
const { versions, current, previous } = await installedReleases(deps, target);
|
|
322
|
+
const wanted = previous && versions.some((entry) => basename(entry.dir) === previous) ? previous : versions.map((entry) => basename(entry.dir)).find((name) => name !== current);
|
|
323
|
+
if (!wanted) throw new Error("There is no earlier cua-driver release on disk to go back to.");
|
|
324
|
+
if (current) await writeFile(join(packagesDir(deps), "clikcode-previous"), `${current}
|
|
325
|
+
`);
|
|
326
|
+
await pointCurrent(deps, wanted);
|
|
327
|
+
await linkVisible(deps, target);
|
|
328
|
+
return { action: "rolled-back", version: wanted.slice(0, wanted.length - target.triple.length - 1), dir: join(packagesDir(deps), "releases", wanted), notes: [] };
|
|
329
|
+
}
|
|
330
|
+
async function driverStatus(deps, options = {}) {
|
|
331
|
+
const target = driverTarget(deps.platform, deps.arch);
|
|
332
|
+
if (!target) return { supported: false, releases: [] };
|
|
333
|
+
const binary = findDriverBinary(deps.env, deps.platform);
|
|
334
|
+
const version = binary ? await runningVersion(deps, binary) : void 0;
|
|
335
|
+
const { versions, current, previous } = await installedReleases(deps, target);
|
|
336
|
+
const status = {
|
|
337
|
+
supported: true,
|
|
338
|
+
target: target.triple,
|
|
339
|
+
...binary ? { binary: await realpath(binary).catch(() => binary) } : {},
|
|
340
|
+
...version ? { version } : {},
|
|
341
|
+
releases: versions.map((entry) => entry.version),
|
|
342
|
+
...current ? { current } : {},
|
|
343
|
+
...previous ? { previous } : {}
|
|
344
|
+
};
|
|
345
|
+
if (options.checkLatest !== false) {
|
|
346
|
+
try {
|
|
347
|
+
const latest = await latestDriverVersion(deps, target);
|
|
348
|
+
status.latest = latest.version;
|
|
349
|
+
status.latestSource = latest.source;
|
|
350
|
+
if (version) status.upToDate = compareVersions(version, latest.version) >= 0;
|
|
351
|
+
} catch (error) {
|
|
352
|
+
status.latestError = error instanceof Error ? error.message : String(error);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return status;
|
|
356
|
+
}
|
|
357
|
+
async function activeReleaseDir(deps) {
|
|
358
|
+
const binary = findDriverBinary(deps.env, deps.platform);
|
|
359
|
+
if (!binary) return void 0;
|
|
360
|
+
return dirname(await realpath(binary).catch(() => binary));
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// src/agent/computer/driver-wayland.ts
|
|
364
|
+
var HELPER_MIN_GNOME = 45;
|
|
365
|
+
var HELPER_MAX_GNOME = 49;
|
|
366
|
+
function gnomeMajor(versionOutput) {
|
|
367
|
+
const major = versionOutput.match(/GNOME Shell\s+(\d+)/i)?.[1];
|
|
368
|
+
return major === void 0 ? void 0 : Number(major);
|
|
369
|
+
}
|
|
370
|
+
function waylandHelperVerdict(input) {
|
|
371
|
+
if (input.platform !== "linux") return { ok: false, reason: "The Wayland helper is a GNOME Shell extension; it applies to Linux only." };
|
|
372
|
+
if (!/gnome/i.test(input.desktop ?? "")) return { ok: false, reason: `This desktop is ${input.desktop || "not GNOME"}. The helper is a GNOME Shell extension and does nothing elsewhere.` };
|
|
373
|
+
const major = gnomeMajor(input.gnomeShellOutput ?? "");
|
|
374
|
+
if (major === void 0) return { ok: false, reason: "Could not read the GNOME Shell version (gnome-shell --version), so the helper was not installed." };
|
|
375
|
+
if (major >= HELPER_MAX_GNOME + 1) {
|
|
376
|
+
return { ok: false, reason: `GNOME ${major} is newer than the helper supports. Cua turned it off from GNOME ${HELPER_MAX_GNOME + 1} because it crashed the Shell, and cua-driver 0.38 or newer lists native windows through the accessibility bus without it. Run \`clikcode computer driver update\` instead if windows are missing.` };
|
|
377
|
+
}
|
|
378
|
+
if (major < HELPER_MIN_GNOME) return { ok: false, reason: `GNOME ${major} is older than the helper supports (${HELPER_MIN_GNOME}-${HELPER_MAX_GNOME}).` };
|
|
379
|
+
if (input.sessionType && input.sessionType !== "wayland") return { ok: false, reason: `This is a ${input.sessionType} session; the helper is for Wayland.` };
|
|
380
|
+
return { ok: true, major };
|
|
381
|
+
}
|
|
382
|
+
var helperExplanation = "The helper is a small GNOME Shell extension (winrects@cua) bundled with cua-driver. It lets cua-driver see where windows are on screen and draw its agent cursor. The installer copies it to ~/.local/share/gnome-shell/extensions and adds it to your enabled extensions with gsettings. GNOME loads extensions only at start-up, so you must log out and back in once afterwards.";
|
|
383
|
+
|
|
384
|
+
// src/commands/computer-driver.ts
|
|
385
|
+
var say = (line) => {
|
|
386
|
+
process.stderr.write(`${line}
|
|
387
|
+
`);
|
|
388
|
+
};
|
|
389
|
+
function report(result, verb) {
|
|
390
|
+
if (isJsonDefaultMode()) return emitResult({ computer: { driver: result } });
|
|
391
|
+
const line = result.action === "up-to-date" ? `cua-driver ${result.version} is already installed and current.` : result.action === "newer-installed" ? result.notes[0] : result.action === "rolled-back" ? `Went back to cua-driver ${result.version}.` : `cua-driver ${result.version} ${verb}.${result.dir ? ` (${result.dir})` : ""}`;
|
|
392
|
+
process.stdout.write(`${line}
|
|
393
|
+
`);
|
|
394
|
+
for (const note of result.notes.filter((note2) => note2 !== line)) process.stdout.write(`${note}
|
|
395
|
+
`);
|
|
396
|
+
if (result.previous) process.stdout.write(`The previous release stays on disk; \`clikcode computer driver rollback\` goes back to it.
|
|
397
|
+
`);
|
|
398
|
+
}
|
|
399
|
+
async function computerDriverInstall(options = {}, verb = "installed") {
|
|
400
|
+
report(await installDriver(await defaultDeps(say), options), verb);
|
|
401
|
+
}
|
|
402
|
+
async function computerDriverRollback() {
|
|
403
|
+
report(await rollbackDriver(await defaultDeps(say)), "rolled back");
|
|
404
|
+
}
|
|
405
|
+
async function computerDriverStatus(options = {}) {
|
|
406
|
+
const status = await driverStatus(await defaultDeps(say), { checkLatest: !options.offline });
|
|
407
|
+
const wayland = waylandSession();
|
|
408
|
+
const stale = Boolean(status.version && driverVersionNotice(status.version, wayland));
|
|
409
|
+
if (isJsonDefaultMode()) return emitResult({ computer: { driver: { ...status, ...wayland ? { waylandNeeds: WAYLAND_DRIVER_VERSION, tooOldForWayland: stale } : {} } } });
|
|
410
|
+
if (!status.supported) return void process.stdout.write("Cua ships no cua-driver for this operating system or architecture.\n");
|
|
411
|
+
const lines = [
|
|
412
|
+
status.version ? `cua-driver ${status.version} at ${status.binary}` : "cua-driver is not installed. Install it with: clikcode computer driver install",
|
|
413
|
+
...status.releases.length ? [`releases on disk: ${status.releases.join(", ")}${status.current ? ` (active: ${status.current})` : ""}${status.previous ? `, rollback target: ${status.previous}` : ""}`] : [],
|
|
414
|
+
...status.latest ? [`latest release: ${status.latest}${status.version ? status.upToDate ? " (you have it)" : " (update with: clikcode computer driver update)" : ""}`] : status.latestError ? [`latest release: unknown (${status.latestError})`] : [],
|
|
415
|
+
...stale ? [`This Wayland desktop needs cua-driver ${WAYLAND_DRIVER_VERSION} or newer: clikcode computer driver update`] : []
|
|
416
|
+
];
|
|
417
|
+
process.stdout.write(`${lines.join("\n")}
|
|
418
|
+
`);
|
|
419
|
+
}
|
|
420
|
+
var gnomeShellVersion = () => new Promise((resolve) => execFile("gnome-shell", ["--version"], { timeout: 1e4 }, (_error, stdout) => resolve(String(stdout ?? ""))));
|
|
421
|
+
async function computerDriverWaylandHelper(options = {}) {
|
|
422
|
+
const verdict = waylandHelperVerdict({ platform: process.platform, ...process.env.XDG_CURRENT_DESKTOP ? { desktop: process.env.XDG_CURRENT_DESKTOP } : {}, ...process.env.XDG_SESSION_TYPE ? { sessionType: process.env.XDG_SESSION_TYPE } : {}, gnomeShellOutput: await gnomeShellVersion() });
|
|
423
|
+
if (!verdict.ok) throw new Error(verdict.reason);
|
|
424
|
+
const deps = await defaultDeps(say);
|
|
425
|
+
const dir = await activeReleaseDir(deps);
|
|
426
|
+
const script = dir ? join2(dir, "wayland-helper", "install.sh") : void 0;
|
|
427
|
+
const present = script ? await import("node:fs/promises").then((fs) => fs.stat(script).then(() => true, () => false)) : false;
|
|
428
|
+
if (!script || !present) throw new Error("The installed cua-driver has no bundled wayland-helper/install.sh. Install or update it first: clikcode computer driver install");
|
|
429
|
+
if (!options.yes) {
|
|
430
|
+
process.stdout.write(`GNOME ${verdict.major} is supported by the helper.
|
|
431
|
+
${helperExplanation}
|
|
432
|
+
|
|
433
|
+
Run it with: clikcode computer driver wayland-helper --yes
|
|
434
|
+
`);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
const code = await deps.runVisible("bash", [script], deps.env);
|
|
438
|
+
if (code !== 0) throw new Error(`The helper installer exited with ${code}.`);
|
|
439
|
+
if (isJsonDefaultMode()) return emitResult({ computer: { waylandHelper: { installed: true, logOutRequired: true } } });
|
|
440
|
+
process.stdout.write("Installed. Log out of your desktop session and back in once so GNOME loads the helper. Afterwards `gnome-extensions info winrects@cua` should say State: ACTIVE.\n");
|
|
441
|
+
}
|
|
442
|
+
export {
|
|
443
|
+
computerDriverInstall,
|
|
444
|
+
computerDriverRollback,
|
|
445
|
+
computerDriverStatus,
|
|
446
|
+
computerDriverWaylandHelper
|
|
447
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
drawHarnessOutput,
|
|
5
|
+
emitHarnessOutput,
|
|
6
|
+
panelParts,
|
|
7
|
+
renderPanelText,
|
|
8
|
+
renderSessionCard,
|
|
9
|
+
sessionModelLabel
|
|
10
|
+
} from "./chunk-4RHXTL3W.js";
|
|
11
|
+
import "./chunk-W5AYOICN.js";
|
|
12
|
+
import "./chunk-2OLS7V66.js";
|
|
13
|
+
import "./chunk-2QWPQRSU.js";
|
|
14
|
+
import "./chunk-IS4USJPY.js";
|
|
15
|
+
import "./chunk-2BBELGHY.js";
|
|
16
|
+
import "./chunk-QYHI3YET.js";
|
|
17
|
+
import "./chunk-4LPDG57B.js";
|
|
18
|
+
import "./chunk-TQDM7S5N.js";
|
|
19
|
+
import "./chunk-TQDKJHWX.js";
|
|
20
|
+
import "./chunk-GQBZU6EO.js";
|
|
21
|
+
import "./chunk-QQRLPY25.js";
|
|
22
|
+
import "./chunk-DA44ZENT.js";
|
|
23
|
+
import "./chunk-F252T6Y3.js";
|
|
24
|
+
import "./chunk-XWAC3MKW.js";
|
|
25
|
+
import "./chunk-CVFVFRGN.js";
|
|
26
|
+
import "./chunk-QJP7EYGL.js";
|
|
27
|
+
import "./chunk-ESF3DIZY.js";
|
|
28
|
+
import "./chunk-R7QN6ONS.js";
|
|
29
|
+
import "./chunk-ZGX3ERAT.js";
|
|
30
|
+
import "./chunk-PEWCDI2C.js";
|
|
31
|
+
import "./chunk-TULAXS77.js";
|
|
32
|
+
import "./chunk-NWEYRBWK.js";
|
|
33
|
+
import "./chunk-WWLJMP6D.js";
|
|
34
|
+
import "./chunk-CRUVYGO2.js";
|
|
35
|
+
import "./chunk-FF7ZVYJF.js";
|
|
36
|
+
import "./chunk-IMLTL2MY.js";
|
|
37
|
+
import "./chunk-BUOPJQP5.js";
|
|
38
|
+
import "./chunk-3B2CHX7M.js";
|
|
39
|
+
import "./chunk-RVUOIJXN.js";
|
|
40
|
+
import "./chunk-QUS4ER2W.js";
|
|
41
|
+
import "./chunk-DQYVQ2N7.js";
|
|
42
|
+
import "./chunk-KYUHIFP3.js";
|
|
43
|
+
import "./chunk-RSZGEL5U.js";
|
|
44
|
+
import "./chunk-DF35KMXM.js";
|
|
45
|
+
import "./chunk-ZT7B4H2V.js";
|
|
46
|
+
import "./chunk-OL4JBD3J.js";
|
|
47
|
+
import "./chunk-IGZ6C2MC.js";
|
|
48
|
+
import "./chunk-4NN3XQQT.js";
|
|
49
|
+
import "./chunk-4AQ5NINV.js";
|
|
50
|
+
import "./chunk-WPB5WEZJ.js";
|
|
51
|
+
import "./chunk-GYMAI5NY.js";
|
|
52
|
+
import "./chunk-CQ7J6UQ7.js";
|
|
53
|
+
import "./chunk-XKW5NDMR.js";
|
|
54
|
+
import "./chunk-W3YYPBEA.js";
|
|
55
|
+
import "./chunk-XIBYREEY.js";
|
|
56
|
+
import "./chunk-EE4B6A7W.js";
|
|
57
|
+
import "./chunk-WZYVLUVQ.js";
|
|
58
|
+
import "./chunk-O3EW7LAY.js";
|
|
59
|
+
import "./chunk-KHW6TX6I.js";
|
|
60
|
+
import "./chunk-YMCH3L2S.js";
|
|
61
|
+
import "./chunk-JGIWATSG.js";
|
|
62
|
+
import "./chunk-5B6TVO4A.js";
|
|
63
|
+
import "./chunk-NAOX3JUB.js";
|
|
64
|
+
import "./chunk-4QZEZME7.js";
|
|
65
|
+
import "./chunk-LVRRWP4W.js";
|
|
66
|
+
import "./chunk-GGYKY4GF.js";
|
|
67
|
+
import "./chunk-PAXYQZH7.js";
|
|
68
|
+
import "./chunk-G3QP67Z7.js";
|
|
69
|
+
import "./chunk-4L2ZZM4Q.js";
|
|
70
|
+
import "./chunk-F6F47QAY.js";
|
|
71
|
+
import "./chunk-RDDWQBEM.js";
|
|
72
|
+
import "./chunk-MPAJ446F.js";
|
|
73
|
+
import "./chunk-CBANJFBO.js";
|
|
74
|
+
import "./chunk-PWXII6HF.js";
|
|
75
|
+
export {
|
|
76
|
+
drawHarnessOutput,
|
|
77
|
+
emitHarnessOutput,
|
|
78
|
+
panelParts,
|
|
79
|
+
renderPanelText,
|
|
80
|
+
renderSessionCard,
|
|
81
|
+
sessionModelLabel
|
|
82
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
acceptGatewayUncensoredTerms,
|
|
5
|
+
gatewayModelForWord,
|
|
6
|
+
gatewayModels,
|
|
7
|
+
gatewayUncensoredConsent
|
|
8
|
+
} from "./chunk-W5AYOICN.js";
|
|
9
|
+
import "./chunk-2OLS7V66.js";
|
|
10
|
+
import "./chunk-2QWPQRSU.js";
|
|
11
|
+
import "./chunk-IS4USJPY.js";
|
|
12
|
+
import "./chunk-2BBELGHY.js";
|
|
13
|
+
import "./chunk-QYHI3YET.js";
|
|
14
|
+
import "./chunk-4LPDG57B.js";
|
|
15
|
+
import "./chunk-TQDM7S5N.js";
|
|
16
|
+
import "./chunk-TQDKJHWX.js";
|
|
17
|
+
import "./chunk-GQBZU6EO.js";
|
|
18
|
+
import "./chunk-F252T6Y3.js";
|
|
19
|
+
import "./chunk-PEWCDI2C.js";
|
|
20
|
+
import "./chunk-TULAXS77.js";
|
|
21
|
+
import "./chunk-NWEYRBWK.js";
|
|
22
|
+
import "./chunk-YMCH3L2S.js";
|
|
23
|
+
import "./chunk-NAOX3JUB.js";
|
|
24
|
+
import "./chunk-GGYKY4GF.js";
|
|
25
|
+
import "./chunk-PAXYQZH7.js";
|
|
26
|
+
import "./chunk-4L2ZZM4Q.js";
|
|
27
|
+
import "./chunk-F6F47QAY.js";
|
|
28
|
+
import "./chunk-RDDWQBEM.js";
|
|
29
|
+
import "./chunk-MPAJ446F.js";
|
|
30
|
+
import "./chunk-CBANJFBO.js";
|
|
31
|
+
import "./chunk-PWXII6HF.js";
|
|
32
|
+
|
|
33
|
+
// src/gateway/agreement.ts
|
|
34
|
+
async function reviewGatewayModelAgreement(model, prompter) {
|
|
35
|
+
const list = await gatewayModels();
|
|
36
|
+
if (!gatewayModelForWord(list.models, model)?.tags?.includes("uncensored")) return true;
|
|
37
|
+
const consent = await gatewayUncensoredConsent();
|
|
38
|
+
if (consent.accepted) return true;
|
|
39
|
+
if (!prompter.select) throw new Error("Review the Gateway agreement with clikcode gateway agreement before selecting this model.");
|
|
40
|
+
const accepted = await prompter.select(`Uncensored models \xB7 agreement ${consent.version}
|
|
41
|
+
|
|
42
|
+
${consent.terms}
|
|
43
|
+
|
|
44
|
+
Accepting records this choice for your ClikDeploy account.`, [
|
|
45
|
+
{ label: "I accept \u2014 continue", value: true },
|
|
46
|
+
{ label: "Cancel", value: false }
|
|
47
|
+
]);
|
|
48
|
+
if (accepted !== true) return false;
|
|
49
|
+
const saved = await acceptGatewayUncensoredTerms(consent.version);
|
|
50
|
+
if (!saved.accepted) throw new Error("The current agreement was not recorded. Review the current version and try again.");
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
reviewGatewayModelAgreement
|
|
55
|
+
};
|