codetree-claude 1.4.7 → 1.5.1
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 +144 -86
- package/dist/cli.js +69 -83
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +126 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -1
- package/dist/diff.d.ts +37 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +181 -0
- package/dist/diff.js.map +1 -0
- package/dist/doctor.d.ts +5 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +139 -0
- package/dist/doctor.js.map +1 -0
- package/dist/hook/post-compact.js +1 -23
- package/dist/hook/post-compact.js.map +1 -1
- package/dist/hook/post-tool-use.js +15 -27
- package/dist/hook/post-tool-use.js.map +1 -1
- package/dist/hook/pre-compact.js +1 -22
- package/dist/hook/pre-compact.js.map +1 -1
- package/dist/hook/pre-tool-use.bundled.js +49 -69
- package/dist/hook/pre-tool-use.js +23 -80
- package/dist/hook/pre-tool-use.js.map +1 -1
- package/dist/hook/session-start.js +19 -23
- package/dist/hook/session-start.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/indexer/extractor-registry.d.ts.map +1 -1
- package/dist/indexer/extractor-registry.js +6 -0
- package/dist/indexer/extractor-registry.js.map +1 -1
- package/dist/indexer/extractors/csharp.d.ts +12 -0
- package/dist/indexer/extractors/csharp.d.ts.map +1 -0
- package/dist/indexer/extractors/csharp.js +165 -0
- package/dist/indexer/extractors/csharp.js.map +1 -0
- package/dist/indexer/extractors/go.js +44 -1
- package/dist/indexer/extractors/go.js.map +1 -1
- package/dist/indexer/extractors/java.d.ts.map +1 -1
- package/dist/indexer/extractors/java.js +41 -3
- package/dist/indexer/extractors/java.js.map +1 -1
- package/dist/indexer/extractors/javascript.d.ts.map +1 -1
- package/dist/indexer/extractors/javascript.js +67 -3
- package/dist/indexer/extractors/javascript.js.map +1 -1
- package/dist/indexer/extractors/python.d.ts.map +1 -1
- package/dist/indexer/extractors/python.js +31 -2
- package/dist/indexer/extractors/python.js.map +1 -1
- package/dist/indexer/extractors/ruby.d.ts +10 -0
- package/dist/indexer/extractors/ruby.d.ts.map +1 -0
- package/dist/indexer/extractors/ruby.js +145 -0
- package/dist/indexer/extractors/ruby.js.map +1 -0
- package/dist/indexer/extractors/rust.d.ts +10 -0
- package/dist/indexer/extractors/rust.d.ts.map +1 -0
- package/dist/indexer/extractors/rust.js +194 -0
- package/dist/indexer/extractors/rust.js.map +1 -0
- package/dist/indexer/extractors/types.d.ts.map +1 -1
- package/dist/indexer/extractors/types.js +6 -0
- package/dist/indexer/extractors/types.js.map +1 -1
- package/dist/indexer/indexer.d.ts +23 -0
- package/dist/indexer/indexer.d.ts.map +1 -1
- package/dist/indexer/indexer.js +233 -14
- package/dist/indexer/indexer.js.map +1 -1
- package/dist/indexer/watcher.d.ts +3 -0
- package/dist/indexer/watcher.d.ts.map +1 -1
- package/dist/indexer/watcher.js +33 -1
- package/dist/indexer/watcher.js.map +1 -1
- package/dist/server/ipc.d.ts +10 -4
- package/dist/server/ipc.d.ts.map +1 -1
- package/dist/server/ipc.js +190 -109
- package/dist/server/ipc.js.map +1 -1
- package/dist/server/mcp-server.js +38 -29
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/codetree-edit.d.ts +2 -1
- package/dist/server/tools/codetree-edit.d.ts.map +1 -1
- package/dist/server/tools/codetree-edit.js +24 -6
- package/dist/server/tools/codetree-edit.js.map +1 -1
- package/dist/server/tools/codetree-find-refs.d.ts.map +1 -1
- package/dist/server/tools/codetree-find-refs.js +29 -15
- package/dist/server/tools/codetree-find-refs.js.map +1 -1
- package/dist/server/tools/codetree-memory.d.ts +3 -6
- package/dist/server/tools/codetree-memory.d.ts.map +1 -1
- package/dist/server/tools/codetree-memory.js +9 -10
- package/dist/server/tools/codetree-memory.js.map +1 -1
- package/dist/server/tools/codetree-outline.d.ts +57 -0
- package/dist/server/tools/codetree-outline.d.ts.map +1 -0
- package/dist/server/tools/codetree-outline.js +76 -0
- package/dist/server/tools/codetree-outline.js.map +1 -0
- package/dist/server/tools/codetree-probe.d.ts +53 -0
- package/dist/server/tools/codetree-probe.d.ts.map +1 -0
- package/dist/server/tools/codetree-probe.js +81 -0
- package/dist/server/tools/codetree-probe.js.map +1 -0
- package/dist/server/tools/codetree-read.d.ts +52 -3
- package/dist/server/tools/codetree-read.d.ts.map +1 -1
- package/dist/server/tools/codetree-read.js +249 -38
- package/dist/server/tools/codetree-read.js.map +1 -1
- package/dist/server/tools/codetree-search.d.ts +13 -1
- package/dist/server/tools/codetree-search.d.ts.map +1 -1
- package/dist/server/tools/codetree-search.js +89 -49
- package/dist/server/tools/codetree-search.js.map +1 -1
- package/dist/server/tools/codetree-structure.d.ts +25 -1
- package/dist/server/tools/codetree-structure.d.ts.map +1 -1
- package/dist/server/tools/codetree-structure.js +99 -31
- package/dist/server/tools/codetree-structure.js.map +1 -1
- package/dist/server/tools/codetree-summary.d.ts +2 -0
- package/dist/server/tools/codetree-summary.d.ts.map +1 -1
- package/dist/server/tools/codetree-summary.js +5 -0
- package/dist/server/tools/codetree-summary.js.map +1 -1
- package/dist/server/tools/codetree-write.d.ts +2 -1
- package/dist/server/tools/codetree-write.d.ts.map +1 -1
- package/dist/server/tools/codetree-write.js +9 -1
- package/dist/server/tools/codetree-write.js.map +1 -1
- package/dist/setup/install.d.ts +45 -1
- package/dist/setup/install.d.ts.map +1 -1
- package/dist/setup/install.js +163 -58
- package/dist/setup/install.js.map +1 -1
- package/dist/setup/template-load.d.ts +9 -0
- package/dist/setup/template-load.d.ts.map +1 -0
- package/dist/setup/template-load.js +39 -0
- package/dist/setup/template-load.js.map +1 -0
- package/dist/storage/database.d.ts +49 -0
- package/dist/storage/database.d.ts.map +1 -1
- package/dist/storage/database.js +398 -53
- package/dist/storage/database.js.map +1 -1
- package/dist/storage/disk-manager.d.ts.map +1 -1
- package/dist/storage/disk-manager.js +1 -5
- package/dist/storage/disk-manager.js.map +1 -1
- package/dist/utils.d.ts +23 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +102 -0
- package/dist/utils.js.map +1 -0
- package/package.json +63 -5
- package/templates/README.md +15 -0
- package/templates/agents-codetree.snippet.md +24 -0
- package/templates/claude-md-codetree.snippet.md +22 -0
- package/templates/claude-rules-codetree.md +23 -0
- package/templates/cursor-codetree.mdc +31 -0
- package/templates/gemini-codetree.snippet.md +6 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CodeTreeConfig } from "../../config.js";
|
|
2
|
+
import type { Indexer } from "../../indexer/indexer.js";
|
|
3
|
+
import type { Database } from "../../storage/database.js";
|
|
4
|
+
export interface ProbeParams {
|
|
5
|
+
query: string;
|
|
6
|
+
files?: string[];
|
|
7
|
+
file_pattern?: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ProbeResult {
|
|
11
|
+
query: string;
|
|
12
|
+
hits: Array<{
|
|
13
|
+
file_path: string;
|
|
14
|
+
line_numbers: number[];
|
|
15
|
+
}>;
|
|
16
|
+
filesScanned: number;
|
|
17
|
+
truncated: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Cheap presence probe — "does X mention Y?". Returns line numbers only,
|
|
21
|
+
* NEVER returns line content. Massively cheaper than search/read for triage.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createProbeTool(_config: CodeTreeConfig, indexer: Indexer, db: Database): {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: "object";
|
|
28
|
+
properties: {
|
|
29
|
+
query: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
files: {
|
|
34
|
+
type: string;
|
|
35
|
+
items: {
|
|
36
|
+
type: string;
|
|
37
|
+
};
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
file_pattern: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
limit: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
required: string[];
|
|
50
|
+
};
|
|
51
|
+
handler: (params: ProbeParams) => Promise<ProbeResult>;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=codetree-probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codetree-probe.d.ts","sourceRoot":"","sources":["../../../src/server/tools/codetree-probe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAiB3D,WAAW,KAAG,OAAO,CAAC,WAAW,CAAC;EAuD7D"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cheap presence probe — "does X mention Y?". Returns line numbers only,
|
|
3
|
+
* NEVER returns line content. Massively cheaper than search/read for triage.
|
|
4
|
+
*/
|
|
5
|
+
export function createProbeTool(_config, indexer, db) {
|
|
6
|
+
return {
|
|
7
|
+
name: "codetree_probe",
|
|
8
|
+
description: "Cheap presence probe. Returns ONLY file paths + line numbers where the query appears. " +
|
|
9
|
+
"No content snippets. Use to answer 'does file X mention Y?' or 'where is Y referenced?' " +
|
|
10
|
+
"without paying the token cost of content snippets or full reads.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
query: { type: "string", description: "Substring/identifier to look for (case-insensitive)." },
|
|
15
|
+
files: { type: "array", items: { type: "string" }, description: "Optional: restrict to these file paths." },
|
|
16
|
+
file_pattern: { type: "string", description: "Optional: substring pattern on file path." },
|
|
17
|
+
limit: { type: "number", description: "Max files in response (default 30)." },
|
|
18
|
+
},
|
|
19
|
+
required: ["query"],
|
|
20
|
+
},
|
|
21
|
+
handler: async (params) => {
|
|
22
|
+
const limit = params.limit ?? 30;
|
|
23
|
+
const q = params.query;
|
|
24
|
+
const qLower = q.toLowerCase();
|
|
25
|
+
// Candidate file set
|
|
26
|
+
const MAX_FALLBACK_FILES = 500;
|
|
27
|
+
let candidatePaths;
|
|
28
|
+
if (params.files && params.files.length > 0) {
|
|
29
|
+
candidatePaths = params.files;
|
|
30
|
+
}
|
|
31
|
+
else if (q.length >= 3) {
|
|
32
|
+
const candidates = indexer.filesContainingAny([q]);
|
|
33
|
+
if (candidates.size === 0) {
|
|
34
|
+
// Postings may be cold for non-identifier queries — fall back, but
|
|
35
|
+
// bounded to avoid full-corpus scans.
|
|
36
|
+
candidatePaths = db.getAllFiles().slice(0, MAX_FALLBACK_FILES).map((f) => f.path);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
candidatePaths = Array.from(candidates);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Too short for postings — bounded scan only.
|
|
44
|
+
candidatePaths = db.getAllFiles().slice(0, MAX_FALLBACK_FILES).map((f) => f.path);
|
|
45
|
+
}
|
|
46
|
+
if (params.file_pattern) {
|
|
47
|
+
const p = params.file_pattern.toLowerCase();
|
|
48
|
+
candidatePaths = candidatePaths.filter((fp) => fp.toLowerCase().includes(p));
|
|
49
|
+
}
|
|
50
|
+
const hits = [];
|
|
51
|
+
let filesScanned = 0;
|
|
52
|
+
let truncated = false;
|
|
53
|
+
for (const fp of candidatePaths) {
|
|
54
|
+
if (hits.length >= limit) {
|
|
55
|
+
truncated = true;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
filesScanned++;
|
|
59
|
+
const content = indexer.readCached(fp);
|
|
60
|
+
if (!content)
|
|
61
|
+
continue;
|
|
62
|
+
if (!content.toLowerCase().includes(qLower))
|
|
63
|
+
continue;
|
|
64
|
+
const lines = content.split("\n");
|
|
65
|
+
const lineNumbers = [];
|
|
66
|
+
for (let i = 0; i < lines.length; i++) {
|
|
67
|
+
if (lines[i].toLowerCase().includes(qLower)) {
|
|
68
|
+
lineNumbers.push(i + 1);
|
|
69
|
+
if (lineNumbers.length >= 20)
|
|
70
|
+
break; // cap per file
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (lineNumbers.length > 0) {
|
|
74
|
+
hits.push({ file_path: fp, line_numbers: lineNumbers });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { query: q, hits, filesScanned, truncated };
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=codetree-probe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codetree-probe.js","sourceRoot":"","sources":["../../../src/server/tools/codetree-probe.ts"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAu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C,MAAM,CAAC;oBAAE,SAAS;gBACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAClC,MAAM,WAAW,GAAa,EAAE,CAAC;gBACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACtC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;wBAC5C,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;wBACxB,IAAI,WAAW,CAAC,MAAM,IAAI,EAAE;4BAAE,MAAM,CAAC,eAAe;oBACtD,CAAC;gBACH,CAAC;gBACD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC3B,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;gBAC1D,CAAC;YACH,CAAC;YAED,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;QACrD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,20 +5,37 @@ export interface ReadParams {
|
|
|
5
5
|
file_path: string;
|
|
6
6
|
offset?: number;
|
|
7
7
|
limit?: number;
|
|
8
|
+
outline_only?: boolean;
|
|
9
|
+
include_symbols?: boolean;
|
|
10
|
+
include_content?: boolean;
|
|
11
|
+
exported_symbols_only?: boolean;
|
|
12
|
+
symbols_limit?: number;
|
|
13
|
+
expected_hash?: string;
|
|
14
|
+
session_id?: string;
|
|
15
|
+
focus_symbol?: string;
|
|
8
16
|
}
|
|
9
17
|
export interface ReadResult {
|
|
10
|
-
content
|
|
11
|
-
|
|
18
|
+
content?: string;
|
|
19
|
+
/** When the file changed and the agent sent expected_hash, this contains a compact diff instead of full content */
|
|
20
|
+
diff?: string;
|
|
21
|
+
source: "memory_cache" | "disk_cache" | "direct_read" | "session_unchanged" | "outline" | "diff";
|
|
12
22
|
path: string;
|
|
23
|
+
hash: string | null;
|
|
13
24
|
lineCount: number;
|
|
14
25
|
size: number;
|
|
15
26
|
language: string | null;
|
|
16
|
-
symbols
|
|
27
|
+
symbols?: Array<{
|
|
17
28
|
name: string;
|
|
18
29
|
kind: string;
|
|
19
30
|
line: number | null;
|
|
20
31
|
signature: string | null;
|
|
21
32
|
}>;
|
|
33
|
+
truncated?: boolean;
|
|
34
|
+
outline_only?: boolean;
|
|
35
|
+
/** True when the response intentionally omitted the file body (outline_only OR include_content=false OR auto-fallback). */
|
|
36
|
+
body_omitted?: boolean;
|
|
37
|
+
unchanged_since_last_read?: boolean;
|
|
38
|
+
message?: string;
|
|
22
39
|
}
|
|
23
40
|
export declare function createReadTool(config: CodeTreeConfig, indexer: Indexer, db: Database): {
|
|
24
41
|
name: string;
|
|
@@ -38,6 +55,38 @@ export declare function createReadTool(config: CodeTreeConfig, indexer: Indexer,
|
|
|
38
55
|
type: string;
|
|
39
56
|
description: string;
|
|
40
57
|
};
|
|
58
|
+
outline_only: {
|
|
59
|
+
type: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
include_symbols: {
|
|
63
|
+
type: string;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
include_content: {
|
|
67
|
+
type: string;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
exported_symbols_only: {
|
|
71
|
+
type: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
symbols_limit: {
|
|
75
|
+
type: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
expected_hash: {
|
|
79
|
+
type: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
session_id: {
|
|
83
|
+
type: string;
|
|
84
|
+
description: string;
|
|
85
|
+
};
|
|
86
|
+
focus_symbol: {
|
|
87
|
+
type: string;
|
|
88
|
+
description: string;
|
|
89
|
+
};
|
|
41
90
|
};
|
|
42
91
|
required: string[];
|
|
43
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codetree-read.d.ts","sourceRoot":"","sources":["../../../src/server/tools/codetree-read.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"codetree-read.d.ts","sourceRoot":"","sources":["../../../src/server/tools/codetree-read.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAG1D,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mHAAmH;IACnH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,GAAG,YAAY,GAAG,aAAa,GAAG,mBAAmB,GAAG,SAAS,GAAG,MAAM,CAAC;IACjG,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAC/F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,2HAA2H;IAC3H,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA2BzD,UAAU,KAAG,OAAO,CAAC,UAAU,CAAC;EAgR3D"}
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
import { resolve, relative } from "node:path";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
2
|
+
import { readFileSync, statSync } from "node:fs";
|
|
3
3
|
import { normalizePath } from "../../config.js";
|
|
4
|
+
import { computeDiff, isDiffWorthSending } from "../../diff.js";
|
|
4
5
|
export function createReadTool(config, indexer, db) {
|
|
6
|
+
const tk = config.tokenSave.read;
|
|
5
7
|
return {
|
|
6
8
|
name: "codetree_read",
|
|
7
|
-
description: "Read a file from the CodeTree cache.
|
|
8
|
-
"
|
|
9
|
-
"
|
|
9
|
+
description: "Read a file from the CodeTree cache. Token-efficient: returns 'unchanged_since_last_read' " +
|
|
10
|
+
"when the same session already read the same content (no body re-sent), supports outline_only " +
|
|
11
|
+
"(symbols/metadata only, no body), and includes the file hash so the agent can avoid re-reads. " +
|
|
12
|
+
"Use offset/limit to paginate large files. Use outline_only=true for cheap browsing.",
|
|
10
13
|
inputSchema: {
|
|
11
14
|
type: "object",
|
|
12
15
|
properties: {
|
|
13
|
-
file_path: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
16
|
+
file_path: { type: "string", description: "Absolute or project-relative path." },
|
|
17
|
+
offset: { type: "number", description: "Line number to start (0-indexed). Default: 0" },
|
|
18
|
+
limit: { type: "number", description: "Number of lines. Default: all" },
|
|
19
|
+
outline_only: { type: "boolean", description: "Return symbols + metadata only (no body). Default: false." },
|
|
20
|
+
include_symbols: { type: "boolean", description: `Include symbol metadata. Default: ${tk.includeSymbolsByDefault}.` },
|
|
21
|
+
include_content: { type: "boolean", description: "Include file content. Default: true. Set false for cheap probes." },
|
|
22
|
+
exported_symbols_only: { type: "boolean", description: `Return only exported symbols. Default: ${tk.exportedSymbolsOnlyByDefault}.` },
|
|
23
|
+
symbols_limit: { type: "number", description: `Cap symbols returned. Default: ${tk.maxSymbols}.` },
|
|
24
|
+
expected_hash: { type: "string", description: "If provided and matches current hash, returns unchanged with no body. If hash differs, returns a compact diff instead of full content." },
|
|
25
|
+
session_id: { type: "string", description: "If set, enables 'unchanged since you last read it' short-circuit." },
|
|
26
|
+
focus_symbol: { type: "string", description: "Auto-narrow to lines containing this symbol (function/class name). Returns only the symbol body + context. Huge token savings on large files." },
|
|
25
27
|
},
|
|
26
28
|
required: ["file_path"],
|
|
27
29
|
},
|
|
28
30
|
handler: async (params) => {
|
|
29
|
-
|
|
31
|
+
if (!params.file_path) {
|
|
32
|
+
throw new Error("file_path is required. Use file_path (not file) to specify the file to read.");
|
|
33
|
+
}
|
|
34
|
+
// Resolve path
|
|
30
35
|
let absPath;
|
|
31
36
|
let relPath;
|
|
32
|
-
if (params.file_path.startsWith("/") ||
|
|
37
|
+
if (params.file_path.startsWith("/") || /^[A-Za-z]:/.test(params.file_path)) {
|
|
33
38
|
absPath = resolve(params.file_path);
|
|
34
39
|
relPath = normalizePath(relative(config.projectRoot, absPath));
|
|
35
40
|
}
|
|
@@ -37,44 +42,250 @@ export function createReadTool(config, indexer, db) {
|
|
|
37
42
|
relPath = normalizePath(params.file_path);
|
|
38
43
|
absPath = resolve(config.projectRoot, relPath);
|
|
39
44
|
}
|
|
40
|
-
|
|
45
|
+
const fileRecord = db.getFile(relPath);
|
|
46
|
+
const includeSymbols = params.include_symbols ?? tk.includeSymbolsByDefault;
|
|
47
|
+
const includeContent = params.include_content ?? true;
|
|
48
|
+
const exportedOnly = params.exported_symbols_only ?? tk.exportedSymbolsOnlyByDefault;
|
|
49
|
+
const symbolsCap = params.symbols_limit ?? tk.maxSymbols;
|
|
50
|
+
const outlineOnly = params.outline_only === true;
|
|
51
|
+
// Helper to fetch + trim symbols
|
|
52
|
+
const buildSymbols = (rangeStart, rangeEnd) => {
|
|
53
|
+
if (!includeSymbols)
|
|
54
|
+
return undefined;
|
|
55
|
+
let symbols = db.getSymbolsForFile(relPath);
|
|
56
|
+
if (exportedOnly)
|
|
57
|
+
symbols = symbols.filter((s) => s.exported);
|
|
58
|
+
if (rangeStart !== undefined && rangeEnd !== undefined) {
|
|
59
|
+
symbols = symbols.filter((s) => s.line_start !== null && s.line_start >= rangeStart + 1 && s.line_start <= rangeEnd);
|
|
60
|
+
}
|
|
61
|
+
if (symbolsCap > 0 && symbols.length > symbolsCap)
|
|
62
|
+
symbols = symbols.slice(0, symbolsCap);
|
|
63
|
+
return symbols.map((s) => ({
|
|
64
|
+
name: s.name,
|
|
65
|
+
kind: s.kind,
|
|
66
|
+
line: s.line_start,
|
|
67
|
+
signature: s.signature,
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
// ── Unchanged-since-last-read short-circuit (token-saver) ────
|
|
71
|
+
if (tk.unchangedShortCircuit &&
|
|
72
|
+
fileRecord &&
|
|
73
|
+
params.session_id &&
|
|
74
|
+
!outlineOnly && includeContent) {
|
|
75
|
+
try {
|
|
76
|
+
const lastReadAt = db.getLastSessionReadAt(params.session_id, relPath);
|
|
77
|
+
if (lastReadAt > 0 && lastReadAt >= fileRecord.mtime_ms) {
|
|
78
|
+
// Verify file still exists on disk and the mtime really matches what
|
|
79
|
+
// we have in the index — guards against stale fileRecord (e.g. file
|
|
80
|
+
// deleted or modified between watcher trigger and this call).
|
|
81
|
+
let stillValid = false;
|
|
82
|
+
try {
|
|
83
|
+
const st = statSync(absPath);
|
|
84
|
+
stillValid = Math.floor(st.mtimeMs) === fileRecord.mtime_ms;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
stillValid = false;
|
|
88
|
+
}
|
|
89
|
+
if (stillValid) {
|
|
90
|
+
return {
|
|
91
|
+
source: "session_unchanged",
|
|
92
|
+
path: relPath,
|
|
93
|
+
hash: fileRecord.hash,
|
|
94
|
+
lineCount: fileRecord.line_count,
|
|
95
|
+
size: fileRecord.size,
|
|
96
|
+
language: fileRecord.language,
|
|
97
|
+
symbols: buildSymbols(),
|
|
98
|
+
unchanged_since_last_read: true,
|
|
99
|
+
message: "Unchanged since you last read it this session. Use prior content; no re-read needed.",
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
// Otherwise, fall through to a real read (will re-index as needed)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch { /* ignore */ }
|
|
106
|
+
}
|
|
107
|
+
// ── expected_hash short-circuit ───────────────────────────────
|
|
108
|
+
if (fileRecord && params.expected_hash && params.expected_hash === fileRecord.hash) {
|
|
109
|
+
return {
|
|
110
|
+
source: "session_unchanged",
|
|
111
|
+
path: relPath,
|
|
112
|
+
hash: fileRecord.hash,
|
|
113
|
+
lineCount: fileRecord.line_count,
|
|
114
|
+
size: fileRecord.size,
|
|
115
|
+
language: fileRecord.language,
|
|
116
|
+
symbols: buildSymbols(),
|
|
117
|
+
unchanged_since_last_read: true,
|
|
118
|
+
message: "Hash matches expected_hash; content unchanged.",
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// ── Diff-based read: file changed but agent has prior version ──
|
|
122
|
+
if (fileRecord &&
|
|
123
|
+
params.expected_hash &&
|
|
124
|
+
params.expected_hash !== fileRecord.hash &&
|
|
125
|
+
includeContent && !outlineOnly) {
|
|
126
|
+
// Agent sent a hash that doesn't match — file changed.
|
|
127
|
+
// Try to return a diff instead of the full content.
|
|
128
|
+
const newContent = indexer.readCached(relPath) || (() => {
|
|
129
|
+
try {
|
|
130
|
+
return readFileSync(absPath, "utf-8");
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
})();
|
|
136
|
+
if (newContent) {
|
|
137
|
+
// We need the old content to compute diff.
|
|
138
|
+
// Look up old content from the content cache by hash.
|
|
139
|
+
// If we can't get old content, fall through to full read.
|
|
140
|
+
const oldContent = db.getCachedContentByHash(params.expected_hash);
|
|
141
|
+
if (oldContent) {
|
|
142
|
+
const diffResult = computeDiff(oldContent, newContent);
|
|
143
|
+
const newBytes = Buffer.byteLength(newContent, "utf-8");
|
|
144
|
+
if (isDiffWorthSending(diffResult, newBytes)) {
|
|
145
|
+
// Log read for session memory
|
|
146
|
+
try {
|
|
147
|
+
const sid = params.session_id || db.getRecentSessions(1)[0]?.id;
|
|
148
|
+
if (sid)
|
|
149
|
+
db.logSessionRead(sid, relPath, "codetree_read");
|
|
150
|
+
}
|
|
151
|
+
catch { /* ignore */ }
|
|
152
|
+
const diffBytes = Buffer.byteLength(diffResult.compactDiff, "utf-8");
|
|
153
|
+
const pctSmaller = newBytes > 0
|
|
154
|
+
? Math.max(0, Math.round((1 - diffBytes / newBytes) * 100))
|
|
155
|
+
: 0;
|
|
156
|
+
return {
|
|
157
|
+
diff: diffResult.compactDiff,
|
|
158
|
+
source: "diff",
|
|
159
|
+
path: relPath,
|
|
160
|
+
hash: fileRecord.hash,
|
|
161
|
+
lineCount: fileRecord.line_count,
|
|
162
|
+
size: fileRecord.size,
|
|
163
|
+
language: fileRecord.language,
|
|
164
|
+
symbols: buildSymbols(),
|
|
165
|
+
message: `File changed (${diffResult.totalChanged} lines). Diff sent instead of full content (${pctSmaller}% smaller).`,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Fall through to full content read if diff isn't possible/worth it
|
|
171
|
+
}
|
|
172
|
+
// ── Outline-only path: return metadata + symbols, no body ───
|
|
173
|
+
if (outlineOnly || !includeContent) {
|
|
174
|
+
const symbols = buildSymbols();
|
|
175
|
+
// Log the read for session memory
|
|
176
|
+
try {
|
|
177
|
+
const sid = params.session_id || db.getRecentSessions(1)[0]?.id;
|
|
178
|
+
if (sid)
|
|
179
|
+
db.logSessionRead(sid, relPath, "codetree_read");
|
|
180
|
+
}
|
|
181
|
+
catch { /* ignore */ }
|
|
182
|
+
return {
|
|
183
|
+
source: "outline",
|
|
184
|
+
path: relPath,
|
|
185
|
+
hash: fileRecord?.hash ?? null,
|
|
186
|
+
lineCount: fileRecord?.line_count ?? 0,
|
|
187
|
+
size: fileRecord?.size ?? 0,
|
|
188
|
+
language: fileRecord?.language ?? null,
|
|
189
|
+
symbols,
|
|
190
|
+
// Only echo `outline_only` when the caller actually asked for it.
|
|
191
|
+
// Always set body_omitted so agents have one stable field to check.
|
|
192
|
+
outline_only: outlineOnly ? true : undefined,
|
|
193
|
+
body_omitted: true,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
// ── Get content (cache → disk) ───────────────────────────────
|
|
41
197
|
let content = indexer.readCached(relPath);
|
|
42
198
|
let source = "memory_cache";
|
|
43
199
|
if (!content) {
|
|
44
|
-
// Direct read as fallback
|
|
45
200
|
try {
|
|
46
201
|
content = readFileSync(absPath, "utf-8");
|
|
47
202
|
source = "direct_read";
|
|
48
|
-
// Trigger background indexing of this file
|
|
49
203
|
indexer.indexFile(absPath);
|
|
50
204
|
}
|
|
51
|
-
catch
|
|
205
|
+
catch {
|
|
52
206
|
throw new Error(`Failed to read file: ${absPath}`);
|
|
53
207
|
}
|
|
54
208
|
}
|
|
55
|
-
//
|
|
56
|
-
if (params.
|
|
209
|
+
// ── focus_symbol: auto-narrow to a specific symbol's body ──
|
|
210
|
+
if (params.focus_symbol && !params.offset && !params.limit) {
|
|
211
|
+
const allSymbols = db.getSymbolsForFile(relPath);
|
|
212
|
+
const target = allSymbols.find((s) => s.name === params.focus_symbol || s.name.endsWith(`.${params.focus_symbol}`));
|
|
213
|
+
if (target && target.line_start !== null) {
|
|
214
|
+
const lines = content.split("\n");
|
|
215
|
+
const contextLines = 3;
|
|
216
|
+
const start = Math.max(0, target.line_start - 1 - contextLines);
|
|
217
|
+
const end = Math.min(lines.length, (target.line_end ?? target.line_start + 20) + contextLines);
|
|
218
|
+
const focused = lines.slice(start, end).join("\n");
|
|
219
|
+
// Log read
|
|
220
|
+
try {
|
|
221
|
+
const sid = params.session_id || db.getRecentSessions(1)[0]?.id;
|
|
222
|
+
if (sid)
|
|
223
|
+
db.logSessionRead(sid, relPath, "codetree_read", start, end);
|
|
224
|
+
}
|
|
225
|
+
catch { /* ignore */ }
|
|
226
|
+
return {
|
|
227
|
+
content: focused,
|
|
228
|
+
source,
|
|
229
|
+
path: relPath,
|
|
230
|
+
hash: fileRecord?.hash ?? null,
|
|
231
|
+
lineCount: end - start,
|
|
232
|
+
size: Buffer.byteLength(focused, "utf-8"),
|
|
233
|
+
language: fileRecord?.language ?? null,
|
|
234
|
+
symbols: [target].map((s) => ({
|
|
235
|
+
name: s.name, kind: s.kind, line: s.line_start, signature: s.signature,
|
|
236
|
+
})),
|
|
237
|
+
message: `Focused on ${target.kind} "${target.name}" (lines ${start + 1}-${end}). Full file: ${fileRecord?.line_count ?? lines.length} lines.`,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const hasRange = params.offset !== undefined || params.limit !== undefined;
|
|
242
|
+
let rangeStart = 0;
|
|
243
|
+
let rangeEnd = Infinity;
|
|
244
|
+
if (hasRange) {
|
|
57
245
|
const lines = content.split("\n");
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
246
|
+
rangeStart = Math.max(0, params.offset ?? 0);
|
|
247
|
+
// Cap any single-call slice so a runaway `limit` (e.g. 999_999) on a
|
|
248
|
+
// huge file can't bypass the outline-fallback budget.
|
|
249
|
+
const MAX_LINES_PER_CALL = 5000;
|
|
250
|
+
const requestedLimit = params.limit ?? (lines.length - rangeStart);
|
|
251
|
+
const safeLimit = Math.min(requestedLimit, MAX_LINES_PER_CALL);
|
|
252
|
+
rangeEnd = rangeStart + safeLimit;
|
|
253
|
+
content = lines.slice(rangeStart, rangeEnd).join("\n");
|
|
61
254
|
}
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
255
|
+
// Log read for session memory
|
|
256
|
+
try {
|
|
257
|
+
const sid = params.session_id || db.getRecentSessions(1)[0]?.id;
|
|
258
|
+
if (sid) {
|
|
259
|
+
db.logSessionRead(sid, relPath, "codetree_read", rangeStart || undefined, hasRange ? rangeEnd : undefined);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
catch { /* ignore */ }
|
|
263
|
+
const slicedSize = Buffer.byteLength(content, "utf-8");
|
|
264
|
+
// ── Auto-degrade to outline if content is huge and no range ─
|
|
265
|
+
if (!hasRange && slicedSize > tk.outlineFallbackBytes) {
|
|
266
|
+
const symbols = buildSymbols();
|
|
267
|
+
return {
|
|
268
|
+
source: "outline",
|
|
269
|
+
path: relPath,
|
|
270
|
+
hash: fileRecord?.hash ?? null,
|
|
271
|
+
lineCount: fileRecord?.line_count ?? content.split("\n").length,
|
|
272
|
+
size: fileRecord?.size ?? slicedSize,
|
|
273
|
+
language: fileRecord?.language ?? null,
|
|
274
|
+
symbols,
|
|
275
|
+
body_omitted: true,
|
|
276
|
+
message: `[outline auto: file is ${(slicedSize / 1024).toFixed(0)}KB; pass offset/limit for content]`,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const slicedLineCount = content.split("\n").length;
|
|
65
280
|
return {
|
|
66
281
|
content,
|
|
67
282
|
source,
|
|
68
283
|
path: relPath,
|
|
69
|
-
|
|
70
|
-
|
|
284
|
+
hash: fileRecord?.hash ?? null,
|
|
285
|
+
lineCount: hasRange ? slicedLineCount : (fileRecord?.line_count ?? slicedLineCount),
|
|
286
|
+
size: hasRange ? slicedSize : (fileRecord?.size ?? slicedSize),
|
|
71
287
|
language: fileRecord?.language ?? null,
|
|
72
|
-
symbols:
|
|
73
|
-
name: s.name,
|
|
74
|
-
kind: s.kind,
|
|
75
|
-
line: s.line_start,
|
|
76
|
-
signature: s.signature,
|
|
77
|
-
})),
|
|
288
|
+
symbols: buildSymbols(rangeStart, rangeEnd === Infinity ? undefined : rangeEnd),
|
|
78
289
|
};
|
|
79
290
|
},
|
|
80
291
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codetree-read.js","sourceRoot":"","sources":["../../../src/server/tools/codetree-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAuB,MAAM,iBAAiB,CAAC;AAoBrE,MAAM,UAAU,cAAc,CAAC,MAAsB,EAAE,OAAgB,EAAE,EAAY;IACnF,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,uGAAuG;YACvG,gFAAgF;YAChF,6DAA6D;QAC/D,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QA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O,CAAC,CAAC,CAAC,oCAAoC;iBACtG,CAAC;YACJ,CAAC;YAED,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;YACnD,OAAO;gBACL,OAAO;gBACP,MAAM;gBACN,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,IAAI;gBAC9B,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,UAAU,IAAI,eAAe,CAAC;gBACnF,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,IAAI,UAAU,CAAC;gBAC9D,QAAQ,EAAE,UAAU,EAAE,QAAQ,IAAI,IAAI;gBACtC,OAAO,EAAE,YAAY,CAAC,UAAU,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;aAChF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,8 @@ export interface SearchParams {
|
|
|
7
7
|
file_pattern?: string;
|
|
8
8
|
limit?: number;
|
|
9
9
|
content_search?: boolean;
|
|
10
|
+
include_signature?: boolean;
|
|
11
|
+
cursor?: number;
|
|
10
12
|
}
|
|
11
13
|
export interface SearchResult {
|
|
12
14
|
symbols: Array<{
|
|
@@ -14,7 +16,7 @@ export interface SearchResult {
|
|
|
14
16
|
kind: string;
|
|
15
17
|
file_path: string;
|
|
16
18
|
line_start: number | null;
|
|
17
|
-
signature
|
|
19
|
+
signature?: string | null;
|
|
18
20
|
exported: boolean;
|
|
19
21
|
}>;
|
|
20
22
|
content_matches?: Array<{
|
|
@@ -24,6 +26,8 @@ export interface SearchResult {
|
|
|
24
26
|
}>;
|
|
25
27
|
totalResults: number;
|
|
26
28
|
source: "index";
|
|
29
|
+
next_cursor?: number;
|
|
30
|
+
truncated?: boolean;
|
|
27
31
|
}
|
|
28
32
|
export declare function createSearchTool(config: CodeTreeConfig, indexer: Indexer, db: Database): {
|
|
29
33
|
name: string;
|
|
@@ -51,6 +55,14 @@ export declare function createSearchTool(config: CodeTreeConfig, indexer: Indexe
|
|
|
51
55
|
type: string;
|
|
52
56
|
description: string;
|
|
53
57
|
};
|
|
58
|
+
include_signature: {
|
|
59
|
+
type: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
cursor: {
|
|
63
|
+
type: string;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
54
66
|
};
|
|
55
67
|
required: string[];
|
|
56
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codetree-search.d.ts","sourceRoot":"","sources":["../../../src/server/tools/codetree-search.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"codetree-search.d.ts","sourceRoot":"","sources":["../../../src/server/tools/codetree-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAG1D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAA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