Skip to content

Commit 9caf473

Browse files
Gustav-SimonssonTheGreatAxios
authored andcommitted
refactor(agent): compress verbose comments in the tool classification module
1 parent cd7da73 commit 9caf473

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

‎src/agent/tool-classification.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
SEARCH_QUERY_TOOLS,
66
} from "./tool-classification.js";
77

8-
// Pins membership so a future edit to these sets or their base READ_TOOLS
9-
// fails CI instead of silently drifting call sites out of sync.
8+
// Pins membership so edits to these sets or READ_TOOLS fail CI instead of
9+
// drifting call sites out of sync.
1010
describe("AUTO_ALLOW_READ_TOOLS", () => {
1111
test("gates auto-allow with exactly this membership", () => {
1212
expect([...AUTO_ALLOW_READ_TOOLS].sort()).toEqual(

‎src/agent/tool-classification.ts‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
/**
22
* Shared tool-name classification constants. One name (`READ_TOOLS`) used to
33
* mean different memberships in four places, one of them security-relevant,
4-
* so the concepts are now separate sets derived from one base:
5-
* - the director read surface (tool-sets.ts READ_TOOLS): everything a
6-
* read-only leaf may call, including run_shell and the web tools;
7-
* - the auto-allow gate: never needs an approval prompt — a strict subset
8-
* (shell/web keep their own narrower rules) plus manage_tasks;
9-
* - compaction's re-read dedup and thrash's read tracking: both key off
10-
* read_file's path-keyed result, unified here.
11-
* Sets stay separate where the concepts differ, so a future difference reads
12-
* as intentional instead of drift.
4+
* so the concepts are now separate sets derived from one base: the director
5+
* read surface (tool-sets.ts READ_TOOLS), the auto-allow gate, and the
6+
* path-keyed / query-keyed sets behind compaction's dedup and thrash's
7+
* read tracking. Sets stay separate where the concepts differ, so a future
8+
* difference reads as intentional instead of drift.
139
*/
1410

1511
import { READ_TOOLS as DIRECTOR_READ_TOOLS } from "./directors/tool-sets.js";
1612

1713
/**
18-
* The one read tool whose result is keyed by path: a newer read supersedes
19-
* an older one for the same path. Shared by compaction's re-read dedup and
20-
* thrash's read-count bookkeeping.
14+
* The read tool whose result is keyed by path: a newer read supersedes an
15+
* older one for the same path. Shared by compaction's re-read dedup and
16+
* thrash's read tracking.
2117
*/
2218
export const PATH_KEYED_READ_TOOLS: ReadonlySet<string> = new Set([
2319
"read_file",
2420
]);
2521

2622
/**
2723
* grep / search_files: pattern-keyed query tools — a repeated identical call
28-
* reflects current workspace state, not stale history. Base for compaction
24+
* reflects the current workspace, not stale history. Base for compaction
2925
* and thrash; each adds/omits list_dir for its own reason.
3026
*/
3127
export const SEARCH_QUERY_TOOLS: ReadonlySet<string> = new Set([

0 commit comments

Comments
 (0)