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,88 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
quotaRetryHint,
|
|
5
|
+
quotaRollingWindowMs
|
|
6
|
+
} from "./chunk-2YPAPAR3.js";
|
|
7
|
+
import {
|
|
8
|
+
clearQuotaMark,
|
|
9
|
+
markQuotaExhausted,
|
|
10
|
+
vendorWindows,
|
|
11
|
+
windowKey,
|
|
12
|
+
windowSpent
|
|
13
|
+
} from "./chunk-XWAC3MKW.js";
|
|
14
|
+
import {
|
|
15
|
+
readState
|
|
16
|
+
} from "./chunk-MXS6S2PY.js";
|
|
17
|
+
import {
|
|
18
|
+
writeState
|
|
19
|
+
} from "./chunk-RKUVLRZI.js";
|
|
20
|
+
import {
|
|
21
|
+
localHarnessForProvider
|
|
22
|
+
} from "./chunk-KYUHIFP3.js";
|
|
23
|
+
|
|
24
|
+
// src/harness/accounts/quota-scope.ts
|
|
25
|
+
function quotaScopeForModel(account, model) {
|
|
26
|
+
if (!model) return void 0;
|
|
27
|
+
let scopes;
|
|
28
|
+
try {
|
|
29
|
+
scopes = localHarnessForProvider(account.provider)?.quotaScopes;
|
|
30
|
+
} catch {
|
|
31
|
+
scopes = void 0;
|
|
32
|
+
}
|
|
33
|
+
if (!scopes) return void 0;
|
|
34
|
+
const id = model.toLowerCase();
|
|
35
|
+
const family = Object.entries(scopes).find(([, words]) => words.some((word) => id.includes(word)))?.[0];
|
|
36
|
+
if (!family) return void 0;
|
|
37
|
+
const pool = vendorWindows(account).find((window) => window.name.toLowerCase().split(/[\/,+\s]+/).includes(family));
|
|
38
|
+
if (pool) return pool.name.toLowerCase().split(/[\/,+\s]+/).filter(Boolean).sort().join("+");
|
|
39
|
+
return family;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/turn/account-outcome.ts
|
|
43
|
+
function recordSuccessfulAccountTurn(account, model) {
|
|
44
|
+
const spent = vendorWindows(account).filter(windowSpent).map(windowKey);
|
|
45
|
+
if (spent.length) account.disprovenWindows = [.../* @__PURE__ */ new Set([...account.disprovenWindows ?? [], ...spent])];
|
|
46
|
+
clearQuotaMark(account);
|
|
47
|
+
const scope = quotaScopeForModel(account, model);
|
|
48
|
+
if (scope && account.quotaScopes?.[scope]) {
|
|
49
|
+
delete account.quotaScopes[scope];
|
|
50
|
+
if (!Object.keys(account.quotaScopes).length) account.quotaScopes = void 0;
|
|
51
|
+
}
|
|
52
|
+
account.verification = void 0;
|
|
53
|
+
}
|
|
54
|
+
function noteFreePlan(account, failure) {
|
|
55
|
+
if (account.plan) return;
|
|
56
|
+
const carried = failure ?? {};
|
|
57
|
+
const text = [carried.stderrTail, carried.message].filter((part) => typeof part === "string").join("\n");
|
|
58
|
+
if (/free-usage-exhausted/i.test(text)) account.plan = { name: "Free" };
|
|
59
|
+
}
|
|
60
|
+
function recordQuotaRefusal(state, account, failure, now = Date.now(), model) {
|
|
61
|
+
account.disprovenWindows = void 0;
|
|
62
|
+
noteFreePlan(account, failure);
|
|
63
|
+
const named = quotaRetryHint(failure, now);
|
|
64
|
+
const windowMs = quotaRollingWindowMs(failure);
|
|
65
|
+
const exact = windowMs ? void 0 : named;
|
|
66
|
+
const spentReset = vendorWindows(account).filter((window) => windowSpent(window) && window.resetsAt !== void 0 && Date.parse(window.resetsAt) > now).map((window) => window.resetsAt).sort().at(-1);
|
|
67
|
+
const retryAt = exact ?? spentReset ?? named;
|
|
68
|
+
const scope = quotaScopeForModel(account, model);
|
|
69
|
+
if (scope) {
|
|
70
|
+
account.quotaScopes ??= {};
|
|
71
|
+
account.quotaScopes[scope] = { exhaustedAt: new Date(now).toISOString(), ...retryAt ? { retryAt } : {} };
|
|
72
|
+
} else markQuotaExhausted(account, now, retryAt);
|
|
73
|
+
}
|
|
74
|
+
async function storeQuotaRefusal(accountId, failure) {
|
|
75
|
+
const state = await readState({ transcripts: [] });
|
|
76
|
+
const account = state.accounts.find((item) => item.id === accountId);
|
|
77
|
+
if (!account) return false;
|
|
78
|
+
recordQuotaRefusal(state, account, failure);
|
|
79
|
+
await writeState(state);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
quotaScopeForModel,
|
|
85
|
+
recordSuccessfulAccountTurn,
|
|
86
|
+
recordQuotaRefusal,
|
|
87
|
+
storeQuotaRefusal
|
|
88
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
beginJournal,
|
|
5
|
+
exportJournal,
|
|
6
|
+
importJournal,
|
|
7
|
+
noteStep,
|
|
8
|
+
recordVerified,
|
|
9
|
+
recordableStep,
|
|
10
|
+
safeText
|
|
11
|
+
} from "./chunk-3RXBMYKZ.js";
|
|
12
|
+
import {
|
|
13
|
+
compactSteps
|
|
14
|
+
} from "./chunk-34JQYQCA.js";
|
|
15
|
+
import "./chunk-JYBONKD4.js";
|
|
16
|
+
import "./chunk-OQ245JLA.js";
|
|
17
|
+
import "./chunk-MCBRVPA7.js";
|
|
18
|
+
import "./chunk-YMCH3L2S.js";
|
|
19
|
+
import "./chunk-CBANJFBO.js";
|
|
20
|
+
import "./chunk-PWXII6HF.js";
|
|
21
|
+
export {
|
|
22
|
+
beginJournal,
|
|
23
|
+
compactSteps,
|
|
24
|
+
exportJournal,
|
|
25
|
+
importJournal,
|
|
26
|
+
noteStep,
|
|
27
|
+
recordVerified,
|
|
28
|
+
recordableStep,
|
|
29
|
+
safeText
|
|
30
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
aiSessionClose,
|
|
5
|
+
aiSessionCreate,
|
|
6
|
+
aiSessionLeave,
|
|
7
|
+
aiSessionSet,
|
|
8
|
+
aiSessionShow,
|
|
9
|
+
aiSessionsList,
|
|
10
|
+
applyClikCodeAgentSessionPolicy,
|
|
11
|
+
applyClikCodeLocalSessionPolicy,
|
|
12
|
+
applyFreshLocalSessionPolicy,
|
|
13
|
+
applyGatewaySessionPolicy,
|
|
14
|
+
assertRealModel,
|
|
15
|
+
chooseGatewayModel,
|
|
16
|
+
launchSession,
|
|
17
|
+
selectGatewayAgent
|
|
18
|
+
} from "./chunk-RJLPTWHW.js";
|
|
19
|
+
import "./chunk-2EOL5PZL.js";
|
|
20
|
+
import "./chunk-MDT5XDXL.js";
|
|
21
|
+
import "./chunk-UYEEMIWR.js";
|
|
22
|
+
import "./chunk-TVT45XNH.js";
|
|
23
|
+
import "./chunk-K2NLG2HK.js";
|
|
24
|
+
import "./chunk-EOBTJV32.js";
|
|
25
|
+
import "./chunk-7AULZ7OD.js";
|
|
26
|
+
import "./chunk-UA5K2BTI.js";
|
|
27
|
+
import "./chunk-IF43HIGV.js";
|
|
28
|
+
import "./chunk-7TSQLONI.js";
|
|
29
|
+
import "./chunk-2YPAPAR3.js";
|
|
30
|
+
import "./chunk-DGASQT26.js";
|
|
31
|
+
import "./chunk-PUOVIFHW.js";
|
|
32
|
+
import "./chunk-LA6MG4ET.js";
|
|
33
|
+
import "./chunk-N3SFDYM7.js";
|
|
34
|
+
import "./chunk-4RHXTL3W.js";
|
|
35
|
+
import "./chunk-W5AYOICN.js";
|
|
36
|
+
import "./chunk-2OLS7V66.js";
|
|
37
|
+
import "./chunk-2QWPQRSU.js";
|
|
38
|
+
import "./chunk-IS4USJPY.js";
|
|
39
|
+
import "./chunk-2BBELGHY.js";
|
|
40
|
+
import "./chunk-QYHI3YET.js";
|
|
41
|
+
import "./chunk-4LPDG57B.js";
|
|
42
|
+
import "./chunk-TQDM7S5N.js";
|
|
43
|
+
import "./chunk-TQDKJHWX.js";
|
|
44
|
+
import "./chunk-GQBZU6EO.js";
|
|
45
|
+
import "./chunk-SQVUDO2O.js";
|
|
46
|
+
import "./chunk-RE4TGORR.js";
|
|
47
|
+
import "./chunk-DCZ6CIUM.js";
|
|
48
|
+
import "./chunk-M3FO5UMK.js";
|
|
49
|
+
import "./chunk-CERF3RIB.js";
|
|
50
|
+
import "./chunk-QQRLPY25.js";
|
|
51
|
+
import "./chunk-DA44ZENT.js";
|
|
52
|
+
import "./chunk-F252T6Y3.js";
|
|
53
|
+
import "./chunk-XWAC3MKW.js";
|
|
54
|
+
import "./chunk-CVFVFRGN.js";
|
|
55
|
+
import "./chunk-QJP7EYGL.js";
|
|
56
|
+
import "./chunk-ESF3DIZY.js";
|
|
57
|
+
import "./chunk-R7QN6ONS.js";
|
|
58
|
+
import "./chunk-ZN7G6JLS.js";
|
|
59
|
+
import "./chunk-ZGX3ERAT.js";
|
|
60
|
+
import "./chunk-PEWCDI2C.js";
|
|
61
|
+
import "./chunk-TULAXS77.js";
|
|
62
|
+
import "./chunk-ZZCBDNZI.js";
|
|
63
|
+
import "./chunk-MXS6S2PY.js";
|
|
64
|
+
import "./chunk-BISGNHKD.js";
|
|
65
|
+
import "./chunk-RKUVLRZI.js";
|
|
66
|
+
import "./chunk-BGEMY2JJ.js";
|
|
67
|
+
import "./chunk-XCKQ5BM2.js";
|
|
68
|
+
import "./chunk-NWEYRBWK.js";
|
|
69
|
+
import "./chunk-TWCVV2JO.js";
|
|
70
|
+
import "./chunk-PDPEM5VW.js";
|
|
71
|
+
import "./chunk-WWLJMP6D.js";
|
|
72
|
+
import "./chunk-CRUVYGO2.js";
|
|
73
|
+
import "./chunk-FF7ZVYJF.js";
|
|
74
|
+
import "./chunk-IMLTL2MY.js";
|
|
75
|
+
import "./chunk-BUOPJQP5.js";
|
|
76
|
+
import "./chunk-3B2CHX7M.js";
|
|
77
|
+
import "./chunk-RVUOIJXN.js";
|
|
78
|
+
import "./chunk-QUS4ER2W.js";
|
|
79
|
+
import "./chunk-DQYVQ2N7.js";
|
|
80
|
+
import "./chunk-KYUHIFP3.js";
|
|
81
|
+
import "./chunk-RSZGEL5U.js";
|
|
82
|
+
import "./chunk-NKDATMEM.js";
|
|
83
|
+
import "./chunk-DF35KMXM.js";
|
|
84
|
+
import "./chunk-ZT7B4H2V.js";
|
|
85
|
+
import "./chunk-OL4JBD3J.js";
|
|
86
|
+
import "./chunk-IGZ6C2MC.js";
|
|
87
|
+
import "./chunk-4NN3XQQT.js";
|
|
88
|
+
import "./chunk-4AQ5NINV.js";
|
|
89
|
+
import "./chunk-WPB5WEZJ.js";
|
|
90
|
+
import "./chunk-GYMAI5NY.js";
|
|
91
|
+
import "./chunk-CQ7J6UQ7.js";
|
|
92
|
+
import "./chunk-XKW5NDMR.js";
|
|
93
|
+
import "./chunk-W3YYPBEA.js";
|
|
94
|
+
import "./chunk-XIBYREEY.js";
|
|
95
|
+
import "./chunk-EE4B6A7W.js";
|
|
96
|
+
import "./chunk-WZYVLUVQ.js";
|
|
97
|
+
import "./chunk-O3EW7LAY.js";
|
|
98
|
+
import "./chunk-KHW6TX6I.js";
|
|
99
|
+
import "./chunk-YMCH3L2S.js";
|
|
100
|
+
import "./chunk-JGIWATSG.js";
|
|
101
|
+
import "./chunk-5B6TVO4A.js";
|
|
102
|
+
import "./chunk-NAOX3JUB.js";
|
|
103
|
+
import "./chunk-4QZEZME7.js";
|
|
104
|
+
import "./chunk-LVRRWP4W.js";
|
|
105
|
+
import "./chunk-GGYKY4GF.js";
|
|
106
|
+
import "./chunk-5SM5UAWN.js";
|
|
107
|
+
import "./chunk-PAXYQZH7.js";
|
|
108
|
+
import "./chunk-G3QP67Z7.js";
|
|
109
|
+
import "./chunk-4L2ZZM4Q.js";
|
|
110
|
+
import "./chunk-F6F47QAY.js";
|
|
111
|
+
import "./chunk-RDDWQBEM.js";
|
|
112
|
+
import "./chunk-MPAJ446F.js";
|
|
113
|
+
import "./chunk-CBANJFBO.js";
|
|
114
|
+
import "./chunk-PWXII6HF.js";
|
|
115
|
+
export {
|
|
116
|
+
aiSessionClose,
|
|
117
|
+
aiSessionCreate,
|
|
118
|
+
aiSessionLeave,
|
|
119
|
+
aiSessionSet,
|
|
120
|
+
aiSessionShow,
|
|
121
|
+
aiSessionsList,
|
|
122
|
+
applyClikCodeAgentSessionPolicy,
|
|
123
|
+
applyClikCodeLocalSessionPolicy,
|
|
124
|
+
applyFreshLocalSessionPolicy,
|
|
125
|
+
applyGatewaySessionPolicy,
|
|
126
|
+
assertRealModel,
|
|
127
|
+
chooseGatewayModel,
|
|
128
|
+
launchSession,
|
|
129
|
+
selectGatewayAgent
|
|
130
|
+
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
deskHeldTargets
|
|
5
|
+
} from "./chunk-4GVEJ5FK.js";
|
|
6
|
+
import {
|
|
7
|
+
pidIsAlive
|
|
8
|
+
} from "./chunk-4L2ZZM4Q.js";
|
|
9
|
+
import {
|
|
10
|
+
atomicWriteFile
|
|
11
|
+
} from "./chunk-F6F47QAY.js";
|
|
12
|
+
import {
|
|
13
|
+
lifecycle,
|
|
14
|
+
quiet,
|
|
15
|
+
swallowed
|
|
16
|
+
} from "./chunk-RDDWQBEM.js";
|
|
17
|
+
|
|
18
|
+
// src/agent/computer/tab-registry.ts
|
|
19
|
+
import fs from "node:fs/promises";
|
|
20
|
+
import path from "node:path";
|
|
21
|
+
var envNumber = (name, fallback, env) => {
|
|
22
|
+
const value = Number(env[name]);
|
|
23
|
+
return Number.isFinite(value) && value > 0 ? value : fallback;
|
|
24
|
+
};
|
|
25
|
+
function tabLimits(env = process.env) {
|
|
26
|
+
return { idleMs: envNumber("CLIKCODE_BROWSER_TAB_IDLE_MS", 20 * 6e4, env), maxTabs: Math.floor(envNumber("CLIKCODE_BROWSER_MAX_TABS", 12, env)) };
|
|
27
|
+
}
|
|
28
|
+
var PARKED_MS = 6 * 36e5;
|
|
29
|
+
var ACTIVE_MS = 1e4;
|
|
30
|
+
var tabsDirectory = (stateDir) => path.join(stateDir, "computer", "tabs");
|
|
31
|
+
var tabFile = (stateDir, id) => path.join(tabsDirectory(stateDir), `${id.replace(/[^A-Za-z0-9_-]/g, "_")}.json`);
|
|
32
|
+
async function writeTabRecord(stateDir, record) {
|
|
33
|
+
try {
|
|
34
|
+
await atomicWriteFile(tabFile(stateDir, record.id), JSON.stringify(record), { durable: false });
|
|
35
|
+
} catch (error) {
|
|
36
|
+
quiet("agent/computer/tab-registry")(error);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function removeTabRecord(stateDir, id) {
|
|
40
|
+
await fs.unlink(tabFile(stateDir, id)).catch(quiet("agent/computer/tab-registry"));
|
|
41
|
+
}
|
|
42
|
+
async function readTabRecords(stateDir) {
|
|
43
|
+
const names = await fs.readdir(tabsDirectory(stateDir)).catch(() => []);
|
|
44
|
+
const records = [];
|
|
45
|
+
for (const name of names) {
|
|
46
|
+
if (!name.endsWith(".json")) continue;
|
|
47
|
+
try {
|
|
48
|
+
const record = JSON.parse(await fs.readFile(path.join(tabsDirectory(stateDir), name), "utf8"));
|
|
49
|
+
if (typeof record.id === "string" && Number.isFinite(record.lastUsedAt) && Number.isFinite(record.openedAt)) records.push(record);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
swallowed("agent/computer/tab-registry", error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return records;
|
|
55
|
+
}
|
|
56
|
+
function planTabClosures(input) {
|
|
57
|
+
const { records, liveIds, now, limits, alive } = input;
|
|
58
|
+
const deskHeld = input.deskHeld ?? /* @__PURE__ */ new Set();
|
|
59
|
+
const forget = records.filter((record) => !liveIds.has(record.id)).map((record) => record.id);
|
|
60
|
+
const live = records.filter((record) => liveIds.has(record.id));
|
|
61
|
+
const close = [];
|
|
62
|
+
const kept = [];
|
|
63
|
+
for (const record of live) {
|
|
64
|
+
const idle = now - record.lastUsedAt;
|
|
65
|
+
if (deskHeld.has(record.id)) kept.push(record);
|
|
66
|
+
else if (record.parked) {
|
|
67
|
+
if (idle >= PARKED_MS) close.push({ id: record.id, reason: "idle" });
|
|
68
|
+
else kept.push(record);
|
|
69
|
+
} else if (record.ownerPid > 0 && !alive(record.ownerPid)) close.push({ id: record.id, reason: "owner ended" });
|
|
70
|
+
else if (idle >= limits.idleMs) close.push({ id: record.id, reason: "idle" });
|
|
71
|
+
else kept.push(record);
|
|
72
|
+
}
|
|
73
|
+
let excess = kept.length - limits.maxTabs;
|
|
74
|
+
for (const record of [...kept].sort((a, b) => a.lastUsedAt - b.lastUsedAt)) {
|
|
75
|
+
if (excess <= 0) break;
|
|
76
|
+
if (record.parked || deskHeld.has(record.id) || now - record.lastUsedAt < ACTIVE_MS) continue;
|
|
77
|
+
close.push({ id: record.id, reason: "over the tab cap" });
|
|
78
|
+
excess--;
|
|
79
|
+
}
|
|
80
|
+
return { close, forget };
|
|
81
|
+
}
|
|
82
|
+
async function devToolsBase(stateDir) {
|
|
83
|
+
try {
|
|
84
|
+
const port = Number((await fs.readFile(path.join(stateDir, "computer", "chrome", "DevToolsActivePort"), "utf8")).split("\n")[0]);
|
|
85
|
+
return Number.isInteger(port) && port > 0 && port < 65536 ? `http://127.0.0.1:${port}` : void 0;
|
|
86
|
+
} catch {
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function listBrowserTargets(stateDir) {
|
|
91
|
+
const base = await devToolsBase(stateDir);
|
|
92
|
+
if (!base) return void 0;
|
|
93
|
+
try {
|
|
94
|
+
const response = await fetch(`${base}/json/list`, { signal: AbortSignal.timeout(5e3) });
|
|
95
|
+
if (!response.ok) return void 0;
|
|
96
|
+
const all = await response.json();
|
|
97
|
+
return all.filter((target) => target.type === "page" && !/^devtools:/.test(target.url));
|
|
98
|
+
} catch {
|
|
99
|
+
return void 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async function closeBrowserTarget(stateDir, id) {
|
|
103
|
+
const base = await devToolsBase(stateDir);
|
|
104
|
+
if (!base) return false;
|
|
105
|
+
try {
|
|
106
|
+
return (await fetch(`${base}/json/close/${encodeURIComponent(id)}`, { signal: AbortSignal.timeout(5e3) })).ok;
|
|
107
|
+
} catch {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
var firstSeen = /* @__PURE__ */ new Map();
|
|
112
|
+
async function allTabs(stateDir, deps = {}) {
|
|
113
|
+
const now = deps.now ?? Date.now();
|
|
114
|
+
const targets = await (deps.list ?? (() => listBrowserTargets(stateDir)))();
|
|
115
|
+
if (!targets) return void 0;
|
|
116
|
+
const byId = new Map((await readTabRecords(stateDir)).map((record) => [record.id, record]));
|
|
117
|
+
return targets.map((target) => {
|
|
118
|
+
const record = byId.get(target.id);
|
|
119
|
+
if (record) return { ...record, url: target.url || record.url, ...target.title ? { title: target.title } : {}, recorded: true };
|
|
120
|
+
if (!firstSeen.has(target.id)) firstSeen.set(target.id, now);
|
|
121
|
+
const since = firstSeen.get(target.id);
|
|
122
|
+
return { id: target.id, ownerPid: 0, owner: "not recorded (opened before tracking)", openedAt: since, lastUsedAt: since, url: target.url, ...target.title ? { title: target.title } : {}, recorded: false };
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function logName(view) {
|
|
126
|
+
let url = view.url ?? "";
|
|
127
|
+
try {
|
|
128
|
+
const parsed = new URL(url);
|
|
129
|
+
url = `${parsed.origin}${parsed.pathname}`;
|
|
130
|
+
} catch {
|
|
131
|
+
}
|
|
132
|
+
return { tab: view.tab ?? "(default)", owner: view.owner, url: url.slice(0, 120) };
|
|
133
|
+
}
|
|
134
|
+
async function closeTabLogged(stateDir, view, reason, deps = {}) {
|
|
135
|
+
const now = deps.now ?? Date.now();
|
|
136
|
+
const closed = await (deps.close ?? ((id) => closeBrowserTarget(stateDir, id)))(view.id);
|
|
137
|
+
if (closed) {
|
|
138
|
+
await removeTabRecord(stateDir, view.id);
|
|
139
|
+
firstSeen.delete(view.id);
|
|
140
|
+
lifecycle("browser.tab.closed", { id: view.id, reason, ageMs: now - view.openedAt, idleMs: now - view.lastUsedAt, ...logName(view) });
|
|
141
|
+
}
|
|
142
|
+
return closed;
|
|
143
|
+
}
|
|
144
|
+
async function sweepTabs(stateDir, deps = {}) {
|
|
145
|
+
const now = deps.now ?? Date.now();
|
|
146
|
+
const views = await allTabs(stateDir, { now, ...deps.list ? { list: deps.list } : {} });
|
|
147
|
+
if (!views) return [];
|
|
148
|
+
const live = new Set(views.map((view) => view.id));
|
|
149
|
+
const records = await readTabRecords(stateDir);
|
|
150
|
+
const deskHeld = await deskHeldTargets(stateDir, now).catch(() => /* @__PURE__ */ new Set());
|
|
151
|
+
const plan = planTabClosures({ records: views, liveIds: live, now, limits: deps.limits ?? tabLimits(), alive: deps.alive ?? pidIsAlive, deskHeld });
|
|
152
|
+
for (const id of records.map((record) => record.id)) if (!live.has(id)) await removeTabRecord(stateDir, id);
|
|
153
|
+
for (const id of firstSeen.keys()) if (!live.has(id)) firstSeen.delete(id);
|
|
154
|
+
let closes = plan.close;
|
|
155
|
+
if (closes.length >= views.length && views.length) {
|
|
156
|
+
const spare = [...views].sort((a, b) => b.lastUsedAt - a.lastUsedAt)[0].id;
|
|
157
|
+
closes = closes.filter((entry) => entry.id !== spare);
|
|
158
|
+
}
|
|
159
|
+
const done = [];
|
|
160
|
+
for (const entry of closes) {
|
|
161
|
+
const view = views.find((item) => item.id === entry.id);
|
|
162
|
+
if (await closeTabLogged(stateDir, view, entry.reason, { ...deps, now })) done.push({ view, reason: entry.reason });
|
|
163
|
+
}
|
|
164
|
+
return done;
|
|
165
|
+
}
|
|
166
|
+
async function closeTabsByLabel(stateDir, label, deps = {}) {
|
|
167
|
+
const views = await allTabs(stateDir, deps.list ? { list: deps.list } : {}) ?? [];
|
|
168
|
+
const closed = [];
|
|
169
|
+
const deskHeld = await deskHeldTargets(stateDir).catch(() => /* @__PURE__ */ new Set());
|
|
170
|
+
for (const view of views.filter((item) => item.tab === label && !deskHeld.has(item.id))) if (await closeTabLogged(stateDir, view, "asked to close", deps)) closed.push(view);
|
|
171
|
+
return closed;
|
|
172
|
+
}
|
|
173
|
+
async function closeTabsOfOwner(stateDir, pid, deps = {}) {
|
|
174
|
+
const views = await allTabs(stateDir, deps.list ? { list: deps.list } : {}) ?? [];
|
|
175
|
+
let count = 0;
|
|
176
|
+
const deskHeld = await deskHeldTargets(stateDir).catch(() => /* @__PURE__ */ new Set());
|
|
177
|
+
for (const view of views.filter((item) => item.ownerPid === pid && !item.parked && !deskHeld.has(item.id))) if (await closeTabLogged(stateDir, view, "owner ended", deps)) count++;
|
|
178
|
+
return count;
|
|
179
|
+
}
|
|
180
|
+
function roughAge(ms) {
|
|
181
|
+
const minutes = Math.max(0, Math.round(ms / 6e4));
|
|
182
|
+
if (minutes < 1) return `${Math.max(0, Math.round(ms / 1e3))}s`;
|
|
183
|
+
if (minutes < 120) return `${minutes}m`;
|
|
184
|
+
const hours = Math.round(minutes / 60);
|
|
185
|
+
return hours < 48 ? `${hours}h` : `${Math.round(hours / 24)}d`;
|
|
186
|
+
}
|
|
187
|
+
function describeTabs(views, now = Date.now(), options = {}) {
|
|
188
|
+
if (!views.length) return "No tab is open in the shared browser.";
|
|
189
|
+
const limits = options.limits ?? tabLimits();
|
|
190
|
+
const lines = [...views].sort((a, b) => a.openedAt - b.openedAt).map((view) => {
|
|
191
|
+
const name = view.tab ? `tab "${view.tab}"` : "default tab";
|
|
192
|
+
const state = view.parked ? ", parked" : view.restoreFor !== void 0 && view.ownerPid === 0 ? ", restored, unclaimed" : "";
|
|
193
|
+
const title = view.title ? `"${view.title.replace(/\s+/g, " ").slice(0, 60)}" ` : "";
|
|
194
|
+
return `- ${name} \xB7 ${view.owner}${state} \xB7 open ${roughAge(now - view.openedAt)}, idle ${roughAge(now - view.lastUsedAt)} \xB7 ${title}${(view.url ?? "").slice(0, 100)}`;
|
|
195
|
+
});
|
|
196
|
+
return `All tabs in the shared browser (${views.length}; tabs idle ${roughAge(limits.idleMs)} or whose worker ended are closed, at most ${limits.maxTabs} are kept; close any with tab: "<name>"):
|
|
197
|
+
${lines.join("\n")}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
tabLimits,
|
|
202
|
+
ACTIVE_MS,
|
|
203
|
+
writeTabRecord,
|
|
204
|
+
readTabRecords,
|
|
205
|
+
planTabClosures,
|
|
206
|
+
allTabs,
|
|
207
|
+
sweepTabs,
|
|
208
|
+
closeTabsByLabel,
|
|
209
|
+
closeTabsOfOwner,
|
|
210
|
+
describeTabs
|
|
211
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ADOPTED_TRANSCRIPT_READERS,
|
|
5
|
+
FS_SESSION_DISCOVERY,
|
|
6
|
+
NATIVE_SESSION_STORES,
|
|
7
|
+
locateNativeSessionFile,
|
|
8
|
+
nativeSessionRoot,
|
|
9
|
+
nativeSessionStore,
|
|
10
|
+
nativeTranscriptReader
|
|
11
|
+
} from "./chunk-M3FO5UMK.js";
|
|
12
|
+
import "./chunk-CERF3RIB.js";
|
|
13
|
+
import "./chunk-CVFVFRGN.js";
|
|
14
|
+
import "./chunk-ESF3DIZY.js";
|
|
15
|
+
import "./chunk-R7QN6ONS.js";
|
|
16
|
+
import "./chunk-FF7ZVYJF.js";
|
|
17
|
+
import "./chunk-IMLTL2MY.js";
|
|
18
|
+
import "./chunk-BUOPJQP5.js";
|
|
19
|
+
import "./chunk-3B2CHX7M.js";
|
|
20
|
+
import "./chunk-RVUOIJXN.js";
|
|
21
|
+
import "./chunk-QUS4ER2W.js";
|
|
22
|
+
import "./chunk-DQYVQ2N7.js";
|
|
23
|
+
import "./chunk-KYUHIFP3.js";
|
|
24
|
+
import "./chunk-RSZGEL5U.js";
|
|
25
|
+
import "./chunk-DF35KMXM.js";
|
|
26
|
+
import "./chunk-ZT7B4H2V.js";
|
|
27
|
+
import "./chunk-OL4JBD3J.js";
|
|
28
|
+
import "./chunk-IGZ6C2MC.js";
|
|
29
|
+
import "./chunk-4NN3XQQT.js";
|
|
30
|
+
import "./chunk-4AQ5NINV.js";
|
|
31
|
+
import "./chunk-WPB5WEZJ.js";
|
|
32
|
+
import "./chunk-GYMAI5NY.js";
|
|
33
|
+
import "./chunk-CQ7J6UQ7.js";
|
|
34
|
+
import "./chunk-XKW5NDMR.js";
|
|
35
|
+
import "./chunk-W3YYPBEA.js";
|
|
36
|
+
import "./chunk-XIBYREEY.js";
|
|
37
|
+
import "./chunk-EE4B6A7W.js";
|
|
38
|
+
import "./chunk-WZYVLUVQ.js";
|
|
39
|
+
import "./chunk-O3EW7LAY.js";
|
|
40
|
+
import "./chunk-KHW6TX6I.js";
|
|
41
|
+
import "./chunk-YMCH3L2S.js";
|
|
42
|
+
import "./chunk-4QZEZME7.js";
|
|
43
|
+
import "./chunk-LVRRWP4W.js";
|
|
44
|
+
import "./chunk-G3QP67Z7.js";
|
|
45
|
+
import "./chunk-4L2ZZM4Q.js";
|
|
46
|
+
import "./chunk-F6F47QAY.js";
|
|
47
|
+
import "./chunk-RDDWQBEM.js";
|
|
48
|
+
import "./chunk-MPAJ446F.js";
|
|
49
|
+
import "./chunk-CBANJFBO.js";
|
|
50
|
+
import "./chunk-PWXII6HF.js";
|
|
51
|
+
export {
|
|
52
|
+
ADOPTED_TRANSCRIPT_READERS,
|
|
53
|
+
FS_SESSION_DISCOVERY,
|
|
54
|
+
NATIVE_SESSION_STORES,
|
|
55
|
+
locateNativeSessionFile,
|
|
56
|
+
nativeSessionRoot,
|
|
57
|
+
nativeSessionStore,
|
|
58
|
+
nativeTranscriptReader
|
|
59
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/ide/wire-gzip.ts
|
|
5
|
+
import { gunzipSync, gzipSync } from "node:zlib";
|
|
6
|
+
var WIRE_GZIP_ENV = "CLIKCODE_WIRE_GZIP";
|
|
7
|
+
var MIN_BYTES = 32 * 1024;
|
|
8
|
+
var PREFIX = '{"type":"z","data":"';
|
|
9
|
+
function encodeWireLine(text, enabled) {
|
|
10
|
+
if (!enabled || text.length < MIN_BYTES) return text;
|
|
11
|
+
return `${PREFIX}${gzipSync(text, { level: 1 }).toString("base64")}"}`;
|
|
12
|
+
}
|
|
13
|
+
function decodeWireLine(line) {
|
|
14
|
+
if (!line.startsWith(PREFIX)) return line;
|
|
15
|
+
const data = JSON.parse(line).data;
|
|
16
|
+
return typeof data === "string" ? gunzipSync(Buffer.from(data, "base64")).toString("utf8") : line;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
WIRE_GZIP_ENV,
|
|
21
|
+
encodeWireLine,
|
|
22
|
+
decodeWireLine
|
|
23
|
+
};
|