@eclipse-docks/extension-rag-system 0.7.68

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 (66) hide show
  1. package/dist/api.d.ts +9 -0
  2. package/dist/api.d.ts.map +1 -0
  3. package/dist/api.js +48 -0
  4. package/dist/api.js.map +1 -0
  5. package/dist/chunkers/chunker-interface.d.ts +21 -0
  6. package/dist/chunkers/chunker-interface.d.ts.map +1 -0
  7. package/dist/chunkers/document-chunker.d.ts +12 -0
  8. package/dist/chunkers/document-chunker.d.ts.map +1 -0
  9. package/dist/chunkers/fallback-chunker.d.ts +10 -0
  10. package/dist/chunkers/fallback-chunker.d.ts.map +1 -0
  11. package/dist/chunkers/langchain-chunker.d.ts +12 -0
  12. package/dist/chunkers/langchain-chunker.d.ts.map +1 -0
  13. package/dist/document-index-service.d.ts +102 -0
  14. package/dist/document-index-service.d.ts.map +1 -0
  15. package/dist/embedding-service.d.ts +18 -0
  16. package/dist/embedding-service.d.ts.map +1 -0
  17. package/dist/extractors/document-extractor-interface.d.ts +26 -0
  18. package/dist/extractors/document-extractor-interface.d.ts.map +1 -0
  19. package/dist/extractors/document-extractor.d.ts +13 -0
  20. package/dist/extractors/document-extractor.d.ts.map +1 -0
  21. package/dist/extractors/llm-ocr-extractor.d.ts +16 -0
  22. package/dist/extractors/llm-ocr-extractor.d.ts.map +1 -0
  23. package/dist/extractors/pdfjs-extractor.d.ts +7 -0
  24. package/dist/extractors/pdfjs-extractor.d.ts.map +1 -0
  25. package/dist/i18n.de-C4Oy9SoE.js +11 -0
  26. package/dist/i18n.de-C4Oy9SoE.js.map +1 -0
  27. package/dist/i18n.en-BGbyrXax.js +11 -0
  28. package/dist/i18n.en-BGbyrXax.js.map +1 -0
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +19 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/rag-integration-CT4hgNjS.js +173 -0
  34. package/dist/rag-integration-CT4hgNjS.js.map +1 -0
  35. package/dist/rag-integration-DkvJoU26.js +2 -0
  36. package/dist/rag-integration.d.ts +6 -0
  37. package/dist/rag-integration.d.ts.map +1 -0
  38. package/dist/rag-service-DHsW5YrB.js +1653 -0
  39. package/dist/rag-service-DHsW5YrB.js.map +1 -0
  40. package/dist/rag-service.d.ts +25 -0
  41. package/dist/rag-service.d.ts.map +1 -0
  42. package/dist/rag-system-extension-CHeA4aaJ.js +1032 -0
  43. package/dist/rag-system-extension-CHeA4aaJ.js.map +1 -0
  44. package/dist/rag-system-extension.d.ts +2 -0
  45. package/dist/rag-system-extension.d.ts.map +1 -0
  46. package/dist/rag-system-manager.d.ts +41 -0
  47. package/dist/rag-system-manager.d.ts.map +1 -0
  48. package/dist/rxdb-loader.d.ts +9 -0
  49. package/dist/rxdb-loader.d.ts.map +1 -0
  50. package/dist/services/rag-result-formatter.d.ts +23 -0
  51. package/dist/services/rag-result-formatter.d.ts.map +1 -0
  52. package/dist/services/relevance-calculator.d.ts +7 -0
  53. package/dist/services/relevance-calculator.d.ts.map +1 -0
  54. package/dist/utils/constants.d.ts +35 -0
  55. package/dist/utils/constants.d.ts.map +1 -0
  56. package/dist/utils/context-scopes.d.ts +39 -0
  57. package/dist/utils/context-scopes.d.ts.map +1 -0
  58. package/dist/utils/query-utils.d.ts +7 -0
  59. package/dist/utils/query-utils.d.ts.map +1 -0
  60. package/dist/utils/snippet-extractor.d.ts +22 -0
  61. package/dist/utils/snippet-extractor.d.ts.map +1 -0
  62. package/dist/utils/workspace-utils.d.ts +8 -0
  63. package/dist/utils/workspace-utils.d.ts.map +1 -0
  64. package/dist/vector-utils.d.ts +28 -0
  65. package/dist/vector-utils.d.ts.map +1 -0
  66. package/package.json +43 -0
package/dist/api.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export { documentIndexService, type DocumentSearchScope, type IndexedDocument, type DocumentIndexOptions, } from './document-index-service';
2
+ export { embeddingService, type EmbeddingOptions } from './embedding-service';
3
+ export { ragService, searchWorkspaceDocuments, type RAGSearchOptions, type RAGSearchResult, } from './rag-service';
4
+ export { ragPromptEnhancer, createRAGToolExecutor, registerRAGCommands, integrateRAGWithAI, } from './rag-integration';
5
+ export type { VectorEmbedding, IndexValues, SampleVector } from './vector-utils';
6
+ export { euclideanDistance, cosineSimilarity, createIndexValuesFromArray, getIndexValueArray } from './vector-utils';
7
+ export { createEditorScope, createDirectoryScope, createFileTypeScope, combineScopes, } from './utils/context-scopes';
8
+ export type { ContextScopeProvider } from './utils/context-scopes';
9
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACL,UAAU,EACV,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACrH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/api.js ADDED
@@ -0,0 +1,48 @@
1
+ import { c as createIndexValuesFromArray, l as euclideanDistance, m as embeddingService, n as searchWorkspaceDocuments, o as documentIndexService, s as cosineSimilarity, t as ragService, u as getIndexValueArray } from "./rag-service-DHsW5YrB.js";
2
+ import { i as registerRAGCommands, n as integrateRAGWithAI, r as ragPromptEnhancer, t as createRAGToolExecutor } from "./rag-integration-CT4hgNjS.js";
3
+ //#region src/utils/context-scopes.ts
4
+ function createEditorScope(openFiles) {
5
+ return { includePaths: openFiles };
6
+ }
7
+ function createDirectoryScope(directoryPath, recursive = true) {
8
+ const pattern = recursive ? `^${directoryPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*` : `^${directoryPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/[^/]+$`;
9
+ return { pathPattern: new RegExp(pattern) };
10
+ }
11
+ function createFileTypeScope(fileTypes) {
12
+ const pattern = `\\.(${fileTypes.join("|")})$`;
13
+ return { pathPattern: new RegExp(pattern) };
14
+ }
15
+ function combineScopes(...scopes) {
16
+ const validScopes = scopes.filter((s) => s !== null);
17
+ if (validScopes.length === 0) return null;
18
+ if (validScopes.length === 1) return validScopes[0];
19
+ const combined = {};
20
+ const allIncludePaths = [];
21
+ const allExcludePaths = [];
22
+ const allTags = [];
23
+ const allMetadataFilters = [];
24
+ for (const scope of validScopes) {
25
+ if (scope.includePaths) allIncludePaths.push(...scope.includePaths);
26
+ if (scope.excludePaths) allExcludePaths.push(...scope.excludePaths);
27
+ if (scope.tags) allTags.push(...scope.tags);
28
+ if (scope.metadataFilter) allMetadataFilters.push(scope.metadataFilter);
29
+ if (scope.pathPattern) {
30
+ const existingPattern = combined.pathPattern;
31
+ if (existingPattern) {
32
+ const newPattern = scope.pathPattern instanceof RegExp ? scope.pathPattern : new RegExp(scope.pathPattern);
33
+ combined.pathPattern = new RegExp(`(${existingPattern instanceof RegExp ? existingPattern.source : existingPattern})|(${newPattern.source})`);
34
+ } else combined.pathPattern = scope.pathPattern;
35
+ }
36
+ }
37
+ if (allIncludePaths.length > 0) combined.includePaths = [...new Set(allIncludePaths)];
38
+ if (allExcludePaths.length > 0) combined.excludePaths = [...new Set(allExcludePaths)];
39
+ if (allTags.length > 0) combined.tags = [...new Set(allTags)];
40
+ if (allMetadataFilters.length > 0) combined.metadataFilter = (doc) => {
41
+ return allMetadataFilters.every((filter) => filter(doc));
42
+ };
43
+ return combined;
44
+ }
45
+ //#endregion
46
+ export { combineScopes, cosineSimilarity, createDirectoryScope, createEditorScope, createFileTypeScope, createIndexValuesFromArray, createRAGToolExecutor, documentIndexService, embeddingService, euclideanDistance, getIndexValueArray, integrateRAGWithAI, ragPromptEnhancer, ragService, registerRAGCommands, searchWorkspaceDocuments };
47
+
48
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","names":[],"sources":["../src/utils/context-scopes.ts"],"sourcesContent":["import { DocumentSearchScope } from '../document-index-service';\nimport { IndexedDocument } from '../document-index-service';\n\nexport interface ContextScopeProvider {\n getScope(): DocumentSearchScope | null;\n getName(): string;\n}\n\nexport class PathBasedScope implements ContextScopeProvider {\n constructor(\n private includePaths: string[],\n private excludePaths: string[] = [],\n private name: string = 'Path-based scope'\n ) {}\n\n getScope(): DocumentSearchScope {\n return {\n includePaths: this.includePaths,\n excludePaths: this.excludePaths\n };\n }\n\n getName(): string {\n return this.name;\n }\n}\n\nexport class PatternBasedScope implements ContextScopeProvider {\n constructor(\n private pattern: string | RegExp,\n private name: string = 'Pattern-based scope'\n ) {}\n\n getScope(): DocumentSearchScope {\n return {\n pathPattern: this.pattern\n };\n }\n\n getName(): string {\n return this.name;\n }\n}\n\nexport class TagBasedScope implements ContextScopeProvider {\n constructor(\n private tags: string[],\n private name: string = 'Tag-based scope'\n ) {}\n\n getScope(): DocumentSearchScope {\n return {\n tags: this.tags\n };\n }\n\n getName(): string {\n return this.name;\n }\n}\n\nexport class CustomScope implements ContextScopeProvider {\n constructor(\n private scope: DocumentSearchScope,\n private name: string = 'Custom scope'\n ) {}\n\n getScope(): DocumentSearchScope {\n return this.scope;\n }\n\n getName(): string {\n return this.name;\n }\n}\n\nexport function createEditorScope(openFiles: string[]): DocumentSearchScope {\n return {\n includePaths: openFiles\n };\n}\n\nexport function createDirectoryScope(directoryPath: string, recursive: boolean = true): DocumentSearchScope {\n const pattern = recursive \n ? `^${directoryPath.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}/.*`\n : `^${directoryPath.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}/[^/]+$`;\n return {\n pathPattern: new RegExp(pattern)\n };\n}\n\nexport function createFileTypeScope(fileTypes: string[]): DocumentSearchScope {\n const pattern = `\\\\.(${fileTypes.join('|')})$`;\n return {\n pathPattern: new RegExp(pattern)\n };\n}\n\nexport function combineScopes(...scopes: (DocumentSearchScope | null)[]): DocumentSearchScope | null {\n const validScopes = scopes.filter((s): s is DocumentSearchScope => s !== null);\n if (validScopes.length === 0) {\n return null;\n }\n if (validScopes.length === 1) {\n return validScopes[0];\n }\n\n const combined: DocumentSearchScope = {};\n \n const allIncludePaths: string[] = [];\n const allExcludePaths: string[] = [];\n const allTags: string[] = [];\n const allMetadataFilters: Array<(doc: IndexedDocument) => boolean> = [];\n\n for (const scope of validScopes) {\n if (scope.includePaths) {\n allIncludePaths.push(...scope.includePaths);\n }\n if (scope.excludePaths) {\n allExcludePaths.push(...scope.excludePaths);\n }\n if (scope.tags) {\n allTags.push(...scope.tags);\n }\n if (scope.metadataFilter) {\n allMetadataFilters.push(scope.metadataFilter);\n }\n if (scope.pathPattern) {\n const existingPattern = combined.pathPattern;\n if (existingPattern) {\n const newPattern = scope.pathPattern instanceof RegExp \n ? scope.pathPattern \n : new RegExp(scope.pathPattern);\n combined.pathPattern = new RegExp(`(${existingPattern instanceof RegExp ? existingPattern.source : existingPattern})|(${newPattern.source})`);\n } else {\n combined.pathPattern = scope.pathPattern;\n }\n }\n }\n\n if (allIncludePaths.length > 0) {\n combined.includePaths = [...new Set(allIncludePaths)];\n }\n if (allExcludePaths.length > 0) {\n combined.excludePaths = [...new Set(allExcludePaths)];\n }\n if (allTags.length > 0) {\n combined.tags = [...new Set(allTags)];\n }\n if (allMetadataFilters.length > 0) {\n combined.metadataFilter = (doc: IndexedDocument) => {\n return allMetadataFilters.every(filter => filter(doc));\n };\n }\n\n return combined;\n}\n\n"],"mappings":";;;AA4EA,SAAgB,kBAAkB,WAA0C;AACxE,QAAO,EACH,cAAc,WACjB;;AAGL,SAAgB,qBAAqB,eAAuB,YAAqB,MAA2B;CACxG,MAAM,UAAU,YACV,IAAI,cAAc,QAAQ,uBAAuB,OAAO,CAAC,OACzD,IAAI,cAAc,QAAQ,uBAAuB,OAAO,CAAC;AAC/D,QAAO,EACH,aAAa,IAAI,OAAO,QAAQ,EACnC;;AAGL,SAAgB,oBAAoB,WAA0C;CAC1E,MAAM,UAAU,OAAO,UAAU,KAAK,IAAI,CAAC;AAC3C,QAAO,EACH,aAAa,IAAI,OAAO,QAAQ,EACnC;;AAGL,SAAgB,cAAc,GAAG,QAAoE;CACjG,MAAM,cAAc,OAAO,QAAQ,MAAgC,MAAM,KAAK;AAC9E,KAAI,YAAY,WAAW,EACvB,QAAO;AAEX,KAAI,YAAY,WAAW,EACvB,QAAO,YAAY;CAGvB,MAAM,WAAgC,EAAE;CAExC,MAAM,kBAA4B,EAAE;CACpC,MAAM,kBAA4B,EAAE;CACpC,MAAM,UAAoB,EAAE;CAC5B,MAAM,qBAA+D,EAAE;AAEvE,MAAK,MAAM,SAAS,aAAa;AAC7B,MAAI,MAAM,aACN,iBAAgB,KAAK,GAAG,MAAM,aAAa;AAE/C,MAAI,MAAM,aACN,iBAAgB,KAAK,GAAG,MAAM,aAAa;AAE/C,MAAI,MAAM,KACN,SAAQ,KAAK,GAAG,MAAM,KAAK;AAE/B,MAAI,MAAM,eACN,oBAAmB,KAAK,MAAM,eAAe;AAEjD,MAAI,MAAM,aAAa;GACnB,MAAM,kBAAkB,SAAS;AACjC,OAAI,iBAAiB;IACjB,MAAM,aAAa,MAAM,uBAAuB,SAC1C,MAAM,cACN,IAAI,OAAO,MAAM,YAAY;AACnC,aAAS,cAAc,IAAI,OAAO,IAAI,2BAA2B,SAAS,gBAAgB,SAAS,gBAAgB,KAAK,WAAW,OAAO,GAAG;SAE7I,UAAS,cAAc,MAAM;;;AAKzC,KAAI,gBAAgB,SAAS,EACzB,UAAS,eAAe,CAAC,GAAG,IAAI,IAAI,gBAAgB,CAAC;AAEzD,KAAI,gBAAgB,SAAS,EACzB,UAAS,eAAe,CAAC,GAAG,IAAI,IAAI,gBAAgB,CAAC;AAEzD,KAAI,QAAQ,SAAS,EACjB,UAAS,OAAO,CAAC,GAAG,IAAI,IAAI,QAAQ,CAAC;AAEzC,KAAI,mBAAmB,SAAS,EAC5B,UAAS,kBAAkB,QAAyB;AAChD,SAAO,mBAAmB,OAAM,WAAU,OAAO,IAAI,CAAC;;AAI9D,QAAO"}
@@ -0,0 +1,21 @@
1
+ export interface DocumentChunk {
2
+ id: string;
3
+ documentId: string;
4
+ chunkIndex: number;
5
+ text: string;
6
+ startOffset: number;
7
+ endOffset: number;
8
+ }
9
+ export interface ChunkingOptions {
10
+ /** Maximum chunk size in words (default: 500) */
11
+ chunkSize?: number;
12
+ /** Overlap between chunks in words (default: 50) */
13
+ chunkOverlap?: number;
14
+ /** Minimum chunk size in words (used by fallback chunker) */
15
+ minChunkSize?: number;
16
+ }
17
+ export interface IDocumentChunker {
18
+ chunkDocument(documentId: string, content: string, fileName: string): DocumentChunk[] | Promise<DocumentChunk[]>;
19
+ getChunkContext(chunk: DocumentChunk, allChunks: DocumentChunk[]): string;
20
+ }
21
+ //# sourceMappingURL=chunker-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunker-interface.d.ts","sourceRoot":"","sources":["../../src/chunkers/chunker-interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC5B,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC7B,aAAa,CACT,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACjB,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAE9C,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;CAC7E"}
@@ -0,0 +1,12 @@
1
+ import { ChunkingOptions, IDocumentChunker, DocumentChunk } from './chunker-interface';
2
+ export type { DocumentChunk, ChunkingOptions, IDocumentChunker } from './chunker-interface';
3
+ export { FallbackChunker } from './fallback-chunker';
4
+ export { LangChainChunker } from './langchain-chunker';
5
+ export declare class DocumentChunker implements IDocumentChunker {
6
+ private chunker;
7
+ constructor(options?: ChunkingOptions);
8
+ chunkDocument(documentId: string, content: string, fileName: string): Promise<DocumentChunk[]>;
9
+ getChunkContext(chunk: any, allChunks: any[]): string;
10
+ }
11
+ export declare const defaultChunker: DocumentChunker;
12
+ //# sourceMappingURL=document-chunker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-chunker.d.ts","sourceRoot":"","sources":["../../src/chunkers/document-chunker.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI5F,qBAAa,eAAgB,YAAW,gBAAgB;IACpD,OAAO,CAAC,OAAO,CAAmB;gBAEtB,OAAO,GAAE,eAAoB;IAUnC,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAWzE,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE;CAG/C;AAED,eAAO,MAAM,cAAc,iBAAwB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { DocumentChunk, ChunkingOptions, IDocumentChunker } from './chunker-interface';
2
+ export declare class FallbackChunker implements IDocumentChunker {
3
+ private readonly chunkSize;
4
+ private readonly chunkOverlap;
5
+ private readonly minChunkSize;
6
+ constructor(options?: ChunkingOptions);
7
+ chunkDocument(documentId: string, content: string, fileName: string): DocumentChunk[];
8
+ getChunkContext(chunk: DocumentChunk, allChunks: DocumentChunk[]): string;
9
+ }
10
+ //# sourceMappingURL=fallback-chunker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback-chunker.d.ts","sourceRoot":"","sources":["../../src/chunkers/fallback-chunker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM5F,qBAAa,eAAgB,YAAW,gBAAgB;IACpD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,OAAO,GAAE,eAAoB;IAMzC,aAAa,CACT,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACjB,aAAa,EAAE;IA8ClB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,MAAM;CAmB5E"}
@@ -0,0 +1,12 @@
1
+ import { DocumentChunk, ChunkingOptions, IDocumentChunker } from './chunker-interface';
2
+ export declare class LangChainChunker implements IDocumentChunker {
3
+ private textSplitter;
4
+ private readonly chunkSize;
5
+ private readonly chunkOverlap;
6
+ constructor(options?: ChunkingOptions);
7
+ private getTextSplitter;
8
+ chunkDocument(documentId: string, content: string, fileName: string): Promise<DocumentChunk[]>;
9
+ private validateNoWordSplitting;
10
+ getChunkContext(chunk: DocumentChunk, allChunks: DocumentChunk[]): string;
11
+ }
12
+ //# sourceMappingURL=langchain-chunker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"langchain-chunker.d.ts","sourceRoot":"","sources":["../../src/chunkers/langchain-chunker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAe5F,qBAAa,gBAAiB,YAAW,gBAAgB;IACrD,OAAO,CAAC,YAAY,CAA+C;IACnE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,OAAO,GAAE,eAAoB;YAK3B,eAAe;IAqBvB,aAAa,CACf,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,EAAE,CAAC;IA+D3B,OAAO,CAAC,uBAAuB;IAsB/B,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,MAAM;CAmB5E"}
@@ -0,0 +1,102 @@
1
+ import { File, Directory } from '@eclipse-docks/core';
2
+ export interface DocumentSearchScope {
3
+ includePaths?: string[];
4
+ excludePaths?: string[];
5
+ pathPattern?: string | RegExp;
6
+ tags?: string[];
7
+ metadataFilter?: (doc: IndexedDocument) => boolean;
8
+ }
9
+ export interface IndexedDocument {
10
+ id: string;
11
+ workspacePath: string;
12
+ filePath: string;
13
+ fileName: string;
14
+ fileType: string;
15
+ content: string;
16
+ contentHash: string;
17
+ metadata: {
18
+ size: number;
19
+ lastModified: number;
20
+ language?: string;
21
+ tags?: string[];
22
+ };
23
+ indexedAt: number;
24
+ updatedAt: number;
25
+ }
26
+ export interface DocumentIndexOptions {
27
+ includeContent?: boolean;
28
+ maxFileSize?: number;
29
+ fileTypes?: string[];
30
+ excludePatterns?: string[];
31
+ tags?: string[];
32
+ }
33
+ declare class DocumentIndexService {
34
+ private db?;
35
+ private documentsCollection?;
36
+ private vectorsCollection?;
37
+ private sampleVectors;
38
+ private isInitialized;
39
+ private readonly DEFAULT_MAX_FILE_SIZE;
40
+ private readonly chunker;
41
+ private readonly documentExtractor;
42
+ private readonly DEFAULT_INDEXABLE_TYPES;
43
+ initialize(): Promise<void>;
44
+ private ensureInitialized;
45
+ private initializeSampleVectors;
46
+ private generateDocumentId;
47
+ private computeContentHash;
48
+ private isIndexableFile;
49
+ private detectLanguage;
50
+ indexDocument(file: File, options?: DocumentIndexOptions): Promise<IndexedDocument>;
51
+ getDocument(id: string): Promise<IndexedDocument | null>;
52
+ getDocumentByPath(workspacePath: string, filePath: string): Promise<IndexedDocument | null>;
53
+ listDocuments(workspacePath?: string): Promise<IndexedDocument[]>;
54
+ deleteDocument(id: string): Promise<boolean>;
55
+ deleteDocumentByPath(workspacePath: string, filePath: string): Promise<boolean>;
56
+ private handleSchemaMigration;
57
+ deleteWorkspace(workspacePath: string): Promise<number>;
58
+ updateDocumentMetadata(id: string, updates: Partial<Pick<IndexedDocument, 'metadata'>>): Promise<IndexedDocument | null>;
59
+ indexWorkspace(workspace: Directory, options?: DocumentIndexOptions): Promise<{
60
+ indexed: number;
61
+ failed: number;
62
+ errors: string[];
63
+ }>;
64
+ private collectFiles;
65
+ reindexDocument(file: File, options?: DocumentIndexOptions): Promise<IndexedDocument>;
66
+ reindexAllDocuments(options?: DocumentIndexOptions): Promise<{
67
+ total: number;
68
+ succeeded: number;
69
+ failed: number;
70
+ }>;
71
+ getStats(): Promise<{
72
+ totalDocuments: number;
73
+ byWorkspace: Record<string, number>;
74
+ }>;
75
+ private handleWorkspaceChange;
76
+ private generateAndStoreEmbedding;
77
+ searchSimilar(queryText: string, options?: {
78
+ limit?: number;
79
+ workspacePath?: string;
80
+ fileType?: string;
81
+ indexDistance?: number;
82
+ docsPerIndexSide?: number;
83
+ }): Promise<Array<{
84
+ document: IndexedDocument;
85
+ similarity: number;
86
+ chunkIndex?: number;
87
+ chunkStartOffset?: number;
88
+ chunkEndOffset?: number;
89
+ }>>;
90
+ indexFileInContext(file: File, context: DocumentSearchScope, options?: DocumentIndexOptions): Promise<IndexedDocument>;
91
+ indexFilesInContext(files: File[], context: DocumentSearchScope, options?: DocumentIndexOptions): Promise<{
92
+ succeeded: number;
93
+ failed: number;
94
+ }>;
95
+ reindexFileInContext(file: File, context: DocumentSearchScope, options?: DocumentIndexOptions): Promise<IndexedDocument>;
96
+ removeFileFromContext(file: File, context: DocumentSearchScope): Promise<void>;
97
+ clearContext(context: DocumentSearchScope): Promise<void>;
98
+ getFilePathsInContext(context: DocumentSearchScope): Promise<string[]>;
99
+ }
100
+ export declare const documentIndexService: DocumentIndexService;
101
+ export {};
102
+ //# sourceMappingURL=document-index-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-index-service.d.ts","sourceRoot":"","sources":["../src/document-index-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,IAAI,EAAE,SAAS,EAAuE,MAAM,qBAAqB,CAAC;AAY7I,MAAM,WAAW,mBAAmB;IAChC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAA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,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BzD,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAY/E;AAED,eAAO,MAAM,oBAAoB,sBAA6B,CAAC"}
@@ -0,0 +1,18 @@
1
+ export interface EmbeddingOptions {
2
+ pooling?: 'mean' | 'cls' | 'none';
3
+ normalize?: boolean;
4
+ }
5
+ declare class EmbeddingService {
6
+ private pipePromise?;
7
+ private modelName;
8
+ private readonly EMBEDDING_DIMENSION;
9
+ private readonly DEFAULT_OPTIONS;
10
+ initialize(): Promise<void>;
11
+ generateEmbedding(text: string, options?: EmbeddingOptions): Promise<number[]>;
12
+ generateEmbeddings(texts: string[], options?: EmbeddingOptions): Promise<number[][]>;
13
+ getEmbeddingDimension(): number;
14
+ getModelName(): string;
15
+ }
16
+ export declare const embeddingService: EmbeddingService;
17
+ export {};
18
+ //# sourceMappingURL=embedding-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedding-service.d.ts","sourceRoot":"","sources":["../src/embedding-service.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,cAAM,gBAAgB;IAClB,OAAO,CAAC,WAAW,CAAC,CAAqC;IACzD,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAO;IAC3C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAG9B;IAEI,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B3B,iBAAiB,CACnB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC/B,OAAO,CAAC,MAAM,EAAE,CAAC;IA2Bd,kBAAkB,CACpB,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,GAAE,gBAAqB,GAC/B,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAWtB,qBAAqB,IAAI,MAAM;IAI/B,YAAY,IAAI,MAAM;CAGzB;AAED,eAAO,MAAM,gBAAgB,kBAAyB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { File } from '@eclipse-docks/core';
2
+ export interface DocumentExtractionOptions {
3
+ /** Include page numbers in extracted text (default: true for PDFs) */
4
+ includePageNumbers?: boolean;
5
+ /** Custom page separator (default: '\n\n') */
6
+ pageSeparator?: string;
7
+ /** File type hint (auto-detected from file extension if not provided) */
8
+ fileType?: string;
9
+ }
10
+ export interface IDocumentExtractor {
11
+ /**
12
+ * Checks if this extractor can handle the given file type.
13
+ * @param fileType The file type (extension) to check
14
+ * @returns true if this extractor can handle the file type
15
+ */
16
+ canExtract(fileType: string): boolean;
17
+ /**
18
+ * Extracts text content from a document file.
19
+ * @param file The file to extract text from
20
+ * @param options Optional extraction options
21
+ * @returns The extracted text content
22
+ * @throws Error if extraction fails or file contains no extractable text
23
+ */
24
+ extractText(file: File, options?: DocumentExtractionOptions): Promise<string>;
25
+ }
26
+ //# sourceMappingURL=document-extractor-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-extractor-interface.d.ts","sourceRoot":"","sources":["../../src/extractors/document-extractor-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,WAAW,yBAAyB;IACtC,sEAAsE;IACtE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IAC/B;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtC;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACjF"}
@@ -0,0 +1,13 @@
1
+ import { IDocumentExtractor, DocumentExtractionOptions } from './document-extractor-interface';
2
+ import { File } from '@eclipse-docks/core';
3
+ export type { IDocumentExtractor, DocumentExtractionOptions } from './document-extractor-interface';
4
+ export { PDFJSExtractor } from './pdfjs-extractor';
5
+ export { LLMOCRExtractor } from './llm-ocr-extractor';
6
+ export declare class DocumentExtractor implements IDocumentExtractor {
7
+ private extractors;
8
+ constructor();
9
+ canExtract(fileType: string): boolean;
10
+ extractText(file: File, options?: DocumentExtractionOptions): Promise<string>;
11
+ }
12
+ export declare const defaultDocumentExtractor: DocumentExtractor;
13
+ //# sourceMappingURL=document-extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-extractor.d.ts","sourceRoot":"","sources":["../../src/extractors/document-extractor.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAMtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AACpG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAIhD,qBAAa,iBAAkB,YAAW,kBAAkB;IACxD,OAAO,CAAC,UAAU,CAAuB;;IASzC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI/B,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC;CAyCtF;AAED,eAAO,MAAM,wBAAwB,mBAA0B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { File } from '@eclipse-docks/core';
2
+ import { IDocumentExtractor, DocumentExtractionOptions } from './document-extractor-interface';
3
+ /**
4
+ * LLM-based OCR extractor for document files using Mistral OCR.
5
+ *
6
+ * This extractor uses Mistral OCR API to perform OCR on document files,
7
+ * particularly useful for scanned documents or image-based files
8
+ * that cannot be processed by standard text extraction methods.
9
+ */
10
+ export declare class LLMOCRExtractor implements IDocumentExtractor {
11
+ canExtract(fileType: string): boolean;
12
+ extractText(file: File, options?: DocumentExtractionOptions): Promise<string>;
13
+ private blobToBase64;
14
+ private getMimeType;
15
+ }
16
+ //# sourceMappingURL=llm-ocr-extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-ocr-extractor.d.ts","sourceRoot":"","sources":["../../src/extractors/llm-ocr-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAKpG;;;;;;GAMG;AACH,qBAAa,eAAgB,YAAW,kBAAkB;IACtD,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI/B,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,MAAM,CAAC;YA6EzE,YAAY;IAa1B,OAAO,CAAC,WAAW;CAWtB"}
@@ -0,0 +1,7 @@
1
+ import { File } from '@eclipse-docks/core';
2
+ import { IDocumentExtractor, DocumentExtractionOptions } from './document-extractor-interface';
3
+ export declare class PDFJSExtractor implements IDocumentExtractor {
4
+ canExtract(fileType: string): boolean;
5
+ extractText(file: File, options?: DocumentExtractionOptions): Promise<string>;
6
+ }
7
+ //# sourceMappingURL=pdfjs-extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdfjs-extractor.d.ts","sourceRoot":"","sources":["../../src/extractors/pdfjs-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAIpG,qBAAa,cAAe,YAAW,kBAAkB;IACrD,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI/B,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,MAAM,CAAC;CAsD1F"}
@@ -0,0 +1,11 @@
1
+ //#region src/i18n.de.json
2
+ var EXT_RAG_SYSTEM_NAME = "RAG-System";
3
+ var EXT_RAG_SYSTEM_DESC = "Retrieval-Augmented Generation System für Dokumentenindizierung, Suche und Abruf";
4
+ var i18n_de_default = {
5
+ EXT_RAG_SYSTEM_NAME,
6
+ EXT_RAG_SYSTEM_DESC
7
+ };
8
+ //#endregion
9
+ export { EXT_RAG_SYSTEM_DESC, EXT_RAG_SYSTEM_NAME, i18n_de_default as default };
10
+
11
+ //# sourceMappingURL=i18n.de-C4Oy9SoE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.de-C4Oy9SoE.js","names":[],"sources":["../src/i18n.de.json"],"sourcesContent":["{\n \"EXT_RAG_SYSTEM_NAME\": \"RAG-System\",\n \"EXT_RAG_SYSTEM_DESC\": \"Retrieval-Augmented Generation System für Dokumentenindizierung, Suche und Abruf\"\n}\n"],"mappings":""}
@@ -0,0 +1,11 @@
1
+ //#region src/i18n.en.json
2
+ var EXT_RAG_SYSTEM_NAME = "RAG System";
3
+ var EXT_RAG_SYSTEM_DESC = "Retrieval-Augmented Generation system for document indexing, search and retrieval";
4
+ var i18n_en_default = {
5
+ EXT_RAG_SYSTEM_NAME,
6
+ EXT_RAG_SYSTEM_DESC
7
+ };
8
+ //#endregion
9
+ export { EXT_RAG_SYSTEM_DESC, EXT_RAG_SYSTEM_NAME, i18n_en_default as default };
10
+
11
+ //# sourceMappingURL=i18n.en-BGbyrXax.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.en-BGbyrXax.js","names":[],"sources":["../src/i18n.en.json"],"sourcesContent":["{\n \"EXT_RAG_SYSTEM_NAME\": \"RAG System\",\n \"EXT_RAG_SYSTEM_DESC\": \"Retrieval-Augmented Generation system for document indexing, search and retrieval\"\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import { extensionRegistry, i18n } from "@eclipse-docks/core";
2
+ import pkg from "../package.json";
3
+ //#region src/index.ts
4
+ var t = await i18n(/* @__PURE__ */ Object.assign({
5
+ "./i18n.de.json": () => import("./i18n.de-C4Oy9SoE.js"),
6
+ "./i18n.en.json": () => import("./i18n.en-BGbyrXax.js")
7
+ }), true);
8
+ extensionRegistry.registerExtension({
9
+ id: pkg.name,
10
+ name: t.EXT_RAG_SYSTEM_NAME,
11
+ description: t.EXT_RAG_SYSTEM_DESC,
12
+ loader: () => import("./rag-system-extension-CHeA4aaJ.js"),
13
+ icon: "database",
14
+ experimental: true,
15
+ dependencies: ["@eclipse-docks/extension-ai-system", "@eclipse-docks/extension-in-browser-ml"]
16
+ });
17
+ //#endregion
18
+
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry, i18n } from '@eclipse-docks/core';\nimport pkg from '../package.json';\n\nconst t = await i18n(import.meta.glob('./i18n*.json'), true);\n\nextensionRegistry.registerExtension({\n id: pkg.name,\n name: t.EXT_RAG_SYSTEM_NAME,\n description: t.EXT_RAG_SYSTEM_DESC,\n loader: () => import(\"./rag-system-extension\"),\n icon: \"database\",\n experimental: true,\n dependencies: [\"@eclipse-docks/extension-ai-system\", \"@eclipse-docks/extension-in-browser-ml\"],\n});\n"],"mappings":";;;AAGA,IAAM,IAAI,MAAM,KAAK,uBAAA,OAAA;CAAA,wBAAA,OAAA;CAAA,wBAAA,OAAA;CAAA,CAAgC,EAAE,KAAK;AAE5D,kBAAkB,kBAAkB;CAClC,IAAI,IAAI;CACR,MAAM,EAAE;CACR,aAAa,EAAE;CACf,cAAc,OAAO;CACrB,MAAM;CACN,cAAc;CACd,cAAc,CAAC,sCAAsC,yCAAA;CACtD,CAAC"}
@@ -0,0 +1,173 @@
1
+ import { a as getWorkspacePath, f as SEARCH_CONFIG, i as SnippetExtractor, n as searchWorkspaceDocuments, o as documentIndexService, r as RAGResultFormatter, t as ragService } from "./rag-service-DHsW5YrB.js";
2
+ import { createLogger, registerAll, rootContext } from "@eclipse-docks/core";
3
+ import { aiService } from "@eclipse-docks/extension-ai-system/api";
4
+ //#region src/rag-integration.ts
5
+ var logger = createLogger("RAGIntegration");
6
+ var resultFormatter = new RAGResultFormatter(new SnippetExtractor());
7
+ var ragPromptEnhancer = {
8
+ priority: 10,
9
+ async enhance(prompt, context) {
10
+ try {
11
+ if ((await documentIndexService.getStats()).totalDocuments === 0) return prompt;
12
+ return `${prompt}\n\nIMPORTANT: When a user mentions a specific file name or path:
13
+ 1. ALWAYS first check if the file is indexed using rag.checindexed with the file path
14
+ 2. If indexed: Use rag.search-documents with filePath parameter to get relevant content from the indexed document
15
+ 3. If not indexed: Read the file directly using file commands (cat_file, ls, etc.)
16
+
17
+ NEVER use filePath or fileName parameters in rag.search-documents without first verifying the file is indexed with rag.checindexed. If you use a non-indexed file path/name, the search will return no results.
18
+
19
+ For general searches (not specific files), use rag.search-documents with just the query parameter to search across all indexed documents. This is more efficient than reading files one by one.`;
20
+ } catch (error) {
21
+ logger.warn(`RAG enhancement failed: ${error}`);
22
+ return prompt;
23
+ }
24
+ }
25
+ };
26
+ function createRAGToolExecutor() {
27
+ return async (toolName, params) => {
28
+ if (toolName === "search_workspace_documents") {
29
+ const query = params.query || "";
30
+ const limit = Math.min(params.limit || SEARCH_CONFIG.DEFAULT_LIMIT, SEARCH_CONFIG.MAX_LIMIT);
31
+ const fileType = params.fileType;
32
+ const filePath = params.filePath;
33
+ const fileName = params.fileName;
34
+ const results = await searchWorkspaceDocuments(query, {
35
+ limit,
36
+ fileType,
37
+ filePath,
38
+ fileName,
39
+ documentSearchScope: params.includePaths || params.excludePaths || params.pathPattern ? {
40
+ includePaths: params.includePaths,
41
+ excludePaths: params.excludePaths,
42
+ pathPattern: params.pathPattern
43
+ } : void 0
44
+ });
45
+ return {
46
+ results: resultFormatter.formatSearchResults(results),
47
+ total: results.length
48
+ };
49
+ }
50
+ throw new Error(`Unknown RAG tool: ${toolName}`);
51
+ };
52
+ }
53
+ function registerRAGCommands() {
54
+ registerAll({
55
+ command: {
56
+ id: "rag.search-documents",
57
+ name: "Search Workspace Documents (RAG)",
58
+ description: "Search indexed workspace documents for relevant content. IMPORTANT: Only use filePath or fileName if you have already verified the file is indexed using rag.checindexed. If the file is not indexed, this will return no results.",
59
+ parameters: [
60
+ {
61
+ name: "query",
62
+ description: "Search query (optional if filePath or fileName is provided)",
63
+ required: false
64
+ },
65
+ {
66
+ name: "limit",
67
+ description: "Maximum number of results",
68
+ required: false
69
+ },
70
+ {
71
+ name: "fileType",
72
+ description: "Filter by file type",
73
+ required: false
74
+ },
75
+ {
76
+ name: "filePath",
77
+ description: "Exact file path to search (relative to workspace root). Only use if you verified the file is indexed with rag.checindexed.",
78
+ required: false
79
+ },
80
+ {
81
+ name: "fileName",
82
+ description: "File name to search for (partial match supported). Only use if you verified the file is indexed with rag.checindexed.",
83
+ required: false
84
+ }
85
+ ]
86
+ },
87
+ handler: {
88
+ canExecute: () => true,
89
+ execute: async (context) => {
90
+ const query = context.params?.query || "";
91
+ const limit = context.params?.limit ? Math.min(parseInt(context.params.limit), SEARCH_CONFIG.MAX_LIMIT) : SEARCH_CONFIG.DEFAULT_LIMIT;
92
+ const fileType = context.params?.fileType;
93
+ const filePath = context.params?.filePath;
94
+ const fileName = context.params?.fileName;
95
+ if (!query && !filePath && !fileName) throw new Error("Either query, filePath, or fileName parameter must be provided");
96
+ const results = await searchWorkspaceDocuments(query, {
97
+ limit,
98
+ fileType,
99
+ filePath,
100
+ fileName
101
+ });
102
+ if ((filePath || fileName) && results.length === 0) return {
103
+ query: query || (filePath ? `filePath: ${filePath}` : `fileName: ${fileName}`),
104
+ results: [],
105
+ warning: `No indexed document found for ${filePath ? `file path "${filePath}"` : `file name "${fileName}"`}. The file may not be indexed. Use rag.checindexed to verify if a file is indexed before searching.`
106
+ };
107
+ return {
108
+ query: query || (filePath ? `filePath: ${filePath}` : fileName ? `fileName: ${fileName}` : ""),
109
+ results: resultFormatter.formatCommandResults(results)
110
+ };
111
+ }
112
+ }
113
+ });
114
+ registerAll({
115
+ command: {
116
+ id: "rag.checindexed",
117
+ name: "Check if File is Indexed",
118
+ description: "Check if a specific file is indexed in the document index. Use this to determine if you should use RAG search or read the file directly.",
119
+ parameters: [{
120
+ name: "filePath",
121
+ description: "The file path to check (relative to workspace root)",
122
+ required: true
123
+ }]
124
+ },
125
+ handler: {
126
+ canExecute: () => true,
127
+ execute: async (context) => {
128
+ const filePath = context.params?.filePath;
129
+ if (!filePath) throw new Error("File path parameter required");
130
+ const workspaceResult = await getWorkspacePath();
131
+ if (!workspaceResult) return {
132
+ indexed: false,
133
+ reason: "No workspace connected"
134
+ };
135
+ const { workspacePath } = workspaceResult;
136
+ const document = await documentIndexService.getDocumentByPath(workspacePath, filePath);
137
+ if (document) return {
138
+ indexed: true,
139
+ filePath: document.filePath,
140
+ fileName: document.fileName,
141
+ fileType: document.fileType,
142
+ indexedAt: new Date(document.indexedAt).toISOString(),
143
+ size: document.metadata.size
144
+ };
145
+ return {
146
+ indexed: false,
147
+ filePath,
148
+ reason: "File not found in document index"
149
+ };
150
+ }
151
+ }
152
+ });
153
+ }
154
+ function integrateRAGWithAI() {
155
+ try {
156
+ registerRAGCommands();
157
+ const promptBuilder = aiService.promptBuilder;
158
+ if (promptBuilder && typeof promptBuilder.addEnhancer === "function") {
159
+ promptBuilder.addEnhancer(ragPromptEnhancer);
160
+ logger.info("RAG prompt enhancer and commands registered - AI will be instructed to use RAG before reading files");
161
+ } else {
162
+ logger.warn("AI service prompt builder not available yet, will retry");
163
+ setTimeout(() => integrateRAGWithAI(), 1e3);
164
+ }
165
+ } catch (error) {
166
+ logger.warn(`Failed to integrate RAG with AI: ${error}`);
167
+ }
168
+ }
169
+ rootContext.put("ragService", ragService);
170
+ //#endregion
171
+ export { registerRAGCommands as i, integrateRAGWithAI as n, ragPromptEnhancer as r, createRAGToolExecutor as t };
172
+
173
+ //# sourceMappingURL=rag-integration-CT4hgNjS.js.map