token-goat 2.9.30 → 2.9.31
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 +24 -7
- package/SECURITY.md +10 -2
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/native/linux-arm64/tg-hook +0 -0
- package/dist/native/linux-x64/tg-hook +0 -0
- package/dist/native/win32-arm64/tg-hook.exe +0 -0
- package/dist/native/win32-x64/tg-hook.exe +0 -0
- package/dist/{token-goat-chunk-QSBRTGM2.mjs → token-goat-chunk-25TRAWET.mjs} +17 -7
- package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
- package/dist/{token-goat-chunk-IVKIZWAB.mjs → token-goat-chunk-2M7E4PF7.mjs} +41 -12
- package/dist/{token-goat-chunk-SMVRN2HU.mjs → token-goat-chunk-2UPZGKKY.mjs} +2 -2
- package/dist/token-goat-chunk-2WLPWKHV.mjs +135 -0
- package/dist/token-goat-chunk-2XBMMDBD.mjs +126 -0
- package/dist/token-goat-chunk-32ZOY4N5.mjs +23 -0
- package/dist/token-goat-chunk-3EZRNKTK.mjs +188 -0
- package/dist/token-goat-chunk-4ADZHI7J.mjs +63 -0
- package/dist/token-goat-chunk-4GBVPH3D.mjs +242 -0
- package/dist/{token-goat-chunk-KWPNJBDH.mjs → token-goat-chunk-4GILLLWY.mjs} +7 -4
- package/dist/{token-goat-chunk-67TQJ76B.mjs → token-goat-chunk-4NAPX7BA.mjs} +36 -3
- package/dist/{token-goat-chunk-PU7V3FD6.mjs → token-goat-chunk-4SC7UJYV.mjs} +3354 -2553
- package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
- package/dist/{token-goat-chunk-AFLYLHDH.mjs → token-goat-chunk-4ZBFWLXF.mjs} +283 -427
- package/dist/{token-goat-chunk-JDWCRD6M.mjs → token-goat-chunk-57BIAXJL.mjs} +73 -40
- package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
- package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
- package/dist/token-goat-chunk-646E6U44.mjs +398 -0
- package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
- package/dist/{token-goat-chunk-JN4XMLSD.mjs → token-goat-chunk-6DG6HWP3.mjs} +8 -2
- package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
- package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
- package/dist/{token-goat-chunk-VPBBTSJR.mjs → token-goat-chunk-76FGDLRO.mjs} +262 -255
- package/dist/{token-goat-chunk-7IN2MKDS.mjs → token-goat-chunk-7EZTZOMC.mjs} +121 -289
- package/dist/{token-goat-chunk-OJBNYTJP.mjs → token-goat-chunk-7MAOA6X4.mjs} +640 -80
- package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
- package/dist/{token-goat-chunk-PD5VKH46.mjs → token-goat-chunk-AUNGYYQX.mjs} +2 -2
- package/dist/{token-goat-chunk-HG45AF2B.mjs → token-goat-chunk-AUQYRMMH.mjs} +794 -37
- package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
- package/dist/{token-goat-chunk-A3CK6N5Z.mjs → token-goat-chunk-BA4HI6BW.mjs} +1309 -110
- package/dist/{token-goat-chunk-JB6QN6VF.mjs → token-goat-chunk-BFCWY73P.mjs} +59 -23
- package/dist/{token-goat-chunk-B45VMIIH.mjs → token-goat-chunk-BWGFUZZE.mjs} +7 -5
- package/dist/{token-goat-chunk-P4QMM4WK.mjs → token-goat-chunk-C75NA7PL.mjs} +50 -23
- package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
- package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
- package/dist/{token-goat-chunk-H2PHHGM5.mjs → token-goat-chunk-CIMQ2BB3.mjs} +57 -12
- package/dist/{token-goat-chunk-N2NMER56.mjs → token-goat-chunk-CJLS3CDL.mjs} +46 -4
- package/dist/{token-goat-chunk-VES7EL7O.mjs → token-goat-chunk-CO3UYX6G.mjs} +1 -1
- package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
- package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
- package/dist/{token-goat-chunk-4LCCNRTG.mjs → token-goat-chunk-CVCEVUGK.mjs} +8 -6
- package/dist/{token-goat-chunk-B2RZZCSS.mjs → token-goat-chunk-CXHOFN7R.mjs} +37 -20
- package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
- package/dist/{token-goat-chunk-APGZXSPS.mjs → token-goat-chunk-DGS2LVNA.mjs} +47 -30
- package/dist/{token-goat-chunk-54K3EUV3.mjs → token-goat-chunk-DOWRSMWO.mjs} +1 -1
- package/dist/token-goat-chunk-E45INMY3.mjs +71 -0
- package/dist/token-goat-chunk-EC5F37F4.mjs +244 -0
- package/dist/{token-goat-chunk-XTQAOTSO.mjs → token-goat-chunk-EDBDRVH5.mjs} +4 -1
- package/dist/{token-goat-chunk-5BCIJXMO.mjs → token-goat-chunk-EELTBKDM.mjs} +14 -10
- package/dist/{token-goat-chunk-W3QCJS6G.mjs → token-goat-chunk-F4HYL64R.mjs} +8 -6
- package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
- package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
- package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
- package/dist/{token-goat-chunk-C63JQV5K.mjs → token-goat-chunk-GL3ETKSC.mjs} +233 -15
- package/dist/token-goat-chunk-GVB2MUST.mjs +1298 -0
- package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
- package/dist/{token-goat-chunk-ZEJVMUQH.mjs → token-goat-chunk-HLPW63A7.mjs} +2 -2
- package/dist/{token-goat-chunk-GOLEOXZP.mjs → token-goat-chunk-HU4TORC5.mjs} +44 -26
- package/dist/{token-goat-chunk-Z57YODA2.mjs → token-goat-chunk-I7VKZZAW.mjs} +2 -2
- package/dist/{token-goat-chunk-NYKZLXMK.mjs → token-goat-chunk-IA6XSPE3.mjs} +6 -6
- package/dist/{token-goat-chunk-E3OQX2XT.mjs → token-goat-chunk-IAGXMHIK.mjs} +81 -42
- package/dist/{token-goat-chunk-HYBFA5X3.mjs → token-goat-chunk-IK2DRMFX.mjs} +24 -68
- package/dist/{token-goat-chunk-COBQGL5S.mjs → token-goat-chunk-INNPTRUX.mjs} +249 -299
- package/dist/{token-goat-chunk-7NADEDKJ.mjs → token-goat-chunk-JJ5BX4F4.mjs} +6 -1
- package/dist/{token-goat-chunk-PEPTHRFF.mjs → token-goat-chunk-JVFSHVFJ.mjs} +6 -6
- package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
- package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
- package/dist/{token-goat-chunk-Q5VTGRH7.mjs → token-goat-chunk-LCNQ2CNN.mjs} +55 -319
- package/dist/token-goat-chunk-M3LFJDPU.mjs +58 -0
- package/dist/token-goat-chunk-M52KPT3C.mjs +87 -0
- package/dist/token-goat-chunk-MBEG42H7.mjs +150 -0
- package/dist/{token-goat-chunk-EVC4TOLE.mjs → token-goat-chunk-METECDOH.mjs} +3 -12
- package/dist/{token-goat-chunk-T4FK7VOV.mjs → token-goat-chunk-MHX7XCC3.mjs} +2 -1
- package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
- package/dist/{token-goat-chunk-LOBGHXPB.mjs → token-goat-chunk-N5MMR2IW.mjs} +1 -1
- package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
- package/dist/{token-goat-chunk-RHXKCZX3.mjs → token-goat-chunk-NISNMD7T.mjs} +2182 -2959
- package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
- package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
- package/dist/{token-goat-chunk-KQNZDCBD.mjs → token-goat-chunk-NSNSPPBG.mjs} +25 -3
- package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
- package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
- package/dist/{token-goat-chunk-JTQQGXZH.mjs → token-goat-chunk-ODBT2USM.mjs} +124 -57
- package/dist/token-goat-chunk-OS5EM5PP.mjs +107 -0
- package/dist/token-goat-chunk-OUKDTVNU.mjs +1178 -0
- package/dist/token-goat-chunk-OXFMP75N.mjs +566 -0
- package/dist/{token-goat-chunk-DZX2YDPT.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -2
- package/dist/{token-goat-chunk-QCLDAQTS.mjs → token-goat-chunk-P6HQSWQ3.mjs} +50 -53
- package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
- package/dist/{token-goat-chunk-7BXSNBY5.mjs → token-goat-chunk-PFWIMH2E.mjs} +23 -15
- package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
- package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
- package/dist/{token-goat-chunk-GFBSN7BD.mjs → token-goat-chunk-PX5PQWTY.mjs} +22 -250
- package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
- package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
- package/dist/{token-goat-chunk-FBNQNSJK.mjs → token-goat-chunk-QH7YVYOY.mjs} +2198 -2782
- package/dist/{token-goat-chunk-64FBPDTK.mjs → token-goat-chunk-QLMUHEPB.mjs} +12 -9
- package/dist/{token-goat-chunk-RZRTDST7.mjs → token-goat-chunk-QQOJIHL3.mjs} +37 -11
- package/dist/{token-goat-chunk-XKI4SEMX.mjs → token-goat-chunk-QQTWJY2O.mjs} +19 -0
- package/dist/{token-goat-chunk-U4N3BN2W.mjs → token-goat-chunk-QYHO5CPH.mjs} +3 -2
- package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
- package/dist/{token-goat-chunk-ETBHVDB6.mjs → token-goat-chunk-RSLPOBKQ.mjs} +22 -11
- package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
- package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
- package/dist/{token-goat-chunk-4JJS54TR.mjs → token-goat-chunk-SOAFZNNZ.mjs} +161 -38
- package/dist/{token-goat-chunk-664RTTUV.mjs → token-goat-chunk-SRTHT7KV.mjs} +21 -16
- package/dist/{token-goat-chunk-4FVIAHSI.mjs → token-goat-chunk-T5P5ACNQ.mjs} +7 -6
- package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
- package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
- package/dist/{token-goat-chunk-COTXZHTS.mjs → token-goat-chunk-TM6MC754.mjs} +4 -3
- package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
- package/dist/{token-goat-chunk-3CHUNJ2O.mjs → token-goat-chunk-U2KSB4SG.mjs} +8 -5
- package/dist/{token-goat-chunk-3Z5S4KGM.mjs → token-goat-chunk-U4WHMG6Y.mjs} +29 -49
- package/dist/{token-goat-chunk-PY533T7F.mjs → token-goat-chunk-UGJHGR5A.mjs} +21 -15
- package/dist/{token-goat-chunk-CYCEYAEO.mjs → token-goat-chunk-UOUDVA5U.mjs} +1 -1
- package/dist/{token-goat-chunk-JDHE26RP.mjs → token-goat-chunk-URRJ33GR.mjs} +16 -5
- package/dist/{token-goat-chunk-56EIMS3E.mjs → token-goat-chunk-UZOROKIS.mjs} +23 -17
- package/dist/{token-goat-chunk-CZ3LUXYZ.mjs → token-goat-chunk-VIHGGGEI.mjs} +427 -308
- package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
- package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
- package/dist/{token-goat-chunk-YARZFCZS.mjs → token-goat-chunk-VWZA2H4P.mjs} +62 -53
- package/dist/{token-goat-chunk-SQSSNQPE.mjs → token-goat-chunk-VXEXMJDL.mjs} +3979 -4745
- package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
- package/dist/{token-goat-chunk-SJHWVNDQ.mjs → token-goat-chunk-WDH44VAU.mjs} +7 -4
- package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
- package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
- package/dist/{token-goat-chunk-FZ3NEW5O.mjs → token-goat-chunk-XLRBNZCC.mjs} +13 -8
- package/dist/{token-goat-chunk-Z44YO3QZ.mjs → token-goat-chunk-XRKUX6CM.mjs} +1 -1
- package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
- package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
- package/dist/{token-goat-chunk-WY3L4DVT.mjs → token-goat-chunk-Y2ZTQOCL.mjs} +13 -8
- package/dist/{token-goat-chunk-UQ5UK2T7.mjs → token-goat-chunk-YB4VMGK2.mjs} +1 -1
- package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
- package/dist/{token-goat-chunk-ZQSJMO2R.mjs → token-goat-chunk-YHVDKQBR.mjs} +105 -105
- package/dist/{token-goat-chunk-H2K3QP6H.mjs → token-goat-chunk-YJB5XLWI.mjs} +8 -6
- package/dist/{token-goat-chunk-ZCDTCVIS.mjs → token-goat-chunk-YKB6AQG3.mjs} +5 -2
- package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
- package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
- package/dist/{token-goat-chunk-HOJLCGDP.mjs → token-goat-chunk-YY6AVUFL.mjs} +2033 -2251
- package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
- package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
- package/dist/token-goat-hook-client.cjs +1 -1
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +67 -38
- package/dist/token-goat.core.mjs +4 -4
- package/docs/C4_RUNTIME_ARCHITECTURE.md +1 -1
- package/docs/cli.md +40 -21
- package/docs/install.md +19 -9
- package/docs/security.md +5 -3
- package/package.json +2 -1
- package/dist/token-goat-chunk-5KDMCMF2.mjs +0 -362
- package/dist/token-goat-chunk-6QMAS7AB.mjs +0 -42
- package/dist/token-goat-chunk-7F2UBPD3.mjs +0 -397
- package/dist/token-goat-chunk-ARDNEC2U.mjs +0 -248
- package/dist/token-goat-chunk-ATCPY7EQ.mjs +0 -134
- package/dist/token-goat-chunk-EFHMMIGP.mjs +0 -68
- package/dist/token-goat-chunk-IVALLT3S.mjs +0 -48
- package/dist/token-goat-chunk-JDU3EXSU.mjs +0 -65
- package/dist/token-goat-chunk-MKPF4CL5.mjs +0 -37
- package/dist/token-goat-chunk-RC35RBUL.mjs +0 -312
- package/dist/token-goat-chunk-USILZ3T3.mjs +0 -53
- package/dist/token-goat-chunk-VL3YIFHZ.mjs +0 -2975
- package/dist/token-goat-chunk-XU4P6Z24.mjs +0 -133
- package/dist/token-goat-chunk-Y776AENC.mjs +0 -1597
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_HEARTBEAT_INTERVAL_MS,
|
|
5
|
+
DEFAULT_TIMEOUT_SECONDS,
|
|
6
|
+
MAX_CAPTURE_BYTES,
|
|
7
|
+
resolveFilter,
|
|
8
|
+
run,
|
|
9
|
+
runRaw,
|
|
10
|
+
spawnTarget,
|
|
11
|
+
unknownFilterNotice
|
|
12
|
+
} from "./token-goat-chunk-VWDXLT4F.mjs";
|
|
13
|
+
import "./token-goat-chunk-DOWRSMWO.mjs";
|
|
14
|
+
import "./token-goat-chunk-INNPTRUX.mjs";
|
|
15
|
+
import "./token-goat-chunk-N5LSOVSU.mjs";
|
|
16
|
+
import "./token-goat-chunk-KQBLRPBN.mjs";
|
|
17
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
18
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
19
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
20
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
21
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
22
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
23
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
24
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
25
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
26
|
+
import "./token-goat-chunk-X2SUP3EI.mjs";
|
|
27
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
28
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
29
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
30
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
31
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
32
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
33
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
34
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
35
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
36
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
37
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
38
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
39
|
+
export {
|
|
40
|
+
DEFAULT_HEARTBEAT_INTERVAL_MS,
|
|
41
|
+
DEFAULT_TIMEOUT_SECONDS,
|
|
42
|
+
MAX_CAPTURE_BYTES,
|
|
43
|
+
resolveFilter,
|
|
44
|
+
run,
|
|
45
|
+
runRaw,
|
|
46
|
+
spawnTarget,
|
|
47
|
+
unknownFilterNotice
|
|
48
|
+
};
|
|
@@ -10,11 +10,86 @@ import {
|
|
|
10
10
|
stripMultilineStringSpan,
|
|
11
11
|
stripNestedBlockCommentSpan,
|
|
12
12
|
stripStringLiterals
|
|
13
|
-
} from "./token-goat-chunk-
|
|
13
|
+
} from "./token-goat-chunk-OUKDTVNU.mjs";
|
|
14
14
|
import {
|
|
15
15
|
init_define_import_meta_env
|
|
16
16
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
17
17
|
|
|
18
|
+
// src/languages/body_segments.ts
|
|
19
|
+
init_define_import_meta_env();
|
|
20
|
+
function bodySegments(code, from) {
|
|
21
|
+
const out = [];
|
|
22
|
+
let braces = 0;
|
|
23
|
+
let nest = 0;
|
|
24
|
+
let inString = false;
|
|
25
|
+
let start = from;
|
|
26
|
+
const cut = (end) => {
|
|
27
|
+
if (/[^\s;]/.test(code.slice(start, end))) out.push({ start, end, open: false });
|
|
28
|
+
start = end;
|
|
29
|
+
};
|
|
30
|
+
for (let i = from; i < code.length; i++) {
|
|
31
|
+
const ch = code[i];
|
|
32
|
+
if (ch === '"') inString = !inString;
|
|
33
|
+
else if (inString) continue;
|
|
34
|
+
else if (ch === "(" || ch === "[") nest++;
|
|
35
|
+
else if (ch === ")" || ch === "]") nest = Math.max(0, nest - 1);
|
|
36
|
+
else if (ch === "{") braces++;
|
|
37
|
+
else if (ch === "}") {
|
|
38
|
+
if (braces === 0) {
|
|
39
|
+
cut(i);
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
braces--;
|
|
43
|
+
if (braces === 0 && nest === 0) cut(i + 1);
|
|
44
|
+
} else if (ch === ";" && braces === 0 && nest === 0) cut(i + 1);
|
|
45
|
+
}
|
|
46
|
+
if (/[^\s;]/.test(code.slice(start))) out.push({ start, end: code.length, open: braces > 0 });
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
function bodyBraceAt(code, from, to) {
|
|
50
|
+
let parens = 0;
|
|
51
|
+
for (let i = from; i < to; i++) {
|
|
52
|
+
const ch = code[i];
|
|
53
|
+
if (ch === "(") parens++;
|
|
54
|
+
else if (ch === ")") parens = Math.max(0, parens - 1);
|
|
55
|
+
else if (ch === "{" && parens === 0) return i;
|
|
56
|
+
}
|
|
57
|
+
return -1;
|
|
58
|
+
}
|
|
59
|
+
function endOpenMember(symbols, settled, open, lineNum, lines) {
|
|
60
|
+
const { sym } = open;
|
|
61
|
+
const ended = { ...sym, lineEnd: lineNum, body: [sym.body, ...lines.slice(sym.lineStart, lineNum)].join("\n") };
|
|
62
|
+
symbols[symbols.indexOf(sym)] = ended;
|
|
63
|
+
settled.delete(sym);
|
|
64
|
+
settled.add(ended);
|
|
65
|
+
}
|
|
66
|
+
function spanUnsettled(symbols, settled, span) {
|
|
67
|
+
const spanned = span(symbols.filter((s) => !settled.has(s)));
|
|
68
|
+
let next = 0;
|
|
69
|
+
return symbols.map((s) => settled.has(s) ? s : spanned[next++]);
|
|
70
|
+
}
|
|
71
|
+
function bodyResumeAt(code, depthInside) {
|
|
72
|
+
if (depthInside <= 0) return 0;
|
|
73
|
+
let depth = depthInside;
|
|
74
|
+
for (let i = 0; i < code.length; i++) {
|
|
75
|
+
const ch = code[i];
|
|
76
|
+
if (ch === "{") depth++;
|
|
77
|
+
else if (ch === "}" && --depth === 0) return i + 1;
|
|
78
|
+
}
|
|
79
|
+
return -1;
|
|
80
|
+
}
|
|
81
|
+
function openMembersOf(blocks, bodyDepth) {
|
|
82
|
+
return blocks.map((b) => ({ sym: b.sym, depth: bodyDepth + b.level + 1 }));
|
|
83
|
+
}
|
|
84
|
+
function endOpenMembers(symbols, settled, open, braceDepth, lineNum, lines) {
|
|
85
|
+
const still = [];
|
|
86
|
+
for (const m of open) {
|
|
87
|
+
if (braceDepth < m.depth) endOpenMember(symbols, settled, m, lineNum, lines);
|
|
88
|
+
else still.push(m);
|
|
89
|
+
}
|
|
90
|
+
return still;
|
|
91
|
+
}
|
|
92
|
+
|
|
18
93
|
// src/languages/swift.ts
|
|
19
94
|
init_define_import_meta_env();
|
|
20
95
|
var SWIFT_STRIP = { swiftInterpolation: true };
|
|
@@ -46,6 +121,9 @@ var SUBSCRIPT_RE = new RegExp(
|
|
|
46
121
|
var PROPERTY_RE = new RegExp(
|
|
47
122
|
"^\\s*(?:" + MODIFIER_ALT + `\\s+)*(?:var|let)\\s+(${IDENT}[^\\n]*)`
|
|
48
123
|
);
|
|
124
|
+
var ENUM_CASE_RE = new RegExp(
|
|
125
|
+
"^\\s*(?:" + MODIFIER_ALT + `\\s+)*(?:@[A-Za-z_][A-Za-z0-9_.]*\\s+)*case\\s+(${IDENT}[^\\n]*)`
|
|
126
|
+
);
|
|
49
127
|
function splitDeclaratorNames(tail) {
|
|
50
128
|
const names = [];
|
|
51
129
|
let depth = 0;
|
|
@@ -73,7 +151,7 @@ var TYPE_HEADER_RE = new RegExp(
|
|
|
73
151
|
`^(?:(?:public|private|fileprivate|internal|open|package|final|indirect|distributed|nonisolated)\\s+)*(class|struct|enum|protocol|extension|actor)\\s+(?!(?:func|var|let|subscript)\\b)(${IDENT}(?:\\.${IDENT})*)`
|
|
74
152
|
);
|
|
75
153
|
function stripRegexLiterals(line) {
|
|
76
|
-
return line.replace(/([=(,[:]|^|\breturn\b)(\s*)\/(?![\s/*])(?:\\.|[^\\/\n])
|
|
154
|
+
return line.replace(/([=(,[:]|^|\breturn\b)(\s*)(\/(?![\s/*])(?:\\.|[^\\/\n])*\/)/g, (_m, lead, gap, literal) => lead + gap + " ".repeat(literal.length));
|
|
77
155
|
}
|
|
78
156
|
var ALIAS_RE = new RegExp(
|
|
79
157
|
"^(?:" + MODIFIER_ALT + "\\s+)*(typealias|associatedtype|macro)\\s+(" + IDENT + ")"
|
|
@@ -81,6 +159,50 @@ var ALIAS_RE = new RegExp(
|
|
|
81
159
|
function typeKindFor(keyword2) {
|
|
82
160
|
return keyword2 === "struct" ? "struct" : keyword2 === "enum" ? "enum" : keyword2 === "protocol" ? "protocol" : keyword2 === "extension" ? "extension" : keyword2 === "actor" ? "actor" : "class";
|
|
83
161
|
}
|
|
162
|
+
function memberSymbols(text, parent, sig, site) {
|
|
163
|
+
const { filePath, lineNum, lines } = site;
|
|
164
|
+
const style = lines !== void 0 ? "c" : void 0;
|
|
165
|
+
const noAttr = stripLeadingAttributes(text);
|
|
166
|
+
const initM = INIT_RE.exec(noAttr);
|
|
167
|
+
if (initM) return [makeLineSymbol(filePath, initM[1] ?? "init", "method", lineNum, sig, parent, lines, style)];
|
|
168
|
+
if (DEINIT_RE.exec(noAttr)) return [makeLineSymbol(filePath, "deinit", "method", lineNum, sig, parent, lines, style)];
|
|
169
|
+
const subscriptM = SUBSCRIPT_RE.exec(noAttr);
|
|
170
|
+
if (subscriptM) return [makeLineSymbol(filePath, subscriptM[1] ?? "subscript", "method", lineNum, sig, parent, lines, style)];
|
|
171
|
+
const fm = FUNC_RE.exec(noAttr);
|
|
172
|
+
if (fm) return [makeLineSymbol(filePath, unquoteIdent(fm[1] ?? ""), parent === void 0 ? "function" : "method", lineNum, sig, parent, lines, style)];
|
|
173
|
+
const propM = PROPERTY_RE.exec(noAttr);
|
|
174
|
+
if (propM) return splitDeclaratorNames(propM[1] ?? "").map((name) => makeLineSymbol(filePath, name, "var", lineNum, sig, parent, lines, style));
|
|
175
|
+
const caseM = parent === void 0 ? null : ENUM_CASE_RE.exec(noAttr);
|
|
176
|
+
if (caseM) return splitDeclaratorNames(caseM[1] ?? "").map((name) => makeLineSymbol(filePath, name, "enum_member", lineNum, sig, parent, lines, style));
|
|
177
|
+
return [];
|
|
178
|
+
}
|
|
179
|
+
function inlineSwiftMembers(line, code, segs, parent, filePath, lineNum, level = 0) {
|
|
180
|
+
const members = [];
|
|
181
|
+
const opens = [];
|
|
182
|
+
for (const seg of segs) {
|
|
183
|
+
const text = line.slice(seg.start, seg.end).trim();
|
|
184
|
+
const noAttr = stripLeadingAttributes(text);
|
|
185
|
+
const tm = TYPE_HEADER_RE.exec(noAttr);
|
|
186
|
+
if (tm) {
|
|
187
|
+
const brace = bodyBraceAt(code, seg.start, seg.end);
|
|
188
|
+
if (seg.open && brace === -1) continue;
|
|
189
|
+
const name = unquoteIdent(tm[2] ?? "");
|
|
190
|
+
const typeSym = makeLineSymbol(filePath, name, typeKindFor(tm[1] ?? "class"), lineNum, text, parent);
|
|
191
|
+
members.push(typeSym);
|
|
192
|
+
if (brace !== -1) {
|
|
193
|
+
const inner = inlineSwiftMembers(line, code, bodySegments(code, brace + 1), name, filePath, lineNum, level + 1);
|
|
194
|
+
members.push(...inner.members);
|
|
195
|
+
if (seg.open) opens.push({ sym: typeSym, level, isType: true }, ...inner.opens);
|
|
196
|
+
}
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const am = ALIAS_RE.exec(noAttr);
|
|
200
|
+
const found = am ? [makeLineSymbol(filePath, unquoteIdent(am[2] ?? ""), am[1] === "macro" ? "macro" : "type", lineNum, text, parent)] : memberSymbols(text, parent, text, { filePath, lineNum });
|
|
201
|
+
members.push(...found);
|
|
202
|
+
if (seg.open && found.length > 0) opens.push({ sym: found[found.length - 1], level, isType: false });
|
|
203
|
+
}
|
|
204
|
+
return { members, opens };
|
|
205
|
+
}
|
|
84
206
|
function extractSwift(content, filePath) {
|
|
85
207
|
const symbols = [];
|
|
86
208
|
const imports = [];
|
|
@@ -89,37 +211,10 @@ function extractSwift(content, filePath) {
|
|
|
89
211
|
let braceDepth = 0;
|
|
90
212
|
let commentDepth = 0;
|
|
91
213
|
let mlState = null;
|
|
214
|
+
const settled = /* @__PURE__ */ new Set();
|
|
215
|
+
let openMembers = [];
|
|
92
216
|
function pushMembers(text, parent, lineNum, sig) {
|
|
93
|
-
|
|
94
|
-
const kind = parent === void 0 ? "function" : "method";
|
|
95
|
-
const initM = INIT_RE.exec(noAttr);
|
|
96
|
-
if (initM) {
|
|
97
|
-
symbols.push(makeLineSymbol(filePath, initM[1] ?? "init", "method", lineNum, sig, parent, lines, "c"));
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
if (DEINIT_RE.exec(noAttr)) {
|
|
101
|
-
symbols.push(makeLineSymbol(filePath, "deinit", "method", lineNum, sig, parent, lines, "c"));
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
const subscriptM = SUBSCRIPT_RE.exec(noAttr);
|
|
105
|
-
if (subscriptM) {
|
|
106
|
-
symbols.push(makeLineSymbol(filePath, subscriptM[1] ?? "subscript", "method", lineNum, sig, parent, lines, "c"));
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
const fm = FUNC_RE.exec(noAttr);
|
|
110
|
-
if (fm) {
|
|
111
|
-
symbols.push(makeLineSymbol(filePath, unquoteIdent(fm[1] ?? ""), kind, lineNum, sig, parent, lines, "c"));
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
const propM = PROPERTY_RE.exec(noAttr);
|
|
115
|
-
if (propM) {
|
|
116
|
-
const names = splitDeclaratorNames(propM[1] ?? "");
|
|
117
|
-
for (const name of names) {
|
|
118
|
-
symbols.push(makeLineSymbol(filePath, name, "var", lineNum, sig, parent, lines, "c"));
|
|
119
|
-
}
|
|
120
|
-
return names.length > 0;
|
|
121
|
-
}
|
|
122
|
-
return false;
|
|
217
|
+
symbols.push(...memberSymbols(text, parent, sig, { filePath, lineNum, lines }));
|
|
123
218
|
}
|
|
124
219
|
for (let i = 0; i < lines.length; i++) {
|
|
125
220
|
const rawLine = lines[i] ?? "";
|
|
@@ -153,11 +248,6 @@ function extractSwift(content, filePath) {
|
|
|
153
248
|
const parent = typeStack.length > 0 ? typeStack[typeStack.length - 1].name : void 0;
|
|
154
249
|
symbols.push(makeLineSymbol(filePath, tname, typeKindFor(tm[1] ?? "class"), lineNum, stripped.slice(0, 200), parent, lines, "c"));
|
|
155
250
|
typeStack.push({ name: tname, startDepth: braceDepth, bodyEntered: false });
|
|
156
|
-
const open = strippedNoAttr.indexOf("{");
|
|
157
|
-
if (open !== -1) {
|
|
158
|
-
const tail = strippedNoAttr.slice(open + 1).replace(/\}\s*$/, "").trim();
|
|
159
|
-
if (tail) pushMembers(tail, tname, lineNum, tail.slice(0, 200));
|
|
160
|
-
}
|
|
161
251
|
}
|
|
162
252
|
const am = tm === null && typeDetectionGateOk && (braceDepth === 0 || typeStack.length > 0) ? ALIAS_RE.exec(strippedNoAttr) : null;
|
|
163
253
|
if (am) {
|
|
@@ -174,6 +264,28 @@ function extractSwift(content, filePath) {
|
|
|
174
264
|
pushMembers(line, void 0, lineNum, stripped.slice(0, 200));
|
|
175
265
|
}
|
|
176
266
|
const braceLine = stripRegexLiterals(stripStringLiterals(line, SWIFT_STRIP));
|
|
267
|
+
const lineOpens = [];
|
|
268
|
+
const queueMembers = (segs, parent, bodyDepth) => {
|
|
269
|
+
const { members, opens } = inlineSwiftMembers(line, braceLine, segs, parent, filePath, lineNum);
|
|
270
|
+
symbols.push(...members);
|
|
271
|
+
for (const m of members) settled.add(m);
|
|
272
|
+
lineOpens.push(...openMembersOf(opens, bodyDepth));
|
|
273
|
+
for (const o of opens) {
|
|
274
|
+
if (!o.isType) continue;
|
|
275
|
+
const enclosing = typeStack[typeStack.length - 1];
|
|
276
|
+
if (enclosing !== void 0) enclosing.bodyEntered = true;
|
|
277
|
+
typeStack.push({ name: o.sym.name, startDepth: bodyDepth + o.level, bodyEntered: true });
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
const lineSegs = bodySegments(braceLine, 0);
|
|
281
|
+
if (tm !== null && frame !== null && lineSegs[0] !== void 0) {
|
|
282
|
+
const brace = bodyBraceAt(braceLine, lineSegs[0].start, lineSegs[0].end);
|
|
283
|
+
if (brace !== -1) queueMembers(bodySegments(braceLine, brace + 1), frame.name, braceDepth + 1);
|
|
284
|
+
}
|
|
285
|
+
if (outerFrame !== null && outerDepthInType >= 1) {
|
|
286
|
+
const resume = bodyResumeAt(braceLine, outerDepthInType - 1);
|
|
287
|
+
if (resume >= 0) queueMembers(outerDepthInType === 1 ? lineSegs.slice(1) : bodySegments(braceLine, resume), outerFrame.name, outerFrame.startDepth + 1);
|
|
288
|
+
} else if (outerFrame === null && braceDepth === 0) queueMembers(lineSegs.slice(1), void 0, braceDepth);
|
|
177
289
|
for (const ch of braceLine) {
|
|
178
290
|
if (ch === "{") {
|
|
179
291
|
braceDepth++;
|
|
@@ -185,6 +297,8 @@ function extractSwift(content, filePath) {
|
|
|
185
297
|
braceDepth--;
|
|
186
298
|
}
|
|
187
299
|
}
|
|
300
|
+
openMembers = endOpenMembers(symbols, settled, openMembers, braceDepth, lineNum, lines);
|
|
301
|
+
openMembers.push(...lineOpens);
|
|
188
302
|
while (typeStack.length > 0) {
|
|
189
303
|
const top = typeStack[typeStack.length - 1];
|
|
190
304
|
if (top.bodyEntered && braceDepth <= top.startDepth) {
|
|
@@ -194,7 +308,7 @@ function extractSwift(content, filePath) {
|
|
|
194
308
|
}
|
|
195
309
|
}
|
|
196
310
|
}
|
|
197
|
-
return { symbols, imports };
|
|
311
|
+
return { symbols, imports, settled };
|
|
198
312
|
}
|
|
199
313
|
|
|
200
314
|
// src/languages/cobol.ts
|
|
@@ -1620,6 +1734,7 @@ function scanBraceLanguage(content, filePath, lang) {
|
|
|
1620
1734
|
codeOffset: code.length - code.trimStart().length,
|
|
1621
1735
|
header: () => headerFrom(masked, i)
|
|
1622
1736
|
};
|
|
1737
|
+
if (pending !== null && pending.parens === 0 && pending.line < i && lang.memberStart?.test(trimmed) === true) pending = null;
|
|
1623
1738
|
const inHeader = pending !== null && pending.parens > 0;
|
|
1624
1739
|
const d = items.length < MAX_SYMBOLS4 && !inHeader ? lang.match(trimmed, ctx) : null;
|
|
1625
1740
|
if (d !== null && d.name.length <= MAX_NAME_LENGTH2 && (d.name !== "" || d.nameAfterClose === true)) {
|
|
@@ -1794,6 +1909,7 @@ function matchGroovy(code, ctx) {
|
|
|
1794
1909
|
var GROOVY = {
|
|
1795
1910
|
lex: { lineComments: ["//"], blockComment: ["/*", "*/"], quotes: `"'`, tripleQuotes: true, shebang: true, slashyStrings: true },
|
|
1796
1911
|
match: matchGroovy,
|
|
1912
|
+
memberStart: /^static\s*\{/,
|
|
1797
1913
|
importOf: (code) => /^import\s+(?:static\s+)?([\w.]+(?:\.\*)?)/.exec(code)?.[1] ?? null,
|
|
1798
1914
|
docComments: true
|
|
1799
1915
|
};
|
|
@@ -3710,6 +3826,13 @@ function extractErlang(content, filePath) {
|
|
|
3710
3826
|
}
|
|
3711
3827
|
|
|
3712
3828
|
export {
|
|
3829
|
+
bodySegments,
|
|
3830
|
+
bodyBraceAt,
|
|
3831
|
+
endOpenMember,
|
|
3832
|
+
spanUnsettled,
|
|
3833
|
+
bodyResumeAt,
|
|
3834
|
+
openMembersOf,
|
|
3835
|
+
endOpenMembers,
|
|
3713
3836
|
stripLeadingAttributes,
|
|
3714
3837
|
IMPORT_RE,
|
|
3715
3838
|
extractSwift,
|
|
@@ -4,30 +4,35 @@ import {
|
|
|
4
4
|
CONTENT_DELIVERED_REASON,
|
|
5
5
|
classifyToolError,
|
|
6
6
|
errorPrefix
|
|
7
|
-
} from "./token-goat-chunk-
|
|
7
|
+
} from "./token-goat-chunk-JVFSHVFJ.mjs";
|
|
8
|
+
import "./token-goat-chunk-DGS2LVNA.mjs";
|
|
9
|
+
import "./token-goat-chunk-INNPTRUX.mjs";
|
|
8
10
|
import "./token-goat-chunk-MNWKPRAL.mjs";
|
|
9
|
-
import "./token-goat-chunk-
|
|
10
|
-
import "./token-goat-chunk-
|
|
11
|
-
import "./token-goat-chunk-
|
|
12
|
-
import "./token-goat-chunk-
|
|
13
|
-
import "./token-goat-chunk-
|
|
14
|
-
import "./token-goat-chunk-JB6QN6VF.mjs";
|
|
15
|
-
import "./token-goat-chunk-3Z5S4KGM.mjs";
|
|
16
|
-
import "./token-goat-chunk-VL3YIFHZ.mjs";
|
|
11
|
+
import "./token-goat-chunk-P6VGNTQT.mjs";
|
|
12
|
+
import "./token-goat-chunk-76FGDLRO.mjs";
|
|
13
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
14
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
15
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
17
16
|
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
18
|
-
import "./token-goat-chunk-
|
|
19
|
-
import "./token-goat-chunk-
|
|
20
|
-
import "./token-goat-chunk-
|
|
17
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
18
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
19
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
20
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
21
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
22
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
23
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
24
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
25
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
26
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
21
27
|
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
22
28
|
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
23
|
-
import "./token-goat-chunk-
|
|
29
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
30
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
24
31
|
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
25
32
|
import {
|
|
26
33
|
displaySafeText
|
|
27
34
|
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
28
|
-
import "./token-goat-chunk-
|
|
29
|
-
import "./token-goat-chunk-KWPNJBDH.mjs";
|
|
30
|
-
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
35
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
31
36
|
import {
|
|
32
37
|
init_define_import_meta_env
|
|
33
38
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -2,11 +2,11 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
loadConfig
|
|
5
|
-
} from "./token-goat-chunk-
|
|
5
|
+
} from "./token-goat-chunk-7EZTZOMC.mjs";
|
|
6
6
|
import {
|
|
7
7
|
growsExponentially,
|
|
8
8
|
hasNestedQuantifier
|
|
9
|
-
} from "./token-goat-chunk-
|
|
9
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
10
10
|
import {
|
|
11
11
|
init_define_import_meta_env
|
|
12
12
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -159,20 +159,21 @@ function hasPreciseSecret(text, config = loadConfig()) {
|
|
|
159
159
|
}
|
|
160
160
|
return false;
|
|
161
161
|
}
|
|
162
|
-
function redactSecrets(text, config = loadConfig()) {
|
|
162
|
+
function redactSecrets(text, config = loadConfig(), opts = {}) {
|
|
163
163
|
let count = 0;
|
|
164
164
|
let out = text;
|
|
165
|
+
const placeholder = (tag, match) => opts.keepLineCount === true ? match.split(/(\r?\n)/).map((part, i) => i % 2 === 1 ? part : tag).join("") : tag;
|
|
165
166
|
for (const [kind, pattern] of SECRET_PATTERNS) {
|
|
166
|
-
out = out.replace(pattern, () => {
|
|
167
|
+
out = out.replace(pattern, (match) => {
|
|
167
168
|
count++;
|
|
168
|
-
return `[REDACTED:${kind}]
|
|
169
|
+
return placeholder(`[REDACTED:${kind}]`, match);
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
for (const pattern of compileCustomPatterns(config.redaction.custom_patterns).patterns) {
|
|
172
173
|
out = out.replace(pattern, (match) => {
|
|
173
174
|
if (match.length === 0) return match;
|
|
174
175
|
count++;
|
|
175
|
-
return "[REDACTED:custom]";
|
|
176
|
+
return placeholder("[REDACTED:custom]", match);
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
179
|
if (config.redaction.strict) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
MAX_RESUME_CHARS,
|
|
5
|
+
MAX_RESUME_TOKENS,
|
|
6
|
+
buildResumePacket
|
|
7
|
+
} from "./token-goat-chunk-XLRBNZCC.mjs";
|
|
8
|
+
import "./token-goat-chunk-LCNQ2CNN.mjs";
|
|
9
|
+
import "./token-goat-chunk-GWFLAUMQ.mjs";
|
|
10
|
+
import "./token-goat-chunk-NMD42SFQ.mjs";
|
|
11
|
+
import "./token-goat-chunk-SAMFDIS2.mjs";
|
|
12
|
+
import "./token-goat-chunk-WBA5SKT4.mjs";
|
|
13
|
+
import "./token-goat-chunk-WDH44VAU.mjs";
|
|
14
|
+
import "./token-goat-chunk-BPGCUMR7.mjs";
|
|
15
|
+
import "./token-goat-chunk-KQBLRPBN.mjs";
|
|
16
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
17
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
18
|
+
import "./token-goat-chunk-EVMZJ27Z.mjs";
|
|
19
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
20
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
21
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
22
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
23
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
24
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
25
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
26
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
27
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
28
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
29
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
30
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
31
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
32
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
33
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
34
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
35
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
36
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
37
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
38
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
39
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
40
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
41
|
+
export {
|
|
42
|
+
MAX_RESUME_CHARS,
|
|
43
|
+
MAX_RESUME_TOKENS,
|
|
44
|
+
buildResumePacket
|
|
45
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
readAllProcesses
|
|
5
|
+
} from "./token-goat-chunk-N7B3JQ2C.mjs";
|
|
6
|
+
import {
|
|
7
|
+
PROCESS_QUERY_TIMEOUT_MS,
|
|
8
|
+
daemonEntryScript,
|
|
9
|
+
isResidentOfInstall,
|
|
10
|
+
pidAlive,
|
|
11
|
+
readProcessCommandLine,
|
|
12
|
+
terminateProcessTree,
|
|
13
|
+
zombiePids
|
|
14
|
+
} from "./token-goat-chunk-F6PAUIEK.mjs";
|
|
15
|
+
import "./token-goat-chunk-65N4RHP4.mjs";
|
|
16
|
+
import "./token-goat-chunk-X2SUP3EI.mjs";
|
|
17
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
18
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
19
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
20
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
21
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
22
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
23
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
24
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
25
|
+
import {
|
|
26
|
+
displaySafeText
|
|
27
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
28
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
29
|
+
import {
|
|
30
|
+
init_define_import_meta_env
|
|
31
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
32
|
+
|
|
33
|
+
// src/stray_residents.ts
|
|
34
|
+
init_define_import_meta_env();
|
|
35
|
+
var UPGRADE_RESIDENT_KINDS = ["worker", "hook-server"];
|
|
36
|
+
var TERM_GRACE_MS = 8e3;
|
|
37
|
+
var KILL_GRACE_MS = 2e3;
|
|
38
|
+
var POLL_MS = 50;
|
|
39
|
+
function pause(ms) {
|
|
40
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
41
|
+
}
|
|
42
|
+
function running(pids, cheapOnly) {
|
|
43
|
+
const up = pids.filter(pidAlive);
|
|
44
|
+
const dead = new Set(zombiePids(up, cheapOnly));
|
|
45
|
+
return up.filter((pid) => !dead.has(pid));
|
|
46
|
+
}
|
|
47
|
+
async function stillAlive(pids, graceMs) {
|
|
48
|
+
const end = Date.now() + graceMs;
|
|
49
|
+
let alive = running(pids, true);
|
|
50
|
+
while (alive.length > 0 && Date.now() < end) {
|
|
51
|
+
await pause(POLL_MS);
|
|
52
|
+
alive = running(alive, true);
|
|
53
|
+
}
|
|
54
|
+
return running(alive, false);
|
|
55
|
+
}
|
|
56
|
+
function matchingPids(opts) {
|
|
57
|
+
const table = readAllProcesses();
|
|
58
|
+
if (!Array.isArray(table)) return table.reason;
|
|
59
|
+
const entry = daemonEntryScript();
|
|
60
|
+
const skip = /* @__PURE__ */ new Set([process.pid, ...opts.skip ?? []]);
|
|
61
|
+
return table.filter((p) => !skip.has(p.processId) && isResidentOfInstall(p.commandLine, entry, opts.kinds)).map((p) => p.processId);
|
|
62
|
+
}
|
|
63
|
+
async function retireStrayResidents(opts) {
|
|
64
|
+
const listed = matchingPids(opts);
|
|
65
|
+
if (typeof listed === "string") return { retired: [], survivors: [], unreadable: listed };
|
|
66
|
+
if (listed.length === 0) return { retired: [], survivors: [] };
|
|
67
|
+
const confirmed = matchingPids(opts);
|
|
68
|
+
if (typeof confirmed === "string") return { retired: [], survivors: [], unreadable: confirmed };
|
|
69
|
+
const found = listed.filter((pid) => confirmed.includes(pid));
|
|
70
|
+
const deadline = Date.now() + (opts.deadlineMs ?? PROCESS_QUERY_TIMEOUT_MS);
|
|
71
|
+
const recheck = opts.readCommandLine ?? (process.platform === "win32" ? readProcessCommandLine : null);
|
|
72
|
+
const entry = daemonEntryScript();
|
|
73
|
+
const signalled = [];
|
|
74
|
+
const notTried = [];
|
|
75
|
+
for (const pid of found) {
|
|
76
|
+
if (Date.now() >= deadline) {
|
|
77
|
+
notTried.push(pid);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (recheck !== null) {
|
|
81
|
+
const latest = recheck(pid);
|
|
82
|
+
if (latest === null || !isResidentOfInstall(latest, entry, opts.kinds)) continue;
|
|
83
|
+
}
|
|
84
|
+
terminateProcessTree(pid, process.platform === "win32");
|
|
85
|
+
signalled.push(pid);
|
|
86
|
+
}
|
|
87
|
+
let remaining = await stillAlive(signalled, process.platform === "win32" ? KILL_GRACE_MS : TERM_GRACE_MS);
|
|
88
|
+
if (remaining.length > 0 && process.platform !== "win32") {
|
|
89
|
+
const again = matchingPids(opts);
|
|
90
|
+
const mine = typeof again === "string" ? [] : remaining.filter((pid) => again.includes(pid));
|
|
91
|
+
for (const pid of mine) terminateProcessTree(pid, true);
|
|
92
|
+
remaining = await stillAlive(remaining, KILL_GRACE_MS);
|
|
93
|
+
}
|
|
94
|
+
return { retired: signalled.filter((pid) => !remaining.includes(pid)), survivors: [...remaining, ...notTried], notTried };
|
|
95
|
+
}
|
|
96
|
+
function describeRetirement(report) {
|
|
97
|
+
const parts = [];
|
|
98
|
+
if (report.unreadable !== void 0) parts.push(`Could not read the process list (${displaySafeText(report.unreadable)}), so other token-goat background processes were not looked for.`);
|
|
99
|
+
if (report.retired.length > 0) parts.push(`Ended ${report.retired.length} other token-goat background process${report.retired.length === 1 ? "" : "es"} of this install, whatever their data directory (pid ${report.retired.join(", ")}).`);
|
|
100
|
+
const skipped = report.notTried ?? [];
|
|
101
|
+
const failed = report.survivors.filter((pid) => !skipped.includes(pid));
|
|
102
|
+
if (failed.length > 0) parts.push(`Could not end pid ${failed.join(", ")}; end ${failed.length === 1 ? "it" : "them"} yourself before upgrading.`);
|
|
103
|
+
if (skipped.length > 0) parts.push(`Stopped ending processes at the time limit; pid ${skipped.join(", ")} ${skipped.length === 1 ? "was" : "were"} left running, end ${skipped.length === 1 ? "it" : "them"} yourself before upgrading.`);
|
|
104
|
+
return parts.length === 0 ? null : parts.join(" ");
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
UPGRADE_RESIDENT_KINDS,
|
|
108
|
+
describeRetirement,
|
|
109
|
+
retireStrayResidents
|
|
110
|
+
};
|
|
@@ -15,11 +15,12 @@ import {
|
|
|
15
15
|
lastDownloadFailure,
|
|
16
16
|
recordDownloadFailure,
|
|
17
17
|
withExplicitDownload
|
|
18
|
-
} from "./token-goat-chunk-
|
|
19
|
-
import "./token-goat-chunk-
|
|
18
|
+
} from "./token-goat-chunk-2UPZGKKY.mjs";
|
|
19
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
20
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
20
21
|
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
21
22
|
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
22
|
-
import "./token-goat-chunk-
|
|
23
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
23
24
|
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
24
25
|
export {
|
|
25
26
|
DownloadCooldownError,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
anchorStatus
|
|
5
|
+
} from "./token-goat-chunk-I7VKZZAW.mjs";
|
|
6
|
+
import "./token-goat-chunk-COPNXRJM.mjs";
|
|
7
|
+
import "./token-goat-chunk-4SC7UJYV.mjs";
|
|
8
|
+
import "./token-goat-chunk-QQTWJY2O.mjs";
|
|
9
|
+
import "./token-goat-chunk-EC5F37F4.mjs";
|
|
10
|
+
import "./token-goat-chunk-ZNMNUPAZ.mjs";
|
|
11
|
+
import "./token-goat-chunk-32ZOY4N5.mjs";
|
|
12
|
+
import "./token-goat-chunk-SOAFZNNZ.mjs";
|
|
13
|
+
import "./token-goat-chunk-M52KPT3C.mjs";
|
|
14
|
+
import "./token-goat-chunk-CJLS3CDL.mjs";
|
|
15
|
+
import "./token-goat-chunk-VWZA2H4P.mjs";
|
|
16
|
+
import "./token-goat-chunk-N5LSOVSU.mjs";
|
|
17
|
+
import "./token-goat-chunk-OBOFIHKN.mjs";
|
|
18
|
+
import "./token-goat-chunk-QH7YVYOY.mjs";
|
|
19
|
+
import "./token-goat-chunk-NOSS5VWY.mjs";
|
|
20
|
+
import "./token-goat-chunk-NMD42SFQ.mjs";
|
|
21
|
+
import "./token-goat-chunk-SAMFDIS2.mjs";
|
|
22
|
+
import "./token-goat-chunk-4SMRO4TO.mjs";
|
|
23
|
+
import "./token-goat-chunk-WBA5SKT4.mjs";
|
|
24
|
+
import "./token-goat-chunk-MNWKPRAL.mjs";
|
|
25
|
+
import "./token-goat-chunk-CIMQ2BB3.mjs";
|
|
26
|
+
import "./token-goat-chunk-WDH44VAU.mjs";
|
|
27
|
+
import "./token-goat-chunk-BPGCUMR7.mjs";
|
|
28
|
+
import "./token-goat-chunk-KQBLRPBN.mjs";
|
|
29
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
30
|
+
import "./token-goat-chunk-C75NA7PL.mjs";
|
|
31
|
+
import "./token-goat-chunk-CBIQ7WTD.mjs";
|
|
32
|
+
import "./token-goat-chunk-P6VGNTQT.mjs";
|
|
33
|
+
import "./token-goat-chunk-76FGDLRO.mjs";
|
|
34
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
35
|
+
import "./token-goat-chunk-OXFMP75N.mjs";
|
|
36
|
+
import "./token-goat-chunk-NISNMD7T.mjs";
|
|
37
|
+
import "./token-goat-chunk-EVMZJ27Z.mjs";
|
|
38
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
39
|
+
import "./token-goat-chunk-5Y6ZYL6U.mjs";
|
|
40
|
+
import "./token-goat-chunk-4NAPX7BA.mjs";
|
|
41
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
42
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
43
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
44
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
45
|
+
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
46
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
47
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
48
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
49
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
50
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
51
|
+
import "./token-goat-chunk-F6PAUIEK.mjs";
|
|
52
|
+
import "./token-goat-chunk-65N4RHP4.mjs";
|
|
53
|
+
import "./token-goat-chunk-X2SUP3EI.mjs";
|
|
54
|
+
import "./token-goat-chunk-25TRAWET.mjs";
|
|
55
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
56
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
57
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
58
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
59
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
60
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
61
|
+
import "./token-goat-chunk-EDBDRVH5.mjs";
|
|
62
|
+
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
63
|
+
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
64
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
65
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
66
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
67
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
68
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
69
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
70
|
+
export {
|
|
71
|
+
anchorStatus
|
|
72
|
+
};
|