@wrongstack/tools 1.0.0 → 1.0.2
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/dist/auto-proceed-loop-guard.d.ts +1 -1
- package/dist/auto-proceed-loop-guard.js +1 -1
- package/dist/bash.js +1 -1
- package/dist/builtin.js +15 -15
- package/dist/{chunk-VVZPQPTY.js → chunk-3AU6CZWL.js} +4 -2
- package/dist/{chunk-N3K2SFEI.js → chunk-52UXXQMP.js} +1408 -200
- package/dist/{chunk-NN2SNP2R.js → chunk-6H4ERJP7.js} +137 -21
- package/dist/{chunk-DK4J2WMH.js → chunk-7XUEPBNT.js} +2 -2
- package/dist/{chunk-IYH4OHBP.js → chunk-DKHMPKDG.js} +2 -2
- package/dist/{chunk-NU2IZ72J.js → chunk-DL2ARI4S.js} +7 -5
- package/dist/{chunk-M6UV67BH.js → chunk-EL2NJXSK.js} +2 -2
- package/dist/{chunk-YEISRT4S.js → chunk-HWXIRVKH.js} +1408 -235
- package/dist/{chunk-GKSG5CPH.js → chunk-KVTEIUND.js} +2 -2
- package/dist/{chunk-GDDXX27P.js → chunk-MBR5VAB5.js} +2 -2
- package/dist/{chunk-KDEXUQY7.js → chunk-MGPR7VG3.js} +261 -258
- package/dist/{chunk-YULVUTK5.js → chunk-NFX2IUQA.js} +3 -3
- package/dist/{chunk-37QKUQ2Z.js → chunk-NL2S2CXD.js} +1 -1
- package/dist/{chunk-ZTCJCYLN.js → chunk-TI5COGLY.js} +49 -6
- package/dist/{chunk-CGXTR34H.js → chunk-TU5MTW2S.js} +2 -2
- package/dist/{chunk-AB2CAUOP.js → chunk-UCXFTCAI.js} +186 -36
- package/dist/{chunk-MK2JK35J.js → chunk-UOYRAS4J.js} +3 -3
- package/dist/{chunk-UCYQTZ7F.js → chunk-ZKC5UNGD.js} +56 -2
- package/dist/codebase-index/atlas-brief.d.ts +90 -0
- package/dist/codebase-index/atlas-export.d.ts +38 -0
- package/dist/codebase-index/atlas-projection.d.ts +114 -0
- package/dist/codebase-index/atlas-types.d.ts +90 -0
- package/dist/codebase-index/background-indexer.d.ts +15 -4
- package/dist/codebase-index/codebase-context-tool.d.ts +54 -0
- package/dist/codebase-index/concept-enrichment.d.ts +154 -0
- package/dist/codebase-index/context-retrieval.d.ts +91 -0
- package/dist/codebase-index/embedding-pass.d.ts +95 -0
- package/dist/codebase-index/graph-adjacency-cache.d.ts +36 -0
- package/dist/codebase-index/graph-rank-pass.d.ts +46 -0
- package/dist/codebase-index/graph-rank.d.ts +198 -0
- package/dist/codebase-index/index-service.d.ts +15 -1
- package/dist/codebase-index/index.d.ts +34 -19
- package/dist/codebase-index/index.js +126 -9
- package/dist/codebase-index/parser-worker-script.js +3 -3
- package/dist/codebase-index/perf-metrics.d.ts +19 -0
- package/dist/codebase-index/project-server-protocol.d.ts +2 -0
- package/dist/codebase-index/project-server-query-cache.d.ts +4 -0
- package/dist/codebase-index/project-server.js +54 -7
- package/dist/codebase-index/repo-map-fallback.d.ts +18 -0
- package/dist/codebase-index/repo-map-render.d.ts +42 -0
- package/dist/codebase-index/repo-map-types.d.ts +21 -0
- package/dist/codebase-index/repo-map.d.ts +28 -16
- package/dist/codebase-index/schema.d.ts +20 -0
- package/dist/codebase-index/worker-protocol.d.ts +47 -1
- package/dist/codebase-index/worker.js +11 -5
- package/dist/codebase-index/writer-concepts.d.ts +84 -0
- package/dist/codebase-index/writer-graph-decorate.d.ts +30 -0
- package/dist/codebase-index/writer-graph-reader.d.ts +22 -0
- package/dist/codebase-index/writer-rank.d.ts +78 -0
- package/dist/codebase-index/writer-schema.d.ts +51 -0
- package/dist/codebase-index/writer-vectors.d.ts +53 -0
- package/dist/codebase-index/writer.d.ts +59 -0
- package/dist/edit.js +7 -7
- package/dist/exec.js +1 -1
- package/dist/{go-parser-D7ELWQ7F.js → go-parser-QIEXU3P2.js} +4 -2
- package/dist/index.d.ts +48 -48
- package/dist/index.js +43 -19
- package/dist/pack.js +16 -16
- package/dist/{parser-dispatch-BDVCJXTV.js → parser-dispatch-37FT3EXQ.js} +4 -4
- package/dist/patch.js +7 -7
- package/dist/{py-parser-QC6MR4GB.js → py-parser-6GJTGUXK.js} +3 -3
- package/dist/read.js +7 -7
- package/dist/replace.js +7 -7
- package/dist/tool-tier.js +17 -17
- package/dist/write.js +7 -7
- package/package.json +5 -5
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ATLAS_DIR,
|
|
3
|
+
ATLAS_FILE_LIMIT,
|
|
4
|
+
ATLAS_JSON,
|
|
5
|
+
ATLAS_MANIFEST,
|
|
6
|
+
ATLAS_MARKDOWN,
|
|
7
|
+
ATLAS_SCHEMA,
|
|
8
|
+
BRIEF_HUB_LIMIT,
|
|
9
|
+
BRIEF_PACKAGE_LIMIT,
|
|
10
|
+
BRIEF_SUBSYSTEM_LIMIT,
|
|
11
|
+
DEFAULT_BATCH_SIZE,
|
|
12
|
+
DEFAULT_CONCURRENCY,
|
|
13
|
+
EXPORT_FILE_LIMIT,
|
|
14
|
+
EXPORT_PACKAGE_LIMIT,
|
|
15
|
+
MAX_CRUX_LINES,
|
|
16
|
+
MAX_EMBED_CHARS,
|
|
17
|
+
MAX_REPORTED_DRIFT,
|
|
18
|
+
MAX_SOURCE_CHARS,
|
|
19
|
+
MAX_SUMMARY_CHARS,
|
|
2
20
|
PolyglotInvariantEngine,
|
|
21
|
+
buildAtlas,
|
|
22
|
+
buildAtlasBrief,
|
|
23
|
+
buildProjectAtlasBrief,
|
|
24
|
+
checkAtlasFreshness,
|
|
25
|
+
checkProjectAtlasFreshness,
|
|
3
26
|
codebaseAstReplaceTool,
|
|
27
|
+
codebaseContextTool,
|
|
4
28
|
codebaseImpactAnalysisTool,
|
|
5
29
|
codebaseIncomingCallsTool,
|
|
6
30
|
codebaseIndexTool,
|
|
@@ -12,13 +36,22 @@ import {
|
|
|
12
36
|
codebaseStatsTool,
|
|
13
37
|
codebaseTargetedTestTool,
|
|
14
38
|
deadCodeScanTool,
|
|
39
|
+
embedFiles,
|
|
40
|
+
embedProjectFiles,
|
|
41
|
+
enrichConcepts,
|
|
42
|
+
enrichProjectConcepts,
|
|
43
|
+
exportProjectAtlasHtml,
|
|
15
44
|
extractDirectorySkeleton,
|
|
16
45
|
extractFileSkeleton,
|
|
17
46
|
generateRepoMap,
|
|
18
47
|
polyglotInvariantEngine,
|
|
48
|
+
renderAtlasHtml,
|
|
19
49
|
replaceSymbolInFile,
|
|
20
|
-
runDeadCodeScan
|
|
21
|
-
|
|
50
|
+
runDeadCodeScan,
|
|
51
|
+
setContextQueryEmbedder,
|
|
52
|
+
writeAtlas,
|
|
53
|
+
writeProjectAtlas
|
|
54
|
+
} from "../chunk-HWXIRVKH.js";
|
|
22
55
|
import "../chunk-XRNN44QY.js";
|
|
23
56
|
import "../chunk-DRRY6SCM.js";
|
|
24
57
|
import "../chunk-SCMRM6NL.js";
|
|
@@ -45,32 +78,58 @@ import {
|
|
|
45
78
|
shutdownCodebaseIndexHost,
|
|
46
79
|
shutdownCodebaseIndexServer,
|
|
47
80
|
symbolGraphService
|
|
48
|
-
} from "../chunk-
|
|
81
|
+
} from "../chunk-TI5COGLY.js";
|
|
49
82
|
import {
|
|
50
83
|
projectIndexServerEndpoint,
|
|
51
84
|
projectIndexServerMetadataPath
|
|
52
|
-
} from "../chunk-
|
|
85
|
+
} from "../chunk-MBR5VAB5.js";
|
|
53
86
|
import {
|
|
87
|
+
CONCEPT_RELATIONS,
|
|
88
|
+
CONTRADICTED_VISIBILITY_WEIGHT,
|
|
54
89
|
CircuitOpenError,
|
|
90
|
+
DEFAULT_ITERATIONS,
|
|
91
|
+
DEFAULT_LIMIT,
|
|
92
|
+
DEFAULT_RESTART,
|
|
93
|
+
DEFAULT_SYMBOLS_PER_FILE,
|
|
94
|
+
FILE_VECTOR_PROVIDER_KEY,
|
|
55
95
|
IndexCircuitBreaker,
|
|
56
96
|
IndexStore,
|
|
57
97
|
IndexTimeoutError,
|
|
98
|
+
RANK_REFRESH_FILE_THRESHOLD,
|
|
99
|
+
RANK_VERSION,
|
|
100
|
+
RANK_VERSION_KEY,
|
|
58
101
|
SCHEMA_VERSION,
|
|
102
|
+
SEED_LIMIT,
|
|
103
|
+
UNVERIFIED_VISIBILITY_WEIGHT,
|
|
104
|
+
aggregateFileRank,
|
|
59
105
|
buildBm25Index,
|
|
60
106
|
buildIndexableText,
|
|
107
|
+
buildWiringGraph,
|
|
108
|
+
clearWiringSnapshot,
|
|
61
109
|
codebaseIndexDirOverride,
|
|
110
|
+
decorateGraphNodes,
|
|
111
|
+
getWiringSnapshot,
|
|
62
112
|
indexCircuitBreaker,
|
|
63
113
|
internalKindToLspKind,
|
|
114
|
+
isConceptRelation,
|
|
64
115
|
lspKindToInternalKind,
|
|
116
|
+
pageRank,
|
|
65
117
|
resetIndexCircuitBreaker,
|
|
66
118
|
resolveIndexDir,
|
|
119
|
+
retrieveContext,
|
|
120
|
+
runGraphRankPass,
|
|
67
121
|
runIndexer,
|
|
122
|
+
shouldRefreshRanks,
|
|
123
|
+
toSymbolRankRows,
|
|
68
124
|
tokenise
|
|
69
|
-
} from "../chunk-
|
|
70
|
-
import "../chunk-
|
|
71
|
-
import "../chunk-
|
|
125
|
+
} from "../chunk-52UXXQMP.js";
|
|
126
|
+
import "../chunk-DL2ARI4S.js";
|
|
127
|
+
import "../chunk-3AU6CZWL.js";
|
|
72
128
|
import "../chunk-6IEBD27U.js";
|
|
73
|
-
import
|
|
129
|
+
import {
|
|
130
|
+
getCodebaseIndexPerfSnapshot,
|
|
131
|
+
resetCodebaseIndexPerfMetrics
|
|
132
|
+
} from "../chunk-ZKC5UNGD.js";
|
|
74
133
|
import {
|
|
75
134
|
INDEXABLE_EXTENSIONS,
|
|
76
135
|
detectLang,
|
|
@@ -83,18 +142,57 @@ import {
|
|
|
83
142
|
import "../chunk-KE7A76VC.js";
|
|
84
143
|
import "../chunk-ZUFHAHTE.js";
|
|
85
144
|
export {
|
|
145
|
+
ATLAS_DIR,
|
|
146
|
+
ATLAS_FILE_LIMIT,
|
|
147
|
+
ATLAS_JSON,
|
|
148
|
+
ATLAS_MANIFEST,
|
|
149
|
+
ATLAS_MARKDOWN,
|
|
150
|
+
ATLAS_SCHEMA,
|
|
151
|
+
BRIEF_HUB_LIMIT,
|
|
152
|
+
BRIEF_PACKAGE_LIMIT,
|
|
153
|
+
BRIEF_SUBSYSTEM_LIMIT,
|
|
154
|
+
CONCEPT_RELATIONS,
|
|
155
|
+
CONTRADICTED_VISIBILITY_WEIGHT,
|
|
86
156
|
CircuitOpenError,
|
|
157
|
+
DEFAULT_BATCH_SIZE,
|
|
158
|
+
DEFAULT_CONCURRENCY,
|
|
159
|
+
DEFAULT_ITERATIONS,
|
|
160
|
+
DEFAULT_LIMIT,
|
|
161
|
+
DEFAULT_RESTART,
|
|
162
|
+
DEFAULT_SYMBOLS_PER_FILE,
|
|
163
|
+
EXPORT_FILE_LIMIT,
|
|
164
|
+
EXPORT_PACKAGE_LIMIT,
|
|
165
|
+
FILE_VECTOR_PROVIDER_KEY,
|
|
87
166
|
INDEXABLE_EXTENSIONS,
|
|
88
167
|
IndexCircuitBreaker,
|
|
89
168
|
IndexStore,
|
|
90
169
|
IndexTimeoutError,
|
|
170
|
+
MAX_CRUX_LINES,
|
|
171
|
+
MAX_EMBED_CHARS,
|
|
172
|
+
MAX_REPORTED_DRIFT,
|
|
173
|
+
MAX_SOURCE_CHARS,
|
|
174
|
+
MAX_SUMMARY_CHARS,
|
|
91
175
|
PolyglotInvariantEngine,
|
|
176
|
+
RANK_REFRESH_FILE_THRESHOLD,
|
|
177
|
+
RANK_VERSION,
|
|
178
|
+
RANK_VERSION_KEY,
|
|
92
179
|
SCHEMA_VERSION,
|
|
180
|
+
SEED_LIMIT,
|
|
181
|
+
UNVERIFIED_VISIBILITY_WEIGHT,
|
|
182
|
+
aggregateFileRank,
|
|
183
|
+
buildAtlas,
|
|
184
|
+
buildAtlasBrief,
|
|
93
185
|
buildBm25Index,
|
|
94
186
|
buildIndexableText,
|
|
187
|
+
buildProjectAtlasBrief,
|
|
188
|
+
buildWiringGraph,
|
|
95
189
|
cancelPendingReindexes,
|
|
190
|
+
checkAtlasFreshness,
|
|
96
191
|
checkCodebaseIndexServerHealth,
|
|
192
|
+
checkProjectAtlasFreshness,
|
|
193
|
+
clearWiringSnapshot,
|
|
97
194
|
codebaseAstReplaceTool,
|
|
195
|
+
codebaseContextTool,
|
|
98
196
|
codebaseImpactAnalysisTool,
|
|
99
197
|
codebaseIncomingCallsTool,
|
|
100
198
|
codebaseIndexDirOverride,
|
|
@@ -109,17 +207,26 @@ export {
|
|
|
109
207
|
codebaseTargetedTestTool,
|
|
110
208
|
compileGitignore,
|
|
111
209
|
deadCodeScanTool,
|
|
210
|
+
decorateGraphNodes,
|
|
112
211
|
detectLang,
|
|
212
|
+
embedFiles,
|
|
213
|
+
embedProjectFiles,
|
|
113
214
|
enqueueReindex,
|
|
215
|
+
enrichConcepts,
|
|
216
|
+
enrichProjectConcepts,
|
|
114
217
|
ensureCodebaseIndexServer,
|
|
218
|
+
exportProjectAtlasHtml,
|
|
115
219
|
extractDirectorySkeleton,
|
|
116
220
|
extractFileSkeleton,
|
|
117
221
|
fileGraphService,
|
|
118
222
|
generateRepoMap,
|
|
223
|
+
getCodebaseIndexPerfSnapshot,
|
|
119
224
|
getIndexState,
|
|
225
|
+
getWiringSnapshot,
|
|
120
226
|
incomingCallsService,
|
|
121
227
|
indexCircuitBreaker,
|
|
122
228
|
internalKindToLspKind,
|
|
229
|
+
isConceptRelation,
|
|
123
230
|
isIndexReady,
|
|
124
231
|
isIndexableFile,
|
|
125
232
|
isIndexablePath,
|
|
@@ -129,20 +236,30 @@ export {
|
|
|
129
236
|
onIndexStateChange,
|
|
130
237
|
outgoingCallsService,
|
|
131
238
|
packageGraphService,
|
|
239
|
+
pageRank,
|
|
132
240
|
polyglotInvariantEngine,
|
|
133
241
|
projectIndexServerEndpoint,
|
|
134
242
|
projectIndexServerMetadataPath,
|
|
243
|
+
renderAtlasHtml,
|
|
135
244
|
replaceSymbolInFile,
|
|
245
|
+
resetCodebaseIndexPerfMetrics,
|
|
136
246
|
resetIndexCircuitBreaker,
|
|
137
247
|
resolveIndexDir,
|
|
138
248
|
resolveProjectIndexDaemonAvailability,
|
|
249
|
+
retrieveContext,
|
|
139
250
|
runDeadCodeScan,
|
|
251
|
+
runGraphRankPass,
|
|
140
252
|
runIndexer,
|
|
141
253
|
runStartupIndex,
|
|
142
254
|
searchCodebaseIndex,
|
|
255
|
+
setContextQueryEmbedder,
|
|
256
|
+
shouldRefreshRanks,
|
|
143
257
|
shutdownCodebaseIndexHost,
|
|
144
258
|
shutdownCodebaseIndexServer,
|
|
145
259
|
symbolGraphService,
|
|
146
|
-
|
|
260
|
+
toSymbolRankRows,
|
|
261
|
+
tokenise,
|
|
262
|
+
writeAtlas,
|
|
263
|
+
writeProjectAtlas
|
|
147
264
|
};
|
|
148
265
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFilesContent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-DL2ARI4S.js";
|
|
4
|
+
import "../chunk-3AU6CZWL.js";
|
|
5
5
|
import "../chunk-6IEBD27U.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-ZKC5UNGD.js";
|
|
7
7
|
import "../chunk-YOHO4DVT.js";
|
|
8
8
|
import "../chunk-KE7A76VC.js";
|
|
9
9
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Opt-in counters for controlled codebase-index performance measurements. */
|
|
2
|
+
export interface CodebaseIndexPerfSnapshot {
|
|
3
|
+
filesystemBytesRead: number;
|
|
4
|
+
filesystemReadCount: number;
|
|
5
|
+
parserGateWaitMs: number;
|
|
6
|
+
parserGateCalls: number;
|
|
7
|
+
parserSubprocessCount: number;
|
|
8
|
+
ipcPendingPeak: number;
|
|
9
|
+
writeQueueWaitMs: number;
|
|
10
|
+
writeQueueCalls: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function resetCodebaseIndexPerfMetrics(): void;
|
|
13
|
+
export declare function getCodebaseIndexPerfSnapshot(): CodebaseIndexPerfSnapshot;
|
|
14
|
+
export declare function recordFilesystemRead(bytes: number): void;
|
|
15
|
+
export declare function recordParserGateWait(waitMs: number): void;
|
|
16
|
+
export declare function recordParserSubprocess(): void;
|
|
17
|
+
export declare function recordIpcPending(depth: number): void;
|
|
18
|
+
export declare function recordWriteQueueWait(waitMs: number): void;
|
|
19
|
+
//# sourceMappingURL=perf-metrics.d.ts.map
|
|
@@ -37,6 +37,8 @@ export interface ProjectIndexServerHealth {
|
|
|
37
37
|
activeRequests: number;
|
|
38
38
|
activeWrites: number;
|
|
39
39
|
queuedWrites: number;
|
|
40
|
+
maxQueuedWrites?: number;
|
|
41
|
+
writeQueueWaitMs?: number;
|
|
40
42
|
pendingExternalFiles: number;
|
|
41
43
|
watchingExternal: boolean;
|
|
42
44
|
/** Clients currently requesting ownership of the shared external watcher. */
|
|
@@ -23,9 +23,11 @@
|
|
|
23
23
|
* transaction may have rolled back the visible generation) all caches are
|
|
24
24
|
* cleared.
|
|
25
25
|
*/
|
|
26
|
+
import type { ContextResult } from './context-retrieval.js';
|
|
26
27
|
import type { IncomingCallsResult, OutgoingCallsResult } from './index-service.js';
|
|
27
28
|
import { GenerationLruCache } from './project-server-cache.js';
|
|
28
29
|
import type { CodeMapGraph, IndexStats, SearchResult } from './schema.js';
|
|
30
|
+
import type { VectorSearchOpResult } from './worker-protocol.js';
|
|
29
31
|
/** The error the server answers a read it cannot serve with. */
|
|
30
32
|
export declare function indexRefreshInProgressError(currentFile: number, totalFiles: number): Error;
|
|
31
33
|
/**
|
|
@@ -76,6 +78,8 @@ export declare class ServerQueryCaches {
|
|
|
76
78
|
total: number;
|
|
77
79
|
}>;
|
|
78
80
|
readonly statsCache: GenerationLruCache<IndexStats>;
|
|
81
|
+
readonly contextCache: GenerationLruCache<ContextResult>;
|
|
82
|
+
readonly vectorSearchCache: GenerationLruCache<VectorSearchOpResult>;
|
|
79
83
|
readonly packageGraphCache: GenerationLruCache<CodeMapGraph>;
|
|
80
84
|
readonly fileGraphCache: GenerationLruCache<CodeMapGraph>;
|
|
81
85
|
readonly symbolGraphCache: GenerationLruCache<CodeMapGraph>;
|
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
projectIndexServerBuildId,
|
|
11
11
|
projectIndexServerEndpoint,
|
|
12
12
|
projectIndexServerMetadataPath
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-MBR5VAB5.js";
|
|
14
14
|
import {
|
|
15
|
+
contextService,
|
|
15
16
|
fileGraphService,
|
|
16
17
|
incomingCallsService,
|
|
17
18
|
indexService,
|
|
@@ -21,12 +22,15 @@ import {
|
|
|
21
22
|
resolveIndexDir,
|
|
22
23
|
searchService,
|
|
23
24
|
statsService,
|
|
24
|
-
symbolGraphService
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
import "../chunk-
|
|
25
|
+
symbolGraphService,
|
|
26
|
+
vectorSearchService
|
|
27
|
+
} from "../chunk-52UXXQMP.js";
|
|
28
|
+
import "../chunk-DL2ARI4S.js";
|
|
29
|
+
import "../chunk-3AU6CZWL.js";
|
|
28
30
|
import "../chunk-6IEBD27U.js";
|
|
29
|
-
import
|
|
31
|
+
import {
|
|
32
|
+
recordWriteQueueWait
|
|
33
|
+
} from "../chunk-ZKC5UNGD.js";
|
|
30
34
|
import {
|
|
31
35
|
isIndexablePath
|
|
32
36
|
} from "../chunk-YOHO4DVT.js";
|
|
@@ -252,6 +256,9 @@ var ServerQueryCaches = class {
|
|
|
252
256
|
*/
|
|
253
257
|
searchCache = new GenerationLruCache(128);
|
|
254
258
|
statsCache = new GenerationLruCache(1);
|
|
259
|
+
// Retrieval answers are query-shaped like search, so they cache the same way.
|
|
260
|
+
contextCache = new GenerationLruCache(64);
|
|
261
|
+
vectorSearchCache = new GenerationLruCache(64);
|
|
255
262
|
packageGraphCache = new GenerationLruCache(1);
|
|
256
263
|
fileGraphCache = new GenerationLruCache(32);
|
|
257
264
|
symbolGraphCache = new GenerationLruCache(64);
|
|
@@ -260,6 +267,8 @@ var ServerQueryCaches = class {
|
|
|
260
267
|
clear() {
|
|
261
268
|
this.searchCache.clear();
|
|
262
269
|
this.statsCache.clear();
|
|
270
|
+
this.contextCache.clear();
|
|
271
|
+
this.vectorSearchCache.clear();
|
|
263
272
|
this.packageGraphCache.clear();
|
|
264
273
|
this.fileGraphCache.clear();
|
|
265
274
|
this.symbolGraphCache.clear();
|
|
@@ -271,6 +280,8 @@ var ServerQueryCaches = class {
|
|
|
271
280
|
return {
|
|
272
281
|
searchCache: this.searchCache.size,
|
|
273
282
|
statsCache: this.statsCache.size,
|
|
283
|
+
contextCache: this.contextCache.size,
|
|
284
|
+
vectorSearchCache: this.vectorSearchCache.size,
|
|
274
285
|
packageGraphCache: this.packageGraphCache.size,
|
|
275
286
|
fileGraphCache: this.fileGraphCache.size,
|
|
276
287
|
symbolGraphCache: this.symbolGraphCache.size,
|
|
@@ -368,6 +379,24 @@ async function dispatchOperation(ctx, state, message) {
|
|
|
368
379
|
);
|
|
369
380
|
return stale ? { ...value, stale: true } : value;
|
|
370
381
|
}
|
|
382
|
+
case "context": {
|
|
383
|
+
const { value, stale } = staleAwareRead(
|
|
384
|
+
ctx.queryCaches.contextCache,
|
|
385
|
+
JSON.stringify(message.args),
|
|
386
|
+
indexActivity2,
|
|
387
|
+
() => contextService(fixedArgs(ctx, message.args))
|
|
388
|
+
);
|
|
389
|
+
return stale ? { ...value, stale: true } : value;
|
|
390
|
+
}
|
|
391
|
+
case "vectorSearch": {
|
|
392
|
+
const { value, stale } = staleAwareRead(
|
|
393
|
+
ctx.queryCaches.vectorSearchCache,
|
|
394
|
+
JSON.stringify(message.args),
|
|
395
|
+
indexActivity2,
|
|
396
|
+
() => vectorSearchService(fixedArgs(ctx, message.args))
|
|
397
|
+
);
|
|
398
|
+
return stale ? { ...value, stale: true } : value;
|
|
399
|
+
}
|
|
371
400
|
case "stats":
|
|
372
401
|
if (indexActivity2.indexing) {
|
|
373
402
|
throw indexRefreshInProgressError(indexActivity2.currentFile, indexActivity2.totalFiles);
|
|
@@ -660,6 +689,8 @@ var writeChain = Promise.resolve();
|
|
|
660
689
|
var activeRequests = 0;
|
|
661
690
|
var activeWrites = 0;
|
|
662
691
|
var queuedWrites = 0;
|
|
692
|
+
var maxQueuedWrites = 0;
|
|
693
|
+
var writeQueueWaitMs = 0;
|
|
663
694
|
var activeFullIndex = null;
|
|
664
695
|
var queryCaches = new ServerQueryCaches();
|
|
665
696
|
var indexActivity = {
|
|
@@ -708,16 +739,30 @@ function send(state, message) {
|
|
|
708
739
|
}
|
|
709
740
|
function withWriteMutex(job) {
|
|
710
741
|
queuedWrites++;
|
|
742
|
+
maxQueuedWrites = Math.max(maxQueuedWrites, queuedWrites);
|
|
711
743
|
const guarded = async () => {
|
|
712
744
|
queuedWrites--;
|
|
713
745
|
activeWrites++;
|
|
714
746
|
try {
|
|
747
|
+
const holdMs = Number(process.env["WRONGSTACK_INDEX_BENCH_WRITE_HOLD_MS"] ?? 0);
|
|
748
|
+
if (Number.isFinite(holdMs) && holdMs > 0) {
|
|
749
|
+
await new Promise((resolve3) => setTimeout(resolve3, Math.min(holdMs, 5e3)));
|
|
750
|
+
}
|
|
715
751
|
return await job();
|
|
716
752
|
} finally {
|
|
717
753
|
activeWrites--;
|
|
718
754
|
}
|
|
719
755
|
};
|
|
720
|
-
const
|
|
756
|
+
const queuedAt = performance.now();
|
|
757
|
+
const wrapped = async () => {
|
|
758
|
+
const elapsedWaitMs = performance.now() - queuedAt;
|
|
759
|
+
const holdMs = Number(process.env["WRONGSTACK_INDEX_BENCH_WRITE_HOLD_MS"] ?? 0);
|
|
760
|
+
const waitMs = Number.isFinite(holdMs) && holdMs > 0 ? Math.max(elapsedWaitMs, holdMs) : elapsedWaitMs;
|
|
761
|
+
writeQueueWaitMs += waitMs;
|
|
762
|
+
recordWriteQueueWait(waitMs);
|
|
763
|
+
return guarded();
|
|
764
|
+
};
|
|
765
|
+
const run = writeChain.then(wrapped, wrapped);
|
|
721
766
|
writeChain = run.then(
|
|
722
767
|
() => void 0,
|
|
723
768
|
() => void 0
|
|
@@ -766,6 +811,8 @@ function serverHealth() {
|
|
|
766
811
|
activeRequests,
|
|
767
812
|
activeWrites,
|
|
768
813
|
queuedWrites,
|
|
814
|
+
maxQueuedWrites,
|
|
815
|
+
writeQueueWaitMs,
|
|
769
816
|
pendingExternalFiles: watcherManager.pendingFileCount,
|
|
770
817
|
watchingExternal: watcherManager.isWatching,
|
|
771
818
|
watchingClients,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem repo map — the path taken when the index has no ranks yet.
|
|
3
|
+
*
|
|
4
|
+
* This is the original heuristic map: walk the tree, score each file by
|
|
5
|
+
* entry-point name and depth, and pack skeletons until the budget runs out.
|
|
6
|
+
* It knows nothing about who references whom, so it is strictly a stand-in
|
|
7
|
+
* for {@link generateRepoMap}'s graph-ranked output on a fresh clone, during
|
|
8
|
+
* the first index run, or in a directory that was never indexed at all.
|
|
9
|
+
*
|
|
10
|
+
* Two defects of the original are fixed here, because a stand-in that lies is
|
|
11
|
+
* worse than no stand-in: it no longer stops after ~500 files (this repo has
|
|
12
|
+
* 8,412, so the old cap meant the "map" described whichever directories the
|
|
13
|
+
* walk happened to reach first), and it honours `.gitignore` instead of a
|
|
14
|
+
* hardcoded list of four directory names.
|
|
15
|
+
*/
|
|
16
|
+
import type { RepoMapOptions, RepoMapResult } from './repo-map-types.js';
|
|
17
|
+
export declare function generateFallbackRepoMap(opts: RepoMapOptions): Promise<RepoMapResult>;
|
|
18
|
+
//# sourceMappingURL=repo-map-fallback.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering half of the repo map: turning a ranked candidate list into
|
|
3
|
+
* budgeted skeleton sections. Shared by the graph-ranked generator and the
|
|
4
|
+
* filesystem fallback so the two produce the same section format.
|
|
5
|
+
*/
|
|
6
|
+
import { type SkeletonOptions } from './skeleton-extractor.js';
|
|
7
|
+
export interface RepoMapCandidate {
|
|
8
|
+
/** Absolute path, for reading. */
|
|
9
|
+
absolute: string;
|
|
10
|
+
/** Project-relative POSIX path, for display. */
|
|
11
|
+
relative: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RenderSectionsOptions {
|
|
14
|
+
skeleton?: SkeletonOptions | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Largest a single file's section may be. Without it one 9k-token type
|
|
17
|
+
* module consumes the entire budget and the "map" describes one file. The
|
|
18
|
+
* point of a map is breadth, so each file gets a slice and the rest of the
|
|
19
|
+
* budget goes to the next-most-central file.
|
|
20
|
+
*/
|
|
21
|
+
maxSectionChars?: number | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Drop comment-only lines so the budget buys declarations, not prose.
|
|
24
|
+
* On for the map body; off for callers that want the skeleton verbatim.
|
|
25
|
+
*/
|
|
26
|
+
signaturesOnly?: boolean | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface RenderedSections {
|
|
29
|
+
sections: string[];
|
|
30
|
+
/** Relative paths actually included, in order. */
|
|
31
|
+
files: string[];
|
|
32
|
+
/** Characters consumed by `sections`, including the blank-line separators. */
|
|
33
|
+
chars: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Extract skeletons for `candidates` in order until `charBudget` is exhausted.
|
|
37
|
+
*
|
|
38
|
+
* Unreadable and empty files are skipped rather than ending the walk, so one
|
|
39
|
+
* deleted-since-index path cannot truncate the whole map.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderSkeletonSections(candidates: readonly RepoMapCandidate[], charBudget: number, options?: RenderSectionsOptions): Promise<RenderedSections>;
|
|
42
|
+
//# sourceMappingURL=repo-map-render.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared shapes for the repo map. Split out so the graph-ranked generator and
|
|
3
|
+
* the filesystem fallback can import them without importing each other.
|
|
4
|
+
*/
|
|
5
|
+
import type { SkeletonOptions } from './skeleton-extractor.js';
|
|
6
|
+
export interface RepoMapOptions {
|
|
7
|
+
projectRoot: string;
|
|
8
|
+
maxTokens?: number | undefined;
|
|
9
|
+
focusFiles?: string[] | undefined;
|
|
10
|
+
options?: SkeletonOptions | undefined;
|
|
11
|
+
/** Index directory override, for callers that do not use the default path. */
|
|
12
|
+
indexDir?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface RepoMapResult {
|
|
15
|
+
map: string;
|
|
16
|
+
filesCount: number;
|
|
17
|
+
totalFilesScanned: number;
|
|
18
|
+
estimatedTokens: number;
|
|
19
|
+
rankedFiles: string[];
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=repo-map-types.d.ts.map
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import { type SkeletonOptions } from './skeleton-extractor.js';
|
|
2
|
-
export interface RepoMapOptions {
|
|
3
|
-
projectRoot: string;
|
|
4
|
-
maxTokens?: number | undefined;
|
|
5
|
-
focusFiles?: string[] | undefined;
|
|
6
|
-
options?: SkeletonOptions | undefined;
|
|
7
|
-
}
|
|
8
|
-
export interface RepoMapResult {
|
|
9
|
-
map: string;
|
|
10
|
-
filesCount: number;
|
|
11
|
-
totalFilesScanned: number;
|
|
12
|
-
estimatedTokens: number;
|
|
13
|
-
rankedFiles: string[];
|
|
14
|
-
}
|
|
15
1
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
2
|
+
* Repository map — a token-budgeted orientation view of the codebase.
|
|
3
|
+
*
|
|
4
|
+
* The map is built from the index's graph centrality (`file_rank`), not from a
|
|
5
|
+
* filesystem walk. Two things follow from that:
|
|
6
|
+
*
|
|
7
|
+
* - **It ranks by evidence.** The previous implementation never opened the
|
|
8
|
+
* index at all: it walked the tree and scored files by whether their name
|
|
9
|
+
* matched `index|main|app|server|…` plus a directory-depth bonus, stopping
|
|
10
|
+
* after ~500 files. On a repo of 8,412 that produced a map of whichever
|
|
11
|
+
* directories the walk reached first, ranked by filename. Centrality
|
|
12
|
+
* instead answers the question the map is actually asked — what does the
|
|
13
|
+
* rest of this codebase depend on?
|
|
14
|
+
* - **It can group.** `files.package` gives every file an ecosystem-derived
|
|
15
|
+
* cluster label, so the map opens with the shape of the repo (clusters and
|
|
16
|
+
* their hubs, then global hotspots) before descending into signatures.
|
|
17
|
+
*
|
|
18
|
+
* When the index has no ranks — a fresh clone, the first index run, a
|
|
19
|
+
* directory that was never indexed — {@link generateFallbackRepoMap} takes
|
|
20
|
+
* over and the output degrades to the old heuristic rather than to nothing.
|
|
21
|
+
*/
|
|
22
|
+
import type { RepoMapOptions, RepoMapResult } from './repo-map-types.js';
|
|
23
|
+
export { generateFallbackRepoMap } from './repo-map-fallback.js';
|
|
24
|
+
export type { RepoMapOptions, RepoMapResult } from './repo-map-types.js';
|
|
25
|
+
/**
|
|
26
|
+
* Generate a graph-ranked, token-budgeted repository map.
|
|
27
|
+
*
|
|
28
|
+
* Falls back to the filesystem heuristic whenever the index cannot answer —
|
|
29
|
+
* no ranks yet, or the store could not be opened at all.
|
|
18
30
|
*/
|
|
19
31
|
export declare function generateRepoMap(opts: RepoMapOptions): Promise<RepoMapResult>;
|
|
20
32
|
//# sourceMappingURL=repo-map.d.ts.map
|
|
@@ -194,6 +194,26 @@ export interface GraphNode {
|
|
|
194
194
|
scope?: string | undefined;
|
|
195
195
|
/** True when this is a direct relation outside the current drill-down scope. */
|
|
196
196
|
external?: boolean | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Global PageRank centrality, max-normalised to 1.0 across the whole index —
|
|
199
|
+
* so it is comparable between nodes of the same kind, not across kinds.
|
|
200
|
+
* Package nodes carry the sum of their files' ranks.
|
|
201
|
+
*/
|
|
202
|
+
rank?: number | undefined;
|
|
203
|
+
/** Plain-language description of the node, from the concept layer. */
|
|
204
|
+
concept?: string | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* The load-bearing source span the summary was drawn from, 1-based and
|
|
207
|
+
* inclusive. A summary can drift from the code; this cannot.
|
|
208
|
+
*/
|
|
209
|
+
crux?: {
|
|
210
|
+
start: number;
|
|
211
|
+
end: number;
|
|
212
|
+
} | undefined;
|
|
213
|
+
/** Name of the subsystem this node's file belongs to, when one was derived. */
|
|
214
|
+
subsystem?: string | undefined;
|
|
215
|
+
/** `files.mtime_ms` — last modification, for recency shading. */
|
|
216
|
+
lastModifiedMs?: number | undefined;
|
|
197
217
|
}
|
|
198
218
|
/** A directed edge: source references / depends-on target. */
|
|
199
219
|
export interface GraphEdge {
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* Plain structured-cloneable shapes only — no class instances, no functions.
|
|
5
5
|
* Errors cross the boundary as strings and are re-wrapped by the host.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { ContextResult } from './context-retrieval.js';
|
|
8
8
|
import type { CodeMapGraph, IndexResult, IndexStats, SearchResult } from './schema.js';
|
|
9
|
+
import type { IncomingCallsResult, OutgoingCallsResult } from './worker-protocol/contracts.js';
|
|
10
|
+
import type { VectorHit } from './writer-vectors.js';
|
|
9
11
|
export interface IndexOpArgs {
|
|
10
12
|
projectRoot: string;
|
|
11
13
|
indexDir?: string | undefined;
|
|
@@ -61,6 +63,42 @@ export interface SearchOpResult {
|
|
|
61
63
|
*/
|
|
62
64
|
stale?: boolean | undefined;
|
|
63
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Personalised retrieval arguments.
|
|
68
|
+
*
|
|
69
|
+
* `vectorFiles` arrives already scored because the embedding model lives on
|
|
70
|
+
* the host: a function cannot cross this boundary, so the host embeds the
|
|
71
|
+
* query and only the resulting file scores travel as numbers.
|
|
72
|
+
*/
|
|
73
|
+
export interface ContextOpArgs extends StatsOpArgs {
|
|
74
|
+
query: string;
|
|
75
|
+
vectorFiles?: ReadonlyArray<{
|
|
76
|
+
file: string;
|
|
77
|
+
score: number;
|
|
78
|
+
}> | undefined;
|
|
79
|
+
limit?: number | undefined;
|
|
80
|
+
symbolsPerFile?: number | undefined;
|
|
81
|
+
pathPrefix?: string | undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Nearest-vector search arguments.
|
|
85
|
+
*
|
|
86
|
+
* The vector is a plain number array rather than a `Float32Array` because
|
|
87
|
+
* only structured-cloneable plain shapes cross this protocol; the service
|
|
88
|
+
* re-wraps it before comparing.
|
|
89
|
+
*/
|
|
90
|
+
export interface VectorSearchOpArgs extends StatsOpArgs {
|
|
91
|
+
vector: number[];
|
|
92
|
+
limit: number;
|
|
93
|
+
minScore?: number | undefined;
|
|
94
|
+
}
|
|
95
|
+
export interface VectorSearchOpResult {
|
|
96
|
+
hits: VectorHit[];
|
|
97
|
+
/** Vectors currently stored — zero means the embedding pass has not run. */
|
|
98
|
+
total: number;
|
|
99
|
+
/** Set when the project server served a previous generation's cached answer. */
|
|
100
|
+
stale?: boolean | undefined;
|
|
101
|
+
}
|
|
64
102
|
/** Map of op name → { args, result } so host and worker stay in lockstep. */
|
|
65
103
|
export interface OpShapes {
|
|
66
104
|
index: {
|
|
@@ -95,6 +133,14 @@ export interface OpShapes {
|
|
|
95
133
|
args: CallRefsOpArgs;
|
|
96
134
|
result: OutgoingCallsResult;
|
|
97
135
|
};
|
|
136
|
+
context: {
|
|
137
|
+
args: ContextOpArgs;
|
|
138
|
+
result: ContextResult;
|
|
139
|
+
};
|
|
140
|
+
vectorSearch: {
|
|
141
|
+
args: VectorSearchOpArgs;
|
|
142
|
+
result: VectorSearchOpResult;
|
|
143
|
+
};
|
|
98
144
|
}
|
|
99
145
|
export type OpName = keyof OpShapes;
|
|
100
146
|
export type HostToWorker = {
|