@vibgrate/cli 2026.722.2 → 2026.727.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/DOCS.md +418 -213
- package/README.md +34 -8
- package/dist/baseline-TG4ATZGZ.js +8 -0
- package/dist/{baseline-BD3A7EXD.js.map → baseline-TG4ATZGZ.js.map} +1 -1
- package/dist/chunk-2MBL43EJ.js +82 -0
- package/dist/chunk-2MBL43EJ.js.map +1 -0
- package/dist/chunk-2XQDMLKB.js +465 -0
- package/dist/chunk-2XQDMLKB.js.map +1 -0
- package/dist/{chunk-PY3DNX5H.js → chunk-3Q7QBWFW.js} +13 -2
- package/dist/chunk-3Q7QBWFW.js.map +1 -0
- package/dist/chunk-3V24O47U.js +478 -0
- package/dist/chunk-3V24O47U.js.map +1 -0
- package/dist/chunk-5I4VSBWQ.js +764 -0
- package/dist/chunk-5I4VSBWQ.js.map +1 -0
- package/dist/{chunk-WNIIKCNF.js → chunk-6ABXHZRN.js} +59 -311
- package/dist/chunk-6ABXHZRN.js.map +1 -0
- package/dist/chunk-6AYDFFP5.js +136 -0
- package/dist/chunk-6AYDFFP5.js.map +1 -0
- package/dist/chunk-6UQMXIAG.js +122 -0
- package/dist/chunk-6UQMXIAG.js.map +1 -0
- package/dist/chunk-7N4Y3E47.js +108 -0
- package/dist/chunk-7N4Y3E47.js.map +1 -0
- package/dist/chunk-BPF3YX2U.js +64 -0
- package/dist/chunk-BPF3YX2U.js.map +1 -0
- package/dist/chunk-BWPBB45M.js +88 -0
- package/dist/chunk-BWPBB45M.js.map +1 -0
- package/dist/{chunk-6CXTPC74.js → chunk-CY4WKXB2.js} +27 -6
- package/dist/chunk-CY4WKXB2.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +10 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/{chunk-NONYJLOJ.js → chunk-EX4PQT6W.js} +3 -3
- package/dist/{chunk-NONYJLOJ.js.map → chunk-EX4PQT6W.js.map} +1 -1
- package/dist/chunk-IS7VTH2Q.js +627 -0
- package/dist/chunk-IS7VTH2Q.js.map +1 -0
- package/dist/chunk-IZDH67DX.js +289 -0
- package/dist/chunk-IZDH67DX.js.map +1 -0
- package/dist/chunk-J4RFRKZH.js +2496 -0
- package/dist/chunk-J4RFRKZH.js.map +1 -0
- package/dist/chunk-J7LKEB2R.js +51 -0
- package/dist/chunk-J7LKEB2R.js.map +1 -0
- package/dist/chunk-JIBOJTGS.js +313 -0
- package/dist/chunk-JIBOJTGS.js.map +1 -0
- package/dist/chunk-K3MZIVZW.js +88 -0
- package/dist/chunk-K3MZIVZW.js.map +1 -0
- package/dist/chunk-K7REHDQS.js +776 -0
- package/dist/chunk-K7REHDQS.js.map +1 -0
- package/dist/{chunk-2O5YZVZV.js → chunk-KCKYKDMS.js} +23 -19
- package/dist/chunk-KCKYKDMS.js.map +1 -0
- package/dist/{chunk-3MXNNBLI.js → chunk-KNELIQJO.js} +1647 -2042
- package/dist/chunk-KNELIQJO.js.map +1 -0
- package/dist/chunk-KSBHGWRV.js +613 -0
- package/dist/chunk-KSBHGWRV.js.map +1 -0
- package/dist/chunk-LKVMI67M.js +1695 -0
- package/dist/chunk-LKVMI67M.js.map +1 -0
- package/dist/chunk-NDMDSPFX.js +69 -0
- package/dist/chunk-NDMDSPFX.js.map +1 -0
- package/dist/{chunk-CS37OBE3.js → chunk-OFUC6RYN.js} +791 -783
- package/dist/chunk-OFUC6RYN.js.map +1 -0
- package/dist/chunk-OOIG3RUM.js +276 -0
- package/dist/chunk-OOIG3RUM.js.map +1 -0
- package/dist/chunk-PMYWZRRS.js +62 -0
- package/dist/chunk-PMYWZRRS.js.map +1 -0
- package/dist/chunk-PXHNTC6D.js +382 -0
- package/dist/chunk-PXHNTC6D.js.map +1 -0
- package/dist/{chunk-I7GY7MVN.js → chunk-RNP3SMTV.js} +60 -12
- package/dist/chunk-RNP3SMTV.js.map +1 -0
- package/dist/chunk-TCDAZZNP.js +843 -0
- package/dist/chunk-TCDAZZNP.js.map +1 -0
- package/dist/{chunk-5BDHQ7DD.js → chunk-WGUL45AV.js} +24 -17
- package/dist/chunk-WGUL45AV.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +3373 -617
- package/dist/cli.js.map +1 -1
- package/dist/execution-env-ZU45JZ4G.js +4 -0
- package/dist/execution-env-ZU45JZ4G.js.map +1 -0
- package/dist/federation-SZWZIFZ7.js +7 -0
- package/dist/federation-SZWZIFZ7.js.map +1 -0
- package/dist/{fs-IPY4FJKH.js → fs-B5HZ2MIU.js} +3 -2
- package/dist/fs-B5HZ2MIU.js.map +1 -0
- package/dist/{fs-KCABDURV.js → fs-O5IQYXHO.js} +3 -2
- package/dist/fs-O5IQYXHO.js.map +1 -0
- package/dist/git-ref-XDXB6JP5.js +4 -0
- package/dist/git-ref-XDXB6JP5.js.map +1 -0
- package/dist/graph-backend-73URGTFY.js +11 -0
- package/dist/graph-backend-73URGTFY.js.map +1 -0
- package/dist/index.d.ts +472 -137
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/{interactive-A4DISSIW.js → interactive-372NLI5C.js} +186 -226
- package/dist/interactive-372NLI5C.js.map +1 -0
- package/dist/llm-host-7GWDO6IX.js +9 -0
- package/dist/llm-host-7GWDO6IX.js.map +1 -0
- package/dist/load-I333TGNI.js +8 -0
- package/dist/load-I333TGNI.js.map +1 -0
- package/dist/local-runtime-5O2NN3GA.js +5 -0
- package/dist/local-runtime-5O2NN3GA.js.map +1 -0
- package/dist/mcp-tools-I7JK3S2M.js +4 -0
- package/dist/{mcp-tools-I6PME3AV.js.map → mcp-tools-I7JK3S2M.js.map} +1 -1
- package/dist/model-execution-profile-TFBKCNJG.js +4 -0
- package/dist/model-execution-profile-TFBKCNJG.js.map +1 -0
- package/dist/model-orchestrator-TVONAUPS.js +9 -0
- package/dist/model-orchestrator-TVONAUPS.js.map +1 -0
- package/dist/parse-worker.d.ts +1 -1
- package/dist/parse-worker.js +2 -1
- package/dist/parse-worker.js.map +1 -1
- package/dist/paths-2RAH3GME.js +6 -0
- package/dist/paths-2RAH3GME.js.map +1 -0
- package/dist/resolve-gguf-VPL4YQ6J.js +8 -0
- package/dist/resolve-gguf-VPL4YQ6J.js.map +1 -0
- package/dist/runtime-session-JRKCQUHY.js +18 -0
- package/dist/runtime-session-JRKCQUHY.js.map +1 -0
- package/dist/session-ITPYQ5XI.js +11 -0
- package/dist/{session-POJUDFPH.js.map → session-ITPYQ5XI.js.map} +1 -1
- package/dist/session-store-WFBX7HXL.js +4 -0
- package/dist/{session-store-W5RZZHA3.js.map → session-store-WFBX7HXL.js.map} +1 -1
- package/dist/{stream-json-Q2JGWPHB.js → stream-json-SLMDKLXP.js} +17 -6
- package/dist/stream-json-SLMDKLXP.js.map +1 -0
- package/dist/{types-Jl6RJ175.d.ts → types-7AHBUbFm.d.ts} +8 -2
- package/dist/ui-Q6DJ3GCU.js +5 -0
- package/dist/ui-Q6DJ3GCU.js.map +1 -0
- package/dist/vgd-7JV5KCNJ.js +17 -0
- package/dist/vgd-7JV5KCNJ.js.map +1 -0
- package/package.json +9 -6
- package/dist/baseline-BD3A7EXD.js +0 -7
- package/dist/chunk-2O5YZVZV.js.map +0 -1
- package/dist/chunk-3MXNNBLI.js.map +0 -1
- package/dist/chunk-5BDHQ7DD.js.map +0 -1
- package/dist/chunk-6CXTPC74.js.map +0 -1
- package/dist/chunk-CS37OBE3.js.map +0 -1
- package/dist/chunk-GGJZA3Q6.js +0 -961
- package/dist/chunk-GGJZA3Q6.js.map +0 -1
- package/dist/chunk-I7GY7MVN.js.map +0 -1
- package/dist/chunk-JBXNQCGE.js +0 -484
- package/dist/chunk-JBXNQCGE.js.map +0 -1
- package/dist/chunk-PY3DNX5H.js.map +0 -1
- package/dist/chunk-WNIIKCNF.js.map +0 -1
- package/dist/fs-IPY4FJKH.js.map +0 -1
- package/dist/fs-KCABDURV.js.map +0 -1
- package/dist/interactive-A4DISSIW.js.map +0 -1
- package/dist/mcp-tools-I6PME3AV.js +0 -3
- package/dist/session-POJUDFPH.js +0 -6
- package/dist/session-store-W5RZZHA3.js +0 -3
- package/dist/stream-json-Q2JGWPHB.js.map +0 -1
- package/dist/ui-HOVOPWMX.js +0 -4
- package/dist/ui-HOVOPWMX.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { G as GraphNode, a as GraphEdge, A as Area, R as ResolverKind, V as VgGraph, F as FileParse, E as EdgeKind, b as Fact, c as GroundingKind, d as GroundingEdge } from './types-
|
|
2
|
-
export { C as Centrality, D as DerivedBy,
|
|
1
|
+
import { G as GraphNode, a as GraphEdge, A as Area, R as ResolverKind, V as VgGraph, F as FileParse, E as EdgeKind, b as Fact, c as GroundingKind, d as GroundingEdge } from './types-7AHBUbFm.js';
|
|
2
|
+
export { e as AnalysisTier, C as Centrality, D as DerivedBy, f as EpistemicTier, g as FactConfidence, h as FactKind, i as GraphMeta, N as NodeKind, P as Provenance, S as SCHEMA_VERSION, j as Span, T as Toolchain, U as Unknown } from './types-7AHBUbFm.js';
|
|
3
3
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
4
|
|
|
5
|
-
declare const VERSION = "2026.
|
|
5
|
+
declare const VERSION = "2026.727.2";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Analysis stage: importance, centrality, hubs, communities, and surprise.
|
|
9
9
|
*
|
|
10
10
|
* - **Centrality** blends PageRank + betweenness + eigenvector + degree over the
|
|
11
11
|
* dependency graph (call/import/extends/implements/references), catching
|
|
12
|
-
* high-fan-in critical nodes that degree-only ranking
|
|
12
|
+
* high-fan-in critical nodes that degree-only ranking misses.
|
|
13
13
|
* - **Communities** via Louvain (`graphology-communities-louvain`, MIT), seeded
|
|
14
14
|
* and single-pass for determinism. Leiden (via a permissive WASM impl) is a
|
|
15
15
|
* later enhancement; the cluster mode is reported honestly, never silent.
|
|
@@ -20,16 +20,25 @@ declare const VERSION = "2026.722.2";
|
|
|
20
20
|
* Pure and deterministic: identical (nodes, edges) → identical result.
|
|
21
21
|
*/
|
|
22
22
|
type ClusterMode = 'leiden' | 'louvain' | 'none';
|
|
23
|
+
type AnalysisTier = 'full' | 'large' | 'xl';
|
|
23
24
|
interface AnalyzeOptions {
|
|
24
25
|
cluster?: ClusterMode;
|
|
25
26
|
/** Skip betweenness above this node count (O(V·E) — too slow for huge graphs). */
|
|
26
27
|
betweennessLimit?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Analysis cost tier. When omitted, auto-selected from node count:
|
|
30
|
+
* full ≤5k nodes — PR + betweenness + eigenvector + Louvain
|
|
31
|
+
* large ≤50k — PR + eigenvector + Louvain (no betweenness)
|
|
32
|
+
* xl >50k — PR + degree; Louvain only on file-level contraction
|
|
33
|
+
*/
|
|
34
|
+
tier?: AnalysisTier;
|
|
27
35
|
}
|
|
28
36
|
interface AnalyzeResult {
|
|
29
37
|
nodes: GraphNode[];
|
|
30
38
|
edges: GraphEdge[];
|
|
31
39
|
areas: Area[];
|
|
32
40
|
cluster: ClusterMode;
|
|
41
|
+
tier: AnalysisTier;
|
|
33
42
|
}
|
|
34
43
|
declare function analyze(nodes: GraphNode[], edges: GraphEdge[], options?: AnalyzeOptions): AnalyzeResult;
|
|
35
44
|
|
|
@@ -75,6 +84,13 @@ declare class ResourceLimitError extends Error {
|
|
|
75
84
|
*/
|
|
76
85
|
declare function resolveLimits(overrides?: Partial<ResourceLimits>): ResourceLimits;
|
|
77
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Stage wall-clock timers for build diagnostics.
|
|
89
|
+
* Pure measurement — never enters the serialized graph artifact.
|
|
90
|
+
*/
|
|
91
|
+
type StageName = 'discover' | 'hash' | 'parse' | 'resolve' | 'tsc' | 'scip' | 'tests' | 'analyze' | 'facts' | 'ground' | 'index' | 'total';
|
|
92
|
+
type StageTimings = Partial<Record<StageName, number>>;
|
|
93
|
+
|
|
78
94
|
/**
|
|
79
95
|
* Module resolution for import edges. Resolves an import specifier (relative,
|
|
80
96
|
* `tsconfig` path alias, or workspace-package name) to a repo-relative file —
|
|
@@ -100,7 +116,7 @@ declare function parseJsonc<T = unknown>(text: string): T;
|
|
|
100
116
|
* and typed, id'd edges.
|
|
101
117
|
*
|
|
102
118
|
* The Phase-0 resolver is the deterministic **heuristic** rung of the ladder
|
|
103
|
-
* (VG-ENGINE-TEARDOWN §3.2). It is already well beyond
|
|
119
|
+
* (VG-ENGINE-TEARDOWN §3.2). It is already well beyond a
|
|
104
120
|
* single-candidate label match: it is scope-aware (same-file first), import-aware
|
|
105
121
|
* (callees reachable through imported files next), and arity/visibility-honest
|
|
106
122
|
* (records its confidence and resolution rung per edge rather than silently
|
|
@@ -167,6 +183,15 @@ interface BuildOptions {
|
|
|
167
183
|
noScip?: boolean;
|
|
168
184
|
/** Skip the in-process TypeScript Compiler API resolver (heuristic floor only). */
|
|
169
185
|
noTsc?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Fast mode: skip tsc precise resolve (heuristic only). Useful for XL cold
|
|
188
|
+
* builds when precision can wait for a focused rebuild.
|
|
189
|
+
*/
|
|
190
|
+
fast?: boolean;
|
|
191
|
+
/** Force analysis tier (default: auto by node count). */
|
|
192
|
+
analysisTier?: AnalysisTier;
|
|
193
|
+
/** Skip writing the SQLite serve index. */
|
|
194
|
+
noIndex?: boolean;
|
|
170
195
|
/** Pin the artifact timestamp for byte-deterministic output. */
|
|
171
196
|
generatedAt?: string;
|
|
172
197
|
/** Live progress during the parse phase (files done of total). */
|
|
@@ -188,9 +213,12 @@ interface BuildResult {
|
|
|
188
213
|
graph: VgGraph;
|
|
189
214
|
timing: {
|
|
190
215
|
totalMs: number;
|
|
216
|
+
stages: StageTimings;
|
|
191
217
|
};
|
|
192
218
|
reparsed: number;
|
|
193
219
|
reused: number;
|
|
220
|
+
/** Files skipped via mtime+size fingerprint (subset of reused). */
|
|
221
|
+
statHits: number;
|
|
194
222
|
totalFiles: number;
|
|
195
223
|
/** Stat+hash of every file in the corpus — input for the freshness snapshot. */
|
|
196
224
|
fileStats: FileStat[];
|
|
@@ -202,6 +230,7 @@ interface BuildResult {
|
|
|
202
230
|
jsx: number;
|
|
203
231
|
heritage: number;
|
|
204
232
|
resolved: number;
|
|
233
|
+
shards?: number;
|
|
205
234
|
};
|
|
206
235
|
/** Present when a SCIP index was ingested. */
|
|
207
236
|
scip?: {
|
|
@@ -210,11 +239,24 @@ interface BuildResult {
|
|
|
210
239
|
resolved: number;
|
|
211
240
|
tool?: string;
|
|
212
241
|
};
|
|
242
|
+
/** SQLite index write result. */
|
|
243
|
+
index?: {
|
|
244
|
+
ok: boolean;
|
|
245
|
+
path?: string;
|
|
246
|
+
reason?: string;
|
|
247
|
+
};
|
|
213
248
|
warnings: string[];
|
|
214
249
|
}
|
|
215
250
|
declare function buildGraph(options: BuildOptions): Promise<BuildResult>;
|
|
216
251
|
|
|
217
|
-
/**
|
|
252
|
+
/**
|
|
253
|
+
* Load the code map for a repository.
|
|
254
|
+
*
|
|
255
|
+
* When `graphPath` is omitted, prefers an existing global-store snapshot, then
|
|
256
|
+
* the legacy `.vibgrate/graph.json`, matching {@link resolveGraphPath}.
|
|
257
|
+
* Prefers the SQLite index when its corpusHash matches the committed map
|
|
258
|
+
* (faster cold serve on large repos). Returns null if none exists.
|
|
259
|
+
*/
|
|
218
260
|
declare function loadGraph(root: string, graphPath?: string): VgGraph | null;
|
|
219
261
|
|
|
220
262
|
/**
|
|
@@ -231,9 +273,19 @@ declare function stableStringify(value: unknown, indent?: number): string;
|
|
|
231
273
|
declare function parseGraph(json: string): VgGraph;
|
|
232
274
|
|
|
233
275
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
276
|
+
* Graph artifact layout (Fusion Runtime Phase 1).
|
|
277
|
+
*
|
|
278
|
+
* By default the code map lives in the **global** application store
|
|
279
|
+
* (XDG / Application Support), keyed by repository id — not inside the repo.
|
|
280
|
+
* That keeps `vg` / `vg serve` / auto-refresh from dirtying the working tree.
|
|
281
|
+
*
|
|
282
|
+
* Legacy in-repo path `.vibgrate/graph.json` is still **read** when present
|
|
283
|
+
* (migration), and is still the write target when:
|
|
284
|
+
* - `VIBGRATE_GRAPH_IN_REPO=1` (or true/yes), or
|
|
285
|
+
* - callers pass an explicit `graphPath` / `--graph`.
|
|
286
|
+
*
|
|
287
|
+
* `vg share` continues to opt into a committed in-repo map by writing under
|
|
288
|
+
* `.vibgrate/` (and rewriting its gitignore).
|
|
237
289
|
*/
|
|
238
290
|
interface WriteOptions {
|
|
239
291
|
root: string;
|
|
@@ -248,7 +300,31 @@ interface WrittenArtifacts {
|
|
|
248
300
|
factsPath?: string;
|
|
249
301
|
}
|
|
250
302
|
declare function vibgrateDir(root: string): string;
|
|
251
|
-
|
|
303
|
+
/** Historical in-repo map path (still read as a fallback). */
|
|
304
|
+
declare function legacyGraphPath(root: string): string;
|
|
305
|
+
/**
|
|
306
|
+
* When true, default writes go to `.vibgrate/graph.json` (pre–Phase-1 layout).
|
|
307
|
+
* Useful for CI that asserts in-repo artifacts, and for `vg share` workflows.
|
|
308
|
+
*/
|
|
309
|
+
declare function preferInRepoGraph(env?: NodeJS.ProcessEnv): boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Default **write** path for the map. Global store unless the operator opts
|
|
312
|
+
* into the legacy in-repo layout. When git is available, prefer a
|
|
313
|
+
* branch-keyed snapshot (Fusion §4.1.1) so switching branches does not
|
|
314
|
+
* overwrite another ref's on-disk map.
|
|
315
|
+
*/
|
|
316
|
+
declare function defaultGraphPath(root: string, env?: NodeJS.ProcessEnv): string;
|
|
317
|
+
/**
|
|
318
|
+
* Resolve where to **read** the map from.
|
|
319
|
+
* Order: explicit override → legacy in-repo when `VIBGRATE_GRAPH_IN_REPO` is set
|
|
320
|
+
* → branch-keyed global (if on a git ref) → `current` global snapshot →
|
|
321
|
+
* legacy in-repo → default write path.
|
|
322
|
+
*
|
|
323
|
+
* The in-repo env short-circuit matters for CI and the release benchmark: they
|
|
324
|
+
* force portable `.vibgrate/graph.json` artifacts and must not pay a synchronous
|
|
325
|
+
* `git rev-parse` (or prefer a leftover global snapshot) on every resolve.
|
|
326
|
+
*/
|
|
327
|
+
declare function resolveGraphPath(root: string, override?: string, env?: NodeJS.ProcessEnv): string;
|
|
252
328
|
declare function writeArtifacts(graph: VgGraph, options: WriteOptions): WrittenArtifacts;
|
|
253
329
|
|
|
254
330
|
interface VerifyResult {
|
|
@@ -274,13 +350,6 @@ declare function verifyDeterminism(opts: {
|
|
|
274
350
|
*/
|
|
275
351
|
declare function renderReport(graph: VgGraph): string;
|
|
276
352
|
|
|
277
|
-
/**
|
|
278
|
-
* Phase-0 `graph.html`: a self-contained, dependency-free, deterministic
|
|
279
|
-
* overview (summary + most-connected definitions + per-file breakdown), with the
|
|
280
|
-
* full graph embedded as JSON for tooling. The interactive WebGL view (sigma.js
|
|
281
|
-
* over a ForceAtlas2 layout, scaling past ~5k nodes — VG-ENGINE-TEARDOWN §3.12)
|
|
282
|
-
* lands in Phase 1; this keeps the artifact present, honest, and byte-stable now.
|
|
283
|
-
*/
|
|
284
353
|
declare function renderHtml(graph: VgGraph): string;
|
|
285
354
|
|
|
286
355
|
/**
|
|
@@ -289,7 +358,7 @@ declare function renderHtml(graph: VgGraph): string;
|
|
|
289
358
|
* Reads a real SCIP index (`index.scip`) produced by a language indexer
|
|
290
359
|
* (scip-typescript, scip-python, scip-java, rust-analyzer→SCIP, …) and turns its
|
|
291
360
|
* precise occurrences into call/reference edges at `resolution: "scip"`,
|
|
292
|
-
* confidence 1.0 —
|
|
361
|
+
* confidence 1.0 — a real SCIP indexer win. vg does
|
|
293
362
|
* NOT bundle indexers; it consumes an index the user/CI generates (deterministic,
|
|
294
363
|
* offline). The heuristic resolver remains the floor for files SCIP didn't cover.
|
|
295
364
|
*
|
|
@@ -432,8 +501,10 @@ declare function loadEmbedder(options?: LoadEmbedderOptions): Promise<Embedder |
|
|
|
432
501
|
* strongest available signal — the node's **doc-comment / docstring** summary —
|
|
433
502
|
* plus lightweight context already on the graph (file-path words, area label), so
|
|
434
503
|
* a tersely-named symbol (`Table`, `NotificationJob`) a concept query can reach.
|
|
435
|
-
*
|
|
436
|
-
*
|
|
504
|
+
*
|
|
505
|
+
* `document` nodes (markdown, manifests, Docker, CI, OpenAPI, …) put the
|
|
506
|
+
* scrubbed body in `doc` — that body is the primary embed signal so `vg ask`
|
|
507
|
+
* can answer project-context questions, not only code symbols.
|
|
437
508
|
*/
|
|
438
509
|
declare function nodeEmbedText(node: GraphNode, areaLabel?: string): string;
|
|
439
510
|
declare function cosine(a: number[], b: number[]): number;
|
|
@@ -605,6 +676,121 @@ interface VgTool {
|
|
|
605
676
|
}
|
|
606
677
|
declare const TOOLS: VgTool[];
|
|
607
678
|
|
|
679
|
+
/** The graph-affecting discovery/build scope, replayed verbatim on refresh. */
|
|
680
|
+
interface BuildScope {
|
|
681
|
+
only?: string[];
|
|
682
|
+
exclude?: string[];
|
|
683
|
+
paths?: string[];
|
|
684
|
+
deep?: boolean;
|
|
685
|
+
noGround?: boolean;
|
|
686
|
+
scip?: string;
|
|
687
|
+
noScip?: boolean;
|
|
688
|
+
noTsc?: boolean;
|
|
689
|
+
cluster?: string;
|
|
690
|
+
grammarsDir?: string;
|
|
691
|
+
}
|
|
692
|
+
interface SnapshotFile {
|
|
693
|
+
version: string;
|
|
694
|
+
/** corpusHash of the build this snapshot belongs to. */
|
|
695
|
+
corpusHash: string;
|
|
696
|
+
scope: BuildScope;
|
|
697
|
+
files: Record<string, {
|
|
698
|
+
size: number;
|
|
699
|
+
mtimeMs: number;
|
|
700
|
+
hash: string;
|
|
701
|
+
}>;
|
|
702
|
+
}
|
|
703
|
+
interface Drift {
|
|
704
|
+
/** Files whose *content* changed (stat moved AND hash differs). */
|
|
705
|
+
changed: string[];
|
|
706
|
+
/** Files present now but absent from the snapshot. */
|
|
707
|
+
added: string[];
|
|
708
|
+
/** Snapshot files no longer present. */
|
|
709
|
+
removed: string[];
|
|
710
|
+
}
|
|
711
|
+
interface ProbeResult {
|
|
712
|
+
drift: Drift;
|
|
713
|
+
/** The recorded build scope — what a refresh must replay. */
|
|
714
|
+
scope: BuildScope;
|
|
715
|
+
/** corpusHash the current map was built from. */
|
|
716
|
+
corpusHash: string;
|
|
717
|
+
}
|
|
718
|
+
/** Persist the snapshot after a successful build. Best-effort (cache-only). */
|
|
719
|
+
declare function writeSnapshot(root: string, corpusHash: string, fileStats: FileStat[], scope?: BuildScope): void;
|
|
720
|
+
declare function loadSnapshot(root: string): SnapshotFile | null;
|
|
721
|
+
declare function hasDrift(drift: Drift): boolean;
|
|
722
|
+
/** Total drifted files — the number shown to humans. */
|
|
723
|
+
declare function driftCount(drift: Drift): number;
|
|
724
|
+
/**
|
|
725
|
+
* Compare the working tree to the snapshot. Returns null when no snapshot
|
|
726
|
+
* exists (nothing was ever built on this machine — auto-refresh stays off
|
|
727
|
+
* rather than guessing the build scope). Stat-only except for files whose
|
|
728
|
+
* stat moved; touch-only moves are absorbed back into the snapshot.
|
|
729
|
+
*/
|
|
730
|
+
declare function probeFreshness(root: string): ProbeResult | null;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Auto-refresh: bring the code map back in sync with the working tree when the
|
|
734
|
+
* freshness probe says it drifted. The rebuild is the ordinary incremental
|
|
735
|
+
* `buildGraph` (warm parse cache → only changed files re-parse), replaying the
|
|
736
|
+
* scope recorded at the last explicit build, guarded by a cross-process lock
|
|
737
|
+
* so a serving MCP process and a foreground command never write at once.
|
|
738
|
+
*
|
|
739
|
+
* Two properties keep this safe to run implicitly:
|
|
740
|
+
* - **No git churn**: if the rebuilt corpusHash equals the snapshot's (e.g. a
|
|
741
|
+
* drift that reverted itself), `graph.json` is left untouched — the artifact
|
|
742
|
+
* stays byte-identical.
|
|
743
|
+
* - **No surprise artifacts**: `GRAPH_REPORT.md`/`graph.html` are rewritten
|
|
744
|
+
* only if they already exist; a refresh never adds files a user's explicit
|
|
745
|
+
* build chose not to produce.
|
|
746
|
+
*/
|
|
747
|
+
interface RefreshOptions {
|
|
748
|
+
/** Force single-threaded parsing (tests / constrained hosts). */
|
|
749
|
+
inline?: boolean;
|
|
750
|
+
/** Worker count for the parse pool. */
|
|
751
|
+
jobs?: number;
|
|
752
|
+
/**
|
|
753
|
+
* The map path already resolved by the caller (e.g. `vg serve`'s startup
|
|
754
|
+
* resolution). Passed straight through to `writeArtifacts` so a refresh
|
|
755
|
+
* never re-resolves it: `defaultGraphPath` shells out to `git rev-parse`
|
|
756
|
+
* (Fusion §4.1.1 branch keying), and re-running that on every drift-driven
|
|
757
|
+
* refresh put a synchronous git spawn back on the hot tool-call path this
|
|
758
|
+
* function exists to keep off of. Omit only when no caller-known path
|
|
759
|
+
* exists (falls back to a fresh `defaultGraphPath` resolution).
|
|
760
|
+
*/
|
|
761
|
+
graphPath?: string;
|
|
762
|
+
}
|
|
763
|
+
type RefreshOutcome =
|
|
764
|
+
/** Map already matches the working tree. */
|
|
765
|
+
{
|
|
766
|
+
status: 'fresh';
|
|
767
|
+
}
|
|
768
|
+
/** No freshness snapshot — no build ever ran here, so scope is unknown. */
|
|
769
|
+
| {
|
|
770
|
+
status: 'no-snapshot';
|
|
771
|
+
}
|
|
772
|
+
/** Another vg process is rebuilding right now; its write will land shortly. */
|
|
773
|
+
| {
|
|
774
|
+
status: 'locked';
|
|
775
|
+
}
|
|
776
|
+
/** Rebuilt. `wrote` is false when the corpus turned out unchanged. */
|
|
777
|
+
| {
|
|
778
|
+
status: 'refreshed';
|
|
779
|
+
drift: Drift;
|
|
780
|
+
ms: number;
|
|
781
|
+
reparsed: number;
|
|
782
|
+
totalFiles: number;
|
|
783
|
+
wrote: boolean;
|
|
784
|
+
} | {
|
|
785
|
+
status: 'error';
|
|
786
|
+
message: string;
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* Probe, and rebuild incrementally if the tree drifted from the map.
|
|
790
|
+
* Silent (no output) — callers own the messaging for their surface.
|
|
791
|
+
*/
|
|
792
|
+
declare function refreshIfStale(root: string, opts?: RefreshOptions): Promise<RefreshOutcome>;
|
|
793
|
+
|
|
608
794
|
/**
|
|
609
795
|
* How a navigation call reached the map:
|
|
610
796
|
* - `mcp` — a tool call over the local `vg serve` MCP server;
|
|
@@ -732,6 +918,19 @@ declare class SessionStats {
|
|
|
732
918
|
private rowFor;
|
|
733
919
|
}
|
|
734
920
|
|
|
921
|
+
type RefreshImpl = typeof refreshIfStale;
|
|
922
|
+
interface GraphSourceTuning {
|
|
923
|
+
probeIntervalMs?: number;
|
|
924
|
+
refreshBudgetMs?: number;
|
|
925
|
+
/**
|
|
926
|
+
* Workspace root for freshness probes. Prefer passing this explicitly —
|
|
927
|
+
* deriving it from `graphPath` via `dirname` twice only works for the legacy
|
|
928
|
+
* `root/.vibgrate/graph.json` layout, not the global branch-keyed store.
|
|
929
|
+
*/
|
|
930
|
+
root?: string;
|
|
931
|
+
/** Tests only: inject a slow/fake refresh to assert the micro-budget. */
|
|
932
|
+
refreshImpl?: RefreshImpl;
|
|
933
|
+
}
|
|
735
934
|
interface ServeOptions {
|
|
736
935
|
/** Record local, counts-only usage savings (opt-in). */
|
|
737
936
|
savings?: boolean;
|
|
@@ -748,6 +947,11 @@ interface ServeOptions {
|
|
|
748
947
|
dedup?: boolean;
|
|
749
948
|
/** Auto-refresh the map when the working tree drifts (default true). */
|
|
750
949
|
refresh?: boolean;
|
|
950
|
+
/**
|
|
951
|
+
* Workspace root (project directory). When set, freshness probes and tools
|
|
952
|
+
* use this instead of inferring root from the graph path.
|
|
953
|
+
*/
|
|
954
|
+
root?: string;
|
|
751
955
|
/**
|
|
752
956
|
* In-memory session stats behind the live `vg serve` status display. Always
|
|
753
957
|
* safe to pass: nothing recorded here is persisted or uploaded — it dies with
|
|
@@ -758,22 +962,21 @@ interface ServeOptions {
|
|
|
758
962
|
declare class GraphSource {
|
|
759
963
|
readonly graphPath: string;
|
|
760
964
|
private readonly refresh;
|
|
761
|
-
/** Timing overrides (tests
|
|
965
|
+
/** Timing / root overrides (production passes `root`; tests may pass more). */
|
|
762
966
|
private readonly tuning;
|
|
763
967
|
private cachedMtimeMs;
|
|
764
968
|
private cached;
|
|
765
|
-
|
|
969
|
+
/** Project root used for freshness probes and rebuilds. */
|
|
970
|
+
readonly root: string;
|
|
766
971
|
private lastProbeAt;
|
|
767
972
|
private failedUntil;
|
|
768
973
|
private inflight;
|
|
769
|
-
/** Self-tuned: grows with measured probe cost so huge repos aren't penalized. */
|
|
974
|
+
/** Self-tuned: grows with measured probe/rebuild cost so huge repos aren't penalized. */
|
|
770
975
|
private probeIntervalMs;
|
|
976
|
+
private readonly refreshImpl;
|
|
771
977
|
constructor(graphPath: string, refresh?: boolean,
|
|
772
|
-
/** Timing overrides (tests
|
|
773
|
-
tuning?:
|
|
774
|
-
probeIntervalMs?: number;
|
|
775
|
-
refreshBudgetMs?: number;
|
|
776
|
-
});
|
|
978
|
+
/** Timing / root overrides (production passes `root`; tests may pass more). */
|
|
979
|
+
tuning?: GraphSourceTuning);
|
|
777
980
|
/** Current graph: auto-refreshed if the tree drifted, reloaded if the file changed. */
|
|
778
981
|
get(): Promise<VgGraph>;
|
|
779
982
|
/**
|
|
@@ -785,113 +988,8 @@ declare class GraphSource {
|
|
|
785
988
|
declare function createServer(source: GraphSource, opts?: ServeOptions): Server;
|
|
786
989
|
declare function serveStdio(graphPath: string, opts?: ServeOptions): Promise<void>;
|
|
787
990
|
|
|
788
|
-
/** The graph-affecting discovery/build scope, replayed verbatim on refresh. */
|
|
789
|
-
interface BuildScope {
|
|
790
|
-
only?: string[];
|
|
791
|
-
exclude?: string[];
|
|
792
|
-
paths?: string[];
|
|
793
|
-
deep?: boolean;
|
|
794
|
-
noGround?: boolean;
|
|
795
|
-
scip?: string;
|
|
796
|
-
noScip?: boolean;
|
|
797
|
-
noTsc?: boolean;
|
|
798
|
-
cluster?: string;
|
|
799
|
-
grammarsDir?: string;
|
|
800
|
-
}
|
|
801
|
-
interface SnapshotFile {
|
|
802
|
-
version: string;
|
|
803
|
-
/** corpusHash of the build this snapshot belongs to. */
|
|
804
|
-
corpusHash: string;
|
|
805
|
-
scope: BuildScope;
|
|
806
|
-
files: Record<string, {
|
|
807
|
-
size: number;
|
|
808
|
-
mtimeMs: number;
|
|
809
|
-
hash: string;
|
|
810
|
-
}>;
|
|
811
|
-
}
|
|
812
|
-
interface Drift {
|
|
813
|
-
/** Files whose *content* changed (stat moved AND hash differs). */
|
|
814
|
-
changed: string[];
|
|
815
|
-
/** Files present now but absent from the snapshot. */
|
|
816
|
-
added: string[];
|
|
817
|
-
/** Snapshot files no longer present. */
|
|
818
|
-
removed: string[];
|
|
819
|
-
}
|
|
820
|
-
interface ProbeResult {
|
|
821
|
-
drift: Drift;
|
|
822
|
-
/** The recorded build scope — what a refresh must replay. */
|
|
823
|
-
scope: BuildScope;
|
|
824
|
-
/** corpusHash the current map was built from. */
|
|
825
|
-
corpusHash: string;
|
|
826
|
-
}
|
|
827
|
-
/** Persist the snapshot after a successful build. Best-effort (cache-only). */
|
|
828
|
-
declare function writeSnapshot(root: string, corpusHash: string, fileStats: FileStat[], scope?: BuildScope): void;
|
|
829
|
-
declare function loadSnapshot(root: string): SnapshotFile | null;
|
|
830
|
-
declare function hasDrift(drift: Drift): boolean;
|
|
831
|
-
/** Total drifted files — the number shown to humans. */
|
|
832
|
-
declare function driftCount(drift: Drift): number;
|
|
833
991
|
/**
|
|
834
|
-
*
|
|
835
|
-
* exists (nothing was ever built on this machine — auto-refresh stays off
|
|
836
|
-
* rather than guessing the build scope). Stat-only except for files whose
|
|
837
|
-
* stat moved; touch-only moves are absorbed back into the snapshot.
|
|
838
|
-
*/
|
|
839
|
-
declare function probeFreshness(root: string): ProbeResult | null;
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* Auto-refresh: bring the code map back in sync with the working tree when the
|
|
843
|
-
* freshness probe says it drifted. The rebuild is the ordinary incremental
|
|
844
|
-
* `buildGraph` (warm parse cache → only changed files re-parse), replaying the
|
|
845
|
-
* scope recorded at the last explicit build, guarded by a cross-process lock
|
|
846
|
-
* so a serving MCP process and a foreground command never write at once.
|
|
847
|
-
*
|
|
848
|
-
* Two properties keep this safe to run implicitly:
|
|
849
|
-
* - **No git churn**: if the rebuilt corpusHash equals the snapshot's (e.g. a
|
|
850
|
-
* drift that reverted itself), `graph.json` is left untouched — the artifact
|
|
851
|
-
* stays byte-identical.
|
|
852
|
-
* - **No surprise artifacts**: `GRAPH_REPORT.md`/`graph.html` are rewritten
|
|
853
|
-
* only if they already exist; a refresh never adds files a user's explicit
|
|
854
|
-
* build chose not to produce.
|
|
855
|
-
*/
|
|
856
|
-
interface RefreshOptions {
|
|
857
|
-
/** Force single-threaded parsing (tests / constrained hosts). */
|
|
858
|
-
inline?: boolean;
|
|
859
|
-
/** Worker count for the parse pool. */
|
|
860
|
-
jobs?: number;
|
|
861
|
-
}
|
|
862
|
-
type RefreshOutcome =
|
|
863
|
-
/** Map already matches the working tree. */
|
|
864
|
-
{
|
|
865
|
-
status: 'fresh';
|
|
866
|
-
}
|
|
867
|
-
/** No freshness snapshot — no build ever ran here, so scope is unknown. */
|
|
868
|
-
| {
|
|
869
|
-
status: 'no-snapshot';
|
|
870
|
-
}
|
|
871
|
-
/** Another vg process is rebuilding right now; its write will land shortly. */
|
|
872
|
-
| {
|
|
873
|
-
status: 'locked';
|
|
874
|
-
}
|
|
875
|
-
/** Rebuilt. `wrote` is false when the corpus turned out unchanged. */
|
|
876
|
-
| {
|
|
877
|
-
status: 'refreshed';
|
|
878
|
-
drift: Drift;
|
|
879
|
-
ms: number;
|
|
880
|
-
reparsed: number;
|
|
881
|
-
totalFiles: number;
|
|
882
|
-
wrote: boolean;
|
|
883
|
-
} | {
|
|
884
|
-
status: 'error';
|
|
885
|
-
message: string;
|
|
886
|
-
};
|
|
887
|
-
/**
|
|
888
|
-
* Probe, and rebuild incrementally if the tree drifted from the map.
|
|
889
|
-
* Silent (no output) — callers own the messaging for their surface.
|
|
890
|
-
*/
|
|
891
|
-
declare function refreshIfStale(root: string, opts?: RefreshOptions): Promise<RefreshOutcome>;
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* Test-awareness (VG-ENGINE-TEARDOWN §3.6) — the wedge Graphify has no answer to.
|
|
992
|
+
* Test-awareness (VG-ENGINE-TEARDOWN §3.6).
|
|
895
993
|
*
|
|
896
994
|
* Deterministic, two signals:
|
|
897
995
|
* 1. **Static linkage** — calls from a test file into product code become `test`
|
|
@@ -1042,8 +1140,8 @@ declare function enrichOnline(records: DepRecord[], fetchImpl?: typeof fetch): P
|
|
|
1042
1140
|
/**
|
|
1043
1141
|
* Local-model discovery (VG-LOCAL-MODELS §9.2) — be a no-key *consumer* of the
|
|
1044
1142
|
* developer's local model fleet. Fully offline and deterministic: inspect the
|
|
1045
|
-
* on-disk layouts of Ollama / LM Studio / llama.cpp
|
|
1046
|
-
* runtime is built or launched.
|
|
1143
|
+
* on-disk layouts of Ollama / LM Studio / llama.cpp / the Vibgrate weight store,
|
|
1144
|
+
* never the network. No runtime is built or launched.
|
|
1047
1145
|
*/
|
|
1048
1146
|
interface LocalModel {
|
|
1049
1147
|
runtime: 'ollama' | 'lm-studio' | 'gguf';
|
|
@@ -1211,4 +1309,241 @@ declare function redactGraph(graph: VgGraph): VgGraph;
|
|
|
1211
1309
|
*/
|
|
1212
1310
|
declare function grammarsSourceDir(): string | null;
|
|
1213
1311
|
|
|
1214
|
-
|
|
1312
|
+
/** The graph-grounded context handed to the model, plus what fed it. */
|
|
1313
|
+
interface CodeContext {
|
|
1314
|
+
instruction: string;
|
|
1315
|
+
/** Symbols the retrieval surfaced as most relevant, with their relations. */
|
|
1316
|
+
seeds: {
|
|
1317
|
+
node: GraphNode;
|
|
1318
|
+
why: string;
|
|
1319
|
+
}[];
|
|
1320
|
+
/** Files the edit is expected to touch, in stable order. */
|
|
1321
|
+
targetFiles: string[];
|
|
1322
|
+
/** Blast radius: symbols that call/depend on the seeds (impact-aware review). */
|
|
1323
|
+
impacted: {
|
|
1324
|
+
node: GraphNode;
|
|
1325
|
+
via: string;
|
|
1326
|
+
}[];
|
|
1327
|
+
/** Hard constraints (declared facts) pinned so compaction can't drop them. */
|
|
1328
|
+
pinnedFacts: string[];
|
|
1329
|
+
/** The rendered, budget-bounded prompt block. */
|
|
1330
|
+
rendered: string;
|
|
1331
|
+
tokensEstimate: number;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Graph-grounded context assembly for `vg code` (VG-CLI-CODE §3).
|
|
1336
|
+
*
|
|
1337
|
+
* A generic coding agent starts blind and reconstructs structure by grepping and
|
|
1338
|
+
* reading whole files — which is exactly what blows the context window and
|
|
1339
|
+
* degrades the model. This module instead uses the deterministic code graph to
|
|
1340
|
+
* hand the planner a *small, high-signal, budget-bounded* context: the symbols
|
|
1341
|
+
* most relevant to the instruction, their immediate relations, the blast radius
|
|
1342
|
+
* of changing them, and any declared facts (hard constraints) that must not be
|
|
1343
|
+
* dropped by later compaction. Deterministic given a graph + instruction, so it
|
|
1344
|
+
* is fully offline-testable and benchmarkable.
|
|
1345
|
+
*/
|
|
1346
|
+
|
|
1347
|
+
interface BuildContextOptions {
|
|
1348
|
+
/** Approx token budget for the rendered block (default 3000). */
|
|
1349
|
+
budget?: number;
|
|
1350
|
+
/** How many retrieval seeds to expand (default 8). */
|
|
1351
|
+
seeds?: number;
|
|
1352
|
+
/** Impact BFS depth for the blast radius (default 2). */
|
|
1353
|
+
impactDepth?: number;
|
|
1354
|
+
/** Restrict the edit surface to these files (from `--file`), if given. */
|
|
1355
|
+
files?: string[];
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Build the context block for a coding instruction. The ordering is
|
|
1359
|
+
* cache-stable by design (see router.ts): the invariant, repo-derived material
|
|
1360
|
+
* (facts, symbols, relations) comes first and the volatile instruction is
|
|
1361
|
+
* echoed last, so a provider's prompt cache can reuse the stable prefix across
|
|
1362
|
+
* turns.
|
|
1363
|
+
*/
|
|
1364
|
+
declare function buildCodeContext(graph: VgGraph, instruction: string, options?: BuildContextOptions): CodeContext;
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* Source-bearing Task Capsule compiler (Fusion Runtime Phase 0).
|
|
1368
|
+
*
|
|
1369
|
+
* Today's {@link buildCodeContext} pays for graph metadata, then the model still
|
|
1370
|
+
* calls `read_file` — double payment. This module compiles a Task Capsule that
|
|
1371
|
+
* includes exact source ranges (from Tree-sitter spans already on graph nodes)
|
|
1372
|
+
* so the first inference can solve without navigation tool calls (ZNS@1 path).
|
|
1373
|
+
*
|
|
1374
|
+
* Deterministic given (graph, instruction, file contents, options). Injectable
|
|
1375
|
+
* `readFile` keeps unit tests offline and pure.
|
|
1376
|
+
*
|
|
1377
|
+
* Schema: docs/fusion/task-capsule-v0.schema.json
|
|
1378
|
+
*/
|
|
1379
|
+
|
|
1380
|
+
declare const TASK_CAPSULE_SCHEMA_VERSION: "task-capsule/0";
|
|
1381
|
+
/** Frozen ranking policy id — bump when the heuristic changes (benchmark gate). */
|
|
1382
|
+
declare const CAPSULE_RANKING_VERSION: "capsule-rank@2026.07.0";
|
|
1383
|
+
declare const CAPSULE_COMPILER_ID: "vg-task-capsule/0";
|
|
1384
|
+
interface BuildCapsuleOptions extends BuildContextOptions {
|
|
1385
|
+
/**
|
|
1386
|
+
* Read file contents relative to the repository root. Required for source
|
|
1387
|
+
* slices; when omitted, the capsule still builds metadata + empty slices
|
|
1388
|
+
* (useful for schema/shape tests).
|
|
1389
|
+
*/
|
|
1390
|
+
readFile?: (relativePath: string) => string | null;
|
|
1391
|
+
/** Extra lines of context around each symbol span (default 1). */
|
|
1392
|
+
padding?: number;
|
|
1393
|
+
/** Max source slices after merge (default 12). */
|
|
1394
|
+
maxSlices?: number;
|
|
1395
|
+
repositoryId?: string | null;
|
|
1396
|
+
/** Optional provenance from the Model Execution Profile / security ladder. */
|
|
1397
|
+
provenance?: CapsuleProvenanceExtras;
|
|
1398
|
+
/**
|
|
1399
|
+
* Extra pinned facts (e.g. high-confidence federation bridge edges) appended
|
|
1400
|
+
* after graph-derived facts. Secret-free, short strings only.
|
|
1401
|
+
*/
|
|
1402
|
+
extraPinnedFacts?: string[];
|
|
1403
|
+
}
|
|
1404
|
+
interface CapsuleSymbolRef {
|
|
1405
|
+
id: string;
|
|
1406
|
+
qualifiedName: string;
|
|
1407
|
+
kind: string;
|
|
1408
|
+
file: string;
|
|
1409
|
+
span: {
|
|
1410
|
+
start: number;
|
|
1411
|
+
end: number;
|
|
1412
|
+
};
|
|
1413
|
+
signature?: string | null;
|
|
1414
|
+
why: string;
|
|
1415
|
+
importance: number;
|
|
1416
|
+
}
|
|
1417
|
+
interface SourceSlice {
|
|
1418
|
+
file: string;
|
|
1419
|
+
start: number;
|
|
1420
|
+
end: number;
|
|
1421
|
+
content: string;
|
|
1422
|
+
contentHash: string;
|
|
1423
|
+
symbolIds: string[];
|
|
1424
|
+
}
|
|
1425
|
+
interface CapsuleRelationship {
|
|
1426
|
+
kind: 'calls' | 'called-by' | 'impacts' | 'contains' | 'other';
|
|
1427
|
+
from: string;
|
|
1428
|
+
to: string;
|
|
1429
|
+
}
|
|
1430
|
+
interface VerificationPlan {
|
|
1431
|
+
syntaxFiles: string[];
|
|
1432
|
+
suggestedTests: string[];
|
|
1433
|
+
notes: string[];
|
|
1434
|
+
}
|
|
1435
|
+
interface TaskCapsule {
|
|
1436
|
+
schemaVersion: typeof TASK_CAPSULE_SCHEMA_VERSION;
|
|
1437
|
+
instruction: string;
|
|
1438
|
+
primary: CapsuleSymbolRef[];
|
|
1439
|
+
supporting: CapsuleSymbolRef[];
|
|
1440
|
+
sourceSlices: SourceSlice[];
|
|
1441
|
+
relationships: CapsuleRelationship[];
|
|
1442
|
+
pinnedFacts: string[];
|
|
1443
|
+
targetFiles: string[];
|
|
1444
|
+
verificationPlan: VerificationPlan;
|
|
1445
|
+
rendered: string;
|
|
1446
|
+
tokensEstimate: number;
|
|
1447
|
+
provenance: {
|
|
1448
|
+
compiler: string;
|
|
1449
|
+
rankingVersion: string;
|
|
1450
|
+
graphCorpusHash: string | null;
|
|
1451
|
+
repositoryId: string | null;
|
|
1452
|
+
/** Model Execution Profile id when resolved (Fusion Phase 4/7). */
|
|
1453
|
+
modelProfileId?: string | null;
|
|
1454
|
+
/** Security tier for shell during this task. */
|
|
1455
|
+
securityTier?: string | null;
|
|
1456
|
+
/** Frozen policy / ranking patch id if any. */
|
|
1457
|
+
policyVersion?: string | null;
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
interface CapsuleProvenanceExtras {
|
|
1461
|
+
modelProfileId?: string | null;
|
|
1462
|
+
securityTier?: string | null;
|
|
1463
|
+
policyVersion?: string | null;
|
|
1464
|
+
}
|
|
1465
|
+
/** Host-safe capsule summary for VS Code / stream-json capsule transparency. */
|
|
1466
|
+
interface CapsuleSummary {
|
|
1467
|
+
schemaVersion: string;
|
|
1468
|
+
instruction: string;
|
|
1469
|
+
primary: Array<{
|
|
1470
|
+
qualifiedName: string;
|
|
1471
|
+
file: string;
|
|
1472
|
+
kind: string;
|
|
1473
|
+
}>;
|
|
1474
|
+
supporting: Array<{
|
|
1475
|
+
qualifiedName: string;
|
|
1476
|
+
file: string;
|
|
1477
|
+
kind: string;
|
|
1478
|
+
}>;
|
|
1479
|
+
sourceSliceCount: number;
|
|
1480
|
+
sourceFiles: string[];
|
|
1481
|
+
tokensEstimate: number;
|
|
1482
|
+
rankingVersion: string;
|
|
1483
|
+
/** Truncated rendered capsule for display (not the full prompt dump). */
|
|
1484
|
+
preview: string;
|
|
1485
|
+
}
|
|
1486
|
+
/** Host-safe capsule summary (capsule transparency UI / stream-json). */
|
|
1487
|
+
declare function summarizeCapsule(capsule: TaskCapsule): CapsuleSummary;
|
|
1488
|
+
/**
|
|
1489
|
+
* Compile a source-bearing Task Capsule. Reuses the same seed / impact /
|
|
1490
|
+
* fact-pinning path as {@link buildCodeContext}, then attaches exact source
|
|
1491
|
+
* slices and a verification sketch.
|
|
1492
|
+
*/
|
|
1493
|
+
declare function buildTaskCapsule(graph: VgGraph, instruction: string, options?: BuildCapsuleOptions): TaskCapsule;
|
|
1494
|
+
/**
|
|
1495
|
+
* Project a capsule into the legacy {@link CodeContext} shape so the existing
|
|
1496
|
+
* agent prompt path can consume it without a full rewrite (A/B flag).
|
|
1497
|
+
*/
|
|
1498
|
+
declare function capsuleToCodeContext(capsule: TaskCapsule): CodeContext;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* `search_symbols` — the hybrid flashlight next to the map
|
|
1502
|
+
* (docs/graph/VG-GRAPH-OPTIMIZATION-PLAN.md P1).
|
|
1503
|
+
*
|
|
1504
|
+
* Two passes, both bounded and deterministic:
|
|
1505
|
+
* 1. symbol pass — the graph's own name index via findNodes (exact id /
|
|
1506
|
+
* qualified name / short name / case-insensitive / substring), ranked;
|
|
1507
|
+
* 2. literal pass — a repo-root-jailed substring scan over source files for
|
|
1508
|
+
* strings the graph does not model (config keys, log messages, comments),
|
|
1509
|
+
* only run when the symbol pass has spare result budget.
|
|
1510
|
+
*
|
|
1511
|
+
* Rows are tiny by contract ({kind, name, file, line, score|preview}) — this
|
|
1512
|
+
* tool exists to make "I know the name" discovery one cheap call, so the model
|
|
1513
|
+
* never flails through graph queries for a plain string lookup.
|
|
1514
|
+
*/
|
|
1515
|
+
interface SymbolHit {
|
|
1516
|
+
kind: string;
|
|
1517
|
+
name: string;
|
|
1518
|
+
file: string;
|
|
1519
|
+
line: number;
|
|
1520
|
+
score: number;
|
|
1521
|
+
}
|
|
1522
|
+
interface TextHit {
|
|
1523
|
+
kind: 'text';
|
|
1524
|
+
file: string;
|
|
1525
|
+
line: number;
|
|
1526
|
+
preview: string;
|
|
1527
|
+
}
|
|
1528
|
+
interface SearchResult {
|
|
1529
|
+
matches: (SymbolHit | TextHit)[];
|
|
1530
|
+
moreAvailable: boolean;
|
|
1531
|
+
/**
|
|
1532
|
+
* Total literal (text) matches across the scanned tree, reported when a
|
|
1533
|
+
* literal sweep ran (a whitespace/phrase query). Lets a caller doing a "find
|
|
1534
|
+
* every occurrence" sweep know whether the shown text rows are the complete
|
|
1535
|
+
* set (`totalTextMatches` === shown text rows) or a page of a larger set
|
|
1536
|
+
* (`totalTextMatches` > shown) — so it never mistakes a truncated list for a
|
|
1537
|
+
* complete one, and never has to fall back to grep to be sure. A trailing `+`
|
|
1538
|
+
* intent is signalled via `moreAvailable`; absent for single-name lookups.
|
|
1539
|
+
*/
|
|
1540
|
+
totalTextMatches?: number;
|
|
1541
|
+
/**
|
|
1542
|
+
* Present when nothing matched (the pivot to take) or when a literal sweep was
|
|
1543
|
+
* truncated (how to get the rest).
|
|
1544
|
+
*/
|
|
1545
|
+
hint?: string;
|
|
1546
|
+
}
|
|
1547
|
+
declare function searchSymbols(graph: VgGraph, root: string, query: string, limit: number): Promise<SearchResult>;
|
|
1548
|
+
|
|
1549
|
+
export { ASSISTANTS, type AnalyzeOptions, type AnalyzeResult, Area, type Assistant, type BuildCapsuleOptions, type BuildContextOptions, type BuildOptions, type BuildResult, type BuildScope, CAPSULE_COMPILER_ID, CAPSULE_RANKING_VERSION, type CapsuleSummary, type CapsuleSymbolRef, type ClusterMode, type DepRecord, type DiscoverOptions, type DiscoveredFile, type Drift, type DriftInventory, type DriftNote, EdgeKind, type Embedder, type ExportContext, type ExportFormat, FREE_PACK, Fact, FileParse, GraphEdge, GraphIndex, GraphNode, GraphSource, type GraphUploadEnvelope, GroundingEdge, GroundingKind, type ImpactItem, type ImpactResult, type KnowledgePack, LANGUAGES, type LanguageDef, type LibCatalog, type LibEntry, type LibSource, type LoadEmbedderOptions, type LocalModel, type ModuleResolver, type PackEntry, type PathResult, type ProbeResult, type QueryMatch, type QueryOptions, type QueryResult, type RefreshOptions, type RefreshOutcome, ResolverKind, ResourceLimitError, type ResourceLimits, SKIP_DIRS, SKIP_FILES, type SavingsReport, type ScipDocument, type ScipIndex, type ScipOccurrence, type SearchResult, type SemanticQueryOptions, type ServeOptions, type SourceSlice, type SymbolHit, TASK_CAPSULE_SCHEMA_VERSION, TOOLS, type TaskCapsule, type TextHit, UsageError, VERSION, type VerifyResult, VgGraph, type VgTool, type WriteOptions, type WrittenArtifacts, addLibrary, allLanguageIds, analyze, applyCoverage, applyStaticTestLinkage, assistantById, buildCodeContext, buildEnvelope, buildFacts, buildGraph, buildModuleResolver, buildTaskCapsule, capsuleToCodeContext, cosine, coveringTests, createServer, decodeScipIndex, defaultGraphPath, inventory as dependencyInventory, detectRunner, discover, discoverModels, driftCount, driftFor, enrichOnline, exportGraph, findNodes, formatForExt, getNodeEmbeddings, grammarsSourceDir, groundGraph, hasDrift, identifierParts, impactOf, installAssistant, isTestFile, langById, langForExtension, legacyGraphPath, libId, loadCatalog, loadCoverage, loadEmbedder, loadGraph, loadSnapshot, nodeById, nodeEmbedText, parseGraph, parseJsonc, parseSource, preferInRepoGraph, probeFreshness, queryGraph, queryGraphSemantic, readDoc, readSavings, recordSaving, redactGraph, refreshIfStale, relativeResolver, renderHtml, renderReport, resolveGraphPath, resolveLib, resolveLimits, resolveOne, saveCatalog, savingsRecorded, scipEdges, searchSymbols, serializeGraph, serveStdio, shortestPath, stableStringify, summarizeCapsule, testsToRun, uninstallAssistant, verifyDeterminism, vibgrateDir, writeArtifacts, writeSnapshot };
|