converse-mcp-server 1.11.0 → 1.11.1
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/package.json +1 -1
- package/src/utils/contextProcessor.js +16 -56
package/package.json
CHANGED
|
@@ -30,14 +30,8 @@ export class ContextProcessorError extends Error {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Supported
|
|
33
|
+
* Supported image extensions (everything else is treated as text)
|
|
34
34
|
*/
|
|
35
|
-
const SUPPORTED_TEXT_EXTENSIONS = [
|
|
36
|
-
'.txt', '.md', '.js', '.ts', '.json', '.yaml', '.yml',
|
|
37
|
-
'.py', '.java', '.c', '.cpp', '.h', '.css', '.html',
|
|
38
|
-
'.xml', '.csv', '.sql', '.sh', '.bat', '.log'
|
|
39
|
-
];
|
|
40
|
-
|
|
41
35
|
const SUPPORTED_IMAGE_EXTENSIONS = [
|
|
42
36
|
'.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp'
|
|
43
37
|
];
|
|
@@ -164,21 +158,7 @@ export async function processFileContent(filePath, options = {}) {
|
|
|
164
158
|
const maxTextSize = options.maxTextSize || 1024 * 1024; // 1MB default
|
|
165
159
|
const maxImageSize = options.maxImageSize || 10 * 1024 * 1024; // 10MB default
|
|
166
160
|
|
|
167
|
-
if (
|
|
168
|
-
result.type = 'text';
|
|
169
|
-
|
|
170
|
-
if (fileStats.size > maxTextSize) {
|
|
171
|
-
result.error = `File too large (${fileStats.size} bytes, max ${maxTextSize})`;
|
|
172
|
-
return result;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const content = await readFile(validatedPath, 'utf8');
|
|
176
|
-
result.content = content;
|
|
177
|
-
result.lineCount = content.split(/\r?\n/).length;
|
|
178
|
-
result.encoding = 'utf8';
|
|
179
|
-
result.charCount = content.length;
|
|
180
|
-
|
|
181
|
-
} else if (SUPPORTED_IMAGE_EXTENSIONS.includes(extension)) {
|
|
161
|
+
if (SUPPORTED_IMAGE_EXTENSIONS.includes(extension)) {
|
|
182
162
|
result.type = 'image';
|
|
183
163
|
|
|
184
164
|
if (fileStats.size > maxImageSize) {
|
|
@@ -186,19 +166,26 @@ export async function processFileContent(filePath, options = {}) {
|
|
|
186
166
|
return result;
|
|
187
167
|
}
|
|
188
168
|
|
|
189
|
-
// For images, read as base64 for AI processing
|
|
169
|
+
// For images, read as base64 for AI processing
|
|
190
170
|
const buffer = await readFile(validatedPath);
|
|
191
171
|
result.content = buffer.toString('base64');
|
|
192
172
|
result.mimeType = getMimeType(extension);
|
|
193
173
|
result.encoding = 'base64';
|
|
194
174
|
|
|
195
|
-
// Placeholder: Advanced image processing could be added here
|
|
196
|
-
// - Image resizing, format conversion
|
|
197
|
-
// - EXIF data extraction
|
|
198
|
-
// - Image analysis/description generation
|
|
199
|
-
|
|
200
175
|
} else {
|
|
201
|
-
|
|
176
|
+
// Read everything else as text
|
|
177
|
+
result.type = 'text';
|
|
178
|
+
|
|
179
|
+
if (fileStats.size > maxTextSize) {
|
|
180
|
+
result.error = `File too large (${fileStats.size} bytes, max ${maxTextSize})`;
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const content = await readFile(validatedPath, 'utf8');
|
|
185
|
+
result.content = content;
|
|
186
|
+
result.lineCount = content.split(/\r?\n/).length;
|
|
187
|
+
result.encoding = 'utf8';
|
|
188
|
+
result.charCount = content.length;
|
|
202
189
|
}
|
|
203
190
|
|
|
204
191
|
return result;
|
|
@@ -477,30 +464,3 @@ export async function validateFilePaths(filePaths, options = {}) {
|
|
|
477
464
|
return results;
|
|
478
465
|
}
|
|
479
466
|
|
|
480
|
-
/**
|
|
481
|
-
* Get supported file extensions
|
|
482
|
-
* @returns {object} Object containing supported extensions by type
|
|
483
|
-
*/
|
|
484
|
-
export function getSupportedExtensions() {
|
|
485
|
-
return {
|
|
486
|
-
text: [...SUPPORTED_TEXT_EXTENSIONS],
|
|
487
|
-
image: [...SUPPORTED_IMAGE_EXTENSIONS],
|
|
488
|
-
all: [...SUPPORTED_TEXT_EXTENSIONS, ...SUPPORTED_IMAGE_EXTENSIONS]
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* Check if file type is supported
|
|
494
|
-
* @param {string} filePath - Path to check
|
|
495
|
-
* @returns {object} Support information
|
|
496
|
-
*/
|
|
497
|
-
export function isFileTypeSupported(filePath) {
|
|
498
|
-
const extension = extname(filePath).toLowerCase();
|
|
499
|
-
|
|
500
|
-
return {
|
|
501
|
-
extension,
|
|
502
|
-
isSupported: SUPPORTED_TEXT_EXTENSIONS.includes(extension) || SUPPORTED_IMAGE_EXTENSIONS.includes(extension),
|
|
503
|
-
type: SUPPORTED_TEXT_EXTENSIONS.includes(extension) ? 'text' :
|
|
504
|
-
SUPPORTED_IMAGE_EXTENSIONS.includes(extension) ? 'image' : 'unknown'
|
|
505
|
-
};
|
|
506
|
-
}
|