@wrongstack/tools 1.0.1 → 1.0.3

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.
Files changed (98) hide show
  1. package/dist/_win32-resolve.d.ts +1 -6
  2. package/dist/audit.js +5 -5
  3. package/dist/bash.js +2 -2
  4. package/dist/builtin.js +30 -30
  5. package/dist/{chunk-7LQCT3LT.js → chunk-32XPUSY3.js} +3 -3
  6. package/dist/{chunk-N3K2SFEI.js → chunk-3JVSOBHU.js} +1408 -200
  7. package/dist/{chunk-7N5U2RAU.js → chunk-3LS3FYEF.js} +2 -2
  8. package/dist/{chunk-FBUP524S.js → chunk-4YKVHCQC.js} +13 -2
  9. package/dist/{chunk-KE7A76VC.js → chunk-5U5ULQX2.js} +4 -14
  10. package/dist/{chunk-NU2IZ72J.js → chunk-6LCKF5KH.js} +8 -6
  11. package/dist/{chunk-GDDXX27P.js → chunk-6ZLRRC74.js} +2 -2
  12. package/dist/{chunk-IYH4OHBP.js → chunk-77MBK46T.js} +3 -3
  13. package/dist/{chunk-DK4J2WMH.js → chunk-AMURQAJX.js} +2 -2
  14. package/dist/{chunk-ZTCJCYLN.js → chunk-CVNCSMVU.js} +49 -6
  15. package/dist/{chunk-MJSJWXBF.js → chunk-DX5KZEMK.js} +14 -2
  16. package/dist/{chunk-CGXTR34H.js → chunk-E2ZD4ERD.js} +2 -2
  17. package/dist/{chunk-DRRY6SCM.js → chunk-EMA2XENR.js} +2 -2
  18. package/dist/{chunk-3D5DJWOE.js → chunk-FC3X7GGJ.js} +11 -3
  19. package/dist/{chunk-T3SMFF5Q.js → chunk-GU7QJ37F.js} +2 -2
  20. package/dist/{chunk-4WPBS45A.js → chunk-IRUEHGCR.js} +3 -3
  21. package/dist/{chunk-WEEVSWQB.js → chunk-KIQTABBJ.js} +3 -3
  22. package/dist/{chunk-6H4ERJP7.js → chunk-KYVOTHG7.js} +2 -2
  23. package/dist/{chunk-O6BY43ZB.js → chunk-MIV2RU5B.js} +3 -3
  24. package/dist/{chunk-5KS24LTS.js → chunk-NOCU555K.js} +2 -2
  25. package/dist/{chunk-6GOZTS6F.js → chunk-OUEH4I4X.js} +3 -3
  26. package/dist/{chunk-YEISRT4S.js → chunk-PNLDTRC5.js} +1429 -242
  27. package/dist/{chunk-GKSG5CPH.js → chunk-QU2VRCMM.js} +2 -2
  28. package/dist/{chunk-VVZPQPTY.js → chunk-REWOZIA4.js} +5 -3
  29. package/dist/{chunk-MGPR7VG3.js → chunk-T7YVY2BV.js} +2 -2
  30. package/dist/{chunk-IAYMTTR2.js → chunk-TYRVYBHW.js} +27 -23
  31. package/dist/{chunk-LQSOU63Z.js → chunk-VKAJMHVG.js} +2 -2
  32. package/dist/{chunk-E7JE3UEX.js → chunk-VO6M2FVG.js} +2 -2
  33. package/dist/{chunk-NJX2RXKJ.js → chunk-YDTRKEYY.js} +11 -3
  34. package/dist/{chunk-MK2JK35J.js → chunk-YECHJJJF.js} +3 -3
  35. package/dist/{chunk-QA6IASYX.js → chunk-Z34CUZCZ.js} +3 -3
  36. package/dist/{chunk-UCYQTZ7F.js → chunk-ZKC5UNGD.js} +56 -2
  37. package/dist/codebase-index/atlas-brief.d.ts +90 -0
  38. package/dist/codebase-index/atlas-export.d.ts +38 -0
  39. package/dist/codebase-index/atlas-projection.d.ts +114 -0
  40. package/dist/codebase-index/atlas-types.d.ts +90 -0
  41. package/dist/codebase-index/background-indexer.d.ts +15 -4
  42. package/dist/codebase-index/codebase-context-tool.d.ts +54 -0
  43. package/dist/codebase-index/concept-enrichment.d.ts +154 -0
  44. package/dist/codebase-index/context-retrieval.d.ts +91 -0
  45. package/dist/codebase-index/embedding-pass.d.ts +95 -0
  46. package/dist/codebase-index/graph-adjacency-cache.d.ts +36 -0
  47. package/dist/codebase-index/graph-rank-pass.d.ts +46 -0
  48. package/dist/codebase-index/graph-rank.d.ts +198 -0
  49. package/dist/codebase-index/index-service.d.ts +15 -1
  50. package/dist/codebase-index/index.d.ts +34 -19
  51. package/dist/codebase-index/index.js +128 -11
  52. package/dist/codebase-index/parser-worker-script.js +4 -4
  53. package/dist/codebase-index/perf-metrics.d.ts +19 -0
  54. package/dist/codebase-index/project-server-protocol.d.ts +2 -0
  55. package/dist/codebase-index/project-server-query-cache.d.ts +4 -0
  56. package/dist/codebase-index/project-server.js +55 -8
  57. package/dist/codebase-index/repo-map-fallback.d.ts +18 -0
  58. package/dist/codebase-index/repo-map-render.d.ts +42 -0
  59. package/dist/codebase-index/repo-map-types.d.ts +21 -0
  60. package/dist/codebase-index/repo-map.d.ts +28 -16
  61. package/dist/codebase-index/schema.d.ts +20 -0
  62. package/dist/codebase-index/worker-protocol.d.ts +47 -1
  63. package/dist/codebase-index/worker.js +12 -6
  64. package/dist/codebase-index/writer-concepts.d.ts +84 -0
  65. package/dist/codebase-index/writer-graph-decorate.d.ts +30 -0
  66. package/dist/codebase-index/writer-graph-reader.d.ts +22 -0
  67. package/dist/codebase-index/writer-rank.d.ts +78 -0
  68. package/dist/codebase-index/writer-schema.d.ts +51 -0
  69. package/dist/codebase-index/writer-vectors.d.ts +53 -0
  70. package/dist/codebase-index/writer.d.ts +59 -0
  71. package/dist/edit.js +8 -8
  72. package/dist/exec.js +2 -2
  73. package/dist/fetch.js +1 -1
  74. package/dist/format.js +5 -5
  75. package/dist/{go-parser-D7ELWQ7F.js → go-parser-EMKTAAD3.js} +5 -3
  76. package/dist/index.d.ts +48 -48
  77. package/dist/index.js +57 -33
  78. package/dist/install.js +5 -5
  79. package/dist/languages/index.js +3 -3
  80. package/dist/{legacy-bridge-YXANP5QB.js → legacy-bridge-WVQ4BHDI.js} +5 -5
  81. package/dist/lint.js +5 -5
  82. package/dist/outdated.js +2 -2
  83. package/dist/pack.js +31 -31
  84. package/dist/parser-dispatch-UQAB4E6V.js +14 -0
  85. package/dist/patch.js +8 -8
  86. package/dist/plan.js +2 -2
  87. package/dist/{py-parser-QC6MR4GB.js → py-parser-DDG53RXI.js} +4 -4
  88. package/dist/read.js +8 -8
  89. package/dist/replace.js +8 -8
  90. package/dist/task.js +2 -2
  91. package/dist/test.js +5 -5
  92. package/dist/todo.js +1 -1
  93. package/dist/tool-tier.js +32 -32
  94. package/dist/typecheck.js +5 -5
  95. package/dist/win32.js +1 -1
  96. package/dist/write.js +8 -8
  97. package/package.json +5 -5
  98. package/dist/parser-dispatch-BDVCJXTV.js +0 -14
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Graph centrality over the symbol wiring graph.
3
+ *
4
+ * Two modes share one implementation:
5
+ *
6
+ * - **Global** — computed once per index run with a uniform restart
7
+ * distribution, persisted to `symbol_rank` / `file_rank`. Answers "what is
8
+ * architecturally central in this repo", and drives the repo map, the
9
+ * CodeMap node sizing and the atlas projection.
10
+ * - **Personalised** — computed per query with the lexical (BM25) hit scores
11
+ * as the restart distribution. Answers "what is central *to this query*".
12
+ * Lexical search proposes the seeds; the graph decides the ordering.
13
+ *
14
+ * The walk runs over an **undirected** view of the graph: a caller and its
15
+ * callee are mutually relevant when you are trying to understand either one,
16
+ * and a directed walk starves leaf utilities that everything depends on.
17
+ * Directed in/out degrees are still reported separately, because they are
18
+ * what a human reads as "blast radius" vs "coupling".
19
+ *
20
+ * Only refs that resolved to a real symbol id participate. At the time of
21
+ * writing roughly a third of this repo's refs stay unresolved (stdlib and
22
+ * third-party targets that were never indexed); including them would mean
23
+ * walking to nodes that carry no code.
24
+ *
25
+ * Edge multiplicity is deliberately preserved. Five calls from A to B produce
26
+ * five edges, so B receives five shares of A's mass: repeated coupling is
27
+ * stronger coupling. Self-references are dropped — recursion should not make
28
+ * a symbol important on its own account.
29
+ *
30
+ * ## Why edges carry a confidence weight
31
+ *
32
+ * The index resolves a ref by matching `to_name` to the lowest symbol id in
33
+ * the same language family — it is not file- or import-aware, which
34
+ * `findIncomingCallsByName` already documents as an ambiguity source. For a
35
+ * per-query answer that is a caveat; for a global ranking it is fatal. On this
36
+ * repo roughly half of all resolved refs point at a name that several symbols
37
+ * declare, and the worst offenders are test globals and single-letter locals:
38
+ * every `it(...)` in the suite lands on whichever `it` happens to hold the
39
+ * lowest id, handing that one symbol thousands of incoming edges it never had.
40
+ *
41
+ * So an edge into a name that `n` symbols declare carries weight `1 / n`: the
42
+ * resolver guessed one of `n` equally plausible targets, and the walk spreads
43
+ * exactly that much belief. Unique names — the half we can actually trust —
44
+ * keep full weight.
45
+ *
46
+ * Homonym counting alone is not enough, because the worst misresolutions are
47
+ * to names that really are unique. Every `it(...)` in the test suite resolves
48
+ * to the one `const it: Catalog` in the desktop app's i18n file — the Italian
49
+ * locale — handing a translation table 5,500 incoming edges. Nothing declares
50
+ * a competing `it`, so no homonym penalty applies.
51
+ *
52
+ * The second weight is therefore visibility, in three tiers. An edge is fully
53
+ * trusted when the two symbols share a file, or when the source file actually
54
+ * imports the target's file — the module resolver already recorded those pairs
55
+ * in `refs.to_file`. Otherwise the question is whether we can believe the
56
+ * absence of that import:
57
+ *
58
+ * - The source file has resolved imports, and the target's file is not among
59
+ * them. The resolver worked here and still did not connect these two files,
60
+ * so the reference almost certainly is not to this symbol
61
+ * ({@link CONTRADICTED_VISIBILITY_WEIGHT}).
62
+ * - The source file has no resolved imports at all. Resolution failed
63
+ * wholesale for it, so its silence is not evidence either way, and the edge
64
+ * keeps a reduced but meaningful weight
65
+ * ({@link UNVERIFIED_VISIBILITY_WEIGHT}).
66
+ *
67
+ * These stay penalties rather than filters: module resolution only resolves
68
+ * about three fifths of this repo's import specifiers, and dropping the rest
69
+ * outright would gut the graph.
70
+ *
71
+ * Both of these are ranking-quality fixes, not resolver fixes; making ref
72
+ * resolution import-aware would remove the need for either.
73
+ */
74
+ /** Ref shape as returned by `IndexStore.getAllResolvedRefs()`. */
75
+ export interface ResolvedRefEdge {
76
+ fromId: number;
77
+ toId: number;
78
+ callType: string;
79
+ }
80
+ /**
81
+ * Compressed sparse row adjacency over a dense node numbering.
82
+ *
83
+ * `neighbours[offsets[u] .. offsets[u + 1]]` are the dense indices adjacent to
84
+ * dense node `u`. `ids[u]` maps back to the original symbol id.
85
+ */
86
+ export interface WiringGraph {
87
+ /** Number of nodes. */
88
+ size: number;
89
+ /** Original symbol id for each dense index. */
90
+ ids: Int32Array;
91
+ /** Dense index for each original symbol id. */
92
+ index: Map<number, number>;
93
+ /** CSR row offsets, length `size + 1`. */
94
+ offsets: Int32Array;
95
+ /** CSR adjacency entries, length `offsets[size]`. */
96
+ neighbours: Int32Array;
97
+ /**
98
+ * Confidence per adjacency entry, parallel to `neighbours`, in `(0, 1]`.
99
+ *
100
+ * This attenuates rather than redistributes: an edge with confidence `c`
101
+ * carries `c` of the mass it would otherwise carry, and the remaining
102
+ * `1 - c` returns to the restart distribution as belief the walk declined
103
+ * to place. Normalising these away — dividing each node's split by the sum
104
+ * of its weights — would make them inert, because a node with a single
105
+ * low-confidence edge would still hand over all of its mass.
106
+ */
107
+ weights: Float64Array;
108
+ /** Directed in-degree per dense node (how many symbols reference it). */
109
+ inDegree: Int32Array;
110
+ /** Directed out-degree per dense node (how many symbols it references). */
111
+ outDegree: Int32Array;
112
+ }
113
+ export interface PageRankOptions {
114
+ /**
115
+ * Restart (teleport) probability — the share of mass that returns to the
116
+ * restart distribution each iteration. Higher keeps the walk closer to its
117
+ * seeds. 0.25 is the value Graft settled on for code graphs; the classic
118
+ * web-PageRank 0.15 wanders too far for personalised queries.
119
+ */
120
+ restart?: number;
121
+ /** Power iterations. 25 converges comfortably at this graph size. */
122
+ iterations?: number;
123
+ /**
124
+ * Seed weights by **dense index**, for a personalised walk. Weights need not
125
+ * be normalised. Omitted (or empty) means a uniform restart distribution.
126
+ */
127
+ seeds?: ReadonlyMap<number, number> | undefined;
128
+ }
129
+ export declare const DEFAULT_RESTART = 0.25;
130
+ export declare const DEFAULT_ITERATIONS = 25;
131
+ /**
132
+ * Weight for a cross-file edge from a file whose imports never resolved. We
133
+ * cannot corroborate the edge, but we cannot contradict it either.
134
+ */
135
+ export declare const UNVERIFIED_VISIBILITY_WEIGHT = 0.25;
136
+ /**
137
+ * Weight for a cross-file edge from a file whose imports DID resolve, to a
138
+ * file it does not import. Near-zero rather than zero so a single resolver
139
+ * miss degrades one edge instead of erasing it.
140
+ */
141
+ export declare const CONTRADICTED_VISIBILITY_WEIGHT = 0.02;
142
+ /**
143
+ * Build the undirected CSR wiring graph from the resolved ref list.
144
+ *
145
+ * Two passes over the edge list (count, then fill) so the adjacency lands in
146
+ * flat typed arrays with no intermediate per-node arrays — at 180k edges the
147
+ * array-of-arrays shape costs more in allocation than the walk itself.
148
+ */
149
+ export interface WiringGraphOptions {
150
+ /**
151
+ * How many symbols declare the name each target symbol carries, keyed by
152
+ * target symbol id. Absent ids are treated as unambiguous (weight 1).
153
+ */
154
+ candidates?: ReadonlyMap<number, number> | undefined;
155
+ /** Declaring file per symbol id, used for the visibility check. */
156
+ fileOf?: ReadonlyMap<number, string> | undefined;
157
+ /** Files each source file imports, as resolved by the module resolver. */
158
+ importsOf?: ReadonlyMap<string, ReadonlySet<string>> | undefined;
159
+ }
160
+ export declare function buildWiringGraph(refs: readonly ResolvedRefEdge[], options?: WiringGraphOptions): WiringGraph;
161
+ /**
162
+ * Power-iterate PageRank over `graph`, returning scores normalised so the
163
+ * highest is exactly 1.0. Nodes the walk never reaches score 0.
164
+ *
165
+ * Mass is conserved exactly: every node hands `restart` of its mass back to
166
+ * the restart distribution, spreads the rest over its neighbours, and a node
167
+ * with no neighbours hands everything back. Low-confidence edges return their
168
+ * unspent share to the same pool. Without it the total would leak downwards
169
+ * and the final normalisation would hide the leak.
170
+ */
171
+ export declare function pageRank(graph: WiringGraph, options?: PageRankOptions): Float64Array;
172
+ /** One persisted `symbol_rank` row. */
173
+ export interface SymbolRankRow {
174
+ symbolId: number;
175
+ rank: number;
176
+ inDeg: number;
177
+ outDeg: number;
178
+ }
179
+ /** One persisted `file_rank` row. */
180
+ export interface FileRankRow {
181
+ file: string;
182
+ rank: number;
183
+ inDeg: number;
184
+ outDeg: number;
185
+ }
186
+ /** Materialise the score vector as persistable symbol rows. */
187
+ export declare function toSymbolRankRows(graph: WiringGraph, scores: Float64Array): SymbolRankRow[];
188
+ /**
189
+ * Roll symbol scores up to files.
190
+ *
191
+ * A file's rank is the **sum** of its symbols' ranks, not the mean: a module
192
+ * that exports twenty things everyone uses is more central than one that
193
+ * exports a single equally-used thing, and averaging erases exactly that.
194
+ * Degrees roll up the same way. The result is re-normalised to max 1.0 so
195
+ * file and symbol ranks share a scale.
196
+ */
197
+ export declare function aggregateFileRank(rows: readonly SymbolRankRow[], fileOf: ReadonlyMap<number, string>): FileRankRow[];
198
+ //# sourceMappingURL=graph-rank.d.ts.map
@@ -11,8 +11,9 @@
11
11
  * run on one event loop, so a pooled connection is both safe and substantially
12
12
  * cheaper than re-running schema/FTS drift checks for every edited file.
13
13
  */
14
+ import type { ContextResult } from './context-retrieval.js';
14
15
  import type { CodeMapGraph, IndexResult, IndexStats } from './schema.js';
15
- import type { CallRefsOpArgs, IndexOpArgs, SearchOpArgs, SearchOpResult, StatsOpArgs } from './worker-protocol.js';
16
+ import type { CallRefsOpArgs, ContextOpArgs, IndexOpArgs, SearchOpArgs, SearchOpResult, StatsOpArgs, VectorSearchOpArgs, VectorSearchOpResult } from './worker-protocol.js';
16
17
  interface ServiceHooks {
17
18
  signal?: AbortSignal | undefined;
18
19
  onProgress?: ((current: number, total: number) => void) | undefined;
@@ -21,6 +22,19 @@ interface ServiceHooks {
21
22
  export declare function indexService(args: IndexOpArgs, hooks?: ServiceHooks): Promise<IndexResult>;
22
23
  /** Ranked symbol search (FTS5 inside SQLite; BM25 fallback without FTS5). */
23
24
  export declare function searchService(args: SearchOpArgs): SearchOpResult;
25
+ /**
26
+ * Personalised retrieval: lexical seeds walked through the wiring graph.
27
+ *
28
+ * Path relativisation happens here rather than in the retriever so the pure
29
+ * algorithm stays free of `node:path`, and so the daemon — which knows the
30
+ * project root it was started for — is the one that decides what "relative"
31
+ * means.
32
+ */
33
+ export declare function contextService(args: ContextOpArgs): ContextResult;
34
+ /**
35
+ * Nearest files to a query vector. The caller embeds; this only compares.
36
+ */
37
+ export declare function vectorSearchService(args: VectorSearchOpArgs): VectorSearchOpResult;
24
38
  /** Index health and statistics. */
25
39
  export declare function statsService(args: StatsOpArgs): IndexStats;
26
40
  /** Package-level dependency graph. */
@@ -13,36 +13,51 @@
13
13
  * fallback so every mapped language always enters the index
14
14
  * Ranking: Okapi BM25 / FTS5 (k1=1.5, b=0.75)
15
15
  */
16
- export { resolveProjectIndexDaemonAvailability, type ProjectIndexDaemonAvailability, } from './project-server-client.js';
16
+ export { type InvariantEvaluationResult, type InvariantRuleId, type InvariantViolation, type ModuleContract, PolyglotInvariantEngine, polyglotInvariantEngine, } from './ast-invariant-engine.js';
17
+ export { type MutateSymbolOptions, type MutateSymbolResult, replaceSymbolInFile, } from './ast-symbol-mutator.js';
17
18
  export { cancelPendingReindexes, checkCodebaseIndexServerHealth, codebaseIndexStats, enqueueReindex, ensureCodebaseIndexServer, fileGraphService, getIndexState, incomingCallsService, isIndexableFile, isIndexing, isIndexReady, onIndexStateChange, outgoingCallsService, packageGraphService, runStartupIndex, searchCodebaseIndex, shutdownCodebaseIndexHost, shutdownCodebaseIndexServer, symbolGraphService, } from './background-indexer.js';
18
19
  export { buildBm25Index, buildIndexableText, tokenise, } from './bm25.js';
20
+ export { getCodebaseIndexPerfSnapshot, resetCodebaseIndexPerfMetrics, type CodebaseIndexPerfSnapshot, } from './perf-metrics.js';
19
21
  export type { CircuitSnapshot, CircuitState } from './circuit-breaker.js';
20
22
  export { CircuitOpenError, IndexCircuitBreaker, IndexTimeoutError, indexCircuitBreaker, resetIndexCircuitBreaker, } from './circuit-breaker.js';
21
- export { codebaseAstReplaceTool, type CodebaseAstReplaceInput, type CodebaseAstReplaceOutput, } from './codebase-ast-replace-tool.js';
22
- export { codebaseInvariantCheckTool, type CodebaseInvariantCheckInput, type CodebaseInvariantCheckOutput, } from './codebase-invariant-check-tool.js';
23
- export { replaceSymbolInFile, type MutateSymbolOptions, type MutateSymbolResult, } from './ast-symbol-mutator.js';
24
- export { codebaseImpactAnalysisTool, type CodebaseImpactAnalysisInput, type CodebaseImpactAnalysisOutput, type ImpactAnalysisInput, type ImpactAnalysisOutput, type ImpactCallSite, } from './codebase-impact-analysis-tool.js';
25
- export { codebaseIncomingCallsTool, type CodebaseIncomingCallsInput, type CodebaseIncomingCallsOutput, type IncomingCallsInput, type IncomingCallsOutput, } from './codebase-incoming-calls-tool.js';
26
- export { codebaseIndexTool, type CodebaseIndexInput, type CodebaseIndexOutput, } from './codebase-index-tool.js';
27
- export { codebaseOutgoingCallsTool, type CodebaseOutgoingCallsInput, type CodebaseOutgoingCallsOutput, type OutgoingCallsInput, type OutgoingCallsOutput, } from './codebase-outgoing-calls-tool.js';
28
- export { codebaseRepoMapTool, type CodebaseRepoMapInput, type CodebaseRepoMapOutput, } from './codebase-repo-map-tool.js';
29
- export { codebaseSearchTool, type CodebaseSearchInput, type CodebaseSearchOutput, } from './codebase-search-tool.js';
30
- export { codebaseSkeletonTool, type CodebaseSkeletonInput, type CodebaseSkeletonOutput, } from './codebase-skeleton-tool.js';
31
- export { codebaseStatsTool, type CodebaseStatsInput, type CodebaseStatsOutput, } from './codebase-stats-tool.js';
32
- export { codebaseTargetedTestTool, type CodebaseTargetedTestInput, type CodebaseTargetedTestOutput, type TargetedTestInput, type TargetedTestOutput, } from './codebase-targeted-test-tool.js';
33
- export { generateRepoMap, type RepoMapOptions, type RepoMapResult, } from './repo-map.js';
34
- export { extractDirectorySkeleton, extractFileSkeleton, type FileSkeletonResult, type SkeletonOptions, type SkeletonSymbolRange, } from './skeleton-extractor.js';
35
- export { deadCodeScanTool, runDeadCodeScan } from './dead-code-scan.js';
23
+ export { type CodebaseAstReplaceInput, type CodebaseAstReplaceOutput, codebaseAstReplaceTool, } from './codebase-ast-replace-tool.js';
24
+ export { type CodebaseImpactAnalysisInput, type CodebaseImpactAnalysisOutput, codebaseImpactAnalysisTool, type ImpactAnalysisInput, type ImpactAnalysisOutput, type ImpactCallSite, } from './codebase-impact-analysis-tool.js';
25
+ export { type CodebaseIncomingCallsInput, type CodebaseIncomingCallsOutput, codebaseIncomingCallsTool, type IncomingCallsInput, type IncomingCallsOutput, } from './codebase-incoming-calls-tool.js';
26
+ export { type CodebaseIndexInput, type CodebaseIndexOutput, codebaseIndexTool, } from './codebase-index-tool.js';
27
+ export { type CodebaseInvariantCheckInput, type CodebaseInvariantCheckOutput, codebaseInvariantCheckTool, } from './codebase-invariant-check-tool.js';
28
+ export { type CodebaseOutgoingCallsInput, type CodebaseOutgoingCallsOutput, codebaseOutgoingCallsTool, type OutgoingCallsInput, type OutgoingCallsOutput, } from './codebase-outgoing-calls-tool.js';
29
+ export { type CodebaseRepoMapInput, type CodebaseRepoMapOutput, codebaseRepoMapTool, } from './codebase-repo-map-tool.js';
30
+ export { type CodebaseSearchInput, type CodebaseSearchOutput, codebaseSearchTool, } from './codebase-search-tool.js';
31
+ export { type CodebaseSkeletonInput, type CodebaseSkeletonOutput, codebaseSkeletonTool, } from './codebase-skeleton-tool.js';
32
+ export { type CodebaseStatsInput, type CodebaseStatsOutput, codebaseStatsTool, } from './codebase-stats-tool.js';
33
+ export { type CodebaseTargetedTestInput, type CodebaseTargetedTestOutput, codebaseTargetedTestTool, type TargetedTestInput, type TargetedTestOutput, } from './codebase-targeted-test-tool.js';
36
34
  export type { DeadCodeScanInput, DeadCodeScanOutput, DeadFile, DeadPackage, DeadSymbol, } from './dead-code-scan.js';
35
+ export { deadCodeScanTool, runDeadCodeScan } from './dead-code-scan.js';
36
+ export { compileGitignore, type IgnoreMatcher, loadGitignoreMatcher, } from './gitignore.js';
37
37
  export { runIndexer } from './indexer.js';
38
- export { compileGitignore, loadGitignoreMatcher, type IgnoreMatcher, } from './gitignore.js';
39
38
  export { detectLang, INDEXABLE_EXTENSIONS, isIndexablePath } from './languages.js';
40
39
  export { internalKindToLspKind, lspKindToInternalKind, } from './lsp-kind.js';
41
40
  export type { ProjectIndexServerClientHealth, ProjectIndexServerConnectionState, ProjectIndexServerConnectionStatus, } from './project-server-client.js';
41
+ export { type ProjectIndexDaemonAvailability, resolveProjectIndexDaemonAvailability, } from './project-server-client.js';
42
+ export { projectIndexServerEndpoint, projectIndexServerMetadataPath, } from './project-server-endpoint.js';
42
43
  export type { ProjectIndexServerActivity, ProjectIndexServerHealth, } from './project-server-protocol.js';
44
+ export { generateRepoMap, type RepoMapOptions, type RepoMapResult, } from './repo-map.js';
43
45
  export type { CallSite, CodeMapGraph, FileMeta, FileSymbols, GraphEdge, GraphNode, IndexResult, IndexStats, SearchResult, Symbol, SymbolKind, SymbolLang, } from './schema.js';
44
- export { projectIndexServerEndpoint, projectIndexServerMetadataPath, } from './project-server-endpoint.js';
45
46
  export { SCHEMA_VERSION } from './schema.js';
47
+ export { extractDirectorySkeleton, extractFileSkeleton, type FileSkeletonResult, type SkeletonOptions, type SkeletonSymbolRange, } from './skeleton-extractor.js';
46
48
  export { codebaseIndexDirOverride, IndexStore, resolveIndexDir } from './writer.js';
47
- export { PolyglotInvariantEngine, polyglotInvariantEngine, type InvariantEvaluationResult, type InvariantRuleId, type InvariantViolation, type ModuleContract, } from './ast-invariant-engine.js';
49
+ export { type AtlasBrief, type AtlasBriefHub, type AtlasBriefIndexMissing, type AtlasBriefPackage, type AtlasBriefSubsystem, BRIEF_HUB_LIMIT, BRIEF_PACKAGE_LIMIT, BRIEF_SUBSYSTEM_LIMIT, buildAtlasBrief, buildProjectAtlasBrief, } from './atlas-brief.js';
50
+ export { type AtlasExportOptions, EXPORT_FILE_LIMIT, EXPORT_PACKAGE_LIMIT, renderAtlasHtml, } from './atlas-export.js';
51
+ export { ATLAS_DIR, ATLAS_FILE_LIMIT, ATLAS_JSON, ATLAS_MANIFEST, ATLAS_MARKDOWN, ATLAS_SCHEMA, type AtlasDocument, type AtlasEdge, type AtlasFile, type AtlasFreshness, type AtlasIndexMissing, type AtlasManifest, type AtlasPackage, type AtlasProjection, type AtlasSymbol, buildAtlas, checkAtlasFreshness, checkProjectAtlasFreshness, exportProjectAtlasHtml, MAX_REPORTED_DRIFT, type WrittenAtlas, writeAtlas, writeProjectAtlas, } from './atlas-projection.js';
52
+ export { type CodebaseContextInput, type CodebaseContextOutput, codebaseContextTool, setContextQueryEmbedder, } from './codebase-context-tool.js';
53
+ export { type ConceptIndexMissing, DEFAULT_CONCURRENCY, type EnrichOptions, type EnrichResult, enrichConcepts, enrichProjectConcepts, MAX_CRUX_LINES, MAX_SOURCE_CHARS, MAX_SUMMARY_CHARS, type SummarizeFileInput, type SummarizeFileResult, type SummarizerPort, type SummarizeSubsystemInput, type SummarizeSubsystemResult, } from './concept-enrichment.js';
54
+ export { type ContextEntry, type ContextOptions, type ContextResult, type ContextSymbol, DEFAULT_LIMIT, DEFAULT_SYMBOLS_PER_FILE, retrieveContext, SEED_LIMIT, } from './context-retrieval.js';
55
+ export { DEFAULT_BATCH_SIZE, type EmbeddingPort, type EmbedIndexMissing, type EmbedOptions, type EmbedResult, embedFiles, embedProjectFiles, MAX_EMBED_CHARS, } from './embedding-pass.js';
56
+ export { clearWiringSnapshot, getWiringSnapshot, type WiringSnapshot, } from './graph-adjacency-cache.js';
57
+ export { aggregateFileRank, buildWiringGraph, CONTRADICTED_VISIBILITY_WEIGHT, DEFAULT_ITERATIONS, DEFAULT_RESTART, type FileRankRow, type PageRankOptions, pageRank, type ResolvedRefEdge, type SymbolRankRow, toSymbolRankRows, UNVERIFIED_VISIBILITY_WEIGHT, type WiringGraph, type WiringGraphOptions, } from './graph-rank.js';
58
+ export { RANK_REFRESH_FILE_THRESHOLD, RANK_VERSION, RANK_VERSION_KEY, type RankPassResult, runGraphRankPass, shouldRefreshRanks, } from './graph-rank-pass.js';
59
+ export { CONCEPT_RELATIONS, type ConceptCoverage, type ConceptEdge, type ConceptRelation, type ConceptState, type FileConcept, isConceptRelation, type Subsystem, } from './writer-concepts.js';
60
+ export { decorateGraphNodes } from './writer-graph-decorate.js';
61
+ export type { RankedFileRow } from './writer-rank.js';
62
+ export { FILE_VECTOR_PROVIDER_KEY, type FileVectorRow, type FileVectorState, type VectorHit, } from './writer-vectors.js';
48
63
  //# sourceMappingURL=index.d.ts.map
@@ -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,15 +36,24 @@ 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
- } from "../chunk-YEISRT4S.js";
50
+ runDeadCodeScan,
51
+ setContextQueryEmbedder,
52
+ writeAtlas,
53
+ writeProjectAtlas
54
+ } from "../chunk-PNLDTRC5.js";
22
55
  import "../chunk-XRNN44QY.js";
23
- import "../chunk-DRRY6SCM.js";
56
+ import "../chunk-EMA2XENR.js";
24
57
  import "../chunk-SCMRM6NL.js";
25
58
  import "../chunk-HDYUBRMF.js";
26
59
  import "../chunk-7JJFC6CT.js";
@@ -45,32 +78,58 @@ import {
45
78
  shutdownCodebaseIndexHost,
46
79
  shutdownCodebaseIndexServer,
47
80
  symbolGraphService
48
- } from "../chunk-ZTCJCYLN.js";
81
+ } from "../chunk-CVNCSMVU.js";
49
82
  import {
50
83
  projectIndexServerEndpoint,
51
84
  projectIndexServerMetadataPath
52
- } from "../chunk-GDDXX27P.js";
85
+ } from "../chunk-6ZLRRC74.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-N3K2SFEI.js";
70
- import "../chunk-NU2IZ72J.js";
71
- import "../chunk-VVZPQPTY.js";
125
+ } from "../chunk-3JVSOBHU.js";
126
+ import "../chunk-6LCKF5KH.js";
127
+ import "../chunk-REWOZIA4.js";
72
128
  import "../chunk-6IEBD27U.js";
73
- import "../chunk-UCYQTZ7F.js";
129
+ import {
130
+ getCodebaseIndexPerfSnapshot,
131
+ resetCodebaseIndexPerfMetrics
132
+ } from "../chunk-ZKC5UNGD.js";
74
133
  import {
75
134
  INDEXABLE_EXTENSIONS,
76
135
  detectLang,
@@ -80,21 +139,60 @@ import {
80
139
  compileGitignore,
81
140
  loadGitignoreMatcher
82
141
  } from "../chunk-2CTZW6JQ.js";
83
- import "../chunk-KE7A76VC.js";
142
+ import "../chunk-5U5ULQX2.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
- tokenise
260
+ toSymbolRankRows,
261
+ tokenise,
262
+ writeAtlas,
263
+ writeProjectAtlas
147
264
  };
148
265
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  parseFilesContent
3
- } from "../chunk-NU2IZ72J.js";
4
- import "../chunk-VVZPQPTY.js";
3
+ } from "../chunk-6LCKF5KH.js";
4
+ import "../chunk-REWOZIA4.js";
5
5
  import "../chunk-6IEBD27U.js";
6
- import "../chunk-UCYQTZ7F.js";
6
+ import "../chunk-ZKC5UNGD.js";
7
7
  import "../chunk-YOHO4DVT.js";
8
- import "../chunk-KE7A76VC.js";
8
+ import "../chunk-5U5ULQX2.js";
9
9
 
10
10
  // src/codebase-index/parser-worker-script.ts
11
11
  import { parentPort, threadId } from "node:worker_threads";
@@ -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>;