codesearch-mcp 0.2.3-alpha → 0.3.0-alpha
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/CHANGELOG.md +31 -1
- package/README.md +46 -26
- package/dist/app.js +5 -19
- package/dist/src/chunking/AstChunker.d.ts +12 -0
- package/dist/src/chunking/AstChunker.js +30 -0
- package/dist/src/chunking/CharacterChunkStrategy.d.ts +8 -0
- package/dist/src/chunking/CharacterChunkStrategy.js +15 -0
- package/dist/src/chunking/DeclarationChunkStrategy.d.ts +15 -0
- package/dist/src/chunking/DeclarationChunkStrategy.js +87 -0
- package/dist/src/chunking/FragmentMerger.d.ts +11 -0
- package/dist/src/chunking/FragmentMerger.js +61 -0
- package/dist/src/chunking/ImportOnlyFilter.d.ts +5 -0
- package/dist/src/chunking/ImportOnlyFilter.js +14 -0
- package/dist/src/chunking/LangchainTextSplitter.d.ts +21 -0
- package/dist/src/chunking/LangchainTextSplitter.js +133 -0
- package/dist/src/chunking/MinSizeSplitPolicy.d.ts +9 -0
- package/dist/src/chunking/MinSizeSplitPolicy.js +18 -0
- package/dist/src/chunking/RunPacker.d.ts +12 -0
- package/dist/src/chunking/RunPacker.js +84 -0
- package/dist/src/chunking/create-chunker.d.ts +3 -0
- package/dist/src/chunking/create-chunker.js +15 -0
- package/dist/src/chunking/interfaces.d.ts +27 -0
- package/dist/src/chunking/interfaces.js +2 -0
- package/dist/src/commands/ConfigCommand.js +1 -9
- package/dist/src/commands/EvalCommand.d.ts +4 -3
- package/dist/src/commands/EvalCommand.js +85 -52
- package/dist/src/commands/IndexCommand.js +0 -22
- package/dist/src/commands/McpCommand.js +2 -8
- package/dist/src/commands/WebCommand.js +2 -5
- package/dist/src/config-error.d.ts +0 -4
- package/dist/src/config-error.js +0 -4
- package/dist/src/config-store.d.ts +1 -54
- package/dist/src/config-store.js +8 -69
- package/dist/src/config.d.ts +8 -17
- package/dist/src/config.js +35 -34
- package/dist/src/constants.d.ts +2 -28
- package/dist/src/constants.js +6 -28
- package/dist/src/container.d.ts +6 -0
- package/dist/src/container.js +12 -3
- package/dist/src/db/schema.d.ts +17 -0
- package/dist/src/db/schema.js +1 -6
- package/dist/src/declarations/DeclarationTree.d.ts +19 -0
- package/dist/src/declarations/DeclarationTree.js +66 -0
- package/dist/src/declarations/DeclarationTreeBuilder.d.ts +22 -0
- package/dist/src/declarations/DeclarationTreeBuilder.js +179 -0
- package/dist/src/declarations/SourceLines.d.ts +37 -0
- package/dist/src/declarations/SourceLines.js +415 -0
- package/dist/src/dependency-traversal.d.ts +0 -6
- package/dist/src/dependency-traversal.js +0 -6
- package/dist/src/enriched-prompt.d.ts +0 -6
- package/dist/src/enriched-prompt.js +0 -6
- package/dist/src/error-record.d.ts +12 -0
- package/dist/src/error-record.js +248 -0
- package/dist/src/eval-corpus.d.ts +16 -0
- package/dist/src/eval-corpus.js +169 -0
- package/dist/src/eval-results.d.ts +6 -3
- package/dist/src/eval-results.js +309 -26
- package/dist/src/file-utils.d.ts +0 -5
- package/dist/src/file-utils.js +0 -5
- package/dist/src/graph.d.ts +0 -25
- package/dist/src/graph.js +0 -28
- package/dist/src/hnsw-settings.d.ts +3 -0
- package/dist/src/hnsw-settings.js +24 -0
- package/dist/src/interfaces/IAstParser.d.ts +2 -39
- package/dist/src/interfaces/IChunker.d.ts +3 -12
- package/dist/src/interfaces/ICorpusInspector.d.ts +7 -0
- package/dist/src/interfaces/ICorpusInspector.js +2 -0
- package/dist/src/interfaces/IDatabase.d.ts +2 -22
- package/dist/src/interfaces/IEmbedder.d.ts +0 -9
- package/dist/src/interfaces/ILogger.d.ts +1 -11
- package/dist/src/interfaces/IMcpToolHandler.d.ts +0 -5
- package/dist/src/interfaces/IMonorepoResolver.d.ts +0 -22
- package/dist/src/interfaces/IProjectDiscovery.d.ts +0 -17
- package/dist/src/interfaces/IRetrievalEvaluator.d.ts +134 -12
- package/dist/src/interfaces/ISearcher.d.ts +16 -5
- package/dist/src/interrupt.js +0 -2
- package/dist/src/owner-path.d.ts +9 -10
- package/dist/src/owner-path.js +11 -23
- package/dist/src/project-scope.d.ts +0 -12
- package/dist/src/project-scope.js +0 -12
- package/dist/src/project-selector.d.ts +0 -5
- package/dist/src/project-selector.js +0 -11
- package/dist/src/retrieval-eval.d.ts +14 -6
- package/dist/src/retrieval-eval.js +345 -59
- package/dist/src/search/result-shaping.d.ts +4 -0
- package/dist/src/search/result-shaping.js +19 -0
- package/dist/src/services/AstParserService.d.ts +2 -62
- package/dist/src/services/AstParserService.js +25 -137
- package/dist/src/services/DatabaseService.d.ts +2 -7
- package/dist/src/services/DatabaseService.js +42 -29
- package/dist/src/services/EmbedderFactory.d.ts +0 -4
- package/dist/src/services/EmbedderFactory.js +0 -5
- package/dist/src/services/IndexerService.d.ts +0 -16
- package/dist/src/services/IndexerService.js +16 -45
- package/dist/src/services/InfinityEmbedder.d.ts +0 -21
- package/dist/src/services/InfinityEmbedder.js +0 -15
- package/dist/src/services/LoggerService.d.ts +7 -5
- package/dist/src/services/LoggerService.js +37 -41
- package/dist/src/services/McpServer.d.ts +22 -14
- package/dist/src/services/McpServer.js +70 -37
- package/dist/src/services/MonorepoAwareDiscoveryService.d.ts +1 -45
- package/dist/src/services/MonorepoAwareDiscoveryService.js +1 -51
- package/dist/src/services/NxMonorepoResolver.d.ts +0 -29
- package/dist/src/services/NxMonorepoResolver.js +5 -56
- package/dist/src/services/OpenAICompatibleEmbedder.d.ts +0 -6
- package/dist/src/services/OpenAICompatibleEmbedder.js +0 -14
- package/dist/src/services/ProjectDiscoveryService.d.ts +0 -4
- package/dist/src/services/ProjectDiscoveryService.js +0 -4
- package/dist/src/services/SearcherService.d.ts +9 -116
- package/dist/src/services/SearcherService.js +95 -176
- package/dist/src/services/VoyageEmbedder.d.ts +0 -6
- package/dist/src/services/VoyageEmbedder.js +0 -6
- package/dist/src/services/WebServerService.d.ts +1 -53
- package/dist/src/services/WebServerService.js +11 -57
- package/dist/src/services/http-retry.d.ts +0 -7
- package/dist/src/services/http-retry.js +1 -10
- package/dist/src/services/infinity-provisioning.d.ts +0 -74
- package/dist/src/services/infinity-provisioning.js +5 -88
- package/dist/src/services/legacy-ollama-index.d.ts +0 -16
- package/dist/src/services/legacy-ollama-index.js +0 -23
- package/dist/src/services/reranker.d.ts +0 -9
- package/dist/src/services/reranker.js +46 -12
- package/dist/src/setup.d.ts +11 -23
- package/dist/src/setup.js +98 -71
- package/dist/src/symbol-name.d.ts +0 -12
- package/dist/src/symbol-name.js +0 -13
- package/dist/src/symbol-rows.d.ts +0 -14
- package/dist/src/symbol-rows.js +0 -14
- package/dist/src/tool-call-log.d.ts +2 -0
- package/dist/src/tool-call-log.js +24 -0
- package/dist/src/tools/GetDependenciesTool.js +1 -1
- package/dist/src/tools/GetDependentsTool.js +1 -1
- package/dist/src/tools/SearchCodebaseTool.js +6 -3
- package/dist/src/tools/format-helpers.d.ts +0 -6
- package/dist/src/tools/format-helpers.js +87 -14
- package/dist/src/web/dashboard.d.ts +0 -8
- package/dist/src/web/dashboard.js +7 -10
- package/package.json +2 -2
- package/dist/src/services/AstChunker.d.ts +0 -42
- package/dist/src/services/AstChunker.js +0 -158
- package/docs/web-dashboard.md +0 -206
|
@@ -6,12 +6,6 @@ const config_1 = require("../config");
|
|
|
6
6
|
const reranker_1 = require("./reranker");
|
|
7
7
|
const http_retry_1 = require("./http-retry");
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
|
-
/**
|
|
10
|
-
* Embedder for any server exposing an OpenAI-style `/embeddings` endpoint:
|
|
11
|
-
* OpenAI cloud, Infinity, TEI, vLLM, LM Studio, LocalAI. One request carries all
|
|
12
|
-
* inputs (`{ input: string[], model, dimensions? }`) and returns
|
|
13
|
-
* `{ data: [{ embedding, index }] }`, re-ordered to input order.
|
|
14
|
-
*/
|
|
15
9
|
class OpenAICompatibleEmbedder {
|
|
16
10
|
config;
|
|
17
11
|
logger;
|
|
@@ -24,7 +18,6 @@ class OpenAICompatibleEmbedder {
|
|
|
24
18
|
this.config = config;
|
|
25
19
|
this.logger = logger;
|
|
26
20
|
const base = config.embedding.baseURL.replace(/\/+$/, '');
|
|
27
|
-
// Allow a baseURL that already includes the path (…/v1) or not.
|
|
28
21
|
this.url = /\/embeddings$/.test(base) ? base : `${base}/embeddings`;
|
|
29
22
|
this.doFetch = deps.fetchImpl ?? fetch;
|
|
30
23
|
this.baseDelayMs = deps.baseDelayMs;
|
|
@@ -40,8 +33,6 @@ class OpenAICompatibleEmbedder {
|
|
|
40
33
|
return [];
|
|
41
34
|
return (0, http_retry_1.withRetry)(async () => {
|
|
42
35
|
const headers = { 'Content-Type': 'application/json' };
|
|
43
|
-
// Resolve the key lazily — an unset `env:` ref throws here (request time),
|
|
44
|
-
// not at construction, so `rag-web`/`rag-mcp` still start.
|
|
45
36
|
const apiKey = (0, config_1.resolveEnvRef)(this.config.embedding.apiKey);
|
|
46
37
|
if (apiKey)
|
|
47
38
|
headers['Authorization'] = `Bearer ${apiKey}`;
|
|
@@ -51,7 +42,6 @@ class OpenAICompatibleEmbedder {
|
|
|
51
42
|
const res = await this.doFetch(this.url, {
|
|
52
43
|
method: 'POST',
|
|
53
44
|
headers,
|
|
54
|
-
// CPU inference of one batch of token-dense text (e.g. pseudo-localized strings) takes well over 2 min.
|
|
55
45
|
signal: AbortSignal.timeout(240_000),
|
|
56
46
|
body: JSON.stringify(body),
|
|
57
47
|
});
|
|
@@ -60,13 +50,9 @@ class OpenAICompatibleEmbedder {
|
|
|
60
50
|
throw new http_retry_1.HttpError(res.status, `embeddings request failed: ${res.status} ${errBody}`);
|
|
61
51
|
}
|
|
62
52
|
const data = await res.json();
|
|
63
|
-
// Guard against a partial/mismatched response — a missing vector would
|
|
64
|
-
// otherwise be inserted as "[undefined]" and fail the whole file, or (with
|
|
65
|
-
// reordering + no index) silently misalign vectors to the wrong chunks.
|
|
66
53
|
if (!Array.isArray(data.data) || data.data.length !== texts.length) {
|
|
67
54
|
throw new Error(`embeddings response returned ${data.data?.length ?? 0} vectors for ${texts.length} inputs`);
|
|
68
55
|
}
|
|
69
|
-
// Sort by `index` so vectors line up with input order regardless of server ordering.
|
|
70
56
|
return [...data.data]
|
|
71
57
|
.sort((a, b) => (a.index ?? 0) - (b.index ?? 0))
|
|
72
58
|
.map(d => d.embedding);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { IProjectDiscovery, DiscoveredProject } from '../interfaces/IProjectDiscovery';
|
|
2
|
-
/**
|
|
3
|
-
* Default project discovery: finds immediate subdirectories
|
|
4
|
-
* of the workspace root that contain a package.json.
|
|
5
|
-
*/
|
|
6
2
|
export declare class ProjectDiscoveryService implements IProjectDiscovery {
|
|
7
3
|
discover(rootDir: string): DiscoveredProject[];
|
|
8
4
|
}
|
|
@@ -37,10 +37,6 @@ exports.ProjectDiscoveryService = void 0;
|
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const file_utils_1 = require("../file-utils");
|
|
40
|
-
/**
|
|
41
|
-
* Default project discovery: finds immediate subdirectories
|
|
42
|
-
* of the workspace root that contain a package.json.
|
|
43
|
-
*/
|
|
44
40
|
class ProjectDiscoveryService {
|
|
45
41
|
discover(rootDir) {
|
|
46
42
|
return fs.readdirSync(rootDir, { withFileTypes: true })
|
|
@@ -5,6 +5,7 @@ import type { IDatabase } from '../interfaces';
|
|
|
5
5
|
import { type IndexingExclusion, type ProjectMeta } from '../file-utils';
|
|
6
6
|
import type { ILogger } from '../interfaces';
|
|
7
7
|
import type { IProjectDiscovery } from '../interfaces';
|
|
8
|
+
import type { StagedSearchResult } from '../interfaces/ISearcher';
|
|
8
9
|
export interface ChunkRow {
|
|
9
10
|
serviceName: string;
|
|
10
11
|
filePath: string;
|
|
@@ -24,7 +25,6 @@ export interface GraphContext {
|
|
|
24
25
|
imports: string[];
|
|
25
26
|
usedBy: string[];
|
|
26
27
|
}
|
|
27
|
-
/** A tool path argument refused on its form alone, before any lookup. */
|
|
28
28
|
export type PathRefusal = {
|
|
29
29
|
ok: false;
|
|
30
30
|
reason: 'invalid';
|
|
@@ -50,7 +50,6 @@ export type NotIndexedExplanation = IndexingExclusion | {
|
|
|
50
50
|
} | {
|
|
51
51
|
kind: 'unknown';
|
|
52
52
|
};
|
|
53
|
-
/** A well-formed path that leads to no readable data. */
|
|
54
53
|
export type PathFailure = {
|
|
55
54
|
ok: false;
|
|
56
55
|
reason: 'outside_workspace';
|
|
@@ -106,7 +105,6 @@ export type GrepSymbolResult = {
|
|
|
106
105
|
} | {
|
|
107
106
|
ok: false;
|
|
108
107
|
};
|
|
109
|
-
/** Filesystem access of the path tools — injectable so error codes are testable without permissions. */
|
|
110
108
|
export interface SearcherFs {
|
|
111
109
|
realpath(p: string): Promise<string>;
|
|
112
110
|
stat(p: string): Promise<fs.Stats>;
|
|
@@ -121,17 +119,15 @@ export interface DependencyRow {
|
|
|
121
119
|
depType: string;
|
|
122
120
|
depth?: number;
|
|
123
121
|
via?: string;
|
|
122
|
+
id?: string;
|
|
124
123
|
}
|
|
125
124
|
export interface ProjectRow extends ProjectMeta {
|
|
126
125
|
serviceName: string;
|
|
127
126
|
chunks: number;
|
|
128
127
|
packageName?: string | null;
|
|
129
128
|
type?: 'app' | 'lib';
|
|
130
|
-
/** Real filesystem root of the project (resolved via discovery). */
|
|
131
129
|
path?: string;
|
|
132
|
-
/** `path` in workspace-relative form (`.` for the workspace root). */
|
|
133
130
|
relPath?: string;
|
|
134
|
-
/** Error code of `stat` on `path`, null when it exists. */
|
|
135
131
|
rootError?: string | null;
|
|
136
132
|
}
|
|
137
133
|
export interface GrepMatch {
|
|
@@ -152,13 +148,12 @@ export interface SymbolHit {
|
|
|
152
148
|
column: number;
|
|
153
149
|
kind: Exclude<SymbolKind, 'all'>;
|
|
154
150
|
signature: string;
|
|
155
|
-
/** `container.name`, or `name` when the container is null. */
|
|
156
151
|
qualified: string;
|
|
157
152
|
isStatic: boolean;
|
|
158
153
|
source: 'index' | 'grep';
|
|
159
|
-
/** Qualified TypeScript name of the decorated declaration (GraphQL rows only); null otherwise. */
|
|
160
154
|
target: string | null;
|
|
161
155
|
}
|
|
156
|
+
export declare function rerankDocument(row: ChunkRow): string;
|
|
162
157
|
export declare class SearcherService {
|
|
163
158
|
private db;
|
|
164
159
|
private embedder;
|
|
@@ -167,93 +162,38 @@ export declare class SearcherService {
|
|
|
167
162
|
private logger;
|
|
168
163
|
private readonly fs;
|
|
169
164
|
constructor(db: IDatabase, embedder: IEmbedder, discovery: IProjectDiscovery, config: Config, logger?: ILogger, fsDeps?: Partial<SearcherFs>);
|
|
170
|
-
/**
|
|
171
|
-
* Whether `code_symbol.target` exists — `true` once a check finds it (never
|
|
172
|
-
* re-checked again in this process), `false` until then (re-checked on
|
|
173
|
-
* every lookup, so a `rag-index` run that adds the column takes effect
|
|
174
|
-
* without restarting `rag-mcp`). See "find_symbol works before the target
|
|
175
|
-
* column exists" (`graphql-symbols`).
|
|
176
|
-
*/
|
|
177
165
|
private targetColumnPresent;
|
|
178
|
-
/** Real path of `workspaceRoot`; cached only once resolved, so a transient failure is retried. */
|
|
179
166
|
private realRootCache?;
|
|
180
|
-
/** Lazily-built, cached map of project name → real filesystem root. */
|
|
181
167
|
private rootMap?;
|
|
182
|
-
|
|
168
|
+
private pgvectorVersionRead?;
|
|
169
|
+
private degradedScanWarned;
|
|
170
|
+
private iterativeScanEnabled;
|
|
171
|
+
private warnDegradedScan;
|
|
183
172
|
private projectRootMap;
|
|
184
|
-
/**
|
|
185
|
-
* Resolve a project name to its real filesystem root. Uses discovery (leaf
|
|
186
|
-
* projects) so nested-monorepo names like `repo/app` map to their true path;
|
|
187
|
-
* falls back to `join(workspaceRoot, name)` when the name is unknown (e.g. a
|
|
188
|
-
* project since removed from disk, or a flat project not surfaced by discovery).
|
|
189
|
-
*/
|
|
190
173
|
private resolveProjectRoot;
|
|
191
174
|
private toRel;
|
|
192
175
|
private toAbs;
|
|
193
176
|
private workspaceRoot;
|
|
194
177
|
private realWorkspaceRoot;
|
|
195
|
-
/**
|
|
196
|
-
* Lexical validation of a tool path argument: refusals for an empty value,
|
|
197
|
-
* `\`, an absolute path and a `..` escape; otherwise the canonical
|
|
198
|
-
* workspace-relative form. The only filesystem access is the cached real path
|
|
199
|
-
* of `workspaceRoot`.
|
|
200
|
-
*/
|
|
201
178
|
resolveToolPath(input: string | null | undefined): Promise<ResolvedToolPath>;
|
|
202
|
-
/**
|
|
203
|
-
* Whether the real location of `absPath` — of the target, else of its nearest
|
|
204
|
-
* existing ancestor plus the remaining segments — lies under the real
|
|
205
|
-
* workspace root.
|
|
206
|
-
*/
|
|
207
179
|
private realLocation;
|
|
208
|
-
/**
|
|
209
|
-
* Workspace boundary of the disk tools. A real location outside the workspace
|
|
210
|
-
* is allowed only for content the indexer already read (a symlinked share):
|
|
211
|
-
* the file itself for `file`, any file below it for `dir`.
|
|
212
|
-
*/
|
|
213
180
|
checkRealLocation(relPath: string, absPath: string, kind: 'file' | 'dir'): Promise<{
|
|
214
181
|
ok: true;
|
|
215
182
|
} | Extract<PathFailure, {
|
|
216
183
|
reason: 'outside_workspace' | 'unreadable';
|
|
217
184
|
}>>;
|
|
218
185
|
private pathExists;
|
|
219
|
-
/** Whether any table of the index holds `relPath` (a canonical path, never `../…`). */
|
|
220
186
|
isIndexedPath(relPath: string): Promise<boolean>;
|
|
221
|
-
/** Whether the indexer read the file at `relPath`. */
|
|
222
187
|
isContentPath(relPath: string): Promise<boolean>;
|
|
223
188
|
private hasContentUnder;
|
|
224
|
-
/**
|
|
225
|
-
* Up to three index paths ending in `/<relPath>` (`file`) or directories
|
|
226
|
-
* ending in `/<relPath>` that hold one (`dir`), in byte order. For `dir`, the
|
|
227
|
-
* root of a project named `relPath` comes first.
|
|
228
|
-
*/
|
|
229
189
|
findPathCandidates(relPath: string, kind: 'file' | 'dir'): Promise<string[]>;
|
|
230
|
-
/** `findPathCandidates`, with a failed lookup logged and answered by no candidates. */
|
|
231
190
|
private candidatesOrNone;
|
|
232
|
-
/**
|
|
233
|
-
* `relPath` with a leading project name replaced by that project's root
|
|
234
|
-
* (`repo/app/src/x.ts` → `repo/apps/app/src/x.ts`), or null when no name
|
|
235
|
-
* prefixes it, the root equals the name, or the result names nothing.
|
|
236
|
-
*/
|
|
237
191
|
private substituteProjectName;
|
|
238
192
|
private findProjectRootByName;
|
|
239
|
-
/** Longest workspace-relative project root accepted by `match`; discovery is re-run once before giving up. */
|
|
240
193
|
private findProjectRoot;
|
|
241
|
-
/** Root directory (workspace-relative) of the project the text-search fallback for `relPath` runs in. */
|
|
242
194
|
fallbackRoot(relPath: string): string | null;
|
|
243
|
-
/**
|
|
244
|
-
* Why a graph tool has no data for `relPath`, or null when the path is in the
|
|
245
|
-
* index path set. Touches the disk only for an unknown path, and answers a
|
|
246
|
-
* real location outside the workspace as `not_found` without looking at it.
|
|
247
|
-
*/
|
|
248
195
|
checkGraphPath(relPath: string): Promise<PathFailure | null>;
|
|
249
196
|
private explainNotIndexed;
|
|
250
|
-
/**
|
|
251
|
-
* Project-level dependency edges aggregated from `code_dependency`: an edge
|
|
252
|
-
* `A → B` means some file in project A imports a file owned by project B.
|
|
253
|
-
* Used by the graph to draw links between a monorepo's sub-projects. Only
|
|
254
|
-
* edges whose target file belongs to an indexed project are returned (targets
|
|
255
|
-
* outside any indexed project — e.g. unindexed libs — are skipped).
|
|
256
|
-
*/
|
|
257
197
|
getProjectEdges(): Promise<{
|
|
258
198
|
from: string;
|
|
259
199
|
to: string;
|
|
@@ -262,81 +202,34 @@ export declare class SearcherService {
|
|
|
262
202
|
query: string;
|
|
263
203
|
translated: boolean;
|
|
264
204
|
}>;
|
|
265
|
-
/**
|
|
266
|
-
* Refuse when the configured embedding model disagrees with the one that built
|
|
267
|
-
* the index — embedding a query into a foreign vector space returns noise. A
|
|
268
|
-
* missing `index_meta` row with an empty (or altogether absent) `code_chunk`
|
|
269
|
-
* does not block — but a *populated* `code_chunk` with no `index_meta` row is a
|
|
270
|
-
* pre-`index_meta` install, treated as the legacy `ollama`/`bge-m3` index (same
|
|
271
|
-
* interpretation as the `rag-index` legacy-Ollama guard), read-only — this check
|
|
272
|
-
* never writes `index_meta`.
|
|
273
|
-
*/
|
|
274
205
|
assertIndexMatches(): Promise<void>;
|
|
275
206
|
private compareIndexed;
|
|
276
207
|
listProjects(): Promise<ProjectRow[]>;
|
|
277
|
-
searchChunks(query: string, limit: number, project: string | null, threshold?: number, rerankOverride?: boolean): Promise<SearchResult[]>;
|
|
278
|
-
|
|
279
|
-
* Emit one structured search-tuning line (via `logger.metric`, at `info`
|
|
280
|
-
* regardless of `logging.level`). `candidates` are in cosine order, so a
|
|
281
|
-
* candidate's array index is its cosine rank — `maxCosineRankSurvived` is the
|
|
282
|
-
* deepest cosine position that survived reranking into the returned set. Read
|
|
283
|
-
* it alongside `poolSaturated` to tune `candidateFloor`/`overfetch`/threshold
|
|
284
|
-
* per hardware. Never logs chunk content, embeddings, or credentials.
|
|
285
|
-
*/
|
|
208
|
+
searchChunks(query: string, limit: number, project: string | null, threshold?: number, rerankOverride?: boolean, perFile?: number): Promise<SearchResult[]>;
|
|
209
|
+
searchChunksWithStages(query: string, limit: number, project: string | null, threshold?: number, rerankOverride?: boolean, perFile?: number): Promise<StagedSearchResult>;
|
|
286
210
|
private emitSearchMetrics;
|
|
287
211
|
fetchNeighbors(results: SearchResult[]): Promise<NeighborResult[]>;
|
|
288
212
|
fetchGraphContext(results: SearchResult[]): Promise<Map<string, GraphContext>>;
|
|
289
213
|
getDependencies(filePath: string, symbol?: string | null, transitive?: boolean): Promise<DependencyRow[]>;
|
|
290
214
|
getDependents(filePath: string, symbol?: string | null, transitive?: boolean): Promise<DependencyRow[]>;
|
|
291
215
|
getCallers(symbol: string, project: string, calleeFile?: string | null): Promise<CallerRow[]>;
|
|
292
|
-
/**
|
|
293
|
-
* Whole-word text search for `symbol` under `rootDir` (workspace-relative).
|
|
294
|
-
* grep exiting ≥ 2 after printing matches is a partial result; without
|
|
295
|
-
* matches, or when grep cannot be spawned, the search failed.
|
|
296
|
-
*/
|
|
297
216
|
grepSymbol(symbol: string, rootDir: string, excludeFile: string): Promise<GrepSymbolResult>;
|
|
298
217
|
findSymbol(name: string, project: string | null, kind: SymbolKind): Promise<{
|
|
299
218
|
hits: SymbolHit[];
|
|
300
219
|
truncated: boolean;
|
|
301
220
|
grepFailed: boolean;
|
|
302
221
|
}>;
|
|
303
|
-
/**
|
|
304
|
-
* Whether `code_symbol.target` exists. A present result is cached for the
|
|
305
|
-
* process; an absent one is re-checked on every call. Propagates on a
|
|
306
|
-
* failing check, same as any other failed index query.
|
|
307
|
-
*/
|
|
308
222
|
private hasTargetColumn;
|
|
309
223
|
private findSymbolFromIndex;
|
|
310
224
|
private grepFindSymbol;
|
|
311
225
|
listFiles(relPath: string, depth: number, pattern: string | null): Promise<ListFilesResult>;
|
|
312
|
-
/**
|
|
313
|
-
* The read tools' common front: workspace boundary, then existence and type.
|
|
314
|
-
* A missing file still in the index is `deleted`; otherwise `not_found`.
|
|
315
|
-
*/
|
|
316
226
|
private openableFile;
|
|
317
|
-
/**
|
|
318
|
-
* Streams the file's lines (as `readline` yields them) to `onLine` until it
|
|
319
|
-
* returns false. An open or read error discards everything read so far.
|
|
320
|
-
*/
|
|
321
227
|
private readLines;
|
|
322
228
|
readFile(relPath: string, maxLines: number): Promise<FileRangeResult>;
|
|
323
229
|
readFileRange(relPath: string, startLine: number, endLine: number): Promise<FileRangeResult>;
|
|
324
|
-
/** Throws when `absDir` itself cannot be read; an unreadable subdirectory is marked in place. */
|
|
325
230
|
private walkDir;
|
|
326
|
-
/**
|
|
327
|
-
* ERE pattern for a grep-fallback kind, or null when that kind is never
|
|
328
|
-
* grepped (`function_property`/`method_signature` are index-only; a bare
|
|
329
|
-
* `constructor` search only makes sense when the name itself is `constructor`).
|
|
330
|
-
*/
|
|
331
231
|
private buildFindSymbolPattern;
|
|
332
|
-
/** 1-based index of the first whole-word occurrence of `name` in `line`, or -1. */
|
|
333
232
|
private static wholeWordIndex;
|
|
334
233
|
private inferKind;
|
|
335
|
-
/**
|
|
336
|
-
* Async wrapper around grep to avoid blocking the event loop. `ok: false`
|
|
337
|
-
* means grep could not be spawned (`output: null`) or exited with status ≥ 2,
|
|
338
|
-
* keeping whatever it printed — distinguishable from a clean "no matches",
|
|
339
|
-
* which is `ok: true, output: null`.
|
|
340
|
-
*/
|
|
341
234
|
private spawnGrep;
|
|
342
235
|
}
|