gitnexus 1.6.8-rc.2 → 1.6.8-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +20 -0
  2. package/dist/_shared/scope-resolution/parsed-file.d.ts +21 -0
  3. package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -1
  4. package/dist/_shared/scope-resolution/symbol-definition.d.ts +4 -0
  5. package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
  6. package/dist/cli/ai-context.js +1 -0
  7. package/dist/cli/analyze-config.js +40 -0
  8. package/dist/cli/analyze.d.ts +22 -0
  9. package/dist/cli/analyze.js +36 -6
  10. package/dist/cli/clean.d.ts +1 -0
  11. package/dist/cli/clean.js +43 -1
  12. package/dist/cli/eval-server.js +43 -0
  13. package/dist/cli/help-i18n.js +11 -0
  14. package/dist/cli/i18n/en.d.ts +13 -0
  15. package/dist/cli/i18n/en.js +13 -0
  16. package/dist/cli/i18n/resources.d.ts +26 -0
  17. package/dist/cli/i18n/zh-CN.d.ts +13 -0
  18. package/dist/cli/i18n/zh-CN.js +13 -0
  19. package/dist/cli/index.js +19 -0
  20. package/dist/cli/list.js +12 -0
  21. package/dist/cli/optional-grammars.d.ts +6 -8
  22. package/dist/cli/optional-grammars.js +8 -11
  23. package/dist/cli/skill-gen.js +1 -0
  24. package/dist/cli/status.js +26 -5
  25. package/dist/cli/tool.d.ts +12 -1
  26. package/dist/cli/tool.js +41 -1
  27. package/dist/core/embeddings/embedder.js +4 -0
  28. package/dist/core/embeddings/embedding-pipeline.js +27 -16
  29. package/dist/core/embeddings/onnxruntime-common-resolver.d.ts +6 -0
  30. package/dist/core/embeddings/onnxruntime-common-resolver.js +130 -0
  31. package/dist/core/graph/import-cycles.d.ts +10 -0
  32. package/dist/core/graph/import-cycles.js +103 -0
  33. package/dist/core/group/extractors/grpc-patterns/proto.js +10 -6
  34. package/dist/core/group/extractors/http-patterns/java.js +3 -50
  35. package/dist/core/group/extractors/http-patterns/kotlin.js +7 -7
  36. package/dist/core/group/extractors/include-extractor.js +7 -7
  37. package/dist/core/ingestion/cfg/cfg-builder.d.ts +64 -0
  38. package/dist/core/ingestion/cfg/cfg-builder.js +129 -0
  39. package/dist/core/ingestion/cfg/collect.d.ts +30 -0
  40. package/dist/core/ingestion/cfg/collect.js +34 -0
  41. package/dist/core/ingestion/cfg/control-flow-context.d.ts +97 -0
  42. package/dist/core/ingestion/cfg/control-flow-context.js +113 -0
  43. package/dist/core/ingestion/cfg/emit.d.ts +144 -0
  44. package/dist/core/ingestion/cfg/emit.js +315 -0
  45. package/dist/core/ingestion/cfg/reaching-defs.d.ts +90 -0
  46. package/dist/core/ingestion/cfg/reaching-defs.js +364 -0
  47. package/dist/core/ingestion/cfg/traversal-result.d.ts +20 -0
  48. package/dist/core/ingestion/cfg/traversal-result.js +2 -0
  49. package/dist/core/ingestion/cfg/types.d.ts +231 -0
  50. package/dist/core/ingestion/cfg/types.js +13 -0
  51. package/dist/core/ingestion/cfg/visitors/typescript-harvest.d.ts +144 -0
  52. package/dist/core/ingestion/cfg/visitors/typescript-harvest.js +1032 -0
  53. package/dist/core/ingestion/cfg/visitors/typescript.d.ts +66 -0
  54. package/dist/core/ingestion/cfg/visitors/typescript.js +584 -0
  55. package/dist/core/ingestion/language-provider.d.ts +36 -2
  56. package/dist/core/ingestion/languages/c-cpp.js +11 -4
  57. package/dist/core/ingestion/languages/cpp/arity-metadata.js +6 -2
  58. package/dist/core/ingestion/languages/cpp/captures.js +24 -1
  59. package/dist/core/ingestion/languages/cpp/query.js +23 -0
  60. package/dist/core/ingestion/languages/java.js +3 -0
  61. package/dist/core/ingestion/languages/kotlin/query.js +3 -2
  62. package/dist/core/ingestion/languages/kotlin.js +5 -1
  63. package/dist/core/ingestion/languages/typescript.js +5 -0
  64. package/dist/core/ingestion/method-extractors/configs/c-cpp.js +6 -13
  65. package/dist/core/ingestion/method-extractors/generic.js +1 -0
  66. package/dist/core/ingestion/method-types.d.ts +2 -0
  67. package/dist/core/ingestion/model/symbol-table.d.ts +1 -0
  68. package/dist/core/ingestion/model/symbol-table.js +1 -0
  69. package/dist/core/ingestion/parsing-processor.js +22 -0
  70. package/dist/core/ingestion/pipeline-phases/parse-impl.js +18 -1
  71. package/dist/core/ingestion/pipeline-phases/routes.js +64 -14
  72. package/dist/core/ingestion/pipeline.d.ts +57 -0
  73. package/dist/core/ingestion/route-extractors/spring-shared.d.ts +50 -0
  74. package/dist/core/ingestion/route-extractors/spring-shared.js +80 -0
  75. package/dist/core/ingestion/route-extractors/spring.d.ts +35 -0
  76. package/dist/core/ingestion/route-extractors/spring.js +136 -0
  77. package/dist/core/ingestion/scope-extractor.js +3 -0
  78. package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +12 -0
  79. package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +145 -24
  80. package/dist/core/ingestion/scope-resolution/pipeline/phase.js +6 -0
  81. package/dist/core/ingestion/scope-resolution/pipeline/reconcile-ownership.js +43 -3
  82. package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +21 -0
  83. package/dist/core/ingestion/scope-resolution/pipeline/run.js +207 -0
  84. package/dist/core/ingestion/scope-resolution/resolution-outcome.d.ts +1 -1
  85. package/dist/core/ingestion/taint/emit.d.ts +124 -0
  86. package/dist/core/ingestion/taint/emit.js +204 -0
  87. package/dist/core/ingestion/taint/match.d.ts +153 -0
  88. package/dist/core/ingestion/taint/match.js +278 -0
  89. package/dist/core/ingestion/taint/path-codec.d.ts +134 -0
  90. package/dist/core/ingestion/taint/path-codec.js +190 -0
  91. package/dist/core/ingestion/taint/propagate.d.ts +216 -0
  92. package/dist/core/ingestion/taint/propagate.js +664 -0
  93. package/dist/core/ingestion/taint/site-safety.d.ts +29 -0
  94. package/dist/core/ingestion/taint/site-safety.js +98 -0
  95. package/dist/core/ingestion/taint/source-sink-config.d.ts +94 -23
  96. package/dist/core/ingestion/taint/source-sink-config.js +11 -11
  97. package/dist/core/ingestion/taint/source-sink-registry.d.ts +6 -4
  98. package/dist/core/ingestion/taint/source-sink-registry.js +6 -4
  99. package/dist/core/ingestion/taint/typescript-model.d.ts +38 -0
  100. package/dist/core/ingestion/taint/typescript-model.js +102 -0
  101. package/dist/core/ingestion/utils/method-props.js +1 -0
  102. package/dist/core/ingestion/workers/clone-safety.d.ts +109 -0
  103. package/dist/core/ingestion/workers/clone-safety.js +465 -0
  104. package/dist/core/ingestion/workers/parse-worker.d.ts +11 -0
  105. package/dist/core/ingestion/workers/parse-worker.js +70 -53
  106. package/dist/core/ingestion/workers/post-result.d.ts +22 -0
  107. package/dist/core/ingestion/workers/post-result.js +87 -0
  108. package/dist/core/ingestion/workers/result-merge.d.ts +20 -0
  109. package/dist/core/ingestion/workers/result-merge.js +43 -0
  110. package/dist/core/ingestion/workers/worker-pool.d.ts +15 -0
  111. package/dist/core/ingestion/workers/worker-pool.js +33 -16
  112. package/dist/core/lbug/lbug-adapter.d.ts +19 -0
  113. package/dist/core/lbug/lbug-adapter.js +56 -1
  114. package/dist/core/run-analyze.d.ts +87 -0
  115. package/dist/core/run-analyze.js +280 -25
  116. package/dist/core/tree-sitter/parser-loader.js +5 -4
  117. package/dist/core/tree-sitter/vendored-grammars.d.ts +39 -0
  118. package/dist/core/tree-sitter/vendored-grammars.js +57 -0
  119. package/dist/mcp/core/embedder.js +4 -0
  120. package/dist/mcp/local/local-backend.d.ts +86 -2
  121. package/dist/mcp/local/local-backend.js +657 -27
  122. package/dist/mcp/resources.js +1 -0
  123. package/dist/mcp/tools.d.ts +9 -0
  124. package/dist/mcp/tools.js +109 -0
  125. package/dist/server/analyze-launch.d.ts +29 -0
  126. package/dist/server/analyze-launch.js +137 -0
  127. package/dist/server/analyze-upload.d.ts +33 -0
  128. package/dist/server/analyze-upload.js +123 -0
  129. package/dist/server/analyze-worker-ipc.d.ts +58 -0
  130. package/dist/server/analyze-worker-ipc.js +16 -0
  131. package/dist/server/analyze-worker.d.ts +17 -1
  132. package/dist/server/analyze-worker.js +7 -1
  133. package/dist/server/api.js +46 -140
  134. package/dist/server/git-clone.d.ts +1 -0
  135. package/dist/server/git-clone.js +1 -1
  136. package/dist/server/middleware.d.ts +11 -0
  137. package/dist/server/middleware.js +27 -0
  138. package/dist/server/upload-ingest.d.ts +56 -0
  139. package/dist/server/upload-ingest.js +276 -0
  140. package/dist/server/upload-paths.d.ts +31 -0
  141. package/dist/server/upload-paths.js +51 -0
  142. package/dist/server/upload-sweep.d.ts +20 -0
  143. package/dist/server/upload-sweep.js +57 -0
  144. package/dist/storage/branch-index.d.ts +52 -0
  145. package/dist/storage/branch-index.js +65 -0
  146. package/dist/storage/git.d.ts +11 -0
  147. package/dist/storage/git.js +28 -0
  148. package/dist/storage/parse-cache.d.ts +22 -1
  149. package/dist/storage/parse-cache.js +32 -10
  150. package/dist/storage/repo-manager.d.ts +122 -10
  151. package/dist/storage/repo-manager.js +162 -21
  152. package/hooks/antigravity/gitnexus-antigravity-hook.cjs +42 -8
  153. package/hooks/claude/gitnexus-hook.cjs +36 -8
  154. package/hooks/claude/hook-db-lock-probe.cjs +123 -2
  155. package/package.json +4 -2
  156. package/scripts/assert-publish-grammar-coverage.cjs +31 -0
  157. package/scripts/build-tree-sitter-grammars.cjs +16 -10
  158. package/skills/gitnexus-guide.md +11 -0
  159. package/vendor/tree-sitter-c/package.json +1 -1
  160. package/vendor/tree-sitter-dart/package.json +1 -1
  161. package/vendor/tree-sitter-kotlin/package.json +1 -1
  162. package/vendor/tree-sitter-proto/package.json +1 -1
  163. package/vendor/tree-sitter-swift/package.json +1 -1
  164. package/web/assets/{agent-CKPMqImC.js → agent-ay4LD70X.js} +1 -1
  165. package/web/assets/{architectureDiagram-UL44E2DR-D1EXI0zA.js → architectureDiagram-UL44E2DR-Dc-viYhd.js} +1 -1
  166. package/web/assets/{chunk-LCXTWHL2-Dfmux4m1.js → chunk-LCXTWHL2-4rpojOyj.js} +1 -1
  167. package/web/assets/{chunk-RG4AUYOV-CAkzcoRj.js → chunk-RG4AUYOV-BnOy944n.js} +1 -1
  168. package/web/assets/{classDiagram-KGZ6W3CR-Bv93af_b.js → classDiagram-KGZ6W3CR-Bsgpy98Q.js} +1 -1
  169. package/web/assets/{classDiagram-v2-72OJOZXJ-CLfEqHUa.js → classDiagram-v2-72OJOZXJ-D5atDGjc.js} +1 -1
  170. package/web/assets/{diagram-3NCE3AQN-BqAtKUpW.js → diagram-3NCE3AQN-Cz1OEMVi.js} +1 -1
  171. package/web/assets/{diagram-GF46GFSD-CaBG6n6o.js → diagram-GF46GFSD-CWYwzfP8.js} +1 -1
  172. package/web/assets/{diagram-QXG6HAR7-CZ-O3rcV.js → diagram-QXG6HAR7-DtBObr8L.js} +1 -1
  173. package/web/assets/{diagram-WEQXMOUZ-P4lSL4GH.js → diagram-WEQXMOUZ-BUV44Ov_.js} +1 -1
  174. package/web/assets/{erDiagram-L5TCEMPS-QN2eEP1e.js → erDiagram-L5TCEMPS-Ds9s-sRF.js} +1 -1
  175. package/web/assets/{flowDiagram-H6V6AXG4-CXbXImlN.js → flowDiagram-H6V6AXG4-CupStHQb.js} +1 -1
  176. package/web/assets/index-COMMmbxW.css +2 -0
  177. package/web/assets/{index-CG6q8eTs.js → index-Do8AE5yF.js} +85 -85
  178. package/web/assets/{infoDiagram-3YFTVSEB-DmLICZx1.js → infoDiagram-3YFTVSEB-DPTXSbgu.js} +1 -1
  179. package/web/assets/{ishikawaDiagram-BNXS4ZKH-6LKOvBfp.js → ishikawaDiagram-BNXS4ZKH-CeK-Qhet.js} +1 -1
  180. package/web/assets/{kanban-definition-75IXJCU3-DgDi9oJT.js → kanban-definition-75IXJCU3-D4tx6QQ-.js} +1 -1
  181. package/web/assets/{mindmap-definition-2TDM6QVE-CwR5sBB-.js → mindmap-definition-2TDM6QVE-Bcto_kGa.js} +1 -1
  182. package/web/assets/{pieDiagram-CU6KROY3-By8g6f6B.js → pieDiagram-CU6KROY3-DPIeBTG6.js} +1 -1
  183. package/web/assets/{requirementDiagram-JXO7QTGE-7oDcJ1_J.js → requirementDiagram-JXO7QTGE-DDGXjVKO.js} +1 -1
  184. package/web/assets/{sequenceDiagram-VS2MUI6T-FySeKCUy.js → sequenceDiagram-VS2MUI6T-BzDqpcVW.js} +1 -1
  185. package/web/assets/{stateDiagram-7D4R322I-CB2nABwH.js → stateDiagram-7D4R322I-Bx__als3.js} +1 -1
  186. package/web/assets/{stateDiagram-v2-36443NZ5-COBGd2RL.js → stateDiagram-v2-36443NZ5-QqOh2yO-.js} +1 -1
  187. package/web/assets/{timeline-definition-O6YCAMPW-Ds2CnVZK.js → timeline-definition-O6YCAMPW-C1eogTOG.js} +1 -1
  188. package/web/assets/{vennDiagram-MWXL3ELB-DUIEwXWp.js → vennDiagram-MWXL3ELB-D20F4rSW.js} +1 -1
  189. package/web/assets/{wardleyDiagram-CUQ6CDDI-DEiFPQih.js → wardleyDiagram-CUQ6CDDI-BeBHg7ST.js} +1 -1
  190. package/web/assets/{xychartDiagram-N2JHSOCM-BUbayhST.js → xychartDiagram-N2JHSOCM-CdOWeoNI.js} +1 -1
  191. package/web/index.html +2 -2
  192. package/scripts/materialize-vendor-grammars.cjs +0 -97
  193. package/web/assets/index-BKWA-m7o.css +0 -2
@@ -0,0 +1,57 @@
1
+ import { createRequire } from 'node:module';
2
+ import { fileURLToPath } from 'node:url';
3
+ import path from 'node:path';
4
+ const _require = createRequire(import.meta.url);
5
+ /**
6
+ * Absolute path to the vendored grammar tree (`<pkg>/vendor`).
7
+ *
8
+ * This module compiles to `<pkg>/dist/core/tree-sitter/vendored-grammars.js`
9
+ * and runs from `<pkg>/src/core/tree-sitter/...` under tsx in dev — both sit
10
+ * three directories below the package root, and the build (`tsc`) never bundles,
11
+ * so `import.meta.url` resolves the same way in both. `vendor/` ships in the
12
+ * published package via package.json `files`.
13
+ */
14
+ export const VENDOR_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..', 'vendor');
15
+ /**
16
+ * The tree-sitter grammars GitNexus vendors inside its own package (NOT npm
17
+ * dependencies). Kept in one place so consumers (runtime loaders, the CLI
18
+ * availability probe, and the test grammar-introspection helper) agree on which
19
+ * grammars resolve from `vendor/` rather than `node_modules`.
20
+ */
21
+ export const VENDORED_GRAMMAR_PACKAGES = new Set([
22
+ 'tree-sitter-c',
23
+ 'tree-sitter-dart',
24
+ 'tree-sitter-proto',
25
+ 'tree-sitter-swift',
26
+ 'tree-sitter-kotlin',
27
+ ]);
28
+ /** Absolute directory of a vendored grammar package under `vendor/`. */
29
+ export const vendoredGrammarDir = (packageName) => path.join(VENDOR_ROOT, packageName);
30
+ /**
31
+ * Load a vendored tree-sitter grammar by its absolute path under `vendor/`.
32
+ *
33
+ * GitNexus vendors five grammars (c/dart/proto/swift/kotlin) inside its own
34
+ * package under `vendor/`, each shipping committed per-platform prebuilds. They
35
+ * are deliberately NOT npm dependencies and must NEVER be copied into
36
+ * `node_modules`: an undeclared package under `node_modules` is "extraneous" to
37
+ * every subsequent `npm`/`npx` arborist reify, which prunes or relocates it.
38
+ * That is the root cause of #2111 / #1728 — on Windows the relocation throws
39
+ * `EPERM: operation not permitted, symlink` (errno -4048) during the npx-cache
40
+ * reify Antigravity triggers when it launches the MCP server, and on every OS
41
+ * the second run silently deletes the materialized grammars.
42
+ *
43
+ * Resolving the grammar by absolute path runs its own `bindings/node` entry,
44
+ * which calls `node-gyp-build(<grammarDir>)` and loads
45
+ * `vendor/<name>/prebuilds/<platform>-<arch>/…` directly — no build, no write,
46
+ * no `node_modules` copy. (`node-gyp-build` itself IS an npm dependency and
47
+ * resolves normally from the grammar directory.)
48
+ */
49
+ export const requireVendoredGrammar = (packageName) => {
50
+ // Fail loudly on a name that isn't actually vendored — a typo or a list that
51
+ // drifted out of sync (VENDORED_GRAMMAR_PACKAGES vs the CLI probe vs the build
52
+ // registry) would otherwise surface as a confusing absolute-path require miss.
53
+ if (!VENDORED_GRAMMAR_PACKAGES.has(packageName)) {
54
+ throw new Error(`'${packageName}' is not a vendored grammar (expected one of: ${[...VENDORED_GRAMMAR_PACKAGES].join(', ')}).`);
55
+ }
56
+ return _require(vendoredGrammarDir(packageName));
57
+ };
@@ -8,6 +8,7 @@ import { isHttpMode, getHttpDimensions, httpEmbedQuery, } from '../../core/embed
8
8
  import { resolveEmbeddingConfig } from '../../core/embeddings/config.js';
9
9
  import { applyHfEnvOverrides, isHfDownloadFailure, withHfDownloadRetry, } from '../../core/embeddings/hf-env.js';
10
10
  import { getLocalEmbeddingRuntimeBlocker } from '../../core/embeddings/runtime-support.js';
11
+ import { ensureOnnxRuntimeCommonResolvable } from '../../core/embeddings/onnxruntime-common-resolver.js';
11
12
  import { silenceStdout, restoreStdout, realStderrWrite } from '../../core/lbug/pool-adapter.js';
12
13
  import { logger } from '../../core/logger.js';
13
14
  // Model config
@@ -43,6 +44,9 @@ export const initEmbedder = async () => {
43
44
  try {
44
45
  // Lazy-load transformers.js only after the runtime guard has passed, so
45
46
  // unsupported platforms never reach the native ONNX import (#1515).
47
+ // Under pnpm-strict / `pnpm dlx`, transformers' phantom `onnxruntime-common`
48
+ // import is unresolvable; register the fallback resolver first (#307).
49
+ ensureOnnxRuntimeCommonResolvable();
46
50
  const { pipeline, env } = await import('@huggingface/transformers');
47
51
  env.allowLocalModels = false;
48
52
  // Bridge user-controlled env vars to transformers.js: HF_HOME →
@@ -5,7 +5,7 @@
5
5
  * Supports multiple indexed repositories via a global registry.
6
6
  * LadybugDB connections are opened lazily per repo on first query.
7
7
  */
8
- import { type RegistryEntry } from '../../storage/repo-manager.js';
8
+ import { type RegistryEntry, type BranchSummary } from '../../storage/repo-manager.js';
9
9
  import { GroupService } from '../../core/group/service.js';
10
10
  /**
11
11
  * Quick test-file detection for filtering impact results.
@@ -16,6 +16,15 @@ export declare function isTestFilePath(filePath: string): boolean;
16
16
  export declare const VALID_NODE_LABELS: Set<string>;
17
17
  /** Valid relation types for impact analysis filtering */
18
18
  export declare const VALID_RELATION_TYPES: Set<string>;
19
+ /**
20
+ * Relation types the #1858 epistemic-boundary probe keys on. Kept as
21
+ * module-level `readonly` arrays (not Sets) because computeEpistemicBoundary
22
+ * binds them as Cypher query params (`r.type IN $heritage` / `IN $types`).
23
+ * The heritage set is exactly the IMPACT_RELATION_CONFIDENCE 0.85 tier —
24
+ * "statically verifiable, but the concrete binding past it is not".
25
+ */
26
+ export declare const EPISTEMIC_HERITAGE_RELATION_TYPES: readonly string[];
27
+ export declare const EPISTEMIC_CONSUMER_RELATION_TYPES: readonly string[];
19
28
  /**
20
29
  * Per-relation-type confidence floor for impact analysis.
21
30
  *
@@ -56,6 +65,10 @@ interface RepoHandle {
56
65
  lastCommit: string;
57
66
  remoteUrl?: string;
58
67
  stats?: RegistryEntry['stats'];
68
+ /** Primary/flat branch name, when known (#2106). */
69
+ branch?: string;
70
+ /** Non-primary branch indexes available for this repo (#2106). */
71
+ branches?: BranchSummary[];
59
72
  }
60
73
  /**
61
74
  * Resolve the git diff cwd for detect_changes, auto-detecting linked worktrees.
@@ -107,6 +120,10 @@ export interface RepoListing {
107
120
  path: string;
108
121
  lastCommit: string;
109
122
  }>;
123
+ /** Primary/flat branch name, when known (#2106). */
124
+ branch?: string;
125
+ /** Non-primary branch indexes available for this repo (#2106). */
126
+ branches?: Array<Omit<BranchSummary, 'stats'>>;
110
127
  }
111
128
  /** Continuation metadata for the paginated `list_repos` MCP tool (#2119). */
112
129
  export interface ListReposPagination {
@@ -153,6 +170,7 @@ export declare class LocalBackend {
153
170
  private initializedRepos;
154
171
  private reinitPromises;
155
172
  private lastStalenessCheck;
173
+ private lastObservedIndexedAt;
156
174
  private groupToolSvc;
157
175
  /**
158
176
  * One-shot stderr warnings for sibling-clone drift, keyed by
@@ -214,7 +232,20 @@ export declare class LocalBackend {
214
232
  * On a miss, re-reads the registry once in case a new repo was indexed
215
233
  * while the MCP server was running.
216
234
  */
217
- resolveRepo(repoParam?: string): Promise<RepoHandle>;
235
+ resolveRepo(repoParam?: string, branch?: string): Promise<RepoHandle>;
236
+ /**
237
+ * Re-point a resolved repo handle at a specific branch index (#2106).
238
+ *
239
+ * - No `branch` (default) → the primary/flat handle, unchanged (backward
240
+ * compatible: every existing caller passes no branch).
241
+ * - `branch` equal to the known primary → the flat handle.
242
+ * - `branch` matching an indexed non-primary branch → a handle whose
243
+ * `lbugPath` points at `branches/<slug>/lbug`; the connection pool keys by
244
+ * `lbugPath`, so this is the only change needed to scope every tool.
245
+ * - `branch` that was never indexed → a clear error (never a silently-empty
246
+ * result against the wrong DB).
247
+ */
248
+ private applyBranchScope;
218
249
  /**
219
250
  * Try to resolve a repo from the in-memory cache. Returns null on miss.
220
251
  * Throws {@link RegistryAmbiguousTargetError} when `repoParam` matches
@@ -306,6 +337,8 @@ export declare class LocalBackend {
306
337
  */
307
338
  private maybeWarnSiblingDrift;
308
339
  callTool(method: string, params: any): Promise<any>;
340
+ /** Check repository graph invariants that are suitable for CI gating. */
341
+ private check;
309
342
  /**
310
343
  * Query tool — process-grouped search.
311
344
  *
@@ -391,6 +424,35 @@ export declare class LocalBackend {
391
424
  */
392
425
  private context;
393
426
  private _contextImpl;
427
+ /**
428
+ * Explain tool (#2083 M3 U6) — persisted taint-finding explanation.
429
+ * WAL-aware wrapper mirroring `context`.
430
+ */
431
+ private explain;
432
+ /**
433
+ * Taint findings are persisted as `TAINTED` rows in CodeRelation whose
434
+ * endpoints are BOTH BasicBlock nodes — the label anchor restricts every
435
+ * query here to the BasicBlock→BasicBlock partition of the rel table
436
+ * (which holds only the sparse, per-function-capped pdg layers), never a
437
+ * global symbol-space scan (the S1 verdict; LadybugDB has no rel-property
438
+ * index, so the label anchor IS the bound).
439
+ *
440
+ * Anchoring granularity:
441
+ * - file target → BasicBlock id prefix (`BasicBlock:<filePath>:` — the
442
+ * shared `basicBlockId` template) with an exact-or-suffix path match so
443
+ * `vuln.ts` finds `src/vuln.ts`.
444
+ * - symbol target → resolved via `resolveSymbolCandidates` (the context()
445
+ * path: ambiguous ⇒ ranked candidates, unknown ⇒ not-found), then the
446
+ * file id-prefix PLUS source-block startLine within the symbol's
447
+ * [startLine, endLine] span. Findings are intra-procedural, so filtering
448
+ * the SOURCE endpoint is sufficient — both endpoints share the function.
449
+ * Symbols without a line span degrade to the file-level filter.
450
+ *
451
+ * The per-finding `sinkKind` and hop path decode from the persisted
452
+ * `reason` via the SHARED `taint/path-codec.ts` (the U4 write path encodes
453
+ * with the same module — `;<kind>` header + ordered `variable:line` hops).
454
+ */
455
+ private _explainImpl;
394
456
  /**
395
457
  * Legacy explore — kept for backwards compatibility with resources.ts.
396
458
  * Routes cluster/process types to direct graph queries.
@@ -409,6 +471,28 @@ export declare class LocalBackend {
409
471
  private rename;
410
472
  private impact;
411
473
  private _impactImpl;
474
+ /**
475
+ * #1858 — epistemic lower-bound detection.
476
+ *
477
+ * impact()/context() traverse only edges materialized in the graph. When the
478
+ * queried symbol sits on an interface / abstract boundary, callers that bind
479
+ * to the interface via DI, a container, or dynamic dispatch — rather than
480
+ * naming the concrete symbol — are not traced. The reported count is then a
481
+ * lower bound, not an exact figure. Instead of returning a confident count
482
+ * that silently omits those callers, annotate the result with
483
+ * `epistemic: 'lower-bound'` plus a human-readable boundary note. A fully
484
+ * resolved leaf with no indirection stays `epistemic: 'exact'`.
485
+ *
486
+ * Aligns with the numeric confidence model rather than the long-deleted
487
+ * TIER_CONFIDENCE enum: the heritage/indirection edges this keys on
488
+ * (IMPLEMENTS / METHOD_IMPLEMENTS / EXTENDS) carry the 0.85
489
+ * `IMPACT_RELATION_CONFIDENCE` floor — "statically verifiable, but the
490
+ * concrete binding past it is not".
491
+ *
492
+ * Never throws: on query error it returns 'exact', so it can only add signal,
493
+ * never suppress a result.
494
+ */
495
+ private computeEpistemicBoundary;
412
496
  /**
413
497
  * Shared BFS traversal for impact analysis (name-resolved or UID-resolved symbol).
414
498
  */