gitnexus 1.6.4-rc.23 → 1.6.4-rc.25
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.
|
@@ -73,6 +73,13 @@ export declare class LocalBackend {
|
|
|
73
73
|
* making MCP stderr unreadable.
|
|
74
74
|
*/
|
|
75
75
|
private warnedSiblingDrift;
|
|
76
|
+
/**
|
|
77
|
+
* One-shot stderr warning for the VECTOR-extension fallback. Without this
|
|
78
|
+
* guard the diagnostic would fire on every `semanticSearch()` call on
|
|
79
|
+
* platforms where the extension is unsupported (e.g. Windows), making MCP
|
|
80
|
+
* stderr noisy per DoD §2.8.
|
|
81
|
+
*/
|
|
82
|
+
private warnedVectorUnsupported;
|
|
76
83
|
/**
|
|
77
84
|
* Cross-repo group tools (CLI). Shares logic with MCP `group_*` handlers.
|
|
78
85
|
*/
|
|
@@ -20,7 +20,7 @@ import { resolveAtGroupMemberRepoPath } from '../../core/group/resolve-at-member
|
|
|
20
20
|
import { collectBestChunks } from '../../core/embeddings/types.js';
|
|
21
21
|
import { rankExactEmbeddingRows, } from '../../core/embeddings/exact-search.js';
|
|
22
22
|
import { EMBEDDING_TABLE_NAME, EMBEDDING_INDEX_NAME } from '../../core/lbug/schema.js';
|
|
23
|
-
import { getExactScanLimit } from '../../core/platform/capabilities.js';
|
|
23
|
+
import { getExactScanLimit, isVectorExtensionSupportedByPlatform, } from '../../core/platform/capabilities.js';
|
|
24
24
|
import { PhaseTimer } from '../../core/search/phase-timer.js';
|
|
25
25
|
import { checkStaleness, checkCwdMatch } from '../../core/git-staleness.js';
|
|
26
26
|
// AI context generation is CLI-only (gitnexus analyze)
|
|
@@ -172,6 +172,13 @@ export class LocalBackend {
|
|
|
172
172
|
* making MCP stderr unreadable.
|
|
173
173
|
*/
|
|
174
174
|
warnedSiblingDrift = new Set();
|
|
175
|
+
/**
|
|
176
|
+
* One-shot stderr warning for the VECTOR-extension fallback. Without this
|
|
177
|
+
* guard the diagnostic would fire on every `semanticSearch()` call on
|
|
178
|
+
* platforms where the extension is unsupported (e.g. Windows), making MCP
|
|
179
|
+
* stderr noisy per DoD §2.8.
|
|
180
|
+
*/
|
|
181
|
+
warnedVectorUnsupported = false;
|
|
175
182
|
/**
|
|
176
183
|
* Cross-repo group tools (CLI). Shares logic with MCP `group_*` handlers.
|
|
177
184
|
*/
|
|
@@ -892,9 +899,10 @@ export class LocalBackend {
|
|
|
892
899
|
const dims = getEmbeddingDims();
|
|
893
900
|
const queryVecStr = `[${queryVec.join(',')}]`;
|
|
894
901
|
let bestChunks = new Map();
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
902
|
+
if (isVectorExtensionSupportedByPlatform()) {
|
|
903
|
+
try {
|
|
904
|
+
bestChunks = await collectBestChunks(limit, async (fetchLimit) => {
|
|
905
|
+
const vectorQuery = `
|
|
898
906
|
CALL QUERY_VECTOR_INDEX('${EMBEDDING_TABLE_NAME}', '${EMBEDDING_INDEX_NAME}',
|
|
899
907
|
CAST(${queryVecStr} AS FLOAT[${dims}]), ${fetchLimit})
|
|
900
908
|
YIELD node AS emb, distance
|
|
@@ -904,18 +912,28 @@ export class LocalBackend {
|
|
|
904
912
|
emb.startLine AS startLine, emb.endLine AS endLine, distance
|
|
905
913
|
ORDER BY distance
|
|
906
914
|
`;
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
915
|
+
const embResults = await executeQuery(repo.id, vectorQuery);
|
|
916
|
+
return embResults.map((row) => ({
|
|
917
|
+
nodeId: row.nodeId ?? row[0],
|
|
918
|
+
chunkIndex: row.chunkIndex ?? row[1] ?? 0,
|
|
919
|
+
startLine: row.startLine ?? row[2] ?? 0,
|
|
920
|
+
endLine: row.endLine ?? row[3] ?? 0,
|
|
921
|
+
distance: row.distance ?? row[4],
|
|
922
|
+
}));
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
catch {
|
|
926
|
+
bestChunks = new Map();
|
|
927
|
+
}
|
|
916
928
|
}
|
|
917
|
-
|
|
918
|
-
|
|
929
|
+
else if (!this.warnedVectorUnsupported) {
|
|
930
|
+
// Rare diagnostic: surface why we fell back to the exact scan path so
|
|
931
|
+
// operators can see at a glance that the VECTOR extension is missing on
|
|
932
|
+
// this runtime (e.g. Windows builds without the optional native
|
|
933
|
+
// dependency). Emitted once per `LocalBackend` instance lifetime to
|
|
934
|
+
// avoid noisy stderr on hot semantic-search paths (DoD §2.8).
|
|
935
|
+
this.warnedVectorUnsupported = true;
|
|
936
|
+
console.error('GitNexus [query:vector]: VECTOR index unavailable for this runtime; using exact scan fallback');
|
|
919
937
|
}
|
|
920
938
|
if (bestChunks.size === 0) {
|
|
921
939
|
const embeddingCount = Number(tableCheck[0].cnt ?? tableCheck[0][0] ?? 0);
|
package/package.json
CHANGED