polydev-ai 1.8.32 → 1.8.34

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/lib/cliManager.js CHANGED
@@ -415,15 +415,16 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
415
415
  }
416
416
 
417
417
  async sendCliPrompt(providerId, prompt, mode = 'args', timeoutMs = null, model = null) {
418
- // Set provider-specific default timeouts (5 minutes for all by default, complex prompts take time)
418
+ // Set default timeout for CLI-within-CLI scenarios (90 seconds)
419
+ // This is important when Claude Code calls Claude Code via Polydev MCP
419
420
  if (timeoutMs === null) {
420
- timeoutMs = 300000; // 300 seconds (5 minutes) default for all providers
421
+ timeoutMs = 90000; // 90 seconds default for CLI responses
421
422
  }
422
-
423
+
423
424
  // Ensure timeoutMs is valid (not undefined, null, Infinity, or negative)
424
425
  // Allow up to 600 seconds (10 minutes) for very complex operations
425
426
  if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 600000) {
426
- timeoutMs = 300000 // Default to 5 minutes
427
+ timeoutMs = 90000 // Default to 90 seconds for CLI responses
427
428
  }
428
429
 
429
430
  const startTime = Date.now();
@@ -736,11 +737,11 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
736
737
  }
737
738
  }
738
739
 
739
- async executeCliCommand(command, args, mode = 'args', timeoutMs = 180000, stdinInput) {
740
+ async executeCliCommand(command, args, mode = 'args', timeoutMs = 90000, stdinInput) {
740
741
  // Ensure timeoutMs is valid (not undefined, null, Infinity, or negative)
741
- // Allow up to 300 seconds (5 minutes) for complex operations
742
- if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 300000) {
743
- timeoutMs = 180000 // Default to 180 seconds
742
+ // 90 seconds default for CLI-within-CLI scenarios
743
+ if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 600000) {
744
+ timeoutMs = 90000 // Default to 90 seconds
744
745
  }
745
746
 
746
747
  return new Promise((resolve, reject) => {
package/mcp/manifest.json CHANGED
@@ -370,10 +370,10 @@
370
370
  },
371
371
  "timeout_ms": {
372
372
  "type": "integer",
373
- "description": "Timeout in milliseconds",
373
+ "description": "Timeout in milliseconds (90 seconds default for CLI-within-CLI scenarios)",
374
374
  "minimum": 1000,
375
- "maximum": 300000,
376
- "default": 30000
375
+ "maximum": 600000,
376
+ "default": 90000
377
377
  },
378
378
  "user_id": {
379
379
  "type": "string",
package/mcp/server.js CHANGED
@@ -595,12 +595,13 @@ class MCPServer {
595
595
  console.log('[MCP Server] Send CLI prompt requested');
596
596
 
597
597
  try {
598
- const { provider_id, prompt, mode = 'args', timeout_ms = 30000, user_id } = args;
599
-
598
+ const { provider_id, prompt, mode = 'args', timeout_ms = 90000, user_id } = args;
599
+
600
600
  // Ensure timeout_ms is valid (not undefined, null, Infinity, or negative)
601
+ // 90 seconds default for CLI-within-CLI scenarios (Claude Code calling Claude Code)
601
602
  let validTimeout = timeout_ms;
602
- if (!validTimeout || validTimeout === Infinity || validTimeout < 1 || validTimeout > 300000) {
603
- validTimeout = 30000 // Default to 30 seconds
603
+ if (!validTimeout || validTimeout === Infinity || validTimeout < 1 || validTimeout > 600000) {
604
+ validTimeout = 90000 // Default to 90 seconds for CLI responses
604
605
  }
605
606
 
606
607
  if (!provider_id || !prompt) {
@@ -6,6 +6,12 @@ const path = require('path');
6
6
  const os = require('os');
7
7
  const { CLIManager } = require('../lib/cliManager');
8
8
 
9
+ // MCP stdio servers must only emit JSON-RPC on stdout.
10
+ // Redirect any accidental console output to stderr to avoid handshake failures.
11
+ console.log = console.error;
12
+ console.info = console.error;
13
+ console.debug = console.error;
14
+
9
15
  // Simple .env file loader (no external dependencies)
10
16
  function loadEnvFile(filePath) {
11
17
  try {
@@ -1564,20 +1570,8 @@ class StdioMCPWrapper {
1564
1570
  }
1565
1571
 
1566
1572
  async start() {
1567
- console.log('Starting Polydev Stdio MCP Wrapper...');
1568
-
1569
- // Run initial CLI detection on startup
1570
- console.error('[Stdio Wrapper] Running initial CLI detection...');
1571
- try {
1572
- await this.localForceCliDetection({});
1573
- console.error('[Stdio Wrapper] Initial CLI detection completed');
1574
- } catch (error) {
1575
- console.error('[Stdio Wrapper] Initial CLI detection failed:', error);
1576
- }
1577
-
1578
- // Start smart refresh scheduler for automatic updates
1579
- this.startSmartRefreshScheduler();
1580
-
1573
+ console.error('Starting Polydev Stdio MCP Wrapper...');
1574
+
1581
1575
  process.stdin.setEncoding('utf8');
1582
1576
  let buffer = '';
1583
1577
 
@@ -1601,25 +1595,39 @@ class StdioMCPWrapper {
1601
1595
  });
1602
1596
 
1603
1597
  process.stdin.on('end', () => {
1604
- console.log('Stdio MCP Wrapper shutting down...');
1598
+ console.error('Stdio MCP Wrapper shutting down...');
1605
1599
  this.stopSmartRefreshScheduler();
1606
1600
  process.exit(0);
1607
1601
  });
1608
1602
 
1609
1603
  // Handle process signals
1610
1604
  process.on('SIGINT', () => {
1611
- console.log('Received SIGINT, shutting down...');
1605
+ console.error('Received SIGINT, shutting down...');
1612
1606
  this.stopSmartRefreshScheduler();
1613
1607
  process.exit(0);
1614
1608
  });
1615
1609
 
1616
1610
  process.on('SIGTERM', () => {
1617
- console.log('Received SIGTERM, shutting down...');
1611
+ console.error('Received SIGTERM, shutting down...');
1618
1612
  this.stopSmartRefreshScheduler();
1619
1613
  process.exit(0);
1620
1614
  });
1621
1615
 
1622
- console.log('Stdio MCP Wrapper ready and listening on stdin...');
1616
+ console.error('Stdio MCP Wrapper ready and listening on stdin...');
1617
+
1618
+ // Run initial CLI detection in the background so MCP handshake isn't blocked.
1619
+ console.error('[Stdio Wrapper] Running initial CLI detection...');
1620
+ this.localForceCliDetection({})
1621
+ .then(() => {
1622
+ console.error('[Stdio Wrapper] Initial CLI detection completed');
1623
+ })
1624
+ .catch((error) => {
1625
+ console.error('[Stdio Wrapper] Initial CLI detection failed:', error);
1626
+ })
1627
+ .finally(() => {
1628
+ // Start smart refresh scheduler after initial detection attempt
1629
+ this.startSmartRefreshScheduler();
1630
+ });
1623
1631
  }
1624
1632
  }
1625
1633
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polydev-ai",
3
- "version": "1.8.32",
3
+ "version": "1.8.34",
4
4
  "description": "Agentic workflow assistant with CLI integration - get diverse perspectives from multiple LLMs when stuck or need enhanced reasoning",
5
5
  "keywords": [
6
6
  "mcp",
@@ -67,7 +67,7 @@
67
67
  "lucide-react": "^0.542.0",
68
68
  "marked": "^16.2.1",
69
69
  "next": "^15.5.7",
70
- "polydev-ai": "^1.8.15",
70
+ "polydev-ai": "^1.8.31",
71
71
  "posthog-js": "^1.157.2",
72
72
  "prismjs": "^1.30.0",
73
73
  "react": "^18.3.1",