token-goat 2.9.26 → 2.9.29
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 +30 -88
- package/SECURITY.md +14 -0
- package/dist/{token-goat-chunk-OZRSREKR.mjs → token-goat-chunk-2AWQ2R5X.mjs} +2 -2
- package/dist/{token-goat-chunk-BH4ZVRB2.mjs → token-goat-chunk-2NNUA2LR.mjs} +4 -4
- package/dist/token-goat-chunk-2WOUYWLM.mjs +955 -0
- package/dist/{token-goat-chunk-IKZLSRII.mjs → token-goat-chunk-435UQTKD.mjs} +5 -3
- package/dist/{token-goat-chunk-62IHOU6L.mjs → token-goat-chunk-44BM7DDQ.mjs} +5 -3
- package/dist/token-goat-chunk-52NSDWYY.mjs +96 -0
- package/dist/{token-goat-chunk-CXBOFPF4.mjs → token-goat-chunk-67BNIKKO.mjs} +32 -18
- package/dist/{token-goat-chunk-XBESNWEX.mjs → token-goat-chunk-6AK46ZT7.mjs} +2 -3
- package/dist/{token-goat-chunk-7SXPJOSZ.mjs → token-goat-chunk-7CPMDFGB.mjs} +166 -40
- package/dist/token-goat-chunk-ASLWOQ3I.mjs +14 -0
- package/dist/{token-goat-chunk-MWID3YOY.mjs → token-goat-chunk-BGYOZ6DO.mjs} +6 -4
- package/dist/{token-goat-chunk-PAV6NNY7.mjs → token-goat-chunk-C5YPNZKQ.mjs} +22 -8
- package/dist/{token-goat-chunk-D2X7XN5M.mjs → token-goat-chunk-CIQ2FTY3.mjs} +23 -242
- package/dist/token-goat-chunk-D4ETHJD6.mjs +246 -0
- package/dist/{token-goat-chunk-7Y6GWTII.mjs → token-goat-chunk-DNRPXHYH.mjs} +25 -17
- package/dist/{token-goat-chunk-L43RKNHA.mjs → token-goat-chunk-DNSPXQXQ.mjs} +2 -2
- package/dist/token-goat-chunk-DPNLUJWB.mjs +220 -0
- package/dist/token-goat-chunk-E4ZOJIZK.mjs +1382 -0
- package/dist/token-goat-chunk-E5TK5DNO.mjs +718 -0
- package/dist/{token-goat-chunk-VVROQBQJ.mjs → token-goat-chunk-EUSDXRXU.mjs} +62 -12
- package/dist/{token-goat-chunk-POOI26O6.mjs → token-goat-chunk-FTP4U4QA.mjs} +12 -8
- package/dist/token-goat-chunk-G23DWHV4.mjs +142 -0
- package/dist/{token-goat-chunk-MDV5VWF4.mjs → token-goat-chunk-G7IWXCFF.mjs} +223 -15
- package/dist/{token-goat-chunk-C2PG4K5D.mjs → token-goat-chunk-GLXRTTLE.mjs} +7 -5
- package/dist/{token-goat-chunk-M6CVNHTW.mjs → token-goat-chunk-H5J3C56Q.mjs} +95 -573
- package/dist/{token-goat-chunk-BAWKGODL.mjs → token-goat-chunk-HNFZZHFW.mjs} +2 -2
- package/dist/{token-goat-chunk-TG5ZPD6B.mjs → token-goat-chunk-HUYUHODZ.mjs} +1036 -759
- package/dist/token-goat-chunk-IVE6U7KV.mjs +53 -0
- package/dist/{token-goat-chunk-ZZT6PVB3.mjs → token-goat-chunk-IVWI2OCK.mjs} +72 -45
- package/dist/{token-goat-chunk-GMOUBOX4.mjs → token-goat-chunk-JTKCQMQA.mjs} +37 -5
- package/dist/{token-goat-chunk-H2CPLEMP.mjs → token-goat-chunk-KOPIR3KZ.mjs} +46 -23
- package/dist/token-goat-chunk-L7H3U27L.mjs +35 -0
- package/dist/{token-goat-chunk-FLEYOCAS.mjs → token-goat-chunk-LZNBQTDK.mjs} +6 -4
- package/dist/token-goat-chunk-MELOKFDJ.mjs +199 -0
- package/dist/{token-goat-chunk-RH27ZSPF.mjs → token-goat-chunk-NMBWLRHW.mjs} +164 -50
- package/dist/{token-goat-chunk-43JFN26X.mjs → token-goat-chunk-O6I2XU4P.mjs} +27 -967
- package/dist/{token-goat-chunk-G6EYO5CD.mjs → token-goat-chunk-ONXH6NZ5.mjs} +2 -87
- package/dist/token-goat-chunk-ORNFMIER.mjs +295 -0
- package/dist/{token-goat-chunk-LHUP4DXZ.mjs → token-goat-chunk-PGTH2U4C.mjs} +1 -1
- package/dist/{token-goat-chunk-5BQ7W7D7.mjs → token-goat-chunk-PKRWMHVP.mjs} +76 -59
- package/dist/{token-goat-chunk-DA43OE7L.mjs → token-goat-chunk-PQ53BSCF.mjs} +1 -1
- package/dist/{token-goat-chunk-STYRLQIW.mjs → token-goat-chunk-PYSUADX4.mjs} +2 -2
- package/dist/{token-goat-chunk-JALB3KWJ.mjs → token-goat-chunk-QO3LXVVR.mjs} +4247 -5005
- package/dist/{token-goat-chunk-L45IWWMC.mjs → token-goat-chunk-RLP6J7WR.mjs} +6 -6
- package/dist/token-goat-chunk-RQGGMPCR.mjs +205 -0
- package/dist/{token-goat-chunk-MBDJR6HU.mjs → token-goat-chunk-RTMVLHWX.mjs} +3708 -4003
- package/dist/{token-goat-chunk-E3K3BTEQ.mjs → token-goat-chunk-S4VSXURL.mjs} +8 -6
- package/dist/{token-goat-chunk-LKSXAMJB.mjs → token-goat-chunk-SE6E4BKJ.mjs} +1 -1
- package/dist/token-goat-chunk-TCQANXYC.mjs +351 -0
- package/dist/token-goat-chunk-TDUT2CL6.mjs +564 -0
- package/dist/{token-goat-chunk-LRIZ7K3F.mjs → token-goat-chunk-TGOXNAHW.mjs} +54 -111
- package/dist/{token-goat-chunk-WNBSCSAI.mjs → token-goat-chunk-UA5BKWWQ.mjs} +1 -1
- package/dist/{token-goat-chunk-RIB6XY2V.mjs → token-goat-chunk-UXSXQQIY.mjs} +1 -1
- package/dist/{token-goat-chunk-7EPYB34H.mjs → token-goat-chunk-VMFWNHGR.mjs} +84 -73
- package/dist/token-goat-chunk-VQ6F6T7X.mjs +36 -0
- package/dist/{token-goat-chunk-5M3NRJD2.mjs → token-goat-chunk-VZQEWRVH.mjs} +6 -4
- package/dist/{token-goat-chunk-OSUFN2FV.mjs → token-goat-chunk-XB5KKOCG.mjs} +5 -25
- package/dist/{token-goat-chunk-6E2IDLHF.mjs → token-goat-chunk-XYWPOSCN.mjs} +57 -615
- package/dist/{token-goat-chunk-CQHY4SL7.mjs → token-goat-chunk-YAGLESS3.mjs} +8 -5
- package/dist/token-goat-chunk-YKSRAWUU.mjs +33 -0
- package/dist/{token-goat-chunk-F2ARFHLJ.mjs → token-goat-chunk-YOOVFPTP.mjs} +2 -2
- package/dist/{token-goat-chunk-EEIDFMEM.mjs → token-goat-chunk-YZAAZU2S.mjs} +12 -3
- package/dist/token-goat-chunk-Z6KBMOBI.mjs +53 -0
- package/dist/{token-goat-chunk-4GEDH2WU.mjs → token-goat-chunk-ZER6EAXZ.mjs} +81 -70
- package/dist/token-goat-hook-client.cjs +475 -0
- package/dist/token-goat-hook-client.mjs +26 -0
- package/dist/token-goat-hook.mjs +31 -21
- package/dist/token-goat.core.mjs +9 -39
- package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
- package/docs/cli.md +35 -23
- package/docs/install.md +18 -14
- package/package.json +1 -1
- package/dist/token-goat-chunk-ADMR3QVF.mjs +0 -41
- package/dist/token-goat-chunk-E6B2UFDF.mjs +0 -30
- package/dist/token-goat-chunk-GKZ2US5B.mjs +0 -187
- package/dist/token-goat-chunk-MZTO4FXH.mjs +0 -26
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
const __tgModuleUrl = require('node:url').pathToFileURL(__filename).href;
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/hook_client.ts
|
|
32
|
+
var hook_client_exports = {};
|
|
33
|
+
__export(hook_client_exports, {
|
|
34
|
+
WARM_CLI_COMMANDS: () => WARM_CLI_COMMANDS,
|
|
35
|
+
callServer: () => callServer,
|
|
36
|
+
queryServers: () => queryServers,
|
|
37
|
+
relayViaServer: () => relayViaServer,
|
|
38
|
+
runCliViaServer: () => runCliViaServer,
|
|
39
|
+
serverEnabled: () => serverEnabled,
|
|
40
|
+
serverStatuses: () => serverStatuses,
|
|
41
|
+
warmCliEligible: () => warmCliEligible
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(hook_client_exports);
|
|
44
|
+
var import_node_child_process = require("node:child_process");
|
|
45
|
+
var fs2 = __toESM(require("node:fs"), 1);
|
|
46
|
+
var net = __toESM(require("node:net"), 1);
|
|
47
|
+
|
|
48
|
+
// src/env.ts
|
|
49
|
+
var FALSY_ENV_VALUES = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
50
|
+
var TRUTHY_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
51
|
+
function envBool(key, defaultVal) {
|
|
52
|
+
const raw = process.env[key];
|
|
53
|
+
if (raw === void 0) return defaultVal;
|
|
54
|
+
const norm = raw.trim().toLowerCase();
|
|
55
|
+
if (norm === "") return defaultVal;
|
|
56
|
+
if (TRUTHY_ENV_VALUES.has(norm)) return true;
|
|
57
|
+
if (FALSY_ENV_VALUES.has(norm)) return false;
|
|
58
|
+
return defaultVal;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/hook_ipc.ts
|
|
62
|
+
var crypto = __toESM(require("node:crypto"), 1);
|
|
63
|
+
var fs = __toESM(require("node:fs"), 1);
|
|
64
|
+
var os2 = __toESM(require("node:os"), 1);
|
|
65
|
+
var path2 = __toESM(require("node:path"), 1);
|
|
66
|
+
var import_node_url = require("node:url");
|
|
67
|
+
|
|
68
|
+
// src/constants.ts
|
|
69
|
+
var os = __toESM(require("node:os"), 1);
|
|
70
|
+
var path = __toESM(require("node:path"), 1);
|
|
71
|
+
|
|
72
|
+
// src/version.ts
|
|
73
|
+
var import_node_module = require("node:module");
|
|
74
|
+
function readManifest() {
|
|
75
|
+
if (true) return JSON.parse('{"version":"2.9.29","name":"token-goat","bugs":{"url":"https://github.com/DFKHelper/token-goat/issues"}}');
|
|
76
|
+
try {
|
|
77
|
+
return (0, import_node_module.createRequire)(__tgModuleUrl)("../package.json");
|
|
78
|
+
} catch {
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
var manifest = readManifest();
|
|
83
|
+
var VERSION = manifest.version ?? "0.0.0";
|
|
84
|
+
var PACKAGE_NAME = manifest.name !== void 0 && manifest.name !== "" ? manifest.name : "token-goat";
|
|
85
|
+
var ISSUES_URL = manifest.bugs?.url !== void 0 && manifest.bugs.url !== "" ? manifest.bugs.url : "https://github.com/DFKHelper/token-goat/issues";
|
|
86
|
+
|
|
87
|
+
// src/constants.ts
|
|
88
|
+
function safeEnvDir(value) {
|
|
89
|
+
const stripped = value.trim();
|
|
90
|
+
if (stripped === "") return void 0;
|
|
91
|
+
if (!path.isAbsolute(stripped)) return void 0;
|
|
92
|
+
if (process.platform === "win32") {
|
|
93
|
+
const root = path.parse(stripped).root;
|
|
94
|
+
if (root === "" || root === "\\" || root === "/") return void 0;
|
|
95
|
+
}
|
|
96
|
+
return stripped;
|
|
97
|
+
}
|
|
98
|
+
function dataDirForHome(homeDir) {
|
|
99
|
+
const platform = process.platform;
|
|
100
|
+
if (platform === "win32") {
|
|
101
|
+
return path.join(homeDir, "AppData", "Local", "dfk-helper", "token-goat");
|
|
102
|
+
}
|
|
103
|
+
if (platform === "darwin") {
|
|
104
|
+
return path.join(homeDir, "Library", "Application Support", "token-goat");
|
|
105
|
+
}
|
|
106
|
+
return path.join(homeDir, ".local", "share", "token-goat");
|
|
107
|
+
}
|
|
108
|
+
function homeFallbackOrGuard() {
|
|
109
|
+
const inVitest = process.env["VITEST_WORKER_ID"] !== void 0 || process.env["VITEST"] === "true";
|
|
110
|
+
if (inVitest && process.env["VITEST_ALLOW_REAL_DATA_DIR"] !== "1") {
|
|
111
|
+
throw new Error(
|
|
112
|
+
"token-goat: refusing to resolve DATA_DIR against the real home directory inside a Vitest worker (LOCALAPPDATA/XDG_DATA_HOME is unset). This would read or write the developer's real global.db/config.toml. Set LOCALAPPDATA/XDG_DATA_HOME explicitly for this process, or VITEST_ALLOW_REAL_DATA_DIR=1 if this is an intentional mocked-home test."
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return dataDirForHome(os.homedir());
|
|
116
|
+
}
|
|
117
|
+
function defaultDataDir() {
|
|
118
|
+
const platform = process.platform;
|
|
119
|
+
if (platform === "win32") {
|
|
120
|
+
const raw = process.env["LOCALAPPDATA"] ?? "";
|
|
121
|
+
const base2 = raw ? safeEnvDir(raw) : void 0;
|
|
122
|
+
if (base2 !== void 0) {
|
|
123
|
+
return path.join(base2, "dfk-helper", "token-goat");
|
|
124
|
+
}
|
|
125
|
+
return homeFallbackOrGuard();
|
|
126
|
+
}
|
|
127
|
+
if (platform === "darwin") {
|
|
128
|
+
const raw = process.env["XDG_DATA_HOME"] ?? "";
|
|
129
|
+
const base2 = raw ? safeEnvDir(raw) : void 0;
|
|
130
|
+
if (base2 !== void 0) {
|
|
131
|
+
return path.join(base2, "token-goat");
|
|
132
|
+
}
|
|
133
|
+
return homeFallbackOrGuard();
|
|
134
|
+
}
|
|
135
|
+
const xdg = process.env["XDG_DATA_HOME"] ?? "";
|
|
136
|
+
const base = xdg ? safeEnvDir(xdg) : void 0;
|
|
137
|
+
if (base !== void 0) {
|
|
138
|
+
return path.join(base, "token-goat");
|
|
139
|
+
}
|
|
140
|
+
return homeFallbackOrGuard();
|
|
141
|
+
}
|
|
142
|
+
var DATA_DIR = defaultDataDir();
|
|
143
|
+
function dataDir() {
|
|
144
|
+
return DATA_DIR;
|
|
145
|
+
}
|
|
146
|
+
function configPath() {
|
|
147
|
+
return path.join(DATA_DIR, "config.toml");
|
|
148
|
+
}
|
|
149
|
+
var SYMBOL_BODY_CHAR_CAP = 128 * 1024;
|
|
150
|
+
|
|
151
|
+
// src/hook_ipc.ts
|
|
152
|
+
var PROTOCOL_VERSION = 1;
|
|
153
|
+
var SERVER_SLOTS = 3;
|
|
154
|
+
var MAX_FRAME_BYTES = 64 * 1024 * 1024;
|
|
155
|
+
var KEY_BYTES = 32;
|
|
156
|
+
function bundleDir() {
|
|
157
|
+
const dir = path2.dirname((0, import_node_url.fileURLToPath)(__tgModuleUrl));
|
|
158
|
+
try {
|
|
159
|
+
return fs.realpathSync.native(dir);
|
|
160
|
+
} catch {
|
|
161
|
+
return dir;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function endpointId(dir) {
|
|
165
|
+
const fold = (p) => process.platform === "win32" ? p.toLowerCase() : p;
|
|
166
|
+
return crypto.createHash("sha256").update(`${fold(dir)}\0${fold(bundleDir())}`).digest("hex").slice(0, 16);
|
|
167
|
+
}
|
|
168
|
+
function endpointFor(slot, dir = dataDir()) {
|
|
169
|
+
const id = `${endpointId(dir)}-${slot}`;
|
|
170
|
+
if (process.platform === "win32") return String.raw`\\.\pipe\token-goat-hooks-` + id;
|
|
171
|
+
const inData = path2.join(dir, `hooks-${id}.sock`);
|
|
172
|
+
if (Buffer.byteLength(inData) < 100) return inData;
|
|
173
|
+
const own = privateTempDir();
|
|
174
|
+
return own === void 0 ? inData : path2.join(own, `${id}.sock`);
|
|
175
|
+
}
|
|
176
|
+
function privateTempDir() {
|
|
177
|
+
const uid = process.getuid?.();
|
|
178
|
+
if (uid === void 0) return void 0;
|
|
179
|
+
const own = path2.join(os2.tmpdir(), `token-goat-${uid}`);
|
|
180
|
+
try {
|
|
181
|
+
fs.mkdirSync(own, { mode: 448 });
|
|
182
|
+
} catch {
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
const st = fs.lstatSync(own);
|
|
186
|
+
return st.isDirectory() && st.uid === uid && (st.mode & 63) === 0 ? own : void 0;
|
|
187
|
+
} catch {
|
|
188
|
+
return void 0;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function serverKeyPath(dir = dataDir()) {
|
|
192
|
+
return path2.join(dir, "hook-server.key");
|
|
193
|
+
}
|
|
194
|
+
function keyIsPrivate(st) {
|
|
195
|
+
if (process.platform === "win32") return true;
|
|
196
|
+
return (st.mode & 63) === 0 && (process.getuid === void 0 || st.uid === process.getuid());
|
|
197
|
+
}
|
|
198
|
+
function readServerKey(dir = dataDir()) {
|
|
199
|
+
try {
|
|
200
|
+
const p = serverKeyPath(dir);
|
|
201
|
+
if (!keyIsPrivate(fs.statSync(p))) return void 0;
|
|
202
|
+
const key = fs.readFileSync(p);
|
|
203
|
+
return key.length === KEY_BYTES ? key : void 0;
|
|
204
|
+
} catch {
|
|
205
|
+
return void 0;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function nonce() {
|
|
209
|
+
return crypto.randomBytes(16).toString("hex");
|
|
210
|
+
}
|
|
211
|
+
function mac(key, ...parts) {
|
|
212
|
+
const h = crypto.createHmac("sha256", key);
|
|
213
|
+
for (const part of parts) h.update(`${Buffer.byteLength(part)}:`).update(part);
|
|
214
|
+
return h.digest("hex");
|
|
215
|
+
}
|
|
216
|
+
function macMatches(expected, actual) {
|
|
217
|
+
if (typeof actual !== "string" || actual.length !== expected.length) return false;
|
|
218
|
+
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(actual));
|
|
219
|
+
}
|
|
220
|
+
function writeFrame(socket, message) {
|
|
221
|
+
socket.write(encodeFrame(message));
|
|
222
|
+
}
|
|
223
|
+
function encodeFrame(message) {
|
|
224
|
+
const body = Buffer.from(JSON.stringify(message), "utf8");
|
|
225
|
+
const header = Buffer.alloc(4);
|
|
226
|
+
header.writeUInt32BE(body.length, 0);
|
|
227
|
+
return Buffer.concat([header, body]);
|
|
228
|
+
}
|
|
229
|
+
function frameFits(frame) {
|
|
230
|
+
return frame.length - 4 <= MAX_FRAME_BYTES;
|
|
231
|
+
}
|
|
232
|
+
function readFrames(socket, onFrame, onError) {
|
|
233
|
+
let buffered = Buffer.alloc(0);
|
|
234
|
+
socket.on("data", (chunk) => {
|
|
235
|
+
buffered = buffered.length === 0 ? chunk : Buffer.concat([buffered, chunk]);
|
|
236
|
+
while (buffered.length >= 4) {
|
|
237
|
+
const len = buffered.readUInt32BE(0);
|
|
238
|
+
if (len > MAX_FRAME_BYTES) {
|
|
239
|
+
onError(new Error(`frame of ${len} bytes exceeds ${MAX_FRAME_BYTES}`));
|
|
240
|
+
socket.destroy();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (buffered.length < 4 + len) return;
|
|
244
|
+
const body = buffered.subarray(4, 4 + len);
|
|
245
|
+
buffered = buffered.subarray(4 + len);
|
|
246
|
+
let message;
|
|
247
|
+
try {
|
|
248
|
+
message = JSON.parse(body.toString("utf8"));
|
|
249
|
+
} catch (e) {
|
|
250
|
+
onError(e);
|
|
251
|
+
socket.destroy();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (message === null || typeof message !== "object" || Array.isArray(message)) {
|
|
255
|
+
onError(new Error("frame is not a JSON object"));
|
|
256
|
+
socket.destroy();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
onFrame(message);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function envSnapshot() {
|
|
264
|
+
const env = {};
|
|
265
|
+
for (const [k, v] of Object.entries(process.env)) if (v !== void 0) env[k] = v;
|
|
266
|
+
return env;
|
|
267
|
+
}
|
|
268
|
+
function markerPath(name, dir = dataDir()) {
|
|
269
|
+
return path2.join(dir, `hook-server.${name}`);
|
|
270
|
+
}
|
|
271
|
+
function markerAgeMs(name, dir = dataDir()) {
|
|
272
|
+
try {
|
|
273
|
+
return Date.now() - fs.statSync(markerPath(name, dir)).mtimeMs;
|
|
274
|
+
} catch {
|
|
275
|
+
return Infinity;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function touchMarker(name, content = String(process.pid), dir = dataDir()) {
|
|
279
|
+
try {
|
|
280
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
281
|
+
fs.writeFileSync(markerPath(name, dir), content);
|
|
282
|
+
} catch {
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function configStamp() {
|
|
286
|
+
try {
|
|
287
|
+
return String(fs.statSync(configPath()).mtimeMs);
|
|
288
|
+
} catch {
|
|
289
|
+
return "absent";
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function readMarker(name, dir = dataDir()) {
|
|
293
|
+
try {
|
|
294
|
+
return fs.readFileSync(markerPath(name, dir), "utf8");
|
|
295
|
+
} catch {
|
|
296
|
+
return void 0;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function launcherPath() {
|
|
300
|
+
return path2.join(bundleDir(), "token-goat.mjs");
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// src/hook_client.ts
|
|
304
|
+
var HANDSHAKE_TIMEOUT_MS = 150;
|
|
305
|
+
var FIND_BUDGET_MS = 300;
|
|
306
|
+
var RESPONSE_TIMEOUT_MS = 12e4;
|
|
307
|
+
var CONTROL_WAIT_MS = 1e4;
|
|
308
|
+
var SPAWN_RETRY_MS = 3e4;
|
|
309
|
+
var DISABLED_MARKER_TTL_MS = 10 * 6e4;
|
|
310
|
+
function attempt(slot, key, request, handshakeMs, dir) {
|
|
311
|
+
return new Promise((resolve) => {
|
|
312
|
+
const socket = net.connect(endpointFor(slot, dir));
|
|
313
|
+
const nc = nonce();
|
|
314
|
+
let dispatched = false;
|
|
315
|
+
let settled = false;
|
|
316
|
+
const finish = (outcome) => {
|
|
317
|
+
if (settled) return;
|
|
318
|
+
settled = true;
|
|
319
|
+
clearTimeout(timer);
|
|
320
|
+
socket.destroy();
|
|
321
|
+
resolve(outcome);
|
|
322
|
+
};
|
|
323
|
+
let timer = setTimeout(() => finish({ kind: "busy" }), handshakeMs);
|
|
324
|
+
socket.on("error", (e) => {
|
|
325
|
+
if (dispatched) finish({ kind: "lost" });
|
|
326
|
+
else finish({ kind: e.code === "ENOENT" || e.code === "ECONNREFUSED" ? "absent" : "refused" });
|
|
327
|
+
});
|
|
328
|
+
socket.on("close", () => finish({ kind: dispatched ? "lost" : "refused" }));
|
|
329
|
+
const control = request.kind === "status" || request.kind === "stop";
|
|
330
|
+
socket.on("connect", () => writeFrame(socket, { t: "hello", v: PROTOCOL_VERSION, nc, ...control ? { ctl: true } : {} }));
|
|
331
|
+
let ns = "";
|
|
332
|
+
readFrames(
|
|
333
|
+
socket,
|
|
334
|
+
(msg) => {
|
|
335
|
+
if (msg["t"] === "busy") return finish({ kind: "busy" });
|
|
336
|
+
if (msg["t"] === "stale") return finish({ kind: "stale" });
|
|
337
|
+
if (msg["t"] === "challenge" && !dispatched) {
|
|
338
|
+
ns = typeof msg["ns"] === "string" ? msg["ns"] : "";
|
|
339
|
+
if (ns === "" || msg["v"] !== PROTOCOL_VERSION || !macMatches(mac(key, "S", nc, ns), msg["mac"])) return finish({ kind: "refused" });
|
|
340
|
+
const body = JSON.stringify(request);
|
|
341
|
+
const frame = encodeFrame({ t: "req", mac: mac(key, "C", nc, ns, body), body });
|
|
342
|
+
if (!frameFits(frame)) return finish({ kind: "oversize" });
|
|
343
|
+
dispatched = true;
|
|
344
|
+
clearTimeout(timer);
|
|
345
|
+
timer = setTimeout(() => finish({ kind: "lost" }), RESPONSE_TIMEOUT_MS);
|
|
346
|
+
socket.write(frame);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (msg["t"] === "res" && dispatched) {
|
|
350
|
+
const body = msg["body"];
|
|
351
|
+
if (typeof body !== "string" || !macMatches(mac(key, "R", nc, ns, body), msg["mac"])) return finish({ kind: "lost" });
|
|
352
|
+
try {
|
|
353
|
+
return finish({ kind: "served", reply: JSON.parse(body) });
|
|
354
|
+
} catch {
|
|
355
|
+
return finish({ kind: "lost" });
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
finish({ kind: dispatched ? "lost" : "refused" });
|
|
359
|
+
},
|
|
360
|
+
() => finish({ kind: dispatched ? "lost" : "refused" })
|
|
361
|
+
);
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
function startServer(slot) {
|
|
365
|
+
const launcher = launcherPath();
|
|
366
|
+
const disabled = markerAgeMs("disabled") < DISABLED_MARKER_TTL_MS && readMarker("disabled") === configStamp();
|
|
367
|
+
if (disabled || markerAgeMs(`spawn-${slot}`) < SPAWN_RETRY_MS || !fs2.existsSync(launcher)) return;
|
|
368
|
+
touchMarker(`spawn-${slot}`);
|
|
369
|
+
try {
|
|
370
|
+
(0, import_node_child_process.spawn)(process.execPath, [launcher, "hook-server", "run", "--slot", String(slot)], { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
371
|
+
} catch {
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function serverEnabled() {
|
|
375
|
+
return envBool("TOKEN_GOAT_HOOK_SERVER", true);
|
|
376
|
+
}
|
|
377
|
+
async function callServer(request, opts = {}) {
|
|
378
|
+
if (!serverEnabled()) return void 0;
|
|
379
|
+
const autostart = opts.autostart !== false;
|
|
380
|
+
const key = readServerKey();
|
|
381
|
+
if (key === void 0) {
|
|
382
|
+
if (autostart) startServer(0);
|
|
383
|
+
return void 0;
|
|
384
|
+
}
|
|
385
|
+
const deadline = Date.now() + FIND_BUDGET_MS;
|
|
386
|
+
for (let slot = 0; slot < SERVER_SLOTS && Date.now() < deadline; slot++) {
|
|
387
|
+
const outcome = await attempt(slot, key, request, opts.handshakeMs ?? HANDSHAKE_TIMEOUT_MS);
|
|
388
|
+
if (outcome.kind === "served") return outcome.reply;
|
|
389
|
+
if (outcome.kind === "lost") return "lost";
|
|
390
|
+
if (outcome.kind === "absent") {
|
|
391
|
+
if (autostart) startServer(slot);
|
|
392
|
+
return void 0;
|
|
393
|
+
}
|
|
394
|
+
if (outcome.kind === "stale" || outcome.kind === "oversize") return void 0;
|
|
395
|
+
}
|
|
396
|
+
return void 0;
|
|
397
|
+
}
|
|
398
|
+
async function relayViaServer(event, input, harnessWaitMs) {
|
|
399
|
+
try {
|
|
400
|
+
const request = {
|
|
401
|
+
kind: "hook",
|
|
402
|
+
event,
|
|
403
|
+
input: typeof input === "string" ? input : JSON.stringify(input),
|
|
404
|
+
elapsedMs: performance.now(),
|
|
405
|
+
env: envSnapshot(),
|
|
406
|
+
cwd: process.cwd()
|
|
407
|
+
};
|
|
408
|
+
if (harnessWaitMs !== void 0) request.harnessWaitMs = harnessWaitMs;
|
|
409
|
+
const reply = await callServer(request);
|
|
410
|
+
if (reply === void 0) return void 0;
|
|
411
|
+
if (reply === "lost" || !reply.ok || !("stdout" in reply)) return "{}";
|
|
412
|
+
return reply.stdout;
|
|
413
|
+
} catch {
|
|
414
|
+
return void 0;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
var WARM_CLI_COMMANDS = /* @__PURE__ */ new Set([
|
|
418
|
+
"answer",
|
|
419
|
+
"brief",
|
|
420
|
+
"changed",
|
|
421
|
+
"exports",
|
|
422
|
+
"imports",
|
|
423
|
+
"map",
|
|
424
|
+
"outline",
|
|
425
|
+
"read",
|
|
426
|
+
"refs",
|
|
427
|
+
"section",
|
|
428
|
+
"semantic",
|
|
429
|
+
"skeleton",
|
|
430
|
+
"symbol"
|
|
431
|
+
]);
|
|
432
|
+
function warmCliEligible(argv) {
|
|
433
|
+
const command = argv[2];
|
|
434
|
+
if (command === void 0 || !WARM_CLI_COMMANDS.has(command) || process.stdout.isTTY === true) return false;
|
|
435
|
+
return !argv.slice(3).some((a) => a === "-" || a === "--stdin" || a === "--help" || a === "-h");
|
|
436
|
+
}
|
|
437
|
+
async function runCliViaServer(argv) {
|
|
438
|
+
if (!warmCliEligible(argv)) return false;
|
|
439
|
+
try {
|
|
440
|
+
const reply = await callServer({ kind: "cli", argv: argv.slice(2), env: envSnapshot(), cwd: process.cwd() });
|
|
441
|
+
if (reply === void 0 || reply === "lost" || !reply.ok || !("stdout" in reply)) return false;
|
|
442
|
+
if (reply.stdout !== "") process.stdout.write(reply.stdout);
|
|
443
|
+
if (reply.stderr !== void 0 && reply.stderr !== "") process.stderr.write(reply.stderr);
|
|
444
|
+
process.exitCode = reply.status ?? 0;
|
|
445
|
+
return true;
|
|
446
|
+
} catch {
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
async function serverStatuses(dir) {
|
|
451
|
+
return (await queryServers("status", dir)).flatMap(({ reply }) => reply.ok && "info" in reply ? [reply.info] : []);
|
|
452
|
+
}
|
|
453
|
+
async function queryServers(kind, dir) {
|
|
454
|
+
const key = readServerKey(dir);
|
|
455
|
+
if (key === void 0) return [];
|
|
456
|
+
const deadline = Date.now() + CONTROL_WAIT_MS;
|
|
457
|
+
const answered = [];
|
|
458
|
+
for (let slot = 0; slot < SERVER_SLOTS; slot++) {
|
|
459
|
+
let outcome = await attempt(slot, key, { kind }, 2e3, dir);
|
|
460
|
+
while (outcome.kind === "busy" && Date.now() < deadline) outcome = await attempt(slot, key, { kind }, 2e3, dir);
|
|
461
|
+
if (outcome.kind === "served") answered.push({ slot, reply: outcome.reply });
|
|
462
|
+
}
|
|
463
|
+
return answered;
|
|
464
|
+
}
|
|
465
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
466
|
+
0 && (module.exports = {
|
|
467
|
+
WARM_CLI_COMMANDS,
|
|
468
|
+
callServer,
|
|
469
|
+
queryServers,
|
|
470
|
+
relayViaServer,
|
|
471
|
+
runCliViaServer,
|
|
472
|
+
serverEnabled,
|
|
473
|
+
serverStatuses,
|
|
474
|
+
warmCliEligible
|
|
475
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
WARM_CLI_COMMANDS,
|
|
5
|
+
callServer,
|
|
6
|
+
queryServers,
|
|
7
|
+
relayViaServer,
|
|
8
|
+
runCliViaServer,
|
|
9
|
+
serverEnabled,
|
|
10
|
+
serverStatuses,
|
|
11
|
+
warmCliEligible
|
|
12
|
+
} from "./token-goat-chunk-RQGGMPCR.mjs";
|
|
13
|
+
import "./token-goat-chunk-DPNLUJWB.mjs";
|
|
14
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
15
|
+
import "./token-goat-chunk-MELOKFDJ.mjs";
|
|
16
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
17
|
+
export {
|
|
18
|
+
WARM_CLI_COMMANDS,
|
|
19
|
+
callServer,
|
|
20
|
+
queryServers,
|
|
21
|
+
relayViaServer,
|
|
22
|
+
runCliViaServer,
|
|
23
|
+
serverEnabled,
|
|
24
|
+
serverStatuses,
|
|
25
|
+
warmCliEligible
|
|
26
|
+
};
|
package/dist/token-goat-hook.mjs
CHANGED
|
@@ -2,30 +2,40 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
relayInProcess
|
|
5
|
-
} from "./token-goat-chunk-
|
|
6
|
-
import "./token-goat-chunk-
|
|
7
|
-
import "./token-goat-chunk-
|
|
8
|
-
import "./token-goat-chunk-
|
|
9
|
-
import "./token-goat-chunk-
|
|
10
|
-
import "./token-goat-chunk-
|
|
11
|
-
import "./token-goat-chunk-
|
|
12
|
-
import "./token-goat-chunk-
|
|
13
|
-
import "./token-goat-chunk-
|
|
14
|
-
import "./token-goat-chunk-
|
|
15
|
-
import "./token-goat-chunk-
|
|
16
|
-
import "./token-goat-chunk-
|
|
5
|
+
} from "./token-goat-chunk-QO3LXVVR.mjs";
|
|
6
|
+
import "./token-goat-chunk-IVWI2OCK.mjs";
|
|
7
|
+
import "./token-goat-chunk-DNRPXHYH.mjs";
|
|
8
|
+
import "./token-goat-chunk-RTMVLHWX.mjs";
|
|
9
|
+
import "./token-goat-chunk-L7H3U27L.mjs";
|
|
10
|
+
import "./token-goat-chunk-RRNZMM3A.mjs";
|
|
11
|
+
import "./token-goat-chunk-E4ZOJIZK.mjs";
|
|
12
|
+
import "./token-goat-chunk-E5TK5DNO.mjs";
|
|
13
|
+
import "./token-goat-chunk-ZER6EAXZ.mjs";
|
|
14
|
+
import "./token-goat-chunk-44BM7DDQ.mjs";
|
|
15
|
+
import "./token-goat-chunk-EUSDXRXU.mjs";
|
|
16
|
+
import "./token-goat-chunk-G7IWXCFF.mjs";
|
|
17
|
+
import "./token-goat-chunk-H5J3C56Q.mjs";
|
|
18
|
+
import "./token-goat-chunk-TDUT2CL6.mjs";
|
|
19
|
+
import "./token-goat-chunk-ONXH6NZ5.mjs";
|
|
20
|
+
import "./token-goat-chunk-O6I2XU4P.mjs";
|
|
21
|
+
import "./token-goat-chunk-D4ETHJD6.mjs";
|
|
22
|
+
import "./token-goat-chunk-52NSDWYY.mjs";
|
|
23
|
+
import "./token-goat-chunk-2WOUYWLM.mjs";
|
|
24
|
+
import "./token-goat-chunk-CIQ2FTY3.mjs";
|
|
17
25
|
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
18
|
-
import "./token-goat-chunk-
|
|
19
|
-
import "./token-goat-chunk-
|
|
20
|
-
import "./token-goat-chunk-
|
|
21
|
-
import "./token-goat-chunk-
|
|
22
|
-
import "./token-goat-chunk-
|
|
23
|
-
import "./token-goat-chunk-
|
|
24
|
-
import "./token-goat-chunk-
|
|
26
|
+
import "./token-goat-chunk-VMFWNHGR.mjs";
|
|
27
|
+
import "./token-goat-chunk-435UQTKD.mjs";
|
|
28
|
+
import "./token-goat-chunk-7CPMDFGB.mjs";
|
|
29
|
+
import "./token-goat-chunk-TGOXNAHW.mjs";
|
|
30
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
31
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
32
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
33
|
+
import "./token-goat-chunk-XYWPOSCN.mjs";
|
|
34
|
+
import "./token-goat-chunk-TCQANXYC.mjs";
|
|
25
35
|
import "./token-goat-chunk-NMTKNYGF.mjs";
|
|
36
|
+
import "./token-goat-chunk-MELOKFDJ.mjs";
|
|
26
37
|
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
27
|
-
import "./token-goat-chunk-
|
|
28
|
-
import "./token-goat-chunk-RRNZMM3A.mjs";
|
|
38
|
+
import "./token-goat-chunk-JTKCQMQA.mjs";
|
|
29
39
|
import {
|
|
30
40
|
init_define_import_meta_env
|
|
31
41
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
package/dist/token-goat.core.mjs
CHANGED
|
@@ -1,47 +1,15 @@
|
|
|
1
1
|
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
} from "./token-goat-chunk-
|
|
6
|
-
import "./token-goat-chunk-
|
|
7
|
-
import "./token-goat-chunk-
|
|
8
|
-
import "./token-goat-chunk-L45IWWMC.mjs";
|
|
9
|
-
import "./token-goat-chunk-RH27ZSPF.mjs";
|
|
10
|
-
import "./token-goat-chunk-5M3NRJD2.mjs";
|
|
11
|
-
import "./token-goat-chunk-DA43OE7L.mjs";
|
|
12
|
-
import "./token-goat-chunk-7Y6GWTII.mjs";
|
|
13
|
-
import "./token-goat-chunk-62IHOU6L.mjs";
|
|
14
|
-
import "./token-goat-chunk-MDV5VWF4.mjs";
|
|
15
|
-
import "./token-goat-chunk-MBDJR6HU.mjs";
|
|
16
|
-
import "./token-goat-chunk-4GEDH2WU.mjs";
|
|
17
|
-
import "./token-goat-chunk-VVROQBQJ.mjs";
|
|
18
|
-
import "./token-goat-chunk-M6CVNHTW.mjs";
|
|
19
|
-
import "./token-goat-chunk-G6EYO5CD.mjs";
|
|
20
|
-
import "./token-goat-chunk-43JFN26X.mjs";
|
|
21
|
-
import "./token-goat-chunk-D2X7XN5M.mjs";
|
|
22
|
-
import "./token-goat-chunk-LKSXAMJB.mjs";
|
|
23
|
-
import "./token-goat-chunk-WNBSCSAI.mjs";
|
|
24
|
-
import "./token-goat-chunk-BAWKGODL.mjs";
|
|
25
|
-
import "./token-goat-chunk-STYRLQIW.mjs";
|
|
26
|
-
import "./token-goat-chunk-L43RKNHA.mjs";
|
|
27
|
-
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
28
|
-
import "./token-goat-chunk-RIB6XY2V.mjs";
|
|
29
|
-
import "./token-goat-chunk-XTQAOTSO.mjs";
|
|
30
|
-
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
31
|
-
import "./token-goat-chunk-LHUP4DXZ.mjs";
|
|
32
|
-
import "./token-goat-chunk-7EPYB34H.mjs";
|
|
33
|
-
import "./token-goat-chunk-IKZLSRII.mjs";
|
|
34
|
-
import "./token-goat-chunk-7SXPJOSZ.mjs";
|
|
35
|
-
import "./token-goat-chunk-LRIZ7K3F.mjs";
|
|
36
|
-
import "./token-goat-chunk-EEIDFMEM.mjs";
|
|
37
|
-
import "./token-goat-chunk-OSUFN2FV.mjs";
|
|
4
|
+
runCliViaServer
|
|
5
|
+
} from "./token-goat-chunk-RQGGMPCR.mjs";
|
|
6
|
+
import "./token-goat-chunk-DPNLUJWB.mjs";
|
|
7
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
38
8
|
import {
|
|
39
9
|
installEpipeGuard
|
|
40
|
-
} from "./token-goat-chunk-
|
|
10
|
+
} from "./token-goat-chunk-TCQANXYC.mjs";
|
|
41
11
|
import "./token-goat-chunk-NMTKNYGF.mjs";
|
|
42
|
-
import "./token-goat-chunk-
|
|
43
|
-
import "./token-goat-chunk-GMOUBOX4.mjs";
|
|
44
|
-
import "./token-goat-chunk-RRNZMM3A.mjs";
|
|
12
|
+
import "./token-goat-chunk-MELOKFDJ.mjs";
|
|
45
13
|
import {
|
|
46
14
|
init_define_import_meta_env
|
|
47
15
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -49,4 +17,6 @@ import {
|
|
|
49
17
|
// src/main.ts
|
|
50
18
|
init_define_import_meta_env();
|
|
51
19
|
installEpipeGuard();
|
|
52
|
-
void
|
|
20
|
+
void runCliViaServer(process.argv).then(async (served) => {
|
|
21
|
+
if (!served) await (await import("./token-goat-chunk-HUYUHODZ.mjs")).run();
|
|
22
|
+
});
|
|
@@ -80,7 +80,7 @@ flowchart TB
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
subgraph TGProcesses ["Token-Goat Runtime Containers"]
|
|
83
|
-
HookShim["🪝 Hook Shim<br/><small>[~/.claude/hooks/token-goat-shim.
|
|
83
|
+
HookShim["🪝 Hook Shim<br/><small>[~/.claude/hooks/token-goat-shim.cjs]</small><br/>In-process fast path / Subprocess launcher"]:::shim
|
|
84
84
|
HookRelay["⚡ Hook Relay & Normalizer<br/><small>[dist/token-goat-hook.mjs]</small><br/>Normalizes Codex/Gemini/Claude schemas"]:::process
|
|
85
85
|
CLIBinary["💻 CLI Tool & Command Suite<br/><small>[dist/token-goat.mjs]</small><br/>100+ surgical read, outline, pack commands"]:::process
|
|
86
86
|
MCPServer["🔌 MCP stdio Server<br/><small>[token-goat mcp-serve]</small><br/>18 tools: symbol, read, retrieve, section"]:::process
|
|
@@ -218,7 +218,7 @@ flowchart TB
|
|
|
218
218
|
sequenceDiagram
|
|
219
219
|
autonumber
|
|
220
220
|
participant Agent as AI Agent (Claude Code)
|
|
221
|
-
participant Shim as token-goat-shim.
|
|
221
|
+
participant Shim as token-goat-shim.cjs
|
|
222
222
|
participant Relay as relay.ts / hook_registry.ts
|
|
223
223
|
participant Filter as ToolFilter (tool_filters/)
|
|
224
224
|
participant Store as session_store.ts & disk_cache.ts
|