token-goat 2.9.2 → 2.9.3

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.
Files changed (26) hide show
  1. package/README.md +20 -49
  2. package/dist/{token-goat-chunk-Q4LOQY44.mjs → token-goat-chunk-2VVXTAGD.mjs} +137 -12
  3. package/dist/{token-goat-chunk-LEBYARO3.mjs → token-goat-chunk-3UBORD6Z.mjs} +9 -6
  4. package/dist/{token-goat-chunk-LJ3CHCTT.mjs → token-goat-chunk-3XVGPLDS.mjs} +3492 -46
  5. package/dist/{token-goat-chunk-KKIB7O3Z.mjs → token-goat-chunk-6FQMEMWX.mjs} +418 -105
  6. package/dist/{token-goat-chunk-FXAPKVRG.mjs → token-goat-chunk-7A7SBE6R.mjs} +26 -5
  7. package/dist/token-goat-chunk-A37V4PBF.mjs +56 -0
  8. package/dist/{token-goat-chunk-VCNW7BGU.mjs → token-goat-chunk-A4VBNWSL.mjs} +20 -3
  9. package/dist/{token-goat-chunk-G6XLWJWI.mjs → token-goat-chunk-E3K3BTEQ.mjs} +5 -2
  10. package/dist/{token-goat-chunk-AO2QD2AG.mjs → token-goat-chunk-EEIDFMEM.mjs} +4 -0
  11. package/dist/{token-goat-chunk-324QOJYZ.mjs → token-goat-chunk-EVC4TOLE.mjs} +4 -1
  12. package/dist/{token-goat-chunk-WN5T5EW5.mjs → token-goat-chunk-FQD3OB5W.mjs} +98 -2
  13. package/dist/token-goat-chunk-HC5NMGPD.mjs +23 -0
  14. package/dist/{token-goat-chunk-UZ2NFOOZ.mjs → token-goat-chunk-KKHKXUVS.mjs} +154 -8
  15. package/dist/{token-goat-chunk-NY4HYRSK.mjs → token-goat-chunk-LLNA42NI.mjs} +10 -12
  16. package/dist/{token-goat-chunk-5CVKO3DA.mjs → token-goat-chunk-LYWIRYCF.mjs} +5 -2
  17. package/dist/{token-goat-chunk-CGWACYYZ.mjs → token-goat-chunk-OKJX2JWW.mjs} +6 -1
  18. package/dist/{token-goat-chunk-R4SR7MQY.mjs → token-goat-chunk-PXWBHSFB.mjs} +2 -2
  19. package/dist/{token-goat-chunk-JMUBXBG7.mjs → token-goat-chunk-XSSQFI4C.mjs} +7 -7
  20. package/dist/token-goat-hook.mjs +12 -7
  21. package/dist/token-goat.core.mjs +10 -7
  22. package/docs/cli.md +53 -0
  23. package/docs/security.md +6 -2
  24. package/package.json +8 -2
  25. package/dist/token-goat-chunk-AEX54RUZ.mjs +0 -11
  26. 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-AO2QD2AG.mjs";
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.2";
15
+ return "2.9.3";
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;
@@ -3395,6 +3424,7 @@ function saveConfig(config) {
3395
3424
  }
3396
3425
 
3397
3426
  // src/parser_types.ts
3427
+ init_define_import_meta_env();
3398
3428
  import * as path6 from "node:path";
3399
3429
  var EXTENSION_LANGUAGE = /* @__PURE__ */ new Map([
3400
3430
  [".py", "python"],
@@ -3551,7 +3581,17 @@ function unsupportedLanguageName(filePath) {
3551
3581
  return UNSUPPORTED_LANGUAGE_EXTENSIONS.get(ext);
3552
3582
  }
3553
3583
 
3584
+ // src/dotenv_redact.ts
3585
+ init_define_import_meta_env();
3586
+
3587
+ // src/languages/ini_idx.ts
3588
+ init_define_import_meta_env();
3589
+
3590
+ // src/languages/common.ts
3591
+ init_define_import_meta_env();
3592
+
3554
3593
  // src/doc_comment.ts
3594
+ init_define_import_meta_env();
3555
3595
  function precedingDocComment(lines, lineStart, style) {
3556
3596
  const aboveIdx = lineStart - 2;
3557
3597
  if (aboveIdx < 0 || aboveIdx >= lines.length) return "";
@@ -4720,11 +4760,13 @@ function redactIfDotenv(filePath, text) {
4720
4760
  }
4721
4761
 
4722
4762
  // src/db.ts
4763
+ init_define_import_meta_env();
4723
4764
  import * as fs7 from "node:fs";
4724
4765
  import { createRequire as createRequire3 } from "node:module";
4725
4766
  import * as path7 from "node:path";
4726
4767
 
4727
4768
  // src/sqlite_driver.ts
4769
+ init_define_import_meta_env();
4728
4770
  import * as fs6 from "node:fs";
4729
4771
  import { createRequire as createRequire2 } from "node:module";
4730
4772
  var _require = createRequire2(import.meta.url);
@@ -5466,6 +5508,7 @@ function closeAllDbs() {
5466
5508
  registerReset(closeAllDbs);
5467
5509
 
5468
5510
  // src/render/ansi.ts
5511
+ init_define_import_meta_env();
5469
5512
  function _colorStream(isatty) {
5470
5513
  if (process.env["NO_COLOR"]) return false;
5471
5514
  return isatty;
@@ -5540,9 +5583,11 @@ var C = {
5540
5583
  };
5541
5584
 
5542
5585
  // src/stats.ts
5586
+ init_define_import_meta_env();
5543
5587
  import * as path8 from "node:path";
5544
5588
 
5545
5589
  // src/render/stats_renderer.ts
5590
+ init_define_import_meta_env();
5546
5591
  var _STATS_MESSAGES_FALLBACK = {
5547
5592
  bytesModeOnlyNote: "tracks bytes, not vision tokens",
5548
5593
  sessionHintSplitNote: "session_hint shows realized savings; session_hint_overhead shows injected hint cost",
@@ -6925,7 +6970,14 @@ function renderStats2(opts) {
6925
6970
  process.stdout.write(renderStats(statsData) + "\n");
6926
6971
  }
6927
6972
 
6973
+ // src/hook_registry.ts
6974
+ init_define_import_meta_env();
6975
+
6976
+ // src/hooks_common.ts
6977
+ init_define_import_meta_env();
6978
+
6928
6979
  // src/secret_redact.ts
6980
+ init_define_import_meta_env();
6929
6981
  var SECRET_PATTERNS = [
6930
6982
  // 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
6983
  ["anthropic_api_key", /sk-ant-[A-Za-z0-9_-]{20,}/g],
@@ -7405,11 +7457,16 @@ function serializeOutput(output, eventName, harness, event) {
7405
7457
  }
7406
7458
 
7407
7459
  // src/install.ts
7460
+ init_define_import_meta_env();
7408
7461
  import * as fs8 from "node:fs";
7409
7462
  import * as os3 from "node:os";
7410
7463
  import * as path9 from "node:path";
7411
7464
 
7465
+ // src/bridges/claudecode.ts
7466
+ init_define_import_meta_env();
7467
+
7412
7468
  // src/bridges/shim_common.ts
7469
+ init_define_import_meta_env();
7413
7470
  var SHIM_REQUIRES = `const { spawnSync } = require('node:child_process')
7414
7471
  const path = require('node:path')
7415
7472
  const { pathToFileURL } = require('node:url')`;
@@ -7529,6 +7586,7 @@ main().catch(() => {
7529
7586
  `;
7530
7587
 
7531
7588
  // src/bridges/guidance_block.ts
7589
+ init_define_import_meta_env();
7532
7590
  function buildGuidanceBody(fallbackToolClause, opts = {}) {
7533
7591
  const gdrive = opts.gdrive !== false;
7534
7592
  return [
@@ -7869,12 +7927,14 @@ function uninstallSkill() {
7869
7927
  }
7870
7928
 
7871
7929
  // src/bridges/codex_install.ts
7930
+ init_define_import_meta_env();
7872
7931
  import * as crypto from "node:crypto";
7873
7932
  import * as fs9 from "node:fs";
7874
7933
  import * as os4 from "node:os";
7875
7934
  import * as path10 from "node:path";
7876
7935
 
7877
7936
  // src/bridges/codex.ts
7937
+ init_define_import_meta_env();
7878
7938
  var CODEX_HOOK_SCRIPT = `#!/usr/bin/env node
7879
7939
  // 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
7940
  'use strict'
@@ -7978,6 +8038,7 @@ main().catch(() => {
7978
8038
  `;
7979
8039
 
7980
8040
  // src/bridges/matcher_group.ts
8041
+ init_define_import_meta_env();
7981
8042
  function groupHasTokenGoat2(groups, matcher, predicate) {
7982
8043
  if (groups === void 0) return false;
7983
8044
  for (const group of groups) {
@@ -8263,11 +8324,16 @@ function stripAgentsBlock(p) {
8263
8324
  }
8264
8325
 
8265
8326
  // src/bridges/copilot_cli_install.ts
8327
+ init_define_import_meta_env();
8266
8328
  import * as fs10 from "node:fs";
8267
8329
  import * as os5 from "node:os";
8268
8330
  import * as path11 from "node:path";
8269
8331
 
8332
+ // src/bridges/copilot_cli.ts
8333
+ init_define_import_meta_env();
8334
+
8270
8335
  // src/bridges/shrink_block.ts
8336
+ init_define_import_meta_env();
8271
8337
  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
8338
  const MATERIALIZED_SHRINK_MAX_AGE_MS = 60 * 60 * 1000
8273
8339
  let lastMaterializedShrinkSweepAtMs = 0
@@ -8523,7 +8589,18 @@ async function tryInProcess(entryPath, tgEvent, canonical) {
8523
8589
  async function main() {
8524
8590
  const copilotEvent = process.argv[2] || ''
8525
8591
 
8526
- const tgEvent = COPILOT_TO_TG_EVENT[copilotEvent]
8592
+ // hasOwnProperty, not a bare lookup: the map is a plain object literal, so eight keys it never
8593
+ // declares ('constructor', 'toString', '__proto__' and the rest of Object.prototype) come back
8594
+ // truthy and sail past the check below. tgEvent is then a Function, and 'token-goat hook ' +
8595
+ // tgEvent is concatenated into a shell command string by the fallback at the bottom of this
8596
+ // shim. No member of Object.prototype stringifies with a shell metacharacter, so this was a
8597
+ // failed spawn rather than a second command -- but argv reaching a shell string through a gate
8598
+ // that reads like it stops it is the shape worth closing, not the payload that happened to be
8599
+ // harmless. The four shims built on shim_common.ts validate against a closed Set, which has no
8600
+ // equivalent hole.
8601
+ const tgEvent = Object.prototype.hasOwnProperty.call(COPILOT_TO_TG_EVENT, copilotEvent)
8602
+ ? COPILOT_TO_TG_EVENT[copilotEvent]
8603
+ : undefined
8527
8604
  if (!tgEvent) {
8528
8605
  process.stdout.write('{}')
8529
8606
  return
@@ -9016,11 +9093,13 @@ function isCopilotCliInstalled(opts = {}) {
9016
9093
  }
9017
9094
 
9018
9095
  // src/bridges/kimi_install.ts
9096
+ init_define_import_meta_env();
9019
9097
  import * as fs11 from "node:fs";
9020
9098
  import * as os6 from "node:os";
9021
9099
  import * as path12 from "node:path";
9022
9100
 
9023
9101
  // src/bridges/kimi.ts
9102
+ init_define_import_meta_env();
9024
9103
  var KIMI_HOOK_SCRIPT = `#!/usr/bin/env node
9025
9104
  // 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
9105
  'use strict'
@@ -9272,11 +9351,13 @@ function isKimiInstalled() {
9272
9351
  }
9273
9352
 
9274
9353
  // src/bridges/grok_install.ts
9354
+ init_define_import_meta_env();
9275
9355
  import * as fs12 from "node:fs";
9276
9356
  import * as os7 from "node:os";
9277
9357
  import * as path13 from "node:path";
9278
9358
 
9279
9359
  // src/bridges/grok.ts
9360
+ init_define_import_meta_env();
9280
9361
  var GROK_HOOK_SCRIPT = `#!/usr/bin/env node
9281
9362
  // 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
9363
  'use strict'
@@ -9428,6 +9509,7 @@ function isGrokInstalled() {
9428
9509
  }
9429
9510
 
9430
9511
  // src/bridges/vscode_install.ts
9512
+ init_define_import_meta_env();
9431
9513
  import * as fs13 from "node:fs";
9432
9514
  import * as os8 from "node:os";
9433
9515
  import * as path14 from "node:path";
@@ -9593,11 +9675,19 @@ function uninstallVscode(opts = {}) {
9593
9675
  return removed;
9594
9676
  }
9595
9677
 
9678
+ // src/bridges/index.ts
9679
+ init_define_import_meta_env();
9680
+
9596
9681
  // src/tool_filters/helpers.ts
9682
+ init_define_import_meta_env();
9597
9683
  import * as fs14 from "node:fs";
9598
9684
  import * as path15 from "node:path";
9599
9685
 
9686
+ // src/bash_compress.ts
9687
+ init_define_import_meta_env();
9688
+
9600
9689
  // src/filters.ts
9690
+ init_define_import_meta_env();
9601
9691
  var DROP = () => null;
9602
9692
  var FILTERS = [
9603
9693
  {
@@ -9730,6 +9820,11 @@ function hasUnquotedOperator(cmd, ops) {
9730
9820
  return ops.some((op) => masked.includes(op));
9731
9821
  }
9732
9822
  var BYTES_ELIDED_MARKER_RE = /\n\.\.\. \[\d+ bytes elided by token-goat\]$/;
9823
+ var OWN_TRAILING_NOTICE_RE = /(?:\n(?:\[token-goat: output capped at ~\d+ tokens\]|\.\.\. \[\d+ bytes elided by token-goat\]))+$/;
9824
+ function splitOwnTrailingNotices(text) {
9825
+ const m = OWN_TRAILING_NOTICE_RE.exec(text);
9826
+ return m ? { body: text.slice(0, m.index), notices: m[0] } : { body: text, notices: "" };
9827
+ }
9733
9828
  var DIGITS_RE = /\d+/g;
9734
9829
  var CONTROL_CHAR_RE = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g;
9735
9830
  function utf8Len(s) {
@@ -10384,6 +10479,7 @@ function byteLength(s) {
10384
10479
  }
10385
10480
 
10386
10481
  // src/tool_filters/base.ts
10482
+ init_define_import_meta_env();
10387
10483
  var DEFAULT_MIN_NET_SAVINGS_BYTES = 100;
10388
10484
  function resolveMinNetSavingsBytes() {
10389
10485
  try {
@@ -10620,7 +10716,11 @@ ${body}`;
10620
10716
  }
10621
10717
  };
10622
10718
 
10719
+ // src/tool_filters/dispatch.ts
10720
+ init_define_import_meta_env();
10721
+
10623
10722
  // src/tool_filters/generic.ts
10723
+ init_define_import_meta_env();
10624
10724
  var GenericFilter = class extends ToolFilter {
10625
10725
  name = "generic";
10626
10726
  compress(stdout, stderr, _exitCode, _argv) {
@@ -10641,6 +10741,7 @@ ${errPart}` : errPart;
10641
10741
  };
10642
10742
 
10643
10743
  // src/tool_filters/go_test.ts
10744
+ init_define_import_meta_env();
10644
10745
  var TEST_RUN_RE = /^=== (RUN|PAUSE|CONT|NAME)\s/;
10645
10746
  var RACE_FENCE_RE = /^={10,}\s*$/;
10646
10747
  var RACE_WARNING_RE = /^WARNING: DATA RACE/;
@@ -10841,7 +10942,11 @@ var GoTestFilter = class extends ToolFilter {
10841
10942
  };
10842
10943
  var goTestFilter = new GoTestFilter();
10843
10944
 
10945
+ // src/tool_filters/ai_clis.ts
10946
+ init_define_import_meta_env();
10947
+
10844
10948
  // src/tool_filters/families.ts
10949
+ init_define_import_meta_env();
10845
10950
  function plural(n, suffix = "s") {
10846
10951
  return n === 1 ? "" : suffix;
10847
10952
  }
@@ -11538,6 +11643,7 @@ var AI_CLI_FILTERS = [
11538
11643
  ];
11539
11644
 
11540
11645
  // src/tool_filters/build.ts
11646
+ init_define_import_meta_env();
11541
11647
  var MAKE_RECURSE_RE = /^make\[\d+\]: (?:Entering|Leaving) directory/;
11542
11648
  var MAKE_PERCENT_RE = /^\[\s*\d+%\] (?:Building|Linking|Scanning|Generating|Installing|Compiling)\b/;
11543
11649
  var MAKE_ECHO_RE = /^\s*(?:echo|cc|gcc|clang|g\+\+)\b.*(?<![Ee]rror|[Ww]arning)/;
@@ -13023,6 +13129,7 @@ var BUILD_FILTERS = [
13023
13129
  ];
13024
13130
 
13025
13131
  // src/tool_filters/ci.ts
13132
+ init_define_import_meta_env();
13026
13133
  var _GH_RUN_PASS_STEP_RE = /^\s*[✓√]\s/;
13027
13134
  var _GH_RUN_FAIL_STEP_RE = /^\s*[X✗❌]\s|^\s*FAIL(:|ED|URE)\b|^\s*Error:\s/;
13028
13135
  var _GH_API_URL_SUFFIX = "_url";
@@ -13836,6 +13943,7 @@ var CI_FILTERS = [
13836
13943
  ];
13837
13944
 
13838
13945
  // src/tool_filters/cloud.ts
13946
+ init_define_import_meta_env();
13839
13947
  var _TF_REFRESH_RE = /^[a-z0-9_.[\]"-]+: (Refreshing state|Reading|Read complete|Still |Modifications complete)/;
13840
13948
  var _TF_PLAN_SUMMARY_RE = /^Plan: \d+ to (add|change|destroy|import)/;
13841
13949
  var _TF_NO_CHANGES_RE = /^No changes\.|^(?:This plan does nothing|Nothing to do\.)/i;
@@ -15260,6 +15368,7 @@ var CLOUD_FILTERS = [
15260
15368
  ];
15261
15369
 
15262
15370
  // src/tool_filters/shell_file.ts
15371
+ init_define_import_meta_env();
15263
15372
  var _GREP_COMPRESS_THRESHOLD = 30;
15264
15373
  var _GREP_MAX_FILE_LINES = 20;
15265
15374
  var GrepFilter = class extends ToolFilter {
@@ -16366,6 +16475,7 @@ var SHELL_FILE_FILTERS = [
16366
16475
  ];
16367
16476
 
16368
16477
  // src/tool_filters/languages.ts
16478
+ init_define_import_meta_env();
16369
16479
  var NODE_INTERNAL_FRAME_RE = /^\s{4}at\s+(?:node:|.+\s+\(node:)/;
16370
16480
  var NODE_MODULES_FRAME_RE = /^\s{4}at\s+.*[/\\]node_modules[/\\]/;
16371
16481
  var NodeFilter = class extends ToolFilter {
@@ -17590,6 +17700,7 @@ var LANGUAGE_FILTERS = [
17590
17700
  ];
17591
17701
 
17592
17702
  // src/tool_filters/misc.ts
17703
+ init_define_import_meta_env();
17593
17704
  var PW_PASS_RE = /^\s+[✓✔]\s/;
17594
17705
  var PW_DOWNLOAD_RE = /^\s*(Downloading|Downloaded|Installing)\s+\w|^\s*[\d.]+\s+[KMG]b\s+\[/i;
17595
17706
  var PlaywrightFilter = class _PlaywrightFilter extends ToolFilter {
@@ -18996,6 +19107,7 @@ var MISC_FILTERS = [
18996
19107
  ];
18997
19108
 
18998
19109
  // src/tool_filters/containers.ts
19110
+ init_define_import_meta_env();
18999
19111
  var _DOCKER_DIGEST_RE = /^\s*#\d+\s+(sha256:[a-f0-9]{8,}|resolve\s)/;
19000
19112
  var _DOCKER_PROGRESS_RE = /^\s*#\d+\s+\d+(?:\.\d+)?(?:MB|kB|GB)\s+\//;
19001
19113
  var _DOCKER_STEP_RE = /^\s*=>\s|^\s*#\d+\s+\[(internal|build|stage)/;
@@ -19666,6 +19778,7 @@ var CONTAINER_FILTERS = [
19666
19778
  ];
19667
19779
 
19668
19780
  // src/tool_filters/git.ts
19781
+ init_define_import_meta_env();
19669
19782
  var _GIT_VALUE_FLAGS = /* @__PURE__ */ new Set([
19670
19783
  "-m",
19671
19784
  "--message",
@@ -20707,6 +20820,7 @@ var GIT_FILTERS = [
20707
20820
  ];
20708
20821
 
20709
20822
  // src/tool_filters/linters.ts
20823
+ init_define_import_meta_env();
20710
20824
  var _ESLINT_LOC_RE = /^\s+\d+:\d+\s+(error|warning|info)\s/;
20711
20825
  var _ESLINT_FILE_RE = /^(?:\/|[A-Za-z]:|[a-zA-Z0-9_./-]+\.(?:js|jsx|ts|tsx|mjs|cjs|vue))/;
20712
20826
  var _ESLINT_SUMMARY_RE = /^[✖✗✘x×]\s+\d+\s+problem/;
@@ -22120,6 +22234,7 @@ var LINTER_FILTERS = [
22120
22234
  ];
22121
22235
 
22122
22236
  // src/tool_filters/package_managers.ts
22237
+ init_define_import_meta_env();
22123
22238
  function dedupLines(lines, maxPerKey = 1, keyFn = (l) => l.trim()) {
22124
22239
  const seen = /* @__PURE__ */ new Map();
22125
22240
  const out = [];
@@ -23191,6 +23306,7 @@ var PACKAGE_MANAGER_FILTERS = [
23191
23306
  ];
23192
23307
 
23193
23308
  // src/tool_filters/pytest.ts
23309
+ init_define_import_meta_env();
23194
23310
  var XDIST_PREFIX_RE = /^\[gw\d+\]\s*(?:\[\s*\d+%\]\s*)?/;
23195
23311
  var DOTS_RE = /^[.FxXEsS]+\s*(\[\s*\d+%\])?\s*$/;
23196
23312
  var BANNER_RE = /^(?:platform\s|cachedir:\s|rootdir:\s|plugins:\s|configfile:\s|bringing up\s|cacheprovider-)/;
@@ -23377,6 +23493,7 @@ var PytestFilter = class extends ToolFilter {
23377
23493
  var pytestFilter = new PytestFilter();
23378
23494
 
23379
23495
  // src/tool_filters/test_runners.ts
23496
+ init_define_import_meta_env();
23380
23497
  var jestFilter = makeNodeTestRunnerFilter({
23381
23498
  name: "jest",
23382
23499
  binaries: ["jest", "mocha", "ava", "tap"],
@@ -23394,12 +23511,26 @@ var jestFilter = makeNodeTestRunnerFilter({
23394
23511
  var vitestFilter = makeNodeTestRunnerFilter({
23395
23512
  name: "vitest",
23396
23513
  binaries: ["vitest"],
23397
- // File-level pass header carries a duration: `✓ src/x.test.ts (12ms)`.
23398
- passFileRe: /^\s*✓\s+\S.*\([\d.]+\s*[a-zA-Z]\w*\)/,
23514
+ // File-level pass header carries a duration: `✓ src/x.test.ts (12ms)`. The ` > ` exclusion is
23515
+ // not decoration: a verbose per-test line whose test NAME happens to end in something shaped
23516
+ // like a duration (`... to the documented min (100ms) 1ms`) is otherwise claimed here, and gets
23517
+ // counted as a passing FILE. Both branches drop the line, so nothing is lost -- but the reported
23518
+ // count is wrong, and wrong in a way that depends on which reporter produced the run.
23519
+ passFileRe: /^\s*✓(?!.*\s>\s)\s+\S.*\([\d.]+\s*[a-zA-Z]\w*\)/,
23399
23520
  failFileRe: /^\s*(?:×|FAIL|✗|✘)\s+\S/,
23400
- summaryRe: /^(Test Files|Tests|Modules|Duration|Start at)[\s:]+\d/,
23401
- // Per-test tick is indented ≥2 spaces: ` ✓ should pass`.
23402
- testTickRe: /^\s{2,}✓\s/,
23521
+ // Real vitest right-aligns its summary labels, so every one of these arrives indented:
23522
+ // ` Tests 140 passed (140)`. Anchoring at `^` matched none of them. They survived only
23523
+ // by falling through to the keep-verbatim branch, which is not the same rule -- a summary line
23524
+ // reached while a fail block is open was swallowed into that block instead of ending it.
23525
+ summaryRe: /^\s*(Test Files|Tests|Modules|Duration|Start at)[\s:]+\d/,
23526
+ // Two shapes, because the reporter decides which one a passing test prints. The default
23527
+ // reporter indents a per-test tick under its file header (` ✓ should pass`). `--reporter=
23528
+ // verbose` prints one line per test at a single leading space, carrying the full
23529
+ // `file > describe > name` path instead: ` ✓ tests/x.test.ts > safeJoin > joins normally 28ms`.
23530
+ // Those lines match no rule at all today, so a verbose run compresses by nothing. The ` > `
23531
+ // is what separates them from a file-level header, which passFileRe claims first and which
23532
+ // never contains one.
23533
+ testTickRe: /^\s{2,}✓\s|^\s*✓\s.*\s>\s/,
23403
23534
  outputHdrRe: /^\s*stdout\s*\|/,
23404
23535
  outputNoun: "stdout",
23405
23536
  passFileNoun: "passing file"
@@ -23511,12 +23642,23 @@ function compressOutput(filter, stdout, stderr, exitCode, argv, opts = {}) {
23511
23642
  if (opts.maxBytes !== void 0) applyOpts.maxBytes = opts.maxBytes;
23512
23643
  return filter.apply(stdout, stderr, exitCode, argv, applyOpts);
23513
23644
  }
23645
+ function deliverCompressed(filter, stdout, stderr, exitCode, argv, opts = {}) {
23646
+ const compressed = compressOutput(filter, stdout, stderr, exitCode, argv, opts);
23647
+ const minNet = resolveMinNetSavingsBytes();
23648
+ const applied = compressed.worthApplying(minNet);
23649
+ const text = applied ? compressed.text : combineStreams(stdout, stderr);
23650
+ const marker = applied ? compressed.withMarker(minNet).slice(compressed.text.length) : "";
23651
+ return { applied, text, marker, compressed };
23652
+ }
23514
23653
  function filterByName(name) {
23515
23654
  if (name === "generic") return new GenericFilter();
23516
23655
  for (const f of TOOL_FILTERS) if (f.name === name) return f;
23517
23656
  return null;
23518
23657
  }
23519
23658
 
23659
+ // src/tool_filters/index.ts
23660
+ init_define_import_meta_env();
23661
+
23520
23662
  export {
23521
23663
  VERSION,
23522
23664
  dataDir,
@@ -23723,17 +23865,21 @@ export {
23723
23865
  stripAnsiCodes,
23724
23866
  combineStreams,
23725
23867
  hasBareBackgroundOrNewline,
23868
+ splitOwnTrailingNotices,
23726
23869
  dedupeConsecutive,
23727
23870
  capTokens,
23728
23871
  shlexSplit,
23729
23872
  resolveMinNetSavingsBytes,
23730
23873
  isRewriteWorthwhile,
23731
23874
  compressedTokensSaved,
23875
+ CompressedOutput,
23732
23876
  ToolFilter,
23877
+ TOOL_FILTERS,
23733
23878
  dispatchArgv,
23734
23879
  selectFilter,
23735
23880
  detectFromCommand,
23736
23881
  compressOutput,
23882
+ deliverCompressed,
23737
23883
  filterByName
23738
23884
  };
23739
23885
  /*! 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-CGWACYYZ.mjs";
6
+ } from "./token-goat-chunk-OKJX2JWW.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-UZ2NFOOZ.mjs";
21
- import "./token-goat-chunk-AO2QD2AG.mjs";
22
- import "./token-goat-chunk-AEX54RUZ.mjs";
18
+ } from "./token-goat-chunk-KKHKXUVS.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 = compressOutput(filter, stdoutText, stderrText, exitCode, argv, {
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
- const minNetSavingsBytes = resolveMinNetSavingsBytes();
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);
@@ -2,10 +2,13 @@ import { createRequire as __cjsRequire } from 'node:module';
2
2
  const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  external_exports
5
- } from "./token-goat-chunk-WN5T5EW5.mjs";
6
- import "./token-goat-chunk-AEX54RUZ.mjs";
5
+ } from "./token-goat-chunk-FQD3OB5W.mjs";
6
+ import {
7
+ init_define_import_meta_env
8
+ } from "./token-goat-chunk-A37V4PBF.mjs";
7
9
 
8
10
  // src/mcp_jsonrpc.ts
11
+ init_define_import_meta_env();
9
12
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
10
13
  var SUPPORTED_PROTOCOL_VERSIONS = [
11
14
  LATEST_PROTOCOL_VERSION,
@@ -2,9 +2,13 @@ import { createRequire as __cjsRequire } from 'node:module';
2
2
  const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  detectHarness
5
- } from "./token-goat-chunk-UZ2NFOOZ.mjs";
5
+ } from "./token-goat-chunk-KKHKXUVS.mjs";
6
+ import {
7
+ init_define_import_meta_env
8
+ } from "./token-goat-chunk-A37V4PBF.mjs";
6
9
 
7
10
  // src/delivery_cap.ts
11
+ init_define_import_meta_env();
8
12
  var CLAUDE_CODE_BASH_OUTPUT_CAP_BYTES = 2e4;
9
13
  function bashOutputCapBytes(harness = detectHarness()) {
10
14
  return harness === "claudecode" ? CLAUDE_CODE_BASH_OUTPUT_CAP_BYTES : null;
@@ -16,6 +20,7 @@ function deliveredOutputBytes(originalBytes, harness) {
16
20
  }
17
21
 
18
22
  // src/shell.ts
23
+ init_define_import_meta_env();
19
24
  import * as fs from "node:fs";
20
25
  import * as path from "node:path";
21
26
  var WSL_LAUNCHER_SEGMENTS = /* @__PURE__ */ new Set(["system32", "syswow64", "windowsapps"]);
@@ -240,8 +240,8 @@ import {
240
240
  xid,
241
241
  xor,
242
242
  zod_default
243
- } from "./token-goat-chunk-WN5T5EW5.mjs";
244
- import "./token-goat-chunk-AEX54RUZ.mjs";
243
+ } from "./token-goat-chunk-FQD3OB5W.mjs";
244
+ import "./token-goat-chunk-A37V4PBF.mjs";
245
245
  export {
246
246
  $brand,
247
247
  $input,
@@ -7,13 +7,13 @@ import {
7
7
  expandGlobs,
8
8
  leftoverIntegrations,
9
9
  run
10
- } from "./token-goat-chunk-KKIB7O3Z.mjs";
11
- import "./token-goat-chunk-FXAPKVRG.mjs";
12
- import "./token-goat-chunk-VCNW7BGU.mjs";
13
- import "./token-goat-chunk-LJ3CHCTT.mjs";
14
- import "./token-goat-chunk-UZ2NFOOZ.mjs";
15
- import "./token-goat-chunk-AO2QD2AG.mjs";
16
- import "./token-goat-chunk-AEX54RUZ.mjs";
10
+ } from "./token-goat-chunk-6FQMEMWX.mjs";
11
+ import "./token-goat-chunk-7A7SBE6R.mjs";
12
+ import "./token-goat-chunk-A4VBNWSL.mjs";
13
+ import "./token-goat-chunk-3XVGPLDS.mjs";
14
+ import "./token-goat-chunk-KKHKXUVS.mjs";
15
+ import "./token-goat-chunk-EEIDFMEM.mjs";
16
+ import "./token-goat-chunk-A37V4PBF.mjs";
17
17
  export {
18
18
  applyExitOverride,
19
19
  buildProgram,