@neuralsea/workspace-indexer 0.3.6 → 0.4.0

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/index.d.cts CHANGED
@@ -61,6 +61,28 @@ interface SymbolGraphProvider {
61
61
  }): Promise<GraphEdge[]>;
62
62
  }
63
63
 
64
+ type WorkspaceDbCapabilities = {
65
+ /** Whether this SQLite build supports `CREATE VIRTUAL TABLE ... USING fts5(...)`. */
66
+ supportsFts5: boolean;
67
+ };
68
+ interface WorkspaceDbStatement {
69
+ run(...args: any[]): any;
70
+ get(...args: any[]): any;
71
+ all(...args: any[]): any;
72
+ }
73
+ interface WorkspaceDbAdapter {
74
+ readonly capabilities: WorkspaceDbCapabilities;
75
+ pragma(sql: string): void;
76
+ exec(sql: string): void;
77
+ prepare(sql: string): WorkspaceDbStatement;
78
+ transaction<T>(fn: () => T): () => T;
79
+ close(): void;
80
+ }
81
+ type WorkspaceDbFactory = {
82
+ open(dbPath: string): WorkspaceDbAdapter;
83
+ };
84
+ declare const betterSqlite3Adapter: WorkspaceDbFactory;
85
+
64
86
  type AnnMetric = "cosine" | "ip" | "l2";
65
87
  type AnnPoint = {
66
88
  id: string;
@@ -406,6 +428,11 @@ interface IndexerConfig extends ProfilesConfig {
406
428
  ann?: AnnConfig;
407
429
  /** Workspace-only settings (used by WorkspaceIndexer). */
408
430
  workspace?: {
431
+ /**
432
+ * Optional DB adapter factory used for the workspace store.
433
+ * Default: `sqlJsAdapter()` (falls back to `betterSqlite3Adapter` if sql.js isn't available).
434
+ */
435
+ db?: WorkspaceDbFactory | Promise<WorkspaceDbFactory>;
409
436
  /**
410
437
  * Repo discovery knobs.
411
438
  * - include/exclude are workspace-root-relative globs (POSIX-style)
@@ -752,7 +779,16 @@ type WorkspaceStoreOptions = {
752
779
  /** "auto" (default) tries FTS5; "off" disables it. */
753
780
  fts?: "auto" | "off";
754
781
  };
782
+ type WorkspaceStoreDbOptions = {
783
+ db?: WorkspaceDbFactory;
784
+ };
755
785
 
786
+ type CreateWorkspaceStoreOptions = WorkspaceStoreOptions & WorkspaceStoreDbOptions;
787
+ declare function createWorkspaceStore(dbPath: string, opts?: CreateWorkspaceStoreOptions): WorkspaceStore;
788
+ type CreateWorkspaceStoreAsyncOptions = WorkspaceStoreOptions & {
789
+ db?: WorkspaceDbFactory | Promise<WorkspaceDbFactory>;
790
+ };
791
+ declare function createWorkspaceStoreAsync(dbPath: string, opts?: CreateWorkspaceStoreAsyncOptions): Promise<WorkspaceStore>;
756
792
  /**
757
793
  * Workspace-level unified store (SQLite) for multi-repo indexing.
758
794
  *
@@ -767,6 +803,7 @@ declare class WorkspaceStore {
767
803
  private readonly dbPath;
768
804
  private readonly db;
769
805
  private readonly uow;
806
+ private readonly ftsEnabledInternal;
770
807
  private readonly meta;
771
808
  private readonly repoHeads;
772
809
  private readonly files;
@@ -775,7 +812,8 @@ declare class WorkspaceStore {
775
812
  private readonly symbols;
776
813
  private readonly chunks;
777
814
  private readonly opts;
778
- constructor(dbPath: string, opts?: WorkspaceStoreOptions);
815
+ constructor(dbPath: string, opts?: CreateWorkspaceStoreOptions);
816
+ get ftsEnabled(): boolean;
779
817
  setMeta(k: string, v: string): void;
780
818
  getMeta(k: string): string | null;
781
819
  /**
@@ -852,6 +890,21 @@ declare class WorkspaceStore {
852
890
  close(): void;
853
891
  }
854
892
 
893
+ type SqlJsAdapterOptions = {
894
+ /**
895
+ * sql.js locateFile hook used to find `sql-wasm.wasm`.
896
+ * If omitted, sql.js resolves relative to its own package.
897
+ */
898
+ locateFile?: (file: string) => string;
899
+ /** Provide a preloaded wasm binary (avoids filesystem/network lookups). */
900
+ wasmBinary?: Uint8Array;
901
+ };
902
+ /**
903
+ * Creates a WorkspaceDbFactory backed by sql.js (WASM).
904
+ * Requires the optional dependency `sql.js` to be installed.
905
+ */
906
+ declare function sqlJsAdapter(opts?: SqlJsAdapterOptions): Promise<WorkspaceDbFactory>;
907
+
855
908
  declare function stableSymbolId(input: {
856
909
  repoRoot: string;
857
910
  path: string;
@@ -1314,13 +1367,14 @@ declare class WorkspaceIndexer {
1314
1367
  private progress;
1315
1368
  private workspaceStore;
1316
1369
  private graphStore;
1370
+ private readonly workspaceDbPath;
1317
1371
  constructor(workspaceRoot: string, embedder: EmbeddingsProvider, config?: IndexerConfig);
1318
1372
  private emitProgress;
1373
+ private ensureWorkspaceStore;
1319
1374
  open(): Promise<void>;
1320
1375
  indexAll(): Promise<void>;
1321
1376
  watch(): Promise<void>;
1322
1377
  getRepoIndexers(): RepoIndexer[];
1323
- private resolveProfile;
1324
1378
  retrieve(query: string, opts?: RetrieveOptions): Promise<ContextBundle>;
1325
1379
  search(query: string, k?: number): Promise<SearchHit[]>;
1326
1380
  closeAsync(): Promise<void>;
@@ -1394,4 +1448,4 @@ declare function linkWorkspaceRepos(args: {
1394
1448
 
1395
1449
  declare function loadConfigFile(filePath: string): IndexerConfig;
1396
1450
 
1397
- export { type AnnConfig, type AnnIndex, type AnnIndexInit, type AnnMetric, type AnnPoint, type AnnSearchHit, type Cancellation, type Chunk, type ChunkRecord, type ChunkingConfig, type ContextBundle, type CustomVectorConfig, DEFAULT_PROFILES, type EmbeddingsProvider, type FaissVectorConfig, GoModuleLinkStrategy, type GraphEdge, type GraphFileUpdate, type GraphStore, type GraphSymbol, HashEmbeddingsProvider, type HnswlibVectorConfig, type IndexerConfig, type IndexerProgress, type IndexerProgressEvent, type IndexerProgressHandler, IndexerProgressObservable, type IndexerProgressSink, type LspDocument, type LspDocumentSymbol, type LspFacade, type LspPosition, type LspRange, type LspTargetLocation, Neo4jGraphStore, NestedRepoLinkStrategy, NoopAnnIndex, NpmDependencyLinkStrategy, OllamaEmbeddingsProvider, OpenAIEmbeddingsProvider, type ProfilesConfig, type QdrantVectorConfig, type RelatedContextOptions, type RepoDiscoveryOptions, type RepoId, RepoIndexer, type RepoInfo, type RepoLink, type RetrievalProfile, type RetrievalProfileName, type RetrievalScope, type RetrievalWeights, type RetrieveOptions, type SearchHit, type SearchOptions, type SymbolEdgeKind, type SymbolGraphIndexInput, type SymbolGraphIndexOutput, SymbolGraphIndexer, type SymbolGraphIndexingMode, type SymbolGraphProvider, type SymbolGraphStrategyOptions, type SymbolKind, type SymbolRange, type VectorConfig, type VectorIndex, type VectorIndexInit, type VectorMetric, type VectorPoint, type VectorProviderKind, type VectorSearchHit, VsCodeContributesLanguageLinkStrategy, type WorkspaceChunkRow, WorkspaceIndexer, type WorkspaceLinkContext, type WorkspaceLinkStrategy, WorkspaceLinker, WorkspaceStore, asProgressSink, chunkSource, createAnnIndex, createNeo4jGraphStore, createVSCodeSymbolGraphProvider, createVectorIndex, deepMergeProfile, discoverGitRepos, languageFromPath, linkWorkspaceRepos, loadConfigFile, mergeIndexerConfig, pickRepoOverride, stableSymbolId };
1451
+ export { type AnnConfig, type AnnIndex, type AnnIndexInit, type AnnMetric, type AnnPoint, type AnnSearchHit, type Cancellation, type Chunk, type ChunkRecord, type ChunkingConfig, type ContextBundle, type CreateWorkspaceStoreAsyncOptions, type CreateWorkspaceStoreOptions, type CustomVectorConfig, DEFAULT_PROFILES, type EmbeddingsProvider, type FaissVectorConfig, GoModuleLinkStrategy, type GraphEdge, type GraphFileUpdate, type GraphStore, type GraphSymbol, HashEmbeddingsProvider, type HnswlibVectorConfig, type IndexerConfig, type IndexerProgress, type IndexerProgressEvent, type IndexerProgressHandler, IndexerProgressObservable, type IndexerProgressSink, type LspDocument, type LspDocumentSymbol, type LspFacade, type LspPosition, type LspRange, type LspTargetLocation, Neo4jGraphStore, NestedRepoLinkStrategy, NoopAnnIndex, NpmDependencyLinkStrategy, OllamaEmbeddingsProvider, OpenAIEmbeddingsProvider, type ProfilesConfig, type QdrantVectorConfig, type RelatedContextOptions, type RepoDiscoveryOptions, type RepoId, RepoIndexer, type RepoInfo, type RepoLink, type RetrievalProfile, type RetrievalProfileName, type RetrievalScope, type RetrievalWeights, type RetrieveOptions, type SearchHit, type SearchOptions, type SymbolEdgeKind, type SymbolGraphIndexInput, type SymbolGraphIndexOutput, SymbolGraphIndexer, type SymbolGraphIndexingMode, type SymbolGraphProvider, type SymbolGraphStrategyOptions, type SymbolKind, type SymbolRange, type VectorConfig, type VectorIndex, type VectorIndexInit, type VectorMetric, type VectorPoint, type VectorProviderKind, type VectorSearchHit, VsCodeContributesLanguageLinkStrategy, type WorkspaceChunkRow, type WorkspaceDbAdapter, type WorkspaceDbCapabilities, type WorkspaceDbFactory, type WorkspaceDbStatement, WorkspaceIndexer, type WorkspaceLinkContext, type WorkspaceLinkStrategy, WorkspaceLinker, WorkspaceStore, asProgressSink, betterSqlite3Adapter, chunkSource, createAnnIndex, createNeo4jGraphStore, createVSCodeSymbolGraphProvider, createVectorIndex, createWorkspaceStore, createWorkspaceStoreAsync, deepMergeProfile, discoverGitRepos, languageFromPath, linkWorkspaceRepos, loadConfigFile, mergeIndexerConfig, pickRepoOverride, sqlJsAdapter, stableSymbolId };
package/dist/index.d.ts CHANGED
@@ -61,6 +61,28 @@ interface SymbolGraphProvider {
61
61
  }): Promise<GraphEdge[]>;
62
62
  }
63
63
 
64
+ type WorkspaceDbCapabilities = {
65
+ /** Whether this SQLite build supports `CREATE VIRTUAL TABLE ... USING fts5(...)`. */
66
+ supportsFts5: boolean;
67
+ };
68
+ interface WorkspaceDbStatement {
69
+ run(...args: any[]): any;
70
+ get(...args: any[]): any;
71
+ all(...args: any[]): any;
72
+ }
73
+ interface WorkspaceDbAdapter {
74
+ readonly capabilities: WorkspaceDbCapabilities;
75
+ pragma(sql: string): void;
76
+ exec(sql: string): void;
77
+ prepare(sql: string): WorkspaceDbStatement;
78
+ transaction<T>(fn: () => T): () => T;
79
+ close(): void;
80
+ }
81
+ type WorkspaceDbFactory = {
82
+ open(dbPath: string): WorkspaceDbAdapter;
83
+ };
84
+ declare const betterSqlite3Adapter: WorkspaceDbFactory;
85
+
64
86
  type AnnMetric = "cosine" | "ip" | "l2";
65
87
  type AnnPoint = {
66
88
  id: string;
@@ -406,6 +428,11 @@ interface IndexerConfig extends ProfilesConfig {
406
428
  ann?: AnnConfig;
407
429
  /** Workspace-only settings (used by WorkspaceIndexer). */
408
430
  workspace?: {
431
+ /**
432
+ * Optional DB adapter factory used for the workspace store.
433
+ * Default: `sqlJsAdapter()` (falls back to `betterSqlite3Adapter` if sql.js isn't available).
434
+ */
435
+ db?: WorkspaceDbFactory | Promise<WorkspaceDbFactory>;
409
436
  /**
410
437
  * Repo discovery knobs.
411
438
  * - include/exclude are workspace-root-relative globs (POSIX-style)
@@ -752,7 +779,16 @@ type WorkspaceStoreOptions = {
752
779
  /** "auto" (default) tries FTS5; "off" disables it. */
753
780
  fts?: "auto" | "off";
754
781
  };
782
+ type WorkspaceStoreDbOptions = {
783
+ db?: WorkspaceDbFactory;
784
+ };
755
785
 
786
+ type CreateWorkspaceStoreOptions = WorkspaceStoreOptions & WorkspaceStoreDbOptions;
787
+ declare function createWorkspaceStore(dbPath: string, opts?: CreateWorkspaceStoreOptions): WorkspaceStore;
788
+ type CreateWorkspaceStoreAsyncOptions = WorkspaceStoreOptions & {
789
+ db?: WorkspaceDbFactory | Promise<WorkspaceDbFactory>;
790
+ };
791
+ declare function createWorkspaceStoreAsync(dbPath: string, opts?: CreateWorkspaceStoreAsyncOptions): Promise<WorkspaceStore>;
756
792
  /**
757
793
  * Workspace-level unified store (SQLite) for multi-repo indexing.
758
794
  *
@@ -767,6 +803,7 @@ declare class WorkspaceStore {
767
803
  private readonly dbPath;
768
804
  private readonly db;
769
805
  private readonly uow;
806
+ private readonly ftsEnabledInternal;
770
807
  private readonly meta;
771
808
  private readonly repoHeads;
772
809
  private readonly files;
@@ -775,7 +812,8 @@ declare class WorkspaceStore {
775
812
  private readonly symbols;
776
813
  private readonly chunks;
777
814
  private readonly opts;
778
- constructor(dbPath: string, opts?: WorkspaceStoreOptions);
815
+ constructor(dbPath: string, opts?: CreateWorkspaceStoreOptions);
816
+ get ftsEnabled(): boolean;
779
817
  setMeta(k: string, v: string): void;
780
818
  getMeta(k: string): string | null;
781
819
  /**
@@ -852,6 +890,21 @@ declare class WorkspaceStore {
852
890
  close(): void;
853
891
  }
854
892
 
893
+ type SqlJsAdapterOptions = {
894
+ /**
895
+ * sql.js locateFile hook used to find `sql-wasm.wasm`.
896
+ * If omitted, sql.js resolves relative to its own package.
897
+ */
898
+ locateFile?: (file: string) => string;
899
+ /** Provide a preloaded wasm binary (avoids filesystem/network lookups). */
900
+ wasmBinary?: Uint8Array;
901
+ };
902
+ /**
903
+ * Creates a WorkspaceDbFactory backed by sql.js (WASM).
904
+ * Requires the optional dependency `sql.js` to be installed.
905
+ */
906
+ declare function sqlJsAdapter(opts?: SqlJsAdapterOptions): Promise<WorkspaceDbFactory>;
907
+
855
908
  declare function stableSymbolId(input: {
856
909
  repoRoot: string;
857
910
  path: string;
@@ -1314,13 +1367,14 @@ declare class WorkspaceIndexer {
1314
1367
  private progress;
1315
1368
  private workspaceStore;
1316
1369
  private graphStore;
1370
+ private readonly workspaceDbPath;
1317
1371
  constructor(workspaceRoot: string, embedder: EmbeddingsProvider, config?: IndexerConfig);
1318
1372
  private emitProgress;
1373
+ private ensureWorkspaceStore;
1319
1374
  open(): Promise<void>;
1320
1375
  indexAll(): Promise<void>;
1321
1376
  watch(): Promise<void>;
1322
1377
  getRepoIndexers(): RepoIndexer[];
1323
- private resolveProfile;
1324
1378
  retrieve(query: string, opts?: RetrieveOptions): Promise<ContextBundle>;
1325
1379
  search(query: string, k?: number): Promise<SearchHit[]>;
1326
1380
  closeAsync(): Promise<void>;
@@ -1394,4 +1448,4 @@ declare function linkWorkspaceRepos(args: {
1394
1448
 
1395
1449
  declare function loadConfigFile(filePath: string): IndexerConfig;
1396
1450
 
1397
- export { type AnnConfig, type AnnIndex, type AnnIndexInit, type AnnMetric, type AnnPoint, type AnnSearchHit, type Cancellation, type Chunk, type ChunkRecord, type ChunkingConfig, type ContextBundle, type CustomVectorConfig, DEFAULT_PROFILES, type EmbeddingsProvider, type FaissVectorConfig, GoModuleLinkStrategy, type GraphEdge, type GraphFileUpdate, type GraphStore, type GraphSymbol, HashEmbeddingsProvider, type HnswlibVectorConfig, type IndexerConfig, type IndexerProgress, type IndexerProgressEvent, type IndexerProgressHandler, IndexerProgressObservable, type IndexerProgressSink, type LspDocument, type LspDocumentSymbol, type LspFacade, type LspPosition, type LspRange, type LspTargetLocation, Neo4jGraphStore, NestedRepoLinkStrategy, NoopAnnIndex, NpmDependencyLinkStrategy, OllamaEmbeddingsProvider, OpenAIEmbeddingsProvider, type ProfilesConfig, type QdrantVectorConfig, type RelatedContextOptions, type RepoDiscoveryOptions, type RepoId, RepoIndexer, type RepoInfo, type RepoLink, type RetrievalProfile, type RetrievalProfileName, type RetrievalScope, type RetrievalWeights, type RetrieveOptions, type SearchHit, type SearchOptions, type SymbolEdgeKind, type SymbolGraphIndexInput, type SymbolGraphIndexOutput, SymbolGraphIndexer, type SymbolGraphIndexingMode, type SymbolGraphProvider, type SymbolGraphStrategyOptions, type SymbolKind, type SymbolRange, type VectorConfig, type VectorIndex, type VectorIndexInit, type VectorMetric, type VectorPoint, type VectorProviderKind, type VectorSearchHit, VsCodeContributesLanguageLinkStrategy, type WorkspaceChunkRow, WorkspaceIndexer, type WorkspaceLinkContext, type WorkspaceLinkStrategy, WorkspaceLinker, WorkspaceStore, asProgressSink, chunkSource, createAnnIndex, createNeo4jGraphStore, createVSCodeSymbolGraphProvider, createVectorIndex, deepMergeProfile, discoverGitRepos, languageFromPath, linkWorkspaceRepos, loadConfigFile, mergeIndexerConfig, pickRepoOverride, stableSymbolId };
1451
+ export { type AnnConfig, type AnnIndex, type AnnIndexInit, type AnnMetric, type AnnPoint, type AnnSearchHit, type Cancellation, type Chunk, type ChunkRecord, type ChunkingConfig, type ContextBundle, type CreateWorkspaceStoreAsyncOptions, type CreateWorkspaceStoreOptions, type CustomVectorConfig, DEFAULT_PROFILES, type EmbeddingsProvider, type FaissVectorConfig, GoModuleLinkStrategy, type GraphEdge, type GraphFileUpdate, type GraphStore, type GraphSymbol, HashEmbeddingsProvider, type HnswlibVectorConfig, type IndexerConfig, type IndexerProgress, type IndexerProgressEvent, type IndexerProgressHandler, IndexerProgressObservable, type IndexerProgressSink, type LspDocument, type LspDocumentSymbol, type LspFacade, type LspPosition, type LspRange, type LspTargetLocation, Neo4jGraphStore, NestedRepoLinkStrategy, NoopAnnIndex, NpmDependencyLinkStrategy, OllamaEmbeddingsProvider, OpenAIEmbeddingsProvider, type ProfilesConfig, type QdrantVectorConfig, type RelatedContextOptions, type RepoDiscoveryOptions, type RepoId, RepoIndexer, type RepoInfo, type RepoLink, type RetrievalProfile, type RetrievalProfileName, type RetrievalScope, type RetrievalWeights, type RetrieveOptions, type SearchHit, type SearchOptions, type SymbolEdgeKind, type SymbolGraphIndexInput, type SymbolGraphIndexOutput, SymbolGraphIndexer, type SymbolGraphIndexingMode, type SymbolGraphProvider, type SymbolGraphStrategyOptions, type SymbolKind, type SymbolRange, type VectorConfig, type VectorIndex, type VectorIndexInit, type VectorMetric, type VectorPoint, type VectorProviderKind, type VectorSearchHit, VsCodeContributesLanguageLinkStrategy, type WorkspaceChunkRow, type WorkspaceDbAdapter, type WorkspaceDbCapabilities, type WorkspaceDbFactory, type WorkspaceDbStatement, WorkspaceIndexer, type WorkspaceLinkContext, type WorkspaceLinkStrategy, WorkspaceLinker, WorkspaceStore, asProgressSink, betterSqlite3Adapter, chunkSource, createAnnIndex, createNeo4jGraphStore, createVSCodeSymbolGraphProvider, createVectorIndex, createWorkspaceStore, createWorkspaceStoreAsync, deepMergeProfile, discoverGitRepos, languageFromPath, linkWorkspaceRepos, loadConfigFile, mergeIndexerConfig, pickRepoOverride, sqlJsAdapter, stableSymbolId };
package/dist/index.js CHANGED
@@ -15,10 +15,13 @@ import {
15
15
  WorkspaceLinker,
16
16
  WorkspaceStore,
17
17
  asProgressSink,
18
+ betterSqlite3Adapter,
18
19
  chunkSource,
19
20
  createAnnIndex,
20
21
  createNeo4jGraphStore,
21
22
  createVectorIndex,
23
+ createWorkspaceStore,
24
+ createWorkspaceStoreAsync,
22
25
  deepMergeProfile,
23
26
  discoverGitRepos,
24
27
  languageFromPath,
@@ -26,8 +29,10 @@ import {
26
29
  loadConfigFile,
27
30
  mergeIndexerConfig,
28
31
  pickRepoOverride,
32
+ sqlJsAdapter,
29
33
  stableSymbolId
30
- } from "./chunk-FUUQXFJQ.js";
34
+ } from "./chunk-77UJJ6YQ.js";
35
+ import "./chunk-MCKGQKYU.js";
31
36
 
32
37
  // src/symbolGraph/vscodeProvider.ts
33
38
  import path2 from "path";
@@ -411,11 +416,14 @@ export {
411
416
  WorkspaceLinker,
412
417
  WorkspaceStore,
413
418
  asProgressSink,
419
+ betterSqlite3Adapter,
414
420
  chunkSource,
415
421
  createAnnIndex,
416
422
  createNeo4jGraphStore,
417
423
  createVSCodeSymbolGraphProvider,
418
424
  createVectorIndex,
425
+ createWorkspaceStore,
426
+ createWorkspaceStoreAsync,
419
427
  deepMergeProfile,
420
428
  discoverGitRepos,
421
429
  languageFromPath,
@@ -423,5 +431,6 @@ export {
423
431
  loadConfigFile,
424
432
  mergeIndexerConfig,
425
433
  pickRepoOverride,
434
+ sqlJsAdapter,
426
435
  stableSymbolId
427
436
  };