token-goat 2.9.29 → 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 +53 -42
- package/SECURITY.md +37 -11
- package/THIRD_PARTY_NOTICES.md +41 -4
- 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/ort-wasm-simd-threaded.mjs +59 -0
- package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-25TRAWET.mjs} +23 -6
- package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
- package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-2M7E4PF7.mjs} +43 -14
- package/dist/token-goat-chunk-2UPZGKKY.mjs +188 -0
- 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-2WOUYWLM.mjs → token-goat-chunk-4GILLLWY.mjs} +34 -7
- package/dist/token-goat-chunk-4NAPX7BA.mjs +90 -0
- package/dist/{token-goat-chunk-NMBWLRHW.mjs → token-goat-chunk-4SC7UJYV.mjs} +9981 -11563
- package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
- package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-4ZBFWLXF.mjs} +310 -441
- package/dist/token-goat-chunk-57BIAXJL.mjs +286 -0
- package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
- package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
- package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
- package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
- package/dist/token-goat-chunk-646E6U44.mjs +398 -0
- package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
- package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-6DG6HWP3.mjs} +13 -3
- package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
- package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
- package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-76FGDLRO.mjs} +574 -340
- package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7EZTZOMC.mjs} +780 -767
- package/dist/token-goat-chunk-7MAOA6X4.mjs +3647 -0
- package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
- package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
- package/dist/token-goat-chunk-AUNGYYQX.mjs +184 -0
- package/dist/token-goat-chunk-AUQYRMMH.mjs +2985 -0
- package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
- package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-BA4HI6BW.mjs} +1910 -165
- package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-BFCWY73P.mjs} +58 -20
- package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
- package/dist/token-goat-chunk-BWGFUZZE.mjs +25 -0
- package/dist/token-goat-chunk-C75NA7PL.mjs +322 -0
- package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
- package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
- package/dist/token-goat-chunk-CIMQ2BB3.mjs +233 -0
- package/dist/{token-goat-chunk-DNSPXQXQ.mjs → token-goat-chunk-CJLS3CDL.mjs} +70 -18
- package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-CO3UYX6G.mjs} +7 -1
- package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
- package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
- package/dist/token-goat-chunk-CVCEVUGK.mjs +315 -0
- package/dist/token-goat-chunk-CXHOFN7R.mjs +371 -0
- package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
- package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-DGS2LVNA.mjs} +70 -160
- package/dist/{token-goat-chunk-L7H3U27L.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-EELTBKDM.mjs +613 -0
- package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
- package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
- package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-F4HYL64R.mjs} +12 -2
- package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
- package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
- package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
- package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
- package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
- package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-GL3ETKSC.mjs} +276 -19
- package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-GVB2MUST.mjs} +265 -1567
- package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
- package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
- package/dist/token-goat-chunk-HLPW63A7.mjs +48 -0
- package/dist/token-goat-chunk-HU4TORC5.mjs +1377 -0
- package/dist/token-goat-chunk-I7VKZZAW.mjs +35 -0
- package/dist/token-goat-chunk-IA6XSPE3.mjs +218 -0
- package/dist/token-goat-chunk-IAGXMHIK.mjs +863 -0
- package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-IK2DRMFX.mjs} +129 -74
- package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-INNPTRUX.mjs} +2954 -2783
- package/dist/token-goat-chunk-JJ5BX4F4.mjs +129 -0
- package/dist/token-goat-chunk-JVFSHVFJ.mjs +129 -0
- package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
- package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
- package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
- package/dist/token-goat-chunk-LCNQ2CNN.mjs +497 -0
- 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-2AWQ2R5X.mjs → token-goat-chunk-MHX7XCC3.mjs} +3 -2
- package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
- package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
- package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-N5MMR2IW.mjs} +30 -8
- package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
- package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-NISNMD7T.mjs} +2545 -2953
- package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
- package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
- package/dist/token-goat-chunk-NSNSPPBG.mjs +69 -0
- package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
- package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
- package/dist/token-goat-chunk-ODBT2USM.mjs +800 -0
- 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-ASLWOQ3I.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -1
- package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-P6HQSWQ3.mjs} +55 -47
- package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
- package/dist/token-goat-chunk-PFWIMH2E.mjs +261 -0
- package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
- package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
- package/dist/token-goat-chunk-PX5PQWTY.mjs +462 -0
- package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
- package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
- package/dist/token-goat-chunk-QH7YVYOY.mjs +3957 -0
- package/dist/token-goat-chunk-QLMUHEPB.mjs +43 -0
- package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-QQOJIHL3.mjs} +50 -14
- package/dist/token-goat-chunk-QQTWJY2O.mjs +85 -0
- package/dist/token-goat-chunk-QYHO5CPH.mjs +93 -0
- package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
- package/dist/token-goat-chunk-RSLPOBKQ.mjs +339 -0
- package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
- package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
- package/dist/{token-goat-chunk-PGTH2U4C.mjs → token-goat-chunk-SOAFZNNZ.mjs} +164 -40
- package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-SRTHT7KV.mjs} +33 -15
- package/dist/token-goat-chunk-T5P5ACNQ.mjs +212 -0
- package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
- package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
- package/dist/token-goat-chunk-TM6MC754.mjs +40 -0
- package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
- package/dist/token-goat-chunk-U2KSB4SG.mjs +56 -0
- package/dist/token-goat-chunk-U4WHMG6Y.mjs +898 -0
- package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
- package/dist/token-goat-chunk-UGJHGR5A.mjs +52 -0
- package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-UOUDVA5U.mjs} +76 -16
- package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-URRJ33GR.mjs} +22 -4
- package/dist/token-goat-chunk-UZOROKIS.mjs +165 -0
- package/dist/token-goat-chunk-VIHGGGEI.mjs +4234 -0
- package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
- package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
- package/dist/token-goat-chunk-VWZA2H4P.mjs +368 -0
- package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-VXEXMJDL.mjs} +2964 -3153
- package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
- package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-WDH44VAU.mjs} +19 -22
- package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
- package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
- package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-XLRBNZCC.mjs} +40 -21
- package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-XRKUX6CM.mjs} +4 -0
- package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
- package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
- package/dist/token-goat-chunk-Y2ZTQOCL.mjs +35 -0
- package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-YB4VMGK2.mjs} +15 -4
- package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
- package/dist/{token-goat-chunk-PKRWMHVP.mjs → token-goat-chunk-YHVDKQBR.mjs} +389 -221
- package/dist/token-goat-chunk-YJB5XLWI.mjs +26 -0
- package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-YKB6AQG3.mjs} +53 -31
- package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
- package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
- package/dist/{token-goat-chunk-HUYUHODZ.mjs → token-goat-chunk-YY6AVUFL.mjs} +13246 -12247
- package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
- package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
- package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
- package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
- package/dist/token-goat-hook-client.cjs +87 -23
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +76 -31
- package/dist/token-goat.core.mjs +6 -6
- package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
- package/docs/cli.md +113 -60
- package/docs/install.md +63 -20
- package/docs/security.md +10 -8
- package/package.json +18 -7
- package/scripts/verify-native-dist.mjs +386 -0
- package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
- package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
- package/dist/token-goat-chunk-BGYOZ6DO.mjs +0 -24
- package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
- package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
- package/dist/token-goat-chunk-D4ETHJD6.mjs +0 -246
- package/dist/token-goat-chunk-DNRPXHYH.mjs +0 -1062
- package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
- package/dist/token-goat-chunk-FTP4U4QA.mjs +0 -64
- package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
- package/dist/token-goat-chunk-GLXRTTLE.mjs +0 -36
- package/dist/token-goat-chunk-H5J3C56Q.mjs +0 -1511
- package/dist/token-goat-chunk-IVWI2OCK.mjs +0 -368
- package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
- package/dist/token-goat-chunk-LZNBQTDK.mjs +0 -26
- package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
- package/dist/token-goat-chunk-RTMVLHWX.mjs +0 -7113
- package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
- package/dist/token-goat-chunk-VZQEWRVH.mjs +0 -312
- package/dist/token-goat-chunk-XYWPOSCN.mjs +0 -807
- package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
- package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
- package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
init_define_import_meta_env
|
|
5
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
6
|
+
|
|
7
|
+
// src/shell.ts
|
|
8
|
+
init_define_import_meta_env();
|
|
9
|
+
import * as fs from "node:fs";
|
|
10
|
+
import * as path from "node:path";
|
|
11
|
+
var WSL_LAUNCHER_SEGMENTS = /* @__PURE__ */ new Set(["system32", "syswow64", "windowsapps"]);
|
|
12
|
+
function isExecutable(p) {
|
|
13
|
+
try {
|
|
14
|
+
return fs.statSync(p).isFile();
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function isWslLauncherDir(dir) {
|
|
20
|
+
return dir.toLowerCase().split(/[\\/]+/).some((seg) => WSL_LAUNCHER_SEGMENTS.has(seg));
|
|
21
|
+
}
|
|
22
|
+
function locateBashOnPath(pathValue, isExe = isExecutable) {
|
|
23
|
+
for (const dir of (pathValue ?? "").split(path.delimiter)) {
|
|
24
|
+
if (!dir || isWslLauncherDir(dir)) continue;
|
|
25
|
+
const cand = path.join(dir, "bash.exe");
|
|
26
|
+
if (isExe(cand)) return cand;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function knownGitBashPaths() {
|
|
31
|
+
const localPrograms = process.env["LOCALAPPDATA"] ? path.join(process.env["LOCALAPPDATA"], "Programs") : void 0;
|
|
32
|
+
const bases = [
|
|
33
|
+
process.env["ProgramFiles"],
|
|
34
|
+
process.env["ProgramFiles(x86)"],
|
|
35
|
+
process.env["ProgramW6432"],
|
|
36
|
+
localPrograms
|
|
37
|
+
];
|
|
38
|
+
const out = [];
|
|
39
|
+
for (const base of bases) {
|
|
40
|
+
if (!base) continue;
|
|
41
|
+
out.push(path.join(base, "Git", "bin", "bash.exe"));
|
|
42
|
+
out.push(path.join(base, "Git", "usr", "bin", "bash.exe"));
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
function resolveWindowsBash() {
|
|
47
|
+
if (process.platform !== "win32") return null;
|
|
48
|
+
const override = process.env["TOKEN_GOAT_BASH"];
|
|
49
|
+
if (override && isExecutable(override)) return override;
|
|
50
|
+
const onPath = locateBashOnPath(process.env["PATH"]);
|
|
51
|
+
if (onPath) return onPath;
|
|
52
|
+
for (const cand of knownGitBashPaths()) {
|
|
53
|
+
if (isExecutable(cand)) return cand;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function wrappedShell() {
|
|
58
|
+
if (process.platform !== "win32") return true;
|
|
59
|
+
return resolveWindowsBash() ?? true;
|
|
60
|
+
}
|
|
61
|
+
function canRunWrappedShell() {
|
|
62
|
+
return process.platform !== "win32" || resolveWindowsBash() !== null;
|
|
63
|
+
}
|
|
64
|
+
function resolvePowerShell(env = process.env, isExe = isExecutable) {
|
|
65
|
+
const override = env["TOKEN_GOAT_POWERSHELL"] || env["TOKEN_GOAT_PWSH"];
|
|
66
|
+
if (override && isExe(override)) return override;
|
|
67
|
+
if (process.platform === "win32") {
|
|
68
|
+
for (const dir of (env["PATH"] ?? "").split(path.delimiter)) {
|
|
69
|
+
if (!dir) continue;
|
|
70
|
+
const cand = path.join(dir, "pwsh.exe");
|
|
71
|
+
if (isExe(cand)) return cand;
|
|
72
|
+
}
|
|
73
|
+
const systemRoot = env["SystemRoot"] ?? env["windir"] ?? "C:\\Windows";
|
|
74
|
+
const defaultPs = path.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
75
|
+
if (isExe(defaultPs)) return defaultPs;
|
|
76
|
+
return "powershell.exe";
|
|
77
|
+
}
|
|
78
|
+
for (const dir of (env["PATH"] ?? "").split(path.delimiter)) {
|
|
79
|
+
if (!dir) continue;
|
|
80
|
+
const cand = path.join(dir, "pwsh");
|
|
81
|
+
if (isExe(cand)) return cand;
|
|
82
|
+
}
|
|
83
|
+
for (const cand of ["/usr/bin/pwsh", "/usr/local/bin/pwsh", "/opt/microsoft/powershell/7/pwsh"]) {
|
|
84
|
+
if (isExe(cand)) return cand;
|
|
85
|
+
}
|
|
86
|
+
return "pwsh";
|
|
87
|
+
}
|
|
88
|
+
function canRunPowerShell(env = process.env, isExe = isExecutable) {
|
|
89
|
+
if (process.platform === "win32") return true;
|
|
90
|
+
try {
|
|
91
|
+
const ps = resolvePowerShell(env, isExe);
|
|
92
|
+
return isExe(ps);
|
|
93
|
+
} catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function powerShellCommandArgs(command) {
|
|
98
|
+
return ["-NoProfile", "-NonInteractive", "-Command", command];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
wrappedShell,
|
|
103
|
+
canRunWrappedShell,
|
|
104
|
+
resolvePowerShell,
|
|
105
|
+
canRunPowerShell,
|
|
106
|
+
powerShellCommandArgs
|
|
107
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ambiguityPicks,
|
|
5
|
+
confinedProjectRoot,
|
|
6
|
+
confinementRefusal,
|
|
7
|
+
extraFileArgsNote,
|
|
8
|
+
fileConfinementRefusal,
|
|
9
|
+
findParentName,
|
|
10
|
+
findSymbolCandidates,
|
|
11
|
+
formatAmbiguity,
|
|
12
|
+
namedSpecsMergeable,
|
|
13
|
+
parseColonLineRange,
|
|
14
|
+
parseColonLineSpec,
|
|
15
|
+
parseCrossFileMultiSpec,
|
|
16
|
+
parseLineRange,
|
|
17
|
+
parseMultiFileSpec,
|
|
18
|
+
parseReadSpec,
|
|
19
|
+
qualifiedSpellings,
|
|
20
|
+
readSpecsMergeable,
|
|
21
|
+
resolveProjectConfinement,
|
|
22
|
+
resolveQualifiedSpec,
|
|
23
|
+
resolveQualifiedSpecDef,
|
|
24
|
+
resolveSymbolSpec,
|
|
25
|
+
resolveSymbolSpecOrEmitError,
|
|
26
|
+
runLineRange,
|
|
27
|
+
runLineRegion,
|
|
28
|
+
specFilePart,
|
|
29
|
+
specScopeRoot,
|
|
30
|
+
stripHtmlIdSpelling
|
|
31
|
+
} from "./token-goat-chunk-4SC7UJYV.mjs";
|
|
32
|
+
import "./token-goat-chunk-QQTWJY2O.mjs";
|
|
33
|
+
import "./token-goat-chunk-EC5F37F4.mjs";
|
|
34
|
+
import "./token-goat-chunk-ZNMNUPAZ.mjs";
|
|
35
|
+
import "./token-goat-chunk-32ZOY4N5.mjs";
|
|
36
|
+
import "./token-goat-chunk-SOAFZNNZ.mjs";
|
|
37
|
+
import "./token-goat-chunk-M52KPT3C.mjs";
|
|
38
|
+
import "./token-goat-chunk-CJLS3CDL.mjs";
|
|
39
|
+
import {
|
|
40
|
+
resolveLineRegions
|
|
41
|
+
} from "./token-goat-chunk-VWZA2H4P.mjs";
|
|
42
|
+
import "./token-goat-chunk-N5LSOVSU.mjs";
|
|
43
|
+
import "./token-goat-chunk-OBOFIHKN.mjs";
|
|
44
|
+
import "./token-goat-chunk-QH7YVYOY.mjs";
|
|
45
|
+
import "./token-goat-chunk-NOSS5VWY.mjs";
|
|
46
|
+
import "./token-goat-chunk-NMD42SFQ.mjs";
|
|
47
|
+
import "./token-goat-chunk-SAMFDIS2.mjs";
|
|
48
|
+
import "./token-goat-chunk-4SMRO4TO.mjs";
|
|
49
|
+
import "./token-goat-chunk-WBA5SKT4.mjs";
|
|
50
|
+
import "./token-goat-chunk-MNWKPRAL.mjs";
|
|
51
|
+
import "./token-goat-chunk-CIMQ2BB3.mjs";
|
|
52
|
+
import "./token-goat-chunk-WDH44VAU.mjs";
|
|
53
|
+
import "./token-goat-chunk-BPGCUMR7.mjs";
|
|
54
|
+
import "./token-goat-chunk-KQBLRPBN.mjs";
|
|
55
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
56
|
+
import "./token-goat-chunk-C75NA7PL.mjs";
|
|
57
|
+
import "./token-goat-chunk-CBIQ7WTD.mjs";
|
|
58
|
+
import "./token-goat-chunk-P6VGNTQT.mjs";
|
|
59
|
+
import "./token-goat-chunk-76FGDLRO.mjs";
|
|
60
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
61
|
+
import "./token-goat-chunk-OXFMP75N.mjs";
|
|
62
|
+
import "./token-goat-chunk-NISNMD7T.mjs";
|
|
63
|
+
import "./token-goat-chunk-EVMZJ27Z.mjs";
|
|
64
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
65
|
+
import "./token-goat-chunk-5Y6ZYL6U.mjs";
|
|
66
|
+
import "./token-goat-chunk-4NAPX7BA.mjs";
|
|
67
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
68
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
69
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
70
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
71
|
+
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
72
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
73
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
74
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
75
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
76
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
77
|
+
import "./token-goat-chunk-F6PAUIEK.mjs";
|
|
78
|
+
import "./token-goat-chunk-65N4RHP4.mjs";
|
|
79
|
+
import "./token-goat-chunk-X2SUP3EI.mjs";
|
|
80
|
+
import "./token-goat-chunk-25TRAWET.mjs";
|
|
81
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
82
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
83
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
84
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
85
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
86
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
87
|
+
import "./token-goat-chunk-EDBDRVH5.mjs";
|
|
88
|
+
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
89
|
+
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
90
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
91
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
92
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
93
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
94
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
95
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
96
|
+
export {
|
|
97
|
+
ambiguityPicks,
|
|
98
|
+
confinedProjectRoot,
|
|
99
|
+
confinementRefusal,
|
|
100
|
+
extraFileArgsNote,
|
|
101
|
+
fileConfinementRefusal,
|
|
102
|
+
findParentName,
|
|
103
|
+
findSymbolCandidates,
|
|
104
|
+
formatAmbiguity,
|
|
105
|
+
namedSpecsMergeable,
|
|
106
|
+
parseColonLineRange,
|
|
107
|
+
parseColonLineSpec,
|
|
108
|
+
parseCrossFileMultiSpec,
|
|
109
|
+
parseLineRange,
|
|
110
|
+
parseMultiFileSpec,
|
|
111
|
+
parseReadSpec,
|
|
112
|
+
qualifiedSpellings,
|
|
113
|
+
readSpecsMergeable,
|
|
114
|
+
resolveLineRegions,
|
|
115
|
+
resolveProjectConfinement,
|
|
116
|
+
resolveQualifiedSpec,
|
|
117
|
+
resolveQualifiedSpecDef,
|
|
118
|
+
resolveSymbolSpec,
|
|
119
|
+
resolveSymbolSpecOrEmitError,
|
|
120
|
+
runLineRange,
|
|
121
|
+
runLineRegion,
|
|
122
|
+
specFilePart,
|
|
123
|
+
specScopeRoot,
|
|
124
|
+
stripHtmlIdSpelling
|
|
125
|
+
};
|
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
readCompactDroppedPaths,
|
|
5
|
+
renderWebFetchRows
|
|
6
|
+
} from "./token-goat-chunk-LCNQ2CNN.mjs";
|
|
6
7
|
import {
|
|
7
|
-
SESSIONS_SUBDIR,
|
|
8
8
|
extractChecklistSection,
|
|
9
9
|
getSkillFilePath,
|
|
10
10
|
listSkills
|
|
11
|
-
} from "./token-goat-chunk-
|
|
11
|
+
} from "./token-goat-chunk-SAMFDIS2.mjs";
|
|
12
|
+
import {
|
|
13
|
+
SESSIONS_SUBDIR
|
|
14
|
+
} from "./token-goat-chunk-WBA5SKT4.mjs";
|
|
12
15
|
import {
|
|
13
16
|
getBashOutput
|
|
14
|
-
} from "./token-goat-chunk-
|
|
17
|
+
} from "./token-goat-chunk-KQBLRPBN.mjs";
|
|
15
18
|
import {
|
|
16
19
|
loadBlob
|
|
17
|
-
} from "./token-goat-chunk-
|
|
20
|
+
} from "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
18
21
|
import {
|
|
19
22
|
resolveProjectRoot
|
|
20
|
-
} from "./token-goat-chunk-
|
|
23
|
+
} from "./token-goat-chunk-4GBVPH3D.mjs";
|
|
21
24
|
import {
|
|
22
25
|
runGit,
|
|
23
26
|
safeSlice
|
|
24
|
-
} from "./token-goat-chunk-
|
|
27
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
28
|
+
import {
|
|
29
|
+
quotedArg
|
|
30
|
+
} from "./token-goat-chunk-GGGG7RWB.mjs";
|
|
25
31
|
import {
|
|
26
32
|
displaySafePath,
|
|
27
33
|
displaySafeText,
|
|
28
34
|
neutralizeSpokenMarkers
|
|
29
|
-
} from "./token-goat-chunk-
|
|
35
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
30
36
|
import {
|
|
31
37
|
init_define_import_meta_env
|
|
32
38
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -37,6 +43,8 @@ import { readFile } from "node:fs/promises";
|
|
|
37
43
|
var MAX_RESUME_TOKENS = 2e3;
|
|
38
44
|
var MAX_RESUME_CHARS = MAX_RESUME_TOKENS * 4;
|
|
39
45
|
var MAX_RESUME_WEB_FETCHES = 8;
|
|
46
|
+
var MAX_RESUME_DROPPED = 16;
|
|
47
|
+
var DROPPED_MARK = " (not in the compaction summary)";
|
|
40
48
|
var SKILL_MAX_COUNT = 3;
|
|
41
49
|
var SKILL_MAX_CHARS_EACH = 400;
|
|
42
50
|
async function buildSkillsSection(sessionId) {
|
|
@@ -59,7 +67,7 @@ async function buildSkillsSection(sessionId) {
|
|
|
59
67
|
skillLines.push(`**${displaySafeText(skill.name)}**:`);
|
|
60
68
|
skillLines.push(neutralizeSpokenMarkers(trimmed));
|
|
61
69
|
} else {
|
|
62
|
-
skillLines.push(`**${displaySafeText(skill.name)}** \u2014 \`token-goat skill-body ${displaySafeText(skill.name)} --section DoD\``);
|
|
70
|
+
skillLines.push(`**${displaySafeText(skill.name)}** \u2014 \`token-goat skill-body ${quotedArg(displaySafeText(skill.name))} --section DoD\``);
|
|
63
71
|
}
|
|
64
72
|
}
|
|
65
73
|
skillLines.push("");
|
|
@@ -75,32 +83,43 @@ async function buildResumePacket(sessionId) {
|
|
|
75
83
|
lines.push(...await buildSkillsSection(sessionId));
|
|
76
84
|
} catch {
|
|
77
85
|
}
|
|
86
|
+
const dropped = new Set(readCompactDroppedPaths(sessionId));
|
|
87
|
+
const row = (p) => {
|
|
88
|
+
const shown = displaySafePath(p);
|
|
89
|
+
return dropped.delete(shown) ? `- ${shown}${DROPPED_MARK}` : `- ${shown}`;
|
|
90
|
+
};
|
|
78
91
|
const editedPaths = filesArr.filter((f) => f["wasEdited"] === true).map((f) => typeof f["path"] === "string" ? f["path"] : "").filter(Boolean).slice(0, 10);
|
|
79
92
|
if (editedPaths.length > 0) {
|
|
80
93
|
lines.push("## Edited files");
|
|
81
|
-
for (const p of editedPaths) lines.push(
|
|
94
|
+
for (const p of editedPaths) lines.push(row(p));
|
|
82
95
|
lines.push("");
|
|
83
96
|
}
|
|
84
97
|
const topRead = [...filesArr].filter((f) => f["wasEdited"] !== true).sort((a, b) => (typeof b["readCount"] === "number" ? b["readCount"] : 0) - (typeof a["readCount"] === "number" ? a["readCount"] : 0)).slice(0, 8).map((f) => typeof f["path"] === "string" ? f["path"] : "").filter(Boolean);
|
|
85
98
|
if (topRead.length > 0) {
|
|
86
99
|
lines.push("## Top files read");
|
|
87
|
-
for (const p of topRead) lines.push(
|
|
100
|
+
for (const p of topRead) lines.push(row(p));
|
|
101
|
+
lines.push("");
|
|
102
|
+
}
|
|
103
|
+
if (dropped.size > 0) {
|
|
104
|
+
const rest = [...dropped];
|
|
105
|
+
lines.push("## Also not in the compaction summary");
|
|
106
|
+
for (const p of rest.slice(0, MAX_RESUME_DROPPED)) lines.push(`- ${p}`);
|
|
107
|
+
if (rest.length > MAX_RESUME_DROPPED) lines.push(`- ... and ${rest.length - MAX_RESUME_DROPPED} more`);
|
|
88
108
|
lines.push("");
|
|
89
109
|
}
|
|
90
110
|
const bashOutputs = Array.isArray(raw["bashOutputs"]) ? raw["bashOutputs"] : [];
|
|
91
111
|
const recentBash = bashOutputs.slice(-2);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (bashEntry !== null) lines.push(`- ${displaySafeText(bashEntry.command)}`);
|
|
98
|
-
}
|
|
112
|
+
const bashRows = [];
|
|
113
|
+
for (const entry of recentBash) {
|
|
114
|
+
if (Array.isArray(entry) && typeof entry[1] === "string") {
|
|
115
|
+
const bashEntry = getBashOutput(entry[1]);
|
|
116
|
+
if (bashEntry !== null) bashRows.push(`- ${displaySafeText(bashEntry.command)}`);
|
|
99
117
|
}
|
|
100
|
-
lines.push("");
|
|
101
118
|
}
|
|
119
|
+
if (bashRows.length > 0) lines.push("## Recent bash commands", ...bashRows, "");
|
|
102
120
|
const webFetches = Array.isArray(raw["webFetches"]) ? raw["webFetches"] : [];
|
|
103
|
-
const
|
|
121
|
+
const webEntries = webFetches.slice(-MAX_RESUME_WEB_FETCHES).filter((e) => Array.isArray(e) && typeof e[0] === "string" && typeof e[1] === "string");
|
|
122
|
+
const webRows = renderWebFetchRows(webEntries);
|
|
104
123
|
if (webRows.length > 0) {
|
|
105
124
|
lines.push("## Web pages fetched");
|
|
106
125
|
lines.push(...webRows);
|
|
@@ -3,6 +3,9 @@ const require = __cjsRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
clearModuleCaches
|
|
5
5
|
} from "./token-goat-chunk-YZAAZU2S.mjs";
|
|
6
|
+
import {
|
|
7
|
+
_resetDataDirCacheForTesting
|
|
8
|
+
} from "./token-goat-chunk-CO3UYX6G.mjs";
|
|
6
9
|
import {
|
|
7
10
|
init_define_import_meta_env
|
|
8
11
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -51,6 +54,7 @@ async function serveOne(req, runFn, reset = clearModuleCaches) {
|
|
|
51
54
|
let status;
|
|
52
55
|
try {
|
|
53
56
|
if (req.cwd !== void 0) process.chdir(req.cwd);
|
|
57
|
+
_resetDataDirCacheForTesting();
|
|
54
58
|
process.exitCode = void 0;
|
|
55
59
|
await runFn([process.execPath, "token-goat", ...req.argv]);
|
|
56
60
|
status = typeof process.exitCode === "number" ? process.exitCode : 0;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
init_define_import_meta_env
|
|
5
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
6
|
+
|
|
7
|
+
// src/token_estimate.ts
|
|
8
|
+
init_define_import_meta_env();
|
|
9
|
+
var BYTES_PER_TOKEN = {
|
|
10
|
+
text: 4,
|
|
11
|
+
dense: 1.45,
|
|
12
|
+
wide: 3.6
|
|
13
|
+
};
|
|
14
|
+
var UTF8_BYTES_PER_UNIT = {
|
|
15
|
+
text: 1,
|
|
16
|
+
dense: 1,
|
|
17
|
+
wide: 3
|
|
18
|
+
};
|
|
19
|
+
var GUARD_MARGIN = 0.75;
|
|
20
|
+
function creditDivisor(cls = "text") {
|
|
21
|
+
return BYTES_PER_TOKEN[cls];
|
|
22
|
+
}
|
|
23
|
+
function guardDivisor(cls = "text") {
|
|
24
|
+
return BYTES_PER_TOKEN[cls] * GUARD_MARGIN / UTF8_BYTES_PER_UNIT[cls];
|
|
25
|
+
}
|
|
26
|
+
var DENSE_ALPHABET = /^[A-Za-z0-9+/=_-]$/;
|
|
27
|
+
var WIDE_CHAR = /^[㐀-鿿-ヿ가-]$/;
|
|
28
|
+
var WIDE_SHARE = 0.3;
|
|
29
|
+
function isWideCode(code) {
|
|
30
|
+
return code >= 13312 && code <= 40959 || code >= 12352 && code <= 12543 || code >= 44032 && code <= 55215;
|
|
31
|
+
}
|
|
32
|
+
function countWide(text) {
|
|
33
|
+
let wide = 0;
|
|
34
|
+
for (let i = 0; i < text.length; i++) if (isWideCode(text.charCodeAt(i))) wide++;
|
|
35
|
+
return wide;
|
|
36
|
+
}
|
|
37
|
+
var GUARD_UNITS_PER_TOKEN = 9;
|
|
38
|
+
var WIDE_GUARD_UNITS = 10;
|
|
39
|
+
var TEXT_GUARD_UNITS = 3;
|
|
40
|
+
function guardUnits(text) {
|
|
41
|
+
const wide = countWide(text);
|
|
42
|
+
return wide * WIDE_GUARD_UNITS + (text.length - wide) * TEXT_GUARD_UNITS;
|
|
43
|
+
}
|
|
44
|
+
function guardTokens(text, dense = false) {
|
|
45
|
+
if (dense) return text.length / guardDivisor("dense");
|
|
46
|
+
const wide = countWide(text);
|
|
47
|
+
return wide / guardDivisor("wide") + (text.length - wide) / guardDivisor("text");
|
|
48
|
+
}
|
|
49
|
+
var MIN_DENSE_SAMPLE = 200;
|
|
50
|
+
var MIN_DENSE_DISTINCT = 16;
|
|
51
|
+
var CLASSIFY_SAMPLE_CHARS = 4096;
|
|
52
|
+
function classifyContent(text) {
|
|
53
|
+
const sample = text.slice(0, CLASSIFY_SAMPLE_CHARS);
|
|
54
|
+
let whitespace = 0;
|
|
55
|
+
let wide = 0;
|
|
56
|
+
let dense = 0;
|
|
57
|
+
const distinct = /* @__PURE__ */ new Set();
|
|
58
|
+
for (const ch of sample) {
|
|
59
|
+
if (ch === " " || ch === "\n" || ch === " " || ch === "\r") whitespace++;
|
|
60
|
+
else if (WIDE_CHAR.test(ch)) wide++;
|
|
61
|
+
else if (DENSE_ALPHABET.test(ch)) {
|
|
62
|
+
dense++;
|
|
63
|
+
distinct.add(ch);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (wide > 0 && wide >= (sample.length - whitespace) * WIDE_SHARE) return "wide";
|
|
67
|
+
if (sample.length < MIN_DENSE_SAMPLE) return "text";
|
|
68
|
+
if (whitespace / sample.length >= 0.05) return "text";
|
|
69
|
+
if (distinct.size < MIN_DENSE_DISTINCT) return "text";
|
|
70
|
+
return dense / sample.length >= 0.95 ? "dense" : "text";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
BYTES_PER_TOKEN,
|
|
75
|
+
creditDivisor,
|
|
76
|
+
guardDivisor,
|
|
77
|
+
GUARD_UNITS_PER_TOKEN,
|
|
78
|
+
TEXT_GUARD_UNITS,
|
|
79
|
+
guardUnits,
|
|
80
|
+
guardTokens,
|
|
81
|
+
classifyContent
|
|
82
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
MAX_TRACKED_FAILURES,
|
|
5
|
+
REPEAT_NOTICE_EXEMPT,
|
|
6
|
+
diagnoseEditFailure,
|
|
7
|
+
extractFailureText,
|
|
8
|
+
failureSignature,
|
|
9
|
+
loadNearMiss,
|
|
10
|
+
postToolUseFailureHandler,
|
|
11
|
+
postToolUseFailureWithExtras,
|
|
12
|
+
repeatFailureNotice
|
|
13
|
+
} from "./token-goat-chunk-6ENQSNRZ.mjs";
|
|
14
|
+
import "./token-goat-chunk-PX5PQWTY.mjs";
|
|
15
|
+
import "./token-goat-chunk-JVFSHVFJ.mjs";
|
|
16
|
+
import "./token-goat-chunk-ODBT2USM.mjs";
|
|
17
|
+
import "./token-goat-chunk-DGS2LVNA.mjs";
|
|
18
|
+
import "./token-goat-chunk-INNPTRUX.mjs";
|
|
19
|
+
import "./token-goat-chunk-4SMRO4TO.mjs";
|
|
20
|
+
import "./token-goat-chunk-WBA5SKT4.mjs";
|
|
21
|
+
import "./token-goat-chunk-MNWKPRAL.mjs";
|
|
22
|
+
import "./token-goat-chunk-CIMQ2BB3.mjs";
|
|
23
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
24
|
+
import "./token-goat-chunk-C75NA7PL.mjs";
|
|
25
|
+
import "./token-goat-chunk-CBIQ7WTD.mjs";
|
|
26
|
+
import "./token-goat-chunk-P6VGNTQT.mjs";
|
|
27
|
+
import "./token-goat-chunk-76FGDLRO.mjs";
|
|
28
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
29
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
30
|
+
import "./token-goat-chunk-4NAPX7BA.mjs";
|
|
31
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
32
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
33
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
34
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
35
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
36
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
37
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
38
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
39
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
40
|
+
import "./token-goat-chunk-F6PAUIEK.mjs";
|
|
41
|
+
import "./token-goat-chunk-65N4RHP4.mjs";
|
|
42
|
+
import "./token-goat-chunk-X2SUP3EI.mjs";
|
|
43
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
44
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
45
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
46
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
47
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
48
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
49
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
50
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
51
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
52
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
53
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
54
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
55
|
+
export {
|
|
56
|
+
MAX_TRACKED_FAILURES,
|
|
57
|
+
REPEAT_NOTICE_EXEMPT,
|
|
58
|
+
diagnoseEditFailure,
|
|
59
|
+
extractFailureText,
|
|
60
|
+
failureSignature,
|
|
61
|
+
loadNearMiss,
|
|
62
|
+
postToolUseFailureHandler,
|
|
63
|
+
postToolUseFailureWithExtras,
|
|
64
|
+
repeatFailureNotice
|
|
65
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
inlineSlideMath,
|
|
5
|
+
pptxAllSlidesText,
|
|
6
|
+
pptxNotesText,
|
|
7
|
+
pptxOutline,
|
|
8
|
+
pptxSlideText,
|
|
9
|
+
pptxTextGrep
|
|
10
|
+
} from "./token-goat-chunk-URRJ33GR.mjs";
|
|
11
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
12
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
13
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
14
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
15
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
16
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
17
|
+
import "./token-goat-chunk-2M7E4PF7.mjs";
|
|
18
|
+
import "./token-goat-chunk-E45INMY3.mjs";
|
|
19
|
+
import "./token-goat-chunk-EDBDRVH5.mjs";
|
|
20
|
+
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
21
|
+
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
22
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
23
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
24
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
25
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
26
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
27
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
28
|
+
export {
|
|
29
|
+
inlineSlideMath,
|
|
30
|
+
pptxAllSlidesText,
|
|
31
|
+
pptxNotesText,
|
|
32
|
+
pptxOutline,
|
|
33
|
+
pptxSlideText,
|
|
34
|
+
pptxTextGrep
|
|
35
|
+
};
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
ooxmlPartBudget,
|
|
12
12
|
parseOoxmlPart,
|
|
13
13
|
readOoxmlZip
|
|
14
|
-
} from "./token-goat-chunk-
|
|
14
|
+
} from "./token-goat-chunk-2M7E4PF7.mjs";
|
|
15
15
|
import {
|
|
16
16
|
displaySafeText
|
|
17
|
-
} from "./token-goat-chunk-
|
|
17
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
18
18
|
import {
|
|
19
19
|
init_define_import_meta_env
|
|
20
20
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -24,6 +24,11 @@ init_define_import_meta_env();
|
|
|
24
24
|
function paragraphStyleVal(p) {
|
|
25
25
|
return p["w:pPr"]?.["w:pStyle"]?.["@_w:val"];
|
|
26
26
|
}
|
|
27
|
+
function gridSpanOf(tc) {
|
|
28
|
+
const raw = tc["w:tcPr"]?.["w:gridSpan"]?.["@_w:val"];
|
|
29
|
+
const n = raw === void 0 ? 1 : parseInt(String(raw), 10);
|
|
30
|
+
return Number.isFinite(n) && n > 1 ? Math.min(n, 64) : 1;
|
|
31
|
+
}
|
|
27
32
|
function headingLevel(styleVal) {
|
|
28
33
|
if (styleVal === void 0) return null;
|
|
29
34
|
if (/^title$/i.test(styleVal)) return 1;
|
|
@@ -53,10 +58,14 @@ async function docxOutline(filePath) {
|
|
|
53
58
|
}
|
|
54
59
|
return out;
|
|
55
60
|
}
|
|
56
|
-
async function docxText(filePath) {
|
|
61
|
+
async function docxText(filePath, opts = {}) {
|
|
57
62
|
const parsed = await loadDocumentBody(filePath);
|
|
58
63
|
const paragraphs = collectElements(parsed, "w:p");
|
|
59
|
-
const lines = paragraphs.map((p) =>
|
|
64
|
+
const lines = paragraphs.map((p) => {
|
|
65
|
+
const text = collectTextRuns(p, "w:t").join("");
|
|
66
|
+
const level = opts.markdownHeadings === true ? headingLevel(paragraphStyleVal(p)) : null;
|
|
67
|
+
return level !== null && text.trim().length > 0 ? `${"#".repeat(level)} ${text.trim()}` : text;
|
|
68
|
+
}).filter((t) => t.trim().length > 0);
|
|
60
69
|
return lines.join("\n\n");
|
|
61
70
|
}
|
|
62
71
|
async function docxTables(filePath) {
|
|
@@ -72,8 +81,10 @@ async function docxTables(filePath) {
|
|
|
72
81
|
const tcElements = collectElements(tr, "w:tc");
|
|
73
82
|
const rowCells = [];
|
|
74
83
|
for (const tc of tcElements) {
|
|
84
|
+
const span = gridSpanOf(tc);
|
|
75
85
|
const cellText = collectParagraphTexts(tc, "w:p", "w:t", ["w:tbl"]).map((t) => t.replace(/\r?\n/g, " ").trim()).filter((t) => t.length > 0).join(" ");
|
|
76
86
|
rowCells.push(cellText);
|
|
87
|
+
for (let k = 1; k < span; k++) rowCells.push("");
|
|
77
88
|
}
|
|
78
89
|
if (rowCells.length > maxCols) maxCols = rowCells.length;
|
|
79
90
|
rows.push(rowCells);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
init_define_import_meta_env
|
|
5
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
6
|
+
|
|
7
|
+
// src/served_extent.ts
|
|
8
|
+
init_define_import_meta_env();
|
|
9
|
+
var NARROWING_FLAG = /\s(?:--(?:grep|max-lines|head|tail|section|stats|json|list|help)\b|-[A-Za-gik-z]*[jh])/;
|
|
10
|
+
function rangeSuffix(spec) {
|
|
11
|
+
const m = /^(.+)@(\d+)(?:-(\d+))?$/.exec(spec);
|
|
12
|
+
if (m === null || m[1].includes("::")) return null;
|
|
13
|
+
const start = parseInt(m[2], 10);
|
|
14
|
+
return { file: m[1], start, end: m[3] !== void 0 ? parseInt(m[3], 10) : start };
|
|
15
|
+
}
|
|
16
|
+
var SHELL_OPERATOR = /[|<>;&]/;
|
|
17
|
+
var STDERR_ONLY_TAIL = /(?:[ \t]+2>[ \t]*(?:\/dev\/null|&1|\$null))+[ \t]*$/;
|
|
18
|
+
async function servedExtents(sub, spec, cmd, projectRoot) {
|
|
19
|
+
if (NARROWING_FLAG.test(cmd)) return [];
|
|
20
|
+
const { maskQuotedSpans } = await import("./token-goat-chunk-JJ5BX4F4.mjs");
|
|
21
|
+
if (SHELL_OPERATOR.test(maskQuotedSpans(cmd).replace(STDERR_ONLY_TAIL, ""))) return [];
|
|
22
|
+
if (sub === "read") {
|
|
23
|
+
const range = rangeSuffix(spec);
|
|
24
|
+
if (range !== null) return range.end >= range.start ? [{ filePath: range.file, start: range.start, end: range.end }] : [];
|
|
25
|
+
}
|
|
26
|
+
const { parseColonLineRange, parseReadSpec, resolveSymbolSpec } = await import("./token-goat-chunk-X3BELZSJ.mjs");
|
|
27
|
+
const { file, symbol } = parseReadSpec(spec);
|
|
28
|
+
if (symbol === void 0 || symbol === "") return [];
|
|
29
|
+
if (sub === "section") {
|
|
30
|
+
const [{ readSection }, { readFileText }] = await Promise.all([import("./token-goat-chunk-YPBZYQRV.mjs"), import("./token-goat-chunk-MBEG42H7.mjs")]);
|
|
31
|
+
const hit = readSection(file, symbol, readFileText);
|
|
32
|
+
return hit !== null && hit.occurrences === void 0 ? [{ filePath: file, start: hit.lineStart, end: hit.lineEnd }] : [];
|
|
33
|
+
}
|
|
34
|
+
if (sub !== "read") return [];
|
|
35
|
+
const colonRange = parseColonLineRange(symbol);
|
|
36
|
+
if (colonRange !== null) return [{ filePath: file, start: colonRange.start, end: colonRange.end }];
|
|
37
|
+
const extents = [];
|
|
38
|
+
for (const name of symbol.split(",").map((s) => s.trim()).filter((s) => s.length > 0)) {
|
|
39
|
+
const resolution = resolveSymbolSpec(`${file}::${name}`, void 0, projectRoot ?? void 0);
|
|
40
|
+
if (resolution.kind === "ok") extents.push({ filePath: resolution.entry.filePath, start: resolution.entry.lineStart, end: resolution.entry.lineEnd });
|
|
41
|
+
}
|
|
42
|
+
return extents;
|
|
43
|
+
}
|
|
44
|
+
var WHOLE_FILE_READ = /^(?:token-goat|tg)\s+read\s+(?:"[^"]+"|'[^']+'|[^\s"'|<>;&-][^\s|<>;&]*)\s*$/;
|
|
45
|
+
function isWholeFileRead(sub, spec, filePath, cmd) {
|
|
46
|
+
return sub === "read" && spec === filePath && WHOLE_FILE_READ.test(cmd.trim());
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
isWholeFileRead,
|
|
50
|
+
servedExtents
|
|
51
|
+
};
|