@1mcp/agent 0.23.0 → 0.23.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/build/commands/mcp/tokens.d.ts.map +1 -1
- package/build/commands/mcp/tokens.js +0 -2
- package/build/commands/mcp/tokens.js.map +1 -1
- package/build/commands/preset/interactive.js +1 -2
- package/build/commands/preset/interactive.js.map +1 -1
- package/build/commands/preset/list.js +3 -6
- package/build/commands/preset/list.js.map +1 -1
- package/build/commands/preset/show.js +0 -1
- package/build/commands/preset/show.js.map +1 -1
- package/build/commands/serve/serve.js +3 -3
- package/build/commands/serve/serve.js.map +1 -1
- package/build/constants.d.ts +1 -1
- package/build/constants.js +1 -1
- package/build/core/instructions/instructionAggregator.d.ts +4 -38
- package/build/core/instructions/instructionAggregator.d.ts.map +1 -1
- package/build/core/instructions/instructionAggregator.js +43 -151
- package/build/core/instructions/instructionAggregator.js.map +1 -1
- package/build/core/instructions/templateTypes.d.ts +2 -0
- package/build/core/instructions/templateTypes.d.ts.map +1 -1
- package/build/core/instructions/templateTypes.js +1 -0
- package/build/core/instructions/templateTypes.js.map +1 -1
- package/build/core/instructions/templateValidator.d.ts +29 -0
- package/build/core/instructions/templateValidator.d.ts.map +1 -1
- package/build/core/instructions/templateValidator.js +138 -36
- package/build/core/instructions/templateValidator.js.map +1 -1
- package/build/transport/http/routes/sseRoutes.d.ts +1 -1
- package/build/transport/http/routes/sseRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/sseRoutes.js +2 -1
- package/build/transport/http/routes/sseRoutes.js.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.d.ts +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.js +2 -1
- package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
- package/build/transport/http/server.d.ts +3 -1
- package/build/transport/http/server.d.ts.map +1 -1
- package/build/transport/http/server.js +6 -3
- package/build/transport/http/server.js.map +1 -1
- package/build/utils/presetManager.d.ts +0 -4
- package/build/utils/presetManager.d.ts.map +1 -1
- package/build/utils/presetManager.js +0 -16
- package/build/utils/presetManager.js.map +1 -1
- package/build/utils/presetTypes.d.ts +0 -3
- package/build/utils/presetTypes.d.ts.map +1 -1
- package/package.json +1 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import Handlebars from 'handlebars';
|
|
3
|
-
import { LRUCache } from 'lru-cache';
|
|
4
3
|
import logger from '../../logger/logger.js';
|
|
5
4
|
import { FilteringService } from '../filtering/filteringService.js';
|
|
6
5
|
import { DEFAULT_TEMPLATE_CONFIG, DEFAULT_INSTRUCTION_TEMPLATE, } from './templateTypes.js';
|
|
@@ -26,24 +25,9 @@ import { DEFAULT_TEMPLATE_CONFIG, DEFAULT_INSTRUCTION_TEMPLATE, } from './templa
|
|
|
26
25
|
export class InstructionAggregator extends EventEmitter {
|
|
27
26
|
serverInstructions = new Map();
|
|
28
27
|
isInitialized = false;
|
|
29
|
-
templateCache;
|
|
30
28
|
constructor() {
|
|
31
29
|
super();
|
|
32
30
|
this.setMaxListeners(50);
|
|
33
|
-
// Initialize LRU cache with reasonable limits
|
|
34
|
-
this.templateCache = new LRUCache({
|
|
35
|
-
max: 100, // Maximum 100 compiled templates
|
|
36
|
-
maxSize: 10 * 1024 * 1024, // 10MB total size limit
|
|
37
|
-
sizeCalculation: (template, key) => {
|
|
38
|
-
// Estimate size based on template string length (key) plus overhead
|
|
39
|
-
return key.length + 1024; // Template overhead estimate
|
|
40
|
-
},
|
|
41
|
-
ttl: 1000 * 60 * 60, // 1 hour TTL to prevent indefinite growth
|
|
42
|
-
});
|
|
43
|
-
// Set up cache invalidation on instruction changes
|
|
44
|
-
this.on('instructions-changed', () => {
|
|
45
|
-
this.invalidateTemplateCache('instructions-changed');
|
|
46
|
-
});
|
|
47
31
|
}
|
|
48
32
|
/**
|
|
49
33
|
* Set or update instructions for a specific server
|
|
@@ -102,9 +86,27 @@ export class InstructionAggregator extends EventEmitter {
|
|
|
102
86
|
// Get filtering summary for logging
|
|
103
87
|
const filteringSummary = FilteringService.getFilteringSummary(connections, filteredConnections, config);
|
|
104
88
|
logger.info('InstructionAggregator: Filtering applied', filteringSummary);
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
89
|
+
// Try custom template first, fall back to default if it fails
|
|
90
|
+
if (config.customTemplate) {
|
|
91
|
+
logger.info('InstructionAggregator: Trying custom template', { templateLength: config.customTemplate.length });
|
|
92
|
+
try {
|
|
93
|
+
return this.renderTemplate(config.customTemplate, filteredConnections, config);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
97
|
+
// Log detailed error for debugging
|
|
98
|
+
logger.error('InstructionAggregator: Custom template failed, falling back to default template', {
|
|
99
|
+
error: errorMessage,
|
|
100
|
+
templateLength: config.customTemplate.length,
|
|
101
|
+
});
|
|
102
|
+
// Fall back to default template
|
|
103
|
+
return this.renderTemplate(DEFAULT_INSTRUCTION_TEMPLATE, filteredConnections, config);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
// Use default template directly
|
|
108
|
+
return this.renderTemplate(DEFAULT_INSTRUCTION_TEMPLATE, filteredConnections, config);
|
|
109
|
+
}
|
|
108
110
|
}
|
|
109
111
|
/**
|
|
110
112
|
* Get the number of servers that have provided instructions
|
|
@@ -174,100 +176,35 @@ export class InstructionAggregator extends EventEmitter {
|
|
|
174
176
|
return `${serverCount} servers with instructions: ${serverNames.join(', ')}`;
|
|
175
177
|
}
|
|
176
178
|
/**
|
|
177
|
-
* Render a
|
|
178
|
-
* @param template
|
|
179
|
+
* Render a Handlebars template with template variables
|
|
180
|
+
* @param template Template string (custom or default)
|
|
179
181
|
* @param filteredConnections Filtered server connections
|
|
180
182
|
* @param config Client configuration
|
|
181
183
|
* @returns Rendered template string
|
|
182
184
|
*/
|
|
183
|
-
|
|
184
|
-
try {
|
|
185
|
-
// Get or compile template
|
|
186
|
-
const compiledTemplate = this.getCompiledTemplate(template);
|
|
187
|
-
// Generate template variables
|
|
188
|
-
const variables = this.generateTemplateVariables(filteredConnections, config);
|
|
189
|
-
// Render template
|
|
190
|
-
const rendered = compiledTemplate(variables);
|
|
191
|
-
logger.debug('InstructionAggregator: Custom template rendered successfully', {
|
|
192
|
-
templateLength: template.length,
|
|
193
|
-
variableCount: Object.keys(variables).length,
|
|
194
|
-
renderedLength: rendered.length,
|
|
195
|
-
});
|
|
196
|
-
return rendered;
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
200
|
-
logger.error('InstructionAggregator: Failed to render custom template', {
|
|
201
|
-
error: errorMessage,
|
|
202
|
-
templateLength: template.length,
|
|
203
|
-
});
|
|
204
|
-
// Provide actionable guidance for template errors
|
|
205
|
-
logger.warn('InstructionAggregator: Template rendering failed, returning error instructions with guidance');
|
|
206
|
-
const serverCount = Array.from(filteredConnections.keys()).filter((name) => this.serverInstructions.has(name)).length;
|
|
207
|
-
// Generate helpful error message with troubleshooting steps
|
|
208
|
-
return `# 1MCP - Template Rendering Error
|
|
209
|
-
|
|
210
|
-
⚠️ **Template rendering failed:** ${errorMessage}
|
|
211
|
-
|
|
212
|
-
## Available Resources
|
|
213
|
-
- **${serverCount} server(s)** are connected and have instructions
|
|
214
|
-
- **Built-in template** is available as fallback
|
|
215
|
-
|
|
216
|
-
## Troubleshooting Steps
|
|
217
|
-
|
|
218
|
-
1. **Check Template Syntax**:
|
|
219
|
-
- Verify all Handlebars expressions use correct syntax: \`{{variable}}\`
|
|
220
|
-
- Ensure block helpers are properly closed: \`{{#if}}...{{/if}}\`
|
|
221
|
-
- Check for unmatched braces or quotes
|
|
222
|
-
|
|
223
|
-
2. **Validate Template Variables**:
|
|
224
|
-
- Use only supported variables: \`serverCount\`, \`serverNames\`, \`hasServers\`, etc.
|
|
225
|
-
- Check template documentation for full variable list
|
|
226
|
-
|
|
227
|
-
3. **Test Template**:
|
|
228
|
-
- Start with a simple template: \`# {{title}}\\n{{serverCount}} servers available\`
|
|
229
|
-
- Add complexity gradually
|
|
230
|
-
|
|
231
|
-
4. **Get Help**:
|
|
232
|
-
- Remove custom template to use built-in version
|
|
233
|
-
- Check server logs for detailed error information
|
|
234
|
-
- Consult 1MCP documentation for template examples
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
*To restore normal operation, remove or fix the custom template file*`;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get or compile a Handlebars template with caching
|
|
242
|
-
* @param template Template string
|
|
243
|
-
* @returns Compiled template function
|
|
244
|
-
*/
|
|
245
|
-
getCompiledTemplate(template) {
|
|
185
|
+
renderTemplate(template, filteredConnections, config) {
|
|
246
186
|
// Validate template size before processing
|
|
247
|
-
|
|
248
|
-
|
|
187
|
+
// Priority: config > default
|
|
188
|
+
const templateSizeLimit = config.templateSizeLimit || DEFAULT_TEMPLATE_CONFIG.templateSizeLimit;
|
|
189
|
+
if (template.length > templateSizeLimit) {
|
|
249
190
|
const sizeMB = (template.length / 1024 / 1024).toFixed(1);
|
|
250
|
-
|
|
191
|
+
const limitMB = (templateSizeLimit / 1024 / 1024).toFixed(1);
|
|
192
|
+
throw new Error(`Template too large: ${sizeMB}MB (max ${limitMB}MB). ` +
|
|
251
193
|
'Consider splitting into smaller files or removing unnecessary content. ' +
|
|
252
194
|
'Large templates can cause memory issues and slow performance.');
|
|
253
195
|
}
|
|
254
|
-
//
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
//
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
cacheSize: this.templateCache.size,
|
|
267
|
-
cacheKeyLength: cacheKey.length,
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
return compiledTemplate;
|
|
196
|
+
// Compile template directly
|
|
197
|
+
const compiledTemplate = Handlebars.compile(template, { noEscape: true });
|
|
198
|
+
// Generate template variables
|
|
199
|
+
const variables = this.generateTemplateVariables(filteredConnections, config);
|
|
200
|
+
// Render template
|
|
201
|
+
const rendered = compiledTemplate(variables);
|
|
202
|
+
logger.debug('InstructionAggregator: Template rendered successfully', {
|
|
203
|
+
templateLength: template.length,
|
|
204
|
+
variableCount: Object.keys(variables).length,
|
|
205
|
+
renderedLength: rendered.length,
|
|
206
|
+
});
|
|
207
|
+
return rendered;
|
|
271
208
|
}
|
|
272
209
|
/**
|
|
273
210
|
* Generate template variables for rendering
|
|
@@ -323,63 +260,18 @@ export class InstructionAggregator extends EventEmitter {
|
|
|
323
260
|
};
|
|
324
261
|
}
|
|
325
262
|
/**
|
|
326
|
-
*
|
|
327
|
-
*/
|
|
328
|
-
clearTemplateCache() {
|
|
329
|
-
this.templateCache.clear();
|
|
330
|
-
logger.debug('InstructionAggregator: Template cache cleared');
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Get template cache statistics for monitoring
|
|
334
|
-
*/
|
|
335
|
-
getTemplateCacheStats() {
|
|
336
|
-
return {
|
|
337
|
-
size: this.templateCache.size,
|
|
338
|
-
maxSize: this.templateCache.max,
|
|
339
|
-
calculatedSize: this.templateCache.calculatedSize || 0,
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Invalidate template cache with reason logging
|
|
344
|
-
* @param reason Reason for cache invalidation
|
|
345
|
-
*/
|
|
346
|
-
invalidateTemplateCache(reason) {
|
|
347
|
-
const sizeBefore = this.templateCache.size;
|
|
348
|
-
this.templateCache.clear();
|
|
349
|
-
logger.debug(`InstructionAggregator: Template cache invalidated due to ${reason}`, {
|
|
350
|
-
clearedTemplates: sizeBefore,
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Force template cache invalidation (for external triggers)
|
|
355
|
-
* @param reason Reason for forced invalidation
|
|
356
|
-
*/
|
|
357
|
-
forceTemplateCacheInvalidation(reason = 'external-trigger') {
|
|
358
|
-
this.invalidateTemplateCache(reason);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Cryptographically secure hash function for template cache keys
|
|
362
|
-
* Uses SHA-256 to prevent collision attacks
|
|
363
|
-
*/
|
|
364
|
-
hashString(str) {
|
|
365
|
-
const crypto = require('crypto');
|
|
366
|
-
return crypto.createHash('sha256').update(str, 'utf8').digest('hex').substring(0, 16);
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Cleanup method to remove all event listeners and clear caches
|
|
263
|
+
* Cleanup method to remove all event listeners
|
|
370
264
|
* Should be called when the aggregator is no longer needed
|
|
371
265
|
*/
|
|
372
266
|
cleanup() {
|
|
373
267
|
logger.debug('InstructionAggregator: Starting cleanup');
|
|
374
268
|
// Clear all event listeners
|
|
375
269
|
this.removeAllListeners();
|
|
376
|
-
// Clear template cache
|
|
377
|
-
this.templateCache.clear();
|
|
378
270
|
// Clear server instructions
|
|
379
271
|
this.serverInstructions.clear();
|
|
380
272
|
// Reset initialization state
|
|
381
273
|
this.isInitialized = false;
|
|
382
|
-
logger.info('InstructionAggregator: Cleanup completed - all listeners
|
|
274
|
+
logger.info('InstructionAggregator: Cleanup completed - all listeners cleared');
|
|
383
275
|
}
|
|
384
276
|
}
|
|
385
277
|
//# sourceMappingURL=instructionAggregator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructionAggregator.js","sourceRoot":"","sources":["../../../src/core/instructions/instructionAggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"instructionAggregator.js","sourceRoot":"","sources":["../../../src/core/instructions/instructionAggregator.ts"],"names":[],"mappings":"AAAA,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22
|
title: '1MCP - Model Context Protocol Proxy',
|
|
23
23
|
toolPattern: '{server}_1mcp_{tool}',
|
|
24
24
|
examples: DEFAULT_TEMPLATE_EXAMPLES,
|
|
25
|
+
templateSizeLimit: 1024 * 1024, // 1MB default
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
28
|
* Default instruction template using Handlebars syntax
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateTypes.js","sourceRoot":"","sources":["../../../src/core/instructions/templateTypes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateTypes.js","sourceRoot":"","sources":["../../../src/core/instructions/templateTypes.ts"],"names":[],"mappings":"AA0FA;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D;QACE,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,sCAAsC;KACpD;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,mCAAmC;KACjD;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,yCAAyC;KACvD;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAqD;IACvF,KAAK,EAAE,qCAAqC;IAC5C,WAAW,EAAE,sBAAsB;IACnC,QAAQ,EAAE,yBAAyB;IACnC,iBAAiB,EAAE,IAAI,GAAG,IAAI,EAAE,cAAc;CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2DpC,CAAC"}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of template errors for better categorization
|
|
3
|
+
*/
|
|
4
|
+
export declare enum TemplateErrorType {
|
|
5
|
+
/** Handlebars syntax errors (unmatched braces, invalid expressions) */
|
|
6
|
+
SYNTAX = "SYNTAX",
|
|
7
|
+
/** Template compilation errors (missing helpers, invalid helper usage) */
|
|
8
|
+
COMPILATION = "COMPILATION",
|
|
9
|
+
/** Template size exceeds allowed limit */
|
|
10
|
+
SIZE_LIMIT = "SIZE_LIMIT",
|
|
11
|
+
/** Template contains potentially unsafe content */
|
|
12
|
+
UNSAFE_CONTENT = "UNSAFE_CONTENT",
|
|
13
|
+
/** Runtime errors during template rendering */
|
|
14
|
+
RUNTIME = "RUNTIME"
|
|
15
|
+
}
|
|
1
16
|
/**
|
|
2
17
|
* Template validation result with error details if invalid
|
|
3
18
|
*/
|
|
4
19
|
export interface TemplateValidationResult {
|
|
5
20
|
valid: boolean;
|
|
6
21
|
error?: string;
|
|
22
|
+
errorType?: TemplateErrorType;
|
|
7
23
|
suggestions?: string[];
|
|
8
24
|
}
|
|
9
25
|
/**
|
|
@@ -22,6 +38,19 @@ export declare const DEFAULT_TEMPLATE_VALIDATION_CONFIG: Required<TemplateValida
|
|
|
22
38
|
* Built-in dangerous patterns for template content
|
|
23
39
|
*/
|
|
24
40
|
export declare const DANGEROUS_TEMPLATE_PATTERNS: RegExp[];
|
|
41
|
+
/**
|
|
42
|
+
* Categorize template errors based on error message patterns
|
|
43
|
+
* @param errorMessage Error message from Handlebars compilation
|
|
44
|
+
* @returns Template error type
|
|
45
|
+
*/
|
|
46
|
+
export declare function categorizeTemplateError(errorMessage: string): TemplateErrorType;
|
|
47
|
+
/**
|
|
48
|
+
* Get specific suggestions based on error type
|
|
49
|
+
* @param errorType Type of template error
|
|
50
|
+
* @param errorMessage Original error message
|
|
51
|
+
* @returns Array of suggestions
|
|
52
|
+
*/
|
|
53
|
+
export declare function getErrorSuggestions(errorType: TemplateErrorType, errorMessage: string): string[];
|
|
25
54
|
/**
|
|
26
55
|
* Validate Handlebars template content for safety and syntax
|
|
27
56
|
* @param templateContent Template content to validate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateValidator.d.ts","sourceRoot":"","sources":["../../../src/core/instructions/templateValidator.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,wBAAwB,CAIjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAI/C,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,GAAE,wBAA6B,GACpC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"templateValidator.d.ts","sourceRoot":"","sources":["../../../src/core/instructions/templateValidator.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,uEAAuE;IACvE,MAAM,WAAW;IACjB,0EAA0E;IAC1E,WAAW,gBAAgB;IAC3B,0CAA0C;IAC1C,UAAU,eAAe;IACzB,mDAAmD;IACnD,cAAc,mBAAmB;IACjC,+CAA+C;IAC/C,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,wBAAwB,CAIjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAI/C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB,CA2B/E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAkDhG;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,GAAE,wBAA6B,GACpC,wBAAwB,CA6E1B;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,YAAY,GAAE,MAAwD,GACrE,OAAO,CAQT;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,GAAE,wBAA6B,GAAG,OAAO,CAS7G;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM,CAe9E"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import Handlebars from 'handlebars';
|
|
2
|
+
/**
|
|
3
|
+
* Types of template errors for better categorization
|
|
4
|
+
*/
|
|
5
|
+
export var TemplateErrorType;
|
|
6
|
+
(function (TemplateErrorType) {
|
|
7
|
+
/** Handlebars syntax errors (unmatched braces, invalid expressions) */
|
|
8
|
+
TemplateErrorType["SYNTAX"] = "SYNTAX";
|
|
9
|
+
/** Template compilation errors (missing helpers, invalid helper usage) */
|
|
10
|
+
TemplateErrorType["COMPILATION"] = "COMPILATION";
|
|
11
|
+
/** Template size exceeds allowed limit */
|
|
12
|
+
TemplateErrorType["SIZE_LIMIT"] = "SIZE_LIMIT";
|
|
13
|
+
/** Template contains potentially unsafe content */
|
|
14
|
+
TemplateErrorType["UNSAFE_CONTENT"] = "UNSAFE_CONTENT";
|
|
15
|
+
/** Runtime errors during template rendering */
|
|
16
|
+
TemplateErrorType["RUNTIME"] = "RUNTIME";
|
|
17
|
+
})(TemplateErrorType || (TemplateErrorType = {}));
|
|
2
18
|
/**
|
|
3
19
|
* Default validation configuration
|
|
4
20
|
*/
|
|
@@ -15,6 +31,89 @@ export const DANGEROUS_TEMPLATE_PATTERNS = [
|
|
|
15
31
|
/javascript:/i,
|
|
16
32
|
/on\w+\s*=/i, // event handlers like onclick=
|
|
17
33
|
];
|
|
34
|
+
/**
|
|
35
|
+
* Categorize template errors based on error message patterns
|
|
36
|
+
* @param errorMessage Error message from Handlebars compilation
|
|
37
|
+
* @returns Template error type
|
|
38
|
+
*/
|
|
39
|
+
export function categorizeTemplateError(errorMessage) {
|
|
40
|
+
const message = errorMessage.toLowerCase();
|
|
41
|
+
// Check for syntax errors
|
|
42
|
+
if (message.includes('parse error') ||
|
|
43
|
+
message.includes('expecting') ||
|
|
44
|
+
message.includes('unexpected token') ||
|
|
45
|
+
message.includes('unterminated') ||
|
|
46
|
+
message.includes('unmatched') ||
|
|
47
|
+
message.includes("doesn't match")) {
|
|
48
|
+
return TemplateErrorType.SYNTAX;
|
|
49
|
+
}
|
|
50
|
+
// Check for compilation errors
|
|
51
|
+
if (message.includes('missing helper') ||
|
|
52
|
+
message.includes('must pass iterator') ||
|
|
53
|
+
message.includes('helper not found') ||
|
|
54
|
+
message.includes('invalid helper')) {
|
|
55
|
+
return TemplateErrorType.COMPILATION;
|
|
56
|
+
}
|
|
57
|
+
// Default to compilation error for other Handlebars errors
|
|
58
|
+
return TemplateErrorType.COMPILATION;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get specific suggestions based on error type
|
|
62
|
+
* @param errorType Type of template error
|
|
63
|
+
* @param errorMessage Original error message
|
|
64
|
+
* @returns Array of suggestions
|
|
65
|
+
*/
|
|
66
|
+
export function getErrorSuggestions(errorType, errorMessage) {
|
|
67
|
+
switch (errorType) {
|
|
68
|
+
case TemplateErrorType.SYNTAX:
|
|
69
|
+
return [
|
|
70
|
+
'Check for unmatched braces {{ }}',
|
|
71
|
+
'Ensure all Handlebars expressions are properly closed',
|
|
72
|
+
'Verify nested expressions have correct syntax',
|
|
73
|
+
'Look for unterminated block helpers like {{#if}} without {{/if}}',
|
|
74
|
+
];
|
|
75
|
+
case TemplateErrorType.COMPILATION:
|
|
76
|
+
if (errorMessage.includes('Must pass iterator')) {
|
|
77
|
+
return [
|
|
78
|
+
'Use {{#each serverNames}} instead of {{#each}}',
|
|
79
|
+
'Ensure iterator variable is provided for #each helpers',
|
|
80
|
+
'Check available template variables in documentation',
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
return [
|
|
84
|
+
'Use only built-in Handlebars helpers',
|
|
85
|
+
'Check available template variables in documentation',
|
|
86
|
+
'Verify helper names are spelled correctly',
|
|
87
|
+
'Ensure block helpers like {{#if}} have matching {{/if}}',
|
|
88
|
+
];
|
|
89
|
+
case TemplateErrorType.SIZE_LIMIT:
|
|
90
|
+
return [
|
|
91
|
+
'Consider splitting the template into smaller files',
|
|
92
|
+
'Remove unnecessary content or comments',
|
|
93
|
+
'Use template partials for repeated sections',
|
|
94
|
+
'Increase template size limit if necessary',
|
|
95
|
+
];
|
|
96
|
+
case TemplateErrorType.UNSAFE_CONTENT:
|
|
97
|
+
return [
|
|
98
|
+
'Remove script tags and event handlers',
|
|
99
|
+
'Use safe template variables only',
|
|
100
|
+
'Consider using triple braces {{{content}}} only for trusted content',
|
|
101
|
+
'Review template security best practices',
|
|
102
|
+
];
|
|
103
|
+
case TemplateErrorType.RUNTIME:
|
|
104
|
+
return [
|
|
105
|
+
'Check template variables are correctly defined',
|
|
106
|
+
'Verify data passed to template matches expected structure',
|
|
107
|
+
'Test template with sample data',
|
|
108
|
+
];
|
|
109
|
+
default:
|
|
110
|
+
return [
|
|
111
|
+
'Check Handlebars documentation for proper syntax',
|
|
112
|
+
'Test template with a simple Handlebars validator',
|
|
113
|
+
'Start with a minimal template and add complexity gradually',
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
18
117
|
/**
|
|
19
118
|
* Validate Handlebars template content for safety and syntax
|
|
20
119
|
* @param templateContent Template content to validate
|
|
@@ -30,11 +129,8 @@ export function validateTemplateContent(templateContent, templatePath, config =
|
|
|
30
129
|
return {
|
|
31
130
|
valid: false,
|
|
32
131
|
error: `Template file too large${pathInfo}: ${templateContent.length} bytes (max ${Math.round(validationConfig.maxSizeBytes / 1024 / 1024)}MB)`,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'Remove unnecessary content or comments',
|
|
36
|
-
'Use template partials for repeated sections',
|
|
37
|
-
],
|
|
132
|
+
errorType: TemplateErrorType.SIZE_LIMIT,
|
|
133
|
+
suggestions: getErrorSuggestions(TemplateErrorType.SIZE_LIMIT, ''),
|
|
38
134
|
};
|
|
39
135
|
}
|
|
40
136
|
// Check for potentially dangerous content (unless explicitly allowed)
|
|
@@ -45,49 +141,55 @@ export function validateTemplateContent(templateContent, templatePath, config =
|
|
|
45
141
|
return {
|
|
46
142
|
valid: false,
|
|
47
143
|
error: `Template contains potentially unsafe content${pathInfo}: ${pattern.source}`,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'Use safe template variables only',
|
|
51
|
-
'Consider using triple braces {{{content}}} only for trusted content',
|
|
52
|
-
'Review template security best practices',
|
|
53
|
-
],
|
|
144
|
+
errorType: TemplateErrorType.UNSAFE_CONTENT,
|
|
145
|
+
suggestions: getErrorSuggestions(TemplateErrorType.UNSAFE_CONTENT, ''),
|
|
54
146
|
};
|
|
55
147
|
}
|
|
56
148
|
}
|
|
57
149
|
}
|
|
58
|
-
// Validate Handlebars syntax by attempting compilation
|
|
150
|
+
// Validate Handlebars syntax by attempting compilation and rendering
|
|
59
151
|
try {
|
|
60
|
-
Handlebars.compile(templateContent, { noEscape: true });
|
|
152
|
+
const compiledTemplate = Handlebars.compile(templateContent, { noEscape: true });
|
|
153
|
+
// Try rendering with sample data to catch runtime errors
|
|
154
|
+
try {
|
|
155
|
+
compiledTemplate({
|
|
156
|
+
serverCount: 0,
|
|
157
|
+
hasServers: false,
|
|
158
|
+
serverList: '',
|
|
159
|
+
serverNames: [],
|
|
160
|
+
servers: [],
|
|
161
|
+
pluralServers: 'servers',
|
|
162
|
+
isAre: 'are',
|
|
163
|
+
instructions: '',
|
|
164
|
+
filterContext: '',
|
|
165
|
+
toolPattern: '{server}_1mcp_{tool}',
|
|
166
|
+
title: 'Test Title',
|
|
167
|
+
examples: [],
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
catch (renderError) {
|
|
171
|
+
// If rendering fails, it's a compilation/runtime error
|
|
172
|
+
const errorMessage = renderError instanceof Error ? renderError.message : String(renderError);
|
|
173
|
+
const errorType = categorizeTemplateError(errorMessage);
|
|
174
|
+
const suggestions = getErrorSuggestions(errorType, errorMessage);
|
|
175
|
+
return {
|
|
176
|
+
valid: false,
|
|
177
|
+
error: `Template syntax error${pathInfo}: ${errorMessage}`,
|
|
178
|
+
errorType,
|
|
179
|
+
suggestions,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
61
182
|
return { valid: true };
|
|
62
183
|
}
|
|
63
184
|
catch (error) {
|
|
64
185
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
65
|
-
|
|
66
|
-
const suggestions =
|
|
67
|
-
if (errorMessage.includes('Parse error')) {
|
|
68
|
-
suggestions.push('Check for unmatched braces {{ }}');
|
|
69
|
-
suggestions.push('Ensure all Handlebars expressions are properly closed');
|
|
70
|
-
suggestions.push('Verify nested expressions have correct syntax');
|
|
71
|
-
}
|
|
72
|
-
if (errorMessage.includes('Expected')) {
|
|
73
|
-
suggestions.push('Verify template syntax matches Handlebars documentation');
|
|
74
|
-
suggestions.push('Check for typos in helper names or variable references');
|
|
75
|
-
suggestions.push('Ensure block helpers like {{#if}} have matching {{/if}}');
|
|
76
|
-
}
|
|
77
|
-
if (errorMessage.includes('Missing helper')) {
|
|
78
|
-
suggestions.push('Use only built-in Handlebars helpers');
|
|
79
|
-
suggestions.push('Check available template variables in documentation');
|
|
80
|
-
}
|
|
186
|
+
const errorType = categorizeTemplateError(errorMessage);
|
|
187
|
+
const suggestions = getErrorSuggestions(errorType, errorMessage);
|
|
81
188
|
return {
|
|
82
189
|
valid: false,
|
|
83
190
|
error: `Template syntax error${pathInfo}: ${errorMessage}`,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
: [
|
|
87
|
-
'Check Handlebars documentation for proper syntax',
|
|
88
|
-
'Test template with a simple Handlebars validator',
|
|
89
|
-
'Start with a minimal template and add complexity gradually',
|
|
90
|
-
],
|
|
191
|
+
errorType,
|
|
192
|
+
suggestions,
|
|
91
193
|
};
|
|
92
194
|
}
|
|
93
195
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateValidator.js","sourceRoot":"","sources":["../../../src/core/instructions/templateValidator.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"templateValidator.js","sourceRoot":"","sources":["../../../src/core/instructions/templateValidator.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAN,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,uEAAuE;IACvE,sCAAiB,CAAA;IACjB,0EAA0E;IAC1E,gDAA2B,CAAA;IAC3B,0CAA0C;IAC1C,8CAAyB,CAAA;IACzB,mDAAmD;IACnD,sDAAiC,CAAA;IACjC,+CAA+C;IAC/C,wCAAmB,CAAA;AACrB,CAAC,EAXW,iBAAiB,KAAjB,iBAAiB,QAW5B;AAqBD;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAuC;IACpF,YAAY,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM;IACjC,kBA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B,CAAC,eAAuB,EAAE,SAAmC,EAAE;IAClG,MAAM,gBAAgB,GAAG,EAAE,GAAG,kCAAkC,EAAE,GAAG,MAAM,EAAE,CAAC;IAE9E,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC;QACzC,MAAM,WAAW,GAAG,CAAC,GAAG,2BAA2B,EAAE,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;QAClG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAgC;IACpE,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,IAAI,4BAA4B,CAAC;IAE3D,IAAI,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxD,OAAO,IAAI,kBAAkB,CAAC;QAC9B,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;YAC/C,OAAO,IAAI,OAAO,KAAK,GAAG,CAAC,KAAK,UAAU,EAAE,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
2
|
import { ServerManager } from '../../../core/server/serverManager.js';
|
|
3
3
|
import { AsyncLoadingOrchestrator } from '../../../core/capabilities/asyncLoadingOrchestrator.js';
|
|
4
|
-
export declare function setupSseRoutes(router: Router, serverManager: ServerManager, authMiddleware: any, availabilityMiddleware?: any, asyncOrchestrator?: AsyncLoadingOrchestrator): void;
|
|
4
|
+
export declare function setupSseRoutes(router: Router, serverManager: ServerManager, authMiddleware: any, availabilityMiddleware?: any, asyncOrchestrator?: AsyncLoadingOrchestrator, customTemplate?: string): void;
|
|
5
5
|
//# sourceMappingURL=sseRoutes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sseRoutes.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/routes/sseRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AAKpD,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAUlG,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,GAAG,EACnB,sBAAsB,CAAC,EAAE,GAAG,EAC5B,iBAAiB,CAAC,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"sseRoutes.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/routes/sseRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AAKpD,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAUlG,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,GAAG,EACnB,sBAAsB,CAAC,EAAE,GAAG,EAC5B,iBAAiB,CAAC,EAAE,wBAAwB,EAC5C,cAAc,CAAC,EAAE,MAAM,GACtB,IAAI,CA8FN"}
|