token-goat 2.9.2 → 2.9.4
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 +22 -50
- package/dist/{token-goat-chunk-UZ2NFOOZ.mjs → token-goat-chunk-3ZR4NLB3.mjs} +165 -8
- package/dist/{token-goat-chunk-NY4HYRSK.mjs → token-goat-chunk-5BHXZEOI.mjs} +10 -12
- package/dist/{token-goat-chunk-Q4LOQY44.mjs → token-goat-chunk-63XEQMNU.mjs} +137 -12
- package/dist/{token-goat-chunk-KKIB7O3Z.mjs → token-goat-chunk-6MU6FHE3.mjs} +463 -106
- package/dist/token-goat-chunk-A37V4PBF.mjs +56 -0
- package/dist/{token-goat-chunk-LJ3CHCTT.mjs → token-goat-chunk-CBO45DYZ.mjs} +3728 -61
- package/dist/{token-goat-chunk-G6XLWJWI.mjs → token-goat-chunk-E3K3BTEQ.mjs} +5 -2
- package/dist/{token-goat-chunk-AO2QD2AG.mjs → token-goat-chunk-EEIDFMEM.mjs} +4 -0
- package/dist/{token-goat-chunk-CGWACYYZ.mjs → token-goat-chunk-EPX5DWGM.mjs} +6 -1
- package/dist/token-goat-chunk-EQKNR7CN.mjs +23 -0
- package/dist/{token-goat-chunk-324QOJYZ.mjs → token-goat-chunk-EVC4TOLE.mjs} +4 -1
- package/dist/{token-goat-chunk-WN5T5EW5.mjs → token-goat-chunk-FQD3OB5W.mjs} +98 -2
- package/dist/{token-goat-chunk-VCNW7BGU.mjs → token-goat-chunk-FSC44QOH.mjs} +20 -3
- package/dist/{token-goat-chunk-JMUBXBG7.mjs → token-goat-chunk-GEXHIIKM.mjs} +7 -7
- package/dist/{token-goat-chunk-5CVKO3DA.mjs → token-goat-chunk-LYWIRYCF.mjs} +5 -2
- package/dist/{token-goat-chunk-LEBYARO3.mjs → token-goat-chunk-OZAEJQ7L.mjs} +9 -6
- package/dist/{token-goat-chunk-R4SR7MQY.mjs → token-goat-chunk-PXWBHSFB.mjs} +2 -2
- package/dist/{token-goat-chunk-FXAPKVRG.mjs → token-goat-chunk-US57I7GN.mjs} +26 -5
- package/dist/token-goat-hook.mjs +12 -7
- package/dist/token-goat.core.mjs +10 -7
- package/docs/cli.md +68 -8
- package/docs/security.md +6 -2
- package/package.json +8 -2
- package/dist/token-goat-chunk-AEX54RUZ.mjs +0 -11
- package/dist/token-goat-chunk-ZVN5WHTO.mjs +0 -23
|
@@ -2,13 +2,17 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
registerReset
|
|
5
|
-
} from "./token-goat-chunk-
|
|
5
|
+
} from "./token-goat-chunk-EEIDFMEM.mjs";
|
|
6
|
+
import {
|
|
7
|
+
init_define_import_meta_env
|
|
8
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
6
9
|
|
|
7
10
|
// src/version.ts
|
|
11
|
+
init_define_import_meta_env();
|
|
8
12
|
import { createRequire } from "node:module";
|
|
9
13
|
function resolveVersion() {
|
|
10
14
|
if (true) {
|
|
11
|
-
return "2.9.
|
|
15
|
+
return "2.9.4";
|
|
12
16
|
}
|
|
13
17
|
const require2 = createRequire(import.meta.url);
|
|
14
18
|
const pkg = require2("../package.json");
|
|
@@ -17,6 +21,7 @@ function resolveVersion() {
|
|
|
17
21
|
var VERSION = resolveVersion();
|
|
18
22
|
|
|
19
23
|
// src/constants.ts
|
|
24
|
+
init_define_import_meta_env();
|
|
20
25
|
import * as fs from "node:fs";
|
|
21
26
|
import * as os from "node:os";
|
|
22
27
|
import * as path from "node:path";
|
|
@@ -136,6 +141,7 @@ var ENV_KEYS = {
|
|
|
136
141
|
var SYMBOL_BODY_CHAR_CAP = 128 * 1024;
|
|
137
142
|
|
|
138
143
|
// src/bridges/registry.ts
|
|
144
|
+
init_define_import_meta_env();
|
|
139
145
|
var KNOWN_HARNESS_NAMES = /* @__PURE__ */ new Set([
|
|
140
146
|
"claudecode",
|
|
141
147
|
"codex",
|
|
@@ -198,6 +204,7 @@ function resetHarnessCache() {
|
|
|
198
204
|
registerReset(resetHarnessCache);
|
|
199
205
|
|
|
200
206
|
// src/env.ts
|
|
207
|
+
init_define_import_meta_env();
|
|
201
208
|
var FALSY_ENV_VALUES = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
202
209
|
var TRUTHY_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
203
210
|
function envStr(key, defaultVal) {
|
|
@@ -236,6 +243,7 @@ function envStrList(key, defaultVal, delimiter2) {
|
|
|
236
243
|
}
|
|
237
244
|
|
|
238
245
|
// src/fingerprint.ts
|
|
246
|
+
init_define_import_meta_env();
|
|
239
247
|
import { createHash } from "node:crypto";
|
|
240
248
|
import * as fs2 from "node:fs";
|
|
241
249
|
function fingerprintContent(content) {
|
|
@@ -264,6 +272,7 @@ function fileIsAbsent(filePath) {
|
|
|
264
272
|
}
|
|
265
273
|
|
|
266
274
|
// src/paths.ts
|
|
275
|
+
init_define_import_meta_env();
|
|
267
276
|
import * as fs3 from "node:fs";
|
|
268
277
|
import * as path2 from "node:path";
|
|
269
278
|
var WSL_PATH_RE = /^\/mnt\/([a-zA-Z])\/(.*)$/s;
|
|
@@ -371,6 +380,7 @@ function displaySafePath(p) {
|
|
|
371
380
|
}
|
|
372
381
|
|
|
373
382
|
// src/util.ts
|
|
383
|
+
init_define_import_meta_env();
|
|
374
384
|
import { spawn, spawnSync } from "node:child_process";
|
|
375
385
|
import { chmodSync as chmodSync2, closeSync, copyFileSync, existsSync, mkdirSync as mkdirSync2, openSync, readdirSync, readFileSync as readFileSync2, renameSync, statSync as statSync3, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
376
386
|
import * as path3 from "node:path";
|
|
@@ -1089,6 +1099,7 @@ function encodeUtf32(text, littleEndian) {
|
|
|
1089
1099
|
}
|
|
1090
1100
|
|
|
1091
1101
|
// src/project.ts
|
|
1102
|
+
init_define_import_meta_env();
|
|
1092
1103
|
import * as fs4 from "node:fs";
|
|
1093
1104
|
import * as os2 from "node:os";
|
|
1094
1105
|
import * as path4 from "node:path";
|
|
@@ -1305,10 +1316,24 @@ function isInsideRoot(target, root) {
|
|
|
1305
1316
|
}
|
|
1306
1317
|
|
|
1307
1318
|
// src/config.ts
|
|
1319
|
+
init_define_import_meta_env();
|
|
1308
1320
|
import * as fs5 from "node:fs";
|
|
1309
1321
|
import * as path5 from "node:path";
|
|
1310
1322
|
|
|
1323
|
+
// node_modules/smol-toml/dist/index.js
|
|
1324
|
+
init_define_import_meta_env();
|
|
1325
|
+
|
|
1326
|
+
// node_modules/smol-toml/dist/parse.js
|
|
1327
|
+
init_define_import_meta_env();
|
|
1328
|
+
|
|
1329
|
+
// node_modules/smol-toml/dist/struct.js
|
|
1330
|
+
init_define_import_meta_env();
|
|
1331
|
+
|
|
1332
|
+
// node_modules/smol-toml/dist/primitive.js
|
|
1333
|
+
init_define_import_meta_env();
|
|
1334
|
+
|
|
1311
1335
|
// node_modules/smol-toml/dist/date.js
|
|
1336
|
+
init_define_import_meta_env();
|
|
1312
1337
|
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
1313
1338
|
var TomlDate = class _TomlDate extends Date {
|
|
1314
1339
|
#hasDate = false;
|
|
@@ -1401,6 +1426,7 @@ var TomlDate = class _TomlDate extends Date {
|
|
|
1401
1426
|
};
|
|
1402
1427
|
|
|
1403
1428
|
// node_modules/smol-toml/dist/error.js
|
|
1429
|
+
init_define_import_meta_env();
|
|
1404
1430
|
function getLineColFromPtr(string, ptr) {
|
|
1405
1431
|
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
1406
1432
|
return [lines.length, lines.pop().length + 1];
|
|
@@ -1441,6 +1467,7 @@ ${codeblock}`, options);
|
|
|
1441
1467
|
};
|
|
1442
1468
|
|
|
1443
1469
|
// node_modules/smol-toml/dist/util.js
|
|
1470
|
+
init_define_import_meta_env();
|
|
1444
1471
|
function indexOfNewline(str, start = 0) {
|
|
1445
1472
|
let idx = str.indexOf("\n", start);
|
|
1446
1473
|
if (str.charCodeAt(idx - 1) === 13)
|
|
@@ -1652,6 +1679,7 @@ function parseValue(ctx, integersAsBigInt, end) {
|
|
|
1652
1679
|
}
|
|
1653
1680
|
|
|
1654
1681
|
// node_modules/smol-toml/dist/extract.js
|
|
1682
|
+
init_define_import_meta_env();
|
|
1655
1683
|
function extractValue(ctx, end, integersAsBigInt) {
|
|
1656
1684
|
let ptr = ctx.p;
|
|
1657
1685
|
let c = ctx.s.charCodeAt(ptr);
|
|
@@ -1954,6 +1982,7 @@ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
1954
1982
|
}
|
|
1955
1983
|
|
|
1956
1984
|
// node_modules/smol-toml/dist/stringify.js
|
|
1985
|
+
init_define_import_meta_env();
|
|
1957
1986
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
1958
1987
|
function extendedTypeOf(obj) {
|
|
1959
1988
|
let type = typeof obj;
|
|
@@ -2244,6 +2273,8 @@ var CONFIG_DEFAULTS = {
|
|
|
2244
2273
|
// existing users -- see the reread_deny/reread_deny_min_bytes fix's commit message.
|
|
2245
2274
|
reread_deny_min_bytes: 51200,
|
|
2246
2275
|
stable_doc_compacts: true,
|
|
2276
|
+
// Off until measured. This one rewrites what the model reads on a FIRST look at a source file, where -- unlike every re-read mechanism beside it -- the reader has no prior copy to notice an omission against. Its restore rate and edit-error delta cannot be observed until it has run, so the honest default is the one that changes nothing.
|
|
2277
|
+
fold_code_bodies: false,
|
|
2247
2278
|
truncated_read_min_lines: 200,
|
|
2248
2279
|
protect_recent_reads: 4,
|
|
2249
2280
|
warn_unbalanced_shell_quoting: true,
|
|
@@ -2578,6 +2609,8 @@ var PROJECT_LOCKED_SECTIONS = [
|
|
|
2578
2609
|
"screenshot"
|
|
2579
2610
|
];
|
|
2580
2611
|
var PROJECT_LOCKED_KEYS = [
|
|
2612
|
+
// A repository must not be able to decide how much of its own source an agent gets to see. Turning this on folds function bodies out of every Read of this project's files, so a checked-in `.token-goat.toml` setting it true would shrink what a reviewing agent is shown of the very code it came to review -- and the fold is silent about intent, so it reads as normal output. The user's own global config and TOKEN_GOAT_FOLD_CODE_BODIES still set it freely; only the project-supplied layer is refused.
|
|
2613
|
+
"hints.fold_code_bodies",
|
|
2581
2614
|
"image_shrink.max_image_pixels",
|
|
2582
2615
|
"indexing.cross_project_symbols",
|
|
2583
2616
|
"worker.blocked_roots"
|
|
@@ -2990,6 +3023,7 @@ function _buildConfig(raw, projectRaw = {}) {
|
|
|
2990
3023
|
hi.reread_deny = validatedBool(hi_raw["reread_deny"], hi.reread_deny);
|
|
2991
3024
|
hi.reread_deny_min_bytes = validatedIntWithLegacySentinel(hi_raw["reread_deny_min_bytes"], hi.reread_deny_min_bytes, 2048, ...boundsOf("hints.reread_deny_min_bytes"));
|
|
2992
3025
|
hi.stable_doc_compacts = validatedBool(hi_raw["stable_doc_compacts"], hi.stable_doc_compacts);
|
|
3026
|
+
hi.fold_code_bodies = validatedBool(hi_raw["fold_code_bodies"], hi.fold_code_bodies);
|
|
2993
3027
|
hi.truncated_read_min_lines = validatedInt(hi_raw["truncated_read_min_lines"], hi.truncated_read_min_lines, ...boundsOf("hints.truncated_read_min_lines"));
|
|
2994
3028
|
hi.protect_recent_reads = validatedInt(hi_raw["protect_recent_reads"], hi.protect_recent_reads, ...boundsOf("hints.protect_recent_reads"));
|
|
2995
3029
|
hi.warn_unbalanced_shell_quoting = validatedBool(hi_raw["warn_unbalanced_shell_quoting"], hi.warn_unbalanced_shell_quoting);
|
|
@@ -3018,6 +3052,7 @@ function _buildConfig(raw, projectRaw = {}) {
|
|
|
3018
3052
|
hi.min_file_lines_for_hint = envInt("TOKEN_GOAT_MIN_FILE_LINES_FOR_HINT", hi.min_file_lines_for_hint, ...boundsOf("hints.min_file_lines_for_hint"));
|
|
3019
3053
|
hi.git_hint_max_ms = envInt("TOKEN_GOAT_GIT_HINT_MAX_MS", hi.git_hint_max_ms, ...boundsOf("hints.git_hint_max_ms"));
|
|
3020
3054
|
hi.stable_doc_compacts = envBool("TOKEN_GOAT_STABLE_DOC_COMPACTS", hi.stable_doc_compacts);
|
|
3055
|
+
hi.fold_code_bodies = envBool("TOKEN_GOAT_FOLD_CODE_BODIES", hi.fold_code_bodies);
|
|
3021
3056
|
hi.context_threshold_advisory = envBool("TOKEN_GOAT_CONTEXT_THRESHOLD_ADVISORY", hi.context_threshold_advisory);
|
|
3022
3057
|
hi.pre_skill_advisory = envBool("TOKEN_GOAT_PRE_SKILL_ADVISORY", hi.pre_skill_advisory);
|
|
3023
3058
|
hi.quiet_hours = envStr("TOKEN_GOAT_QUIET_HOURS", hi.quiet_hours);
|
|
@@ -3185,6 +3220,7 @@ var CONFIG_KEY_ENV_OVERRIDES = {
|
|
|
3185
3220
|
"hints.min_file_lines_for_hint": ["TOKEN_GOAT_MIN_FILE_LINES_FOR_HINT"],
|
|
3186
3221
|
"hints.git_hint_max_ms": ["TOKEN_GOAT_GIT_HINT_MAX_MS"],
|
|
3187
3222
|
"hints.stable_doc_compacts": ["TOKEN_GOAT_STABLE_DOC_COMPACTS"],
|
|
3223
|
+
"hints.fold_code_bodies": ["TOKEN_GOAT_FOLD_CODE_BODIES"],
|
|
3188
3224
|
"hints.context_threshold_advisory": ["TOKEN_GOAT_CONTEXT_THRESHOLD_ADVISORY"],
|
|
3189
3225
|
"hints.pre_skill_advisory": ["TOKEN_GOAT_PRE_SKILL_ADVISORY"],
|
|
3190
3226
|
"hints.quiet_hours": ["TOKEN_GOAT_QUIET_HOURS"],
|
|
@@ -3323,6 +3359,7 @@ function saveConfig(config) {
|
|
|
3323
3359
|
reread_deny: config.hints.reread_deny,
|
|
3324
3360
|
reread_deny_min_bytes: config.hints.reread_deny_min_bytes,
|
|
3325
3361
|
stable_doc_compacts: config.hints.stable_doc_compacts,
|
|
3362
|
+
fold_code_bodies: config.hints.fold_code_bodies,
|
|
3326
3363
|
truncated_read_min_lines: config.hints.truncated_read_min_lines,
|
|
3327
3364
|
protect_recent_reads: config.hints.protect_recent_reads,
|
|
3328
3365
|
prompt_triggers: config.hints.prompt_triggers,
|
|
@@ -3395,6 +3432,7 @@ function saveConfig(config) {
|
|
|
3395
3432
|
}
|
|
3396
3433
|
|
|
3397
3434
|
// src/parser_types.ts
|
|
3435
|
+
init_define_import_meta_env();
|
|
3398
3436
|
import * as path6 from "node:path";
|
|
3399
3437
|
var EXTENSION_LANGUAGE = /* @__PURE__ */ new Map([
|
|
3400
3438
|
[".py", "python"],
|
|
@@ -3551,7 +3589,17 @@ function unsupportedLanguageName(filePath) {
|
|
|
3551
3589
|
return UNSUPPORTED_LANGUAGE_EXTENSIONS.get(ext);
|
|
3552
3590
|
}
|
|
3553
3591
|
|
|
3592
|
+
// src/dotenv_redact.ts
|
|
3593
|
+
init_define_import_meta_env();
|
|
3594
|
+
|
|
3595
|
+
// src/languages/ini_idx.ts
|
|
3596
|
+
init_define_import_meta_env();
|
|
3597
|
+
|
|
3598
|
+
// src/languages/common.ts
|
|
3599
|
+
init_define_import_meta_env();
|
|
3600
|
+
|
|
3554
3601
|
// src/doc_comment.ts
|
|
3602
|
+
init_define_import_meta_env();
|
|
3555
3603
|
function precedingDocComment(lines, lineStart, style) {
|
|
3556
3604
|
const aboveIdx = lineStart - 2;
|
|
3557
3605
|
if (aboveIdx < 0 || aboveIdx >= lines.length) return "";
|
|
@@ -4720,11 +4768,13 @@ function redactIfDotenv(filePath, text) {
|
|
|
4720
4768
|
}
|
|
4721
4769
|
|
|
4722
4770
|
// src/db.ts
|
|
4771
|
+
init_define_import_meta_env();
|
|
4723
4772
|
import * as fs7 from "node:fs";
|
|
4724
4773
|
import { createRequire as createRequire3 } from "node:module";
|
|
4725
4774
|
import * as path7 from "node:path";
|
|
4726
4775
|
|
|
4727
4776
|
// src/sqlite_driver.ts
|
|
4777
|
+
init_define_import_meta_env();
|
|
4728
4778
|
import * as fs6 from "node:fs";
|
|
4729
4779
|
import { createRequire as createRequire2 } from "node:module";
|
|
4730
4780
|
var _require = createRequire2(import.meta.url);
|
|
@@ -5466,6 +5516,7 @@ function closeAllDbs() {
|
|
|
5466
5516
|
registerReset(closeAllDbs);
|
|
5467
5517
|
|
|
5468
5518
|
// src/render/ansi.ts
|
|
5519
|
+
init_define_import_meta_env();
|
|
5469
5520
|
function _colorStream(isatty) {
|
|
5470
5521
|
if (process.env["NO_COLOR"]) return false;
|
|
5471
5522
|
return isatty;
|
|
@@ -5540,9 +5591,11 @@ var C = {
|
|
|
5540
5591
|
};
|
|
5541
5592
|
|
|
5542
5593
|
// src/stats.ts
|
|
5594
|
+
init_define_import_meta_env();
|
|
5543
5595
|
import * as path8 from "node:path";
|
|
5544
5596
|
|
|
5545
5597
|
// src/render/stats_renderer.ts
|
|
5598
|
+
init_define_import_meta_env();
|
|
5546
5599
|
var _STATS_MESSAGES_FALLBACK = {
|
|
5547
5600
|
bytesModeOnlyNote: "tracks bytes, not vision tokens",
|
|
5548
5601
|
sessionHintSplitNote: "session_hint shows realized savings; session_hint_overhead shows injected hint cost",
|
|
@@ -5957,6 +6010,7 @@ var _KIND_GROUPS = [
|
|
|
5957
6010
|
"browser_tab_dedup",
|
|
5958
6011
|
"grep:fold",
|
|
5959
6012
|
"read:served_elide",
|
|
6013
|
+
"read:body_fold",
|
|
5960
6014
|
"handoff_create",
|
|
5961
6015
|
"handoff_resolve",
|
|
5962
6016
|
"plan_echo_collapse"
|
|
@@ -6402,6 +6456,8 @@ var KIND_TO_SOURCE = {
|
|
|
6402
6456
|
// with real bytes removed from it. Filing it under the advisory bucket would add non-hint
|
|
6403
6457
|
// savings to hint_stats.ts's savedBytes, which reads by_source[SOURCE_HINT] wholesale.
|
|
6404
6458
|
"read:served_elide": SOURCE_CONTENT,
|
|
6459
|
+
// Same bucket and same reasoning as read:served_elide directly above: a rewrite of a Read that did happen, with real bytes removed, not an advisory about whether to read at all.
|
|
6460
|
+
"read:body_fold": SOURCE_CONTENT,
|
|
6405
6461
|
content_retrieve: SOURCE_CONTENT,
|
|
6406
6462
|
handoff_create: SOURCE_CONTENT,
|
|
6407
6463
|
handoff_resolve: SOURCE_CONTENT
|
|
@@ -6925,7 +6981,14 @@ function renderStats2(opts) {
|
|
|
6925
6981
|
process.stdout.write(renderStats(statsData) + "\n");
|
|
6926
6982
|
}
|
|
6927
6983
|
|
|
6984
|
+
// src/hook_registry.ts
|
|
6985
|
+
init_define_import_meta_env();
|
|
6986
|
+
|
|
6987
|
+
// src/hooks_common.ts
|
|
6988
|
+
init_define_import_meta_env();
|
|
6989
|
+
|
|
6928
6990
|
// src/secret_redact.ts
|
|
6991
|
+
init_define_import_meta_env();
|
|
6929
6992
|
var SECRET_PATTERNS = [
|
|
6930
6993
|
// Anthropic keys share OpenAI's "sk-" prefix but are more specific ("sk-ant-"), so they're matched first — the generic OpenAI pattern's negative lookahead below is defense in depth, not the sole guard.
|
|
6931
6994
|
["anthropic_api_key", /sk-ant-[A-Za-z0-9_-]{20,}/g],
|
|
@@ -7405,11 +7468,16 @@ function serializeOutput(output, eventName, harness, event) {
|
|
|
7405
7468
|
}
|
|
7406
7469
|
|
|
7407
7470
|
// src/install.ts
|
|
7471
|
+
init_define_import_meta_env();
|
|
7408
7472
|
import * as fs8 from "node:fs";
|
|
7409
7473
|
import * as os3 from "node:os";
|
|
7410
7474
|
import * as path9 from "node:path";
|
|
7411
7475
|
|
|
7476
|
+
// src/bridges/claudecode.ts
|
|
7477
|
+
init_define_import_meta_env();
|
|
7478
|
+
|
|
7412
7479
|
// src/bridges/shim_common.ts
|
|
7480
|
+
init_define_import_meta_env();
|
|
7413
7481
|
var SHIM_REQUIRES = `const { spawnSync } = require('node:child_process')
|
|
7414
7482
|
const path = require('node:path')
|
|
7415
7483
|
const { pathToFileURL } = require('node:url')`;
|
|
@@ -7529,6 +7597,7 @@ main().catch(() => {
|
|
|
7529
7597
|
`;
|
|
7530
7598
|
|
|
7531
7599
|
// src/bridges/guidance_block.ts
|
|
7600
|
+
init_define_import_meta_env();
|
|
7532
7601
|
function buildGuidanceBody(fallbackToolClause, opts = {}) {
|
|
7533
7602
|
const gdrive = opts.gdrive !== false;
|
|
7534
7603
|
return [
|
|
@@ -7869,12 +7938,14 @@ function uninstallSkill() {
|
|
|
7869
7938
|
}
|
|
7870
7939
|
|
|
7871
7940
|
// src/bridges/codex_install.ts
|
|
7941
|
+
init_define_import_meta_env();
|
|
7872
7942
|
import * as crypto from "node:crypto";
|
|
7873
7943
|
import * as fs9 from "node:fs";
|
|
7874
7944
|
import * as os4 from "node:os";
|
|
7875
7945
|
import * as path10 from "node:path";
|
|
7876
7946
|
|
|
7877
7947
|
// src/bridges/codex.ts
|
|
7948
|
+
init_define_import_meta_env();
|
|
7878
7949
|
var CODEX_HOOK_SCRIPT = `#!/usr/bin/env node
|
|
7879
7950
|
// token-goat Codex hook shim. Forwards the hook payload to \`token-goat hook <event>\`, then strips _tg_* keys and injects hookEventName so the response satisfies Codex's strict (additionalProperties:false) schema.
|
|
7880
7951
|
'use strict'
|
|
@@ -7978,6 +8049,7 @@ main().catch(() => {
|
|
|
7978
8049
|
`;
|
|
7979
8050
|
|
|
7980
8051
|
// src/bridges/matcher_group.ts
|
|
8052
|
+
init_define_import_meta_env();
|
|
7981
8053
|
function groupHasTokenGoat2(groups, matcher, predicate) {
|
|
7982
8054
|
if (groups === void 0) return false;
|
|
7983
8055
|
for (const group of groups) {
|
|
@@ -8263,11 +8335,16 @@ function stripAgentsBlock(p) {
|
|
|
8263
8335
|
}
|
|
8264
8336
|
|
|
8265
8337
|
// src/bridges/copilot_cli_install.ts
|
|
8338
|
+
init_define_import_meta_env();
|
|
8266
8339
|
import * as fs10 from "node:fs";
|
|
8267
8340
|
import * as os5 from "node:os";
|
|
8268
8341
|
import * as path11 from "node:path";
|
|
8269
8342
|
|
|
8343
|
+
// src/bridges/copilot_cli.ts
|
|
8344
|
+
init_define_import_meta_env();
|
|
8345
|
+
|
|
8270
8346
|
// src/bridges/shrink_block.ts
|
|
8347
|
+
init_define_import_meta_env();
|
|
8271
8348
|
var MATERIALIZE_SHRUNK_IMAGE_JS = `// Best-effort sweep of previously materialized shrunk copies in the OS temp dir. The temp file only needs to outlive the single tool call whose path argument was rewritten to it, so anything older than an hour is finished with; the "token-goat-shrink-" prefix check confines the sweep to this mechanism's own files (same defense-in-depth rule as pruneShrinkCache in src/image_shrink.ts). Throttled per process; runs only when a shrink payload actually arrives, so the common no-image path never pays for it.
|
|
8272
8349
|
const MATERIALIZED_SHRINK_MAX_AGE_MS = 60 * 60 * 1000
|
|
8273
8350
|
let lastMaterializedShrinkSweepAtMs = 0
|
|
@@ -8523,7 +8600,18 @@ async function tryInProcess(entryPath, tgEvent, canonical) {
|
|
|
8523
8600
|
async function main() {
|
|
8524
8601
|
const copilotEvent = process.argv[2] || ''
|
|
8525
8602
|
|
|
8526
|
-
|
|
8603
|
+
// hasOwnProperty, not a bare lookup: the map is a plain object literal, so eight keys it never
|
|
8604
|
+
// declares ('constructor', 'toString', '__proto__' and the rest of Object.prototype) come back
|
|
8605
|
+
// truthy and sail past the check below. tgEvent is then a Function, and 'token-goat hook ' +
|
|
8606
|
+
// tgEvent is concatenated into a shell command string by the fallback at the bottom of this
|
|
8607
|
+
// shim. No member of Object.prototype stringifies with a shell metacharacter, so this was a
|
|
8608
|
+
// failed spawn rather than a second command -- but argv reaching a shell string through a gate
|
|
8609
|
+
// that reads like it stops it is the shape worth closing, not the payload that happened to be
|
|
8610
|
+
// harmless. The four shims built on shim_common.ts validate against a closed Set, which has no
|
|
8611
|
+
// equivalent hole.
|
|
8612
|
+
const tgEvent = Object.prototype.hasOwnProperty.call(COPILOT_TO_TG_EVENT, copilotEvent)
|
|
8613
|
+
? COPILOT_TO_TG_EVENT[copilotEvent]
|
|
8614
|
+
: undefined
|
|
8527
8615
|
if (!tgEvent) {
|
|
8528
8616
|
process.stdout.write('{}')
|
|
8529
8617
|
return
|
|
@@ -9016,11 +9104,13 @@ function isCopilotCliInstalled(opts = {}) {
|
|
|
9016
9104
|
}
|
|
9017
9105
|
|
|
9018
9106
|
// src/bridges/kimi_install.ts
|
|
9107
|
+
init_define_import_meta_env();
|
|
9019
9108
|
import * as fs11 from "node:fs";
|
|
9020
9109
|
import * as os6 from "node:os";
|
|
9021
9110
|
import * as path12 from "node:path";
|
|
9022
9111
|
|
|
9023
9112
|
// src/bridges/kimi.ts
|
|
9113
|
+
init_define_import_meta_env();
|
|
9024
9114
|
var KIMI_HOOK_SCRIPT = `#!/usr/bin/env node
|
|
9025
9115
|
// token-goat Kimi Code hook shim. Forwards the hook payload to \`token-goat hook <event>\`, then rewrites the response into Kimi's own contract: permissionDecision "deny" for a block, top-level "message" for a hint, empty stdout for a no-op.
|
|
9026
9116
|
'use strict'
|
|
@@ -9272,11 +9362,13 @@ function isKimiInstalled() {
|
|
|
9272
9362
|
}
|
|
9273
9363
|
|
|
9274
9364
|
// src/bridges/grok_install.ts
|
|
9365
|
+
init_define_import_meta_env();
|
|
9275
9366
|
import * as fs12 from "node:fs";
|
|
9276
9367
|
import * as os7 from "node:os";
|
|
9277
9368
|
import * as path13 from "node:path";
|
|
9278
9369
|
|
|
9279
9370
|
// src/bridges/grok.ts
|
|
9371
|
+
init_define_import_meta_env();
|
|
9280
9372
|
var GROK_HOOK_SCRIPT = `#!/usr/bin/env node
|
|
9281
9373
|
// token-goat Grok CLI hook shim. Forwards the hook payload to \`token-goat hook <event>\`, then -- for pre_tool_use only -- translates token-goat's {"decision":"block",...} deny shape into Grok's documented {"decision":"deny",...} shape and sets exit code 2.
|
|
9282
9374
|
'use strict'
|
|
@@ -9428,6 +9520,7 @@ function isGrokInstalled() {
|
|
|
9428
9520
|
}
|
|
9429
9521
|
|
|
9430
9522
|
// src/bridges/vscode_install.ts
|
|
9523
|
+
init_define_import_meta_env();
|
|
9431
9524
|
import * as fs13 from "node:fs";
|
|
9432
9525
|
import * as os8 from "node:os";
|
|
9433
9526
|
import * as path14 from "node:path";
|
|
@@ -9593,11 +9686,19 @@ function uninstallVscode(opts = {}) {
|
|
|
9593
9686
|
return removed;
|
|
9594
9687
|
}
|
|
9595
9688
|
|
|
9689
|
+
// src/bridges/index.ts
|
|
9690
|
+
init_define_import_meta_env();
|
|
9691
|
+
|
|
9596
9692
|
// src/tool_filters/helpers.ts
|
|
9693
|
+
init_define_import_meta_env();
|
|
9597
9694
|
import * as fs14 from "node:fs";
|
|
9598
9695
|
import * as path15 from "node:path";
|
|
9599
9696
|
|
|
9697
|
+
// src/bash_compress.ts
|
|
9698
|
+
init_define_import_meta_env();
|
|
9699
|
+
|
|
9600
9700
|
// src/filters.ts
|
|
9701
|
+
init_define_import_meta_env();
|
|
9601
9702
|
var DROP = () => null;
|
|
9602
9703
|
var FILTERS = [
|
|
9603
9704
|
{
|
|
@@ -9730,6 +9831,11 @@ function hasUnquotedOperator(cmd, ops) {
|
|
|
9730
9831
|
return ops.some((op) => masked.includes(op));
|
|
9731
9832
|
}
|
|
9732
9833
|
var BYTES_ELIDED_MARKER_RE = /\n\.\.\. \[\d+ bytes elided by token-goat\]$/;
|
|
9834
|
+
var OWN_TRAILING_NOTICE_RE = /(?:\n(?:\[token-goat: output capped at ~\d+ tokens\]|\.\.\. \[\d+ bytes elided by token-goat\]))+$/;
|
|
9835
|
+
function splitOwnTrailingNotices(text) {
|
|
9836
|
+
const m = OWN_TRAILING_NOTICE_RE.exec(text);
|
|
9837
|
+
return m ? { body: text.slice(0, m.index), notices: m[0] } : { body: text, notices: "" };
|
|
9838
|
+
}
|
|
9733
9839
|
var DIGITS_RE = /\d+/g;
|
|
9734
9840
|
var CONTROL_CHAR_RE = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g;
|
|
9735
9841
|
function utf8Len(s) {
|
|
@@ -10384,6 +10490,7 @@ function byteLength(s) {
|
|
|
10384
10490
|
}
|
|
10385
10491
|
|
|
10386
10492
|
// src/tool_filters/base.ts
|
|
10493
|
+
init_define_import_meta_env();
|
|
10387
10494
|
var DEFAULT_MIN_NET_SAVINGS_BYTES = 100;
|
|
10388
10495
|
function resolveMinNetSavingsBytes() {
|
|
10389
10496
|
try {
|
|
@@ -10620,7 +10727,11 @@ ${body}`;
|
|
|
10620
10727
|
}
|
|
10621
10728
|
};
|
|
10622
10729
|
|
|
10730
|
+
// src/tool_filters/dispatch.ts
|
|
10731
|
+
init_define_import_meta_env();
|
|
10732
|
+
|
|
10623
10733
|
// src/tool_filters/generic.ts
|
|
10734
|
+
init_define_import_meta_env();
|
|
10624
10735
|
var GenericFilter = class extends ToolFilter {
|
|
10625
10736
|
name = "generic";
|
|
10626
10737
|
compress(stdout, stderr, _exitCode, _argv) {
|
|
@@ -10641,6 +10752,7 @@ ${errPart}` : errPart;
|
|
|
10641
10752
|
};
|
|
10642
10753
|
|
|
10643
10754
|
// src/tool_filters/go_test.ts
|
|
10755
|
+
init_define_import_meta_env();
|
|
10644
10756
|
var TEST_RUN_RE = /^=== (RUN|PAUSE|CONT|NAME)\s/;
|
|
10645
10757
|
var RACE_FENCE_RE = /^={10,}\s*$/;
|
|
10646
10758
|
var RACE_WARNING_RE = /^WARNING: DATA RACE/;
|
|
@@ -10841,7 +10953,11 @@ var GoTestFilter = class extends ToolFilter {
|
|
|
10841
10953
|
};
|
|
10842
10954
|
var goTestFilter = new GoTestFilter();
|
|
10843
10955
|
|
|
10956
|
+
// src/tool_filters/ai_clis.ts
|
|
10957
|
+
init_define_import_meta_env();
|
|
10958
|
+
|
|
10844
10959
|
// src/tool_filters/families.ts
|
|
10960
|
+
init_define_import_meta_env();
|
|
10845
10961
|
function plural(n, suffix = "s") {
|
|
10846
10962
|
return n === 1 ? "" : suffix;
|
|
10847
10963
|
}
|
|
@@ -11538,6 +11654,7 @@ var AI_CLI_FILTERS = [
|
|
|
11538
11654
|
];
|
|
11539
11655
|
|
|
11540
11656
|
// src/tool_filters/build.ts
|
|
11657
|
+
init_define_import_meta_env();
|
|
11541
11658
|
var MAKE_RECURSE_RE = /^make\[\d+\]: (?:Entering|Leaving) directory/;
|
|
11542
11659
|
var MAKE_PERCENT_RE = /^\[\s*\d+%\] (?:Building|Linking|Scanning|Generating|Installing|Compiling)\b/;
|
|
11543
11660
|
var MAKE_ECHO_RE = /^\s*(?:echo|cc|gcc|clang|g\+\+)\b.*(?<![Ee]rror|[Ww]arning)/;
|
|
@@ -13023,6 +13140,7 @@ var BUILD_FILTERS = [
|
|
|
13023
13140
|
];
|
|
13024
13141
|
|
|
13025
13142
|
// src/tool_filters/ci.ts
|
|
13143
|
+
init_define_import_meta_env();
|
|
13026
13144
|
var _GH_RUN_PASS_STEP_RE = /^\s*[✓√]\s/;
|
|
13027
13145
|
var _GH_RUN_FAIL_STEP_RE = /^\s*[X✗❌]\s|^\s*FAIL(:|ED|URE)\b|^\s*Error:\s/;
|
|
13028
13146
|
var _GH_API_URL_SUFFIX = "_url";
|
|
@@ -13836,6 +13954,7 @@ var CI_FILTERS = [
|
|
|
13836
13954
|
];
|
|
13837
13955
|
|
|
13838
13956
|
// src/tool_filters/cloud.ts
|
|
13957
|
+
init_define_import_meta_env();
|
|
13839
13958
|
var _TF_REFRESH_RE = /^[a-z0-9_.[\]"-]+: (Refreshing state|Reading|Read complete|Still |Modifications complete)/;
|
|
13840
13959
|
var _TF_PLAN_SUMMARY_RE = /^Plan: \d+ to (add|change|destroy|import)/;
|
|
13841
13960
|
var _TF_NO_CHANGES_RE = /^No changes\.|^(?:This plan does nothing|Nothing to do\.)/i;
|
|
@@ -15260,6 +15379,7 @@ var CLOUD_FILTERS = [
|
|
|
15260
15379
|
];
|
|
15261
15380
|
|
|
15262
15381
|
// src/tool_filters/shell_file.ts
|
|
15382
|
+
init_define_import_meta_env();
|
|
15263
15383
|
var _GREP_COMPRESS_THRESHOLD = 30;
|
|
15264
15384
|
var _GREP_MAX_FILE_LINES = 20;
|
|
15265
15385
|
var GrepFilter = class extends ToolFilter {
|
|
@@ -16366,6 +16486,7 @@ var SHELL_FILE_FILTERS = [
|
|
|
16366
16486
|
];
|
|
16367
16487
|
|
|
16368
16488
|
// src/tool_filters/languages.ts
|
|
16489
|
+
init_define_import_meta_env();
|
|
16369
16490
|
var NODE_INTERNAL_FRAME_RE = /^\s{4}at\s+(?:node:|.+\s+\(node:)/;
|
|
16370
16491
|
var NODE_MODULES_FRAME_RE = /^\s{4}at\s+.*[/\\]node_modules[/\\]/;
|
|
16371
16492
|
var NodeFilter = class extends ToolFilter {
|
|
@@ -17590,6 +17711,7 @@ var LANGUAGE_FILTERS = [
|
|
|
17590
17711
|
];
|
|
17591
17712
|
|
|
17592
17713
|
// src/tool_filters/misc.ts
|
|
17714
|
+
init_define_import_meta_env();
|
|
17593
17715
|
var PW_PASS_RE = /^\s+[✓✔]\s/;
|
|
17594
17716
|
var PW_DOWNLOAD_RE = /^\s*(Downloading|Downloaded|Installing)\s+\w|^\s*[\d.]+\s+[KMG]b\s+\[/i;
|
|
17595
17717
|
var PlaywrightFilter = class _PlaywrightFilter extends ToolFilter {
|
|
@@ -18996,6 +19118,7 @@ var MISC_FILTERS = [
|
|
|
18996
19118
|
];
|
|
18997
19119
|
|
|
18998
19120
|
// src/tool_filters/containers.ts
|
|
19121
|
+
init_define_import_meta_env();
|
|
18999
19122
|
var _DOCKER_DIGEST_RE = /^\s*#\d+\s+(sha256:[a-f0-9]{8,}|resolve\s)/;
|
|
19000
19123
|
var _DOCKER_PROGRESS_RE = /^\s*#\d+\s+\d+(?:\.\d+)?(?:MB|kB|GB)\s+\//;
|
|
19001
19124
|
var _DOCKER_STEP_RE = /^\s*=>\s|^\s*#\d+\s+\[(internal|build|stage)/;
|
|
@@ -19666,6 +19789,7 @@ var CONTAINER_FILTERS = [
|
|
|
19666
19789
|
];
|
|
19667
19790
|
|
|
19668
19791
|
// src/tool_filters/git.ts
|
|
19792
|
+
init_define_import_meta_env();
|
|
19669
19793
|
var _GIT_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
19670
19794
|
"-m",
|
|
19671
19795
|
"--message",
|
|
@@ -20707,6 +20831,7 @@ var GIT_FILTERS = [
|
|
|
20707
20831
|
];
|
|
20708
20832
|
|
|
20709
20833
|
// src/tool_filters/linters.ts
|
|
20834
|
+
init_define_import_meta_env();
|
|
20710
20835
|
var _ESLINT_LOC_RE = /^\s+\d+:\d+\s+(error|warning|info)\s/;
|
|
20711
20836
|
var _ESLINT_FILE_RE = /^(?:\/|[A-Za-z]:|[a-zA-Z0-9_./-]+\.(?:js|jsx|ts|tsx|mjs|cjs|vue))/;
|
|
20712
20837
|
var _ESLINT_SUMMARY_RE = /^[✖✗✘x×]\s+\d+\s+problem/;
|
|
@@ -22120,6 +22245,7 @@ var LINTER_FILTERS = [
|
|
|
22120
22245
|
];
|
|
22121
22246
|
|
|
22122
22247
|
// src/tool_filters/package_managers.ts
|
|
22248
|
+
init_define_import_meta_env();
|
|
22123
22249
|
function dedupLines(lines, maxPerKey = 1, keyFn = (l) => l.trim()) {
|
|
22124
22250
|
const seen = /* @__PURE__ */ new Map();
|
|
22125
22251
|
const out = [];
|
|
@@ -23191,6 +23317,7 @@ var PACKAGE_MANAGER_FILTERS = [
|
|
|
23191
23317
|
];
|
|
23192
23318
|
|
|
23193
23319
|
// src/tool_filters/pytest.ts
|
|
23320
|
+
init_define_import_meta_env();
|
|
23194
23321
|
var XDIST_PREFIX_RE = /^\[gw\d+\]\s*(?:\[\s*\d+%\]\s*)?/;
|
|
23195
23322
|
var DOTS_RE = /^[.FxXEsS]+\s*(\[\s*\d+%\])?\s*$/;
|
|
23196
23323
|
var BANNER_RE = /^(?:platform\s|cachedir:\s|rootdir:\s|plugins:\s|configfile:\s|bringing up\s|cacheprovider-)/;
|
|
@@ -23377,6 +23504,7 @@ var PytestFilter = class extends ToolFilter {
|
|
|
23377
23504
|
var pytestFilter = new PytestFilter();
|
|
23378
23505
|
|
|
23379
23506
|
// src/tool_filters/test_runners.ts
|
|
23507
|
+
init_define_import_meta_env();
|
|
23380
23508
|
var jestFilter = makeNodeTestRunnerFilter({
|
|
23381
23509
|
name: "jest",
|
|
23382
23510
|
binaries: ["jest", "mocha", "ava", "tap"],
|
|
@@ -23394,12 +23522,26 @@ var jestFilter = makeNodeTestRunnerFilter({
|
|
|
23394
23522
|
var vitestFilter = makeNodeTestRunnerFilter({
|
|
23395
23523
|
name: "vitest",
|
|
23396
23524
|
binaries: ["vitest"],
|
|
23397
|
-
// File-level pass header carries a duration: `✓ src/x.test.ts (12ms)`.
|
|
23398
|
-
|
|
23525
|
+
// File-level pass header carries a duration: `✓ src/x.test.ts (12ms)`. The ` > ` exclusion is
|
|
23526
|
+
// not decoration: a verbose per-test line whose test NAME happens to end in something shaped
|
|
23527
|
+
// like a duration (`... to the documented min (100ms) 1ms`) is otherwise claimed here, and gets
|
|
23528
|
+
// counted as a passing FILE. Both branches drop the line, so nothing is lost -- but the reported
|
|
23529
|
+
// count is wrong, and wrong in a way that depends on which reporter produced the run.
|
|
23530
|
+
passFileRe: /^\s*✓(?!.*\s>\s)\s+\S.*\([\d.]+\s*[a-zA-Z]\w*\)/,
|
|
23399
23531
|
failFileRe: /^\s*(?:×|FAIL|✗|✘)\s+\S/,
|
|
23400
|
-
|
|
23401
|
-
//
|
|
23402
|
-
|
|
23532
|
+
// Real vitest right-aligns its summary labels, so every one of these arrives indented:
|
|
23533
|
+
// ` Tests 140 passed (140)`. Anchoring at `^` matched none of them. They survived only
|
|
23534
|
+
// by falling through to the keep-verbatim branch, which is not the same rule -- a summary line
|
|
23535
|
+
// reached while a fail block is open was swallowed into that block instead of ending it.
|
|
23536
|
+
summaryRe: /^\s*(Test Files|Tests|Modules|Duration|Start at)[\s:]+\d/,
|
|
23537
|
+
// Two shapes, because the reporter decides which one a passing test prints. The default
|
|
23538
|
+
// reporter indents a per-test tick under its file header (` ✓ should pass`). `--reporter=
|
|
23539
|
+
// verbose` prints one line per test at a single leading space, carrying the full
|
|
23540
|
+
// `file > describe > name` path instead: ` ✓ tests/x.test.ts > safeJoin > joins normally 28ms`.
|
|
23541
|
+
// Those lines match no rule at all today, so a verbose run compresses by nothing. The ` > `
|
|
23542
|
+
// is what separates them from a file-level header, which passFileRe claims first and which
|
|
23543
|
+
// never contains one.
|
|
23544
|
+
testTickRe: /^\s{2,}✓\s|^\s*✓\s.*\s>\s/,
|
|
23403
23545
|
outputHdrRe: /^\s*stdout\s*\|/,
|
|
23404
23546
|
outputNoun: "stdout",
|
|
23405
23547
|
passFileNoun: "passing file"
|
|
@@ -23511,12 +23653,23 @@ function compressOutput(filter, stdout, stderr, exitCode, argv, opts = {}) {
|
|
|
23511
23653
|
if (opts.maxBytes !== void 0) applyOpts.maxBytes = opts.maxBytes;
|
|
23512
23654
|
return filter.apply(stdout, stderr, exitCode, argv, applyOpts);
|
|
23513
23655
|
}
|
|
23656
|
+
function deliverCompressed(filter, stdout, stderr, exitCode, argv, opts = {}) {
|
|
23657
|
+
const compressed = compressOutput(filter, stdout, stderr, exitCode, argv, opts);
|
|
23658
|
+
const minNet = resolveMinNetSavingsBytes();
|
|
23659
|
+
const applied = compressed.worthApplying(minNet);
|
|
23660
|
+
const text = applied ? compressed.text : combineStreams(stdout, stderr);
|
|
23661
|
+
const marker = applied ? compressed.withMarker(minNet).slice(compressed.text.length) : "";
|
|
23662
|
+
return { applied, text, marker, compressed };
|
|
23663
|
+
}
|
|
23514
23664
|
function filterByName(name) {
|
|
23515
23665
|
if (name === "generic") return new GenericFilter();
|
|
23516
23666
|
for (const f of TOOL_FILTERS) if (f.name === name) return f;
|
|
23517
23667
|
return null;
|
|
23518
23668
|
}
|
|
23519
23669
|
|
|
23670
|
+
// src/tool_filters/index.ts
|
|
23671
|
+
init_define_import_meta_env();
|
|
23672
|
+
|
|
23520
23673
|
export {
|
|
23521
23674
|
VERSION,
|
|
23522
23675
|
dataDir,
|
|
@@ -23723,17 +23876,21 @@ export {
|
|
|
23723
23876
|
stripAnsiCodes,
|
|
23724
23877
|
combineStreams,
|
|
23725
23878
|
hasBareBackgroundOrNewline,
|
|
23879
|
+
splitOwnTrailingNotices,
|
|
23726
23880
|
dedupeConsecutive,
|
|
23727
23881
|
capTokens,
|
|
23728
23882
|
shlexSplit,
|
|
23729
23883
|
resolveMinNetSavingsBytes,
|
|
23730
23884
|
isRewriteWorthwhile,
|
|
23731
23885
|
compressedTokensSaved,
|
|
23886
|
+
CompressedOutput,
|
|
23732
23887
|
ToolFilter,
|
|
23888
|
+
TOOL_FILTERS,
|
|
23733
23889
|
dispatchArgv,
|
|
23734
23890
|
selectFilter,
|
|
23735
23891
|
detectFromCommand,
|
|
23736
23892
|
compressOutput,
|
|
23893
|
+
deliverCompressed,
|
|
23737
23894
|
filterByName
|
|
23738
23895
|
};
|
|
23739
23896
|
/*! Bundled license information:
|
|
@@ -3,25 +3,26 @@ 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-EPX5DWGM.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ToolFilter,
|
|
9
9
|
capTokens,
|
|
10
|
-
combineStreams,
|
|
11
|
-
compressOutput,
|
|
12
10
|
compressedTokensSaved,
|
|
11
|
+
deliverCompressed,
|
|
13
12
|
dispatchArgv,
|
|
14
13
|
filterByName,
|
|
15
14
|
loadConfig,
|
|
16
15
|
recordStat,
|
|
17
|
-
resolveMinNetSavingsBytes,
|
|
18
16
|
selectFilter,
|
|
19
17
|
shlexSplit
|
|
20
|
-
} from "./token-goat-chunk-
|
|
21
|
-
import "./token-goat-chunk-
|
|
22
|
-
import
|
|
18
|
+
} from "./token-goat-chunk-3ZR4NLB3.mjs";
|
|
19
|
+
import "./token-goat-chunk-EEIDFMEM.mjs";
|
|
20
|
+
import {
|
|
21
|
+
init_define_import_meta_env
|
|
22
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
23
23
|
|
|
24
24
|
// src/bash_runner.ts
|
|
25
|
+
init_define_import_meta_env();
|
|
25
26
|
import { spawnSync } from "node:child_process";
|
|
26
27
|
import * as os from "node:os";
|
|
27
28
|
var IdentityFilter = class extends ToolFilter {
|
|
@@ -124,17 +125,14 @@ function wrapAndCompress(command, argv, filter, timeout, profile, opts) {
|
|
|
124
125
|
exitCode = 0;
|
|
125
126
|
}
|
|
126
127
|
const limits = resolveCompressLimits();
|
|
127
|
-
const compressed =
|
|
128
|
+
const { applied, marker, compressed, text: delivered } = deliverCompressed(filter, stdoutText, stderrText, exitCode, argv, {
|
|
128
129
|
compressionProfile: profile,
|
|
129
130
|
maxLines: limits.maxLines,
|
|
130
131
|
maxBytes: limits.maxBytes
|
|
131
132
|
});
|
|
132
|
-
|
|
133
|
-
const applied = compressed.worthApplying(minNetSavingsBytes);
|
|
134
|
-
let text = applied ? compressed.text : combineStreams(stdoutText, stderrText);
|
|
133
|
+
let text = delivered;
|
|
135
134
|
const maxTokens = opts.maxTokens ?? 0;
|
|
136
135
|
if (maxTokens > 0) text = capTokens(text, maxTokens);
|
|
137
|
-
const marker = applied ? compressed.withMarker(minNetSavingsBytes).slice(compressed.text.length) : "";
|
|
138
136
|
const body = text + marker;
|
|
139
137
|
writeStdout(body.endsWith("\n") ? body : body + "\n");
|
|
140
138
|
if (applied) recordSavings(compressed);
|