@ninjaxtools/slopdex 0.18.0 → 0.20.0
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/.gitignore +2 -0
- package/README.md +136 -48
- package/binary-install.js +348 -0
- package/binary.js +124 -0
- package/install.js +4 -0
- package/npm-shrinkwrap.json +52 -0
- package/package.json +78 -62
- package/run-slopdex.js +4 -0
- package/.agents/skills/slopdex/SKILL.md +0 -241
- package/dist/chunk-6LHZCHEB.js +0 -1112
- package/dist/chunk-6LHZCHEB.js.map +0 -1
- package/dist/chunk-BXWO2KMC.js +0 -20
- package/dist/chunk-BXWO2KMC.js.map +0 -1
- package/dist/chunk-DKRB2XT5.js +0 -33
- package/dist/chunk-DKRB2XT5.js.map +0 -1
- package/dist/chunk-DTI7SXGL.js +0 -109
- package/dist/chunk-DTI7SXGL.js.map +0 -1
- package/dist/chunk-IQU3YVZ3.js +0 -85
- package/dist/chunk-IQU3YVZ3.js.map +0 -1
- package/dist/chunk-JAVPHCZH.js +0 -24
- package/dist/chunk-JAVPHCZH.js.map +0 -1
- package/dist/chunk-KQRS5P4U.js +0 -10
- package/dist/chunk-KQRS5P4U.js.map +0 -1
- package/dist/chunk-KUV6PKKL.js +0 -425
- package/dist/chunk-KUV6PKKL.js.map +0 -1
- package/dist/chunk-MKUTTXZB.js +0 -74
- package/dist/chunk-MKUTTXZB.js.map +0 -1
- package/dist/chunk-N6D66ASM.js +0 -2217
- package/dist/chunk-N6D66ASM.js.map +0 -1
- package/dist/chunk-OIKBO3NJ.js +0 -133
- package/dist/chunk-OIKBO3NJ.js.map +0 -1
- package/dist/chunk-S225GYCL.js +0 -79
- package/dist/chunk-S225GYCL.js.map +0 -1
- package/dist/chunk-TSURHRFF.js +0 -240
- package/dist/chunk-TSURHRFF.js.map +0 -1
- package/dist/chunk-VH5VGRCI.js +0 -103
- package/dist/chunk-VH5VGRCI.js.map +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1130
- package/dist/cli.js.map +0 -1
- package/dist/code-index-YEFTNG7E.js +0 -14
- package/dist/code-index-YEFTNG7E.js.map +0 -1
- package/dist/cross-search-FVKDMGP7.js +0 -10
- package/dist/cross-search-FVKDMGP7.js.map +0 -1
- package/dist/database-KAPV2YMP.js +0 -14
- package/dist/database-KAPV2YMP.js.map +0 -1
- package/dist/hosted-GHIUHKOU.js +0 -13
- package/dist/hosted-GHIUHKOU.js.map +0 -1
- package/dist/index.d.ts +0 -681
- package/dist/index.js +0 -102
- package/dist/index.js.map +0 -1
- package/dist/jina-43RL7C6M.js +0 -12
- package/dist/jina-43RL7C6M.js.map +0 -1
- package/dist/openai-CYUPNBGB.js +0 -12
- package/dist/openai-CYUPNBGB.js.map +0 -1
- package/dist/openai-EC6THXKV.js +0 -21
- package/dist/openai-EC6THXKV.js.map +0 -1
- package/dist/openai-TCRXM66O.js +0 -11
- package/dist/openai-TCRXM66O.js.map +0 -1
- package/docs/implementation.md +0 -162
- package/docs/reference.md +0 -187
- package/scripts/install-opencode-skill.mjs +0 -11
package/dist/index.d.ts
DELETED
|
@@ -1,681 +0,0 @@
|
|
|
1
|
-
declare class CodeIndex {
|
|
2
|
-
#private;
|
|
3
|
-
readonly rootDir: string;
|
|
4
|
-
readonly indexPath: string;
|
|
5
|
-
readonly provider: EmbeddingProvider;
|
|
6
|
-
readonly reranker: Reranker | undefined;
|
|
7
|
-
readonly descriptionProvider: DescriptionProvider;
|
|
8
|
-
constructor(options: CodeIndexOptions);
|
|
9
|
-
close(): void;
|
|
10
|
-
status(): IndexStatus;
|
|
11
|
-
allFunctions(): IndexedFunction[];
|
|
12
|
-
indexErrors(): IndexingError[];
|
|
13
|
-
updateFiles(options: UpdateFilesOptions): Promise<UpdateStats>;
|
|
14
|
-
updateFromWorkingTree(options?: UpdateFromWorkingTreeOptions): Promise<UpdateStats>;
|
|
15
|
-
updateFromGit(options?: UpdateFromGitOptions): Promise<UpdateStats>;
|
|
16
|
-
useDescriptions(options?: {
|
|
17
|
-
signal?: AbortSignal;
|
|
18
|
-
}): Promise<DescriptionStats>;
|
|
19
|
-
reindexFiles(options?: ReindexFilesOptions): Promise<ReindexFilesStats>;
|
|
20
|
-
disableDescriptions(): DescriptionStats;
|
|
21
|
-
searchDescription(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
22
|
-
similaritySearch(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
23
|
-
similarToFunction(functionId: number, options: {
|
|
24
|
-
includeDescriptions?: boolean;
|
|
25
|
-
limit: number;
|
|
26
|
-
minSimilarity: number;
|
|
27
|
-
maxSimilarity?: number;
|
|
28
|
-
excludePaths?: readonly string[];
|
|
29
|
-
minLines?: number;
|
|
30
|
-
nameRegex?: string;
|
|
31
|
-
}): SimilarityResult[];
|
|
32
|
-
vectorForFunction(functionId: number, kind?: "code" | "description"): number[];
|
|
33
|
-
get readOnly(): boolean;
|
|
34
|
-
similarityCacheInfo(): {
|
|
35
|
-
cachedSources: number;
|
|
36
|
-
cachedPairs: number;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Incrementally refresh the persisted pairwise-similarity cache for same-index
|
|
40
|
-
* analysis. Only pairs scoring at or above `minSimilarity` (the caller's
|
|
41
|
-
* effective threshold) are stored; queries below the cached floor fall back to
|
|
42
|
-
* live vector search. Only functions whose embeddings changed (plus a merge
|
|
43
|
-
* pass over the remaining functions when the changed set is small) are
|
|
44
|
-
* re-queried; unchanged pairs are reused. Lowering the floor below what is
|
|
45
|
-
* cached re-queries every function, since the missing band cannot be rebuilt
|
|
46
|
-
* incrementally; raising it reuses the cache for free. A per-function state
|
|
47
|
-
* row records the embedding triple, floor, row count, and a completeness flag,
|
|
48
|
-
* so a sparse row set is never mistaken for an unfinished computation. Call
|
|
49
|
-
* before cross-search/cohesion, then read through
|
|
50
|
-
* {@link cachedSimilarToFunction}. Best-effort under concurrent writers: a
|
|
51
|
-
* later refresh repairs any rows raced by an overlapping update.
|
|
52
|
-
*/
|
|
53
|
-
refreshSimilarityCache(options?: {
|
|
54
|
-
width?: number;
|
|
55
|
-
/** Minimum similarity stored; pairs below it are never cached. Defaults to -1 (cache everything). */
|
|
56
|
-
minSimilarity?: number;
|
|
57
|
-
signal?: AbortSignal;
|
|
58
|
-
/** Overrides the index-level onProgress for the cache-fill bar. */
|
|
59
|
-
onProgress?: (progress: IndexProgress) => void;
|
|
60
|
-
}): Promise<{
|
|
61
|
-
similarityMode: string;
|
|
62
|
-
width: number;
|
|
63
|
-
minSimilarity: number;
|
|
64
|
-
sourcesRefreshed: number;
|
|
65
|
-
pairsStored: number;
|
|
66
|
-
skipped: boolean;
|
|
67
|
-
}>;
|
|
68
|
-
/**
|
|
69
|
-
* Same-index neighbor lookup backed by {@link refreshSimilarityCache}.
|
|
70
|
-
* Returns cache rows filtered exactly like {@link similarToFunction} and falls
|
|
71
|
-
* back to a live vector query whenever the cache entry is missing, stale,
|
|
72
|
-
* computed at a higher floor than requested, or too truncated to satisfy the
|
|
73
|
-
* filters. A cache entry flagged complete holds every pair above its floor,
|
|
74
|
-
* so short results from it are exact and need no live query.
|
|
75
|
-
*
|
|
76
|
-
* Prefer {@link cachedSimilarityReader} inside per-function loops: it loads
|
|
77
|
-
* the validity snapshot once instead of re-reading it for every function.
|
|
78
|
-
*/
|
|
79
|
-
cachedSimilarToFunction(functionId: number, options: {
|
|
80
|
-
includeDescriptions?: boolean;
|
|
81
|
-
limit: number;
|
|
82
|
-
minSimilarity: number;
|
|
83
|
-
maxSimilarity?: number;
|
|
84
|
-
excludePaths?: readonly string[];
|
|
85
|
-
minLines?: number;
|
|
86
|
-
nameRegex?: string;
|
|
87
|
-
}): SimilarityResult[];
|
|
88
|
-
/**
|
|
89
|
-
* Snapshot the similarity-cache validity state (per-mode states, embedding
|
|
90
|
-
* triples, generation) once for a run of neighbor lookups. The returned
|
|
91
|
-
* lookup behaves exactly like {@link cachedSimilarToFunction} but avoids
|
|
92
|
-
* re-reading whole tables per function; refresh the cache first and create
|
|
93
|
-
* one reader per analysis run. Best-effort under concurrent writers, like the
|
|
94
|
-
* refresh itself: a concurrent mutation mid-run is picked up by the next run.
|
|
95
|
-
*
|
|
96
|
-
* A fallback scan doubles as a read-repair: when the entry is fresh but
|
|
97
|
-
* unusable (missing, recorded at a higher floor, or incomplete), the scan is
|
|
98
|
-
* widened to the full cache width and written back, so later lookups hit.
|
|
99
|
-
* Stale entries are left for the refresh, dense-at-max-width entries cannot
|
|
100
|
-
* be improved, and read-only indexes never write.
|
|
101
|
-
*/
|
|
102
|
-
cachedSimilarityReader(options?: {
|
|
103
|
-
includeDescriptions?: boolean;
|
|
104
|
-
}): {
|
|
105
|
-
similarToFunction: (functionId: number, query: {
|
|
106
|
-
includeDescriptions?: boolean;
|
|
107
|
-
limit: number;
|
|
108
|
-
minSimilarity: number;
|
|
109
|
-
maxSimilarity?: number;
|
|
110
|
-
excludePaths?: readonly string[];
|
|
111
|
-
minLines?: number;
|
|
112
|
-
nameRegex?: string;
|
|
113
|
-
}) => SimilarityResult[];
|
|
114
|
-
};
|
|
115
|
-
vectorForFile(filePath: string): number[];
|
|
116
|
-
searchByVector(vector: readonly number[], options: {
|
|
117
|
-
descriptionVector?: readonly number[];
|
|
118
|
-
fileDescriptionVector?: readonly number[];
|
|
119
|
-
limit?: number;
|
|
120
|
-
minSimilarity: number;
|
|
121
|
-
maxSimilarity?: number;
|
|
122
|
-
excludePaths?: readonly string[];
|
|
123
|
-
minLines?: number;
|
|
124
|
-
nameRegex?: string;
|
|
125
|
-
}): SimilarityResult[];
|
|
126
|
-
sourceFunctions(filter: CrossSearchSourceFilter): Promise<IndexedFunction[]>;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
type SupportedLanguage = "python" | "javascript" | "jsx" | "typescript" | "tsx" | "rust" | "go" | "java" | "c";
|
|
130
|
-
type CallableKind = "function" | "method" | "constructor" | "generator";
|
|
131
|
-
type SourceMode = "git" | "working-tree";
|
|
132
|
-
interface IndexingIssue {
|
|
133
|
-
path: string;
|
|
134
|
-
language: SupportedLanguage | null;
|
|
135
|
-
scope: "file" | "function";
|
|
136
|
-
code: "parse-error" | "parse-failed" | "extraction-error" | "read-error" | "file-too-large";
|
|
137
|
-
message: string;
|
|
138
|
-
qualifiedName: string | null;
|
|
139
|
-
startLine: number | null;
|
|
140
|
-
startColumn: number | null;
|
|
141
|
-
endLine: number | null;
|
|
142
|
-
endColumn: number | null;
|
|
143
|
-
source: string | null;
|
|
144
|
-
}
|
|
145
|
-
interface IndexingError extends IndexingIssue {
|
|
146
|
-
id: number;
|
|
147
|
-
sourceMode: SourceMode;
|
|
148
|
-
indexedCommit: string | null;
|
|
149
|
-
}
|
|
150
|
-
interface ParsedCallable {
|
|
151
|
-
path: string;
|
|
152
|
-
language: SupportedLanguage;
|
|
153
|
-
kind: CallableKind;
|
|
154
|
-
name: string;
|
|
155
|
-
qualifiedName: string;
|
|
156
|
-
signature: string | null;
|
|
157
|
-
identityKey: string;
|
|
158
|
-
startLine: number;
|
|
159
|
-
startColumn: number;
|
|
160
|
-
endLine: number;
|
|
161
|
-
endColumn: number;
|
|
162
|
-
lineCount: number;
|
|
163
|
-
source: string;
|
|
164
|
-
sourceHash: string;
|
|
165
|
-
embeddingInput: string;
|
|
166
|
-
}
|
|
167
|
-
interface IndexedFunction extends ParsedCallable {
|
|
168
|
-
id: number;
|
|
169
|
-
firstSeenCommit: string | null;
|
|
170
|
-
lastSeenCommit: string | null;
|
|
171
|
-
sourceMode: SourceMode;
|
|
172
|
-
embeddingId: number;
|
|
173
|
-
description: string | null;
|
|
174
|
-
descriptionEmbeddingId: number | null;
|
|
175
|
-
}
|
|
176
|
-
interface EmbeddingProfile {
|
|
177
|
-
provider: "openai" | "jina" | string;
|
|
178
|
-
model: string;
|
|
179
|
-
dimensions: number;
|
|
180
|
-
strategyVersion?: string;
|
|
181
|
-
}
|
|
182
|
-
interface EmbeddingProvider {
|
|
183
|
-
readonly profile: EmbeddingProfile;
|
|
184
|
-
embedDocuments(inputs: readonly string[], options?: {
|
|
185
|
-
signal?: AbortSignal;
|
|
186
|
-
}): Promise<number[][]>;
|
|
187
|
-
embedQuery(input: string, options?: {
|
|
188
|
-
signal?: AbortSignal;
|
|
189
|
-
}): Promise<number[]>;
|
|
190
|
-
}
|
|
191
|
-
interface RerankerProfile {
|
|
192
|
-
provider: string;
|
|
193
|
-
model: string;
|
|
194
|
-
}
|
|
195
|
-
interface Reranker {
|
|
196
|
-
readonly profile: RerankerProfile;
|
|
197
|
-
/** Preferred embedding-ranked candidate pool size for this reranker. */
|
|
198
|
-
readonly candidateCount?: number;
|
|
199
|
-
/** Maximum candidate/result count accepted by this reranker. */
|
|
200
|
-
readonly maximumCandidateCount?: number;
|
|
201
|
-
rerank(query: string, documents: readonly string[], options?: {
|
|
202
|
-
limit?: number;
|
|
203
|
-
signal?: AbortSignal;
|
|
204
|
-
}): Promise<Array<{
|
|
205
|
-
index: number;
|
|
206
|
-
score: number;
|
|
207
|
-
}>>;
|
|
208
|
-
}
|
|
209
|
-
interface DescriptionProfile {
|
|
210
|
-
provider: string;
|
|
211
|
-
model: string;
|
|
212
|
-
strategyVersion: string;
|
|
213
|
-
}
|
|
214
|
-
interface DescriptionInput {
|
|
215
|
-
repository: string;
|
|
216
|
-
callable: ParsedCallable;
|
|
217
|
-
fileSource: string;
|
|
218
|
-
}
|
|
219
|
-
interface DescriptionFileInput {
|
|
220
|
-
repository: string;
|
|
221
|
-
path: string;
|
|
222
|
-
fileSource: string;
|
|
223
|
-
}
|
|
224
|
-
interface DescriptionFileSession {
|
|
225
|
-
describeFile(options?: {
|
|
226
|
-
signal?: AbortSignal;
|
|
227
|
-
}): Promise<string>;
|
|
228
|
-
replayFile(description: string): void;
|
|
229
|
-
describe(callable: ParsedCallable, options?: {
|
|
230
|
-
signal?: AbortSignal;
|
|
231
|
-
}): Promise<string>;
|
|
232
|
-
replay(callable: ParsedCallable, description: string): void;
|
|
233
|
-
}
|
|
234
|
-
interface DescriptionProvider {
|
|
235
|
-
readonly profile: DescriptionProfile;
|
|
236
|
-
describe(input: DescriptionInput, options?: {
|
|
237
|
-
signal?: AbortSignal;
|
|
238
|
-
}): Promise<string>;
|
|
239
|
-
describeFile(input: DescriptionFileInput, options?: {
|
|
240
|
-
signal?: AbortSignal;
|
|
241
|
-
}): Promise<string>;
|
|
242
|
-
startFile?(input: DescriptionFileInput): DescriptionFileSession;
|
|
243
|
-
}
|
|
244
|
-
interface DescriptionStats {
|
|
245
|
-
descriptionsCreated: number;
|
|
246
|
-
fileDescriptionsCreated: number;
|
|
247
|
-
descriptionsEnabled: boolean;
|
|
248
|
-
}
|
|
249
|
-
type IndexProgressPhase = "vectors" | "descriptions" | "description-vectors" | "similarity-cache" | "cross-search";
|
|
250
|
-
interface IndexProgress {
|
|
251
|
-
phase: IndexProgressPhase;
|
|
252
|
-
completed: number;
|
|
253
|
-
total: number;
|
|
254
|
-
}
|
|
255
|
-
interface CodeIndexOptions {
|
|
256
|
-
rootDir: string;
|
|
257
|
-
indexPath?: string;
|
|
258
|
-
provider: EmbeddingProvider;
|
|
259
|
-
/** Optional second-stage ranker for natural-language query searches. */
|
|
260
|
-
reranker?: Reranker;
|
|
261
|
-
descriptionProvider?: DescriptionProvider;
|
|
262
|
-
onWarning?: (message: string) => void;
|
|
263
|
-
/** Maximum number of concurrent provider requests for vectors and descriptions. */
|
|
264
|
-
parallelism?: number;
|
|
265
|
-
/** Receives vector and description generation progress updates. */
|
|
266
|
-
onProgress?: (progress: IndexProgress) => void;
|
|
267
|
-
include?: readonly string[];
|
|
268
|
-
exclude?: readonly string[];
|
|
269
|
-
maxFileSize?: number;
|
|
270
|
-
embeddingBatchSize?: number;
|
|
271
|
-
/** Emit a stderr notice for every call made by the default description provider. */
|
|
272
|
-
verbose?: boolean;
|
|
273
|
-
readOnly?: boolean;
|
|
274
|
-
}
|
|
275
|
-
interface UpdateFilesOptions {
|
|
276
|
-
upsert?: readonly string[];
|
|
277
|
-
delete?: readonly string[];
|
|
278
|
-
renames?: readonly {
|
|
279
|
-
from: string;
|
|
280
|
-
to: string;
|
|
281
|
-
}[];
|
|
282
|
-
signal?: AbortSignal;
|
|
283
|
-
}
|
|
284
|
-
interface UpdateFromGitOptions {
|
|
285
|
-
target?: string;
|
|
286
|
-
rebuildOnDivergence?: boolean;
|
|
287
|
-
includeWorkingTree?: boolean;
|
|
288
|
-
signal?: AbortSignal;
|
|
289
|
-
}
|
|
290
|
-
interface UpdateFromWorkingTreeOptions {
|
|
291
|
-
signal?: AbortSignal;
|
|
292
|
-
}
|
|
293
|
-
interface UpdateStats {
|
|
294
|
-
filesUpdated: number;
|
|
295
|
-
filesDeleted: number;
|
|
296
|
-
functionsAdded: number;
|
|
297
|
-
functionsUpdated: number;
|
|
298
|
-
functionsDeleted: number;
|
|
299
|
-
embeddingsCreated: number;
|
|
300
|
-
checkpoint: string | null;
|
|
301
|
-
}
|
|
302
|
-
interface ReindexFilesOptions {
|
|
303
|
-
includeCallables?: boolean;
|
|
304
|
-
signal?: AbortSignal;
|
|
305
|
-
}
|
|
306
|
-
interface ReindexFilesStats {
|
|
307
|
-
filesReindexed: number;
|
|
308
|
-
fileDescriptionsCreated: number;
|
|
309
|
-
descriptionsCreated: number;
|
|
310
|
-
}
|
|
311
|
-
interface SimilaritySearchOptions {
|
|
312
|
-
query: string;
|
|
313
|
-
/** Restrict result qualified names before ranking and limiting. */
|
|
314
|
-
nameRegex?: string;
|
|
315
|
-
limit?: number;
|
|
316
|
-
minSimilarity?: number;
|
|
317
|
-
maxSimilarity?: number;
|
|
318
|
-
signal?: AbortSignal;
|
|
319
|
-
}
|
|
320
|
-
interface SimilarityScores {
|
|
321
|
-
similarity: number;
|
|
322
|
-
codeSimilarity?: number;
|
|
323
|
-
descriptionSimilarity?: number;
|
|
324
|
-
fileDescriptionSimilarity?: number;
|
|
325
|
-
}
|
|
326
|
-
interface AnalysisSimilarity {
|
|
327
|
-
similarityMode: "code" | "code-description-file-average";
|
|
328
|
-
similarityWeights: {
|
|
329
|
-
code: number;
|
|
330
|
-
description: number;
|
|
331
|
-
fileDescription: number;
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
interface SimilarityResult extends SimilarityScores {
|
|
335
|
-
function: IndexedFunction;
|
|
336
|
-
/** Provider relevance score when a second-stage reranker ordered this result. */
|
|
337
|
-
rerankScore?: number;
|
|
338
|
-
}
|
|
339
|
-
type CrossSearchSourceFilter = ({
|
|
340
|
-
type: "all";
|
|
341
|
-
path?: string;
|
|
342
|
-
} | {
|
|
343
|
-
type: "changed-since";
|
|
344
|
-
commit: string;
|
|
345
|
-
path?: string;
|
|
346
|
-
uncommitted?: boolean;
|
|
347
|
-
} | {
|
|
348
|
-
type: "uncommitted";
|
|
349
|
-
path?: string;
|
|
350
|
-
}) & {
|
|
351
|
-
/** Restrict source qualified names; does not restrict target candidates. */
|
|
352
|
-
nameRegex?: string;
|
|
353
|
-
};
|
|
354
|
-
interface CrossSearchOptions {
|
|
355
|
-
source: CodeIndex;
|
|
356
|
-
target?: CodeIndex;
|
|
357
|
-
sourceFilter?: CrossSearchSourceFilter;
|
|
358
|
-
limitPerFunction?: number;
|
|
359
|
-
minSimilarity?: number;
|
|
360
|
-
maxSimilarity?: number;
|
|
361
|
-
includeSymmetricDuplicates?: boolean;
|
|
362
|
-
crossFileOnly?: boolean;
|
|
363
|
-
/** Re-rank each source's semantic matches from greatest to least physical path distance. */
|
|
364
|
-
cohesion?: boolean;
|
|
365
|
-
minLines?: number;
|
|
366
|
-
nameRegex?: string;
|
|
367
|
-
signal?: AbortSignal;
|
|
368
|
-
onProgress?: (progress: {
|
|
369
|
-
completed: number;
|
|
370
|
-
total: number;
|
|
371
|
-
}) => void;
|
|
372
|
-
/** Receives similarity-cache fill progress; defaults to the source index's onProgress. */
|
|
373
|
-
onCacheProgress?: (progress: IndexProgress) => void;
|
|
374
|
-
}
|
|
375
|
-
interface CrossSearchMatch extends SimilarityResult {
|
|
376
|
-
/** Present when cohesion re-ranking is enabled. */
|
|
377
|
-
physicalDistance?: number;
|
|
378
|
-
}
|
|
379
|
-
interface CrossSearchResult {
|
|
380
|
-
source: IndexedFunction;
|
|
381
|
-
matches: CrossSearchMatch[];
|
|
382
|
-
scoring?: AnalysisSimilarity & {
|
|
383
|
-
sourceDescriptionProfile: DescriptionProfile | null;
|
|
384
|
-
targetDescriptionProfile: DescriptionProfile | null;
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
type CohesionLocationCategory = "same-file" | "same-folder" | "different-folder";
|
|
388
|
-
interface CohesionLocation {
|
|
389
|
-
category: CohesionLocationCategory;
|
|
390
|
-
physicalDistance: number;
|
|
391
|
-
folderHops: number;
|
|
392
|
-
commonAncestor: string | null;
|
|
393
|
-
sourceTestPair: boolean;
|
|
394
|
-
}
|
|
395
|
-
interface CohesionFunctionReference {
|
|
396
|
-
path: string;
|
|
397
|
-
qualifiedName: string;
|
|
398
|
-
kind: CallableKind;
|
|
399
|
-
signature: string | null;
|
|
400
|
-
startLine: number;
|
|
401
|
-
startColumn: number;
|
|
402
|
-
endLine: number;
|
|
403
|
-
endColumn: number;
|
|
404
|
-
lineCount: number;
|
|
405
|
-
source?: string;
|
|
406
|
-
}
|
|
407
|
-
interface CohesionPair<FunctionValue = IndexedFunction> extends SimilarityScores {
|
|
408
|
-
rank: number;
|
|
409
|
-
left: FunctionValue;
|
|
410
|
-
right: FunctionValue;
|
|
411
|
-
reciprocal: boolean | null;
|
|
412
|
-
semanticWeight: number;
|
|
413
|
-
separationWeight: number;
|
|
414
|
-
cohesionGap: number;
|
|
415
|
-
location: CohesionLocation;
|
|
416
|
-
}
|
|
417
|
-
interface CohesionFileReport<FunctionValue = IndexedFunction> {
|
|
418
|
-
path: string;
|
|
419
|
-
functionCount: number;
|
|
420
|
-
internalAffinity: number;
|
|
421
|
-
sameFolderAffinity: number;
|
|
422
|
-
externalAffinity: number;
|
|
423
|
-
externalAffinityRatio: number;
|
|
424
|
-
strongestExternalMatch?: SimilarityScores & {
|
|
425
|
-
function: FunctionValue;
|
|
426
|
-
cohesionGap: number;
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
interface CohesionGroup<FunctionValue = IndexedFunction> {
|
|
430
|
-
rank: number;
|
|
431
|
-
memberCount: number;
|
|
432
|
-
fileCount: number;
|
|
433
|
-
minimumEdgeSimilarity: number;
|
|
434
|
-
maximumEdgeSimilarity: number;
|
|
435
|
-
maximumPhysicalDistance: number;
|
|
436
|
-
maximumCohesionGap: number;
|
|
437
|
-
members: FunctionValue[];
|
|
438
|
-
}
|
|
439
|
-
interface CohesionMetrics {
|
|
440
|
-
scope: "repository" | "selected-sources";
|
|
441
|
-
functionsAnalyzed: number;
|
|
442
|
-
candidateFunctions: number;
|
|
443
|
-
semanticEdges: number;
|
|
444
|
-
sameFileRatio: number;
|
|
445
|
-
sameFolderRatio: number;
|
|
446
|
-
remoteRatio: number;
|
|
447
|
-
weightedMeanDistance: number;
|
|
448
|
-
}
|
|
449
|
-
interface CohesionAnalysisOptions {
|
|
450
|
-
source: CodeIndex;
|
|
451
|
-
sourceFilter?: CrossSearchSourceFilter;
|
|
452
|
-
neighbors?: number;
|
|
453
|
-
limit?: number;
|
|
454
|
-
minSimilarity?: number;
|
|
455
|
-
maxSimilarity?: number;
|
|
456
|
-
minLines?: number;
|
|
457
|
-
nameRegex?: string;
|
|
458
|
-
signal?: AbortSignal;
|
|
459
|
-
onProgress?: (progress: {
|
|
460
|
-
completed: number;
|
|
461
|
-
total: number;
|
|
462
|
-
}) => void;
|
|
463
|
-
/** Receives similarity-cache fill progress; defaults to the source index's onProgress. */
|
|
464
|
-
onCacheProgress?: (progress: IndexProgress) => void;
|
|
465
|
-
}
|
|
466
|
-
interface CohesionReport<FunctionValue = IndexedFunction> {
|
|
467
|
-
schemaVersion: 3;
|
|
468
|
-
repository: {
|
|
469
|
-
generation: number;
|
|
470
|
-
gitCheckpoint: string | null;
|
|
471
|
-
embeddingProfile: Required<EmbeddingProfile>;
|
|
472
|
-
descriptionProfile: DescriptionProfile | null;
|
|
473
|
-
};
|
|
474
|
-
parameters: AnalysisSimilarity & {
|
|
475
|
-
neighbors: number;
|
|
476
|
-
limit: number;
|
|
477
|
-
minSimilarity: number;
|
|
478
|
-
maxSimilarity?: number;
|
|
479
|
-
minLines: number;
|
|
480
|
-
nameRegex?: string;
|
|
481
|
-
sourceFilter: CrossSearchSourceFilter;
|
|
482
|
-
};
|
|
483
|
-
metrics: CohesionMetrics;
|
|
484
|
-
pairs: CohesionPair<FunctionValue>[];
|
|
485
|
-
files: CohesionFileReport<FunctionValue>[];
|
|
486
|
-
groups: CohesionGroup<FunctionValue>[];
|
|
487
|
-
}
|
|
488
|
-
type CohesionJsonReport = CohesionReport<CohesionFunctionReference>;
|
|
489
|
-
interface IndexStatus {
|
|
490
|
-
rootDir: string;
|
|
491
|
-
indexPath: string;
|
|
492
|
-
functionCount: number;
|
|
493
|
-
fileCount: number;
|
|
494
|
-
generation: number;
|
|
495
|
-
gitCheckpoint: string | null;
|
|
496
|
-
embeddingProfile: Required<EmbeddingProfile>;
|
|
497
|
-
descriptionsEnabled: boolean;
|
|
498
|
-
descriptionCount: number;
|
|
499
|
-
fileDescriptionCount: number;
|
|
500
|
-
describableFileCount: number;
|
|
501
|
-
staleFileDescriptionCount: number;
|
|
502
|
-
descriptionProfile: DescriptionProfile | null;
|
|
503
|
-
indexingErrorCount: number;
|
|
504
|
-
failedFileCount: number;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
declare function readIndexErrors(indexPath: string): IndexingError[];
|
|
508
|
-
|
|
509
|
-
declare function analyzeCohesion(options: CohesionAnalysisOptions): Promise<CohesionReport>;
|
|
510
|
-
declare function cohesionLocation(leftPath: string, rightPath: string): CohesionLocation;
|
|
511
|
-
|
|
512
|
-
declare function crossSearch(options: CrossSearchOptions): AsyncGenerator<CrossSearchResult>;
|
|
513
|
-
|
|
514
|
-
interface OpenAIEmbeddingProviderOptions {
|
|
515
|
-
apiKey?: string;
|
|
516
|
-
model?: string;
|
|
517
|
-
dimensions?: number;
|
|
518
|
-
baseUrl?: string;
|
|
519
|
-
verbose?: boolean;
|
|
520
|
-
parallelism?: number;
|
|
521
|
-
}
|
|
522
|
-
declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
|
|
523
|
-
#private;
|
|
524
|
-
readonly profile: {
|
|
525
|
-
readonly provider: "openai";
|
|
526
|
-
readonly model: string;
|
|
527
|
-
readonly dimensions: number;
|
|
528
|
-
readonly strategyVersion: "callable-v2";
|
|
529
|
-
};
|
|
530
|
-
constructor(options?: OpenAIEmbeddingProviderOptions);
|
|
531
|
-
embedDocuments(inputs: readonly string[], options?: {
|
|
532
|
-
signal?: AbortSignal;
|
|
533
|
-
}): Promise<number[][]>;
|
|
534
|
-
embedQuery(input: string, options?: {
|
|
535
|
-
signal?: AbortSignal;
|
|
536
|
-
}): Promise<number[]>;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
interface OpenAIDescriptionProviderOptions {
|
|
540
|
-
apiKey?: string;
|
|
541
|
-
model?: string;
|
|
542
|
-
baseUrl?: string;
|
|
543
|
-
provider?: DescriptionProviderName;
|
|
544
|
-
verbose?: boolean;
|
|
545
|
-
retryDelayMs?: number;
|
|
546
|
-
parallelism?: number;
|
|
547
|
-
}
|
|
548
|
-
declare const DESCRIPTION_PROVIDER_NAMES: readonly ["openai", "opencode", "opencode-go"];
|
|
549
|
-
type DescriptionProviderName = typeof DESCRIPTION_PROVIDER_NAMES[number];
|
|
550
|
-
declare class OpenAIDescriptionProvider implements DescriptionProvider {
|
|
551
|
-
#private;
|
|
552
|
-
readonly profile: {
|
|
553
|
-
provider: "openai" | "opencode" | "opencode-go";
|
|
554
|
-
model: string;
|
|
555
|
-
strategyVersion: string;
|
|
556
|
-
};
|
|
557
|
-
constructor(options?: OpenAIDescriptionProviderOptions);
|
|
558
|
-
describe(input: DescriptionInput, options?: {
|
|
559
|
-
signal?: AbortSignal;
|
|
560
|
-
}): Promise<string>;
|
|
561
|
-
describeFile(input: DescriptionFileInput, options?: {
|
|
562
|
-
signal?: AbortSignal;
|
|
563
|
-
}): Promise<string>;
|
|
564
|
-
startFile(input: DescriptionFileInput): DescriptionFileSession;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
interface JinaEmbeddingProviderOptions {
|
|
568
|
-
apiKey?: string;
|
|
569
|
-
model?: string;
|
|
570
|
-
dimensions?: number;
|
|
571
|
-
baseUrl?: string;
|
|
572
|
-
verbose?: boolean;
|
|
573
|
-
parallelism?: number;
|
|
574
|
-
}
|
|
575
|
-
declare class JinaEmbeddingProvider implements EmbeddingProvider {
|
|
576
|
-
#private;
|
|
577
|
-
readonly profile: {
|
|
578
|
-
readonly provider: "jina";
|
|
579
|
-
readonly model: string;
|
|
580
|
-
readonly dimensions: number;
|
|
581
|
-
readonly strategyVersion: "callable-v2:code-query-passage";
|
|
582
|
-
};
|
|
583
|
-
constructor(options?: JinaEmbeddingProviderOptions);
|
|
584
|
-
embedDocuments(inputs: readonly string[], options?: {
|
|
585
|
-
signal?: AbortSignal;
|
|
586
|
-
}): Promise<number[][]>;
|
|
587
|
-
embedQuery(input: string, options?: {
|
|
588
|
-
signal?: AbortSignal;
|
|
589
|
-
}): Promise<number[]>;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
interface HostedRerankerOptions {
|
|
593
|
-
apiKey?: string;
|
|
594
|
-
model?: string;
|
|
595
|
-
baseUrl?: string;
|
|
596
|
-
verbose?: boolean;
|
|
597
|
-
}
|
|
598
|
-
interface HostedRerankerSettings {
|
|
599
|
-
provider: "cohere" | "jina";
|
|
600
|
-
apiKeyName: "COHERE_API_KEY" | "JINA_API_KEY";
|
|
601
|
-
defaultModel: string;
|
|
602
|
-
defaultUrl: string;
|
|
603
|
-
returnDocuments?: boolean;
|
|
604
|
-
}
|
|
605
|
-
declare abstract class HostedReranker implements Reranker {
|
|
606
|
-
#private;
|
|
607
|
-
readonly profile: {
|
|
608
|
-
readonly provider: "jina" | "cohere";
|
|
609
|
-
readonly model: string;
|
|
610
|
-
};
|
|
611
|
-
protected constructor(options: HostedRerankerOptions, settings: HostedRerankerSettings);
|
|
612
|
-
rerank(query: string, documents: readonly string[], options?: {
|
|
613
|
-
limit?: number;
|
|
614
|
-
signal?: AbortSignal;
|
|
615
|
-
}): Promise<Array<{
|
|
616
|
-
index: number;
|
|
617
|
-
score: number;
|
|
618
|
-
}>>;
|
|
619
|
-
}
|
|
620
|
-
type CohereRerankerOptions = HostedRerankerOptions;
|
|
621
|
-
declare class CohereReranker extends HostedReranker {
|
|
622
|
-
constructor(options?: CohereRerankerOptions);
|
|
623
|
-
}
|
|
624
|
-
type JinaRerankerOptions = HostedRerankerOptions;
|
|
625
|
-
declare class JinaReranker extends HostedReranker {
|
|
626
|
-
constructor(options?: JinaRerankerOptions);
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
interface OpenAILLMRerankerOptions {
|
|
630
|
-
apiKey?: string;
|
|
631
|
-
model?: string;
|
|
632
|
-
baseUrl?: string;
|
|
633
|
-
candidateCount?: number;
|
|
634
|
-
verbose?: boolean;
|
|
635
|
-
}
|
|
636
|
-
declare class OpenAILLMReranker implements Reranker {
|
|
637
|
-
#private;
|
|
638
|
-
readonly profile: {
|
|
639
|
-
readonly provider: "openai";
|
|
640
|
-
readonly model: string;
|
|
641
|
-
};
|
|
642
|
-
readonly candidateCount: number;
|
|
643
|
-
readonly maximumCandidateCount = 100;
|
|
644
|
-
constructor(options?: OpenAILLMRerankerOptions);
|
|
645
|
-
rerank(query: string, documents: readonly string[], options?: {
|
|
646
|
-
limit?: number;
|
|
647
|
-
signal?: AbortSignal;
|
|
648
|
-
}): Promise<Array<{
|
|
649
|
-
index: number;
|
|
650
|
-
score: number;
|
|
651
|
-
}>>;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
declare class CodeIndexError extends Error {
|
|
655
|
-
constructor(message: string, options?: ErrorOptions);
|
|
656
|
-
}
|
|
657
|
-
declare class GitDivergenceError extends CodeIndexError {
|
|
658
|
-
constructor(checkpoint: string, target: string);
|
|
659
|
-
}
|
|
660
|
-
declare class GitUnavailableError extends CodeIndexError {
|
|
661
|
-
constructor(message: string, options?: ErrorOptions);
|
|
662
|
-
}
|
|
663
|
-
declare class IncompatibleIndexError extends CodeIndexError {
|
|
664
|
-
constructor(message: string);
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
declare function openCodeIndex(options: CodeIndexOptions): CodeIndex;
|
|
668
|
-
declare function updateFiles(index: CodeIndex, options: UpdateFilesOptions): Promise<UpdateStats>;
|
|
669
|
-
declare function updateFromGit(index: CodeIndex, options?: UpdateFromGitOptions): Promise<UpdateStats>;
|
|
670
|
-
declare function updateFromWorkingTree(index: CodeIndex, options?: UpdateFromWorkingTreeOptions): Promise<UpdateStats>;
|
|
671
|
-
declare function reindexFiles(index: CodeIndex, options?: ReindexFilesOptions): Promise<ReindexFilesStats>;
|
|
672
|
-
declare function similaritySearch(index: CodeIndex, options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
673
|
-
declare function useDescriptions(index: CodeIndex, options?: {
|
|
674
|
-
signal?: AbortSignal;
|
|
675
|
-
}): Promise<DescriptionStats>;
|
|
676
|
-
declare function disableDescriptions(index: CodeIndex): DescriptionStats;
|
|
677
|
-
declare function searchDescription(index: CodeIndex, options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
678
|
-
declare function crossSearchFunctions(options: CrossSearchOptions): AsyncGenerator<CrossSearchResult, any, any>;
|
|
679
|
-
declare function analyzeCodeCohesion(options: CohesionAnalysisOptions): Promise<CohesionReport<IndexedFunction>>;
|
|
680
|
-
|
|
681
|
-
export { type AnalysisSimilarity, type CallableKind, CodeIndex, CodeIndexError, type CodeIndexOptions, CohereReranker, type CohereRerankerOptions, type CohesionAnalysisOptions, type CohesionFileReport, type CohesionFunctionReference, type CohesionGroup, type CohesionJsonReport, type CohesionLocation, type CohesionLocationCategory, type CohesionMetrics, type CohesionPair, type CohesionReport, type CrossSearchMatch, type CrossSearchOptions, type CrossSearchResult, type CrossSearchSourceFilter, type DescriptionFileInput, type DescriptionFileSession, type DescriptionInput, type DescriptionProfile, type DescriptionProvider, type DescriptionProviderName, type DescriptionStats, type EmbeddingProfile, type EmbeddingProvider, GitDivergenceError, GitUnavailableError, IncompatibleIndexError, type IndexProgress, type IndexProgressPhase, type IndexStatus, type IndexedFunction, type IndexingError, type IndexingIssue, JinaEmbeddingProvider, type JinaEmbeddingProviderOptions, JinaReranker, type JinaRerankerOptions, OpenAIDescriptionProvider, type OpenAIDescriptionProviderOptions, OpenAIEmbeddingProvider, type OpenAIEmbeddingProviderOptions, OpenAILLMReranker, type OpenAILLMRerankerOptions, type ParsedCallable, type ReindexFilesOptions, type ReindexFilesStats, type Reranker, type RerankerProfile, type SimilarityResult, type SimilarityScores, type SimilaritySearchOptions, type SourceMode, type SupportedLanguage, type UpdateFilesOptions, type UpdateFromGitOptions, type UpdateFromWorkingTreeOptions, type UpdateStats, analyzeCodeCohesion, analyzeCohesion, cohesionLocation, crossSearch, crossSearchFunctions, disableDescriptions, openCodeIndex, readIndexErrors, reindexFiles, searchDescription, similaritySearch, updateFiles, updateFromGit, updateFromWorkingTree, useDescriptions };
|