token-goat 2.9.12 → 2.9.14
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 +20 -1
- package/dist/token-goat-chunk-2ESBO4IN.mjs +209 -0
- package/dist/token-goat-chunk-3BTK54F3.mjs +1733 -0
- package/dist/{token-goat-chunk-6NIGPPN6.mjs → token-goat-chunk-3XQPEJMV.mjs} +1 -1
- package/dist/token-goat-chunk-4SDX3QP3.mjs +122 -0
- package/dist/token-goat-chunk-7OGKZ7AP.mjs +142 -0
- package/dist/token-goat-chunk-AH6QILZM.mjs +26 -0
- package/dist/token-goat-chunk-AMYCQJX4.mjs +1548 -0
- package/dist/{token-goat-chunk-OTW7LC4Y.mjs → token-goat-chunk-ASVVF4JV.mjs} +13 -10
- package/dist/{token-goat-chunk-GCXX67HM.mjs → token-goat-chunk-DAMXYVIW.mjs} +12477 -12156
- package/dist/token-goat-chunk-DBNY4RLN.mjs +308 -0
- package/dist/token-goat-chunk-EG3663UT.mjs +226 -0
- package/dist/token-goat-chunk-EZNVAIR3.mjs +21 -0
- package/dist/token-goat-chunk-GMOUBOX4.mjs +386 -0
- package/dist/{token-goat-chunk-6F5TLJC7.mjs → token-goat-chunk-HF6H7RNK.mjs} +1 -1
- package/dist/{token-goat-chunk-GM6QZWCF.mjs → token-goat-chunk-IT6O3PNN.mjs} +2660 -6877
- package/dist/token-goat-chunk-NEI4NC54.mjs +424 -0
- package/dist/token-goat-chunk-O5WAMISC.mjs +167 -0
- package/dist/{token-goat-chunk-LHLQFGWQ.mjs → token-goat-chunk-OMNQUUIT.mjs} +9 -27
- package/dist/{token-goat-chunk-SF2CKCFQ.mjs → token-goat-chunk-PGGDW7DZ.mjs} +30 -13
- package/dist/token-goat-chunk-POBYR64E.mjs +1632 -0
- package/dist/token-goat-chunk-PRJVGIC5.mjs +58 -0
- package/dist/{token-goat-chunk-4CK445AW.mjs → token-goat-chunk-RUDOKYPJ.mjs} +10074 -9765
- package/dist/token-goat-chunk-SAQ5PG4L.mjs +2634 -0
- package/dist/token-goat-chunk-T2IWWTHB.mjs +3155 -0
- package/dist/{token-goat-chunk-TOGYS5A7.mjs → token-goat-chunk-VZYD4OZB.mjs} +1469 -5752
- package/dist/token-goat-chunk-XEH6KBWW.mjs +23 -0
- package/dist/token-goat-chunk-XQF5J25J.mjs +33 -0
- package/dist/token-goat-chunk-XTQAOTSO.mjs +89 -0
- package/dist/{token-goat-chunk-THLHC6QJ.mjs → token-goat-chunk-XVZ4MNQC.mjs} +614 -603
- package/dist/token-goat-chunk-Y4AFKTHK.mjs +22 -0
- package/dist/token-goat-chunk-YHGTGG6K.mjs +396 -0
- package/dist/{token-goat-chunk-SBYRP3X4.mjs → token-goat-chunk-YTQHZJXW.mjs} +61 -27
- package/dist/token-goat-chunk-Z6UXPYJA.mjs +62 -0
- package/dist/token-goat-chunk-ZD4EM4LR.mjs +30 -0
- package/dist/token-goat-chunk-ZFM4PWXL.mjs +585 -0
- package/dist/{token-goat-chunk-A6QTLAWO.mjs → token-goat-chunk-ZYNNQ36L.mjs} +128 -328
- package/dist/token-goat-hook.mjs +12 -6
- package/dist/token-goat.core.mjs +22 -7
- package/docs/cli.md +12 -8
- package/docs/security.md +1 -1
- package/package.json +4 -2
- package/dist/token-goat-chunk-HKFOH6JH.mjs +0 -28
- package/dist/token-goat-chunk-LOCOX2ML.mjs +0 -3564
- package/dist/token-goat-chunk-VRWX6QYW.mjs +0 -24
|
@@ -3,7 +3,7 @@ const require = __cjsRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
deliveredOutputBytes,
|
|
5
5
|
wrappedShell
|
|
6
|
-
} from "./token-goat-chunk-
|
|
6
|
+
} from "./token-goat-chunk-3XQPEJMV.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ToolFilter,
|
|
9
9
|
capTokens,
|
|
@@ -11,13 +11,20 @@ import {
|
|
|
11
11
|
deliverCompressed,
|
|
12
12
|
dispatchArgv,
|
|
13
13
|
filterByName,
|
|
14
|
-
loadConfig,
|
|
15
|
-
recordStat,
|
|
16
14
|
selectFilter,
|
|
17
|
-
shlexSplit
|
|
18
|
-
|
|
15
|
+
shlexSplit,
|
|
16
|
+
storeBashOutputSync
|
|
17
|
+
} from "./token-goat-chunk-VZYD4OZB.mjs";
|
|
18
|
+
import {
|
|
19
|
+
recordStat
|
|
20
|
+
} from "./token-goat-chunk-T2IWWTHB.mjs";
|
|
21
|
+
import {
|
|
22
|
+
loadConfig
|
|
23
|
+
} from "./token-goat-chunk-SAQ5PG4L.mjs";
|
|
19
24
|
import "./token-goat-chunk-EEIDFMEM.mjs";
|
|
20
|
-
import "./token-goat-chunk-
|
|
25
|
+
import "./token-goat-chunk-POBYR64E.mjs";
|
|
26
|
+
import "./token-goat-chunk-AMYCQJX4.mjs";
|
|
27
|
+
import "./token-goat-chunk-GMOUBOX4.mjs";
|
|
21
28
|
import {
|
|
22
29
|
init_define_import_meta_env
|
|
23
30
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -47,8 +54,8 @@ function resolveFilter(command, filterName, cwd) {
|
|
|
47
54
|
if (split === null) return { filter: null, argv };
|
|
48
55
|
return { filter: selectFilter(split, cwd), argv };
|
|
49
56
|
}
|
|
50
|
-
function baseSpawnOptions(timeout, cwd, env) {
|
|
51
|
-
return { shell: wrappedShell(), timeout: timeout * 1e3, cwd, env };
|
|
57
|
+
function baseSpawnOptions(timeout, cwd, env, nativeShell) {
|
|
58
|
+
return { shell: nativeShell ? true : wrappedShell(), timeout: timeout * 1e3, cwd, env };
|
|
52
59
|
}
|
|
53
60
|
function signalExitCode(signal) {
|
|
54
61
|
const num = os.constants.signals[signal];
|
|
@@ -75,18 +82,18 @@ function run(command, opts = {}) {
|
|
|
75
82
|
const timeout = opts.timeout ?? DEFAULT_TIMEOUT_SECONDS;
|
|
76
83
|
const { filter, argv } = resolveFilter(command, opts.filterName, opts.cwd);
|
|
77
84
|
if (filter === null) {
|
|
78
|
-
if ((opts.maxTokens ?? 0) > 0) {
|
|
85
|
+
if ((opts.maxTokens ?? 0) > 0 || opts.quietSuccess) {
|
|
79
86
|
return wrapAndCompress(command, argv, new IdentityFilter(), timeout, resolveProfile(opts.compressionProfile), opts);
|
|
80
87
|
}
|
|
81
|
-
return passthrough(command, timeout, opts.cwd, opts.env);
|
|
88
|
+
return passthrough(command, timeout, opts.cwd, opts.env, opts.nativeShell);
|
|
82
89
|
}
|
|
83
90
|
return wrapAndCompress(command, argv, filter, timeout, resolveProfile(opts.compressionProfile), opts);
|
|
84
91
|
}
|
|
85
92
|
function runRaw(command, timeout = DEFAULT_TIMEOUT_SECONDS) {
|
|
86
93
|
return passthrough(command, timeout, void 0, void 0);
|
|
87
94
|
}
|
|
88
|
-
function passthrough(command, timeout, cwd, env) {
|
|
89
|
-
const result = spawnSync(command, { ...baseSpawnOptions(timeout, cwd, env), stdio: "inherit" });
|
|
95
|
+
function passthrough(command, timeout, cwd, env, nativeShell) {
|
|
96
|
+
const result = spawnSync(command, { ...baseSpawnOptions(timeout, cwd, env, nativeShell), stdio: "inherit" });
|
|
90
97
|
if (isTimeout(result.error)) return 124;
|
|
91
98
|
if (result.status !== null) return result.status;
|
|
92
99
|
if (result.signal) return signalExitCode(result.signal);
|
|
@@ -101,8 +108,9 @@ function decode(buf) {
|
|
|
101
108
|
}
|
|
102
109
|
function wrapAndCompress(command, argv, filter, timeout, profile, opts) {
|
|
103
110
|
const writeStdout = opts.writeStdout ?? ((s) => process.stdout.write(s));
|
|
111
|
+
const startTime = Date.now();
|
|
104
112
|
const result = spawnSync(command, {
|
|
105
|
-
...baseSpawnOptions(timeout, opts.cwd, opts.env),
|
|
113
|
+
...baseSpawnOptions(timeout, opts.cwd, opts.env, opts.nativeShell),
|
|
106
114
|
stdio: ["ignore", "pipe", "pipe"],
|
|
107
115
|
maxBuffer: MAX_CAPTURE_BYTES
|
|
108
116
|
});
|
|
@@ -125,6 +133,15 @@ function wrapAndCompress(command, argv, filter, timeout, profile, opts) {
|
|
|
125
133
|
} else {
|
|
126
134
|
exitCode = 0;
|
|
127
135
|
}
|
|
136
|
+
if (opts.quietSuccess && exitCode === 0) {
|
|
137
|
+
const duration = ((Date.now() - startTime) / 1e3).toFixed(1) + "s";
|
|
138
|
+
const fullRaw = (stdoutText + (stderrText ? "\n" + stderrText : "")).trim();
|
|
139
|
+
const id = storeBashOutputSync(command, fullRaw, 0, opts.cwd ?? null);
|
|
140
|
+
const summary = `[tg: ok] ${command} (${duration}, recall: token-goat bash-output ${id})
|
|
141
|
+
`;
|
|
142
|
+
writeStdout(summary);
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
128
145
|
const limits = resolveCompressLimits();
|
|
129
146
|
const { applied, marker, compressed, text: delivered } = deliverCompressed(filter, stdoutText, stderrText, exitCode, argv, {
|
|
130
147
|
compressionProfile: profile,
|