token-goat 2.9.25 → 2.9.28
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 +28 -88
- package/SECURITY.md +14 -0
- package/dist/{token-goat-chunk-ORO4GOMA.mjs → token-goat-chunk-4JJBFT7V.mjs} +3 -3
- package/dist/token-goat-chunk-4JMWPWCS.mjs +96 -0
- package/dist/token-goat-chunk-4RN64ZND.mjs +954 -0
- package/dist/{token-goat-chunk-6W2FFT6H.mjs → token-goat-chunk-4STDIGYC.mjs} +2 -2
- package/dist/{token-goat-chunk-EZVRN44Y.mjs → token-goat-chunk-5NNYIUGV.mjs} +2 -2
- package/dist/{token-goat-chunk-ILROZWXE.mjs → token-goat-chunk-66LODAUT.mjs} +1 -1
- package/dist/{token-goat-chunk-VAIJUZG6.mjs → token-goat-chunk-6CCQDAYY.mjs} +69 -566
- package/dist/{token-goat-chunk-UGCNTVF4.mjs → token-goat-chunk-6DQNNFJ6.mjs} +5 -3
- package/dist/{token-goat-chunk-ZWFP4ZU7.mjs → token-goat-chunk-6SGLIPQB.mjs} +40 -20
- package/dist/{token-goat-chunk-TWVFMUTZ.mjs → token-goat-chunk-6Z5ULNE5.mjs} +3570 -3970
- package/dist/token-goat-chunk-7MAFDRVR.mjs +47 -0
- package/dist/{token-goat-chunk-PPNKB5HP.mjs → token-goat-chunk-7R2XYKC5.mjs} +6 -5
- package/dist/{token-goat-chunk-KYV7E6ZJ.mjs → token-goat-chunk-BCN2YQC6.mjs} +10 -8
- package/dist/token-goat-chunk-BJBRGPBX.mjs +244 -0
- package/dist/{token-goat-chunk-Z5ZTBSHL.mjs → token-goat-chunk-CBMY2FGI.mjs} +479 -544
- package/dist/{token-goat-chunk-UTKNLKYE.mjs → token-goat-chunk-CC2PYJM7.mjs} +2 -1
- package/dist/{token-goat-chunk-7PQYG6TN.mjs → token-goat-chunk-D5ICEPSB.mjs} +14 -14
- package/dist/token-goat-chunk-D7GHQKQD.mjs +30 -0
- package/dist/{token-goat-chunk-NNXCBELZ.mjs → token-goat-chunk-EL7M26WP.mjs} +7623 -8455
- package/dist/{token-goat-chunk-TVTDINTO.mjs → token-goat-chunk-F7QZRIWM.mjs} +69 -20
- package/dist/{token-goat-chunk-MBRX5AP6.mjs → token-goat-chunk-FSTWAOW6.mjs} +3 -3
- package/dist/token-goat-chunk-GGLEE35R.mjs +564 -0
- package/dist/{token-goat-chunk-YZ67F2HJ.mjs → token-goat-chunk-HUDC5GS5.mjs} +2 -2
- package/dist/{token-goat-chunk-BIBZQRC6.mjs → token-goat-chunk-HXNAC4ZF.mjs} +22 -964
- package/dist/token-goat-chunk-I7CB3X4K.mjs +1379 -0
- package/dist/{token-goat-chunk-KMCVX3P2.mjs → token-goat-chunk-IFORDBGC.mjs} +32 -27
- package/dist/{token-goat-chunk-25NRXKIW.mjs → token-goat-chunk-IHKZ3QNA.mjs} +26 -15
- package/dist/token-goat-chunk-IZXKVT4A.mjs +711 -0
- package/dist/{token-goat-chunk-UEQUZDHQ.mjs → token-goat-chunk-JXK2HQXS.mjs} +22 -8
- package/dist/{token-goat-chunk-YE4TGC4Z.mjs → token-goat-chunk-L45ZQRT7.mjs} +1 -1
- package/dist/{token-goat-chunk-IEF2NZFZ.mjs → token-goat-chunk-L7SDVGBT.mjs} +196 -14
- package/dist/token-goat-chunk-LEG3JNJ6.mjs +139 -0
- package/dist/{token-goat-chunk-3FSAZR32.mjs → token-goat-chunk-M56BWPBN.mjs} +1 -1
- package/dist/{token-goat-chunk-QZZPWFVF.mjs → token-goat-chunk-MAMQPC43.mjs} +2 -87
- package/dist/{token-goat-chunk-OHMKCBZI.mjs → token-goat-chunk-MMLMALWK.mjs} +5 -3
- package/dist/{token-goat-chunk-KOL5WXDW.mjs → token-goat-chunk-MVSWBNMD.mjs} +7 -231
- package/dist/{token-goat-chunk-J2PRBQ24.mjs → token-goat-chunk-NILVK7XM.mjs} +4 -4
- package/dist/{token-goat-chunk-OUQIGPW3.mjs → token-goat-chunk-Q4S3UQGO.mjs} +1 -1
- package/dist/{token-goat-chunk-EX2DVKAT.mjs → token-goat-chunk-QM76S6YS.mjs} +3 -3
- package/dist/{token-goat-chunk-G7YWBH25.mjs → token-goat-chunk-RJH64KQH.mjs} +86 -72
- package/dist/{token-goat-chunk-RLDBVMXR.mjs → token-goat-chunk-RSS3TLXU.mjs} +2 -2
- package/dist/{token-goat-chunk-T6652D3F.mjs → token-goat-chunk-SJEKA7Y2.mjs} +21 -16
- package/dist/{token-goat-chunk-II5WBDFB.mjs → token-goat-chunk-UBUKHVYW.mjs} +1 -1
- package/dist/{token-goat-chunk-2SSDSUSF.mjs → token-goat-chunk-VE27HPIF.mjs} +14 -10
- package/dist/{token-goat-chunk-Y463KPAQ.mjs → token-goat-chunk-VWZKZPSR.mjs} +100 -23
- package/dist/{token-goat-chunk-K4TNHLGS.mjs → token-goat-chunk-XI2VFAV6.mjs} +6 -6
- package/dist/{token-goat-chunk-ZDFDCXU2.mjs → token-goat-chunk-XKY4VKJ4.mjs} +1 -1
- package/dist/{token-goat-chunk-BQ6ZDLTF.mjs → token-goat-chunk-YWSP6IU7.mjs} +1 -1
- package/dist/token-goat-hook.mjs +23 -17
- package/dist/token-goat.core.mjs +32 -27
- package/docs/cli.md +32 -21
- package/docs/install.md +2 -0
- package/package.json +1 -1
- package/dist/token-goat-chunk-EDCVQLBR.mjs +0 -26
- package/dist/token-goat-chunk-WEYODFTA.mjs +0 -41
|
@@ -2,11 +2,11 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
getDb
|
|
5
|
-
} from "./token-goat-chunk-
|
|
5
|
+
} from "./token-goat-chunk-M56BWPBN.mjs";
|
|
6
6
|
import {
|
|
7
7
|
getHarnessName,
|
|
8
8
|
loadConfig
|
|
9
|
-
} from "./token-goat-chunk-
|
|
9
|
+
} from "./token-goat-chunk-CC2PYJM7.mjs";
|
|
10
10
|
import {
|
|
11
11
|
registerReset
|
|
12
12
|
} from "./token-goat-chunk-EEIDFMEM.mjs";
|
|
@@ -15,15 +15,12 @@ import {
|
|
|
15
15
|
} from "./token-goat-chunk-OSUFN2FV.mjs";
|
|
16
16
|
import {
|
|
17
17
|
VERSION,
|
|
18
|
-
atomicWriteText,
|
|
19
18
|
countNoun,
|
|
20
19
|
dataDir,
|
|
21
20
|
dataDirForHome,
|
|
22
21
|
ensureDirSync,
|
|
23
|
-
extractErrorMessage
|
|
24
|
-
|
|
25
|
-
tokenGoatHome
|
|
26
|
-
} from "./token-goat-chunk-YE4TGC4Z.mjs";
|
|
22
|
+
extractErrorMessage
|
|
23
|
+
} from "./token-goat-chunk-L45ZQRT7.mjs";
|
|
27
24
|
import {
|
|
28
25
|
displaySafeText
|
|
29
26
|
} from "./token-goat-chunk-NMTKNYGF.mjs";
|
|
@@ -1007,6 +1004,8 @@ var KIND_TO_SOURCE = {
|
|
|
1007
1004
|
reconcile_note_failed: SOURCE_OTHER,
|
|
1008
1005
|
// Measurement of what a compaction produced (hooks_compact.ts postCompactHandler): summary size and how many manifest paths survived into it. SOURCE_OTHER and always recorded at (0, 0) -- the summary was written whether or not token-goat was watching, so there is no counterfactual in which those bytes were saved. Filing it anywhere with a savings total would credit token-goat for the whole summary, which is the accounting mistake this registry exists to prevent.
|
|
1009
1006
|
compact_summary: SOURCE_OTHER,
|
|
1007
|
+
// One row per failed tool call the post_tool_use_failure hook sees (hooks_tool_failure.ts), with its tool_error_class.ts verdict in `detail` so failure rates by reason accumulate going forward. A measurement at (0, 0): a failure saves nothing.
|
|
1008
|
+
tool_failure: SOURCE_OTHER,
|
|
1010
1009
|
// Envelope compaction of an oversized subagent report (hooks_agent_spawn.ts). SOURCE_CONTENT, not SOURCE_HINT: the handler's sibling session_hint entry is advisory (it only appends a recall pointer and genuinely saves nothing), whereas this kind records a real rewrite with real bytes removed, so filing it under the advisory bucket would understate the compaction and repeat the zero-savings desync this registry keeps getting bitten by.
|
|
1011
1010
|
agent_report_compact: SOURCE_CONTENT,
|
|
1012
1011
|
// Decline counterpart to agent_report_compact: the fence-collapse net-benefit gate ran and found at least one over-long fence, but declined to rewrite because net savings did not clear the notice cost. Always recorded at (0, 0) -- see the recordStat call site -- so it never contributes to any savings total; it exists purely to make gate hit-rate and near-misses visible instead of the decline being invisible.
|
|
@@ -1955,220 +1954,6 @@ function redactSecrets(text, config = loadConfig()) {
|
|
|
1955
1954
|
return { text: out, count };
|
|
1956
1955
|
}
|
|
1957
1956
|
|
|
1958
|
-
// src/disk_cache.ts
|
|
1959
|
-
init_define_import_meta_env();
|
|
1960
|
-
import * as fs2 from "node:fs";
|
|
1961
|
-
import * as path2 from "node:path";
|
|
1962
|
-
var DEFAULT_MAX_COUNT = 200;
|
|
1963
|
-
var DEFAULT_MAX_AGE_MS = 24 * 3600 * 1e3;
|
|
1964
|
-
function sanitizeId(id) {
|
|
1965
|
-
return sanitizeIdForFilename(id, 64);
|
|
1966
|
-
}
|
|
1967
|
-
function blobDir(subdir) {
|
|
1968
|
-
return path2.join(tokenGoatHome(), subdir);
|
|
1969
|
-
}
|
|
1970
|
-
function blobPath(subdir, id) {
|
|
1971
|
-
const safe = sanitizeId(id);
|
|
1972
|
-
if (!safe) return null;
|
|
1973
|
-
const dir = blobDir(subdir);
|
|
1974
|
-
const candidate = path2.join(dir, `${safe}.json`);
|
|
1975
|
-
try {
|
|
1976
|
-
const rel = path2.relative(dir, candidate);
|
|
1977
|
-
if (rel.startsWith("..")) return null;
|
|
1978
|
-
} catch {
|
|
1979
|
-
return null;
|
|
1980
|
-
}
|
|
1981
|
-
return candidate;
|
|
1982
|
-
}
|
|
1983
|
-
function isBlobStale(subdir, id) {
|
|
1984
|
-
const p = blobPath(subdir, id);
|
|
1985
|
-
if (p === null) return false;
|
|
1986
|
-
try {
|
|
1987
|
-
const stat = fs2.statSync(p);
|
|
1988
|
-
return Date.now() - stat.mtimeMs > DEFAULT_MAX_AGE_MS;
|
|
1989
|
-
} catch {
|
|
1990
|
-
return false;
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
function subdirCacheDefaults(subdir) {
|
|
1994
|
-
try {
|
|
1995
|
-
if (subdir === "bash_outputs") {
|
|
1996
|
-
const bc = loadConfig().bash_compress;
|
|
1997
|
-
return { maxCount: bc.cache_max_file_count, maxBytes: bc.cache_max_bytes, maxBytesPerItem: bc.cache_max_bytes_per_output };
|
|
1998
|
-
}
|
|
1999
|
-
if (subdir === "web_outputs") {
|
|
2000
|
-
const wf = loadConfig().webfetch;
|
|
2001
|
-
return { maxCount: wf.max_file_count, maxBytes: wf.max_bytes, maxBytesPerItem: Number.POSITIVE_INFINITY };
|
|
2002
|
-
}
|
|
2003
|
-
} catch {
|
|
2004
|
-
}
|
|
2005
|
-
return { maxCount: DEFAULT_MAX_COUNT, maxBytes: Number.POSITIVE_INFINITY, maxBytesPerItem: Number.POSITIVE_INFINITY };
|
|
2006
|
-
}
|
|
2007
|
-
function storeBlob(subdir, id, value, opts = {}) {
|
|
2008
|
-
const p = blobPath(subdir, id);
|
|
2009
|
-
if (!p) return false;
|
|
2010
|
-
const defaults = subdirCacheDefaults(subdir);
|
|
2011
|
-
const maxBytesPerItem = opts.maxBytesPerItem ?? defaults.maxBytesPerItem;
|
|
2012
|
-
let rawJson;
|
|
2013
|
-
try {
|
|
2014
|
-
rawJson = JSON.stringify(value);
|
|
2015
|
-
} catch {
|
|
2016
|
-
return false;
|
|
2017
|
-
}
|
|
2018
|
-
let json;
|
|
2019
|
-
try {
|
|
2020
|
-
const result = redactSecrets(rawJson);
|
|
2021
|
-
json = result.text;
|
|
2022
|
-
if (result.count > 0) recordStat("secret_redacted", 0, result.count, void 0, subdir);
|
|
2023
|
-
} catch {
|
|
2024
|
-
return false;
|
|
2025
|
-
}
|
|
2026
|
-
if (Number.isFinite(maxBytesPerItem) && Buffer.byteLength(json, "utf-8") > maxBytesPerItem) return false;
|
|
2027
|
-
try {
|
|
2028
|
-
const dir = path2.dirname(p);
|
|
2029
|
-
if (!fs2.existsSync(dir)) ensureDirSync(dir);
|
|
2030
|
-
atomicWriteText(p, json);
|
|
2031
|
-
} catch {
|
|
2032
|
-
return false;
|
|
2033
|
-
}
|
|
2034
|
-
pruneBlobs(
|
|
2035
|
-
subdir,
|
|
2036
|
-
opts.maxCount ?? defaults.maxCount,
|
|
2037
|
-
opts.maxAgeMs ?? DEFAULT_MAX_AGE_MS,
|
|
2038
|
-
opts.maxBytes ?? defaults.maxBytes,
|
|
2039
|
-
p
|
|
2040
|
-
);
|
|
2041
|
-
return true;
|
|
2042
|
-
}
|
|
2043
|
-
function loadBlob(subdir, id) {
|
|
2044
|
-
const p = blobPath(subdir, id);
|
|
2045
|
-
if (!p) return null;
|
|
2046
|
-
try {
|
|
2047
|
-
if (!fs2.existsSync(p)) return null;
|
|
2048
|
-
return JSON.parse(fs2.readFileSync(p, "utf8"));
|
|
2049
|
-
} catch {
|
|
2050
|
-
return null;
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2053
|
-
function listBlobs(subdir) {
|
|
2054
|
-
const dir = blobDir(subdir);
|
|
2055
|
-
const out = [];
|
|
2056
|
-
try {
|
|
2057
|
-
if (!fs2.existsSync(dir)) return out;
|
|
2058
|
-
for (const file of fs2.readdirSync(dir)) {
|
|
2059
|
-
if (!file.endsWith(".json")) continue;
|
|
2060
|
-
const id = file.slice(0, -5);
|
|
2061
|
-
let mtime = 0;
|
|
2062
|
-
try {
|
|
2063
|
-
mtime = fs2.statSync(path2.join(dir, file)).mtimeMs;
|
|
2064
|
-
} catch {
|
|
2065
|
-
}
|
|
2066
|
-
const value = loadBlob(subdir, id);
|
|
2067
|
-
if (value !== null) out.push({ id, mtime, value });
|
|
2068
|
-
}
|
|
2069
|
-
} catch {
|
|
2070
|
-
return out;
|
|
2071
|
-
}
|
|
2072
|
-
return out;
|
|
2073
|
-
}
|
|
2074
|
-
function pruneBlobs(subdir, maxCount = DEFAULT_MAX_COUNT, maxAgeMs = DEFAULT_MAX_AGE_MS, maxBytes = Number.POSITIVE_INFINITY, protectedPath) {
|
|
2075
|
-
return pruneBlobDir(blobDir(subdir), maxCount, maxAgeMs, maxBytes, protectedPath);
|
|
2076
|
-
}
|
|
2077
|
-
function pruneBlobDir(dir, maxCount = DEFAULT_MAX_COUNT, maxAgeMs = DEFAULT_MAX_AGE_MS, maxBytes = Number.POSITIVE_INFINITY, protectedPath) {
|
|
2078
|
-
let removed = 0;
|
|
2079
|
-
try {
|
|
2080
|
-
if (!fs2.existsSync(dir)) return 0;
|
|
2081
|
-
const cutoff = Date.now() - maxAgeMs;
|
|
2082
|
-
let kept = [];
|
|
2083
|
-
let protectedEntry;
|
|
2084
|
-
for (const file of fs2.readdirSync(dir)) {
|
|
2085
|
-
const full = path2.join(dir, file);
|
|
2086
|
-
let stat;
|
|
2087
|
-
try {
|
|
2088
|
-
stat = fs2.statSync(full);
|
|
2089
|
-
} catch {
|
|
2090
|
-
continue;
|
|
2091
|
-
}
|
|
2092
|
-
if (!stat.isFile()) continue;
|
|
2093
|
-
if (protectedPath !== void 0 && full === protectedPath) {
|
|
2094
|
-
protectedEntry = [full, stat.mtimeMs, stat.size];
|
|
2095
|
-
continue;
|
|
2096
|
-
}
|
|
2097
|
-
if (stat.mtimeMs < cutoff) {
|
|
2098
|
-
try {
|
|
2099
|
-
fs2.unlinkSync(full);
|
|
2100
|
-
removed++;
|
|
2101
|
-
} catch {
|
|
2102
|
-
continue;
|
|
2103
|
-
}
|
|
2104
|
-
} else if (file.endsWith(".json")) {
|
|
2105
|
-
kept.push([full, stat.mtimeMs, stat.size]);
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
const countBudget = protectedEntry ? Math.max(0, maxCount - 1) : maxCount;
|
|
2109
|
-
if (kept.length > countBudget) {
|
|
2110
|
-
kept.sort((a, b) => a[1] - b[1]);
|
|
2111
|
-
const excess = kept.slice(0, kept.length - countBudget);
|
|
2112
|
-
kept = kept.slice(kept.length - countBudget);
|
|
2113
|
-
for (const [full] of excess) {
|
|
2114
|
-
try {
|
|
2115
|
-
fs2.unlinkSync(full);
|
|
2116
|
-
removed++;
|
|
2117
|
-
} catch {
|
|
2118
|
-
continue;
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
}
|
|
2122
|
-
if (Number.isFinite(maxBytes)) {
|
|
2123
|
-
kept.sort((a, b) => a[1] - b[1]);
|
|
2124
|
-
let total = kept.reduce((sum, [, , size]) => sum + size, 0) + (protectedEntry ? protectedEntry[2] : 0);
|
|
2125
|
-
while (total > maxBytes && kept.length > 0) {
|
|
2126
|
-
const oldest = kept.shift();
|
|
2127
|
-
if (!oldest) break;
|
|
2128
|
-
const [full, , size] = oldest;
|
|
2129
|
-
try {
|
|
2130
|
-
fs2.unlinkSync(full);
|
|
2131
|
-
removed++;
|
|
2132
|
-
total -= size;
|
|
2133
|
-
} catch {
|
|
2134
|
-
break;
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
} catch {
|
|
2139
|
-
return removed;
|
|
2140
|
-
}
|
|
2141
|
-
return removed;
|
|
2142
|
-
}
|
|
2143
|
-
var SWEEPABLE_CACHE_SUBDIRS = [
|
|
2144
|
-
{ subdir: "bash_outputs", countCapped: true },
|
|
2145
|
-
{ subdir: "web_outputs", countCapped: true },
|
|
2146
|
-
{ subdir: "mcp_outputs", countCapped: true },
|
|
2147
|
-
{ subdir: "sessions", countCapped: false }
|
|
2148
|
-
];
|
|
2149
|
-
function sweepCacheRoots(extraRoots = []) {
|
|
2150
|
-
let removed = 0;
|
|
2151
|
-
const roots = [tokenGoatHome(), ...extraRoots];
|
|
2152
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2153
|
-
for (const root of roots) {
|
|
2154
|
-
if (!root || seen.has(root)) continue;
|
|
2155
|
-
seen.add(root);
|
|
2156
|
-
for (const { subdir, countCapped } of SWEEPABLE_CACHE_SUBDIRS) {
|
|
2157
|
-
try {
|
|
2158
|
-
const defaults = subdirCacheDefaults(subdir);
|
|
2159
|
-
removed += pruneBlobDir(
|
|
2160
|
-
path2.join(root, subdir),
|
|
2161
|
-
countCapped ? defaults.maxCount : Number.POSITIVE_INFINITY,
|
|
2162
|
-
DEFAULT_MAX_AGE_MS,
|
|
2163
|
-
countCapped ? defaults.maxBytes : Number.POSITIVE_INFINITY
|
|
2164
|
-
);
|
|
2165
|
-
} catch {
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
return removed;
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
1957
|
export {
|
|
2173
1958
|
BYTES_PER_TOKEN,
|
|
2174
1959
|
guardDivisor,
|
|
@@ -2196,14 +1981,5 @@ export {
|
|
|
2196
1981
|
countRedactionPlaceholders,
|
|
2197
1982
|
compileCustomPatterns,
|
|
2198
1983
|
hasPreciseSecret,
|
|
2199
|
-
redactSecrets
|
|
2200
|
-
DEFAULT_MAX_COUNT,
|
|
2201
|
-
DEFAULT_MAX_AGE_MS,
|
|
2202
|
-
blobPath,
|
|
2203
|
-
isBlobStale,
|
|
2204
|
-
storeBlob,
|
|
2205
|
-
loadBlob,
|
|
2206
|
-
listBlobs,
|
|
2207
|
-
pruneBlobs,
|
|
2208
|
-
sweepCacheRoots
|
|
1984
|
+
redactSecrets
|
|
2209
1985
|
};
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
querySheet,
|
|
11
11
|
rangeSheet,
|
|
12
12
|
xlsxColumns
|
|
13
|
-
} from "./token-goat-chunk-
|
|
14
|
-
import "./token-goat-chunk-
|
|
13
|
+
} from "./token-goat-chunk-RSS3TLXU.mjs";
|
|
14
|
+
import "./token-goat-chunk-YWSP6IU7.mjs";
|
|
15
15
|
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
16
|
-
import "./token-goat-chunk-
|
|
16
|
+
import "./token-goat-chunk-UBUKHVYW.mjs";
|
|
17
17
|
import "./token-goat-chunk-XTQAOTSO.mjs";
|
|
18
18
|
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
19
|
-
import "./token-goat-chunk-
|
|
19
|
+
import "./token-goat-chunk-L45ZQRT7.mjs";
|
|
20
20
|
import "./token-goat-chunk-NMTKNYGF.mjs";
|
|
21
21
|
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
22
22
|
import "./token-goat-chunk-GMOUBOX4.mjs";
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
docxTables,
|
|
6
6
|
docxText,
|
|
7
7
|
formatDocxTables
|
|
8
|
-
} from "./token-goat-chunk-
|
|
9
|
-
import "./token-goat-chunk-
|
|
8
|
+
} from "./token-goat-chunk-XKY4VKJ4.mjs";
|
|
9
|
+
import "./token-goat-chunk-UBUKHVYW.mjs";
|
|
10
10
|
import "./token-goat-chunk-XTQAOTSO.mjs";
|
|
11
11
|
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
12
|
-
import "./token-goat-chunk-
|
|
12
|
+
import "./token-goat-chunk-L45ZQRT7.mjs";
|
|
13
13
|
import "./token-goat-chunk-NMTKNYGF.mjs";
|
|
14
14
|
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
15
15
|
import "./token-goat-chunk-GMOUBOX4.mjs";
|
|
@@ -44,15 +44,15 @@ import {
|
|
|
44
44
|
trimRepeatedPrefix,
|
|
45
45
|
truncateMiddleSmart,
|
|
46
46
|
truncateTableRows
|
|
47
|
-
} from "./token-goat-chunk-
|
|
47
|
+
} from "./token-goat-chunk-4RN64ZND.mjs";
|
|
48
48
|
import {
|
|
49
49
|
redactSecrets,
|
|
50
50
|
savedTokensFromBytes,
|
|
51
51
|
stripAnsiEscapes
|
|
52
|
-
} from "./token-goat-chunk-
|
|
52
|
+
} from "./token-goat-chunk-MVSWBNMD.mjs";
|
|
53
53
|
import {
|
|
54
54
|
loadConfig
|
|
55
|
-
} from "./token-goat-chunk-
|
|
55
|
+
} from "./token-goat-chunk-CC2PYJM7.mjs";
|
|
56
56
|
import {
|
|
57
57
|
resolveIndexPath
|
|
58
58
|
} from "./token-goat-chunk-NMTKNYGF.mjs";
|
|
@@ -281,11 +281,11 @@ ${body}`;
|
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
283
|
|
|
284
|
-
// src/tool_filters/dispatch.ts
|
|
285
|
-
init_define_import_meta_env();
|
|
286
|
-
|
|
287
284
|
// src/tool_filters/generic.ts
|
|
288
285
|
init_define_import_meta_env();
|
|
286
|
+
var PassthroughFilter = class extends ToolFilter {
|
|
287
|
+
name = "passthrough";
|
|
288
|
+
};
|
|
289
289
|
var GenericFilter = class extends ToolFilter {
|
|
290
290
|
name = "generic";
|
|
291
291
|
compress(stdout, stderr, _exitCode, _argv) {
|
|
@@ -305,6 +305,9 @@ ${errPart}` : errPart;
|
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
307
|
|
|
308
|
+
// src/tool_filters/dispatch.ts
|
|
309
|
+
init_define_import_meta_env();
|
|
310
|
+
|
|
308
311
|
// src/tool_filters/go_test.ts
|
|
309
312
|
init_define_import_meta_env();
|
|
310
313
|
var TEST_RUN_RE = /^=== (RUN|PAUSE|CONT|NAME)\s/;
|
|
@@ -717,6 +720,43 @@ function makeNodeTestRunnerFilter(cfg) {
|
|
|
717
720
|
}
|
|
718
721
|
}();
|
|
719
722
|
}
|
|
723
|
+
function initCountedRules(rules) {
|
|
724
|
+
return rules.map(() => ({ count: 0, lastLine: void 0 }));
|
|
725
|
+
}
|
|
726
|
+
function countedRuleMatches(rule, line) {
|
|
727
|
+
return rule.res ? rule.res.some((r) => r.test(line)) : rule.re?.test(line) ?? false;
|
|
728
|
+
}
|
|
729
|
+
function applyCountedRules(rules, counts, line) {
|
|
730
|
+
for (let i = 0; i < rules.length; i++) {
|
|
731
|
+
if (countedRuleMatches(rules[i], line)) {
|
|
732
|
+
counts[i].count++;
|
|
733
|
+
if (rules[i].keepLast) counts[i].lastLine = line.trim();
|
|
734
|
+
return i;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return -1;
|
|
738
|
+
}
|
|
739
|
+
function assembleCountedOutput(rules, counts, kept) {
|
|
740
|
+
const out = [];
|
|
741
|
+
for (let i = 0; i < rules.length; i++) {
|
|
742
|
+
if (rules[i].position === "prepend" && counts[i].count > 0)
|
|
743
|
+
out.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
744
|
+
}
|
|
745
|
+
out.push(...kept);
|
|
746
|
+
for (let i = 0; i < rules.length; i++) {
|
|
747
|
+
if (rules[i].position === "append" && counts[i].count > 0)
|
|
748
|
+
out.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
749
|
+
}
|
|
750
|
+
return out;
|
|
751
|
+
}
|
|
752
|
+
function countedRuleNotes(rules, counts) {
|
|
753
|
+
const notes = [];
|
|
754
|
+
for (let i = 0; i < rules.length; i++) {
|
|
755
|
+
if (rules[i].position === "note" && counts[i].count > 0)
|
|
756
|
+
notes.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
757
|
+
}
|
|
758
|
+
return notes;
|
|
759
|
+
}
|
|
720
760
|
function makeAiCliFilter(cfg) {
|
|
721
761
|
return new class extends ToolFilter {
|
|
722
762
|
name = cfg.name;
|
|
@@ -732,7 +772,7 @@ function makeAiCliFilter(cfg) {
|
|
|
732
772
|
const kept = [];
|
|
733
773
|
let droppedNoise = 0;
|
|
734
774
|
const rules = cfg.countedRules ?? [];
|
|
735
|
-
const counts = rules
|
|
775
|
+
const counts = initCountedRules(rules);
|
|
736
776
|
const klRules = cfg.keepLastRules ?? [];
|
|
737
777
|
const klValues = klRules.map(() => void 0);
|
|
738
778
|
for (const line of lines) {
|
|
@@ -753,18 +793,7 @@ function makeAiCliFilter(cfg) {
|
|
|
753
793
|
}
|
|
754
794
|
}
|
|
755
795
|
if (dropped) continue;
|
|
756
|
-
|
|
757
|
-
for (let i = 0; i < rules.length; i++) {
|
|
758
|
-
const rule = rules[i];
|
|
759
|
-
const matched = rule.res ? rule.res.some((r) => r.test(line)) : rule.re.test(line);
|
|
760
|
-
if (matched) {
|
|
761
|
-
counts[i].count++;
|
|
762
|
-
if (rule.keepLast) counts[i].lastLine = line.trim();
|
|
763
|
-
counted = true;
|
|
764
|
-
break;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
if (counted) continue;
|
|
796
|
+
if (applyCountedRules(rules, counts, line) >= 0) continue;
|
|
768
797
|
let kl = false;
|
|
769
798
|
for (let i = 0; i < klRules.length; i++) {
|
|
770
799
|
if (klRules[i].re.test(line)) {
|
|
@@ -776,24 +805,8 @@ function makeAiCliFilter(cfg) {
|
|
|
776
805
|
if (kl) continue;
|
|
777
806
|
kept.push(line);
|
|
778
807
|
}
|
|
779
|
-
const out =
|
|
780
|
-
|
|
781
|
-
if (rules[i].position === "prepend" && counts[i].count > 0) {
|
|
782
|
-
out.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
out.push(...kept);
|
|
786
|
-
for (let i = 0; i < rules.length; i++) {
|
|
787
|
-
if (rules[i].position === "append" && counts[i].count > 0) {
|
|
788
|
-
out.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
const notes = [];
|
|
792
|
-
for (let i = 0; i < rules.length; i++) {
|
|
793
|
-
if (rules[i].position === "note" && counts[i].count > 0) {
|
|
794
|
-
notes.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
795
|
-
}
|
|
796
|
-
}
|
|
808
|
+
const out = assembleCountedOutput(rules, counts, kept);
|
|
809
|
+
const notes = countedRuleNotes(rules, counts);
|
|
797
810
|
for (let i = 0; i < klRules.length; i++) {
|
|
798
811
|
const v = klValues[i];
|
|
799
812
|
if (v !== void 0) notes.push(klRules[i].note(v));
|
|
@@ -822,7 +835,7 @@ function makeLanguageFilter(cfg) {
|
|
|
822
835
|
const kept = [];
|
|
823
836
|
let droppedNoise = 0;
|
|
824
837
|
const rules = cfg.countedRules ?? [];
|
|
825
|
-
const counts = rules
|
|
838
|
+
const counts = initCountedRules(rules);
|
|
826
839
|
const dRules = cfg.dedupeRules ?? [];
|
|
827
840
|
const dState = dRules.map(() => ({ elided: 0, seen: /* @__PURE__ */ new Map() }));
|
|
828
841
|
for (const line of lines) {
|
|
@@ -830,18 +843,7 @@ function makeLanguageFilter(cfg) {
|
|
|
830
843
|
kept.push(line);
|
|
831
844
|
continue;
|
|
832
845
|
}
|
|
833
|
-
|
|
834
|
-
for (let i = 0; i < rules.length; i++) {
|
|
835
|
-
const rule = rules[i];
|
|
836
|
-
const hit = rule.res ? rule.res.some((r) => r.test(line)) : rule.re?.test(line) ?? false;
|
|
837
|
-
if (hit) {
|
|
838
|
-
counts[i].count++;
|
|
839
|
-
if (rule.keepLast) counts[i].lastLine = line.trim();
|
|
840
|
-
counted = true;
|
|
841
|
-
break;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
if (counted) continue;
|
|
846
|
+
if (applyCountedRules(rules, counts, line) >= 0) continue;
|
|
845
847
|
let deduped = false;
|
|
846
848
|
for (let i = 0; i < dRules.length; i++) {
|
|
847
849
|
if (dRules[i].re.test(line)) {
|
|
@@ -862,21 +864,8 @@ function makeLanguageFilter(cfg) {
|
|
|
862
864
|
}
|
|
863
865
|
kept.push(line);
|
|
864
866
|
}
|
|
865
|
-
const out =
|
|
866
|
-
|
|
867
|
-
if (rules[i].position === "prepend" && counts[i].count > 0)
|
|
868
|
-
out.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
869
|
-
}
|
|
870
|
-
out.push(...kept);
|
|
871
|
-
for (let i = 0; i < rules.length; i++) {
|
|
872
|
-
if (rules[i].position === "append" && counts[i].count > 0)
|
|
873
|
-
out.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
874
|
-
}
|
|
875
|
-
const notes = [];
|
|
876
|
-
for (let i = 0; i < rules.length; i++) {
|
|
877
|
-
if (rules[i].position === "note" && counts[i].count > 0)
|
|
878
|
-
notes.push(rules[i].note(counts[i].count, counts[i].lastLine));
|
|
879
|
-
}
|
|
867
|
+
const out = assembleCountedOutput(rules, counts, kept);
|
|
868
|
+
const notes = countedRuleNotes(rules, counts);
|
|
880
869
|
for (let i = 0; i < dRules.length; i++) {
|
|
881
870
|
if (dState[i].elided > 0) notes.push(dRules[i].note(dState[i].elided));
|
|
882
871
|
}
|
|
@@ -5063,13 +5052,22 @@ function grepFlagInCluster(argv, short, long) {
|
|
|
5063
5052
|
var _GREP_GLUED_VALUE_SHORT_FLAGS = "ABCDdefgm";
|
|
5064
5053
|
var _RG_GLUED_VALUE_SHORT_FLAGS = "ABCEMTdefgjmrt";
|
|
5065
5054
|
function gluedValueShortFlags(argv) {
|
|
5066
|
-
return
|
|
5055
|
+
return isRgCommand(argv) ? _RG_GLUED_VALUE_SHORT_FLAGS : _GREP_GLUED_VALUE_SHORT_FLAGS;
|
|
5056
|
+
}
|
|
5057
|
+
function isRgCommand(argv) {
|
|
5058
|
+
return pathStem(argv[0] ?? "").toLowerCase() === "rg";
|
|
5067
5059
|
}
|
|
5068
5060
|
function isFilesOnlySearch(argv) {
|
|
5069
|
-
|
|
5061
|
+
if (grepFlagInCluster(argv, "l", "--files-with-matches")) return true;
|
|
5062
|
+
if (argv.includes("--files")) return true;
|
|
5063
|
+
if (isRgCommand(argv)) return argv.includes("--files-without-match");
|
|
5064
|
+
return grepFlagInCluster(argv, "L", "--files-without-match");
|
|
5070
5065
|
}
|
|
5071
5066
|
function isCountOnlySearch(argv) {
|
|
5072
|
-
return grepFlagInCluster(argv, "c", "--count");
|
|
5067
|
+
return grepFlagInCluster(argv, "c", "--count") || argv.includes("--count-matches");
|
|
5068
|
+
}
|
|
5069
|
+
function isStructuredOutputSearch(argv) {
|
|
5070
|
+
return argv.includes("--json");
|
|
5073
5071
|
}
|
|
5074
5072
|
var GrepFilter = class extends ToolFilter {
|
|
5075
5073
|
name = "grep";
|
|
@@ -5086,7 +5084,7 @@ var GrepFilter = class extends ToolFilter {
|
|
|
5086
5084
|
}
|
|
5087
5085
|
compress(stdout, stderr, _exitCode, argv, ctx = {}) {
|
|
5088
5086
|
const text = this.combineOutput(stdout, stderr);
|
|
5089
|
-
if (isFilesOnlySearch(argv) || isCountOnlySearch(argv)) return text;
|
|
5087
|
+
if (isFilesOnlySearch(argv) || isCountOnlySearch(argv) || isStructuredOutputSearch(argv)) return text;
|
|
5090
5088
|
const lines = text.split("\n");
|
|
5091
5089
|
const nonEmpty = lines.filter((l) => l.trim());
|
|
5092
5090
|
if (nonEmpty.length <= _GREP_COMPRESS_THRESHOLD) return clipGrepLines(text, argv);
|
|
@@ -5194,7 +5192,7 @@ var RgFilter = class _RgFilter extends ToolFilter {
|
|
|
5194
5192
|
}
|
|
5195
5193
|
_compressBody(stdout, stderr, _exitCode, argv) {
|
|
5196
5194
|
const text = this.combineOutput(stdout, stderr);
|
|
5197
|
-
if (isFilesOnlySearch(argv) || isCountOnlySearch(argv)) return text;
|
|
5195
|
+
if (isFilesOnlySearch(argv) || isCountOnlySearch(argv) || isStructuredOutputSearch(argv)) return text;
|
|
5198
5196
|
const lines = text.split("\n");
|
|
5199
5197
|
if (lines.length <= _RG_CONTEXT_THRESHOLD) return text;
|
|
5200
5198
|
if (!lines.some((l) => l === _RgFilter._SEP)) return text;
|
|
@@ -7368,7 +7366,7 @@ var PWSH_PROGRESS_RECORD_RE = /^(?:Processing record\s+\d+\s+of\s+\d+|PROGRESS:\
|
|
|
7368
7366
|
var PS_CNF_ERROR_RE = /^(\S.*?) : (?:The term '.*?' is|.*? is) not recognized as the name of a cmdlet, function, script file, or operable program\.\r?\n(?:.*\r?\n)*?[ \t]*\+ CategoryInfo\s*:\s*ObjectNotFound:\s*\(([^:]*):String\)\s*\[\],\s*CommandNotFoundException\r?\n[ \t]*\+ FullyQualifiedErrorId\s*:\s*CommandNotFoundException\r?\n?/gm;
|
|
7369
7367
|
var PowerShellErrorFilter = class extends ToolFilter {
|
|
7370
7368
|
name = "powershell";
|
|
7371
|
-
binaries = /* @__PURE__ */ new Set(["pwsh", "powershell", "powershell.exe"]);
|
|
7369
|
+
binaries = /* @__PURE__ */ new Set(["pwsh", "powershell", "powershell.exe", "invoke-pester", "pester"]);
|
|
7372
7370
|
compress(stdout, stderr, _exitCode, _argv) {
|
|
7373
7371
|
const merged = this.combineOutput(stdout, stderr);
|
|
7374
7372
|
const collapsed = this._collapseCommandNotFound(merged);
|
|
@@ -9227,6 +9225,20 @@ var KUBECTL_GLOBAL_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
9227
9225
|
"--as-group",
|
|
9228
9226
|
"--request-timeout"
|
|
9229
9227
|
]);
|
|
9228
|
+
var _KUBECTL_STRUCTURED_OUTPUT = /^(json|yaml|go-template|template)/;
|
|
9229
|
+
function kubectlOutputFormat(argv) {
|
|
9230
|
+
for (let i = 1; i < argv.length; i++) {
|
|
9231
|
+
const a = argv[i];
|
|
9232
|
+
if (a === "-o" || a === "--output") return (argv[i + 1] ?? "").toLowerCase();
|
|
9233
|
+
if (a.startsWith("--output=")) return a.slice("--output=".length).toLowerCase();
|
|
9234
|
+
if (a.startsWith("-o=")) return a.slice("-o=".length).toLowerCase();
|
|
9235
|
+
if (a.startsWith("-o") && !a.startsWith("--") && a.length > 2) return a.slice(2).toLowerCase();
|
|
9236
|
+
}
|
|
9237
|
+
return "";
|
|
9238
|
+
}
|
|
9239
|
+
function isKubectlStructuredOutput(argv) {
|
|
9240
|
+
return _KUBECTL_STRUCTURED_OUTPUT.test(kubectlOutputFormat(argv));
|
|
9241
|
+
}
|
|
9230
9242
|
var KubectlFilter = class extends ToolFilter {
|
|
9231
9243
|
name = "kubectl";
|
|
9232
9244
|
binaries = /* @__PURE__ */ new Set(["kubectl", "k", "k9s", "oc"]);
|
|
@@ -9235,7 +9247,7 @@ var KubectlFilter = class extends ToolFilter {
|
|
|
9235
9247
|
const pos = positionalArgs(argv.slice(1), KUBECTL_GLOBAL_VALUE_FLAGS);
|
|
9236
9248
|
const subcommand = pos[0] ?? "";
|
|
9237
9249
|
let text = stdout;
|
|
9238
|
-
if (subcommand === "get" || subcommand === "top") {
|
|
9250
|
+
if ((subcommand === "get" || subcommand === "top") && !isKubectlStructuredOutput(argv)) {
|
|
9239
9251
|
if (text.includes("\n")) {
|
|
9240
9252
|
const resource = pos[1] ?? "";
|
|
9241
9253
|
if (resource === "events" || resource === "ev" || resource === "event") {
|
|
@@ -13440,6 +13452,7 @@ function deliverCompressed(filter, stdout, stderr, exitCode, argv, opts = {}) {
|
|
|
13440
13452
|
}
|
|
13441
13453
|
function filterByName(name) {
|
|
13442
13454
|
if (name === "generic") return new GenericFilter();
|
|
13455
|
+
if (name === "passthrough") return new PassthroughFilter();
|
|
13443
13456
|
for (const f of TOOL_FILTERS) if (f.name === name) return f;
|
|
13444
13457
|
return null;
|
|
13445
13458
|
}
|
|
@@ -13453,6 +13466,7 @@ export {
|
|
|
13453
13466
|
compressedTokensSaved,
|
|
13454
13467
|
CompressedOutput,
|
|
13455
13468
|
ToolFilter,
|
|
13469
|
+
PassthroughFilter,
|
|
13456
13470
|
pytestFilter,
|
|
13457
13471
|
looksLikePytestOutput,
|
|
13458
13472
|
TOOL_FILTERS,
|
|
@@ -3,7 +3,7 @@ const require = __cjsRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
queryCsv,
|
|
5
5
|
quoteCsvCell
|
|
6
|
-
} from "./token-goat-chunk-
|
|
6
|
+
} from "./token-goat-chunk-YWSP6IU7.mjs";
|
|
7
7
|
import {
|
|
8
8
|
NotAnOfficeDocumentError,
|
|
9
9
|
assertOoxmlWithinDeadline,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ooxmlWorkDeadline,
|
|
13
13
|
parseOoxmlPart,
|
|
14
14
|
readOoxmlZip
|
|
15
|
-
} from "./token-goat-chunk-
|
|
15
|
+
} from "./token-goat-chunk-UBUKHVYW.mjs";
|
|
16
16
|
import {
|
|
17
17
|
displaySafeText
|
|
18
18
|
} from "./token-goat-chunk-NMTKNYGF.mjs";
|