llmnav 0.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/CHANGELOG.md +113 -0
- package/LICENSE +21 -0
- package/README.md +294 -0
- package/ROADMAP.md +71 -0
- package/bin/llmnav.js +16 -0
- package/docs/agent-integration.md +114 -0
- package/docs/api.md +290 -0
- package/docs/architecture.md +286 -0
- package/docs/benchmarking.md +164 -0
- package/docs/ci.md +196 -0
- package/docs/cli.md +233 -0
- package/docs/configuration.md +117 -0
- package/docs/editor-integration.md +29 -0
- package/docs/faq.md +59 -0
- package/docs/graph.md +92 -0
- package/docs/language-examples.md +130 -0
- package/docs/migration.md +130 -0
- package/docs/performance-v0.2.md +42 -0
- package/docs/provider-neutral-integration.md +66 -0
- package/docs/publishing.md +86 -0
- package/docs/quickstart.md +139 -0
- package/docs/research.md +31 -0
- package/docs/spec.md +424 -0
- package/examples/provider-neutral-host.d.mts +17 -0
- package/examples/provider-neutral-host.mjs +40 -0
- package/package.json +79 -0
- package/schema/config.schema.json +296 -0
- package/src/agent-protocol.js +117 -0
- package/src/agent-tools.js +61 -0
- package/src/agents.js +127 -0
- package/src/boundaries.js +50 -0
- package/src/changes.js +168 -0
- package/src/cli.js +459 -0
- package/src/config.js +305 -0
- package/src/contracts.js +70 -0
- package/src/declaration.js +334 -0
- package/src/doctor.js +124 -0
- package/src/editor.js +107 -0
- package/src/evaluation.js +67 -0
- package/src/files.js +81 -0
- package/src/formatter.js +23 -0
- package/src/generator.js +528 -0
- package/src/graph-input.js +157 -0
- package/src/graph.js +403 -0
- package/src/incremental.js +262 -0
- package/src/index.d.ts +673 -0
- package/src/index.js +115 -0
- package/src/initializer.js +137 -0
- package/src/inverted-index.js +350 -0
- package/src/parser.js +449 -0
- package/src/project.js +65 -0
- package/src/prompt-bundle.js +108 -0
- package/src/registry.js +107 -0
- package/src/sarif.js +70 -0
- package/src/search-shards.js +75 -0
- package/src/search.js +636 -0
- package/src/spec.d.ts +27 -0
- package/src/spec.js +237 -0
- package/src/tokenizer.js +37 -0
- package/src/transaction.js +557 -0
- package/src/util.js +256 -0
- package/src/validator.js +635 -0
- package/templates/file-card.txt +8 -0
- package/templates/lexicon.json +7 -0
- package/templates/line-card.txt +9 -0
- package/templates/module-card.txt +9 -0
- package/templates/queries.jsonl +1 -0
- package/templates/symbol-card.txt +10 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
export type LlmnavScope = "file" | "module" | "symbol";
|
|
2
|
+
export type LlmnavStability = "architecture" | "contract" | "implementation";
|
|
3
|
+
export type DiagnosticSeverity = "error" | "warning" | "info";
|
|
4
|
+
|
|
5
|
+
export interface LlmnavCard {
|
|
6
|
+
scope: LlmnavScope;
|
|
7
|
+
id: string;
|
|
8
|
+
role: string;
|
|
9
|
+
owns: string[];
|
|
10
|
+
excludes: string[];
|
|
11
|
+
search: string[];
|
|
12
|
+
invariant: string[];
|
|
13
|
+
effect: string[];
|
|
14
|
+
risk: string[];
|
|
15
|
+
rel: string[];
|
|
16
|
+
stability: LlmnavStability | "";
|
|
17
|
+
unknown?: Array<{ key: string; value: string; line: number }>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface LlmnavEntry {
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
line: number;
|
|
24
|
+
order: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface LlmnavBlock {
|
|
28
|
+
specVersion: string;
|
|
29
|
+
filePath: string;
|
|
30
|
+
scope: LlmnavScope;
|
|
31
|
+
card: LlmnavCard;
|
|
32
|
+
entries: LlmnavEntry[];
|
|
33
|
+
syntaxErrors: Array<{ line: number; message: string }>;
|
|
34
|
+
style: "block" | "html" | "line";
|
|
35
|
+
prefix: string | null;
|
|
36
|
+
indent: string;
|
|
37
|
+
raw: string;
|
|
38
|
+
start: number;
|
|
39
|
+
end: number;
|
|
40
|
+
startLine: number;
|
|
41
|
+
endLine: number;
|
|
42
|
+
newline: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface Declaration {
|
|
46
|
+
kind: string;
|
|
47
|
+
symbol: string;
|
|
48
|
+
signature: string;
|
|
49
|
+
language: "typescript" | "javascript" | "go" | "rust" | "python" | "generic";
|
|
50
|
+
exported: boolean;
|
|
51
|
+
visibility: "public" | "module" | "private";
|
|
52
|
+
receiver: string | null;
|
|
53
|
+
line: number;
|
|
54
|
+
offset: number;
|
|
55
|
+
endOffset: number;
|
|
56
|
+
bodyHash: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface DetectedBoundary {
|
|
60
|
+
kind: "command" | "event" | "migration" | "route" | "schema";
|
|
61
|
+
confidence: "high" | "medium";
|
|
62
|
+
evidence: string[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface Diagnostic {
|
|
66
|
+
severity: DiagnosticSeverity;
|
|
67
|
+
code: string;
|
|
68
|
+
message: string;
|
|
69
|
+
file: string;
|
|
70
|
+
line: number;
|
|
71
|
+
column: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface IndexedLocation {
|
|
75
|
+
path: string;
|
|
76
|
+
startLine: number;
|
|
77
|
+
endLine: number;
|
|
78
|
+
symbol: string | null;
|
|
79
|
+
kind: string | null;
|
|
80
|
+
declarationLine: number | null;
|
|
81
|
+
signature: string | null;
|
|
82
|
+
language: Declaration["language"] | null;
|
|
83
|
+
exported: boolean | null;
|
|
84
|
+
visibility: Declaration["visibility"] | null;
|
|
85
|
+
receiver: string | null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface IndexedCard extends Omit<LlmnavCard, "unknown"> {
|
|
89
|
+
location: IndexedLocation;
|
|
90
|
+
imports: string[];
|
|
91
|
+
boundaries: DetectedBoundary[];
|
|
92
|
+
hashes: {
|
|
93
|
+
semantic: string;
|
|
94
|
+
structure: string;
|
|
95
|
+
body: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface LlmnavIndex {
|
|
100
|
+
schemaVersion: 1;
|
|
101
|
+
specVersion: string;
|
|
102
|
+
generatedBy: string;
|
|
103
|
+
repositoryId: string;
|
|
104
|
+
contractFingerprints?: ContractFingerprints;
|
|
105
|
+
sourceHash: string;
|
|
106
|
+
cards: IndexedCard[];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface ContractFingerprint {
|
|
110
|
+
sha256: string;
|
|
111
|
+
count?: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface ContractFingerprints {
|
|
115
|
+
schemaVersion: 1;
|
|
116
|
+
exportedApi: ContractFingerprint;
|
|
117
|
+
configuration: ContractFingerprint;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface ContractFingerprintChange {
|
|
121
|
+
kind: "exportedApi" | "configuration";
|
|
122
|
+
previous: string | null;
|
|
123
|
+
current: string | null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface SearchDocument {
|
|
127
|
+
hash: string;
|
|
128
|
+
phrases: string[];
|
|
129
|
+
terms: Array<[token: string, sparseFieldCounts: number[]]>;
|
|
130
|
+
tokens: string[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type CompactSearchDocument = [hash: string, phrases: string[]];
|
|
134
|
+
export type CompactSearchPosting = [cardIndex: number, sparseFieldCounts: number[]];
|
|
135
|
+
|
|
136
|
+
export interface LlmnavSearchIndex {
|
|
137
|
+
schemaVersion: 2;
|
|
138
|
+
encoding: "compact-v1";
|
|
139
|
+
tokenizerVersion: number;
|
|
140
|
+
repositoryId: string;
|
|
141
|
+
cardSetHash: string;
|
|
142
|
+
documentCount: number;
|
|
143
|
+
fieldOrder: string[];
|
|
144
|
+
cardIds: string[];
|
|
145
|
+
tokens: string[];
|
|
146
|
+
documents: CompactSearchDocument[];
|
|
147
|
+
postings: CompactSearchPosting[][];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface SearchIndexStats {
|
|
151
|
+
previousUsable: boolean;
|
|
152
|
+
totalCards: number;
|
|
153
|
+
reusedCards: number;
|
|
154
|
+
indexedCards: number;
|
|
155
|
+
removedCards: number;
|
|
156
|
+
changedIds: string[];
|
|
157
|
+
removedIds: string[];
|
|
158
|
+
tokenCount: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface SearchMetrics {
|
|
162
|
+
queryTokens?: number;
|
|
163
|
+
documentTokenizations?: number;
|
|
164
|
+
postingVisits?: number;
|
|
165
|
+
phraseDocumentsScanned?: number;
|
|
166
|
+
idDocumentsScanned?: number;
|
|
167
|
+
graphEdgesVisited?: number;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface SearchResult {
|
|
171
|
+
id: string;
|
|
172
|
+
score: number;
|
|
173
|
+
reasons: string[];
|
|
174
|
+
role: string;
|
|
175
|
+
location: IndexedLocation;
|
|
176
|
+
card: IndexedCard;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface ProjectSession {
|
|
180
|
+
root: string;
|
|
181
|
+
query(query: string, options?: { top?: number }): SearchResult[];
|
|
182
|
+
show(id: string): { card: IndexedCard | null; node: GraphNode | null; resolvedFrom: unknown };
|
|
183
|
+
context(id: string, options?: { depth?: number; budget?: number; maxEdges?: number }): { id: string; depth: number; budget: number; maxEdges: number; included: string[]; includedEdges: string[]; text: string };
|
|
184
|
+
refresh(): Promise<ProjectSession>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface RegistryRecord {
|
|
188
|
+
id: string;
|
|
189
|
+
state: "active" | "redirect" | "replaced" | "retired" | string;
|
|
190
|
+
to?: string;
|
|
191
|
+
by?: string[];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface Registry {
|
|
195
|
+
registryPath: string;
|
|
196
|
+
records: RegistryRecord[];
|
|
197
|
+
byId: Map<string, RegistryRecord>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface LlmnavConfig {
|
|
201
|
+
$schema?: string;
|
|
202
|
+
version: 1;
|
|
203
|
+
repositoryId: string;
|
|
204
|
+
sourceRoots: string[];
|
|
205
|
+
includeExtensions: string[];
|
|
206
|
+
excludeDirectories: string[];
|
|
207
|
+
excludeFiles: string[];
|
|
208
|
+
coverageRules: Array<Record<string, unknown>>;
|
|
209
|
+
graph: {
|
|
210
|
+
indexFiles: string[];
|
|
211
|
+
};
|
|
212
|
+
lint: {
|
|
213
|
+
maxRoleLength: number;
|
|
214
|
+
maxSearchTerms: number;
|
|
215
|
+
minSearchTerms: number;
|
|
216
|
+
maxInvariants: number;
|
|
217
|
+
maxEffects: number;
|
|
218
|
+
maxRelations: number;
|
|
219
|
+
maxBlockBytes: Record<LlmnavScope, number>;
|
|
220
|
+
maxSemanticRatio: number;
|
|
221
|
+
minimumSourceBytesForRatio: number;
|
|
222
|
+
searchTermSaturation: number;
|
|
223
|
+
minimumCardsForSaturation: number;
|
|
224
|
+
genericSearchTerms: string[];
|
|
225
|
+
vagueRoleWords: string[];
|
|
226
|
+
strictRisks: string[];
|
|
227
|
+
additionalEffects: string[];
|
|
228
|
+
additionalRisks: string[];
|
|
229
|
+
additionalRelations: string[];
|
|
230
|
+
requireCanonicalOrder: boolean;
|
|
231
|
+
requireCanonicalFormatting: boolean;
|
|
232
|
+
};
|
|
233
|
+
generation: {
|
|
234
|
+
cacheDirectory: string;
|
|
235
|
+
moduleDepth: number;
|
|
236
|
+
searchShardSize: number;
|
|
237
|
+
repositoryCatalogStabilities: LlmnavStability[];
|
|
238
|
+
moduleCatalogStabilities: LlmnavStability[];
|
|
239
|
+
};
|
|
240
|
+
evaluation: {
|
|
241
|
+
queryFile: string;
|
|
242
|
+
minimumRecallAt1: number;
|
|
243
|
+
minimumRecallAt5: number;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface AgentToolDefinition {
|
|
248
|
+
schemaVersion: 1;
|
|
249
|
+
name: "llmnav_query" | "llmnav_show" | "llmnav_context" | "llmnav_check";
|
|
250
|
+
description: string;
|
|
251
|
+
inputSchema: {
|
|
252
|
+
type: "object";
|
|
253
|
+
additionalProperties: false;
|
|
254
|
+
properties: Record<string, unknown>;
|
|
255
|
+
required: string[];
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface AgentOperationResult<T = unknown> {
|
|
260
|
+
schemaVersion: 1;
|
|
261
|
+
operation: "query" | "show" | "context" | "check" | "unknown";
|
|
262
|
+
ok: boolean;
|
|
263
|
+
data: T | null;
|
|
264
|
+
error: { code: string; message: string } | null;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface PromptPrefixPartition {
|
|
268
|
+
id: string;
|
|
269
|
+
cacheScope: "package" | "repository" | "module";
|
|
270
|
+
contentType: string;
|
|
271
|
+
contentHash: string;
|
|
272
|
+
estimatedTokens: number;
|
|
273
|
+
cacheBoundaryAfter: true;
|
|
274
|
+
content: string;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface PromptPrefixBundle {
|
|
278
|
+
schemaVersion: 1;
|
|
279
|
+
repositoryId: string;
|
|
280
|
+
bundleHash: string;
|
|
281
|
+
assembly: {
|
|
282
|
+
basePartitionIds: string[];
|
|
283
|
+
modulePartitionIds: string[];
|
|
284
|
+
volatileContextAfter: true;
|
|
285
|
+
};
|
|
286
|
+
partitions: PromptPrefixPartition[];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface EditorDiagnosticDocument {
|
|
290
|
+
path: string;
|
|
291
|
+
diagnostics: Array<{
|
|
292
|
+
range: { start: { line: number; character: number }; end: { line: number; character: number } };
|
|
293
|
+
severity: 1 | 2 | 3;
|
|
294
|
+
level: DiagnosticSeverity;
|
|
295
|
+
code: string;
|
|
296
|
+
source: "llmnav";
|
|
297
|
+
message: string;
|
|
298
|
+
}>;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface EditorDiagnosticReport {
|
|
302
|
+
schemaVersion: 1;
|
|
303
|
+
source: "llmnav";
|
|
304
|
+
coordinateBase: 0;
|
|
305
|
+
counts: { error: number; warning: number; info: number };
|
|
306
|
+
documents: EditorDiagnosticDocument[];
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export interface ProjectFileRecord {
|
|
310
|
+
absolutePath: string;
|
|
311
|
+
relativePath: string;
|
|
312
|
+
source: string | null;
|
|
313
|
+
contentHash: string;
|
|
314
|
+
bodyHash: string;
|
|
315
|
+
sourceBytes: number;
|
|
316
|
+
semanticBytes: number;
|
|
317
|
+
blocks: LlmnavBlock[];
|
|
318
|
+
imports: string[];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface ProjectRecord {
|
|
322
|
+
root: string;
|
|
323
|
+
absolutePath: string;
|
|
324
|
+
relativePath: string;
|
|
325
|
+
source: string | null;
|
|
326
|
+
bodyHash: string;
|
|
327
|
+
imports: string[];
|
|
328
|
+
block: LlmnavBlock;
|
|
329
|
+
card: LlmnavCard;
|
|
330
|
+
declaration: Declaration | null;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface ScannedProject {
|
|
334
|
+
root: string;
|
|
335
|
+
config: LlmnavConfig;
|
|
336
|
+
configPath: string;
|
|
337
|
+
files: string[];
|
|
338
|
+
fileRecords: ProjectFileRecord[];
|
|
339
|
+
records: ProjectRecord[];
|
|
340
|
+
registry: Registry;
|
|
341
|
+
sourceBytes: number;
|
|
342
|
+
semanticBytes: number;
|
|
343
|
+
graphInputs?: GraphInputIndex[];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface GraphDefinition {
|
|
347
|
+
id: string;
|
|
348
|
+
symbol: string;
|
|
349
|
+
path: string;
|
|
350
|
+
line: number | null;
|
|
351
|
+
kind: string | null;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface GraphReference {
|
|
355
|
+
from: string;
|
|
356
|
+
to: string;
|
|
357
|
+
kind: string;
|
|
358
|
+
path: string | null;
|
|
359
|
+
line: number | null;
|
|
360
|
+
confidence: number;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface GraphInputIndex {
|
|
364
|
+
file: string;
|
|
365
|
+
contentHash: string | null;
|
|
366
|
+
schemaVersion: 1;
|
|
367
|
+
repositoryId: string;
|
|
368
|
+
generator: string | null;
|
|
369
|
+
definitions: GraphDefinition[];
|
|
370
|
+
references: GraphReference[];
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export interface GraphProvenance {
|
|
374
|
+
type: "source-card" | "local-import" | "generated-index" | string;
|
|
375
|
+
source: string;
|
|
376
|
+
path: string | null;
|
|
377
|
+
line: number | null;
|
|
378
|
+
generator: string | null;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export interface GraphNode {
|
|
382
|
+
key: string;
|
|
383
|
+
repositoryId: string;
|
|
384
|
+
semanticId: string;
|
|
385
|
+
role: string | null;
|
|
386
|
+
location: IndexedLocation | null;
|
|
387
|
+
external: boolean;
|
|
388
|
+
unresolved: boolean;
|
|
389
|
+
definitions: Array<{
|
|
390
|
+
symbol: string;
|
|
391
|
+
path: string;
|
|
392
|
+
line: number | null;
|
|
393
|
+
kind: string | null;
|
|
394
|
+
provenance: Omit<GraphProvenance, "path" | "line">;
|
|
395
|
+
}>;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export interface GraphEdge {
|
|
399
|
+
id: string;
|
|
400
|
+
from: string;
|
|
401
|
+
to: string;
|
|
402
|
+
kind: string;
|
|
403
|
+
confidence: number;
|
|
404
|
+
provenance: GraphProvenance;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export interface RepositoryGraph {
|
|
408
|
+
schemaVersion: 1;
|
|
409
|
+
repositoryId: string;
|
|
410
|
+
sourceHash: string;
|
|
411
|
+
nodes: GraphNode[];
|
|
412
|
+
edges: GraphEdge[];
|
|
413
|
+
stats: { nodeCount: number; edgeCount: number; unresolvedNodeCount: number; importedIndexCount: number };
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export interface GraphStatePartition {
|
|
417
|
+
key: string;
|
|
418
|
+
inputHash: string;
|
|
419
|
+
outputHash: string;
|
|
420
|
+
nodes: Array<Omit<GraphNode, "unresolved">>;
|
|
421
|
+
edges: GraphEdge[];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export interface RepositoryGraphState {
|
|
425
|
+
schemaVersion: 1;
|
|
426
|
+
repositoryId: string;
|
|
427
|
+
resolutionHash: string;
|
|
428
|
+
partitions: GraphStatePartition[];
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export interface IncrementalGraphStats {
|
|
432
|
+
totalPartitions: number;
|
|
433
|
+
reusedPartitions: number;
|
|
434
|
+
rebuiltPartitions: number;
|
|
435
|
+
removedPartitions: number;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export interface SerializedFileStateRecord {
|
|
439
|
+
path: string;
|
|
440
|
+
contentHash: string;
|
|
441
|
+
sourceBytes: number;
|
|
442
|
+
semanticBytes: number;
|
|
443
|
+
imports: string[];
|
|
444
|
+
blocks: LlmnavBlock[];
|
|
445
|
+
declarations: Array<Declaration | null>;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface LlmnavFileState {
|
|
449
|
+
schemaVersion: number;
|
|
450
|
+
indexerVersion: number;
|
|
451
|
+
files: SerializedFileStateRecord[];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export interface IncrementalFileStats {
|
|
455
|
+
totalFiles: number;
|
|
456
|
+
parsedFiles: number;
|
|
457
|
+
reusedFiles: number;
|
|
458
|
+
reusedFilesByStat: number;
|
|
459
|
+
reusedFilesByHash: number;
|
|
460
|
+
deletedFiles: number;
|
|
461
|
+
bytesRead: number;
|
|
462
|
+
cardsParsed: number;
|
|
463
|
+
cardsReused: number;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export interface ChangedCardRecord {
|
|
467
|
+
id: string;
|
|
468
|
+
change: "added" | "modified" | "removed";
|
|
469
|
+
dimensions: Array<"semantic" | "structure" | "body">;
|
|
470
|
+
previous: Record<string, unknown> | null;
|
|
471
|
+
current: Record<string, unknown> | null;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export interface AffectedCatalogRecord {
|
|
475
|
+
file: string;
|
|
476
|
+
kind: "repository" | "module" | "agent-context" | "prompt-prefix";
|
|
477
|
+
id: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export interface AffectedBoundaryRecord {
|
|
481
|
+
id: string;
|
|
482
|
+
change: ChangedCardRecord["change"];
|
|
483
|
+
dimensions: ChangedCardRecord["dimensions"];
|
|
484
|
+
modules: string[];
|
|
485
|
+
boundaries: DetectedBoundary[];
|
|
486
|
+
relatedIds: string[];
|
|
487
|
+
dependentIds: string[];
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export interface TransactionResult {
|
|
491
|
+
committed: boolean;
|
|
492
|
+
skipped: boolean;
|
|
493
|
+
recovered: boolean;
|
|
494
|
+
recoveryAction: string;
|
|
495
|
+
transactionId?: string;
|
|
496
|
+
replacedExisting?: boolean;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
export interface GenerationResult {
|
|
500
|
+
ok: boolean;
|
|
501
|
+
diagnostics: Diagnostic[];
|
|
502
|
+
changedFiles: string[];
|
|
503
|
+
changedCards: ChangedCardRecord[];
|
|
504
|
+
affectedBoundaries: AffectedBoundaryRecord[];
|
|
505
|
+
affectedCatalogs: AffectedCatalogRecord[];
|
|
506
|
+
project: ScannedProject;
|
|
507
|
+
counts: { error: number; warning: number; info: number };
|
|
508
|
+
artifacts?: Map<string, string>;
|
|
509
|
+
index?: LlmnavIndex;
|
|
510
|
+
searchIndex?: LlmnavSearchIndex;
|
|
511
|
+
graph?: RepositoryGraph;
|
|
512
|
+
incremental: {
|
|
513
|
+
enabled: boolean;
|
|
514
|
+
files: IncrementalFileStats;
|
|
515
|
+
cards: SearchIndexStats | null;
|
|
516
|
+
graph: IncrementalGraphStats | null;
|
|
517
|
+
statHintsPersisted?: boolean;
|
|
518
|
+
statHintsError?: string | null;
|
|
519
|
+
};
|
|
520
|
+
transaction: TransactionResult;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export interface EvaluationResult {
|
|
524
|
+
ok: boolean;
|
|
525
|
+
errors: string[];
|
|
526
|
+
cases: Array<{
|
|
527
|
+
query: string;
|
|
528
|
+
expected: string[];
|
|
529
|
+
actual: string[];
|
|
530
|
+
rank: number | null;
|
|
531
|
+
passAt1: boolean;
|
|
532
|
+
passAt5: boolean;
|
|
533
|
+
}>;
|
|
534
|
+
metrics: {
|
|
535
|
+
total: number;
|
|
536
|
+
recallAt1: number;
|
|
537
|
+
recallAt5: number;
|
|
538
|
+
meanReciprocalRank: number;
|
|
539
|
+
};
|
|
540
|
+
thresholds?: LlmnavConfig["evaluation"];
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export const AGENT_PROTOCOL: string;
|
|
544
|
+
export const AGENT_OPERATION_SCHEMA_VERSION: 1;
|
|
545
|
+
export const AGENT_TOOL_SCHEMA_VERSION: 1;
|
|
546
|
+
export const BOUNDARY_KINDS: readonly DetectedBoundary["kind"][];
|
|
547
|
+
export const GRAPH_INPUT_SCHEMA_VERSION: 1;
|
|
548
|
+
export const EDITOR_DIAGNOSTIC_SCHEMA_VERSION: 1;
|
|
549
|
+
export const EDITOR_INTEGRATION_SCHEMA_VERSION: 1;
|
|
550
|
+
export const GRAPH_SCHEMA_VERSION: 1;
|
|
551
|
+
export const GRAPH_STATE_SCHEMA_VERSION: 1;
|
|
552
|
+
export const PROMPT_BUNDLE_SCHEMA_VERSION: 1;
|
|
553
|
+
export const SARIF_SCHEMA: string;
|
|
554
|
+
export const SARIF_VERSION: "2.1.0";
|
|
555
|
+
export const SEARCH_SHARD_ENCODING: "card-range-v1";
|
|
556
|
+
export const SEARCH_SHARD_SCHEMA_VERSION: 1;
|
|
557
|
+
export const CONTRACT_FINGERPRINT_SCHEMA_VERSION: 1;
|
|
558
|
+
export const FILE_STATE_SCHEMA_VERSION: number;
|
|
559
|
+
export const SOURCE_INDEXER_VERSION: number;
|
|
560
|
+
export const SEARCH_INDEX_ENCODING: "compact-v1";
|
|
561
|
+
export const SEARCH_INDEX_SCHEMA_VERSION: 2;
|
|
562
|
+
export const SEARCH_FIELD_ORDER: readonly string[];
|
|
563
|
+
export const SEARCH_FIELD_WEIGHTS: Readonly<Record<string, number>>;
|
|
564
|
+
export const TOKENIZER_VERSION: number;
|
|
565
|
+
export const TRANSACTION_SCHEMA_VERSION: number;
|
|
566
|
+
export const TRANSACTION_ABORT_EXIT_CODE: number;
|
|
567
|
+
|
|
568
|
+
export function installAgentInstructions(root: string, adapters?: string[]): Promise<string[]>;
|
|
569
|
+
export function diagnosticsToEditor(diagnostics: Diagnostic[]): EditorDiagnosticReport;
|
|
570
|
+
export function renderEditorDiagnostics(diagnostics: Diagnostic[]): string;
|
|
571
|
+
export function getEditorIntegration(name: "vscode"): { schemaVersion: 1; editor: "vscode"; target: ".vscode/tasks.json"; config: Record<string, unknown> };
|
|
572
|
+
export function getAgentToolDefinitions(): AgentToolDefinition[];
|
|
573
|
+
export function executeAgentOperation(root: string, name: string, input?: Record<string, unknown>, options?: { session?: ProjectSession }): Promise<AgentOperationResult>;
|
|
574
|
+
export function buildPromptPrefixBundle(input: { repositoryId: string; toolDefinitions: AgentToolDefinition[]; agentProtocol: string; repositoryCore: string; modules?: Array<{ id: string; content: string }> }): PromptPrefixBundle;
|
|
575
|
+
export function isCompatiblePromptPrefixBundle(bundle: unknown, repositoryId?: string): bundle is PromptPrefixBundle;
|
|
576
|
+
export function loadPromptPrefixBundle(root: string): Promise<PromptPrefixBundle>;
|
|
577
|
+
export function renderPromptPrefixBundle(bundle: PromptPrefixBundle): string;
|
|
578
|
+
export function detectBoundaries(record: ProjectRecord): DetectedBoundary[];
|
|
579
|
+
export function normalizeGraphInput(value: unknown, file?: string, contentHash?: string | null): GraphInputIndex;
|
|
580
|
+
export function loadGraphInputs(root: string, config: LlmnavConfig): Promise<{ indexes: GraphInputIndex[]; diagnostics: Diagnostic[] }>;
|
|
581
|
+
export function buildRepositoryGraph(project: ScannedProject, index: LlmnavIndex): RepositoryGraph;
|
|
582
|
+
export function buildRepositoryGraphIncremental(project: ScannedProject, index: LlmnavIndex, previousState?: RepositoryGraphState | null): {
|
|
583
|
+
graph: RepositoryGraph;
|
|
584
|
+
state: RepositoryGraphState;
|
|
585
|
+
stats: IncrementalGraphStats;
|
|
586
|
+
};
|
|
587
|
+
export function compatibleGraphState(state: unknown, repositoryId?: string): state is RepositoryGraphState;
|
|
588
|
+
export function isCompatibleRepositoryGraph(graph: unknown, repositoryId?: string): graph is RepositoryGraph;
|
|
589
|
+
export function renderRepositoryGraph(graph: RepositoryGraph): string;
|
|
590
|
+
export function renderGraphState(state: RepositoryGraphState): string;
|
|
591
|
+
export function renderGraphNode(node: GraphNode): string;
|
|
592
|
+
export function resolveGraphNode(graph: RepositoryGraph | null | undefined, id: string, localRepositoryId?: string): {
|
|
593
|
+
state: "resolved" | "ambiguous" | "missing";
|
|
594
|
+
id: string;
|
|
595
|
+
candidates: string[];
|
|
596
|
+
node: GraphNode | null;
|
|
597
|
+
};
|
|
598
|
+
export function diagnosticsToSarif(diagnostics: Diagnostic[]): Record<string, unknown>;
|
|
599
|
+
export function buildSearchShards(index: LlmnavIndex, searchIndex: LlmnavSearchIndex, shardSize: number): {
|
|
600
|
+
manifest: null | {
|
|
601
|
+
schemaVersion: 1;
|
|
602
|
+
encoding: "card-range-v1";
|
|
603
|
+
repositoryId: string;
|
|
604
|
+
sourceCardSetHash: string;
|
|
605
|
+
shardSize: number;
|
|
606
|
+
shardCount: number;
|
|
607
|
+
shards: Array<{ file: string; firstId: string; lastId: string; cardCount: number; cardSetHash: string; sha256: string }>;
|
|
608
|
+
};
|
|
609
|
+
shards: Map<string, string>;
|
|
610
|
+
};
|
|
611
|
+
export function buildContractFingerprints(project: ScannedProject, cards: IndexedCard[]): ContractFingerprints;
|
|
612
|
+
export function compareContractFingerprints(previous: ContractFingerprints | null | undefined, current: ContractFingerprints | null | undefined): ContractFingerprintChange[];
|
|
613
|
+
export function compareCardIndexes(previousIndex: LlmnavIndex | null, currentIndex: LlmnavIndex): ChangedCardRecord[];
|
|
614
|
+
export function describeAffectedBoundaries(changedCards: ChangedCardRecord[], config: LlmnavConfig, previousIndex: LlmnavIndex | null, currentIndex: LlmnavIndex): AffectedBoundaryRecord[];
|
|
615
|
+
export function describeAffectedCatalogs(changedFiles: string[], cacheDirectory: string, config: LlmnavConfig, previousIndex: LlmnavIndex | null, currentIndex: LlmnavIndex): AffectedCatalogRecord[];
|
|
616
|
+
export function loadConfig(root: string): Promise<{ config: LlmnavConfig; configPath: string }>;
|
|
617
|
+
export function validateConfig(config: LlmnavConfig, configPath?: string): void;
|
|
618
|
+
export function findAttachedDeclaration(source: string, block: LlmnavBlock, filePath: string): Declaration | null;
|
|
619
|
+
export function extractImports(source: string, filePath: string): string[];
|
|
620
|
+
export function doctorProject(root: string): Promise<{ ok: boolean; checks: Array<{ name: string; ok: boolean; message: string }> }>;
|
|
621
|
+
export function evaluateProject(root: string, options?: { top?: number; file?: string }): Promise<EvaluationResult>;
|
|
622
|
+
export function collectSourceFiles(root: string, config: LlmnavConfig, requestedPaths?: string[]): Promise<string[]>;
|
|
623
|
+
export function findProjectRoot(start?: string): Promise<string>;
|
|
624
|
+
export function formatProject(root: string, options?: { check?: boolean; paths?: string[] }): Promise<{ ok: boolean; changedFiles: string[]; errors: Array<{ file: string; line: number; message: string }> }>;
|
|
625
|
+
export function buildArtifacts(project: ScannedProject, order: string[], options?: { previousSearchIndex?: LlmnavSearchIndex | null; previousGraphState?: RepositoryGraphState | null; fileState?: LlmnavFileState }): Map<string, string>;
|
|
626
|
+
export function buildArtifactSet(project: ScannedProject, order: string[], options?: { previousSearchIndex?: LlmnavSearchIndex | null; previousGraphState?: RepositoryGraphState | null; fileState?: LlmnavFileState }): { artifacts: Map<string, string>; index: LlmnavIndex; searchIndex: LlmnavSearchIndex; searchStats: SearchIndexStats; fileState: LlmnavFileState; graph: RepositoryGraph; graphState: RepositoryGraphState; graphStats: IncrementalGraphStats; promptBundle: PromptPrefixBundle; moduleManifest: Array<{ id: string; file: string; cards: number }> };
|
|
627
|
+
export function generateProject(root: string, options?: { check?: boolean; incremental?: boolean; useStatHints?: boolean; paths?: string[]; failpoint?: string; renameOptions?: Record<string, unknown>; lockOptions?: Record<string, unknown>; onTransactionPhase?: (phase: string) => void | Promise<void> }): Promise<GenerationResult>;
|
|
628
|
+
export function renderCompactCard(card: IndexedCard): string;
|
|
629
|
+
export function renderSemanticCard(card: IndexedCard): string;
|
|
630
|
+
export function scanProjectIncremental(root: string, options?: { paths?: string[]; useStatHints?: boolean; previousState?: LlmnavFileState }): Promise<{ project: ScannedProject; fileState: LlmnavFileState; stats: IncrementalFileStats; statHints: unknown; hintsPath: string }>;
|
|
631
|
+
export function buildFileStateFromProject(project: ScannedProject): LlmnavFileState;
|
|
632
|
+
export function renderFileState(fileState: LlmnavFileState): string;
|
|
633
|
+
export function usableFileState(value: unknown): value is LlmnavFileState;
|
|
634
|
+
export function initializeProject(root: string, options?: { force?: boolean; packageScripts?: boolean; agents?: string[] }): Promise<{ ok: boolean; changed: string[]; generated: GenerationResult }>;
|
|
635
|
+
export function buildInvertedIndex(index: LlmnavIndex, previous?: LlmnavSearchIndex | null): { searchIndex: LlmnavSearchIndex; stats: SearchIndexStats };
|
|
636
|
+
export function buildSearchDocument(card: IndexedCard, hash?: string): SearchDocument;
|
|
637
|
+
export function isCompatibleSearchIndex(searchIndex: unknown, repositoryId?: string): searchIndex is LlmnavSearchIndex;
|
|
638
|
+
export function renderSearchIndex(searchIndex: LlmnavSearchIndex): string;
|
|
639
|
+
export function searchCardSetHash(cards: IndexedCard[]): string;
|
|
640
|
+
export function searchDocumentHash(card: IndexedCard): string;
|
|
641
|
+
export function verifySearchIndex(index: LlmnavIndex, searchIndex: LlmnavSearchIndex): boolean;
|
|
642
|
+
export function canonicalizeSource(source: string, filePath?: string): { source: string; changed: boolean; blocks: LlmnavBlock[]; errors: Array<{ line: number; message: string }> };
|
|
643
|
+
export function cardToCanonicalObject(card: LlmnavCard): Record<string, string | string[]>;
|
|
644
|
+
export function formatLlmnavBlock(block: LlmnavBlock): string;
|
|
645
|
+
export function parseLlmnavBlocks(source: string, filePath?: string): LlmnavBlock[];
|
|
646
|
+
export function scanProject(root: string, options?: { paths?: string[] }): Promise<ScannedProject>;
|
|
647
|
+
export function ensureActiveIds(root: string, registry: Registry, ids: string[]): Promise<{ records: RegistryRecord[]; changed: boolean }>;
|
|
648
|
+
export function mergeActiveIds(registry: Registry, ids: string[]): { records: RegistryRecord[]; changed: boolean };
|
|
649
|
+
export function renderRegistryRecords(records: RegistryRecord[]): string;
|
|
650
|
+
export function loadRegistry(root: string): Promise<Registry>;
|
|
651
|
+
export function resolveRegistryId(registry: Registry, id: string): { id: string; state: string; [key: string]: unknown };
|
|
652
|
+
export function buildContext(root: string, id: string, options?: { depth?: number; budget?: number; maxEdges?: number }): Promise<{ id: string; depth: number; budget: number; maxEdges: number; included: string[]; includedEdges: string[]; text: string }>;
|
|
653
|
+
export function createProjectSession(root: string): Promise<ProjectSession>;
|
|
654
|
+
export function loadSearchData(root: string): Promise<{ index: LlmnavIndex; searchIndex: LlmnavSearchIndex; lexicon: { version?: number; aliases: Record<string, string | string[]> }; graph: RepositoryGraph | null }>;
|
|
655
|
+
export function queryIndex(index: LlmnavIndex, query: string, options?: { top?: number; lexicon?: { aliases: Record<string, string | string[]> }; invertedIndex?: LlmnavSearchIndex; metrics?: SearchMetrics; graph?: RepositoryGraph | null }): SearchResult[];
|
|
656
|
+
export function queryPreparedIndex(index: LlmnavIndex, searchIndex: LlmnavSearchIndex, query: string, options?: { top?: number; lexicon?: { aliases: Record<string, string | string[]> }; metrics?: SearchMetrics; graph?: RepositoryGraph | null }): SearchResult[];
|
|
657
|
+
export function queryIndexLegacy(index: LlmnavIndex, query: string, options?: { top?: number; lexicon?: { aliases: Record<string, string | string[]> } }): SearchResult[];
|
|
658
|
+
export function queryProject(root: string, query: string, options?: { top?: number }): Promise<SearchResult[]>;
|
|
659
|
+
export function showProjectCard(root: string, id: string): Promise<{ card: IndexedCard | null; node: GraphNode | null; resolvedFrom: unknown }>;
|
|
660
|
+
export function tokenize(value: string): string[];
|
|
661
|
+
export function normalizeSearchText(value: string): string;
|
|
662
|
+
export function commitGeneratedCache(root: string, cacheDirectory: string, artifacts: Map<string, string>, options?: Record<string, unknown>): Promise<TransactionResult>;
|
|
663
|
+
export function recoverGenerationTransaction(root: string, options?: { cacheDirectory?: string; renameOptions?: Record<string, unknown>; lockOptions?: Record<string, unknown> }): Promise<{ recovered: boolean; action: string }>;
|
|
664
|
+
export function acquireGenerationLock(root: string, options?: Record<string, unknown>): Promise<{ root: string; lockPath: string; ownerId: string }>;
|
|
665
|
+
export function releaseGenerationLock(lock: { root: string; lockPath: string; ownerId: string }): Promise<void>;
|
|
666
|
+
export function withGenerationLock<T>(root: string, callback: (lock: { root: string; lockPath: string; ownerId: string }) => T | Promise<T>, options?: Record<string, unknown>): Promise<T>;
|
|
667
|
+
export function renameWithRetry(source: string, destination: string, options?: Record<string, unknown>): Promise<void>;
|
|
668
|
+
export function removeWithRetry(target: string, options?: Record<string, unknown>): Promise<void>;
|
|
669
|
+
export function countDiagnostics(diagnostics: Diagnostic[]): { error: number; warning: number; info: number };
|
|
670
|
+
export function diagnostic(severity: DiagnosticSeverity, code: string, message: string, file: string, line?: number, column?: number): Diagnostic;
|
|
671
|
+
export function validateProject(project: ScannedProject): Diagnostic[];
|
|
672
|
+
|
|
673
|
+
export * from "./spec.js";
|