@eclipse-docks/extension-rag-system 0.8.13 → 0.8.14

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/api.js CHANGED
@@ -1,6 +1,6 @@
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-DjDVUi1M.js";
2
- import { i as registerRAGCommands, n as integrateRAGWithAI, r as ragPromptEnhancer, t as createRAGToolExecutor } from "./rag-integration-CfNqyIzq.js";
3
- //#region src/utils/context-scopes.ts
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-BBburEI_.js";
2
+ import { i as registerRAGCommands, n as integrateRAGWithAI, r as ragPromptEnhancer, t as createRAGToolExecutor } from "./rag-integration-BhZEKNsx.js";
3
+ // src/utils/context-scopes.ts
4
4
  function createEditorScope(openFiles) {
5
5
  return { includePaths: openFiles };
6
6
  }
@@ -42,7 +42,6 @@ function combineScopes(...scopes) {
42
42
  };
43
43
  return combined;
44
44
  }
45
- //#endregion
46
45
  export { combineScopes, cosineSimilarity, createDirectoryScope, createEditorScope, createFileTypeScope, createIndexValuesFromArray, createRAGToolExecutor, documentIndexService, embeddingService, euclideanDistance, getIndexValueArray, integrateRAGWithAI, ragPromptEnhancer, ragService, registerRAGCommands, searchWorkspaceDocuments };
47
46
 
48
47
  //# sourceMappingURL=api.js.map
@@ -1,11 +1,10 @@
1
- //#region src/i18n.de.json
1
+ // src/i18n.de.json
2
2
  var EXT_RAG_SYSTEM_NAME = "RAG-System";
3
3
  var EXT_RAG_SYSTEM_DESC = "Retrieval-Augmented Generation System für Dokumentenindizierung, Suche und Abruf";
4
4
  var i18n_de_default = {
5
5
  EXT_RAG_SYSTEM_NAME,
6
6
  EXT_RAG_SYSTEM_DESC
7
7
  };
8
- //#endregion
9
8
  export { EXT_RAG_SYSTEM_DESC, EXT_RAG_SYSTEM_NAME, i18n_de_default as default };
10
9
 
11
- //# sourceMappingURL=i18n.de-BlIlaOdb.js.map
10
+ //# sourceMappingURL=i18n.de-CHuG8V64.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.de-BlIlaOdb.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":""}
1
+ {"version":3,"file":"i18n.de-CHuG8V64.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":""}
@@ -1,11 +1,10 @@
1
- //#region src/i18n.en.json
1
+ // src/i18n.en.json
2
2
  var EXT_RAG_SYSTEM_NAME = "RAG System";
3
3
  var EXT_RAG_SYSTEM_DESC = "Retrieval-Augmented Generation system for document indexing, search and retrieval";
4
4
  var i18n_en_default = {
5
5
  EXT_RAG_SYSTEM_NAME,
6
6
  EXT_RAG_SYSTEM_DESC
7
7
  };
8
- //#endregion
9
8
  export { EXT_RAG_SYSTEM_DESC, EXT_RAG_SYSTEM_NAME, i18n_en_default as default };
10
9
 
11
- //# sourceMappingURL=i18n.en-gnDJyJge.js.map
10
+ //# sourceMappingURL=i18n.en-BqyP08om.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.en-gnDJyJge.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":""}
1
+ {"version":3,"file":"i18n.en-BqyP08om.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":""}
package/dist/index.js CHANGED
@@ -1,19 +1,18 @@
1
1
  import { extensionRegistry, i18n } from "@eclipse-docks/core";
2
2
  import pkg from "../package.json";
3
- //#region src/index.ts
3
+ // src/index.ts
4
4
  var t = await i18n(/* #__PURE__ */ Object.assign({
5
- "./i18n.de.json": () => import("./i18n.de-BlIlaOdb.js"),
6
- "./i18n.en.json": () => import("./i18n.en-gnDJyJge.js")
5
+ "./i18n.de.json": () => import("./i18n.de-CHuG8V64.js"),
6
+ "./i18n.en.json": () => import("./i18n.en-BqyP08om.js")
7
7
  }), true);
8
8
  extensionRegistry.registerExtension({
9
9
  id: pkg.name,
10
10
  name: t.EXT_RAG_SYSTEM_NAME,
11
11
  description: t.EXT_RAG_SYSTEM_DESC,
12
- loader: () => import("./rag-system-extension-Cl4De43B.js"),
12
+ loader: () => import("./rag-system-extension-BZp3UcFH.js"),
13
13
  icon: "database",
14
14
  experimental: true,
15
15
  dependencies: ["@eclipse-docks/extension-ai-system", "@eclipse-docks/extension-in-browser-ml"]
16
16
  });
17
- //#endregion
18
17
 
19
18
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
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-DjDVUi1M.js";
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-BBburEI_.js";
2
2
  import { createLogger, registerAll, rootContext } from "@eclipse-docks/core";
3
3
  import { cognitiveRuntime } from "@eclipse-docks/extension-ai-system/api";
4
- //#region src/rag-integration.ts
4
+ // src/rag-integration.ts
5
5
  var logger = createLogger("RAGIntegration");
6
6
  var resultFormatter = new RAGResultFormatter(new SnippetExtractor());
7
7
  var ragPromptEnhancer = async (prompt) => {
@@ -160,7 +160,6 @@ function integrateRAGWithAI() {
160
160
  }
161
161
  }
162
162
  rootContext.put("ragService", ragService);
163
- //#endregion
164
163
  export { registerRAGCommands as i, integrateRAGWithAI as n, ragPromptEnhancer as r, createRAGToolExecutor as t };
165
164
 
166
- //# sourceMappingURL=rag-integration-CfNqyIzq.js.map
165
+ //# sourceMappingURL=rag-integration-BhZEKNsx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rag-integration-CfNqyIzq.js","names":[],"sources":["../src/rag-integration.ts"],"sourcesContent":["import { ragService, searchWorkspaceDocuments } from './rag-service';\nimport { DocumentSearchScope } from './document-index-service';\nimport { documentIndexService } from './document-index-service';\nimport { getWorkspacePath } from './utils/workspace-utils';\nimport { rootContext } from '@eclipse-docks/core';\nimport { SEARCH_CONFIG } from './utils/constants';\nimport { RAGResultFormatter } from './services/rag-result-formatter';\nimport { SnippetExtractor } from './utils/snippet-extractor';\nimport { cognitiveRuntime, type SystemPromptEnhancer } from '@eclipse-docks/extension-ai-system/api';\nimport { commandRegistry, registerAll } from '@eclipse-docks/core';\nimport { createLogger } from '@eclipse-docks/core';\n\nconst logger = createLogger('RAGIntegration');\nconst resultFormatter = new RAGResultFormatter(new SnippetExtractor());\n\nexport const ragPromptEnhancer: SystemPromptEnhancer = async (prompt) => {\n try {\n const stats = await documentIndexService.getStats();\n if (stats.totalDocuments === 0) {\n return prompt;\n }\n\n const instruction = `IMPORTANT: When a user mentions a specific file name or path:\n1. ALWAYS first check if the file is indexed using rag.checindexed with the file path\n2. If indexed: Use rag.search-documents with filePath parameter to get relevant content from the indexed document\n3. If not indexed: Read the file directly using file commands (cat_file, ls, etc.)\n\nNEVER 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.\n\nFor 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.`;\n\n return `${prompt}\\n\\n${instruction}`;\n } catch (error) {\n logger.warn(`RAG enhancement failed: ${error}`);\n return prompt;\n }\n};\n\nexport function createRAGToolExecutor() {\n return async (toolName: string, params: any): Promise<any> => {\n if (toolName === 'search_workspace_documents') {\n const query = params.query || '';\n const limit = Math.min(params.limit || SEARCH_CONFIG.DEFAULT_LIMIT, SEARCH_CONFIG.MAX_LIMIT);\n const fileType = params.fileType;\n const filePath = params.filePath;\n const fileName = params.fileName;\n\n const documentSearchScope: DocumentSearchScope | undefined = \n (params.includePaths || params.excludePaths || params.pathPattern)\n ? {\n includePaths: params.includePaths,\n excludePaths: params.excludePaths,\n pathPattern: params.pathPattern\n }\n : undefined;\n\n const results = await searchWorkspaceDocuments(query, {\n limit,\n fileType,\n filePath,\n fileName,\n documentSearchScope\n });\n\n return {\n results: resultFormatter.formatSearchResults(results),\n total: results.length\n };\n }\n\n throw new Error(`Unknown RAG tool: ${toolName}`);\n };\n}\n\nexport function registerRAGCommands() {\n registerAll({\n command: {\n id: 'rag.search-documents',\n name: 'Search Workspace Documents (RAG)',\n 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.',\n parameters: [\n {\n name: 'query',\n description: 'Search query (optional if filePath or fileName is provided)',\n required: false\n },\n {\n name: 'limit',\n description: 'Maximum number of results',\n required: false\n },\n {\n name: 'fileType',\n description: 'Filter by file type',\n required: false\n },\n {\n name: 'filePath',\n description: 'Exact file path to search (relative to workspace root). Only use if you verified the file is indexed with rag.checindexed.',\n required: false\n },\n {\n name: 'fileName',\n description: 'File name to search for (partial match supported). Only use if you verified the file is indexed with rag.checindexed.',\n required: false\n }\n ]\n },\n handler: {\n canExecute: () => true,\n execute: async (context) => {\n const query = context.params?.query || '';\n const limit = context.params?.limit \n ? Math.min(parseInt(context.params.limit), SEARCH_CONFIG.MAX_LIMIT)\n : SEARCH_CONFIG.DEFAULT_LIMIT;\n const fileType = context.params?.fileType;\n const filePath = context.params?.filePath;\n const fileName = context.params?.fileName;\n\n if (!query && !filePath && !fileName) {\n throw new Error('Either query, filePath, or fileName parameter must be provided');\n }\n\n const results = await searchWorkspaceDocuments(query, {\n limit,\n fileType,\n filePath,\n fileName\n });\n\n if ((filePath || fileName) && results.length === 0) {\n return {\n query: query || (filePath ? `filePath: ${filePath}` : `fileName: ${fileName}`),\n results: [],\n 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.`\n };\n }\n\n return {\n query: query || (filePath ? `filePath: ${filePath}` : fileName ? `fileName: ${fileName}` : ''),\n results: resultFormatter.formatCommandResults(results)\n };\n }\n }\n });\n\n registerAll({\n command: {\n id: 'rag.checindexed',\n name: 'Check if File is Indexed',\n 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.',\n parameters: [\n {\n name: 'filePath',\n description: 'The file path to check (relative to workspace root)',\n required: true\n }\n ]\n },\n handler: {\n canExecute: () => true,\n execute: async (context) => {\n const filePath = context.params?.filePath;\n if (!filePath) {\n throw new Error('File path parameter required');\n }\n\n const workspaceResult = await getWorkspacePath();\n if (!workspaceResult) {\n return { indexed: false, reason: 'No workspace connected' };\n }\n\n const { workspacePath } = workspaceResult;\n const document = await documentIndexService.getDocumentByPath(workspacePath, filePath);\n\n if (document) {\n return {\n indexed: true,\n filePath: document.filePath,\n fileName: document.fileName,\n fileType: document.fileType,\n indexedAt: new Date(document.indexedAt).toISOString(),\n size: document.metadata.size\n };\n }\n\n return {\n indexed: false,\n filePath,\n reason: 'File not found in document index'\n };\n }\n }\n });\n}\n\nexport function integrateRAGWithAI() {\n try {\n registerRAGCommands();\n cognitiveRuntime.start();\n cognitiveRuntime.addSystemPromptEnhancer(ragPromptEnhancer);\n logger.info('RAG prompt enhancer and commands registered');\n } catch (error) {\n logger.warn(`Failed to integrate RAG with AI: ${error}`);\n }\n}\n\nrootContext.put('ragService', ragService);\n\n"],"mappings":";;;;AAYA,IAAM,SAAS,aAAa,gBAAgB;AAC5C,IAAM,kBAAkB,IAAI,mBAAmB,IAAI,iBAAiB,CAAC;AAErE,IAAa,oBAA0C,OAAO,WAAW;CACrE,IAAI;EAEA,KAAI,MADgB,qBAAqB,SAAS,EAAA,CACxC,mBAAmB,GACzB,OAAO;EAYX,OAAO,GAAG,OAAO;;;;;;;;CACrB,SAAS,OAAO;EACZ,OAAO,KAAK,2BAA2B,OAAO;EAC9C,OAAO;CACX;AACJ;AAEA,SAAgB,wBAAwB;CACpC,OAAO,OAAO,UAAkB,WAA8B;EAC1D,IAAI,aAAa,8BAA8B;GAC3C,MAAM,QAAQ,OAAO,SAAS;GAC9B,MAAM,QAAQ,KAAK,IAAI,OAAO,SAAS,cAAc,eAAe,cAAc,SAAS;GAC3F,MAAM,WAAW,OAAO;GACxB,MAAM,WAAW,OAAO;GACxB,MAAM,WAAW,OAAO;GAExB,MAAM,sBACD,OAAO,gBAAgB,OAAO,gBAAgB,OAAO,cAChD;IACE,cAAc,OAAO;IACrB,cAAc,OAAO;IACrB,aAAa,OAAO;GACxB,IACE,KAAA;GAEV,MAAM,UAAU,MAAM,yBAAyB,OAAO;IAClD;IACA;IACA;IACA;IACA;GACJ,CAAC;GAED,OAAO;IACH,SAAS,gBAAgB,oBAAoB,OAAO;IACpD,OAAO,QAAQ;GACnB;EACJ;EAEA,MAAM,IAAI,MAAM,qBAAqB,UAAU;CACnD;AACJ;AAEA,SAAgB,sBAAsB;CAClC,YAAY;EACR,SAAS;GACL,IAAI;GACJ,MAAM;GACN,aAAa;GACb,YAAY;IACR;KACI,MAAM;KACN,aAAa;KACb,UAAU;IACd;IACA;KACI,MAAM;KACN,aAAa;KACb,UAAU;IACd;IACA;KACI,MAAM;KACN,aAAa;KACb,UAAU;IACd;IACA;KACI,MAAM;KACN,a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qB,kBAAkB,eAAe,QAAQ;IAErF,IAAI,UACA,OAAO;KACH,SAAS;KACT,UAAU,SAAS;KACnB,UAAU,SAAS;KACnB,UAAU,SAAS;KACnB,WAAW,IAAI,KAAK,SAAS,SAAS,CAAC,CAAC,YAAY;KACpD,MAAM,SAAS,SAAS;IAC5B;IAGJ,OAAO;KACH,SAAS;KACT;KACA,QAAQ;IACZ;GACJ;EACJ;CACJ,CAAC;AACL;AAEA,SAAgB,qBAAqB;CACjC,IAAI;EACA,oBAAoB;EACpB,iBAAiB,MAAM;EACvB,iBAAiB,wBAAwB,iBAAiB;EAC1D,OAAO,KAAK,6CAA6C;CAC7D,SAAS,OAAO;EACZ,OAAO,KAAK,oCAAoC,OAAO;CAC3D;AACJ;AAEA,YAAY,IAAI,cAAc,UAAU"}
1
+ {"version":3,"file":"rag-integration-BhZEKNsx.js","names":[],"sources":["../src/rag-integration.ts"],"sourcesContent":["import { ragService, searchWorkspaceDocuments } from './rag-service';\nimport { DocumentSearchScope } from './document-index-service';\nimport { documentIndexService } from './document-index-service';\nimport { getWorkspacePath } from './utils/workspace-utils';\nimport { rootContext } from '@eclipse-docks/core';\nimport { SEARCH_CONFIG } from './utils/constants';\nimport { RAGResultFormatter } from './services/rag-result-formatter';\nimport { SnippetExtractor } from './utils/snippet-extractor';\nimport { cognitiveRuntime, type SystemPromptEnhancer } from '@eclipse-docks/extension-ai-system/api';\nimport { commandRegistry, registerAll } from '@eclipse-docks/core';\nimport { createLogger } from '@eclipse-docks/core';\n\nconst logger = createLogger('RAGIntegration');\nconst resultFormatter = new RAGResultFormatter(new SnippetExtractor());\n\nexport const ragPromptEnhancer: SystemPromptEnhancer = async (prompt) => {\n try {\n const stats = await documentIndexService.getStats();\n if (stats.totalDocuments === 0) {\n return prompt;\n }\n\n const instruction = `IMPORTANT: When a user mentions a specific file name or path:\n1. ALWAYS first check if the file is indexed using rag.checindexed with the file path\n2. If indexed: Use rag.search-documents with filePath parameter to get relevant content from the indexed document\n3. If not indexed: Read the file directly using file commands (cat_file, ls, etc.)\n\nNEVER 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.\n\nFor 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.`;\n\n return `${prompt}\\n\\n${instruction}`;\n } catch (error) {\n logger.warn(`RAG enhancement failed: ${error}`);\n return prompt;\n }\n};\n\nexport function createRAGToolExecutor() {\n return async (toolName: string, params: any): Promise<any> => {\n if (toolName === 'search_workspace_documents') {\n const query = params.query || '';\n const limit = Math.min(params.limit || SEARCH_CONFIG.DEFAULT_LIMIT, SEARCH_CONFIG.MAX_LIMIT);\n const fileType = params.fileType;\n const filePath = params.filePath;\n const fileName = params.fileName;\n\n const documentSearchScope: DocumentSearchScope | undefined = \n (params.includePaths || params.excludePaths || params.pathPattern)\n ? {\n includePaths: params.includePaths,\n excludePaths: params.excludePaths,\n pathPattern: params.pathPattern\n }\n : undefined;\n\n const results = await searchWorkspaceDocuments(query, {\n limit,\n fileType,\n filePath,\n fileName,\n documentSearchScope\n });\n\n return {\n results: resultFormatter.formatSearchResults(results),\n total: results.length\n };\n }\n\n throw new Error(`Unknown RAG tool: ${toolName}`);\n };\n}\n\nexport function registerRAGCommands() {\n registerAll({\n command: {\n id: 'rag.search-documents',\n name: 'Search Workspace Documents (RAG)',\n 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.',\n parameters: [\n {\n name: 'query',\n description: 'Search query (optional if filePath or fileName is provided)',\n required: false\n },\n {\n name: 'limit',\n description: 'Maximum number of results',\n required: false\n },\n {\n name: 'fileType',\n description: 'Filter by file type',\n required: false\n },\n {\n name: 'filePath',\n description: 'Exact file path to search (relative to workspace root). Only use if you verified the file is indexed with rag.checindexed.',\n required: false\n },\n {\n name: 'fileName',\n description: 'File name to search for (partial match supported). Only use if you verified the file is indexed with rag.checindexed.',\n required: false\n }\n ]\n },\n handler: {\n canExecute: () => true,\n execute: async (context) => {\n const query = context.params?.query || '';\n const limit = context.params?.limit \n ? Math.min(parseInt(context.params.limit), SEARCH_CONFIG.MAX_LIMIT)\n : SEARCH_CONFIG.DEFAULT_LIMIT;\n const fileType = context.params?.fileType;\n const filePath = context.params?.filePath;\n const fileName = context.params?.fileName;\n\n if (!query && !filePath && !fileName) {\n throw new Error('Either query, filePath, or fileName parameter must be provided');\n }\n\n const results = await searchWorkspaceDocuments(query, {\n limit,\n fileType,\n filePath,\n fileName\n });\n\n if ((filePath || fileName) && results.length === 0) {\n return {\n query: query || (filePath ? `filePath: ${filePath}` : `fileName: ${fileName}`),\n results: [],\n 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.`\n };\n }\n\n return {\n query: query || (filePath ? `filePath: ${filePath}` : fileName ? `fileName: ${fileName}` : ''),\n results: resultFormatter.formatCommandResults(results)\n };\n }\n }\n });\n\n registerAll({\n command: {\n id: 'rag.checindexed',\n name: 'Check if File is Indexed',\n 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.',\n parameters: [\n {\n name: 'filePath',\n description: 'The file path to check (relative to workspace root)',\n required: true\n }\n ]\n },\n handler: {\n canExecute: () => true,\n execute: async (context) => {\n const filePath = context.params?.filePath;\n if (!filePath) {\n throw new Error('File path parameter required');\n }\n\n const workspaceResult = await getWorkspacePath();\n if (!workspaceResult) {\n return { indexed: false, reason: 'No workspace connected' };\n }\n\n const { workspacePath } = workspaceResult;\n const document = await documentIndexService.getDocumentByPath(workspacePath, filePath);\n\n if (document) {\n return {\n indexed: true,\n filePath: document.filePath,\n fileName: document.fileName,\n fileType: document.fileType,\n indexedAt: new Date(document.indexedAt).toISOString(),\n size: document.metadata.size\n };\n }\n\n return {\n indexed: false,\n filePath,\n reason: 'File not found in document index'\n };\n }\n }\n });\n}\n\nexport function integrateRAGWithAI() {\n try {\n registerRAGCommands();\n cognitiveRuntime.start();\n cognitiveRuntime.addSystemPromptEnhancer(ragPromptEnhancer);\n logger.info('RAG prompt enhancer and commands registered');\n } catch (error) {\n logger.warn(`Failed to integrate RAG with AI: ${error}`);\n }\n}\n\nrootContext.put('ragService', ragService);\n\n"],"mappings":";;;;AAYA,IAAM,SAAS,aAAa,gBAAgB;AAC5C,IAAM,kBAAkB,IAAI,mBAAmB,IAAI,iBAAiB,CAAC;AAErE,IAAa,oBAA0C,OAAO,WAAW;CACrE,IAAI;EAEA,KAAI,MADgB,qBAAqB,SAAS,EAAA,CACxC,mBAAmB,GACzB,OAAO;EAYX,OAAO,GAAG,OAAO;;;;;;;;CACrB,SAAS,OAAO;EACZ,OAAO,KAAK,2BAA2B,OAAO;EAC9C,OAAO;CACX;AACJ;AAEA,SAAgB,wBAAwB;CACpC,OAAO,OAAO,UAAkB,WAA8B;EAC1D,IAAI,aAAa,8BAA8B;GAC3C,MAAM,QAAQ,OAAO,SAAS;GAC9B,MAAM,QAAQ,KAAK,IAAI,OAAO,SAAS,cAAc,eAAe,cAAc,SAAS;GAC3F,MAAM,WAAW,OAAO;GACxB,MAAM,WAAW,OAAO;GACxB,MAAM,WAAW,OAAO;GAExB,MAAM,sBACD,OAAO,gBAAgB,OAAO,gBAAgB,OAAO,cAChD;IACE,cAAc,OAAO;IACrB,cAAc,OAAO;IACrB,aAAa,OAAO;GACxB,IACE,KAAA;GAEV,MAAM,UAAU,MAAM,yBAAyB,OAAO;IAClD;IACA;IACA;IACA;IACA;GACJ,CAAC;GAED,OAAO;IACH,SAAS,gBAAgB,oBAAoB,OAAO;IACpD,OAAO,QAAQ;GACnB;EACJ;EAEA,MAAM,IAAI,MAAM,qBAAqB,UAAU;CACnD;AACJ;AAEA,SAAgB,sBAAsB;CAClC,YAAY;EACR,SAAS;GACL,IAAI;GACJ,MAAM;GACN,aAAa;GACb,YAAY;IACR;KACI,MAAM;KACN,aAAa;KACb,UAAU;IACd;I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C,iBACD,OAAO;KAAE,SAAS;KAAO,QAAQ;IAAyB;IAG9D,MAAM,EAAE,kBAAkB;IAC1B,MAAM,WAAW,MAAM,qBAAqB,kBAAkB,eAAe,QAAQ;IAErF,IAAI,UACA,OAAO;KACH,SAAS;KACT,UAAU,SAAS;KACnB,UAAU,SAAS;KACnB,UAAU,SAAS;KACnB,WAAW,IAAI,KAAK,SAAS,SAAS,CAAC,CAAC,YAAY;KACpD,MAAM,SAAS,SAAS;IAC5B;IAGJ,OAAO;KACH,SAAS;KACT;KACA,QAAQ;IACZ;GACJ;EACJ;CACJ,CAAC;AACL;AAEA,SAAgB,qBAAqB;CACjC,IAAI;EACA,oBAAoB;EACpB,iBAAiB,MAAM;EACvB,iBAAiB,wBAAwB,iBAAiB;EAC1D,OAAO,KAAK,6CAA6C;CAC7D,SAAS,OAAO;EACZ,OAAO,KAAK,oCAAoC,OAAO;CAC3D;AACJ;AAEA,YAAY,IAAI,cAAc,UAAU"}
@@ -0,0 +1 @@
1
+ export { n as integrateRAGWithAI } from "./rag-integration-BhZEKNsx.js";
@@ -1,7 +1,7 @@
1
1
  import { Directory, File, FileContentType, TOPIC_WORKSPACE_CHANGED, TOPIC_WORKSPACE_CONNECTED, createLogger, rootContext, subscribe, toastWarning, workspaceService } from "@eclipse-docks/core";
2
2
  import { MLModel, MLTask, inBrowserMLService } from "@eclipse-docks/extension-in-browser-ml/api";
3
3
  import { cognitiveRuntime, parseModelIds } from "@eclipse-docks/extension-ai-system/api";
4
- //#region src/embedding-service.ts
4
+ // src/embedding-service.ts
5
5
  var logger$8 = createLogger("EmbeddingService");
6
6
  var EmbeddingService = class {
7
7
  constructor() {
@@ -69,8 +69,7 @@ var EmbeddingService = class {
69
69
  }
70
70
  };
71
71
  var embeddingService = new EmbeddingService();
72
- //#endregion
73
- //#region src/utils/constants.ts
72
+ // src/utils/constants.ts
74
73
  var SNIPPET_LENGTHS = {
75
74
  DEFAULT: 400,
76
75
  PREVIEW: 500,
@@ -110,8 +109,7 @@ var CONTENT_PREVIEW_LENGTHS = {
110
109
  MEDIUM: 500,
111
110
  LONG: 1e3
112
111
  };
113
- //#endregion
114
- //#region src/vector-utils.ts
112
+ // src/vector-utils.ts
115
113
  function euclideanDistance(vec1, vec2) {
116
114
  if (vec1.length !== vec2.length) throw new Error(`Vector dimensions must match: ${vec1.length} vs ${vec2.length}`);
117
115
  let sum = 0;
@@ -174,8 +172,7 @@ function cosineSimilarity(vec1, vec2) {
174
172
  if (denominator === 0) return 0;
175
173
  return dotProduct / denominator;
176
174
  }
177
- //#endregion
178
- //#region src/chunkers/fallback-chunker.ts
175
+ // src/chunkers/fallback-chunker.ts
179
176
  var DEFAULT_CHUNK_SIZE$1 = 500;
180
177
  var DEFAULT_CHUNK_OVERLAP$1 = 50;
181
178
  var DEFAULT_MIN_CHUNK_SIZE = 100;
@@ -229,8 +226,7 @@ var FallbackChunker = class {
229
226
  return context;
230
227
  }
231
228
  };
232
- //#endregion
233
- //#region src/chunkers/langchain-chunker.ts
229
+ // src/chunkers/langchain-chunker.ts
234
230
  var logger$7 = createLogger("LangChainChunker");
235
231
  var DEFAULT_CHUNK_SIZE = 500;
236
232
  var DEFAULT_CHUNK_OVERLAP = 75;
@@ -329,8 +325,7 @@ var LangChainChunker = class {
329
325
  return context;
330
326
  }
331
327
  };
332
- //#endregion
333
- //#region src/chunkers/document-chunker.ts
328
+ // src/chunkers/document-chunker.ts
334
329
  var logger$6 = createLogger("DocumentChunker");
335
330
  var DocumentChunker = class {
336
331
  constructor(options = {}) {
@@ -356,8 +351,7 @@ var DocumentChunker = class {
356
351
  }
357
352
  };
358
353
  new DocumentChunker();
359
- //#endregion
360
- //#region src/extractors/pdfjs-extractor.ts
354
+ // src/extractors/pdfjs-extractor.ts
361
355
  var logger$5 = createLogger("PDFJSExtractor");
362
356
  var PDFJSExtractor = class {
363
357
  canExtract(fileType) {
@@ -393,8 +387,7 @@ var PDFJSExtractor = class {
393
387
  }
394
388
  }
395
389
  };
396
- //#endregion
397
- //#region src/extractors/llm-ocr-extractor.ts
390
+ // src/extractors/llm-ocr-extractor.ts
398
391
  var logger$4 = createLogger("LLMOCRExtractor");
399
392
  var DEFAULT_MISTRAL_OCR = "https://api.mistral.ai/v1/ocr";
400
393
  /**
@@ -486,8 +479,7 @@ var LLMOCRExtractor = class {
486
479
  }[fileType.toLowerCase()] || "application/octet-stream";
487
480
  }
488
481
  };
489
- //#endregion
490
- //#region src/extractors/document-extractor.ts
482
+ // src/extractors/document-extractor.ts
491
483
  var logger$3 = createLogger("DocumentExtractor");
492
484
  var DocumentExtractor = class {
493
485
  constructor() {
@@ -534,8 +526,7 @@ var DocumentExtractor = class {
534
526
  }
535
527
  };
536
528
  new DocumentExtractor();
537
- //#endregion
538
- //#region src/rxdb-loader.ts
529
+ // src/rxdb-loader.ts
539
530
  var rxdbModulesPromise = null;
540
531
  var pluginsRegistered = false;
541
532
  async function importRxdbModules() {
@@ -562,8 +553,7 @@ async function getRxDbModules() {
562
553
  });
563
554
  return rxdbModulesPromise;
564
555
  }
565
- //#endregion
566
- //#region src/document-index-service.ts
556
+ // src/document-index-service.ts
567
557
  var logger$2 = createLogger("DocumentIndexService");
568
558
  var DocumentIndexService = class {
569
559
  constructor() {
@@ -1261,8 +1251,7 @@ var DocumentIndexService = class {
1261
1251
  };
1262
1252
  var documentIndexService = new DocumentIndexService();
1263
1253
  rootContext.put("documentIndexService", documentIndexService);
1264
- //#endregion
1265
- //#region src/utils/workspace-utils.ts
1254
+ // src/utils/workspace-utils.ts
1266
1255
  var logger$1 = createLogger("WorkspaceUtils");
1267
1256
  async function getWorkspacePath(providedPath) {
1268
1257
  const workspace = await workspaceService.getWorkspace();
@@ -1280,8 +1269,7 @@ async function getWorkspacePath(providedPath) {
1280
1269
  workspacePath
1281
1270
  };
1282
1271
  }
1283
- //#endregion
1284
- //#region src/utils/query-utils.ts
1272
+ // src/utils/query-utils.ts
1285
1273
  var DEFAULT_MIN_TERM_LENGTH = 2;
1286
1274
  function extractQueryTerms(query, options = {}) {
1287
1275
  if (!query || !query.trim()) return [];
@@ -1291,8 +1279,7 @@ function extractQueryTerms(query, options = {}) {
1291
1279
  function normalizeQuery(query) {
1292
1280
  return query.toLowerCase().trim();
1293
1281
  }
1294
- //#endregion
1295
- //#region src/utils/snippet-extractor.ts
1282
+ // src/utils/snippet-extractor.ts
1296
1283
  var DEFAULT_MAX_SNIPPETS = 10;
1297
1284
  var DEFAULT_SNIPPET_LENGTH = 400;
1298
1285
  var DEFAULT_MIN_GAP = 400;
@@ -1408,8 +1395,7 @@ var SnippetExtractor = class {
1408
1395
  }
1409
1396
  };
1410
1397
  new SnippetExtractor();
1411
- //#endregion
1412
- //#region src/services/relevance-calculator.ts
1398
+ // src/services/relevance-calculator.ts
1413
1399
  var RelevanceCalculator = class {
1414
1400
  calculateRelevance(doc, query) {
1415
1401
  const queryLower = normalizeQuery(query);
@@ -1443,8 +1429,7 @@ var RelevanceCalculator = class {
1443
1429
  }
1444
1430
  };
1445
1431
  var relevanceCalculator = new RelevanceCalculator();
1446
- //#endregion
1447
- //#region src/services/rag-result-formatter.ts
1432
+ // src/services/rag-result-formatter.ts
1448
1433
  var RAGResultFormatter = class {
1449
1434
  constructor(snippetExtractor) {
1450
1435
  this.snippetExtractor = snippetExtractor;
@@ -1484,8 +1469,7 @@ Use the information from these documents to provide a helpful answer. Pay specia
1484
1469
  }));
1485
1470
  }
1486
1471
  };
1487
- //#endregion
1488
- //#region src/rag-service.ts
1472
+ // src/rag-service.ts
1489
1473
  var logger = createLogger("RAGService");
1490
1474
  var snippetExtractor = new SnippetExtractor();
1491
1475
  var resultFormatter = new RAGResultFormatter(snippetExtractor);
@@ -1650,7 +1634,6 @@ async function searchWorkspaceDocuments(query, options = {}) {
1650
1634
  workspacePath: workspaceResult.workspacePath
1651
1635
  });
1652
1636
  }
1653
- //#endregion
1654
1637
  export { getWorkspacePath as a, createIndexValuesFromArray as c, CONTENT_PREVIEW_LENGTHS as d, SEARCH_CONFIG as f, SnippetExtractor as i, euclideanDistance as l, embeddingService as m, searchWorkspaceDocuments as n, documentIndexService as o, SNIPPET_LENGTHS as p, RAGResultFormatter as r, cosineSimilarity as s, ragService as t, getIndexValueArray as u };
1655
1638
 
1656
- //# sourceMappingURL=rag-service-DjDVUi1M.js.map
1639
+ //# sourceMappingURL=rag-service-BBburEI_.js.map