@vibgrate/cli 2026.819.2 → 2026.824.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.
- package/dist/{agent-ZJRWCMR6.js → agent-6SJVWFPV.js} +12 -12
- package/dist/{agent-ZJRWCMR6.js.map → agent-6SJVWFPV.js.map} +1 -1
- package/dist/{approvals-YTUXBZWQ.js → approvals-5UBLBNJF.js} +5 -5
- package/dist/{approvals-YTUXBZWQ.js.map → approvals-5UBLBNJF.js.map} +1 -1
- package/dist/{attach-WOA25VNH.js → attach-PSGCCJMA.js} +3 -3
- package/dist/{attach-WOA25VNH.js.map → attach-PSGCCJMA.js.map} +1 -1
- package/dist/baseline-HPXACNFU.js +9 -0
- package/dist/{baseline-TVRRUZGA.js.map → baseline-HPXACNFU.js.map} +1 -1
- package/dist/{chunk-24HKTTFV.js → chunk-2IY24TTR.js} +3 -3
- package/dist/{chunk-24HKTTFV.js.map → chunk-2IY24TTR.js.map} +1 -1
- package/dist/{chunk-7BSUPHX6.js → chunk-3PNAQUZM.js} +3 -3
- package/dist/{chunk-7BSUPHX6.js.map → chunk-3PNAQUZM.js.map} +1 -1
- package/dist/{chunk-W6ASIMG5.js → chunk-4PDWV4AE.js} +10 -12
- package/dist/chunk-4PDWV4AE.js.map +1 -0
- package/dist/{chunk-2ZBLZ2S3.js → chunk-5QO2GFAE.js} +27 -23
- package/dist/chunk-5QO2GFAE.js.map +1 -0
- package/dist/{chunk-GBXOAO5V.js → chunk-5UG4UHKU.js} +40 -10
- package/dist/chunk-5UG4UHKU.js.map +1 -0
- package/dist/chunk-AGOKTI77.js +6 -0
- package/dist/{chunk-ZUZHYAJK.js.map → chunk-AGOKTI77.js.map} +1 -1
- package/dist/{chunk-C2EZIAA3.js → chunk-B5GOCQFB.js} +9 -9
- package/dist/{chunk-C2EZIAA3.js.map → chunk-B5GOCQFB.js.map} +1 -1
- package/dist/{chunk-MMJFHEZ4.js → chunk-CJ2R3LVX.js} +4 -4
- package/dist/{chunk-MMJFHEZ4.js.map → chunk-CJ2R3LVX.js.map} +1 -1
- package/dist/{chunk-2C4QT5D7.js → chunk-III7S75O.js} +53 -463
- package/dist/chunk-III7S75O.js.map +1 -0
- package/dist/{chunk-IMI2VHHZ.js → chunk-IKB5U3AH.js} +3 -3
- package/dist/{chunk-IMI2VHHZ.js.map → chunk-IKB5U3AH.js.map} +1 -1
- package/dist/{chunk-AP3JN33O.js → chunk-JL66EPZ4.js} +221 -10
- package/dist/chunk-JL66EPZ4.js.map +1 -0
- package/dist/{chunk-QE6F62FR.js → chunk-KBLKNR3V.js} +3 -3
- package/dist/{chunk-QE6F62FR.js.map → chunk-KBLKNR3V.js.map} +1 -1
- package/dist/{chunk-JPOYXG7Z.js → chunk-KRE7SXSA.js} +12 -13
- package/dist/chunk-KRE7SXSA.js.map +1 -0
- package/dist/{chunk-XW2XQM3C.js → chunk-LA4CETXN.js} +3 -3
- package/dist/{chunk-XW2XQM3C.js.map → chunk-LA4CETXN.js.map} +1 -1
- package/dist/{chunk-OGFOJG4H.js → chunk-LMHKIQA5.js} +3 -3
- package/dist/{chunk-OGFOJG4H.js.map → chunk-LMHKIQA5.js.map} +1 -1
- package/dist/{chunk-FCMWHSQ6.js → chunk-M5QSBXA6.js} +17 -4
- package/dist/chunk-M5QSBXA6.js.map +1 -0
- package/dist/{chunk-R5TQBIR6.js → chunk-QLNJ3VWO.js} +3 -3
- package/dist/{chunk-R5TQBIR6.js.map → chunk-QLNJ3VWO.js.map} +1 -1
- package/dist/{chunk-XLQ4YHS3.js → chunk-QP3P4V4I.js} +10 -8
- package/dist/chunk-QP3P4V4I.js.map +1 -0
- package/dist/{chunk-BQ6NTRRK.js → chunk-RAEHWCN6.js} +6 -6
- package/dist/{chunk-BQ6NTRRK.js.map → chunk-RAEHWCN6.js.map} +1 -1
- package/dist/{chunk-USPMMVNH.js → chunk-SGIFJIII.js} +3 -3
- package/dist/{chunk-USPMMVNH.js.map → chunk-SGIFJIII.js.map} +1 -1
- package/dist/{chunk-CBL3VY7J.js → chunk-TWWVTKA7.js} +35 -14
- package/dist/chunk-TWWVTKA7.js.map +1 -0
- package/dist/chunk-USW5WHUG.js +605 -0
- package/dist/chunk-USW5WHUG.js.map +1 -0
- package/dist/{chunk-NKKOGJ63.js → chunk-UUNEUEPQ.js} +71 -9
- package/dist/chunk-UUNEUEPQ.js.map +1 -0
- package/dist/{chunk-WPLOEFZU.js → chunk-WATYIYWP.js} +3 -3
- package/dist/{chunk-WPLOEFZU.js.map → chunk-WATYIYWP.js.map} +1 -1
- package/dist/{chunk-PJRPSYFQ.js → chunk-XHIWQGRE.js} +5 -5
- package/dist/{chunk-PJRPSYFQ.js.map → chunk-XHIWQGRE.js.map} +1 -1
- package/dist/{chunk-AQZYDFEK.js → chunk-YJ23GGAJ.js} +3 -3
- package/dist/{chunk-AQZYDFEK.js.map → chunk-YJ23GGAJ.js.map} +1 -1
- package/dist/cli.js +379 -544
- package/dist/cli.js.map +1 -1
- package/dist/{daemon-YKOEP3XA.js → daemon-AEL5N4SJ.js} +9 -9
- package/dist/{daemon-YKOEP3XA.js.map → daemon-AEL5N4SJ.js.map} +1 -1
- package/dist/embed-worker-main.js +3 -3
- package/dist/{ensure-map-BLRJDO2Y.js → ensure-map-YL5NR6UH.js} +15 -15
- package/dist/{ensure-map-BLRJDO2Y.js.map → ensure-map-YL5NR6UH.js.map} +1 -1
- package/dist/{graph-backend-NTYONTWW.js → graph-backend-LEPXFPXQ.js} +7 -7
- package/dist/{graph-backend-NTYONTWW.js.map → graph-backend-LEPXFPXQ.js.map} +1 -1
- package/dist/index.d.ts +72 -130
- package/dist/index.js +15 -15
- package/dist/{interactive-B3WTC7LB.js → interactive-YJ37ZWTA.js} +27 -26
- package/dist/interactive-YJ37ZWTA.js.map +1 -0
- package/dist/load-LT6R73IZ.js +11 -0
- package/dist/{load-AJROS77R.js.map → load-LT6R73IZ.js.map} +1 -1
- package/dist/parse-worker.js +3 -2
- package/dist/parse-worker.js.map +1 -1
- package/dist/{run-outcome-SBBSTSH3.js → run-outcome-YQBPYNEY.js} +5 -5
- package/dist/{run-outcome-SBBSTSH3.js.map → run-outcome-YQBPYNEY.js.map} +1 -1
- package/dist/{runtime-session-JYYKQVDX.js → runtime-session-JSH5UL7Z.js} +9 -9
- package/dist/{runtime-session-JYYKQVDX.js.map → runtime-session-JSH5UL7Z.js.map} +1 -1
- package/dist/{session-2ZMHZ2O6.js → session-3FLVZRMM.js} +8 -8
- package/dist/{session-2ZMHZ2O6.js.map → session-3FLVZRMM.js.map} +1 -1
- package/dist/{stream-json-ZWGB4C47.js → stream-json-VJ2O52CR.js} +12 -12
- package/dist/{stream-json-ZWGB4C47.js.map → stream-json-VJ2O52CR.js.map} +1 -1
- package/dist/version-VUTM46C5.js +4 -0
- package/dist/{version-5QIEUXU6.js.map → version-VUTM46C5.js.map} +1 -1
- package/dist/{vg-mcp-bridge-4FETMJ6M.js → vg-mcp-bridge-UUMEOJSO.js} +9 -9
- package/dist/{vg-mcp-bridge-4FETMJ6M.js.map → vg-mcp-bridge-UUMEOJSO.js.map} +1 -1
- package/dist/{vgd-R524P5BJ.js → vgd-XFT574U6.js} +8 -8
- package/dist/vgd-XFT574U6.js.map +1 -0
- package/package.json +2 -1
- package/dist/baseline-TVRRUZGA.js +0 -9
- package/dist/chunk-2C4QT5D7.js.map +0 -1
- package/dist/chunk-2ZBLZ2S3.js.map +0 -1
- package/dist/chunk-AP3JN33O.js.map +0 -1
- package/dist/chunk-CA4YQBA7.js +0 -699
- package/dist/chunk-CA4YQBA7.js.map +0 -1
- package/dist/chunk-CBL3VY7J.js.map +0 -1
- package/dist/chunk-FCMWHSQ6.js.map +0 -1
- package/dist/chunk-GBXOAO5V.js.map +0 -1
- package/dist/chunk-JPOYXG7Z.js.map +0 -1
- package/dist/chunk-NKKOGJ63.js.map +0 -1
- package/dist/chunk-W6ASIMG5.js.map +0 -1
- package/dist/chunk-XLQ4YHS3.js.map +0 -1
- package/dist/chunk-ZUZHYAJK.js +0 -6
- package/dist/interactive-B3WTC7LB.js.map +0 -1
- package/dist/load-AJROS77R.js +0 -11
- package/dist/version-5QIEUXU6.js +0 -4
- package/dist/vgd-R524P5BJ.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadGraphFileWithSnapshot, resolveGraphPath } from './chunk-
|
|
1
|
+
import { loadGraphFileWithSnapshot, resolveGraphPath } from './chunk-III7S75O.js';
|
|
2
2
|
import { cacheDir } from './chunk-MVPRPSXU.js';
|
|
3
3
|
import { __require } from './chunk-Z6ZWNWWR.js';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -200,5 +200,5 @@ function loadGraph(root, graphPath) {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
export { SCHEMA_VERSION, SUPPORTED_SCHEMA_VERSIONS, loadGraph, loadGraphPreferIndex, writeGraphIndex };
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
204
|
-
//# sourceMappingURL=chunk-
|
|
203
|
+
//# sourceMappingURL=chunk-SGIFJIII.js.map
|
|
204
|
+
//# sourceMappingURL=chunk-SGIFJIII.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema.ts","../src/engine/index-db.ts","../src/engine/load.ts"],"names":[],"mappings":";;;;;;;AAoBO,IAAM,cAAA,GAAiB;AAQvB,IAAM,yBAAA,GAA4B,CAAC,cAAA,EAAgB,cAAc;;;ACQjE,SAAS,YAAY,IAAA,EAAsB;AAChD,EAAA,OAAY,IAAA,CAAA,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA,EAAG,UAAU,CAAA;AAC7C;AAGO,SAAS,eAAA,CAAgB,MAAc,KAAA,EAAkC;AAC9E,EAAA,MAAM,IAAA,GAAO,YAAY,IAAI,CAAA;AAC7B,EAAA,IAAI;AAEF,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,SAAA,CAAQ,QAAa,CAAA;AAC9C,IAAG,aAAe,IAAA,CAAA,OAAA,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`vg-graph/1.1` on-disk schema.\n *\n * This is vg's own open schema (VG-PACKAGE-AND-SCHEMA.md §4) — informed by good\n * ideas (content-hashed ids, epistemic typing of facts) but standalone and\n * self-contained. Every collection is deterministically serialized\n * (sorted keys, stable element order). These TypeScript shapes are normative.\n *\n * ## Version history\n *\n * - `vg-graph/1.0` — code-only vocabulary.\n * - `vg-graph/1.1` — **additive**: toolchain node kinds (`resource`, `workload`,\n * `job`, `step`, `image`, `chart`) and toolchain edge kinds (`depends_on`,\n * `provisions`, `deploys`, `triggers`, `exposes`, `mounts`, `builds_from`),\n * produced by `engine/toolchain/`. Nothing was removed or renamed, so a 1.0\n * reader that tolerates unknown kinds reads a 1.1 graph correctly; readers\n * that hard-match the version string need widening (see\n * `SUPPORTED_SCHEMA_VERSIONS`).\n */\n\nexport const SCHEMA_VERSION = 'vg-graph/1.1' as const;\n\n/**\n * Schema versions a reader should accept. The toolchain vocabulary added in 1.1\n * is purely additive, so a 1.0 artifact still loads — only the newer kinds are\n * absent from it. Readers must prefer this over an equality check on\n * {@link SCHEMA_VERSION}, which rejects perfectly readable older graphs.\n */\nexport const SUPPORTED_SCHEMA_VERSIONS = ['vg-graph/1.0', 'vg-graph/1.1'] as const;\n\nexport type SupportedSchemaVersion = (typeof SUPPORTED_SCHEMA_VERSIONS)[number];\n\nexport type ResolverKind = 'scip' | 'stackgraph' | 'tsc' | 'heuristic';\n\n/** Coarse, honest resolution tier for an edge (see engine/epistemic.ts). */\nexport type EpistemicTier = 'observed' | 'name-matched' | 'declared';\n\n/**\n * The toolchain that produced this graph — the reproducibility fingerprint.\n * Everything here deterministically affects graph *content* (parse trees change\n * between grammar releases; resolvers change which edges resolve), so a CI run\n * and a laptop run that disagree can be caught by comparing `fingerprint`.\n * Deliberately excludes the Node/OS version so the graph stays byte-stable\n * across host runtimes; `fingerprint` pins the parse/resolve toolchain only.\n */\nexport interface Toolchain {\n schema: string; // SCHEMA_VERSION\n tool: string; // vg calendar version\n grammars: string; // tree-sitter grammar set version string\n resolvers: ResolverKind[]; // resolver kinds available, sorted\n fingerprint: string; // shortId over the fields above — the value `vg attest` signs\n}\n\nexport interface Provenance {\n tool: 'vg';\n version: string; // calendar version\n grammars: Record<string, string>; // lang → grammar version (determinism input)\n resolver: ResolverKind[];\n deep: boolean; // did the heavier open passes run\n semanticModel?: string; // embedding model id+version if --deep semantic links\n corpusHash: string; // blake3 over the included file set + hashes\n toolchain?: Toolchain; // reproducibility fingerprint (checked by `vg verify`)\n}\n\n/** Analysis cost tier — auto-selected by node count (or forced). Reported honestly. */\nexport type AnalysisTier = 'full' | 'large' | 'xl';\n\nexport interface GraphMeta {\n root: string; // relative; portable across machines\n languages: string[];\n counts: {\n nodes: number;\n edges: number;\n areas: number;\n tests: number;\n untested: number;\n };\n cluster: 'leiden' | 'louvain' | 'none';\n /** Auto-selected (or forced) analysis tier for large maps. */\n analysisTier?: AnalysisTier;\n edgeKinds: EdgeKind[];\n}\n\nexport type NodeKind =\n | 'file'\n | 'module'\n | 'package'\n | 'class'\n | 'interface'\n | 'function'\n | 'method'\n | 'property'\n | 'test'\n | 'route'\n | 'component'\n /** Documentation / config text ingested for semantic ask (markdown, txt, env examples). */\n | 'document'\n | 'external'\n // ── Toolchain kinds (engine/toolchain/) ──────────────────────────────────\n // Structural extraction of the infrastructure/CI corpus. These sit alongside\n // the code kinds above and never replace the `document` node for the same\n // file: the document node stays the semantic-ask surface, these carry the\n // structure. Additive — consumers must tolerate unknown kinds.\n /** A declared infrastructure object: Terraform resource/data, K8s object, Compose service. */\n | 'resource'\n /** A deployable unit that runs containers (Deployment, StatefulSet, DaemonSet, Job, CronJob). */\n | 'workload'\n /** A CI job (GitHub Actions job, GitLab CI job). */\n | 'job'\n /** A single step within a CI job. */\n | 'step'\n /** A container image reference (`ghcr.io/acme/web:1.2.3`) or a Dockerfile build stage. */\n | 'image'\n /** A Helm chart (from `Chart.yaml`). */\n | 'chart';\n\nexport interface Span {\n start: number; // 1-based start line\n end: number; // 1-based end line\n}\n\nexport interface Centrality {\n degree: number;\n pagerank: number;\n betweenness: number;\n eigenvector: number;\n}\n\nexport interface GraphNode {\n id: string; // blake3(canonical(kind, qualifiedName, file, signature))\n kind: NodeKind;\n name: string; // short name\n qualifiedName: string;\n file: string; // relative path\n span: Span; // line range (excluded from id hash)\n lang: string;\n visibility?: 'public' | 'private' | 'protected' | 'internal';\n signature?: string;\n doc?: string; // short leading doc-comment / docstring summary (deterministic; not a full body)\n importance: number; // 0..1 blended centrality\n centrality: Centrality;\n area: number; // area id (the node's community); -1 = unassigned (cluster \"none\")\n isHub: boolean; // centrality outlier — surfaced by `vg hubs`\n tested: boolean | null; // null = not analyzable (e.g. external)\n coverage?: number; // 0..1 line coverage if a coverage report was ingested\n changeCoupling?: string[]; // node ids that historically change together\n}\n\nexport type EdgeKind =\n | 'call'\n | 'import'\n | 'contains'\n | 'extends'\n | 'implements'\n | 'references'\n | 'test'\n | 'coverage'\n // ── Toolchain edge kinds (engine/toolchain/) ─────────────────────────────\n // Every edge below is produced by structural extraction or by the\n // cross-domain linker. Linker-produced edges are always\n // `resolution: 'heuristic'` with a calibrated confidence — an inferred\n // `deploys` is not a declared `import` and must never claim to be.\n /** Declared ordering/reference dependency (Terraform `depends_on` + interpolation, Compose `depends_on`, CI `needs`). */\n | 'depends_on'\n /** An IaC declaration creates infrastructure (Terraform module → resource, chart → workload). */\n | 'provisions'\n /** A CI job or IaC declaration puts a workload/image into an environment. */\n | 'deploys'\n /** An event or upstream job causes a workflow/job to run. */\n | 'triggers'\n /** A workload/service publishes a port or endpoint. */\n | 'exposes'\n /** A workload/service consumes a volume, config map, or secret *by reference*. */\n | 'mounts'\n /** A build stage or workload is derived from a container image. */\n | 'builds_from';\n\nexport interface GraphEdge {\n id: string; // blake3(canonical(kind, src, dst))\n kind: EdgeKind;\n src: string; // node id\n dst: string; // node id\n resolution: ResolverKind; // how the edge was resolved\n confidence: number; // 0..1 (1.0 for scip/declared; lower for heuristic/dynamic)\n epistemic?: EpistemicTier; // coarse honesty tier derived from resolution+kind\n surprise?: number; // 0..1 improbability under the area model (`vg oddities`)\n count?: number; // call-site multiplicity\n}\n\nexport interface Area {\n id: number; // stable across runs (remapped to previous committed map)\n label: string; // most-central member's name (editable via `vg label`)\n size: number;\n members: string[]; // node ids, sorted\n cohesion: number; // 0..1\n externalEdges: number; // cross-area edge count\n}\n\nexport type FactKind = 'contract' | 'invariant' | 'characterization';\nexport type DerivedBy = 'declared' | 'static';\nexport type FactConfidence = 'Observed' | 'Derived';\n\nexport interface Fact {\n id: string; // blake3(canonical(kind, subjectIds, predicate))\n kind: FactKind;\n subjectIds: string[]; // node ids this fact constrains\n predicate: unknown; // the constraint\n derivedBy: DerivedBy;\n confidence: FactConfidence;\n evidence: { file: string; span: Span }[];\n}\n\n/**\n * A reference the graph could not resolve — surfaced by `vg unknowns`. Reporting\n * what it *cannot* connect (ranked by blast radius) is the honest inverse of a\n * scanner that hides its unknowns. Only unknowns the precise rungs (tsc/scip)\n * did not supersede are recorded, so a compiler-resolved file never shows here.\n */\nexport interface Unknown {\n from: string; // node id where the unresolved reference occurs\n name: string; // the callee/type name that could not be resolved\n kind: 'call' | 'extends' | 'implements';\n count: number; // occurrences at this site\n}\n\nexport type GroundingKind = 'should_follow' | 'smells_like' | 'relevant_to';\n\nexport interface GroundingEdge {\n src: string; // node id\n packEntryId: string;\n kind: GroundingKind;\n confidence: number; // 0..1\n rationale: 'recommended' | 'conjectured';\n citation: { title: string; url: string };\n}\n\n/** Precomputed hub blast-radius counts for fast agent answers (optional). */\nexport interface HubBlastSummary {\n id: string;\n name: string;\n kind: string;\n file: string;\n importance: number;\n direct: number;\n depth2: number;\n files: number;\n tested: boolean | null;\n}\n\nexport interface GraphSummaries {\n hubs: HubBlastSummary[];\n}\n\nexport interface VgGraph {\n /**\n * The schema this artifact was written against. A freshly built graph always\n * carries {@link SCHEMA_VERSION}; a graph *loaded* from disk may carry any\n * member of {@link SUPPORTED_SCHEMA_VERSIONS}, since older artifacts stay\n * readable (the 1.1 additions are additive).\n */\n schemaVersion: SupportedSchemaVersion;\n generatedAt: string; // ISO; the ONLY nondeterministic field (pinned by --generated-at)\n provenance: Provenance;\n meta: GraphMeta;\n nodes: GraphNode[]; // sorted by id\n edges: GraphEdge[]; // sorted by (kind, src, dst)\n areas: Area[]; // sorted by id\n facts?: Fact[]; // open facts (contract/invariant/characterization); sorted by id\n grounding?: GroundingEdge[]; // free-pack grounding (default on; omit with --no-ground)\n unknowns?: Unknown[]; // heuristic references left unresolved; sorted by (from, kind, name)\n /** Build-time hub blast-radius summaries (always on; tiny). */\n summaries?: GraphSummaries;\n}\n","/**\n * SQLite serve index for large maps (scale past flat-JSON-only serve).\n *\n * The canonical artifact remains `graph.json` (determinism / git). The index\n * at `.vibgrate/cache/graph.db` is a derived, gitignored structure built after\n * every successful build:\n * - denormalized name/edge columns for O(log n) lookup\n * - full node/edge/area JSON for reconstructing a `VgGraph` without parsing\n * the pretty-printed graph.json (faster cold serve on XL maps)\n *\n * Uses Node's built-in `node:sqlite` (Node ≥22) — no native npm dependency.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { cacheDir } from './cache.js';\nimport { loadGraphFileWithSnapshot } from './snapshot.js';\nimport type {\n Area,\n EpistemicTier,\n GraphEdge,\n GraphNode,\n ResolverKind,\n VgGraph,\n} from '../schema.js';\nimport { SCHEMA_VERSION } from '../schema.js';\n\nexport interface IndexWriteResult {\n path: string;\n nodes: number;\n edges: number;\n /** False when node:sqlite is unavailable — callers should not fail the build. */\n ok: boolean;\n reason?: string;\n}\n\nexport function indexDbPath(root: string): string {\n return path.join(cacheDir(root), 'graph.db');\n}\n\n/** Write (replace) the SQLite index from a built graph. Never throws to callers. */\nexport function writeGraphIndex(root: string, graph: VgGraph): IndexWriteResult {\n const file = indexDbPath(root);\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n fs.mkdirSync(path.dirname(file), { recursive: true });\n const tmp = `${file}.${process.pid}.tmp`;\n try {\n if (fs.existsSync(tmp)) fs.unlinkSync(tmp);\n } catch {\n /* ignore */\n }\n\n const db = new DatabaseSync(tmp);\n db.exec(`\n PRAGMA journal_mode = OFF;\n PRAGMA synchronous = OFF;\n CREATE TABLE meta (\n key TEXT PRIMARY KEY,\n value TEXT NOT NULL\n );\n CREATE TABLE nodes (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n qualified_name TEXT NOT NULL,\n kind TEXT NOT NULL,\n file TEXT NOT NULL,\n line INTEGER NOT NULL,\n importance REAL NOT NULL,\n area INTEGER NOT NULL,\n is_hub INTEGER NOT NULL,\n lang TEXT NOT NULL,\n json TEXT NOT NULL\n );\n CREATE TABLE edges (\n id TEXT PRIMARY KEY,\n kind TEXT NOT NULL,\n src TEXT NOT NULL,\n dst TEXT NOT NULL,\n resolution TEXT NOT NULL,\n confidence REAL NOT NULL,\n epistemic TEXT NOT NULL,\n json TEXT NOT NULL\n );\n CREATE TABLE areas (\n id INTEGER PRIMARY KEY,\n json TEXT NOT NULL\n );\n CREATE INDEX idx_nodes_name ON nodes(name);\n CREATE INDEX idx_nodes_qn ON nodes(qualified_name);\n CREATE INDEX idx_nodes_file ON nodes(file);\n CREATE INDEX idx_edges_src ON edges(src);\n CREATE INDEX idx_edges_dst ON edges(dst);\n CREATE INDEX idx_edges_kind ON edges(kind);\n `);\n\n const insMeta = db.prepare('INSERT INTO meta(key, value) VALUES (?, ?)');\n insMeta.run('corpusHash', graph.provenance.corpusHash);\n insMeta.run('schemaVersion', graph.schemaVersion);\n insMeta.run('generatedAt', graph.generatedAt);\n insMeta.run('nodeCount', String(graph.nodes.length));\n insMeta.run('edgeCount', String(graph.edges.length));\n insMeta.run('analysisTier', graph.meta.analysisTier ?? 'full');\n insMeta.run('indexVersion', 'vg-graph-index/2');\n // Full meta + provenance for reconstruct without graph.json parse.\n insMeta.run('graphMeta', JSON.stringify(graph.meta));\n insMeta.run('graphProvenance', JSON.stringify(graph.provenance));\n if (graph.facts) insMeta.run('factsJson', JSON.stringify(graph.facts));\n if (graph.grounding) insMeta.run('groundingJson', JSON.stringify(graph.grounding));\n if (graph.summaries) insMeta.run('summariesJson', JSON.stringify(graph.summaries));\n if (graph.unknowns) insMeta.run('unknownsJson', JSON.stringify(graph.unknowns));\n\n const insNode = db.prepare(\n `INSERT INTO nodes(id, name, qualified_name, kind, file, line, importance, area, is_hub, lang, json)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n );\n for (const n of graph.nodes) {\n insNode.run(\n n.id,\n n.name,\n n.qualifiedName,\n n.kind,\n n.file,\n n.span.start,\n n.importance,\n n.area,\n n.isHub ? 1 : 0,\n n.lang,\n JSON.stringify(n),\n );\n }\n\n const insEdge = db.prepare(\n `INSERT INTO edges(id, kind, src, dst, resolution, confidence, epistemic, json)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,\n );\n for (const e of graph.edges) {\n insEdge.run(\n e.id,\n e.kind,\n e.src,\n e.dst,\n e.resolution,\n e.confidence,\n e.epistemic ?? 'observed',\n JSON.stringify(e),\n );\n }\n\n const insArea = db.prepare('INSERT INTO areas(id, json) VALUES (?, ?)');\n for (const a of graph.areas) {\n insArea.run(a.id, JSON.stringify(a));\n }\n\n db.close();\n fs.renameSync(tmp, file);\n return { path: file, nodes: graph.nodes.length, edges: graph.edges.length, ok: true };\n } catch (err) {\n return {\n path: file,\n nodes: 0,\n edges: 0,\n ok: false,\n reason: (err as Error).message,\n };\n }\n}\n\nexport interface NameHit {\n id: string;\n name: string;\n qualifiedName: string;\n kind: string;\n file: string;\n line: number;\n importance: number;\n}\n\n/** Fast name / prefix lookup against the index. Empty if index missing. */\nexport function lookupNameIndex(root: string, query: string, limit = 20): NameHit[] {\n const file = indexDbPath(root);\n if (!fs.existsSync(file) || !query.trim()) return [];\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const q = query.trim();\n const rows = db\n .prepare(\n `SELECT id, name, qualified_name, kind, file, line, importance\n FROM nodes\n WHERE name = ? OR qualified_name = ? OR name LIKE ? OR qualified_name LIKE ?\n ORDER BY\n CASE WHEN name = ? OR qualified_name = ? THEN 0\n WHEN name LIKE ? THEN 1\n ELSE 2 END,\n importance DESC\n LIMIT ?`,\n )\n .all(q, q, `${q}%`, `%${q}%`, q, q, `${q}%`, limit) as Record<string, unknown>[];\n db.close();\n return rows.map((r) => ({\n id: String(r.id),\n name: String(r.name),\n qualifiedName: String(r.qualified_name),\n kind: String(r.kind),\n file: String(r.file),\n line: Number(r.line),\n importance: Number(r.importance),\n }));\n } catch {\n return [];\n }\n}\n\n/** Neighbor edges for a node id (src or dst). Empty if index missing. */\nexport function lookupNeighbors(\n root: string,\n nodeId: string,\n direction: 'out' | 'in' | 'both' = 'both',\n limit = 50,\n): GraphEdge[] {\n const file = indexDbPath(root);\n if (!fs.existsSync(file) || !nodeId) return [];\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n let rows: Record<string, unknown>[] = [];\n if (direction === 'out' || direction === 'both') {\n rows = rows.concat(\n db\n .prepare(`SELECT json FROM edges WHERE src = ? LIMIT ?`)\n .all(nodeId, limit) as Record<string, unknown>[],\n );\n }\n if (direction === 'in' || direction === 'both') {\n rows = rows.concat(\n db\n .prepare(`SELECT json FROM edges WHERE dst = ? LIMIT ?`)\n .all(nodeId, limit) as Record<string, unknown>[],\n );\n }\n db.close();\n const byId = new Map<string, GraphEdge>();\n for (const r of rows) {\n try {\n const e = JSON.parse(String(r.json)) as GraphEdge;\n byId.set(e.id, e);\n } catch {\n /* skip bad row */\n }\n }\n return [...byId.values()];\n } catch {\n return [];\n }\n}\n\n/** Read index meta (corpusHash etc.) or null if missing. */\nexport function readIndexMeta(root: string): Record<string, string> | null {\n const file = indexDbPath(root);\n if (!fs.existsSync(file)) return null;\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const rows = db.prepare('SELECT key, value FROM meta').all() as { key: string; value: string }[];\n db.close();\n const out: Record<string, string> = {};\n for (const r of rows) out[r.key] = r.value;\n return out;\n } catch {\n return null;\n }\n}\n\n/**\n * Reconstruct a full `VgGraph` from the SQLite index (indexVersion ≥ 2).\n * Returns null if the index is missing, stale schema, or incomplete.\n * Prefer this over JSON.parse of pretty graph.json for cold serve on large maps.\n */\nexport function loadGraphFromIndex(root: string): VgGraph | null {\n const file = indexDbPath(root);\n if (!fs.existsSync(file)) return null;\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const metaRows = db.prepare('SELECT key, value FROM meta').all() as {\n key: string;\n value: string;\n }[];\n const meta: Record<string, string> = {};\n for (const r of metaRows) meta[r.key] = r.value;\n\n if (meta.indexVersion !== 'vg-graph-index/2' || !meta.graphMeta || !meta.graphProvenance) {\n db.close();\n return null;\n }\n\n const nodeRows = db.prepare('SELECT json FROM nodes ORDER BY id').all() as {\n json: string;\n }[];\n const edgeRows = db.prepare('SELECT json FROM edges ORDER BY id').all() as {\n json: string;\n }[];\n const areaRows = db.prepare('SELECT json FROM areas ORDER BY id').all() as {\n json: string;\n }[];\n db.close();\n\n const nodes = nodeRows.map((r) => JSON.parse(r.json) as GraphNode);\n const edges = edgeRows.map((r) => JSON.parse(r.json) as GraphEdge);\n const areas = areaRows.map((r) => JSON.parse(r.json) as Area);\n\n // Stable sorts match serialize contract (ids already ordered by SQL, re-sort for safety).\n nodes.sort((a, b) => a.id.localeCompare(b.id));\n edges.sort(\n (a, b) =>\n a.kind.localeCompare(b.kind) || a.src.localeCompare(b.src) || a.dst.localeCompare(b.dst),\n );\n areas.sort((a, b) => a.id - b.id);\n\n const graph: VgGraph = {\n schemaVersion: (meta.schemaVersion as typeof SCHEMA_VERSION) || SCHEMA_VERSION,\n generatedAt: meta.generatedAt ?? new Date(0).toISOString(),\n provenance: JSON.parse(meta.graphProvenance),\n meta: JSON.parse(meta.graphMeta),\n nodes,\n edges,\n areas,\n };\n if (meta.factsJson) graph.facts = JSON.parse(meta.factsJson);\n if (meta.groundingJson) graph.grounding = JSON.parse(meta.groundingJson);\n if (meta.summariesJson) graph.summaries = JSON.parse(meta.summariesJson);\n if (meta.unknownsJson) graph.unknowns = JSON.parse(meta.unknownsJson);\n\n // Lightweight integrity: edge resolution types stay valid.\n for (const e of edges) {\n if (!e.resolution) e.resolution = 'heuristic' as ResolverKind;\n if (!e.epistemic) e.epistemic = 'observed' as EpistemicTier;\n }\n return graph;\n } catch {\n return null;\n }\n}\n\n/**\n * Load the graph preferring the SQLite index when its corpusHash matches the\n * committed graph.json provenance (or when only the index exists). Falls back\n * to graph.json. Returns null if neither is usable.\n */\nexport function loadGraphPreferIndex(\n root: string,\n graphJsonPath: string,\n): { graph: VgGraph; source: 'index' | 'json' } | null {\n // Snapshot-first: skips the large-string JSON.parse when a fresh binary\n // snapshot exists (sidecar or store-mode standalone), and self-heals the\n // sidecar when not (see engine/snapshot.ts).\n const jsonGraph: VgGraph | null = loadGraphFileWithSnapshot(graphJsonPath);\n\n const fromIndex = loadGraphFromIndex(root);\n if (fromIndex) {\n if (!jsonGraph || fromIndex.provenance.corpusHash === jsonGraph.provenance.corpusHash) {\n return { graph: fromIndex, source: 'index' };\n }\n // Index stale vs graph.json — prefer canonical JSON and let next build refresh.\n }\n if (jsonGraph) return { graph: jsonGraph, source: 'json' };\n return null;\n}\n","import { resolveGraphPath } from './artifacts.js';\nimport { loadGraphFileWithSnapshot } from './snapshot.js';\nimport { loadGraphPreferIndex } from './index-db.js';\nimport type { VgGraph } from '../schema.js';\n\n/**\n * Load the code map for a repository.\n *\n * When `graphPath` is omitted, prefers an existing global-store snapshot, then\n * the legacy `.vibgrate/graph.json`, matching {@link resolveGraphPath}.\n * Prefers the SQLite index when its corpusHash matches the committed map\n * (faster cold serve on large repos). Returns null if none exists.\n */\nexport function loadGraph(root: string, graphPath?: string): VgGraph | null {\n const file = resolveGraphPath(root, graphPath);\n // Index is always rooted at the project root; only use it when loading the\n // default map for that root (not an arbitrary --graph path).\n if (!graphPath) {\n const preferred = loadGraphPreferIndex(root, file);\n if (preferred) return preferred.graph;\n }\n return loadGraphFileWithSnapshot(file);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts","../src/engine/index-db.ts","../src/engine/load.ts"],"names":[],"mappings":";;;;;;;AAoBO,IAAM,cAAA,GAAiB;AAQvB,IAAM,yBAAA,GAA4B,CAAC,cAAA,EAAgB,cAAc;;;ACQjE,SAAS,YAAY,IAAA,EAAsB;AAChD,EAAA,OAAY,IAAA,CAAA,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA,EAAG,UAAU,CAAA;AAC7C;AAGO,SAAS,eAAA,CAAgB,MAAc,KAAA,EAAkC;AAC9E,EAAA,MAAM,IAAA,GAAO,YAAY,IAAI,CAAA;AAC7B,EAAA,IAAI;AAEF,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,SAAA,CAAQ,QAAa,CAAA;AAC9C,IAAG,aAAe,IAAA,CAAA,OAAA,CAAQ,IAAI,GAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AACpD,IAAA,MAAM,GAAA,GAAM,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,QAAQ,GAAG,CAAA,IAAA,CAAA;AAClC,IAAA,IAAI;AACF,MAAA,IAAO,EAAA,CAAA,UAAA,CAAW,GAAG,CAAA,EAAM,cAAW,GAAG,CAAA;AAAA,IAC3C,CAAA,CAAA,MAAQ;AAAA,IAER;AAEA,IAAA,MAAM,EAAA,GAAK,IAAI,YAAA,CAAa,GAAG,CAAA;AAC/B,IAAA,EAAA,CAAG,IAAA,CAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AI,CAAA;AACzC,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,IAAI,CAAC,SAAA,IAAa,SAAA,CAAU,WAAW,UAAA,KAAe,SAAA,CAAU,WAAW,UAAA,EAAY;AACrF,MAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,MAAA,EAAQ,OAAA,EAAQ;AAAA,IAC7C;AAAA,EAEF;AACA,EAAA,IAAI,WAAW,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,QAAQ,MAAA,EAAO;AACzD,EAAA,OAAO,IAAA;AACT;;;ACxWO,SAAS,SAAA,CAAU,MAAc,SAAA,EAAoC;AAC1E,EAAA,MAAM,IAAA,GAAO,gBAAA,CAAiB,IAAA,EAAM,SAAS,CAAA;AAG7C,EAAA,IAAI,CAAC,SAAA,EAAW;AACd,IAAA,MAAM,SAAA,GAAY,oBAAA,CAAqB,IAAA,EAAM,IAAI,CAAA;AACjD,IAAA,IAAI,SAAA,SAAkB,SAAA,CAAU,KAAA;AAAA,EAClC;AACA,EAAA,OAAO,0BAA0B,IAAI,CAAA;AACvC","file":"chunk-SGIFJIII.js","sourcesContent":["/**\n * The `vg-graph/1.1` on-disk schema.\n *\n * This is vg's own open schema (VG-PACKAGE-AND-SCHEMA.md §4) — informed by good\n * ideas (content-hashed ids, epistemic typing of facts) but standalone and\n * self-contained. Every collection is deterministically serialized\n * (sorted keys, stable element order). These TypeScript shapes are normative.\n *\n * ## Version history\n *\n * - `vg-graph/1.0` — code-only vocabulary.\n * - `vg-graph/1.1` — **additive**: toolchain node kinds (`resource`, `workload`,\n * `job`, `step`, `image`, `chart`) and toolchain edge kinds (`depends_on`,\n * `provisions`, `deploys`, `triggers`, `exposes`, `mounts`, `builds_from`),\n * produced by `engine/toolchain/`. Nothing was removed or renamed, so a 1.0\n * reader that tolerates unknown kinds reads a 1.1 graph correctly; readers\n * that hard-match the version string need widening (see\n * `SUPPORTED_SCHEMA_VERSIONS`).\n */\n\nexport const SCHEMA_VERSION = 'vg-graph/1.1' as const;\n\n/**\n * Schema versions a reader should accept. The toolchain vocabulary added in 1.1\n * is purely additive, so a 1.0 artifact still loads — only the newer kinds are\n * absent from it. Readers must prefer this over an equality check on\n * {@link SCHEMA_VERSION}, which rejects perfectly readable older graphs.\n */\nexport const SUPPORTED_SCHEMA_VERSIONS = ['vg-graph/1.0', 'vg-graph/1.1'] as const;\n\nexport type SupportedSchemaVersion = (typeof SUPPORTED_SCHEMA_VERSIONS)[number];\n\nexport type ResolverKind = 'scip' | 'stackgraph' | 'tsc' | 'heuristic';\n\n/** Coarse, honest resolution tier for an edge (see engine/epistemic.ts). */\nexport type EpistemicTier = 'observed' | 'name-matched' | 'declared';\n\n/**\n * The toolchain that produced this graph — the reproducibility fingerprint.\n * Everything here deterministically affects graph *content* (parse trees change\n * between grammar releases; resolvers change which edges resolve), so a CI run\n * and a laptop run that disagree can be caught by comparing `fingerprint`.\n * Deliberately excludes the Node/OS version so the graph stays byte-stable\n * across host runtimes; `fingerprint` pins the parse/resolve toolchain only.\n */\nexport interface Toolchain {\n schema: string; // SCHEMA_VERSION\n tool: string; // vg calendar version\n grammars: string; // tree-sitter grammar set version string\n resolvers: ResolverKind[]; // resolver kinds available, sorted\n fingerprint: string; // shortId over the fields above — the value `vg attest` signs\n}\n\nexport interface Provenance {\n tool: 'vg';\n version: string; // calendar version\n grammars: Record<string, string>; // lang → grammar version (determinism input)\n resolver: ResolverKind[];\n deep: boolean; // did the heavier open passes run\n semanticModel?: string; // embedding model id+version if --deep semantic links\n corpusHash: string; // blake3 over the included file set + hashes\n toolchain?: Toolchain; // reproducibility fingerprint (checked by `vg verify`)\n}\n\n/** Analysis cost tier — auto-selected by node count (or forced). Reported honestly. */\nexport type AnalysisTier = 'full' | 'large' | 'xl';\n\nexport interface GraphMeta {\n root: string; // relative; portable across machines\n languages: string[];\n counts: {\n nodes: number;\n edges: number;\n areas: number;\n tests: number;\n untested: number;\n };\n cluster: 'leiden' | 'louvain' | 'none';\n /** Auto-selected (or forced) analysis tier for large maps. */\n analysisTier?: AnalysisTier;\n edgeKinds: EdgeKind[];\n}\n\nexport type NodeKind =\n | 'file'\n | 'module'\n | 'package'\n | 'class'\n | 'interface'\n | 'function'\n | 'method'\n | 'property'\n | 'test'\n | 'route'\n | 'component'\n /** Documentation / config text ingested for semantic ask (markdown, txt, env examples). */\n | 'document'\n | 'external'\n // ── Toolchain kinds (engine/toolchain/) ──────────────────────────────────\n // Structural extraction of the infrastructure/CI corpus. These sit alongside\n // the code kinds above and never replace the `document` node for the same\n // file: the document node stays the semantic-ask surface, these carry the\n // structure. Additive — consumers must tolerate unknown kinds.\n /** A declared infrastructure object: Terraform resource/data, K8s object, Compose service. */\n | 'resource'\n /** A deployable unit that runs containers (Deployment, StatefulSet, DaemonSet, Job, CronJob). */\n | 'workload'\n /** A CI job (GitHub Actions job, GitLab CI job). */\n | 'job'\n /** A single step within a CI job. */\n | 'step'\n /** A container image reference (`ghcr.io/acme/web:1.2.3`) or a Dockerfile build stage. */\n | 'image'\n /** A Helm chart (from `Chart.yaml`). */\n | 'chart';\n\nexport interface Span {\n start: number; // 1-based start line\n end: number; // 1-based end line\n}\n\nexport interface Centrality {\n degree: number;\n pagerank: number;\n betweenness: number;\n eigenvector: number;\n}\n\nexport interface GraphNode {\n id: string; // blake3(canonical(kind, qualifiedName, file, signature))\n kind: NodeKind;\n name: string; // short name\n qualifiedName: string;\n file: string; // relative path\n span: Span; // line range (excluded from id hash)\n lang: string;\n visibility?: 'public' | 'private' | 'protected' | 'internal';\n signature?: string;\n doc?: string; // short leading doc-comment / docstring summary (deterministic; not a full body)\n importance: number; // 0..1 blended centrality\n centrality: Centrality;\n area: number; // area id (the node's community); -1 = unassigned (cluster \"none\")\n isHub: boolean; // centrality outlier — surfaced by `vg hubs`\n tested: boolean | null; // null = not analyzable (e.g. external)\n coverage?: number; // 0..1 line coverage if a coverage report was ingested\n changeCoupling?: string[]; // node ids that historically change together\n}\n\nexport type EdgeKind =\n | 'call'\n | 'import'\n | 'contains'\n | 'extends'\n | 'implements'\n | 'references'\n | 'test'\n | 'coverage'\n // ── Toolchain edge kinds (engine/toolchain/) ─────────────────────────────\n // Every edge below is produced by structural extraction or by the\n // cross-domain linker. Linker-produced edges are always\n // `resolution: 'heuristic'` with a calibrated confidence — an inferred\n // `deploys` is not a declared `import` and must never claim to be.\n /** Declared ordering/reference dependency (Terraform `depends_on` + interpolation, Compose `depends_on`, CI `needs`). */\n | 'depends_on'\n /** An IaC declaration creates infrastructure (Terraform module → resource, chart → workload). */\n | 'provisions'\n /** A CI job or IaC declaration puts a workload/image into an environment. */\n | 'deploys'\n /** An event or upstream job causes a workflow/job to run. */\n | 'triggers'\n /** A workload/service publishes a port or endpoint. */\n | 'exposes'\n /** A workload/service consumes a volume, config map, or secret *by reference*. */\n | 'mounts'\n /** A build stage or workload is derived from a container image. */\n | 'builds_from';\n\nexport interface GraphEdge {\n id: string; // blake3(canonical(kind, src, dst))\n kind: EdgeKind;\n src: string; // node id\n dst: string; // node id\n resolution: ResolverKind; // how the edge was resolved\n confidence: number; // 0..1 (1.0 for scip/declared; lower for heuristic/dynamic)\n epistemic?: EpistemicTier; // coarse honesty tier derived from resolution+kind\n surprise?: number; // 0..1 improbability under the area model (`vg oddities`)\n count?: number; // call-site multiplicity\n}\n\nexport interface Area {\n id: number; // stable across runs (remapped to previous committed map)\n label: string; // most-central member's name (editable via `vg label`)\n size: number;\n members: string[]; // node ids, sorted\n cohesion: number; // 0..1\n externalEdges: number; // cross-area edge count\n}\n\nexport type FactKind = 'contract' | 'invariant' | 'characterization';\nexport type DerivedBy = 'declared' | 'static';\nexport type FactConfidence = 'Observed' | 'Derived';\n\nexport interface Fact {\n id: string; // blake3(canonical(kind, subjectIds, predicate))\n kind: FactKind;\n subjectIds: string[]; // node ids this fact constrains\n predicate: unknown; // the constraint\n derivedBy: DerivedBy;\n confidence: FactConfidence;\n evidence: { file: string; span: Span }[];\n}\n\n/**\n * A reference the graph could not resolve — surfaced by `vg unknowns`. Reporting\n * what it *cannot* connect (ranked by blast radius) is the honest inverse of a\n * scanner that hides its unknowns. Only unknowns the precise rungs (tsc/scip)\n * did not supersede are recorded, so a compiler-resolved file never shows here.\n */\nexport interface Unknown {\n from: string; // node id where the unresolved reference occurs\n name: string; // the callee/type name that could not be resolved\n kind: 'call' | 'extends' | 'implements';\n count: number; // occurrences at this site\n}\n\nexport type GroundingKind = 'should_follow' | 'smells_like' | 'relevant_to';\n\nexport interface GroundingEdge {\n src: string; // node id\n packEntryId: string;\n kind: GroundingKind;\n confidence: number; // 0..1\n rationale: 'recommended' | 'conjectured';\n citation: { title: string; url: string };\n}\n\n/** Precomputed hub blast-radius counts for fast agent answers (optional). */\nexport interface HubBlastSummary {\n id: string;\n name: string;\n kind: string;\n file: string;\n importance: number;\n direct: number;\n depth2: number;\n files: number;\n tested: boolean | null;\n}\n\nexport interface GraphSummaries {\n hubs: HubBlastSummary[];\n}\n\nexport interface VgGraph {\n /**\n * The schema this artifact was written against. A freshly built graph always\n * carries {@link SCHEMA_VERSION}; a graph *loaded* from disk may carry any\n * member of {@link SUPPORTED_SCHEMA_VERSIONS}, since older artifacts stay\n * readable (the 1.1 additions are additive).\n */\n schemaVersion: SupportedSchemaVersion;\n generatedAt: string; // ISO; the ONLY nondeterministic field (pinned by --generated-at)\n provenance: Provenance;\n meta: GraphMeta;\n nodes: GraphNode[]; // sorted by id\n edges: GraphEdge[]; // sorted by (kind, src, dst)\n areas: Area[]; // sorted by id\n facts?: Fact[]; // open facts (contract/invariant/characterization); sorted by id\n grounding?: GroundingEdge[]; // free-pack grounding (default on; omit with --no-ground)\n unknowns?: Unknown[]; // heuristic references left unresolved; sorted by (from, kind, name)\n /** Build-time hub blast-radius summaries (always on; tiny). */\n summaries?: GraphSummaries;\n}\n","/**\n * SQLite serve index for large maps (scale past flat-JSON-only serve).\n *\n * The canonical artifact remains `graph.json` (determinism / git). The index\n * at `.vibgrate/cache/graph.db` is a derived, gitignored structure built after\n * every successful build:\n * - denormalized name/edge columns for O(log n) lookup\n * - full node/edge/area JSON for reconstructing a `VgGraph` without parsing\n * the pretty-printed graph.json (faster cold serve on XL maps)\n *\n * Uses Node's built-in `node:sqlite` (Node ≥22) — no native npm dependency.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { cacheDir } from './cache.js';\nimport { loadGraphFileWithSnapshot } from './snapshot.js';\nimport type {\n Area,\n EpistemicTier,\n GraphEdge,\n GraphNode,\n ResolverKind,\n VgGraph,\n} from '../schema.js';\nimport { SCHEMA_VERSION } from '../schema.js';\n\nexport interface IndexWriteResult {\n path: string;\n nodes: number;\n edges: number;\n /** False when node:sqlite is unavailable — callers should not fail the build. */\n ok: boolean;\n reason?: string;\n}\n\nexport function indexDbPath(root: string): string {\n return path.join(cacheDir(root), 'graph.db');\n}\n\n/** Write (replace) the SQLite index from a built graph. Never throws to callers. */\nexport function writeGraphIndex(root: string, graph: VgGraph): IndexWriteResult {\n const file = indexDbPath(root);\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n fs.mkdirSync(path.dirname(file), { recursive: true });\n const tmp = `${file}.${process.pid}.tmp`;\n try {\n if (fs.existsSync(tmp)) fs.unlinkSync(tmp);\n } catch {\n /* ignore */\n }\n\n const db = new DatabaseSync(tmp);\n db.exec(`\n PRAGMA journal_mode = OFF;\n PRAGMA synchronous = OFF;\n CREATE TABLE meta (\n key TEXT PRIMARY KEY,\n value TEXT NOT NULL\n );\n CREATE TABLE nodes (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n qualified_name TEXT NOT NULL,\n kind TEXT NOT NULL,\n file TEXT NOT NULL,\n line INTEGER NOT NULL,\n importance REAL NOT NULL,\n area INTEGER NOT NULL,\n is_hub INTEGER NOT NULL,\n lang TEXT NOT NULL,\n json TEXT NOT NULL\n );\n CREATE TABLE edges (\n id TEXT PRIMARY KEY,\n kind TEXT NOT NULL,\n src TEXT NOT NULL,\n dst TEXT NOT NULL,\n resolution TEXT NOT NULL,\n confidence REAL NOT NULL,\n epistemic TEXT NOT NULL,\n json TEXT NOT NULL\n );\n CREATE TABLE areas (\n id INTEGER PRIMARY KEY,\n json TEXT NOT NULL\n );\n CREATE INDEX idx_nodes_name ON nodes(name);\n CREATE INDEX idx_nodes_qn ON nodes(qualified_name);\n CREATE INDEX idx_nodes_file ON nodes(file);\n CREATE INDEX idx_edges_src ON edges(src);\n CREATE INDEX idx_edges_dst ON edges(dst);\n CREATE INDEX idx_edges_kind ON edges(kind);\n `);\n\n const insMeta = db.prepare('INSERT INTO meta(key, value) VALUES (?, ?)');\n insMeta.run('corpusHash', graph.provenance.corpusHash);\n insMeta.run('schemaVersion', graph.schemaVersion);\n insMeta.run('generatedAt', graph.generatedAt);\n insMeta.run('nodeCount', String(graph.nodes.length));\n insMeta.run('edgeCount', String(graph.edges.length));\n insMeta.run('analysisTier', graph.meta.analysisTier ?? 'full');\n insMeta.run('indexVersion', 'vg-graph-index/2');\n // Full meta + provenance for reconstruct without graph.json parse.\n insMeta.run('graphMeta', JSON.stringify(graph.meta));\n insMeta.run('graphProvenance', JSON.stringify(graph.provenance));\n if (graph.facts) insMeta.run('factsJson', JSON.stringify(graph.facts));\n if (graph.grounding) insMeta.run('groundingJson', JSON.stringify(graph.grounding));\n if (graph.summaries) insMeta.run('summariesJson', JSON.stringify(graph.summaries));\n if (graph.unknowns) insMeta.run('unknownsJson', JSON.stringify(graph.unknowns));\n\n const insNode = db.prepare(\n `INSERT INTO nodes(id, name, qualified_name, kind, file, line, importance, area, is_hub, lang, json)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n );\n for (const n of graph.nodes) {\n insNode.run(\n n.id,\n n.name,\n n.qualifiedName,\n n.kind,\n n.file,\n n.span.start,\n n.importance,\n n.area,\n n.isHub ? 1 : 0,\n n.lang,\n JSON.stringify(n),\n );\n }\n\n const insEdge = db.prepare(\n `INSERT INTO edges(id, kind, src, dst, resolution, confidence, epistemic, json)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,\n );\n for (const e of graph.edges) {\n insEdge.run(\n e.id,\n e.kind,\n e.src,\n e.dst,\n e.resolution,\n e.confidence,\n e.epistemic ?? 'observed',\n JSON.stringify(e),\n );\n }\n\n const insArea = db.prepare('INSERT INTO areas(id, json) VALUES (?, ?)');\n for (const a of graph.areas) {\n insArea.run(a.id, JSON.stringify(a));\n }\n\n db.close();\n fs.renameSync(tmp, file);\n return { path: file, nodes: graph.nodes.length, edges: graph.edges.length, ok: true };\n } catch (err) {\n return {\n path: file,\n nodes: 0,\n edges: 0,\n ok: false,\n reason: (err as Error).message,\n };\n }\n}\n\nexport interface NameHit {\n id: string;\n name: string;\n qualifiedName: string;\n kind: string;\n file: string;\n line: number;\n importance: number;\n}\n\n/** Fast name / prefix lookup against the index. Empty if index missing. */\nexport function lookupNameIndex(root: string, query: string, limit = 20): NameHit[] {\n const file = indexDbPath(root);\n if (!fs.existsSync(file) || !query.trim()) return [];\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const q = query.trim();\n const rows = db\n .prepare(\n `SELECT id, name, qualified_name, kind, file, line, importance\n FROM nodes\n WHERE name = ? OR qualified_name = ? OR name LIKE ? OR qualified_name LIKE ?\n ORDER BY\n CASE WHEN name = ? OR qualified_name = ? THEN 0\n WHEN name LIKE ? THEN 1\n ELSE 2 END,\n importance DESC\n LIMIT ?`,\n )\n .all(q, q, `${q}%`, `%${q}%`, q, q, `${q}%`, limit) as Record<string, unknown>[];\n db.close();\n return rows.map((r) => ({\n id: String(r.id),\n name: String(r.name),\n qualifiedName: String(r.qualified_name),\n kind: String(r.kind),\n file: String(r.file),\n line: Number(r.line),\n importance: Number(r.importance),\n }));\n } catch {\n return [];\n }\n}\n\n/** Neighbor edges for a node id (src or dst). Empty if index missing. */\nexport function lookupNeighbors(\n root: string,\n nodeId: string,\n direction: 'out' | 'in' | 'both' = 'both',\n limit = 50,\n): GraphEdge[] {\n const file = indexDbPath(root);\n if (!fs.existsSync(file) || !nodeId) return [];\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n let rows: Record<string, unknown>[] = [];\n if (direction === 'out' || direction === 'both') {\n rows = rows.concat(\n db\n .prepare(`SELECT json FROM edges WHERE src = ? LIMIT ?`)\n .all(nodeId, limit) as Record<string, unknown>[],\n );\n }\n if (direction === 'in' || direction === 'both') {\n rows = rows.concat(\n db\n .prepare(`SELECT json FROM edges WHERE dst = ? LIMIT ?`)\n .all(nodeId, limit) as Record<string, unknown>[],\n );\n }\n db.close();\n const byId = new Map<string, GraphEdge>();\n for (const r of rows) {\n try {\n const e = JSON.parse(String(r.json)) as GraphEdge;\n byId.set(e.id, e);\n } catch {\n /* skip bad row */\n }\n }\n return [...byId.values()];\n } catch {\n return [];\n }\n}\n\n/** Read index meta (corpusHash etc.) or null if missing. */\nexport function readIndexMeta(root: string): Record<string, string> | null {\n const file = indexDbPath(root);\n if (!fs.existsSync(file)) return null;\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const rows = db.prepare('SELECT key, value FROM meta').all() as { key: string; value: string }[];\n db.close();\n const out: Record<string, string> = {};\n for (const r of rows) out[r.key] = r.value;\n return out;\n } catch {\n return null;\n }\n}\n\n/**\n * Reconstruct a full `VgGraph` from the SQLite index (indexVersion ≥ 2).\n * Returns null if the index is missing, stale schema, or incomplete.\n * Prefer this over JSON.parse of pretty graph.json for cold serve on large maps.\n */\nexport function loadGraphFromIndex(root: string): VgGraph | null {\n const file = indexDbPath(root);\n if (!fs.existsSync(file)) return null;\n try {\n \n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const metaRows = db.prepare('SELECT key, value FROM meta').all() as {\n key: string;\n value: string;\n }[];\n const meta: Record<string, string> = {};\n for (const r of metaRows) meta[r.key] = r.value;\n\n if (meta.indexVersion !== 'vg-graph-index/2' || !meta.graphMeta || !meta.graphProvenance) {\n db.close();\n return null;\n }\n\n const nodeRows = db.prepare('SELECT json FROM nodes ORDER BY id').all() as {\n json: string;\n }[];\n const edgeRows = db.prepare('SELECT json FROM edges ORDER BY id').all() as {\n json: string;\n }[];\n const areaRows = db.prepare('SELECT json FROM areas ORDER BY id').all() as {\n json: string;\n }[];\n db.close();\n\n const nodes = nodeRows.map((r) => JSON.parse(r.json) as GraphNode);\n const edges = edgeRows.map((r) => JSON.parse(r.json) as GraphEdge);\n const areas = areaRows.map((r) => JSON.parse(r.json) as Area);\n\n // Stable sorts match serialize contract (ids already ordered by SQL, re-sort for safety).\n nodes.sort((a, b) => a.id.localeCompare(b.id));\n edges.sort(\n (a, b) =>\n a.kind.localeCompare(b.kind) || a.src.localeCompare(b.src) || a.dst.localeCompare(b.dst),\n );\n areas.sort((a, b) => a.id - b.id);\n\n const graph: VgGraph = {\n schemaVersion: (meta.schemaVersion as typeof SCHEMA_VERSION) || SCHEMA_VERSION,\n generatedAt: meta.generatedAt ?? new Date(0).toISOString(),\n provenance: JSON.parse(meta.graphProvenance),\n meta: JSON.parse(meta.graphMeta),\n nodes,\n edges,\n areas,\n };\n if (meta.factsJson) graph.facts = JSON.parse(meta.factsJson);\n if (meta.groundingJson) graph.grounding = JSON.parse(meta.groundingJson);\n if (meta.summariesJson) graph.summaries = JSON.parse(meta.summariesJson);\n if (meta.unknownsJson) graph.unknowns = JSON.parse(meta.unknownsJson);\n\n // Lightweight integrity: edge resolution types stay valid.\n for (const e of edges) {\n if (!e.resolution) e.resolution = 'heuristic' as ResolverKind;\n if (!e.epistemic) e.epistemic = 'observed' as EpistemicTier;\n }\n return graph;\n } catch {\n return null;\n }\n}\n\n/**\n * Load the graph preferring the SQLite index when its corpusHash matches the\n * committed graph.json provenance (or when only the index exists). Falls back\n * to graph.json. Returns null if neither is usable.\n */\nexport function loadGraphPreferIndex(\n root: string,\n graphJsonPath: string,\n): { graph: VgGraph; source: 'index' | 'json' } | null {\n // Snapshot-first: skips the large-string JSON.parse when a fresh binary\n // snapshot exists (sidecar or store-mode standalone), and self-heals the\n // sidecar when not (see engine/snapshot.ts).\n const jsonGraph: VgGraph | null = loadGraphFileWithSnapshot(graphJsonPath);\n\n const fromIndex = loadGraphFromIndex(root);\n if (fromIndex) {\n if (!jsonGraph || fromIndex.provenance.corpusHash === jsonGraph.provenance.corpusHash) {\n return { graph: fromIndex, source: 'index' };\n }\n // Index stale vs graph.json — prefer canonical JSON and let next build refresh.\n }\n if (jsonGraph) return { graph: jsonGraph, source: 'json' };\n return null;\n}\n","import { resolveGraphPath } from './artifacts.js';\nimport { loadGraphFileWithSnapshot } from './snapshot.js';\nimport { loadGraphPreferIndex } from './index-db.js';\nimport type { VgGraph } from '../schema.js';\n\n/**\n * Load the code map for a repository.\n *\n * When `graphPath` is omitted, prefers an existing global-store snapshot, then\n * the legacy `.vibgrate/graph.json`, matching {@link resolveGraphPath}.\n * Prefers the SQLite index when its corpusHash matches the committed map\n * (faster cold serve on large repos). Returns null if none exists.\n */\nexport function loadGraph(root: string, graphPath?: string): VgGraph | null {\n const file = resolveGraphPath(root, graphPath);\n // Index is always rooted at the project root; only use it when loading the\n // default map for that root (not an arbitrary --graph path).\n if (!graphPath) {\n const preferred = loadGraphPreferIndex(root, file);\n if (preferred) return preferred.graph;\n }\n return loadGraphFileWithSnapshot(file);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { indexFor, userAskFromInstruction, queryGraph, impactOf,
|
|
1
|
+
import { indexFor, userAskFromInstruction, queryGraph, impactOf, extractLiteralNeedles } from './chunk-USW5WHUG.js';
|
|
2
2
|
import { cacheDir } from './chunk-MVPRPSXU.js';
|
|
3
3
|
import { hashString } from './chunk-JFGYT6BI.js';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -222,13 +222,10 @@ function buildCodeContext(graph, instruction, options = {}) {
|
|
|
222
222
|
const impactDepth = options.impactDepth ?? 2;
|
|
223
223
|
const index = indexFor(graph);
|
|
224
224
|
const ask = userAskFromInstruction(instruction);
|
|
225
|
-
const priorAsk = options.priorInstruction ? userAskFromInstruction(options.priorInstruction) : options.priorInstruction;
|
|
226
225
|
const q = queryGraph(graph, ask, {
|
|
227
226
|
budget: Math.floor(budget * 0.6),
|
|
228
227
|
limit: seedLimit * 2,
|
|
229
|
-
|
|
230
|
-
topicTags: options.topicTags,
|
|
231
|
-
priorQuestion: priorAsk
|
|
228
|
+
ranked: options.ranked
|
|
232
229
|
});
|
|
233
230
|
let seeds = q.matches.map((m) => ({ node: m.node, why: m.why }));
|
|
234
231
|
if (options.files && options.files.length) {
|
|
@@ -251,7 +248,7 @@ function buildCodeContext(graph, instruction, options = {}) {
|
|
|
251
248
|
...literalNeedleFacts(ask),
|
|
252
249
|
...pinnedFactsFor(graph, seedIds)
|
|
253
250
|
];
|
|
254
|
-
const conceptMap =
|
|
251
|
+
const conceptMap = options.ranked?.conceptMap ?? [];
|
|
255
252
|
const rendered = render(instruction, seeds, [...impacted.values()], targetFiles, pinnedFacts, conceptMap, index, budget);
|
|
256
253
|
return {
|
|
257
254
|
instruction,
|
|
@@ -337,8 +334,11 @@ function estimateTokens(text) {
|
|
|
337
334
|
|
|
338
335
|
// src/code/capsule.ts
|
|
339
336
|
var TASK_CAPSULE_SCHEMA_VERSION = "task-capsule/0";
|
|
340
|
-
var CAPSULE_RANKING_VERSION = "capsule-rank@2026.08.
|
|
337
|
+
var CAPSULE_RANKING_VERSION = "capsule-rank@2026.08.4";
|
|
341
338
|
var CAPSULE_COMPILER_ID = "vg-task-capsule/0";
|
|
339
|
+
function interpretationFor(conceptMap) {
|
|
340
|
+
return conceptMap.filter((line) => !/^\s*-?\s*Seed notation\b/i.test(line)).map((line) => line.replace(/^\s*-\s+/, "").trim()).filter(Boolean);
|
|
341
|
+
}
|
|
342
342
|
function summarizeCapsule(capsule) {
|
|
343
343
|
const sourceFiles = [...new Set(capsule.sourceSlices.map((s) => s.file))].sort();
|
|
344
344
|
const preview = capsule.rendered.length > 4e3 ? `${capsule.rendered.slice(0, 4e3)}
|
|
@@ -346,15 +346,36 @@ function summarizeCapsule(capsule) {
|
|
|
346
346
|
return {
|
|
347
347
|
schemaVersion: capsule.schemaVersion,
|
|
348
348
|
instruction: capsule.instruction,
|
|
349
|
-
primary: capsule.primary.map((p) => ({ qualifiedName: p.qualifiedName, file: p.file, kind: p.kind })),
|
|
350
|
-
supporting: capsule.supporting.map((p) => ({ qualifiedName: p.qualifiedName, file: p.file, kind: p.kind })),
|
|
349
|
+
primary: capsule.primary.map((p) => ({ qualifiedName: p.qualifiedName, file: p.file, kind: p.kind, why: p.why })),
|
|
350
|
+
supporting: capsule.supporting.map((p) => ({ qualifiedName: p.qualifiedName, file: p.file, kind: p.kind, why: p.why })),
|
|
351
351
|
sourceSliceCount: capsule.sourceSlices.length,
|
|
352
352
|
sourceFiles,
|
|
353
353
|
tokensEstimate: capsule.tokensEstimate,
|
|
354
354
|
rankingVersion: capsule.provenance.rankingVersion,
|
|
355
|
+
interpretation: interpretationFor(capsule.conceptMap),
|
|
355
356
|
preview
|
|
356
357
|
};
|
|
357
358
|
}
|
|
359
|
+
var TRANSPARENCY_INTERPRETATION_LINES = 6;
|
|
360
|
+
var TRANSPARENCY_SEED_LINES = 3;
|
|
361
|
+
function capsuleTransparencyLines(summary) {
|
|
362
|
+
const lines = [];
|
|
363
|
+
const interpretation = summary.interpretation ?? [];
|
|
364
|
+
for (const line of interpretation.slice(0, TRANSPARENCY_INTERPRETATION_LINES)) {
|
|
365
|
+
lines.push(` read: ${line}`);
|
|
366
|
+
}
|
|
367
|
+
const hiddenInterpretation = interpretation.length - TRANSPARENCY_INTERPRETATION_LINES;
|
|
368
|
+
if (hiddenInterpretation > 0) lines.push(` read: \u2026 ${hiddenInterpretation} more`);
|
|
369
|
+
const seeds = (summary.primary ?? []).filter((p) => p.qualifiedName);
|
|
370
|
+
for (const seed of seeds.slice(0, TRANSPARENCY_SEED_LINES)) {
|
|
371
|
+
const where = seed.file ? ` \xB7 ${seed.file}` : "";
|
|
372
|
+
const why = seed.why ? ` \u2014 ${seed.why}` : "";
|
|
373
|
+
lines.push(` seed: ${seed.qualifiedName}${where}${why}`);
|
|
374
|
+
}
|
|
375
|
+
const hiddenSeeds = seeds.length - TRANSPARENCY_SEED_LINES;
|
|
376
|
+
if (hiddenSeeds > 0) lines.push(` seed: \u2026 ${hiddenSeeds} more`);
|
|
377
|
+
return lines;
|
|
378
|
+
}
|
|
358
379
|
function buildTaskCapsule(graph, instruction, options = {}) {
|
|
359
380
|
const base = buildCodeContext(graph, instruction, options);
|
|
360
381
|
const padding = options.padding ?? 1;
|
|
@@ -400,7 +421,7 @@ function buildTaskCapsule(graph, instruction, options = {}) {
|
|
|
400
421
|
modelProfileId: options.provenance?.modelProfileId ?? null,
|
|
401
422
|
securityTier: options.provenance?.securityTier ?? null,
|
|
402
423
|
policyVersion: options.provenance?.policyVersion ?? null,
|
|
403
|
-
relevanceVersion: options.
|
|
424
|
+
relevanceVersion: options.ranked?.version ?? null
|
|
404
425
|
}
|
|
405
426
|
};
|
|
406
427
|
}
|
|
@@ -550,7 +571,7 @@ function buildVerificationPlan(graph, base) {
|
|
|
550
571
|
}
|
|
551
572
|
function renderCapsule(instruction, primary, supporting, slices, pinnedFacts, conceptMap, targetFiles, verification, relationships, budget) {
|
|
552
573
|
const lines = [];
|
|
553
|
-
lines.push("#
|
|
574
|
+
lines.push("# Context capsule (source-bearing, from the deterministic code graph)");
|
|
554
575
|
lines.push("");
|
|
555
576
|
lines.push("Use the exact source evidence below. Search or read outside it only if this capsule is insufficient.");
|
|
556
577
|
lines.push("");
|
|
@@ -641,6 +662,6 @@ function estimateTokens2(text) {
|
|
|
641
662
|
return Math.ceil(text.length / 4);
|
|
642
663
|
}
|
|
643
664
|
|
|
644
|
-
export { CAPSULE_COMPILER_ID, CAPSULE_RANKING_VERSION, CLI_TOOL_ALIASES, PER_FILE_TOKENS, SAVINGS_TOOLS, TASK_CAPSULE_SCHEMA_VERSION, buildCodeContext, buildTaskCapsule, capsuleToCodeContext, clearSavings, readModelSavings, readSavings, readUsage, recordCliCall, recordSaving, sanitizeClient, savingsLedgerPath, savingsRecorded, summarizeCapsule };
|
|
645
|
-
//# sourceMappingURL=chunk-
|
|
646
|
-
//# sourceMappingURL=chunk-
|
|
665
|
+
export { CAPSULE_COMPILER_ID, CAPSULE_RANKING_VERSION, CLI_TOOL_ALIASES, PER_FILE_TOKENS, SAVINGS_TOOLS, TASK_CAPSULE_SCHEMA_VERSION, buildCodeContext, buildTaskCapsule, capsuleToCodeContext, capsuleTransparencyLines, clearSavings, readModelSavings, readSavings, readUsage, recordCliCall, recordSaving, sanitizeClient, savingsLedgerPath, savingsRecorded, summarizeCapsule };
|
|
666
|
+
//# sourceMappingURL=chunk-TWWVTKA7.js.map
|
|
667
|
+
//# sourceMappingURL=chunk-TWWVTKA7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/engine/savings.ts","../src/code/context.ts","../src/code/capsule.ts"],"names":["estimateTokens","normalize"],"mappings":";;;;;;AAmBA,IAAM,MAAA,GAAS,eAAA;AAER,IAAM,eAAA,GAAkB;AAQxB,IAAM,gCAAgB,IAAI,GAAA,CAAI,CAAC,aAAA,EAAe,UAAA,EAAY,gBAAgB,CAAC;AAoB3E,IAAM,gBAAA,GAAqD;AAAA,EAChE,GAAA,EAAK,aAAA;AAAA,EACL,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQ,WAAA;AAAA,EACR,IAAA,EAAM,WAAA;AAAA,EACN,IAAA,EAAM,WAAA;AAAA,EACN,KAAA,EAAO,YAAA;AAAA,EACP,IAAA,EAAM;AACR;AASO,SAAS,eAAe,IAAA,EAAyC;AACtE,EAAA,IAAI,OAAO,IAAA,KAAS,QAAA,EAAU,OAAO,SAAA;AACrC,EAAA,MAAM,UAAU,IAAA,CACb,IAAA,EAAK,CACL,W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A,IACL,EAAA,EAAI,IAAA;AAAA,IACJ,GAAA,EAAK,KAAA;AAAA,IACL,GAAA,EAAK,IAAA;AAAA,IACL,GAAA,EAAK,IAAA;AAAA,IACL,EAAA,EAAI,QAAA;AAAA,IACJ,EAAA,EAAI,MAAA;AAAA,IACJ,EAAA,EAAI,IAAA;AAAA,IACJ,IAAA,EAAM,MAAA;AAAA,IACN,EAAA,EAAI,QAAA;AAAA,IACJ,EAAA,EAAI,IAAA;AAAA,IACJ,IAAA,EAAM;AAAA,GACR;AACA,EAAA,OAAO,GAAA,CAAI,GAAG,CAAA,IAAK,EAAA;AACrB;AAEA,SAASC,WAAU,IAAA,EAAsB;AACvC,EAAA,OAAO,KAAK,OAAA,CAAQ,KAAA,EAAO,GAAG,CAAA,CAAE,OAAA,CAAQ,SAAS,EAAE,CAAA;AACrD;AAEA,SAASD,gBAAe,IAAA,EAAsB;AAC5C,EAAA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,MAAA,GAAS,CAAC,CAAA;AAClC","file":"chunk-TWWVTKA7.js","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { cacheDir } from './cache.js';\n\n/**\n * Usage-savings tracking (VG-DEVELOPMENT-PLAN §5) — local, privacy-safe, and\n * **opt-in**. We record *counts only* — never code, never the question text —\n * comparing the context tokens vg returned against a grep/read baseline estimate.\n * `vg savings` reports it with the assumptions shown; figures are labelled\n * estimates, never a hero number.\n *\n * Each entry also carries which path served the call (`source`: an MCP tool call\n * vs a `vg <subcommand>` CLI invocation) and, when known, a coarse `client` label\n * (the AI on the other end). That powers the command-vs-MCP split and the\n * per-client breakdown in `vg savings`, and is the basis for the opt-in\n * `vg serve --share-stats` upload (see ./stats-share.ts). Nothing here leaves the\n * machine unless the operator explicitly enables sharing.\n */\n\nconst LEDGER = 'savings.jsonl';\n// A conservative, documented estimate: tokens an agent reads per file it opens.\nexport const PER_FILE_TOKENS = 400;\n\n/** The tools whose grep/read token baseline the savings summary is computed from.\n * search_symbols belongs here: it is the direct grep replacement (the server\n * instructions steer agents to it INSTEAD of grep), yet it used to contribute\n * zero to the estimate — on search-heavy sessions most of the real saving went\n * uncounted. Its baseline is the same measure as query_graph's: the distinct\n * files its matches point at, at PER_FILE_TOKENS each. */\nexport const SAVINGS_TOOLS = new Set(['query_graph', 'get_node', 'search_symbols']);\n\n/**\n * How a navigation call reached the map:\n * - `mcp` — a tool call over the local `vg serve` MCP server;\n * - `cli` — a `vg <subcommand>` invocation that identified itself with `--client`.\n * Both are recorded into one ledger under a shared tool vocabulary (CLI\n * subcommands are normalised to their MCP tool names via CLI_TOOL_ALIASES), so\n * `(tool, source)` is the command-vs-MCP split and the token math stays unified.\n * Absent on ledger lines written before sources existed → read as `mcp` (the\n * only path that recorded then).\n */\nexport type Source = 'mcp' | 'cli';\n\n/**\n * Canonical tool name a CLI navigation subcommand maps to — the same vocabulary\n * the MCP tools use, so a `vg ask --client=claude` and an MCP `query_graph` call\n * land on one row distinguished only by `source`. A subcommand with no MCP twin\n * (e.g. `tree`) keeps its own name.\n */\nexport const CLI_TOOL_ALIASES: Readonly<Record<string, string>> = {\n ask: 'query_graph',\n show: 'get_node',\n impact: 'impact_of',\n path: 'find_path',\n hubs: 'list_hubs',\n areas: 'list_areas',\n tree: 'tree',\n};\n\n/**\n * Normalise a free-form client name (from `--client` or the MCP `initialize`\n * handshake) to a short, bounded, non-PII token: lowercase, `[a-z0-9._-]` only,\n * ≤ 40 chars. Never carries arbitrary user input into the ledger or an upload —\n * it is a coarse client label (e.g. `claude`, `cursor`, `cline`), not identity.\n * Returns `'unknown'` when nothing usable is provided.\n */\nexport function sanitizeClient(name: string | undefined | null): string {\n if (typeof name !== 'string') return 'unknown';\n const cleaned = name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 40);\n return cleaned || 'unknown';\n}\n\n/**\n * Outcome of a recorded navigation call:\n * - `complete` — returned results, with nothing capped or paginated;\n * - `partial` — returned results, but more were available/truncated;\n * - `miss` — returned no result (no match, not-found, not-connected).\n */\nexport type Outcome = 'complete' | 'partial' | 'miss';\n\nexport interface SavingEntry {\n ts: number; // epoch ms (runtime ledger state, not part of any artifact)\n tool: string;\n // Optional for back-compat with ledger lines written before outcomes existed;\n // an absent value is read as `complete` (those lines only recorded hits).\n outcome?: Outcome;\n vgTokens: number;\n baselineTokens: number;\n // Optional for back-compat: absent `source` reads as `mcp`. `client` is a\n // sanitized coarse label (see sanitizeClient) or absent when unidentified.\n source?: Source;\n client?: string;\n // The model that made the call, for per-model savings auditing. `provider` is\n // a coarse provider label (e.g. `anthropic`, `ollama`), `model` the sanitized\n // model slug. VG Code sets both so `vg savings` can break usage down per model.\n // Absent on lines from callers that don't identify a model.\n provider?: string;\n model?: string;\n // Wall time of the call, ms. Optional: absent on lines written before timing\n // existed (and on CLI-sourced lines) — absent means \"not measured\", never 0.\n ms?: number;\n}\n\n/**\n * Normalise a model slug to a bounded, non-PII token — like {@link sanitizeClient}\n * but keeping the `/` and `:` that model ids use (`anthropic/claude-3.5-sonnet`,\n * `qwen2.5-coder:7b`). Returns undefined when nothing usable is given.\n */\nexport function sanitizeModelId(name: string | undefined | null): string | undefined {\n if (typeof name !== 'string') return undefined;\n const cleaned = name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._:/-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 60);\n return cleaned || undefined;\n}\n\n/**\n * Record a CLI navigation call (`vg <subcommand> --client=<ai>`) into the same\n * local ledger the MCP path uses. Only ever called when the caller passed\n * `--client` — i.e. an AI host explicitly identified itself — so a human's bare\n * `vg ask` still records nothing. Counts only; never the question or code.\n */\nexport function recordCliCall(\n root: string,\n entry: { tool: string; client?: string; provider?: string; model?: string; outcome: Outcome; vgTokens?: number; baselineFiles?: number },\n now: number,\n): void {\n recordSaving(\n root,\n {\n tool: entry.tool,\n source: 'cli',\n client: sanitizeClient(entry.client),\n provider: entry.provider ? sanitizeClient(entry.provider) : undefined,\n model: sanitizeModelId(entry.model),\n outcome: entry.outcome,\n vgTokens: entry.vgTokens ?? 0,\n baselineTokens: (entry.baselineFiles ?? 0) * PER_FILE_TOKENS,\n },\n now,\n );\n}\n\n/**\n * Absolute path of the local usage ledger for this repo. Exported so the serve\n * status display can tail it live (mcp/ledger-tail.ts) — the file itself stays\n * local-only (GUARDRAILS §3.4; upload is the separate opt-in stats-share path).\n */\nexport function savingsLedgerPath(root: string): string {\n return path.join(cacheDir(root), LEDGER);\n}\n\nfunction ledgerPath(root: string): string {\n return savingsLedgerPath(root);\n}\n\n/** Whether a savings ledger exists for this repo (i.e. `vg serve --savings` has recorded). */\nexport function savingsRecorded(root: string): boolean {\n return fs.existsSync(ledgerPath(root));\n}\n\n/**\n * Delete the recorded usage data for this repo: the ledger itself plus the\n * stats-share state that indexes into it (a byte offset into the ledger and the\n * random per-install id) — a stale offset against a fresh ledger would silently\n * skip new entries, and clearing \"my data\" should also reset the id. Everything\n * removed lives under `.vibgrate/cache/`; nothing else is touched. Returns\n * whether a ledger existed.\n */\nexport function clearSavings(root: string): boolean {\n const file = ledgerPath(root);\n const existed = fs.existsSync(file);\n fs.rmSync(file, { force: true });\n fs.rmSync(path.join(cacheDir(root), 'stats-share.json'), { force: true });\n return existed;\n}\n\nexport function recordSaving(root: string, entry: Omit<SavingEntry, 'ts'>, now: number): void {\n try {\n fs.mkdirSync(cacheDir(root), { recursive: true });\n const line = JSON.stringify({ ts: now, ...entry });\n fs.appendFileSync(ledgerPath(root), line + '\\n');\n } catch {\n /* never let telemetry break a tool call */\n }\n}\n\nexport interface SavingsReport {\n enabled: boolean;\n days: number;\n queries: number;\n vgTokens: number;\n baselineTokens: number;\n ratio: number;\n estCostVg: number;\n estCostBaseline: number;\n saved: number;\n rateLabel: string;\n}\n\n// Published-style input rate ($/1M tokens), shipped with the CLI. Labelled\n// estimate; the user can pass their own model rate.\nconst DEFAULT_RATE_PER_M = 3.0; // e.g. a mid-tier model input rate\nconst DEFAULT_RATE_LABEL = 'input @ $3/1M';\n\nexport function readSavings(root: string, days: number, now: number, ratePerM = DEFAULT_RATE_PER_M): SavingsReport {\n const file = ledgerPath(root);\n const cutoff = now - days * 24 * 60 * 60 * 1000;\n let queries = 0;\n let vgTokens = 0;\n let baselineTokens = 0;\n if (fs.existsSync(file)) {\n for (const line of fs.readFileSync(file, 'utf8').split('\\n')) {\n if (!line.trim()) continue;\n try {\n const e = JSON.parse(line) as SavingEntry;\n if (e.ts < cutoff) continue;\n // The token-savings figures compare only the tools with a meaningful\n // grep/read baseline; the full per-command breakdown lives in readUsage.\n if (!SAVINGS_TOOLS.has(e.tool)) continue;\n queries++;\n vgTokens += e.vgTokens;\n baselineTokens += e.baselineTokens;\n } catch {\n /* skip corrupt line */\n }\n }\n }\n const estCostVg = (vgTokens / 1e6) * ratePerM;\n const estCostBaseline = (baselineTokens / 1e6) * ratePerM;\n return {\n enabled: savingsRecorded(root),\n days,\n queries,\n vgTokens,\n baselineTokens,\n ratio: vgTokens > 0 ? Math.round((baselineTokens / vgTokens) * 100) / 100 : 0,\n estCostVg: round2(estCostVg),\n estCostBaseline: round2(estCostBaseline),\n saved: round2(estCostBaseline - estCostVg),\n rateLabel: DEFAULT_RATE_LABEL,\n };\n}\n\nfunction round2(x: number): number {\n return Math.round(x * 100) / 100;\n}\n\n/** Token + cost savings attributed to one model (VG Code per-model auditing). */\nexport interface ModelSaving {\n /** `provider/model`, the ledger's per-model key. */\n key: string;\n provider: string;\n model: string;\n queries: number;\n vgTokens: number;\n baselineTokens: number;\n saved: number;\n}\n\n/**\n * Per-model breakdown of the token-savings figures — the basis of \"full savings\n * auditing per model\". Only entries that carry a `model` and are savings-baseline\n * tools contribute, so it lines up with the headline `readSavings` totals.\n * Sorted by dollars saved (desc), then key.\n */\nexport function readModelSavings(root: string, days: number, now: number, ratePerM = DEFAULT_RATE_PER_M): ModelSaving[] {\n const file = ledgerPath(root);\n const cutoff = now - days * 24 * 60 * 60 * 1000;\n const byModel = new Map<string, { provider: string; model: string; queries: number; vg: number; base: number }>();\n if (fs.existsSync(file)) {\n for (const line of fs.readFileSync(file, 'utf8').split('\\n')) {\n if (!line.trim()) continue;\n try {\n const e = JSON.parse(line) as SavingEntry;\n if (e.ts < cutoff || !e.model || !SAVINGS_TOOLS.has(e.tool)) continue;\n const provider = e.provider ?? 'unknown';\n const key = `${provider}/${e.model}`;\n const row = byModel.get(key) ?? { provider, model: e.model, queries: 0, vg: 0, base: 0 };\n row.queries++;\n row.vg += e.vgTokens;\n row.base += e.baselineTokens;\n byModel.set(key, row);\n } catch {\n /* skip corrupt line */\n }\n }\n }\n return [...byModel.entries()]\n .map(([key, r]) => ({\n key,\n provider: r.provider,\n model: r.model,\n queries: r.queries,\n vgTokens: r.vg,\n baselineTokens: r.base,\n saved: round2(((r.base - r.vg) / 1e6) * ratePerM),\n }))\n .sort((a, b) => b.saved - a.saved || a.key.localeCompare(b.key));\n}\n\n/** Per-command usage stats over the ledger window (all recorded tools). */\nexport interface CommandStat {\n tool: string;\n calls: number;\n complete: number;\n partial: number;\n miss: number;\n /** (complete + partial) / calls, as a whole-number percentage. */\n successPct: number;\n /** Mean wall time over the calls that recorded one; null when none did. */\n avgMs: number | null;\n}\n\n/** Calls attributed to one dimension value (a source, or a client). */\nexport interface DimensionStat {\n key: string;\n calls: number;\n complete: number;\n partial: number;\n miss: number;\n successPct: number;\n}\n\nexport interface UsageReport {\n enabled: boolean;\n days: number;\n /** One row per tool used, ordered by call count (desc), then name. */\n commands: CommandStat[];\n /** The command-vs-MCP split: calls grouped by `source` (`cli` / `mcp`). */\n sources: DimensionStat[];\n /** Which AI is calling: calls grouped by coarse `client` label. */\n clients: DimensionStat[];\n /** Column sums across all commands. */\n totals: { calls: number; complete: number; partial: number; miss: number };\n /** The mean of the per-command success percentages (each command weighted equally). */\n avgSuccessPct: number;\n}\n\ninterface OutcomeCounts {\n complete: number;\n partial: number;\n miss: number;\n}\n\n/** Turn a name→outcome-count map into sorted DimensionStat rows. */\nfunction toDimensionStats(byKey: Map<string, OutcomeCounts>): DimensionStat[] {\n return [...byKey.entries()]\n .map(([key, r]) => {\n const calls = r.complete + r.partial + r.miss;\n return {\n key,\n calls,\n complete: r.complete,\n partial: r.partial,\n miss: r.miss,\n successPct: calls ? Math.round(((r.complete + r.partial) / calls) * 100) : 0,\n };\n })\n .sort((a, b) => b.calls - a.calls || a.key.localeCompare(b.key));\n}\n\n/**\n * Per-command breakdown of recorded navigation calls: how often each tool was\n * used and how those calls resolved (complete / partial / miss), plus column\n * totals and the average success rate. Complements the token-savings summary —\n * this counts *every* recorded tool, not just the grep-baseline ones.\n */\nexport function readUsage(root: string, days: number, now: number): UsageReport {\n const file = ledgerPath(root);\n const cutoff = now - days * 24 * 60 * 60 * 1000;\n const byTool = new Map<string, OutcomeCounts>();\n const bySource = new Map<string, OutcomeCounts>();\n const byClient = new Map<string, OutcomeCounts>();\n // Per-tool timing over the entries that recorded a duration (older ledger\n // lines and CLI-sourced calls carry none — \"not measured\", never zero).\n const msByTool = new Map<string, { sum: number; n: number }>();\n const bump = (m: Map<string, OutcomeCounts>, key: string, outcome: Outcome): void => {\n const row = m.get(key) ?? { complete: 0, partial: 0, miss: 0 };\n row[outcome]++;\n m.set(key, row);\n };\n if (fs.existsSync(file)) {\n for (const line of fs.readFileSync(file, 'utf8').split('\\n')) {\n if (!line.trim()) continue;\n try {\n const e = JSON.parse(line) as SavingEntry;\n if (e.ts < cutoff) continue;\n const outcome: Outcome = e.outcome ?? 'complete';\n // Back-compat: lines written before these dims existed are MCP calls\n // from an unidentified client.\n bump(byTool, e.tool, outcome);\n bump(bySource, e.source ?? 'mcp', outcome);\n bump(byClient, e.client ?? 'unknown', outcome);\n if (typeof e.ms === 'number' && e.ms >= 0) {\n const timing = msByTool.get(e.tool) ?? { sum: 0, n: 0 };\n timing.sum += e.ms;\n timing.n++;\n msByTool.set(e.tool, timing);\n }\n } catch {\n /* skip corrupt line */\n }\n }\n }\n const commands: CommandStat[] = toDimensionStats(byTool).map((d) => {\n const timing = msByTool.get(d.key);\n return {\n tool: d.key,\n calls: d.calls,\n complete: d.complete,\n partial: d.partial,\n miss: d.miss,\n successPct: d.successPct,\n avgMs: timing && timing.n > 0 ? Math.round(timing.sum / timing.n) : null,\n };\n });\n const totals = commands.reduce(\n (t, c) => ({\n calls: t.calls + c.calls,\n complete: t.complete + c.complete,\n partial: t.partial + c.partial,\n miss: t.miss + c.miss,\n }),\n { calls: 0, complete: 0, partial: 0, miss: 0 },\n );\n const avgSuccessPct = commands.length\n ? Math.round(commands.reduce((s, c) => s + c.successPct, 0) / commands.length)\n : 0;\n return {\n enabled: savingsRecorded(root),\n days,\n commands,\n sources: toDimensionStats(bySource),\n clients: toDimensionStats(byClient),\n totals,\n avgSuccessPct,\n };\n}\n","/**\n * Graph-grounded context assembly for `vg code` (VG-CLI-CODE §3).\n *\n * A generic coding agent starts blind and reconstructs structure by grepping and\n * reading whole files — which is exactly what blows the context window and\n * degrades the model. This module instead uses the deterministic code graph to\n * hand the planner a *small, high-signal, budget-bounded* context: the symbols\n * most relevant to the instruction, their immediate relations, the blast radius\n * of changing them, and any declared facts (hard constraints) that must not be\n * dropped by later compaction. Deterministic given a graph + instruction, so it\n * is fully offline-testable and benchmarkable.\n */\n\nimport { extractLiteralNeedles, queryGraph } from '../engine/query.js';\nimport type { SanitizedRank } from '../engine/relevance-provider.js';\nimport { indexFor } from '../engine/relations.js';\nimport { impactOf } from '../engine/impact.js';\nimport type { CodeContext } from './types.js';\nimport type { GraphNode, VgGraph } from '../schema.js';\nimport { userAskFromInstruction } from '../engine/user-ask.js';\n\nexport interface BuildContextOptions {\n /** Approx token budget for the rendered block (default 3000). */\n budget?: number;\n /** How many retrieval seeds to expand (default 8). */\n seeds?: number;\n /** Impact BFS depth for the blast radius (default 2). */\n impactDepth?: number;\n /** Restrict the edit surface to these files (from `--file`), if given. */\n files?: string[];\n /** Sanitized module ranking (engine/relevance-provider.ts rankQuestion),\n * computed by the async caller over the user's ask — carries the seed\n * ordering AND the plain-language concept map. Absent → the mechanical\n * fallback ranks and the concept map is empty. */\n ranked?: SanitizedRank | null;\n}\n\n/**\n * Build the context block for a coding instruction. The ordering is\n * cache-stable by design (see router.ts): the invariant, repo-derived material\n * (facts, symbols, relations) comes first and the volatile instruction is\n * echoed last, so a provider's prompt cache can reuse the stable prefix across\n * turns.\n */\nexport function buildCodeContext(graph: VgGraph, instruction: string, options: BuildContextOptions = {}): CodeContext {\n const budget = options.budget ?? 3000;\n const seedLimit = options.seeds ?? 8;\n const impactDepth = options.impactDepth ?? 2;\n const index = indexFor(graph);\n\n // Hosts (VS Code panel) append a \"User attachments\" block with backticked\n // filenames/paths. Ranking and literal-locate pins must use only the user's\n // ask — otherwise `image.png` becomes a hard constraint that aborts the task.\n // The full instruction (with attachments) still goes in the Task section.\n const ask = userAskFromInstruction(instruction);\n\n // Retrieval seeds: the module ranking when the async caller supplied one\n // (options.ranked — the relevance engine), the mechanical fallback\n // otherwise. When `--file` narrows the surface, keep only seeds in those\n // files (but still let impact reach outside them, so the review is honest).\n const q = queryGraph(graph, ask, {\n budget: Math.floor(budget * 0.6),\n limit: seedLimit * 2,\n ranked: options.ranked,\n });\n let seeds = q.matches.map((m) => ({ node: m.node, why: m.why }));\n if (options.files && options.files.length) {\n const set = new Set(options.files.map(normalize));\n const inScope = seeds.filter((s) => set.has(normalize(s.node.file)));\n // If nothing matched inside the named files, keep the best global seeds but\n // still steer target files to what the caller asked for.\n if (inScope.length) seeds = inScope;\n }\n seeds = seeds.slice(0, seedLimit);\n\n // Blast radius: who depends on the seeds. This is the impact-aware review\n // signal — an edit to a hub is riskier and the context says so.\n const impacted = new Map<string, { node: GraphNode; via: string }>();\n for (const s of seeds) {\n const impact = impactOf(graph, s.node.id, { depth: impactDepth });\n for (const item of impact.affected.slice(0, 6)) {\n const node = index.node(item.id);\n if (node && !impacted.has(node.id)) impacted.set(node.id, { node, via: s.node.qualifiedName });\n }\n }\n\n // Target files: the seed files (or the explicit --file set), stable order.\n const targetFiles = options.files?.length\n ? [...new Set(options.files.map(normalize))].sort()\n : [...new Set(seeds.map((s) => s.node.file))].sort();\n\n // Pinned facts: declared invariants/contracts that touch the seeds. These are\n // hard constraints; they are surfaced explicitly and never summarized away.\n const seedIds = new Set(seeds.map((s) => s.node.id));\n const pinnedFacts = [\n ...literalNeedleFacts(ask),\n ...pinnedFactsFor(graph, seedIds),\n ];\n\n // The plain-language interpretation is authored by the relevance module\n // (and sanitized at the seam); the mechanical fallback has none to offer.\n const conceptMap = options.ranked?.conceptMap ?? [];\n const rendered = render(instruction, seeds, [...impacted.values()], targetFiles, pinnedFacts, conceptMap, index, budget);\n return {\n instruction,\n seeds,\n targetFiles,\n impacted: [...impacted.values()],\n pinnedFacts,\n conceptMap,\n rendered,\n tokensEstimate: estimateTokens(rendered),\n };\n}\n\n/** Pin URL / quoted needles so the agent does not treat path tokens as symbols. */\nfunction literalNeedleFacts(ask: string): string[] {\n const needles = extractLiteralNeedles(ask);\n if (!needles.length) return [];\n return needles.map(\n (n) =>\n `literal-locate: search the workspace for the exact string \\`${n}\\` (use search_code with the quoted needle). This is not a graph symbol name. If there are zero hits, report that honestly and finish — do not invent an edit.`,\n );\n}\n\nfunction pinnedFactsFor(graph: VgGraph, seedIds: Set<string>): string[] {\n if (!graph.facts?.length) return [];\n const out: string[] = [];\n for (const f of graph.facts) {\n if (f.kind === 'characterization') continue; // keep hard constraints only\n if (!f.subjectIds.some((id) => seedIds.has(id))) continue;\n const subjects = f.subjectIds\n .map((id) => graph.nodes.find((n) => n.id === id)?.qualifiedName ?? id)\n .join(', ');\n out.push(`${f.kind}: ${subjects} — ${JSON.stringify(f.predicate)}`);\n }\n return out.sort().slice(0, 12);\n}\n\nfunction render(\n instruction: string,\n seeds: { node: GraphNode; why: string }[],\n impacted: { node: GraphNode; via: string }[],\n targetFiles: string[],\n pinnedFacts: string[],\n conceptMap: string[],\n index: ReturnType<typeof indexFor>,\n budget: number,\n): string {\n const lines: string[] = [];\n lines.push('# Repository context (from the deterministic code graph)');\n lines.push('');\n\n if (pinnedFacts.length) {\n lines.push('## Hard constraints (do not violate)');\n for (const f of pinnedFacts) lines.push(`- ${f}`);\n lines.push('');\n }\n\n if (conceptMap.length) {\n lines.push('## How the ask was interpreted');\n for (const l of conceptMap) lines.push(l);\n lines.push('');\n }\n\n lines.push('## Relevant symbols');\n for (const { node, why } of seeds) {\n const block: string[] = [];\n block.push(`### ${node.qualifiedName} (${node.kind}, ${node.file}:${node.span.start}-${node.span.end})`);\n if (node.signature) block.push('`' + node.signature + '`');\n const callees = uniqueNames(index.callees(node.id).map((x) => x.node.qualifiedName)).slice(0, 6);\n const callers = uniqueNames(index.callers(node.id).map((x) => x.node.qualifiedName)).slice(0, 6);\n if (callees.length) block.push(`calls: ${callees.join(', ')}`);\n if (callers.length) block.push(`called by: ${callers.join(', ')}`);\n block.push(`importance ${node.importance.toFixed(3)}${node.isHub ? ' · hub (high blast radius)' : ''} · ${why}`);\n block.push('');\n const candidate = lines.concat(block).join('\\n');\n if (estimateTokens(candidate) > budget && lines.length > 3) break;\n lines.push(...block);\n }\n\n if (impacted.length) {\n lines.push('## Blast radius (would be affected by a change here)');\n for (const { node, via } of impacted.slice(0, 10)) {\n lines.push(`- ${node.qualifiedName} (${node.file}:${node.span.start}) — depends on ${via}`);\n }\n lines.push('');\n }\n\n lines.push('## Files in scope for this edit');\n for (const f of targetFiles) lines.push(`- ${f}`);\n lines.push('');\n\n lines.push('## Task');\n lines.push(instruction);\n return lines.join('\\n');\n}\n\nfunction uniqueNames(xs: string[]): string[] {\n return [...new Set(xs)];\n}\n\nfunction normalize(file: string): string {\n return file.replace(/\\\\/g, '/').replace(/^\\.\\//, '');\n}\n\nfunction estimateTokens(text: string): number {\n return Math.ceil(text.length / 4);\n}\n","/**\n * Source-bearing Context Capsule compiler (Fusion Runtime Phase 0).\n *\n * Today's {@link buildCodeContext} pays for graph metadata, then the model still\n * calls `read_file` — double payment. This module compiles a Context Capsule that\n * includes exact source ranges (from Tree-sitter spans already on graph nodes)\n * so the first inference can solve without navigation tool calls (ZNS@1 path).\n *\n * Deterministic given (graph, instruction, file contents, options). Injectable\n * `readFile` keeps unit tests offline and pure.\n *\n * Schema: docs/fusion/task-capsule-v0.schema.json\n */\n\nimport { queryGraph } from '../engine/query.js';\nimport { indexFor } from '../engine/relations.js';\nimport { impactOf } from '../engine/impact.js';\nimport { hashString } from '../engine/hash.js';\nimport type { GraphNode, VgGraph } from '../schema.js';\nimport type { CodeContext } from './types.js';\nimport { buildCodeContext, type BuildContextOptions } from './context.js';\n\nexport const TASK_CAPSULE_SCHEMA_VERSION = 'task-capsule/0' as const;\n/** Frozen ranking policy id — bump when the heuristic changes (benchmark gate). */\n/** Bumped 2026.07.1: strip URL/quoted needles from seed ranking (no path-token false positives). */\n/** Bumped 2026.08.1: term roles (weak process verbs never seed alone), concept/bigram\n * expansion (payments→stripe, \"direct debit\"→sepa/bacs/mandate), multi-term coverage\n * bonus, directory-segment evidence — gated by the ask-quality corpus (bench/ask-corpus.mjs). */\n/** Bumped 2026.08.2: optional relevance-provider seam — sanitized provider expansions\n * join term preparation (own 0..1 weight capped at EXPANSION_WEIGHT; weak-provenance\n * dropped); provider version recorded as `relevanceVersion` provenance. Absent\n * provider = 2026.08.1 behaviour exactly — gated by the same corpus, dual-mode. */\n/** Bumped 2026.08.3: multi-turn field report (\"do we support direct debits?\" after a\n * stripe ask seeded direct* distractors). (a) Tokens consumed by a fired bigram\n * concept are demoted to the weak role — \"direct\" corroborates, never seeds.\n * (b) Conversation carry-over: the previous ask's content terms join ranking at\n * CARRY_WEIGHT when the caller passes `priorInstruction`. (c) A plain-language\n * \"how the ask was interpreted\" concept map is rendered for small local models.\n * No prior instruction + no bigram ask = 2026.08.2 behaviour exactly. */\n/** Bumped 2026.08.4: relevance relocation — the ranking engine (lexicon, term\n * roles, IDF, tiers, typo repair, morphology, diversification, concept map)\n * moved into the auto-provisioned relevance module behind the seam's\n * rankSymbols API; the host keeps mechanical name matching as the\n * module-less fallback. Seed content with the module active matches\n * 2026.08.3 + the coding-prompt-corpus improvements; the recorded\n * relevanceVersion says which engine ranked this capsule. */\nexport const CAPSULE_RANKING_VERSION = 'capsule-rank@2026.08.4' as const;\nexport const CAPSULE_COMPILER_ID = 'vg-task-capsule/0' as const;\n\nexport interface BuildCapsuleOptions extends BuildContextOptions {\n /**\n * Read file contents relative to the repository root. Required for source\n * slices; when omitted, the capsule still builds metadata + empty slices\n * (useful for schema/shape tests).\n */\n readFile?: (relativePath: string) => string | null;\n /** Extra lines of context around each symbol span (default 1). */\n padding?: number;\n /** Max source slices after merge (default 12). */\n maxSlices?: number;\n repositoryId?: string | null;\n /** Optional provenance from the Model Execution Profile / security ladder. */\n provenance?: CapsuleProvenanceExtras;\n /**\n * Extra pinned facts (e.g. high-confidence federation bridge edges) appended\n * after graph-derived facts. Secret-free, short strings only.\n */\n extraPinnedFacts?: string[];\n}\n\nexport interface CapsuleSymbolRef {\n id: string;\n qualifiedName: string;\n kind: string;\n file: string;\n span: { start: number; end: number };\n signature?: string | null;\n why: string;\n importance: number;\n}\n\nexport interface SourceSlice {\n file: string;\n start: number;\n end: number;\n content: string;\n contentHash: string;\n symbolIds: string[];\n}\n\nexport interface CapsuleRelationship {\n kind: 'calls' | 'called-by' | 'impacts' | 'contains' | 'other';\n from: string;\n to: string;\n}\n\nexport interface VerificationPlan {\n syntaxFiles: string[];\n suggestedTests: string[];\n notes: string[];\n}\n\nexport interface TaskCapsule {\n schemaVersion: typeof TASK_CAPSULE_SCHEMA_VERSION;\n instruction: string;\n primary: CapsuleSymbolRef[];\n supporting: CapsuleSymbolRef[];\n sourceSlices: SourceSlice[];\n relationships: CapsuleRelationship[];\n pinnedFacts: string[];\n /** Plain-language interpretation of the ask (concept expansions, relevance\n * topics, carried prior-turn terms) — see engine/query.ts conceptMapLines. */\n conceptMap: string[];\n targetFiles: string[];\n verificationPlan: VerificationPlan;\n rendered: string;\n tokensEstimate: number;\n provenance: {\n compiler: string;\n rankingVersion: string;\n graphCorpusHash: string | null;\n repositoryId: string | null;\n /** Model Execution Profile id when resolved (Fusion Phase 4/7). */\n modelProfileId?: string | null;\n /** Security tier for shell during this task. */\n securityTier?: string | null;\n /** Frozen policy / ranking patch id if any. */\n policyVersion?: string | null;\n /** Version of the optional relevance provider that widened seed\n * vocabulary for this capsule, or null when none was active. */\n relevanceVersion?: string | null;\n };\n}\n\nexport interface CapsuleProvenanceExtras {\n modelProfileId?: string | null;\n securityTier?: string | null;\n policyVersion?: string | null;\n}\n\n/** Host-safe capsule summary for VS Code / stream-json capsule transparency. */\nexport interface CapsuleSummary {\n schemaVersion: string;\n instruction: string;\n primary: Array<{ qualifiedName: string; file: string; kind: string; why: string }>;\n supporting: Array<{ qualifiedName: string; file: string; kind: string; why: string }>;\n sourceSliceCount: number;\n sourceFiles: string[];\n tokensEstimate: number;\n rankingVersion: string;\n /**\n * How the ask was interpreted, ready to show a human: the capsule's concept\n * map with the model-facing seed-notation legend dropped and the leading\n * \"- \" bullet stripped. Empty when no relevance engine widened the ask.\n */\n interpretation: string[];\n /** Truncated rendered capsule for display (not the full prompt dump). */\n preview: string;\n}\n\n/**\n * The concept map, projected for a human surface. The rendered capsule ends its\n * concept map with a notation legend that exists so a small local model can\n * decode the `a→b` slugs on each seed line; a terminal or panel reader has the\n * `why` strings spelled out next to the symbol, so the legend is noise there.\n */\nfunction interpretationFor(conceptMap: string[]): string[] {\n return conceptMap\n .filter((line) => !/^\\s*-?\\s*Seed notation\\b/i.test(line))\n .map((line) => line.replace(/^\\s*-\\s+/, '').trim())\n .filter(Boolean);\n}\n\n/** Host-safe capsule summary (capsule transparency UI / stream-json). */\nexport function summarizeCapsule(capsule: TaskCapsule): CapsuleSummary {\n const sourceFiles = [...new Set(capsule.sourceSlices.map((s) => s.file))].sort();\n const preview = capsule.rendered.length > 4000 ? `${capsule.rendered.slice(0, 4000)}\\n… (truncated)` : capsule.rendered;\n return {\n schemaVersion: capsule.schemaVersion,\n instruction: capsule.instruction,\n primary: capsule.primary.map((p) => ({ qualifiedName: p.qualifiedName, file: p.file, kind: p.kind, why: p.why })),\n supporting: capsule.supporting.map((p) => ({ qualifiedName: p.qualifiedName, file: p.file, kind: p.kind, why: p.why })),\n sourceSliceCount: capsule.sourceSlices.length,\n sourceFiles,\n tokensEstimate: capsule.tokensEstimate,\n rankingVersion: capsule.provenance.rankingVersion,\n interpretation: interpretationFor(capsule.conceptMap),\n preview,\n };\n}\n\n/**\n * Interpretation lines shown before the seeds. Matches the VS Code panel's cap\n * so the two surfaces explain an ask the same way. Three was too few in\n * practice: the concept map orders broad taxonomy lines ahead of the specific\n * ones, so a typo repair (\"read \\\"chekout\\\" as \\\"checkout\\\"\") — the line a\n * reader who typed the typo most needs — fell past the cut.\n */\nconst TRANSPARENCY_INTERPRETATION_LINES = 6;\n/** Seeds shown with their match provenance. */\nconst TRANSPARENCY_SEED_LINES = 3;\n\n/**\n * The capsule transparency block for a text surface: how the ask was read, and\n * which symbols that reached, with the reason each one matched.\n *\n * Returns indented, ready-to-print lines (the caller applies dimming). Both\n * sections are capped — a coding session prints one of these per turn, and the\n * complete block already travels inside the capsule itself. Empty when there is\n * nothing to explain (no relevance engine active and no seeds).\n */\nexport function capsuleTransparencyLines(summary: CapsuleSummary): string[] {\n const lines: string[] = [];\n\n const interpretation = summary.interpretation ?? [];\n for (const line of interpretation.slice(0, TRANSPARENCY_INTERPRETATION_LINES)) {\n lines.push(` read: ${line}`);\n }\n const hiddenInterpretation = interpretation.length - TRANSPARENCY_INTERPRETATION_LINES;\n if (hiddenInterpretation > 0) lines.push(` read: … ${hiddenInterpretation} more`);\n\n const seeds = (summary.primary ?? []).filter((p) => p.qualifiedName);\n for (const seed of seeds.slice(0, TRANSPARENCY_SEED_LINES)) {\n // An external/module node carries no file of its own — no dangling separator.\n const where = seed.file ? ` · ${seed.file}` : '';\n const why = seed.why ? ` — ${seed.why}` : '';\n lines.push(` seed: ${seed.qualifiedName}${where}${why}`);\n }\n const hiddenSeeds = seeds.length - TRANSPARENCY_SEED_LINES;\n if (hiddenSeeds > 0) lines.push(` seed: … ${hiddenSeeds} more`);\n\n return lines;\n}\n\n/**\n * Compile a source-bearing Context Capsule. Reuses the same seed / impact /\n * fact-pinning path as {@link buildCodeContext}, then attaches exact source\n * slices and a verification sketch.\n */\nexport function buildTaskCapsule(graph: VgGraph, instruction: string, options: BuildCapsuleOptions = {}): TaskCapsule {\n const base = buildCodeContext(graph, instruction, options);\n const padding = options.padding ?? 1;\n const maxSlices = options.maxSlices ?? 12;\n const budget = options.budget ?? 3000;\n const index = indexFor(graph);\n\n const primary = base.seeds.map((s) => toRef(s.node, s.why));\n const primaryIds = new Set(primary.map((p) => p.id));\n\n const supporting: CapsuleSymbolRef[] = [];\n for (const { node, via } of base.impacted) {\n if (primaryIds.has(node.id)) continue;\n supporting.push(toRef(node, `depends on ${via}`));\n }\n\n const relationships = collectRelationships(base, index);\n const sourceSlices = options.readFile\n ? buildSourceSlices(\n [...base.seeds.map((s) => s.node), ...base.impacted.map((i) => i.node)],\n options.readFile,\n padding,\n maxSlices,\n )\n : [];\n\n const extraFacts = (options.extraPinnedFacts ?? []).filter((f) => typeof f === 'string' && f.trim());\n const pinnedFacts = [...base.pinnedFacts, ...extraFacts];\n const verificationPlan = buildVerificationPlan(graph, base);\n const rendered = renderCapsule(instruction, primary, supporting, sourceSlices, pinnedFacts, base.conceptMap, base.targetFiles, verificationPlan, relationships, budget);\n\n return {\n schemaVersion: TASK_CAPSULE_SCHEMA_VERSION,\n instruction,\n primary,\n supporting,\n sourceSlices,\n relationships,\n pinnedFacts,\n conceptMap: base.conceptMap,\n targetFiles: base.targetFiles,\n verificationPlan,\n rendered,\n tokensEstimate: estimateTokens(rendered),\n provenance: {\n compiler: CAPSULE_COMPILER_ID,\n rankingVersion: CAPSULE_RANKING_VERSION,\n graphCorpusHash: graph.provenance?.corpusHash ?? null,\n repositoryId: options.repositoryId ?? null,\n modelProfileId: options.provenance?.modelProfileId ?? null,\n securityTier: options.provenance?.securityTier ?? null,\n policyVersion: options.provenance?.policyVersion ?? null,\n relevanceVersion: options.ranked?.version ?? null,\n },\n };\n}\n\n/**\n * Project a capsule into the legacy {@link CodeContext} shape so the existing\n * agent prompt path can consume it without a full rewrite (A/B flag).\n */\nexport function capsuleToCodeContext(capsule: TaskCapsule): CodeContext {\n return {\n instruction: capsule.instruction,\n seeds: capsule.primary.map((p) => ({\n node: {\n id: p.id,\n qualifiedName: p.qualifiedName,\n kind: p.kind,\n file: p.file,\n span: p.span,\n signature: p.signature ?? undefined,\n importance: p.importance,\n } as GraphNode,\n why: p.why,\n })),\n targetFiles: capsule.targetFiles,\n conceptMap: capsule.conceptMap,\n impacted: capsule.supporting.map((s) => ({\n node: {\n id: s.id,\n qualifiedName: s.qualifiedName,\n kind: s.kind,\n file: s.file,\n span: s.span,\n signature: s.signature ?? undefined,\n importance: s.importance,\n } as GraphNode,\n via: s.why.replace(/^depends on /, ''),\n })),\n pinnedFacts: capsule.pinnedFacts,\n rendered: capsule.rendered,\n tokensEstimate: capsule.tokensEstimate,\n };\n}\n\nfunction toRef(node: GraphNode, why: string): CapsuleSymbolRef {\n return {\n id: node.id,\n qualifiedName: node.qualifiedName,\n kind: node.kind,\n file: normalize(node.file),\n span: { start: node.span.start, end: node.span.end },\n signature: node.signature ?? null,\n why,\n importance: node.importance,\n };\n}\n\nfunction collectRelationships(\n base: CodeContext,\n index: ReturnType<typeof indexFor>,\n): CapsuleRelationship[] {\n const out: CapsuleRelationship[] = [];\n const seen = new Set<string>();\n const push = (kind: CapsuleRelationship['kind'], from: string, to: string) => {\n const key = `${kind}|${from}|${to}`;\n if (seen.has(key)) return;\n seen.add(key);\n out.push({ kind, from, to });\n };\n\n for (const { node } of base.seeds) {\n for (const c of index.callees(node.id).slice(0, 6)) {\n push('calls', node.qualifiedName, c.node.qualifiedName);\n }\n for (const c of index.callers(node.id).slice(0, 6)) {\n push('called-by', node.qualifiedName, c.node.qualifiedName);\n }\n }\n for (const { node, via } of base.impacted.slice(0, 10)) {\n push('impacts', via, node.qualifiedName);\n }\n\n // Stable order for determinism.\n return out.sort((a, b) => a.kind.localeCompare(b.kind) || a.from.localeCompare(b.from) || a.to.localeCompare(b.to));\n}\n\nfunction buildSourceSlices(\n nodes: GraphNode[],\n readFile: (relativePath: string) => string | null,\n padding: number,\n maxSlices: number,\n): SourceSlice[] {\n // Prefer concrete symbols over file/module containers for source evidence.\n const eligible = nodes.filter((n) => !['file', 'module', 'package'].includes(n.kind));\n const byFile = new Map<string, GraphNode[]>();\n for (const n of eligible) {\n const file = normalize(n.file);\n const list = byFile.get(file) ?? [];\n list.push(n);\n byFile.set(file, list);\n }\n\n type Range = { file: string; start: number; end: number; symbolIds: string[]; score: number };\n const ranges: Range[] = [];\n\n for (const [file, fileNodes] of [...byFile.entries()].sort(([a], [b]) => a.localeCompare(b))) {\n const sorted = [...fileNodes].sort((a, b) => a.span.start - b.span.start || b.importance - a.importance);\n let current: Range | null = null;\n for (const n of sorted) {\n const start = Math.max(1, n.span.start - padding);\n const end = n.span.end + padding;\n const score = n.importance + (n.isHub ? 0.25 : 0);\n if (current && current.file === file && start <= current.end + 2) {\n current.end = Math.max(current.end, end);\n current.symbolIds.push(n.id);\n current.score = Math.max(current.score, score);\n } else {\n if (current) ranges.push(current);\n current = { file, start, end, symbolIds: [n.id], score };\n }\n }\n if (current) ranges.push(current);\n }\n\n ranges.sort((a, b) => b.score - a.score || a.file.localeCompare(b.file) || a.start - b.start);\n\n const slices: SourceSlice[] = [];\n for (const range of ranges) {\n if (slices.length >= maxSlices) break;\n const raw = readFile(range.file);\n if (raw === null) continue;\n const lines = raw.split('\\n');\n const start = Math.min(range.start, lines.length);\n const end = Math.min(range.end, lines.length);\n if (start < 1 || end < start) continue;\n const content = lines.slice(start - 1, end).join('\\n');\n slices.push({\n file: range.file,\n start,\n end,\n content,\n contentHash: hashString(content),\n symbolIds: [...new Set(range.symbolIds)].sort(),\n });\n }\n\n // Stable final order: file then start line (score only used for selection).\n return slices.sort((a, b) => a.file.localeCompare(b.file) || a.start - b.start);\n}\n\nfunction buildVerificationPlan(graph: VgGraph, base: CodeContext): VerificationPlan {\n const syntaxFiles = [...base.targetFiles].sort();\n const seedIds = new Set(base.seeds.map((s) => s.node.id));\n const suggestedTests: string[] = [];\n\n for (const n of graph.nodes) {\n if (n.kind !== 'test') continue;\n // Prefer tests that share a file with seeds or whose name mentions a seed.\n const sameFile = base.seeds.some((s) => normalize(s.node.file) === normalize(n.file));\n const nameHit = base.seeds.some((s) => n.qualifiedName.toLowerCase().includes(s.node.name.toLowerCase()));\n if (sameFile || nameHit || seedIds.has(n.id)) {\n suggestedTests.push(n.qualifiedName);\n }\n }\n suggestedTests.sort();\n\n const notes: string[] = [];\n if (!suggestedTests.length) {\n notes.push('No graph-linked tests found for seed symbols; run the nearest project test command after apply.');\n }\n if (base.impacted.some((i) => i.node.isHub || i.node.importance >= 0.7)) {\n notes.push('High-importance dependents in blast radius — prefer targeted tests before a full build.');\n }\n\n return {\n syntaxFiles,\n suggestedTests: suggestedTests.slice(0, 12),\n notes,\n };\n}\n\nfunction renderCapsule(\n instruction: string,\n primary: CapsuleSymbolRef[],\n supporting: CapsuleSymbolRef[],\n slices: SourceSlice[],\n pinnedFacts: string[],\n conceptMap: string[],\n targetFiles: string[],\n verification: VerificationPlan,\n relationships: CapsuleRelationship[],\n budget: number,\n): string {\n const lines: string[] = [];\n lines.push('# Context capsule (source-bearing, from the deterministic code graph)');\n lines.push('');\n lines.push('Use the exact source evidence below. Search or read outside it only if this capsule is insufficient.');\n lines.push('');\n\n if (pinnedFacts.length) {\n lines.push('## Hard constraints (do not violate)');\n for (const f of pinnedFacts) lines.push(`- ${f}`);\n lines.push('');\n }\n\n // Rendered before the symbol list on purpose: a small local model reads the\n // interpretation first, so the `a→b` provenance slugs on each seed line are\n // decodable instead of noise.\n if (conceptMap.length) {\n lines.push('## How the ask was interpreted');\n for (const l of conceptMap) lines.push(l);\n lines.push('');\n }\n\n lines.push('## Primary symbols');\n for (const s of primary) {\n lines.push(`- ${s.qualifiedName} (${s.kind}, ${s.file}:${s.span.start}-${s.span.end})${s.signature ? ` — \\`${s.signature}\\`` : ''} — ${s.why}`);\n }\n lines.push('');\n\n if (supporting.length) {\n lines.push('## Supporting / blast radius');\n for (const s of supporting.slice(0, 10)) {\n lines.push(`- ${s.qualifiedName} (${s.file}:${s.span.start}) — ${s.why}`);\n }\n lines.push('');\n }\n\n if (relationships.length) {\n lines.push('## Relationships');\n for (const r of relationships.slice(0, 24)) {\n lines.push(`- ${r.kind}: ${r.from} → ${r.to}`);\n }\n lines.push('');\n }\n\n lines.push('## Exact source evidence');\n if (!slices.length) {\n lines.push('_No source slices available (file reader missing or spans unreadable)._');\n lines.push('');\n } else {\n let included = 0;\n for (const slice of slices) {\n const block = [\n `### ${slice.file}:${slice.start}-${slice.end}`,\n `\\`\\`\\`${langFor(slice.file)}`,\n slice.content,\n '```',\n '',\n ];\n const candidate = [...lines, ...block, '## Task', instruction].join('\\n');\n if (estimateTokens(candidate) > budget && included > 0) break;\n lines.push(...block);\n included += 1;\n }\n }\n\n lines.push('## Files in scope');\n for (const f of targetFiles) lines.push(`- ${f}`);\n lines.push('');\n\n lines.push('## Verification plan');\n for (const f of verification.syntaxFiles) lines.push(`- syntax: ${f}`);\n for (const t of verification.suggestedTests) lines.push(`- test: ${t}`);\n for (const n of verification.notes) lines.push(`- note: ${n}`);\n lines.push('');\n\n lines.push('## Task');\n lines.push(instruction);\n return lines.join('\\n');\n}\n\nfunction langFor(file: string): string {\n const ext = file.split('.').pop()?.toLowerCase() ?? '';\n const map: Record<string, string> = {\n ts: 'ts',\n tsx: 'tsx',\n js: 'js',\n jsx: 'jsx',\n mjs: 'js',\n cjs: 'js',\n py: 'python',\n rs: 'rust',\n go: 'go',\n java: 'java',\n cs: 'csharp',\n md: 'md',\n json: 'json',\n };\n return map[ext] ?? '';\n}\n\nfunction normalize(file: string): string {\n return file.replace(/\\\\/g, '/').replace(/^\\.\\//, '');\n}\n\nfunction estimateTokens(text: string): number {\n return Math.ceil(text.length / 4);\n}\n\n// Re-export query touch so tree-shaking keeps the dependency explicit for tests.\nexport const __testing = { queryGraph, impactOf };\n"]}
|