rag-lite-ts 1.0.2 → 2.0.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/README.md +606 -93
- package/dist/cli/indexer.js +192 -4
- package/dist/cli/search.js +50 -11
- package/dist/cli.js +183 -26
- package/dist/core/abstract-embedder.d.ts +125 -0
- package/dist/core/abstract-embedder.js +264 -0
- package/dist/core/actionable-error-messages.d.ts +60 -0
- package/dist/core/actionable-error-messages.js +397 -0
- package/dist/core/batch-processing-optimizer.d.ts +155 -0
- package/dist/core/batch-processing-optimizer.js +541 -0
- package/dist/core/chunker.d.ts +2 -0
- package/dist/core/cli-database-utils.d.ts +53 -0
- package/dist/core/cli-database-utils.js +239 -0
- package/dist/core/config.js +10 -3
- package/dist/core/content-errors.d.ts +111 -0
- package/dist/core/content-errors.js +362 -0
- package/dist/core/content-manager.d.ts +343 -0
- package/dist/core/content-manager.js +1504 -0
- package/dist/core/content-performance-optimizer.d.ts +150 -0
- package/dist/core/content-performance-optimizer.js +516 -0
- package/dist/core/content-resolver.d.ts +104 -0
- package/dist/core/content-resolver.js +285 -0
- package/dist/core/cross-modal-search.d.ts +164 -0
- package/dist/core/cross-modal-search.js +342 -0
- package/dist/core/database-connection-manager.d.ts +109 -0
- package/dist/core/database-connection-manager.js +304 -0
- package/dist/core/db.d.ts +141 -2
- package/dist/core/db.js +631 -89
- package/dist/core/embedder-factory.d.ts +176 -0
- package/dist/core/embedder-factory.js +338 -0
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.js +4 -1
- package/dist/core/ingestion.d.ts +85 -15
- package/dist/core/ingestion.js +510 -45
- package/dist/core/lazy-dependency-loader.d.ts +152 -0
- package/dist/core/lazy-dependency-loader.js +453 -0
- package/dist/core/mode-detection-service.d.ts +150 -0
- package/dist/core/mode-detection-service.js +565 -0
- package/dist/core/mode-model-validator.d.ts +92 -0
- package/dist/core/mode-model-validator.js +203 -0
- package/dist/core/model-registry.d.ts +120 -0
- package/dist/core/model-registry.js +415 -0
- package/dist/core/model-validator.d.ts +217 -0
- package/dist/core/model-validator.js +782 -0
- package/dist/core/polymorphic-search-factory.d.ts +154 -0
- package/dist/core/polymorphic-search-factory.js +344 -0
- package/dist/core/raglite-paths.d.ts +121 -0
- package/dist/core/raglite-paths.js +145 -0
- package/dist/core/reranking-config.d.ts +42 -0
- package/dist/core/reranking-config.js +156 -0
- package/dist/core/reranking-factory.d.ts +92 -0
- package/dist/core/reranking-factory.js +591 -0
- package/dist/core/reranking-strategies.d.ts +325 -0
- package/dist/core/reranking-strategies.js +720 -0
- package/dist/core/resource-cleanup.d.ts +163 -0
- package/dist/core/resource-cleanup.js +371 -0
- package/dist/core/resource-manager.d.ts +212 -0
- package/dist/core/resource-manager.js +564 -0
- package/dist/core/search.d.ts +28 -1
- package/dist/core/search.js +83 -5
- package/dist/core/streaming-operations.d.ts +145 -0
- package/dist/core/streaming-operations.js +409 -0
- package/dist/core/types.d.ts +3 -0
- package/dist/core/universal-embedder.d.ts +177 -0
- package/dist/core/universal-embedder.js +139 -0
- package/dist/core/validation-messages.d.ts +99 -0
- package/dist/core/validation-messages.js +334 -0
- package/dist/core/vector-index.js +7 -8
- package/dist/factories/index.d.ts +1 -1
- package/dist/factories/text-factory.d.ts +128 -34
- package/dist/factories/text-factory.js +346 -97
- package/dist/file-processor.d.ts +88 -2
- package/dist/file-processor.js +720 -17
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -0
- package/dist/ingestion.d.ts +16 -0
- package/dist/ingestion.js +21 -0
- package/dist/mcp-server.d.ts +35 -3
- package/dist/mcp-server.js +1107 -31
- package/dist/multimodal/clip-embedder.d.ts +314 -0
- package/dist/multimodal/clip-embedder.js +945 -0
- package/dist/multimodal/index.d.ts +6 -0
- package/dist/multimodal/index.js +6 -0
- package/dist/run-error-recovery-tests.d.ts +7 -0
- package/dist/run-error-recovery-tests.js +101 -0
- package/dist/search.d.ts +26 -0
- package/dist/search.js +54 -1
- package/dist/test-utils.d.ts +8 -26
- package/dist/text/chunker.d.ts +1 -0
- package/dist/text/embedder.js +15 -8
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.js +1 -0
- package/dist/text/reranker.d.ts +1 -2
- package/dist/text/reranker.js +17 -47
- package/dist/text/sentence-transformer-embedder.d.ts +96 -0
- package/dist/text/sentence-transformer-embedder.js +340 -0
- package/dist/types.d.ts +39 -0
- package/dist/utils/vector-math.d.ts +31 -0
- package/dist/utils/vector-math.js +70 -0
- package/package.json +15 -3
- package/dist/api-errors.d.ts.map +0 -1
- package/dist/api-errors.js.map +0 -1
- package/dist/cli/indexer.d.ts.map +0 -1
- package/dist/cli/indexer.js.map +0 -1
- package/dist/cli/search.d.ts.map +0 -1
- package/dist/cli/search.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/core/adapters.d.ts.map +0 -1
- package/dist/core/adapters.js.map +0 -1
- package/dist/core/chunker.d.ts.map +0 -1
- package/dist/core/chunker.js.map +0 -1
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js.map +0 -1
- package/dist/core/db.d.ts.map +0 -1
- package/dist/core/db.js.map +0 -1
- package/dist/core/error-handler.d.ts.map +0 -1
- package/dist/core/error-handler.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/ingestion.d.ts.map +0 -1
- package/dist/core/ingestion.js.map +0 -1
- package/dist/core/interfaces.d.ts.map +0 -1
- package/dist/core/interfaces.js.map +0 -1
- package/dist/core/path-manager.d.ts.map +0 -1
- package/dist/core/path-manager.js.map +0 -1
- package/dist/core/search-example.d.ts +0 -25
- package/dist/core/search-example.d.ts.map +0 -1
- package/dist/core/search-example.js +0 -138
- package/dist/core/search-example.js.map +0 -1
- package/dist/core/search-pipeline-example.d.ts +0 -21
- package/dist/core/search-pipeline-example.d.ts.map +0 -1
- package/dist/core/search-pipeline-example.js +0 -188
- package/dist/core/search-pipeline-example.js.map +0 -1
- package/dist/core/search-pipeline.d.ts.map +0 -1
- package/dist/core/search-pipeline.js.map +0 -1
- package/dist/core/search.d.ts.map +0 -1
- package/dist/core/search.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/core/vector-index.d.ts.map +0 -1
- package/dist/core/vector-index.js.map +0 -1
- package/dist/dom-polyfills.d.ts.map +0 -1
- package/dist/dom-polyfills.js.map +0 -1
- package/dist/examples/clean-api-examples.d.ts +0 -44
- package/dist/examples/clean-api-examples.d.ts.map +0 -1
- package/dist/examples/clean-api-examples.js +0 -206
- package/dist/examples/clean-api-examples.js.map +0 -1
- package/dist/factories/index.d.ts.map +0 -1
- package/dist/factories/index.js.map +0 -1
- package/dist/factories/text-factory.d.ts.map +0 -1
- package/dist/factories/text-factory.js.map +0 -1
- package/dist/file-processor.d.ts.map +0 -1
- package/dist/file-processor.js.map +0 -1
- package/dist/index-manager.d.ts.map +0 -1
- package/dist/index-manager.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/indexer.d.ts.map +0 -1
- package/dist/indexer.js.map +0 -1
- package/dist/ingestion.d.ts.map +0 -1
- package/dist/ingestion.js.map +0 -1
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js.map +0 -1
- package/dist/preprocess.d.ts.map +0 -1
- package/dist/preprocess.js.map +0 -1
- package/dist/preprocessors/index.d.ts.map +0 -1
- package/dist/preprocessors/index.js.map +0 -1
- package/dist/preprocessors/mdx.d.ts.map +0 -1
- package/dist/preprocessors/mdx.js.map +0 -1
- package/dist/preprocessors/mermaid.d.ts.map +0 -1
- package/dist/preprocessors/mermaid.js.map +0 -1
- package/dist/preprocessors/registry.d.ts.map +0 -1
- package/dist/preprocessors/registry.js.map +0 -1
- package/dist/search-standalone.d.ts.map +0 -1
- package/dist/search-standalone.js.map +0 -1
- package/dist/search.d.ts.map +0 -1
- package/dist/search.js.map +0 -1
- package/dist/test-utils.d.ts.map +0 -1
- package/dist/test-utils.js.map +0 -1
- package/dist/text/chunker.d.ts.map +0 -1
- package/dist/text/chunker.js.map +0 -1
- package/dist/text/embedder.d.ts.map +0 -1
- package/dist/text/embedder.js.map +0 -1
- package/dist/text/index.d.ts.map +0 -1
- package/dist/text/index.js.map +0 -1
- package/dist/text/preprocessors/index.d.ts.map +0 -1
- package/dist/text/preprocessors/index.js.map +0 -1
- package/dist/text/preprocessors/mdx.d.ts.map +0 -1
- package/dist/text/preprocessors/mdx.js.map +0 -1
- package/dist/text/preprocessors/mermaid.d.ts.map +0 -1
- package/dist/text/preprocessors/mermaid.js.map +0 -1
- package/dist/text/preprocessors/registry.d.ts.map +0 -1
- package/dist/text/preprocessors/registry.js.map +0 -1
- package/dist/text/reranker.d.ts.map +0 -1
- package/dist/text/reranker.js.map +0 -1
- package/dist/text/tokenizer.d.ts.map +0 -1
- package/dist/text/tokenizer.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CORE MODULE — Mode Detection Service for Chameleon Architecture
|
|
3
|
+
* Handles automatic mode detection from database and provides default configurations
|
|
4
|
+
* Supports graceful error handling and fallback to text mode
|
|
5
|
+
* Enhanced with shared database connection management to prevent locking issues
|
|
6
|
+
*/
|
|
7
|
+
import type { DatabaseConnection } from './db.js';
|
|
8
|
+
import type { SystemInfo, ModeType, ModelType } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Service for detecting and storing system mode configuration
|
|
11
|
+
* Provides automatic mode detection from database with graceful error handling
|
|
12
|
+
* Uses shared database connections to prevent locking issues
|
|
13
|
+
*/
|
|
14
|
+
export declare class ModeDetectionService {
|
|
15
|
+
private dbPath;
|
|
16
|
+
constructor(dbPath: string);
|
|
17
|
+
/**
|
|
18
|
+
* Detects the current system mode from the database
|
|
19
|
+
* Falls back to default text mode configuration for new installations
|
|
20
|
+
* Enhanced with comprehensive error handling and recovery mechanisms
|
|
21
|
+
* Uses shared database connections to prevent locking issues
|
|
22
|
+
*
|
|
23
|
+
* @param existingConnection - Optional existing connection to reuse
|
|
24
|
+
* @returns Promise resolving to SystemInfo with current or default configuration
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const modeService = new ModeDetectionService('./db.sqlite');
|
|
29
|
+
* const systemInfo = await modeService.detectMode();
|
|
30
|
+
* console.log(`Current mode: ${systemInfo.mode}`);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
detectMode(existingConnection?: DatabaseConnection): Promise<SystemInfo>;
|
|
34
|
+
/**
|
|
35
|
+
* Stores system mode configuration in the database
|
|
36
|
+
* Creates or updates the system_info table with the provided configuration
|
|
37
|
+
* Uses shared database connections to prevent locking issues
|
|
38
|
+
*
|
|
39
|
+
* @param systemInfo - SystemInfo object to store (can be partial for updates)
|
|
40
|
+
* @param existingConnection - Optional existing connection to reuse
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const modeService = new ModeDetectionService('./db.sqlite');
|
|
45
|
+
* await modeService.storeMode({
|
|
46
|
+
* mode: 'multimodal',
|
|
47
|
+
* modelName: 'Xenova/clip-vit-base-patch32',
|
|
48
|
+
* modelType: 'clip',
|
|
49
|
+
* modelDimensions: 512,
|
|
50
|
+
* supportedContentTypes: ['text', 'image'],
|
|
51
|
+
* rerankingStrategy: 'text-derived'
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
storeMode(systemInfo: Partial<SystemInfo>, existingConnection?: DatabaseConnection): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the current mode from the database (convenience method)
|
|
58
|
+
* @returns Promise resolving to the current mode string
|
|
59
|
+
*/
|
|
60
|
+
getCurrentMode(): Promise<ModeType>;
|
|
61
|
+
/**
|
|
62
|
+
* Checks if the system is in multimodal mode
|
|
63
|
+
* @returns Promise resolving to boolean indicating multimodal mode
|
|
64
|
+
*/
|
|
65
|
+
isMultimodalMode(): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Gets complete model information from the database
|
|
68
|
+
* @returns Promise resolving to current model configuration
|
|
69
|
+
*/
|
|
70
|
+
getCurrentModelInfo(): Promise<{
|
|
71
|
+
modelName: string;
|
|
72
|
+
modelType: ModelType;
|
|
73
|
+
dimensions: number;
|
|
74
|
+
supportedContentTypes: string[];
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Get default system info for new installations
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
private getDefaultSystemInfo;
|
|
81
|
+
/**
|
|
82
|
+
* Check database file accessibility
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
private checkDatabaseAccessibility;
|
|
86
|
+
/**
|
|
87
|
+
* Verify database schema integrity
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
private verifySchemaIntegrity;
|
|
91
|
+
/**
|
|
92
|
+
* Ensure database schema exists
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
private ensureSchemaExists;
|
|
96
|
+
/**
|
|
97
|
+
* Handle detection errors with fallback to default configuration
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
private handleDetectionError;
|
|
101
|
+
/**
|
|
102
|
+
* Log error-specific guidance for users
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
private logErrorGuidance;
|
|
106
|
+
/**
|
|
107
|
+
* Enhances storage errors with more context and helpful suggestions
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
private enhanceStorageError;
|
|
111
|
+
/**
|
|
112
|
+
* Validate complete system info object
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
private validateSystemInfo;
|
|
116
|
+
/**
|
|
117
|
+
* Validate mode value
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
private validateMode;
|
|
121
|
+
/**
|
|
122
|
+
* Validate model type value
|
|
123
|
+
* @private
|
|
124
|
+
*/
|
|
125
|
+
private validateModelType;
|
|
126
|
+
/**
|
|
127
|
+
* Validate reranking strategy value
|
|
128
|
+
* @private
|
|
129
|
+
*/
|
|
130
|
+
private validateRerankingStrategy;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Quick function to detect mode from database
|
|
134
|
+
* @param dbPath - Path to database file
|
|
135
|
+
* @returns Promise resolving to SystemInfo
|
|
136
|
+
*/
|
|
137
|
+
export declare function detectSystemMode(dbPath: string): Promise<SystemInfo>;
|
|
138
|
+
/**
|
|
139
|
+
* Quick function to store mode configuration
|
|
140
|
+
* @param dbPath - Path to database file
|
|
141
|
+
* @param systemInfo - System configuration to store
|
|
142
|
+
*/
|
|
143
|
+
export declare function storeSystemMode(dbPath: string, systemInfo: Partial<SystemInfo>): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Quick function to check if system is in multimodal mode
|
|
146
|
+
* @param dbPath - Path to database file
|
|
147
|
+
* @returns Promise resolving to boolean
|
|
148
|
+
*/
|
|
149
|
+
export declare function isMultimodalMode(dbPath: string): Promise<boolean>;
|
|
150
|
+
//# sourceMappingURL=mode-detection-service.d.ts.map
|