token-goat 2.8.6 → 2.9.2
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 +27 -717
- package/SECURITY.md +1 -1
- package/dist/token-goat-chunk-CGWACYYZ.mjs +79 -0
- package/dist/{token-goat-chunk-XAWIELXH.mjs → token-goat-chunk-FXAPKVRG.mjs} +545 -217
- package/dist/{token-goat-chunk-SHN4UTL4.mjs → token-goat-chunk-JMUBXBG7.mjs} +5 -5
- package/dist/{token-goat-chunk-U7M2LTGP.mjs → token-goat-chunk-KKIB7O3Z.mjs} +854 -283
- package/dist/{token-goat-chunk-ZIPBLIUZ.mjs → token-goat-chunk-LEBYARO3.mjs} +28 -4
- package/dist/{token-goat-chunk-DK4VLLYB.mjs → token-goat-chunk-LJ3CHCTT.mjs} +2061 -3612
- package/dist/{token-goat-chunk-L2XHDICZ.mjs → token-goat-chunk-NY4HYRSK.mjs} +28 -27
- package/dist/{token-goat-chunk-MA5237JN.mjs → token-goat-chunk-Q4LOQY44.mjs} +205 -60
- package/dist/{token-goat-chunk-GUNYAGOZ.mjs → token-goat-chunk-UZ2NFOOZ.mjs} +10103 -117
- package/dist/{token-goat-chunk-TELKICYU.mjs → token-goat-chunk-VCNW7BGU.mjs} +155 -519
- package/dist/{token-goat-chunk-LJEETTER.mjs → token-goat-chunk-ZVN5WHTO.mjs} +5 -5
- package/dist/token-goat-hook.mjs +5 -5
- package/dist/token-goat.core.mjs +5 -5
- package/docs/C4_RUNTIME_ARCHITECTURE.md +303 -0
- package/docs/cli.md +339 -0
- package/docs/install.md +331 -0
- package/docs/security.md +102 -0
- package/package.json +7 -2
- package/dist/token-goat-chunk-2JZ66BBE.mjs +0 -7157
package/SECURITY.md
CHANGED
|
@@ -49,7 +49,7 @@ The following are not treated as security issues unless paired with a working pr
|
|
|
49
49
|
| an install without optional packages | `npm install --omit=optional token-goat` then `npm audit --omit=dev --omit=optional` | clean, 2 packages |
|
|
50
50
|
| a default install | `npm install token-goat` then `npm audit --omit=dev` | clean, 70 packages |
|
|
51
51
|
|
|
52
|
-
The repository carries an `overrides` block in [`package.json`](package.json) that pins six
|
|
52
|
+
The repository carries an `overrides` block in [`package.json`](package.json) that pins six packages to patched versions, and **npm applies `overrides` only in the root project**, so those pins do not travel to anyone who installs Token-Goat as a dependency. That distinction used to matter a great deal, because a clean repository scan was standing in for an install that was not clean. It decides one thing now, and the section on the embedding runtime below says which. Otherwise the packages those pins were protecting against are not in a consumer's tree at all, whether or not the pins travel; the block stays because the development tree still resolves them.
|
|
53
53
|
|
|
54
54
|
There is no table of reaching advisories here any more, and the last entry in it is worth recording rather than deleting. `@xenova/transformers` was an optional dependency, which in npm means everyone got it unless they asked not to, and it carried [`protobufjs`](https://github.com/advisories/GHSA-xq3m-2v4x-88gg) through `onnx-proto` and `onnxruntime-web` -- one critical advisory and four more -- plus its own nested, older `sharp` carrying [four inherited libvips CVEs](https://github.com/advisories/GHSA-f88m-g3jw-g9cj). None of the six was fixable from here: every one sits in a transitive package with no patched version, and the pins that would have solved it do not travel to consumers.
|
|
55
55
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
detectHarness
|
|
5
|
+
} from "./token-goat-chunk-UZ2NFOOZ.mjs";
|
|
6
|
+
|
|
7
|
+
// src/delivery_cap.ts
|
|
8
|
+
var CLAUDE_CODE_BASH_OUTPUT_CAP_BYTES = 2e4;
|
|
9
|
+
function bashOutputCapBytes(harness = detectHarness()) {
|
|
10
|
+
return harness === "claudecode" ? CLAUDE_CODE_BASH_OUTPUT_CAP_BYTES : null;
|
|
11
|
+
}
|
|
12
|
+
function deliveredOutputBytes(originalBytes, harness) {
|
|
13
|
+
const cap = bashOutputCapBytes(harness);
|
|
14
|
+
if (cap === null) return Math.max(0, originalBytes);
|
|
15
|
+
return Math.max(0, Math.min(originalBytes, cap));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/shell.ts
|
|
19
|
+
import * as fs from "node:fs";
|
|
20
|
+
import * as path from "node:path";
|
|
21
|
+
var WSL_LAUNCHER_SEGMENTS = /* @__PURE__ */ new Set(["system32", "syswow64", "windowsapps"]);
|
|
22
|
+
function isExecutable(p) {
|
|
23
|
+
try {
|
|
24
|
+
return fs.statSync(p).isFile();
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function isWslLauncherDir(dir) {
|
|
30
|
+
return dir.toLowerCase().split(/[\\/]+/).some((seg) => WSL_LAUNCHER_SEGMENTS.has(seg));
|
|
31
|
+
}
|
|
32
|
+
function locateBashOnPath(pathValue, isExe = isExecutable) {
|
|
33
|
+
for (const dir of (pathValue ?? "").split(path.delimiter)) {
|
|
34
|
+
if (!dir || isWslLauncherDir(dir)) continue;
|
|
35
|
+
const cand = path.join(dir, "bash.exe");
|
|
36
|
+
if (isExe(cand)) return cand;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
function knownGitBashPaths() {
|
|
41
|
+
const localPrograms = process.env["LOCALAPPDATA"] ? path.join(process.env["LOCALAPPDATA"], "Programs") : void 0;
|
|
42
|
+
const bases = [
|
|
43
|
+
process.env["ProgramFiles"],
|
|
44
|
+
process.env["ProgramFiles(x86)"],
|
|
45
|
+
process.env["ProgramW6432"],
|
|
46
|
+
localPrograms
|
|
47
|
+
];
|
|
48
|
+
const out = [];
|
|
49
|
+
for (const base of bases) {
|
|
50
|
+
if (!base) continue;
|
|
51
|
+
out.push(path.join(base, "Git", "bin", "bash.exe"));
|
|
52
|
+
out.push(path.join(base, "Git", "usr", "bin", "bash.exe"));
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
function resolveWindowsBash() {
|
|
57
|
+
if (process.platform !== "win32") return null;
|
|
58
|
+
const override = process.env["TOKEN_GOAT_BASH"];
|
|
59
|
+
if (override && isExecutable(override)) return override;
|
|
60
|
+
const onPath = locateBashOnPath(process.env["PATH"]);
|
|
61
|
+
if (onPath) return onPath;
|
|
62
|
+
for (const cand of knownGitBashPaths()) {
|
|
63
|
+
if (isExecutable(cand)) return cand;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
function wrappedShell() {
|
|
68
|
+
if (process.platform !== "win32") return true;
|
|
69
|
+
return resolveWindowsBash() ?? true;
|
|
70
|
+
}
|
|
71
|
+
function canRunWrappedShell() {
|
|
72
|
+
return process.platform !== "win32" || resolveWindowsBash() !== null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
deliveredOutputBytes,
|
|
77
|
+
wrappedShell,
|
|
78
|
+
canRunWrappedShell
|
|
79
|
+
};
|