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,395 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
STALE_BASE
|
|
5
|
+
} from "./chunk-DAJ76TOC.js";
|
|
6
|
+
import {
|
|
7
|
+
carriedHandoffSettings
|
|
8
|
+
} from "./chunk-PUOVIFHW.js";
|
|
9
|
+
import {
|
|
10
|
+
getApiKeyForUrl,
|
|
11
|
+
getApiUrl
|
|
12
|
+
} from "./chunk-TQDM7S5N.js";
|
|
13
|
+
import "./chunk-M3FO5UMK.js";
|
|
14
|
+
import "./chunk-CERF3RIB.js";
|
|
15
|
+
import "./chunk-CVFVFRGN.js";
|
|
16
|
+
import "./chunk-ESF3DIZY.js";
|
|
17
|
+
import "./chunk-R7QN6ONS.js";
|
|
18
|
+
import "./chunk-ZGX3ERAT.js";
|
|
19
|
+
import "./chunk-TULAXS77.js";
|
|
20
|
+
import {
|
|
21
|
+
readState
|
|
22
|
+
} from "./chunk-MXS6S2PY.js";
|
|
23
|
+
import {
|
|
24
|
+
resolveDefaultSettings
|
|
25
|
+
} from "./chunk-BISGNHKD.js";
|
|
26
|
+
import {
|
|
27
|
+
writeState
|
|
28
|
+
} from "./chunk-RKUVLRZI.js";
|
|
29
|
+
import "./chunk-BGEMY2JJ.js";
|
|
30
|
+
import "./chunk-XCKQ5BM2.js";
|
|
31
|
+
import "./chunk-NWEYRBWK.js";
|
|
32
|
+
import {
|
|
33
|
+
forgetNativeThread
|
|
34
|
+
} from "./chunk-TWCVV2JO.js";
|
|
35
|
+
import "./chunk-PDPEM5VW.js";
|
|
36
|
+
import "./chunk-WWLJMP6D.js";
|
|
37
|
+
import {
|
|
38
|
+
GATEWAY_LABEL
|
|
39
|
+
} from "./chunk-CRUVYGO2.js";
|
|
40
|
+
import {
|
|
41
|
+
messageOrigin,
|
|
42
|
+
sessionTranscriptMessages
|
|
43
|
+
} from "./chunk-FF7ZVYJF.js";
|
|
44
|
+
import "./chunk-IMLTL2MY.js";
|
|
45
|
+
import "./chunk-BUOPJQP5.js";
|
|
46
|
+
import "./chunk-3B2CHX7M.js";
|
|
47
|
+
import "./chunk-RVUOIJXN.js";
|
|
48
|
+
import "./chunk-QUS4ER2W.js";
|
|
49
|
+
import "./chunk-DQYVQ2N7.js";
|
|
50
|
+
import {
|
|
51
|
+
harnessSupportsEffort,
|
|
52
|
+
harnessSupportsPermissionMode,
|
|
53
|
+
localHarnessForCommand,
|
|
54
|
+
localHarnessForProvider
|
|
55
|
+
} from "./chunk-KYUHIFP3.js";
|
|
56
|
+
import "./chunk-RSZGEL5U.js";
|
|
57
|
+
import "./chunk-NKDATMEM.js";
|
|
58
|
+
import {
|
|
59
|
+
folderExists
|
|
60
|
+
} from "./chunk-DF35KMXM.js";
|
|
61
|
+
import "./chunk-ZT7B4H2V.js";
|
|
62
|
+
import "./chunk-OL4JBD3J.js";
|
|
63
|
+
import "./chunk-IGZ6C2MC.js";
|
|
64
|
+
import "./chunk-4NN3XQQT.js";
|
|
65
|
+
import "./chunk-4AQ5NINV.js";
|
|
66
|
+
import "./chunk-WPB5WEZJ.js";
|
|
67
|
+
import "./chunk-GYMAI5NY.js";
|
|
68
|
+
import "./chunk-CQ7J6UQ7.js";
|
|
69
|
+
import "./chunk-XKW5NDMR.js";
|
|
70
|
+
import "./chunk-W3YYPBEA.js";
|
|
71
|
+
import "./chunk-XIBYREEY.js";
|
|
72
|
+
import "./chunk-EE4B6A7W.js";
|
|
73
|
+
import "./chunk-WZYVLUVQ.js";
|
|
74
|
+
import "./chunk-O3EW7LAY.js";
|
|
75
|
+
import "./chunk-KHW6TX6I.js";
|
|
76
|
+
import "./chunk-YMCH3L2S.js";
|
|
77
|
+
import "./chunk-4QZEZME7.js";
|
|
78
|
+
import "./chunk-LVRRWP4W.js";
|
|
79
|
+
import "./chunk-G3QP67Z7.js";
|
|
80
|
+
import "./chunk-4L2ZZM4Q.js";
|
|
81
|
+
import "./chunk-F6F47QAY.js";
|
|
82
|
+
import {
|
|
83
|
+
quiet
|
|
84
|
+
} from "./chunk-RDDWQBEM.js";
|
|
85
|
+
import "./chunk-MPAJ446F.js";
|
|
86
|
+
import "./chunk-CBANJFBO.js";
|
|
87
|
+
import "./chunk-PWXII6HF.js";
|
|
88
|
+
|
|
89
|
+
// src/session/move.ts
|
|
90
|
+
import { homedir } from "node:os";
|
|
91
|
+
import { createHash } from "node:crypto";
|
|
92
|
+
import { promisify } from "node:util";
|
|
93
|
+
import { gunzip, gzip } from "node:zlib";
|
|
94
|
+
var MOVED_ALREADY = (session) => `This chat moved to ${session.movedTo.machine}; it goes on there.`;
|
|
95
|
+
function exportedMessages(session) {
|
|
96
|
+
const origin = messageOrigin(session);
|
|
97
|
+
return sessionTranscriptMessages(session).map((message) => message.origin ? message : { ...message, origin });
|
|
98
|
+
}
|
|
99
|
+
function canonicalJson(value) {
|
|
100
|
+
return JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.keys(item).sort().map((key) => [key, item[key]])) : item);
|
|
101
|
+
}
|
|
102
|
+
function chatMessagesHash(messages) {
|
|
103
|
+
const hash = createHash("sha256");
|
|
104
|
+
for (const message of messages) hash.update(canonicalJson(message)).update("\n");
|
|
105
|
+
return hash.digest("hex");
|
|
106
|
+
}
|
|
107
|
+
function movedAwayCopy(state, id) {
|
|
108
|
+
return state.sessions.find((item) => item.id === id && item.movedTo);
|
|
109
|
+
}
|
|
110
|
+
async function chatHave(id) {
|
|
111
|
+
const state = await readState({ transcripts: [id] });
|
|
112
|
+
const session = movedAwayCopy(state, id);
|
|
113
|
+
if (!session) return null;
|
|
114
|
+
const messages = exportedMessages(session);
|
|
115
|
+
return messages.length ? { messages: messages.length, hash: chatMessagesHash(messages) } : null;
|
|
116
|
+
}
|
|
117
|
+
var TURN_RUNS = "A turn is still running in this conversation -- move it when the turn ends, or stop it first.";
|
|
118
|
+
async function exportChat(id, options = {}, since) {
|
|
119
|
+
const state = await readState({ transcripts: [id] });
|
|
120
|
+
const session = state.sessions.find((item) => item.id === id);
|
|
121
|
+
if (!session) throw new Error(`AI session "${id}" was not found`);
|
|
122
|
+
if (session.movedTo) throw new Error(MOVED_ALREADY(session));
|
|
123
|
+
if (options.turnRunning) {
|
|
124
|
+
if (await options.turnRunning()) throw new Error(TURN_RUNS);
|
|
125
|
+
} else {
|
|
126
|
+
const { runningWorker } = await import("./chunk-BBOVDXQM.js");
|
|
127
|
+
if (await runningWorker(id)) {
|
|
128
|
+
const { refuseWhileTurnRuns } = await import("./chunk-OARL2NXZ.js");
|
|
129
|
+
await refuseWhileTurnRuns(id);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const { synchronizeNativeTranscript } = await import("./chunk-FA3Y23ZW.js");
|
|
133
|
+
await synchronizeNativeTranscript(state, session);
|
|
134
|
+
let messages = exportedMessages(session);
|
|
135
|
+
const base = since && Number.isInteger(since.messages) && since.messages > 0 && since.messages <= messages.length && chatMessagesHash(messages.slice(0, since.messages)) === since.hash ? { messages: since.messages, hash: since.hash } : void 0;
|
|
136
|
+
if (base) messages = messages.slice(base.messages);
|
|
137
|
+
const account = session.accountId ? state.accounts.find((item) => item.id === session.accountId)?.label : void 0;
|
|
138
|
+
return {
|
|
139
|
+
...base ? { version: 2, base } : { version: 1 },
|
|
140
|
+
sessionId: session.id,
|
|
141
|
+
conversationId: session.conversationId ?? session.id,
|
|
142
|
+
...session.name ? { name: session.name } : {},
|
|
143
|
+
...session.nameSource ? { nameSource: session.nameSource } : {},
|
|
144
|
+
createdAt: session.createdAt,
|
|
145
|
+
messages,
|
|
146
|
+
...session.summary ? { summary: session.summary } : {},
|
|
147
|
+
...session.plan ? { plan: session.plan } : {},
|
|
148
|
+
settings: {
|
|
149
|
+
route: session.route,
|
|
150
|
+
provider: session.provider,
|
|
151
|
+
model: session.model,
|
|
152
|
+
effort: session.effort,
|
|
153
|
+
...session.nativeHarness ? { nativeHarness: session.nativeHarness } : {},
|
|
154
|
+
...session.routeModels ? { routeModels: session.routeModels } : {},
|
|
155
|
+
...session.permissionMode ? { permissionMode: session.permissionMode } : {},
|
|
156
|
+
...session.planMode ? { planMode: true } : {},
|
|
157
|
+
...session.speed ? { speed: session.speed } : {},
|
|
158
|
+
...session.sandbox ? { sandbox: session.sandbox } : {},
|
|
159
|
+
...session.harnessOptions ? { harnessOptions: session.harnessOptions } : {},
|
|
160
|
+
...session.gatewayAgentId ? { gatewayAgentId: session.gatewayAgentId } : {},
|
|
161
|
+
...session.gatewayAgentName ? { gatewayAgentName: session.gatewayAgentName } : {},
|
|
162
|
+
...account ? { account } : {}
|
|
163
|
+
},
|
|
164
|
+
source: { ...session.workspace ? { folder: session.workspace } : {} }
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
async function markMoved(id, movedTo) {
|
|
168
|
+
const state = await readState({ transcripts: [] });
|
|
169
|
+
const session = state.sessions.find((item) => item.id === id);
|
|
170
|
+
if (!session) throw new Error(`AI session "${id}" was not found`);
|
|
171
|
+
session.movedTo = { ...movedTo, at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
172
|
+
delete session.moveNote;
|
|
173
|
+
session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
174
|
+
await writeState(state);
|
|
175
|
+
const { retireMovedWorker } = await import("./chunk-BBOVDXQM.js");
|
|
176
|
+
await retireMovedWorker(id).catch(quiet("session/move"));
|
|
177
|
+
}
|
|
178
|
+
async function reclaimMovedChat(id) {
|
|
179
|
+
const state = await readState({ transcripts: [id] });
|
|
180
|
+
const session = state.sessions.find((item) => item.id === id);
|
|
181
|
+
if (!session) throw new Error(`AI session "${id}" was not found`);
|
|
182
|
+
if (!session.movedTo) return id;
|
|
183
|
+
delete session.movedTo;
|
|
184
|
+
session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
185
|
+
forgetNativeThread(session);
|
|
186
|
+
await writeState(state);
|
|
187
|
+
const { warmSessionWorker } = await import("./chunk-BBOVDXQM.js");
|
|
188
|
+
await warmSessionWorker(id).catch(quiet("session/move"));
|
|
189
|
+
return id;
|
|
190
|
+
}
|
|
191
|
+
function sameAccount(account, label) {
|
|
192
|
+
const email = (text) => /[^\s<>()]+@[^\s<>()]+\.[^\s<>()]+/.exec(text)?.[0]?.toLowerCase();
|
|
193
|
+
if (account.label.trim().toLowerCase() === label.trim().toLowerCase()) return true;
|
|
194
|
+
const mine = email(account.label);
|
|
195
|
+
return Boolean(mine && mine === email(label));
|
|
196
|
+
}
|
|
197
|
+
var MODE_NAMES = { ask: "Ask", auto: "Auto", bypass: "Bypass" };
|
|
198
|
+
function providerName(settings) {
|
|
199
|
+
if (settings.route === "gateway" || settings.route === "clikcode-local") return GATEWAY_LABEL;
|
|
200
|
+
const harness = settings.nativeHarness ? localHarnessForCommand(settings.nativeHarness) : settings.provider ? localHarnessForProvider(settings.provider) : void 0;
|
|
201
|
+
return harness?.displayName ?? settings.provider ?? "its provider";
|
|
202
|
+
}
|
|
203
|
+
function machineFacts(config) {
|
|
204
|
+
return {
|
|
205
|
+
installed: async (harness) => (await import("./chunk-ZI3YHEBY.js")).inspectNativeHarnessForPicker(harness).then((found) => found.installed, () => false),
|
|
206
|
+
gatewaySignedIn: () => Boolean(config && getApiKeyForUrl(config, getApiUrl(config))),
|
|
207
|
+
vendorSignIn: async (harness) => {
|
|
208
|
+
const { authEvidencePresent, hasAuthEvidence } = await import("./chunk-GGYNHGNJ.js");
|
|
209
|
+
if (!hasAuthEvidence(harness) || !await authEvidencePresent(harness, {}).catch(() => false)) return void 0;
|
|
210
|
+
const { deriveAccountLabel } = await import("./chunk-D2UK66HM.js");
|
|
211
|
+
return await deriveAccountLabel(harness, void 0).catch(quiet("session/move")) ?? harness.displayName;
|
|
212
|
+
},
|
|
213
|
+
efforts: async (harness, account, model) => harnessSupportsEffort(harness) ? (await (await import("./chunk-IZ77QJQG.js")).effortChoicesFor(harness, account, model).catch(quiet("session/move")))?.values : void 0,
|
|
214
|
+
home: homedir
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
async function planImport(state, chat, facts) {
|
|
218
|
+
const wanted = chat.settings;
|
|
219
|
+
const changes = [];
|
|
220
|
+
const remembered = state.sessions.filter((item) => (item.conversationId ?? item.id) === chat.conversationId && item.workspace && folderExists(item.workspace)).sort((left, right) => Date.parse(right.updatedAt) - Date.parse(left.updatedAt))[0]?.workspace;
|
|
221
|
+
const folder = remembered ?? facts.home();
|
|
222
|
+
const harness = wanted.route === "local" ? wanted.nativeHarness ? localHarnessForCommand(wanted.nativeHarness) : wanted.provider ? localHarnessForProvider(wanted.provider) : void 0 : void 0;
|
|
223
|
+
const installedThere = harness ? await facts.installed(harness) : false;
|
|
224
|
+
const usable = wanted.route === "gateway" ? facts.gatewaySignedIn() : wanted.route === "clikcode-local" ? true : Boolean(harness);
|
|
225
|
+
if (harness && !installedThere) changes.push(`${harness.displayName} is not installed there; the first message installs it and signs in.`);
|
|
226
|
+
const kept = { route: wanted.route, provider: wanted.provider, model: wanted.model, effort: wanted.effort };
|
|
227
|
+
let session;
|
|
228
|
+
if (!usable) {
|
|
229
|
+
const { launchSession } = await import("./chunk-AEMHSXKA.js");
|
|
230
|
+
const fresh = launchSession(state, folder);
|
|
231
|
+
const { id: _id, createdAt: _created, updatedAt: _updated, status: _status, messages: _messages, ...settings } = fresh;
|
|
232
|
+
session = { ...settings, conversationId: chat.conversationId };
|
|
233
|
+
const why = wanted.route === "gateway" ? `${GATEWAY_LABEL} is not signed in there` : `${providerName(wanted)} is not installed there`;
|
|
234
|
+
const next = fresh.route === "local" && !fresh.nativeHarness ? "the first message there asks for a provider" : `using ${providerName(fresh)}`;
|
|
235
|
+
if (wanted.route !== "local" || harness || wanted.provider) changes.push(`${why}; ${next}.`);
|
|
236
|
+
} else if (wanted.route !== "local" || !harness) {
|
|
237
|
+
session = {
|
|
238
|
+
...kept,
|
|
239
|
+
conversationId: chat.conversationId,
|
|
240
|
+
accountId: null,
|
|
241
|
+
...wanted.permissionMode ? { permissionMode: wanted.permissionMode } : {},
|
|
242
|
+
...wanted.planMode ? { planMode: true } : {},
|
|
243
|
+
...wanted.speed ? { speed: wanted.speed } : {},
|
|
244
|
+
...wanted.sandbox ? { sandbox: wanted.sandbox } : {},
|
|
245
|
+
...wanted.gatewayAgentId ? { gatewayAgentId: wanted.gatewayAgentId } : {},
|
|
246
|
+
...wanted.gatewayAgentName ? { gatewayAgentName: wanted.gatewayAgentName } : {},
|
|
247
|
+
...wanted.route === "gateway" ? { gatewayConfirmed: true } : {}
|
|
248
|
+
};
|
|
249
|
+
} else {
|
|
250
|
+
const ofProvider = state.accounts.filter((account2) => account2.provider === harness.provider);
|
|
251
|
+
const same = wanted.account ? ofProvider.find((account2) => sameAccount(account2, wanted.account)) : void 0;
|
|
252
|
+
let account = same?.status === "ready" ? same : void 0;
|
|
253
|
+
if (!account) {
|
|
254
|
+
const { signedInAccountId } = await import("./chunk-R6XVVQGC.js");
|
|
255
|
+
const other = signedInAccountId(state, harness.provider);
|
|
256
|
+
account = other ? state.accounts.find((item) => item.id === other) : void 0;
|
|
257
|
+
const onDisk = account || ofProvider.length ? void 0 : await facts.vendorSignIn(harness);
|
|
258
|
+
const using = account?.label ?? onDisk;
|
|
259
|
+
if (installedThere && wanted.account && !(using && sameAccount({ label: using }, wanted.account))) {
|
|
260
|
+
changes.push(using ? `account ${wanted.account} is not signed in there; using ${using}.` : `account ${wanted.account} is not signed in there; the first message there signs in.`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const listed = account?.models ?? [];
|
|
264
|
+
let model = wanted.model;
|
|
265
|
+
if (model && listed.length && !listed.includes(model)) {
|
|
266
|
+
const fallback = [state.providerSettings[harness.provider]?.model, harness.defaultModel].find((candidate) => candidate && listed.includes(candidate)) ?? listed[0];
|
|
267
|
+
changes.push(`model ${model} is not available there; using ${fallback}.`);
|
|
268
|
+
model = fallback;
|
|
269
|
+
}
|
|
270
|
+
const efforts = await facts.efforts(harness, account, model);
|
|
271
|
+
const carried = carriedHandoffSettings(
|
|
272
|
+
{ effort: wanted.effort, ...wanted.permissionMode ? { permissionMode: wanted.permissionMode } : {}, nativeHarness: harness.command },
|
|
273
|
+
harness,
|
|
274
|
+
resolveDefaultSettings(state, harness.provider),
|
|
275
|
+
efforts
|
|
276
|
+
);
|
|
277
|
+
if (wanted.effort && carried.effort !== wanted.effort) changes.push(`Effort ${wanted.effort} \u2192 ${carried.effort || `${harness.displayName}'s default`}.`);
|
|
278
|
+
if (wanted.permissionMode && carried.permissionMode !== wanted.permissionMode) {
|
|
279
|
+
const root = wanted.permissionMode === "bypass" && harness.bypassRefusedAsRoot && !harnessSupportsPermissionMode(harness, "bypass");
|
|
280
|
+
changes.push(`${MODE_NAMES[wanted.permissionMode]} \u2192 ${MODE_NAMES[carried.permissionMode]}${root ? " (root)" : ""}.`);
|
|
281
|
+
}
|
|
282
|
+
session = {
|
|
283
|
+
route: "local",
|
|
284
|
+
conversationId: chat.conversationId,
|
|
285
|
+
provider: harness.provider,
|
|
286
|
+
nativeHarness: harness.command,
|
|
287
|
+
accountId: account?.id ?? same?.id ?? ofProvider[0]?.id ?? null,
|
|
288
|
+
model,
|
|
289
|
+
effort: carried.effort,
|
|
290
|
+
permissionMode: carried.permissionMode,
|
|
291
|
+
...wanted.harnessOptions ? { harnessOptions: wanted.harnessOptions } : {}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
if (wanted.routeModels) session.routeModels = wanted.routeModels;
|
|
295
|
+
return { changes, folder, session, installedThere };
|
|
296
|
+
}
|
|
297
|
+
function moveNoteText(names, from, to) {
|
|
298
|
+
return `This conversation moved from ${names.source}${from ? ` (folder ${from})` : ""} to ${names.target} (folder ${to}). Files, processes and anything started before the move are on the previous machine; paths may differ. Check the state here before relying on earlier findings.`;
|
|
299
|
+
}
|
|
300
|
+
async function importChat(chat, names, facts) {
|
|
301
|
+
const delta = chat?.version === 2 && chat.base;
|
|
302
|
+
if (!(chat?.version === 1 || delta) || !Array.isArray(chat.messages)) throw new Error("This ClikCode cannot read that chat: update ClikCode on both machines.");
|
|
303
|
+
const state = await readState({ transcripts: [chat.sessionId] });
|
|
304
|
+
let messages = chat.messages;
|
|
305
|
+
if (delta) {
|
|
306
|
+
const copy = movedAwayCopy(state, chat.sessionId);
|
|
307
|
+
const held = copy ? exportedMessages(copy) : [];
|
|
308
|
+
if (held.length < delta.messages || chatMessagesHash(held.slice(0, delta.messages)) !== delta.hash) throw new Error(STALE_BASE);
|
|
309
|
+
messages = [...held.slice(0, delta.messages), ...chat.messages];
|
|
310
|
+
}
|
|
311
|
+
const planned = await planImport(state, chat, facts);
|
|
312
|
+
const existing = state.sessions.find((item) => item.id === chat.sessionId);
|
|
313
|
+
const { randomUUID } = await import("node:crypto");
|
|
314
|
+
const id = existing && !existing.movedTo ? randomUUID() : chat.sessionId;
|
|
315
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
316
|
+
const session = {
|
|
317
|
+
...planned.session,
|
|
318
|
+
id,
|
|
319
|
+
createdAt: chat.createdAt || now,
|
|
320
|
+
updatedAt: now,
|
|
321
|
+
status: "active",
|
|
322
|
+
workspace: planned.folder,
|
|
323
|
+
...chat.name ? { name: chat.name } : {},
|
|
324
|
+
...chat.nameSource ? { nameSource: chat.nameSource } : {},
|
|
325
|
+
messages,
|
|
326
|
+
...chat.summary ? { summary: chat.summary } : {},
|
|
327
|
+
...chat.plan ? { plan: chat.plan } : {},
|
|
328
|
+
moveNote: moveNoteText(names, chat.source?.folder, planned.folder)
|
|
329
|
+
};
|
|
330
|
+
if (existing && id === existing.id) {
|
|
331
|
+
forgetNativeThread(existing);
|
|
332
|
+
if (existing.ownedThreads?.length) session.ownedThreads = existing.ownedThreads;
|
|
333
|
+
state.sessions = state.sessions.map((item) => item.id === id ? session : item);
|
|
334
|
+
} else state.sessions.push(session);
|
|
335
|
+
await writeState(state);
|
|
336
|
+
if (session.route === "local" && session.nativeHarness && !session.accountId && planned.installedThere) {
|
|
337
|
+
const { aiHarnessSelect } = await import("./chunk-XRDALAO3.js");
|
|
338
|
+
await aiHarnessSelect(session.nativeHarness, id, { emit: false, signIn: false }).catch(quiet("session/move"));
|
|
339
|
+
}
|
|
340
|
+
const { warmSessionWorker } = await import("./chunk-BBOVDXQM.js");
|
|
341
|
+
await warmSessionWorker(id).catch(quiet("session/move"));
|
|
342
|
+
return { sessionId: id, changes: planned.changes, folder: planned.folder, installationId: state.installationId };
|
|
343
|
+
}
|
|
344
|
+
async function answerMoveRequest(config, request, currentId, options = {}) {
|
|
345
|
+
switch (request.type) {
|
|
346
|
+
case "export-chat": {
|
|
347
|
+
const id = request.sessionId ?? currentId;
|
|
348
|
+
if (!id) throw new Error("No conversation is open.");
|
|
349
|
+
const chat = await exportChat(id, options, request.since);
|
|
350
|
+
return request.pack ? packChat(chat) : chat;
|
|
351
|
+
}
|
|
352
|
+
case "chat-have":
|
|
353
|
+
return chatHave(request.sessionId);
|
|
354
|
+
case "import-chat": {
|
|
355
|
+
if (request.dryRun) {
|
|
356
|
+
const state = await readState({ transcripts: [] });
|
|
357
|
+
const { changes, folder } = await planImport(state, await unpackChat(request.chat), machineFacts(config));
|
|
358
|
+
return { changes, folder };
|
|
359
|
+
}
|
|
360
|
+
return importChat(await unpackChat(request.chat), request.names, machineFacts(config));
|
|
361
|
+
}
|
|
362
|
+
case "mark-moved":
|
|
363
|
+
await markMoved(request.sessionId, request.movedTo);
|
|
364
|
+
return void 0;
|
|
365
|
+
case "reclaim-moved":
|
|
366
|
+
return reclaimMovedChat(request.sessionId);
|
|
367
|
+
default:
|
|
368
|
+
throw new Error("unknown move request");
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
var gzipped = promisify(gzip);
|
|
372
|
+
var gunzipped = promisify(gunzip);
|
|
373
|
+
async function packChat(chat) {
|
|
374
|
+
return {
|
|
375
|
+
packed: (await gzipped(Buffer.from(JSON.stringify(chat)))).toString("base64"),
|
|
376
|
+
sessionId: chat.sessionId,
|
|
377
|
+
...chat.base ? { base: chat.base } : {},
|
|
378
|
+
count: chat.messages.length
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
async function unpackChat(chat) {
|
|
382
|
+
if (!("packed" in chat)) return chat;
|
|
383
|
+
return JSON.parse((await gunzipped(Buffer.from(chat.packed, "base64"))).toString("utf8"));
|
|
384
|
+
}
|
|
385
|
+
export {
|
|
386
|
+
answerMoveRequest,
|
|
387
|
+
chatHave,
|
|
388
|
+
exportChat,
|
|
389
|
+
importChat,
|
|
390
|
+
markMoved,
|
|
391
|
+
packChat,
|
|
392
|
+
planImport,
|
|
393
|
+
reclaimMovedChat,
|
|
394
|
+
unpackChat
|
|
395
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
getApiKeyForUrl,
|
|
5
|
+
getApiUrl
|
|
6
|
+
} from "./chunk-TQDM7S5N.js";
|
|
7
|
+
import {
|
|
8
|
+
modelLabel
|
|
9
|
+
} from "./chunk-F252T6Y3.js";
|
|
10
|
+
import "./chunk-TULAXS77.js";
|
|
11
|
+
import {
|
|
12
|
+
readState
|
|
13
|
+
} from "./chunk-MXS6S2PY.js";
|
|
14
|
+
import "./chunk-BISGNHKD.js";
|
|
15
|
+
import "./chunk-BGEMY2JJ.js";
|
|
16
|
+
import "./chunk-XCKQ5BM2.js";
|
|
17
|
+
import {
|
|
18
|
+
harnessCommand
|
|
19
|
+
} from "./chunk-NWEYRBWK.js";
|
|
20
|
+
import "./chunk-TWCVV2JO.js";
|
|
21
|
+
import "./chunk-PDPEM5VW.js";
|
|
22
|
+
import "./chunk-WWLJMP6D.js";
|
|
23
|
+
import "./chunk-CRUVYGO2.js";
|
|
24
|
+
import "./chunk-FF7ZVYJF.js";
|
|
25
|
+
import "./chunk-IMLTL2MY.js";
|
|
26
|
+
import "./chunk-BUOPJQP5.js";
|
|
27
|
+
import "./chunk-3B2CHX7M.js";
|
|
28
|
+
import "./chunk-RVUOIJXN.js";
|
|
29
|
+
import "./chunk-QUS4ER2W.js";
|
|
30
|
+
import "./chunk-DQYVQ2N7.js";
|
|
31
|
+
import "./chunk-KYUHIFP3.js";
|
|
32
|
+
import "./chunk-RSZGEL5U.js";
|
|
33
|
+
import "./chunk-NKDATMEM.js";
|
|
34
|
+
import "./chunk-CQ7J6UQ7.js";
|
|
35
|
+
import "./chunk-XKW5NDMR.js";
|
|
36
|
+
import "./chunk-W3YYPBEA.js";
|
|
37
|
+
import "./chunk-XIBYREEY.js";
|
|
38
|
+
import "./chunk-EE4B6A7W.js";
|
|
39
|
+
import "./chunk-WZYVLUVQ.js";
|
|
40
|
+
import "./chunk-O3EW7LAY.js";
|
|
41
|
+
import "./chunk-KHW6TX6I.js";
|
|
42
|
+
import "./chunk-YMCH3L2S.js";
|
|
43
|
+
import {
|
|
44
|
+
emitResult
|
|
45
|
+
} from "./chunk-JGIWATSG.js";
|
|
46
|
+
import {
|
|
47
|
+
isJsonDefaultMode
|
|
48
|
+
} from "./chunk-5B6TVO4A.js";
|
|
49
|
+
import {
|
|
50
|
+
CLIKCODE_USER_AGENT
|
|
51
|
+
} from "./chunk-NAOX3JUB.js";
|
|
52
|
+
import "./chunk-4QZEZME7.js";
|
|
53
|
+
import "./chunk-LVRRWP4W.js";
|
|
54
|
+
import "./chunk-G3QP67Z7.js";
|
|
55
|
+
import "./chunk-4L2ZZM4Q.js";
|
|
56
|
+
import "./chunk-F6F47QAY.js";
|
|
57
|
+
import {
|
|
58
|
+
quiet
|
|
59
|
+
} from "./chunk-RDDWQBEM.js";
|
|
60
|
+
import "./chunk-MPAJ446F.js";
|
|
61
|
+
import "./chunk-CBANJFBO.js";
|
|
62
|
+
import "./chunk-PWXII6HF.js";
|
|
63
|
+
|
|
64
|
+
// src/commands/ai/status.ts
|
|
65
|
+
async function aiModelsList() {
|
|
66
|
+
const state = await readState({ transcripts: [] });
|
|
67
|
+
emitResult({
|
|
68
|
+
models: state.accounts.flatMap((account) => account.models.map((model) => ({
|
|
69
|
+
accountId: account.id,
|
|
70
|
+
account: account.label,
|
|
71
|
+
provider: account.provider,
|
|
72
|
+
model,
|
|
73
|
+
// How ClikCode shows it beside the provider; `model` stays the real id.
|
|
74
|
+
label: modelLabel(model, account.provider),
|
|
75
|
+
status: account.status
|
|
76
|
+
})))
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async function aiUsage(now = Date.now()) {
|
|
80
|
+
const state = await readState({ transcripts: [] });
|
|
81
|
+
const [{ usageDays, usageReportAll }, { invocationRollups, invocationTokenCount }, { localHarnessForProvider }] = await Promise.all([
|
|
82
|
+
import("./chunk-5BJLDUPL.js"),
|
|
83
|
+
import("./chunk-W5GZOIUF.js"),
|
|
84
|
+
import("./chunk-GGK43Q3N.js")
|
|
85
|
+
]);
|
|
86
|
+
const name = (provider) => localHarnessForProvider(provider)?.displayName ?? provider;
|
|
87
|
+
if (!isJsonDefaultMode()) {
|
|
88
|
+
process.stdout.write(`${usageReportAll(state, { accountId: null }, { now, providerName: name }).text}
|
|
89
|
+
`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const providers = /* @__PURE__ */ new Map();
|
|
93
|
+
const row = (provider) => providers.get(provider) ?? providers.set(provider, { provider, name: name(provider), turns: 0, maintenance: 0, inputTokens: 0, outputTokens: 0, totalTokens: 0, costUsd: 0, unknownCostCalls: 0 }).get(provider);
|
|
94
|
+
for (const invocation of state.invocations) {
|
|
95
|
+
const totals = row(invocation.provider);
|
|
96
|
+
if (invocation.kind === "maintenance") totals.maintenance += 1;
|
|
97
|
+
else totals.turns += 1;
|
|
98
|
+
totals.inputTokens += invocation.inputTokens ?? 0;
|
|
99
|
+
totals.outputTokens += invocation.outputTokens ?? 0;
|
|
100
|
+
totals.totalTokens += invocationTokenCount(invocation);
|
|
101
|
+
if (invocation.costUsd === void 0) totals.unknownCostCalls += 1;
|
|
102
|
+
else totals.costUsd += invocation.costUsd;
|
|
103
|
+
}
|
|
104
|
+
for (const rollup of invocationRollups(state)) {
|
|
105
|
+
const totals = row(rollup.provider);
|
|
106
|
+
totals.maintenance += rollup.maintenanceCalls ?? 0;
|
|
107
|
+
totals.turns += rollup.calls - (rollup.maintenanceCalls ?? 0);
|
|
108
|
+
totals.inputTokens += rollup.inputTokens;
|
|
109
|
+
totals.outputTokens += rollup.outputTokens;
|
|
110
|
+
totals.totalTokens += rollup.totalTokens ?? rollup.inputTokens + rollup.outputTokens;
|
|
111
|
+
totals.unknownCostCalls += rollup.calls;
|
|
112
|
+
}
|
|
113
|
+
emitResult({ providers: [...providers.values()].sort((left, right) => left.name.localeCompare(right.name)), days: usageDays(state, now) });
|
|
114
|
+
}
|
|
115
|
+
async function aiGatewayStatus(config) {
|
|
116
|
+
const apiUrl = getApiUrl(config);
|
|
117
|
+
const connected = Boolean(getApiKeyForUrl(config, apiUrl));
|
|
118
|
+
emitResult({
|
|
119
|
+
route: "gateway",
|
|
120
|
+
connected,
|
|
121
|
+
apiUrl,
|
|
122
|
+
authentication: "oauth-or-api-key",
|
|
123
|
+
credentialBoundary: "gateway-auth-only",
|
|
124
|
+
// How to connect is only worth saying to someone who is not.
|
|
125
|
+
...connected ? {} : {
|
|
126
|
+
hint: `Run \`${harnessCommand()} gateway login\` to connect ClikDeploy Gateway, or use \`${harnessCommand()} accounts add\` for a provider login that stays local.`
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function gatewayErrorReason(body, status, missing) {
|
|
131
|
+
const error = body?.error;
|
|
132
|
+
if (typeof error === "string" && error) return error;
|
|
133
|
+
if (error && typeof error === "object" && typeof error.message === "string") return error.message;
|
|
134
|
+
return status === 404 ? missing : `HTTP ${status}`;
|
|
135
|
+
}
|
|
136
|
+
async function aiGatewayUsage(config, options = {}, fetchImpl = fetch) {
|
|
137
|
+
const apiUrl = getApiUrl(config);
|
|
138
|
+
const apiKey = getApiKeyForUrl(config, apiUrl);
|
|
139
|
+
if (!apiKey) throw new Error(`Not signed in to ClikDeploy Gateway. Run \`${harnessCommand()} gateway login\`.`);
|
|
140
|
+
const days = options.days === void 0 ? void 0 : Number(options.days);
|
|
141
|
+
if (days !== void 0 && (!Number.isInteger(days) || days < 1 || days > 90)) throw new Error("--days must be a whole number from 1 to 90");
|
|
142
|
+
const url = new URL("/v1/usage", apiUrl);
|
|
143
|
+
if (days !== void 0) url.searchParams.set("days", String(days));
|
|
144
|
+
const headers = { authorization: `Bearer ${apiKey}`, accept: "application/json", "user-agent": CLIKCODE_USER_AGENT };
|
|
145
|
+
const [response, creditResponse] = await Promise.all([fetchImpl(url, { headers }), fetchImpl(new URL("/v1/credits", apiUrl), { headers })]);
|
|
146
|
+
const body = await response.json().catch(quiet("commands/ai/status"));
|
|
147
|
+
if (!response.ok || !body?.data) {
|
|
148
|
+
throw Object.assign(new Error(`ClikDeploy Gateway usage: ${gatewayErrorReason(body, response.status, "this Gateway does not report usage yet")}`), { statusCode: response.status });
|
|
149
|
+
}
|
|
150
|
+
const credit = await creditResponse.json().catch(quiet("commands/ai/status"));
|
|
151
|
+
emitResult({ apiUrl, ...body.data, ...creditResponse.ok && credit?.data ? { credit: credit.data } : {} });
|
|
152
|
+
}
|
|
153
|
+
async function aiGatewayCredit(config, options = {}, deps = {}) {
|
|
154
|
+
const apiUrl = getApiUrl(config);
|
|
155
|
+
const apiKey = getApiKeyForUrl(config, apiUrl);
|
|
156
|
+
if (!apiKey) throw new Error(`Not signed in to ClikDeploy Gateway. Run \`${harnessCommand()} gateway login\`.`);
|
|
157
|
+
if (options.autoTopup !== void 0) {
|
|
158
|
+
await setAutoTopUp(apiUrl, apiKey, options.autoTopup, deps.fetchImpl ?? fetch);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const amountUsd = options.amount === void 0 ? void 0 : Number(options.amount);
|
|
162
|
+
if (amountUsd !== void 0 && (!Number.isInteger(amountUsd) || amountUsd < 5 || amountUsd > 500)) {
|
|
163
|
+
throw new Error("--amount must be a whole number of dollars from 5 to 500");
|
|
164
|
+
}
|
|
165
|
+
const response = await (deps.fetchImpl ?? fetch)(new URL("/v1/credits/checkout", apiUrl), {
|
|
166
|
+
method: "POST",
|
|
167
|
+
headers: { authorization: `Bearer ${apiKey}`, accept: "application/json", "content-type": "application/json", "user-agent": CLIKCODE_USER_AGENT },
|
|
168
|
+
body: JSON.stringify(amountUsd === void 0 ? {} : { amountUsd })
|
|
169
|
+
});
|
|
170
|
+
const body = await response.json().catch(quiet("commands/ai/status"));
|
|
171
|
+
const url = typeof body?.data?.url === "string" ? body.data.url : void 0;
|
|
172
|
+
if (!response.ok || !url) {
|
|
173
|
+
throw Object.assign(new Error(`ClikDeploy Gateway credit: ${gatewayErrorReason(body, response.status, "this Gateway does not sell credit yet")}`), { statusCode: response.status });
|
|
174
|
+
}
|
|
175
|
+
const { hasLocalDisplay, openLoginUrl } = await import("./chunk-6Y7HLXGW.js");
|
|
176
|
+
const opened = hasLocalDisplay(deps.environment ?? process.env);
|
|
177
|
+
if (opened) (deps.open ?? openLoginUrl)(url);
|
|
178
|
+
emitResult({ apiUrl, checkoutUrl: url, amountCents: body?.data?.amountCents ?? null, opened });
|
|
179
|
+
}
|
|
180
|
+
async function setAutoTopUp(apiUrl, apiKey, value, fetchImpl) {
|
|
181
|
+
const word = value.trim().toLowerCase();
|
|
182
|
+
if (word !== "on" && word !== "off") throw new Error("--auto-topup must be on or off");
|
|
183
|
+
const response = await fetchImpl(new URL("/v1/credits", apiUrl), {
|
|
184
|
+
method: "PATCH",
|
|
185
|
+
headers: { authorization: `Bearer ${apiKey}`, accept: "application/json", "content-type": "application/json", "user-agent": CLIKCODE_USER_AGENT },
|
|
186
|
+
body: JSON.stringify({ autoTopUpEnabled: word === "on" })
|
|
187
|
+
});
|
|
188
|
+
const body = await response.json().catch(quiet("commands/ai/status"));
|
|
189
|
+
if (!response.ok || typeof body?.data?.autoTopUpEnabled !== "boolean") {
|
|
190
|
+
throw Object.assign(new Error(`ClikDeploy Gateway auto top-up: ${gatewayErrorReason(body, response.status, "this Gateway does not offer automatic top-up yet")}`), { statusCode: response.status });
|
|
191
|
+
}
|
|
192
|
+
emitResult({ apiUrl, autoTopUpEnabled: body.data.autoTopUpEnabled });
|
|
193
|
+
}
|
|
194
|
+
async function aiGatewayModels(config) {
|
|
195
|
+
const { gatewayModels, gatewayPriceLabel } = await import("./chunk-BXPQFSX5.js");
|
|
196
|
+
const { models } = await gatewayModels({ config, fresh: true });
|
|
197
|
+
emitResult({
|
|
198
|
+
// The model, its price and what it can do: which provider serves it is the Gateway's decision.
|
|
199
|
+
models: models.map((model) => ({
|
|
200
|
+
id: model.id,
|
|
201
|
+
...model.access ? { access: model.access } : {},
|
|
202
|
+
...model.tags?.length ? { tags: model.tags } : {},
|
|
203
|
+
...model.price ? { price: gatewayPriceLabel(model.price), priceUsdPerMTok: model.price } : {},
|
|
204
|
+
...model.contextWindow ? { contextWindow: model.contextWindow } : {},
|
|
205
|
+
...model.maxOutput ? { maxOutput: model.maxOutput } : {},
|
|
206
|
+
...model.vision ? { vision: true } : {},
|
|
207
|
+
...model.reasoning ? { reasoning: true } : {},
|
|
208
|
+
...model.tokensPerSecond ? { tokensPerSecond: model.tokensPerSecond } : {},
|
|
209
|
+
// One of your own models, on ClikDeploy compute: how it is (running, starting, asleep), and whether it takes tools.
|
|
210
|
+
...model.own ? { own: model.own } : {}
|
|
211
|
+
}))
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
export {
|
|
215
|
+
aiGatewayCredit,
|
|
216
|
+
aiGatewayModels,
|
|
217
|
+
aiGatewayStatus,
|
|
218
|
+
aiGatewayUsage,
|
|
219
|
+
aiModelsList,
|
|
220
|
+
aiUsage
|
|
221
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
announceWhenReady,
|
|
5
|
+
peerFromStatus,
|
|
6
|
+
recordPeer,
|
|
7
|
+
startBridge,
|
|
8
|
+
validPeer,
|
|
9
|
+
withPeer
|
|
10
|
+
} from "./chunk-X6WF7JEV.js";
|
|
11
|
+
import "./chunk-UFQ5A5PW.js";
|
|
12
|
+
import "./chunk-AZVD74ZV.js";
|
|
13
|
+
import "./chunk-NWEYRBWK.js";
|
|
14
|
+
import "./chunk-CQ7J6UQ7.js";
|
|
15
|
+
import "./chunk-NAOX3JUB.js";
|
|
16
|
+
import "./chunk-G3QP67Z7.js";
|
|
17
|
+
import "./chunk-F6F47QAY.js";
|
|
18
|
+
import "./chunk-RDDWQBEM.js";
|
|
19
|
+
import "./chunk-MPAJ446F.js";
|
|
20
|
+
import "./chunk-CBANJFBO.js";
|
|
21
|
+
import "./chunk-PWXII6HF.js";
|
|
22
|
+
export {
|
|
23
|
+
announceWhenReady,
|
|
24
|
+
peerFromStatus,
|
|
25
|
+
recordPeer,
|
|
26
|
+
startBridge,
|
|
27
|
+
validPeer,
|
|
28
|
+
withPeer
|
|
29
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
stateDirectory
|
|
5
|
+
} from "./chunk-MPAJ446F.js";
|
|
6
|
+
|
|
7
|
+
// src/session/state/paths.ts
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
var HARNESS_STATE_VERSION = 2;
|
|
10
|
+
function harnessIndexPath() {
|
|
11
|
+
return join(stateDirectory(), "index.json");
|
|
12
|
+
}
|
|
13
|
+
function harnessSecretsPath() {
|
|
14
|
+
return join(stateDirectory(), "secrets.json");
|
|
15
|
+
}
|
|
16
|
+
function harnessCommand() {
|
|
17
|
+
return "clikcode";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
HARNESS_STATE_VERSION,
|
|
22
|
+
harnessIndexPath,
|
|
23
|
+
harnessSecretsPath,
|
|
24
|
+
harnessCommand
|
|
25
|
+
};
|