@probelabs/probe 0.6.0-rc118 → 0.6.0-rc120

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.
@@ -242,11 +242,25 @@ export class MCPClientManager {
242
242
  console.error(`[MCP] Calling ${toolName} with args:`, args);
243
243
  }
244
244
 
245
- const result = await clientInfo.client.callTool({
246
- name: tool.originalName,
247
- arguments: args
245
+ // Get timeout from config (default 30 seconds)
246
+ const timeout = this.config?.settings?.timeout || 30000;
247
+
248
+ // Create a timeout promise
249
+ const timeoutPromise = new Promise((_, reject) => {
250
+ setTimeout(() => {
251
+ reject(new Error(`MCP tool call timeout after ${timeout}ms`));
252
+ }, timeout);
248
253
  });
249
254
 
255
+ // Race between the actual call and timeout
256
+ const result = await Promise.race([
257
+ clientInfo.client.callTool({
258
+ name: tool.originalName,
259
+ arguments: args
260
+ }),
261
+ timeoutPromise
262
+ ]);
263
+
250
264
  return result;
251
265
  } catch (error) {
252
266
  console.error(`[MCP] Error calling tool ${toolName}:`, error);
@@ -562,15 +562,18 @@ export async function validateMermaidDiagram(diagram) {
562
562
  const result = validate(diagram);
563
563
 
564
564
  // Maid returns { type: string, errors: array }
565
- // Valid if errors array is empty
566
- if (result.errors && result.errors.length === 0) {
565
+ // Only count actual errors (severity: 'error'), not warnings
566
+ const actualErrors = (result.errors || []).filter(err => err.severity === 'error');
567
+
568
+ // Valid if no actual errors (warnings are OK)
569
+ if (actualErrors.length === 0) {
567
570
  return {
568
571
  isValid: true,
569
572
  diagramType: result.type || 'unknown'
570
573
  };
571
574
  } else {
572
575
  // Format maid errors into a readable error message
573
- const errorMessages = (result.errors || []).map(err => {
576
+ const errorMessages = actualErrors.map(err => {
574
577
  const location = err.line ? `line ${err.line}${err.column ? `:${err.column}` : ''}` : '';
575
578
  return location ? `${location} - ${err.message}` : err.message;
576
579
  });
@@ -580,7 +583,7 @@ export async function validateMermaidDiagram(diagram) {
580
583
  diagramType: result.type || 'unknown',
581
584
  error: errorMessages[0] || 'Validation failed',
582
585
  detailedError: errorMessages.join('\n'),
583
- errors: result.errors || [] // Include raw maid errors for AI fixing
586
+ errors: actualErrors // Include only actual errors for AI fixing
584
587
  };
585
588
  }
586
589