polydev-ai 1.9.2 → 1.9.3

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
@@ -429,16 +429,16 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
429
429
  }
430
430
 
431
431
  async sendCliPrompt(providerId, prompt, mode = 'args', timeoutMs = null, model = null) {
432
- // Set default timeout for CLI-within-CLI scenarios (90 seconds)
433
- // This is important when Claude Code calls Claude Code via Polydev MCP
432
+ // Set default timeout for CLI responses (240 seconds / 4 minutes)
433
+ // CLI-within-CLI scenarios (Claude Code calling Claude Code) need generous timeouts
434
434
  if (timeoutMs === null) {
435
- timeoutMs = 90000; // 90 seconds default for CLI responses
435
+ timeoutMs = 240000; // 240 seconds (4 minutes) default for CLI responses
436
436
  }
437
437
 
438
438
  // Ensure timeoutMs is valid (not undefined, null, Infinity, or negative)
439
439
  // Allow up to 600 seconds (10 minutes) for very complex operations
440
440
  if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 600000) {
441
- timeoutMs = 90000 // Default to 90 seconds for CLI responses
441
+ timeoutMs = 240000 // Default to 240 seconds (4 minutes) for CLI responses
442
442
  }
443
443
 
444
444
  const startTime = Date.now();
@@ -777,11 +777,11 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
777
777
  }
778
778
  }
779
779
 
780
- async executeCliCommand(command, args, mode = 'args', timeoutMs = 90000, stdinInput) {
780
+ async executeCliCommand(command, args, mode = 'args', timeoutMs = 240000, stdinInput) {
781
781
  // Ensure timeoutMs is valid (not undefined, null, Infinity, or negative)
782
- // 90 seconds default for CLI-within-CLI scenarios
782
+ // 240 seconds (4 minutes) default for CLI responses
783
783
  if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 600000) {
784
- timeoutMs = 90000 // Default to 90 seconds
784
+ timeoutMs = 240000 // Default to 240 seconds (4 minutes)
785
785
  }
786
786
 
787
787
  return new Promise((resolve, reject) => {
@@ -35,7 +35,7 @@ if (typeof globalThis.fetch === 'undefined') {
35
35
  });
36
36
 
37
37
  req.on('error', reject);
38
- req.setTimeout(30000, () => { req.destroy(); reject(new Error('Request timed out')); });
38
+ req.setTimeout(240000, () => { req.destroy(); reject(new Error('Request timed out')); });
39
39
  if (options.body) req.write(options.body);
40
40
  req.end();
41
41
  });
@@ -1170,6 +1170,10 @@ Error: ${error.message}`
1170
1170
  console.error(`[Stdio Wrapper] Forwarding request to remote server`);
1171
1171
 
1172
1172
  try {
1173
+ // Use AbortController for timeout if available, otherwise rely on fetch timeout
1174
+ const controller = typeof AbortController !== 'undefined' ? new AbortController() : null;
1175
+ const timeoutId = controller ? setTimeout(() => controller.abort(), 240000) : null; // 240s timeout
1176
+
1173
1177
  const response = await fetch('https://www.polydev.ai/api/mcp', {
1174
1178
  method: 'POST',
1175
1179
  headers: {
@@ -1177,9 +1181,12 @@ Error: ${error.message}`
1177
1181
  'Authorization': `Bearer ${this.userToken}`,
1178
1182
  'User-Agent': 'polydev-stdio-wrapper/1.0.0'
1179
1183
  },
1180
- body: JSON.stringify(request)
1184
+ body: JSON.stringify(request),
1185
+ ...(controller ? { signal: controller.signal } : {})
1181
1186
  });
1182
1187
 
1188
+ if (timeoutId) clearTimeout(timeoutId);
1189
+
1183
1190
  if (!response.ok) {
1184
1191
  const errorText = await response.text();
1185
1192
  console.error(`[Stdio Wrapper] Remote server error: ${response.status} - ${errorText}`);
@@ -1657,8 +1664,9 @@ Error: ${error.message}`
1657
1664
  console.error('[Polydev] CLI detection ready, proceeding with request');
1658
1665
  }
1659
1666
 
1660
- const results = await this.cliManager.forceCliDetection();
1661
- console.error(`[Stdio Wrapper] CLI detection results:`, JSON.stringify(results, null, 2));
1667
+ // Use cached status (refreshed by smart scheduler) instead of forceCliDetection on every request
1668
+ const results = await this.cliManager.getCliStatus();
1669
+ console.error(`[Stdio Wrapper] CLI status (cached):`, JSON.stringify(results, null, 2));
1662
1670
  const availableProviders = [];
1663
1671
  const unavailableProviders = [];
1664
1672
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polydev-ai",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "engines": {
5
5
  "node": ">=20.x <=22.x"
6
6
  },