token-goat 2.8.2 → 2.8.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.
@@ -7,11 +7,11 @@ import {
7
7
  expandGlobs,
8
8
  leftoverIntegrations,
9
9
  run
10
- } from "./token-goat-chunk-2MWF3OGR.mjs";
11
- import "./token-goat-chunk-LILS6TIU.mjs";
12
- import "./token-goat-chunk-5MLXFSRI.mjs";
13
- import "./token-goat-chunk-AM23GDIS.mjs";
14
- import "./token-goat-chunk-IVCTQPZD.mjs";
10
+ } from "./token-goat-chunk-U4UI5F3S.mjs";
11
+ import "./token-goat-chunk-RE7S7H26.mjs";
12
+ import "./token-goat-chunk-IZRXU64B.mjs";
13
+ import "./token-goat-chunk-4OTIB7SB.mjs";
14
+ import "./token-goat-chunk-E76UNTVK.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-AM23GDIS.mjs";
11
+ } from "./token-goat-chunk-4OTIB7SB.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-IVCTQPZD.mjs";
21
+ } from "./token-goat-chunk-E76UNTVK.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: { path: "file_path" },
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
  }
@@ -4,14 +4,14 @@ import {
4
4
  buildEvent,
5
5
  relay,
6
6
  relayInProcess
7
- } from "./token-goat-chunk-KBVN4ELV.mjs";
7
+ } from "./token-goat-chunk-ZQ3PUOP3.mjs";
8
8
  import {
9
9
  MAX_STDIN_BYTES,
10
10
  readStdinJson
11
- } from "./token-goat-chunk-5MLXFSRI.mjs";
12
- import "./token-goat-chunk-AM23GDIS.mjs";
13
- import "./token-goat-chunk-TF5NT3H5.mjs";
14
- import "./token-goat-chunk-IVCTQPZD.mjs";
11
+ } from "./token-goat-chunk-IZRXU64B.mjs";
12
+ import "./token-goat-chunk-4OTIB7SB.mjs";
13
+ import "./token-goat-chunk-CZALRRGN.mjs";
14
+ import "./token-goat-chunk-E76UNTVK.mjs";
15
15
  import "./token-goat-chunk-AO2QD2AG.mjs";
16
16
  import "./token-goat-chunk-AEX54RUZ.mjs";
17
17
  export {
@@ -25,7 +25,7 @@ import {
25
25
  runSkeleton,
26
26
  runSymbol,
27
27
  withPinnedReads
28
- } from "./token-goat-chunk-LILS6TIU.mjs";
28
+ } from "./token-goat-chunk-RE7S7H26.mjs";
29
29
  import {
30
30
  buildProjectMap,
31
31
  embeddingsDepsAvailable,
@@ -34,7 +34,7 @@ import {
34
34
  getProjectIndexCounts,
35
35
  isWorkerRunning,
36
36
  mapLookupBytesSaved
37
- } from "./token-goat-chunk-AM23GDIS.mjs";
37
+ } from "./token-goat-chunk-4OTIB7SB.mjs";
38
38
  import {
39
39
  VERSION,
40
40
  dataDir,
@@ -44,8 +44,9 @@ import {
44
44
  loadConfig,
45
45
  normalizePath,
46
46
  recordStat,
47
- resolveProjectRoot
48
- } from "./token-goat-chunk-IVCTQPZD.mjs";
47
+ resolveProjectRoot,
48
+ savedTokensFromBytes
49
+ } from "./token-goat-chunk-E76UNTVK.mjs";
49
50
  import "./token-goat-chunk-AO2QD2AG.mjs";
50
51
  import "./token-goat-chunk-AEX54RUZ.mjs";
51
52
 
@@ -533,7 +534,7 @@ async function createMcpServer() {
533
534
  const map = buildProjectMap(resolveToolRoot(projectRoot), { compact: compact === true });
534
535
  const text = formatProjectMap(map, map.compact);
535
536
  const bytesSaved = mapLookupBytesSaved(map, text);
536
- recordStat("map_lookup", bytesSaved, Math.round(bytesSaved / 4));
537
+ recordStat("map_lookup", bytesSaved, savedTokensFromBytes(bytesSaved));
537
538
  return toCallToolResult({ text, code: 0 });
538
539
  }
539
540
  );
@@ -10,11 +10,11 @@ import {
10
10
  selectFilter,
11
11
  shlexSplit,
12
12
  wrappedShell
13
- } from "./token-goat-chunk-TF5NT3H5.mjs";
13
+ } from "./token-goat-chunk-CZALRRGN.mjs";
14
14
  import {
15
15
  loadConfig,
16
16
  recordStat
17
- } from "./token-goat-chunk-IVCTQPZD.mjs";
17
+ } from "./token-goat-chunk-E76UNTVK.mjs";
18
18
  import "./token-goat-chunk-AO2QD2AG.mjs";
19
19
  import "./token-goat-chunk-AEX54RUZ.mjs";
20
20