gitnexus 1.6.3-rc.44 → 1.6.3-rc.45

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.
@@ -123,9 +123,17 @@ export declare const deleteNodesForFile: (filePath: string, dbPath?: string) =>
123
123
  export declare const getEmbeddingTableName: () => string;
124
124
  /**
125
125
  * Load the FTS extension (required before using FTS functions).
126
- * Safe to call multiple times — tracks loaded state via module-level ftsLoaded.
126
+ *
127
+ * Safe to call multiple times — when invoked without arguments, tracks loaded
128
+ * state via module-level `ftsLoaded`. When invoked with an explicit
129
+ * connection, loads on that connection and returns whether the load
130
+ * succeeded — letting callers (e.g. the pool adapter) track their own state.
131
+ *
132
+ * Tries `LOAD EXTENSION fts` first so previously-cached installs skip the
133
+ * network entirely; falls back to `INSTALL` + `LOAD` only when the extension
134
+ * hasn't been cached yet.
127
135
  */
128
- export declare const loadFTSExtension: () => Promise<void>;
136
+ export declare const loadFTSExtension: (targetConn?: lbug.Connection) => Promise<boolean>;
129
137
  /**
130
138
  * Load the VECTOR extension (required before using QUERY_VECTOR_INDEX).
131
139
  * Safe to call multiple times -- tracks loaded state via module-level vectorExtensionLoaded.
@@ -1026,36 +1026,50 @@ export const getEmbeddingTableName = () => EMBEDDING_TABLE_NAME;
1026
1026
  // ============================================================================
1027
1027
  /**
1028
1028
  * Load the FTS extension (required before using FTS functions).
1029
- * Safe to call multiple times — tracks loaded state via module-level ftsLoaded.
1029
+ *
1030
+ * Safe to call multiple times — when invoked without arguments, tracks loaded
1031
+ * state via module-level `ftsLoaded`. When invoked with an explicit
1032
+ * connection, loads on that connection and returns whether the load
1033
+ * succeeded — letting callers (e.g. the pool adapter) track their own state.
1034
+ *
1035
+ * Tries `LOAD EXTENSION fts` first so previously-cached installs skip the
1036
+ * network entirely; falls back to `INSTALL` + `LOAD` only when the extension
1037
+ * hasn't been cached yet.
1030
1038
  */
1031
- export const loadFTSExtension = async () => {
1032
- if (ftsLoaded)
1033
- return;
1034
- if (!conn) {
1039
+ export const loadFTSExtension = async (targetConn) => {
1040
+ const useModuleState = targetConn === undefined;
1041
+ if (useModuleState && ftsLoaded)
1042
+ return true;
1043
+ const c = targetConn ?? conn;
1044
+ if (!c) {
1035
1045
  throw new Error('LadybugDB not initialized. Call initLbug first.');
1036
1046
  }
1047
+ const markLoaded = () => {
1048
+ if (useModuleState)
1049
+ ftsLoaded = true;
1050
+ return true;
1051
+ };
1037
1052
  try {
1038
1053
  // Try loading locally first (no network required)
1039
- await conn.query('LOAD EXTENSION fts');
1040
- ftsLoaded = true;
1054
+ await c.query('LOAD EXTENSION fts');
1055
+ return markLoaded();
1041
1056
  }
1042
1057
  catch {
1043
1058
  // Fall back to install + load (requires network)
1044
1059
  try {
1045
- await conn.query('INSTALL fts');
1046
- await conn.query('LOAD EXTENSION fts');
1047
- ftsLoaded = true;
1060
+ await c.query('INSTALL fts');
1061
+ await c.query('LOAD EXTENSION fts');
1062
+ return markLoaded();
1048
1063
  }
1049
1064
  catch (err) {
1050
1065
  const msg = err?.message || '';
1051
1066
  if (msg.includes('already loaded') ||
1052
1067
  msg.includes('already installed') ||
1053
1068
  msg.includes('already exists')) {
1054
- ftsLoaded = true;
1055
- }
1056
- else {
1057
- console.error('GitNexus: FTS extension load failed:', msg);
1069
+ return markLoaded();
1058
1070
  }
1071
+ console.error('GitNexus: FTS extension load failed:', msg);
1072
+ return false;
1059
1073
  }
1060
1074
  }
1061
1075
  };
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import fs from 'fs/promises';
18
18
  import lbug from '@ladybugdb/core';
19
+ import { loadFTSExtension } from './lbug-adapter.js';
19
20
  const pool = new Map();
20
21
  const poolCloseListeners = new Set();
21
22
  /**
@@ -284,13 +285,7 @@ async function doInitLbug(repoId, dbPath) {
284
285
  // Done BEFORE pool registration so no concurrent checkout can grab
285
286
  // the connection while the async FTS load is in progress.
286
287
  if (!shared.ftsLoaded) {
287
- try {
288
- await available[0].query('LOAD EXTENSION fts');
289
- shared.ftsLoaded = true;
290
- }
291
- catch {
292
- // Extension may not be installed — FTS queries will fail gracefully
293
- }
288
+ shared.ftsLoaded = await loadFTSExtension(available[0]);
294
289
  }
295
290
  // Load VECTOR extension once per shared Database for semantic search support.
296
291
  if (!shared.vectorLoaded) {
@@ -356,13 +351,7 @@ export async function initLbugWithDb(repoId, existingDb, dbPath) {
356
351
  }
357
352
  // Load FTS extension if not already loaded on this Database
358
353
  if (!shared.ftsLoaded) {
359
- try {
360
- await available[0].query('LOAD EXTENSION fts');
361
- shared.ftsLoaded = true;
362
- }
363
- catch {
364
- // Extension may already be loaded or not installed
365
- }
354
+ shared.ftsLoaded = await loadFTSExtension(available[0]);
366
355
  }
367
356
  // Load VECTOR extension for semantic search support
368
357
  if (!shared.vectorLoaded) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.3-rc.44",
3
+ "version": "1.6.3-rc.45",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",