token-goat 2.8.3 → 2.8.6
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 +23 -17
- package/dist/{token-goat-chunk-6ODZ6PZK.mjs → token-goat-chunk-2JZ66BBE.mjs} +216 -72
- package/dist/{token-goat-chunk-PWVXXPCC.mjs → token-goat-chunk-DK4VLLYB.mjs} +563 -155
- package/dist/{token-goat-chunk-EFF2XCLB.mjs → token-goat-chunk-GUNYAGOZ.mjs} +175 -56
- package/dist/{token-goat-chunk-VAGPOZHO.mjs → token-goat-chunk-L2XHDICZ.mjs} +2 -2
- package/dist/{token-goat-chunk-DP3NNGGV.mjs → token-goat-chunk-LJEETTER.mjs} +5 -5
- package/dist/{token-goat-chunk-NKNCHJ4H.mjs → token-goat-chunk-MA5237JN.mjs} +327 -169
- package/dist/{token-goat-chunk-4OM2Q2SX.mjs → token-goat-chunk-SHN4UTL4.mjs} +5 -5
- package/dist/{token-goat-chunk-4HIMCBYK.mjs → token-goat-chunk-TELKICYU.mjs} +55 -6
- package/dist/{token-goat-chunk-222VPFP2.mjs → token-goat-chunk-U7M2LTGP.mjs} +1100 -269
- package/dist/{token-goat-chunk-TX4JFJTD.mjs → token-goat-chunk-XAWIELXH.mjs} +216 -105
- package/dist/{token-goat-chunk-C5IL6MJH.mjs → token-goat-chunk-ZIPBLIUZ.mjs} +6 -5
- package/dist/token-goat-hook.mjs +5 -5
- package/dist/token-goat.core.mjs +5 -5
- package/package.json +3 -1
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
expandGlobs,
|
|
8
8
|
leftoverIntegrations,
|
|
9
9
|
run
|
|
10
|
-
} from "./token-goat-chunk-
|
|
11
|
-
import "./token-goat-chunk-
|
|
12
|
-
import "./token-goat-chunk-
|
|
13
|
-
import "./token-goat-chunk-
|
|
14
|
-
import "./token-goat-chunk-
|
|
10
|
+
} from "./token-goat-chunk-U7M2LTGP.mjs";
|
|
11
|
+
import "./token-goat-chunk-XAWIELXH.mjs";
|
|
12
|
+
import "./token-goat-chunk-TELKICYU.mjs";
|
|
13
|
+
import "./token-goat-chunk-DK4VLLYB.mjs";
|
|
14
|
+
import "./token-goat-chunk-2JZ66BBE.mjs";
|
|
15
15
|
import "./token-goat-chunk-AO2QD2AG.mjs";
|
|
16
16
|
import "./token-goat-chunk-AEX54RUZ.mjs";
|
|
17
17
|
export {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
loadBlob,
|
|
9
9
|
sanitizeFtsQuery,
|
|
10
10
|
storeBlob
|
|
11
|
-
} from "./token-goat-chunk-
|
|
11
|
+
} from "./token-goat-chunk-DK4VLLYB.mjs";
|
|
12
12
|
import {
|
|
13
13
|
SYMBOL_BODY_CHAR_CAP,
|
|
14
14
|
extractErrorMessage,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
redactSecrets,
|
|
19
19
|
runGit,
|
|
20
20
|
shortFingerprint
|
|
21
|
-
} from "./token-goat-chunk-
|
|
21
|
+
} from "./token-goat-chunk-2JZ66BBE.mjs";
|
|
22
22
|
import {
|
|
23
23
|
registerReset
|
|
24
24
|
} from "./token-goat-chunk-AO2QD2AG.mjs";
|
|
@@ -151,8 +151,22 @@ var GROK_TOOL_NAME_MAP = {
|
|
|
151
151
|
write: "Write",
|
|
152
152
|
search_replace: "Edit",
|
|
153
153
|
run_terminal_command: "Bash",
|
|
154
|
+
// The grok 0.2.93 binary registers its shell tool as `tool.run_terminal_cmd` (tracing-id table in ~/.grok/bin/agent.exe) and its newer embedded hooks doc's PreToolUse example sends `"toolName": "run_terminal_cmd"`, while the older embedded doc revision and a 2026-07-09 live capture on the same version both show `run_terminal_command`. Which spelling arrives is profile/version dependent, so BOTH are mapped: an unmatched extra entry is a harmless no-op, a missing one silently kills every Bash hook (compression, wrap, hints) on that profile.
|
|
155
|
+
run_terminal_cmd: "Bash",
|
|
154
156
|
grep: "Grep",
|
|
155
|
-
list_dir: "Glob"
|
|
157
|
+
list_dir: "Glob",
|
|
158
|
+
// `glob` is a distinct registered grok tool (tool.glob in the 0.2.93 binary's tracing-id table), separate from list_dir; unmapped it arrived as lowercase 'glob' and matched no handler.
|
|
159
|
+
glob: "Glob",
|
|
160
|
+
// web_fetch/web_search were entirely absent from this map, so grok's URL fetches bypassed token-goat's WebFetch pipeline (URL-policy deny included) and its searches bypassed the WebSearch dedup/compression. Verified against the 0.2.93 binary: tool.web_fetch / tool.web_search registered ids, grok_build WebFetchInput's field described as "The URL to fetch content from" (i.e. `url`), grok_build WebSearchInput's fields query/citations/allowed_domains -- all matching the keys hooks_fetch.ts / hooks_websearch.ts already read, so a name map alone revives both.
|
|
161
|
+
web_fetch: "WebFetch",
|
|
162
|
+
web_search: "WebSearch",
|
|
163
|
+
// The Hashline prompt profile registers hashline_read/hashline_edit/hashline_grep (tool.hashline_* in the binary; grok's own hook alias table pairs them with Read/Edit/Grep). Their input key shapes were not individually verified: if one differs, the mapped handler degrades to the same no-op as an unmapped name, never a wrong rewrite. The *_concise twins are the GrokBuildConcise profile's registrations of the same three core tools.
|
|
164
|
+
hashline_read: "Read",
|
|
165
|
+
hashline_edit: "Edit",
|
|
166
|
+
hashline_grep: "Grep",
|
|
167
|
+
read_file_concise: "Read",
|
|
168
|
+
search_replace_concise: "Edit",
|
|
169
|
+
run_terminal_cmd_concise: "Bash"
|
|
156
170
|
};
|
|
157
171
|
var GROK_INPUT_KEY_MAP = {
|
|
158
172
|
Read: { target_file: "file_path" }
|
|
@@ -162,10 +176,28 @@ var KIMI_TOOL_NAME_MAP = {
|
|
|
162
176
|
ReadMediaFile: "Read"
|
|
163
177
|
};
|
|
164
178
|
var KIMI_INPUT_KEY_MAP = {
|
|
165
|
-
Read
|
|
179
|
+
// line_offset/n_lines are Kimi's Read paging arguments (ReadInputSchema in MoonshotAI/kimi-code packages/agent-core-v2/src/agent/tools/os/read/read.ts: `path`, `line_offset` "the line number to start reading from", `n_lines` "the number of lines to read"). Unmapped, every ranged Kimi read looked unbounded to hooks_read.ts's estimateRequestedSlice and was gated on the whole file's size -- a small slice of a big file could draw the large-file deny meant for full reads. line_offset's 1-indexed positive form matches Read's own offset semantics exactly; its negative tail-read form has no token-goat equivalent and is clamped to 1 by estimateRequestedSlice's `offset >= 1` guard, degrading to a window of the right SIZE (which is all the gate consumes). ReadMediaFile shares this map via its Read rename and carries only `path`, so the extra entries never touch it.
|
|
180
|
+
Read: { path: "file_path", line_offset: "offset", n_lines: "limit" },
|
|
166
181
|
Write: { path: "file_path" },
|
|
167
182
|
Edit: { path: "file_path" }
|
|
168
183
|
};
|
|
184
|
+
var QWEN_TOOL_NAME_MAP = {
|
|
185
|
+
read_file: "Read",
|
|
186
|
+
write_file: "Write",
|
|
187
|
+
edit: "Edit",
|
|
188
|
+
replace: "Edit",
|
|
189
|
+
notebook_edit: "NotebookEdit",
|
|
190
|
+
run_shell_command: "Bash",
|
|
191
|
+
grep_search: "Grep",
|
|
192
|
+
search_file_content: "Grep",
|
|
193
|
+
glob: "Glob",
|
|
194
|
+
web_fetch: "WebFetch",
|
|
195
|
+
web_search: "WebSearch",
|
|
196
|
+
list_directory: "Read"
|
|
197
|
+
};
|
|
198
|
+
var QWEN_INPUT_KEY_MAP = {
|
|
199
|
+
Read: { path: "file_path" }
|
|
200
|
+
};
|
|
169
201
|
function remapInputKeys(input, keyMap) {
|
|
170
202
|
const newInput = {};
|
|
171
203
|
for (const [k, v] of Object.entries(input)) {
|
|
@@ -209,6 +241,14 @@ function grokToCanonicalWire(obj) {
|
|
|
209
241
|
}
|
|
210
242
|
return wire;
|
|
211
243
|
}
|
|
244
|
+
function aliasLlmContentToOutput(result) {
|
|
245
|
+
const toolResponse = result["tool_response"];
|
|
246
|
+
if (toolResponse === null || typeof toolResponse !== "object" || Array.isArray(toolResponse)) return;
|
|
247
|
+
const responseRecord = toolResponse;
|
|
248
|
+
if (typeof responseRecord["llmContent"] === "string" && responseRecord["output"] === void 0) {
|
|
249
|
+
result["tool_response"] = { ...responseRecord, output: responseRecord["llmContent"] };
|
|
250
|
+
}
|
|
251
|
+
}
|
|
212
252
|
function normalizePayload(payload, harness = "claude") {
|
|
213
253
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
214
254
|
_LOG.warn("normalizePayload: payload is not a dict; received %s", typeof payload);
|
|
@@ -246,12 +286,19 @@ function normalizePayload(payload, harness = "claude") {
|
|
|
246
286
|
result2["_tg_harness"] = harness;
|
|
247
287
|
return result2;
|
|
248
288
|
}
|
|
289
|
+
if (harness === "qwen") {
|
|
290
|
+
const result2 = remapToolName(obj, toolName, QWEN_TOOL_NAME_MAP, QWEN_INPUT_KEY_MAP);
|
|
291
|
+
aliasLlmContentToOutput(result2);
|
|
292
|
+
result2["_tg_harness"] = harness;
|
|
293
|
+
return result2;
|
|
294
|
+
}
|
|
249
295
|
if (harness === "gemini") {
|
|
250
296
|
const result2 = remapToolName(obj, toolName, GEMINI_TOOL_NAME_MAP, GEMINI_INPUT_KEY_MAP);
|
|
251
297
|
if ("functionCallId" in result2 && !("toolUseId" in result2)) {
|
|
252
298
|
result2["toolUseId"] = result2["functionCallId"];
|
|
253
299
|
delete result2["functionCallId"];
|
|
254
300
|
}
|
|
301
|
+
aliasLlmContentToOutput(result2);
|
|
255
302
|
result2["_tg_harness"] = harness;
|
|
256
303
|
return result2;
|
|
257
304
|
}
|
|
@@ -262,6 +309,7 @@ function normalizePayload(payload, harness = "claude") {
|
|
|
262
309
|
|
|
263
310
|
// src/recall_index.ts
|
|
264
311
|
var VALID_TYPES = ["bash", "web", "mcp"];
|
|
312
|
+
var RECALL_DEFAULT_LIMIT = 10;
|
|
265
313
|
function isRecallCacheType(value) {
|
|
266
314
|
return VALID_TYPES.includes(value);
|
|
267
315
|
}
|
|
@@ -367,7 +415,7 @@ function likeSearch(query, type, limit) {
|
|
|
367
415
|
return mapRowsToHits(rows, trimmed);
|
|
368
416
|
}
|
|
369
417
|
function listRecentRecall(opts = {}) {
|
|
370
|
-
const limit = opts.limit ??
|
|
418
|
+
const limit = opts.limit ?? RECALL_DEFAULT_LIMIT;
|
|
371
419
|
const columns = `SELECT entry_id AS id, cache_type AS cacheType, label, content, stored_at AS storedAt FROM cache_recall`;
|
|
372
420
|
try {
|
|
373
421
|
const db = getDb(globalDbPath());
|
|
@@ -378,7 +426,7 @@ function listRecentRecall(opts = {}) {
|
|
|
378
426
|
}
|
|
379
427
|
}
|
|
380
428
|
function searchRecall(query, opts = {}) {
|
|
381
|
-
const limit = opts.limit ??
|
|
429
|
+
const limit = opts.limit ?? RECALL_DEFAULT_LIMIT;
|
|
382
430
|
if (query.trim() === "") return [];
|
|
383
431
|
try {
|
|
384
432
|
if (hasFtsTable()) {
|
|
@@ -1180,6 +1228,7 @@ export {
|
|
|
1180
1228
|
readCopilotMcpTools,
|
|
1181
1229
|
GEMINI_TOOL_NAME_MAP,
|
|
1182
1230
|
normalizePayload,
|
|
1231
|
+
RECALL_DEFAULT_LIMIT,
|
|
1183
1232
|
isRecallCacheType,
|
|
1184
1233
|
indexRecallEntry,
|
|
1185
1234
|
listRecentRecall,
|