polydev-ai 1.9.25 → 1.9.26
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 +8 -8
- package/mcp/stdio-wrapper.js +18 -18
- package/package.json +1 -1
package/lib/cliManager.js
CHANGED
|
@@ -208,7 +208,7 @@ class CLIManager {
|
|
|
208
208
|
provider.command,
|
|
209
209
|
provider.subcommands.version,
|
|
210
210
|
'args',
|
|
211
|
-
|
|
211
|
+
400000
|
|
212
212
|
);
|
|
213
213
|
version = versionResult.stdout?.trim();
|
|
214
214
|
} catch (versionError) {
|
|
@@ -244,7 +244,7 @@ class CLIManager {
|
|
|
244
244
|
provider.command,
|
|
245
245
|
provider.subcommands.auth_status,
|
|
246
246
|
'args',
|
|
247
|
-
|
|
247
|
+
400000 // Reduced timeout to 5 seconds
|
|
248
248
|
);
|
|
249
249
|
|
|
250
250
|
// If command succeeds, check output for authentication indicators
|
|
@@ -458,16 +458,16 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
async sendCliPrompt(providerId, prompt, mode = 'args', timeoutMs = null, model = null) {
|
|
461
|
-
// Set default timeout for CLI responses (
|
|
461
|
+
// Set default timeout for CLI responses (400 seconds)
|
|
462
462
|
// CLI-within-CLI scenarios (Claude Code calling Claude Code) need generous timeouts
|
|
463
463
|
if (timeoutMs === null) {
|
|
464
|
-
timeoutMs =
|
|
464
|
+
timeoutMs = 400000; // 400 seconds default for CLI responses
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
// Ensure timeoutMs is valid (not undefined, null, Infinity, or negative)
|
|
468
468
|
// Allow up to 600 seconds (10 minutes) for very complex operations
|
|
469
469
|
if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 600000) {
|
|
470
|
-
timeoutMs =
|
|
470
|
+
timeoutMs = 400000 // Default to 400 seconds for CLI responses
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
const startTime = Date.now();
|
|
@@ -806,11 +806,11 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
808
|
|
|
809
|
-
async executeCliCommand(command, args, mode = 'args', timeoutMs =
|
|
809
|
+
async executeCliCommand(command, args, mode = 'args', timeoutMs = 400000, stdinInput) {
|
|
810
810
|
// Ensure timeoutMs is valid (not undefined, null, Infinity, or negative)
|
|
811
|
-
//
|
|
811
|
+
// 400 seconds default for CLI responses
|
|
812
812
|
if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 600000) {
|
|
813
|
-
timeoutMs =
|
|
813
|
+
timeoutMs = 400000 // Default to 400 seconds
|
|
814
814
|
}
|
|
815
815
|
|
|
816
816
|
return new Promise((resolve, reject) => {
|
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -35,7 +35,7 @@ if (typeof globalThis.fetch === 'undefined') {
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
req.on('error', reject);
|
|
38
|
-
req.setTimeout(
|
|
38
|
+
req.setTimeout(400000, () => { req.destroy(); reject(new Error('Request timed out')); });
|
|
39
39
|
if (options.body) req.write(options.body);
|
|
40
40
|
req.end();
|
|
41
41
|
});
|
|
@@ -308,7 +308,7 @@ class StdioMCPWrapper {
|
|
|
308
308
|
this.clientInfo = null;
|
|
309
309
|
|
|
310
310
|
// Adaptive timeout tracking: stores recent response times per CLI
|
|
311
|
-
// Used to set smarter timeouts instead of fixed
|
|
311
|
+
// Used to set smarter timeouts instead of fixed 400s
|
|
312
312
|
this.cliResponseTimes = {}; // { cliId: [latency_ms, ...] }
|
|
313
313
|
this.CLI_RESPONSE_HISTORY_SIZE = 5; // Keep last 5 response times
|
|
314
314
|
this.loadCliResponseTimes(); // Load from disk
|
|
@@ -644,7 +644,7 @@ To authenticate, use one of these methods:
|
|
|
644
644
|
// if this process dies, the new one can resume polling with same session)
|
|
645
645
|
this.startLoginPolling(sessionId);
|
|
646
646
|
|
|
647
|
-
// Wait for authentication to complete (blocks up to
|
|
647
|
+
// Wait for authentication to complete (blocks up to 400s)
|
|
648
648
|
console.error('[Polydev] Waiting for browser authentication to complete...');
|
|
649
649
|
const authenticated = await this.waitForAuthCompletion();
|
|
650
650
|
|
|
@@ -721,10 +721,10 @@ Still waiting for login. Use /polydev:auth to check status after signing in.`
|
|
|
721
721
|
/**
|
|
722
722
|
* Wait for authentication to complete by polling this.isAuthenticated
|
|
723
723
|
* Used to block tool calls until login is detected by startLoginPolling
|
|
724
|
-
* @param {number} timeoutMs - Max time to wait (default
|
|
724
|
+
* @param {number} timeoutMs - Max time to wait (default 400s)
|
|
725
725
|
* @returns {boolean} true if authenticated, false if timed out
|
|
726
726
|
*/
|
|
727
|
-
async waitForAuthCompletion(timeoutMs =
|
|
727
|
+
async waitForAuthCompletion(timeoutMs = 400000) {
|
|
728
728
|
const pollInterval = 3000; // Check every 3 seconds
|
|
729
729
|
const maxPolls = Math.floor(timeoutMs / pollInterval);
|
|
730
730
|
|
|
@@ -813,7 +813,7 @@ Dashboard: https://polydev.ai/dashboard`
|
|
|
813
813
|
|
|
814
814
|
/**
|
|
815
815
|
* Trigger re-authentication by opening browser and starting polling
|
|
816
|
-
* Waits for auth to complete inline (up to
|
|
816
|
+
* Waits for auth to complete inline (up to 400s) then returns full status
|
|
817
817
|
* Used when token is detected as invalid/expired
|
|
818
818
|
* @param {*} id - JSON-RPC request id
|
|
819
819
|
* @param {string} reason - Human-readable reason for re-auth
|
|
@@ -879,7 +879,7 @@ To authenticate, pass your token directly:
|
|
|
879
879
|
this.savePendingSession(sessionId);
|
|
880
880
|
this.startLoginPolling(sessionId);
|
|
881
881
|
|
|
882
|
-
// Wait for authentication to complete (blocks up to
|
|
882
|
+
// Wait for authentication to complete (blocks up to 400s)
|
|
883
883
|
console.error('[Polydev] Waiting for browser authentication to complete...');
|
|
884
884
|
const authenticated = await this.waitForAuthCompletion();
|
|
885
885
|
|
|
@@ -1572,7 +1572,7 @@ To re-login: /polydev:login`
|
|
|
1572
1572
|
try {
|
|
1573
1573
|
// Use AbortController for timeout if available, otherwise rely on fetch timeout
|
|
1574
1574
|
const controller = typeof AbortController !== 'undefined' ? new AbortController() : null;
|
|
1575
|
-
const timeoutId = controller ? setTimeout(() => controller.abort(),
|
|
1575
|
+
const timeoutId = controller ? setTimeout(() => controller.abort(), 400000) : null; // 400s timeout
|
|
1576
1576
|
|
|
1577
1577
|
const response = await fetch('https://www.polydev.ai/api/mcp', {
|
|
1578
1578
|
method: 'POST',
|
|
@@ -1889,19 +1889,19 @@ To re-login: /polydev:login`
|
|
|
1889
1889
|
console.error(`[Stdio Wrapper] Local CLI prompt sending with perspectives`);
|
|
1890
1890
|
|
|
1891
1891
|
try {
|
|
1892
|
-
let { provider_id, prompt, mode = 'args', timeout_ms =
|
|
1892
|
+
let { provider_id, prompt, mode = 'args', timeout_ms = 400000 } = args;
|
|
1893
1893
|
|
|
1894
1894
|
// Ensure timeout_ms is valid (not undefined, null, Infinity, or negative)
|
|
1895
|
-
// Default to
|
|
1895
|
+
// Default to 400 seconds for complex CLI responses
|
|
1896
1896
|
if (!timeout_ms || timeout_ms === Infinity || timeout_ms < 1 || timeout_ms > 600000) {
|
|
1897
|
-
timeout_ms =
|
|
1897
|
+
timeout_ms = 400000; // Default to 400 seconds for CLI responses
|
|
1898
1898
|
}
|
|
1899
1899
|
|
|
1900
1900
|
if (!prompt) {
|
|
1901
1901
|
throw new Error('prompt is required');
|
|
1902
1902
|
}
|
|
1903
1903
|
|
|
1904
|
-
// Use configured timeout but cap at
|
|
1904
|
+
// Use configured timeout but cap at 400s max for safety
|
|
1905
1905
|
const gracefulTimeout = Math.min(timeout_ms, 600000);
|
|
1906
1906
|
|
|
1907
1907
|
// Fetch user's model preferences (cached, non-blocking on failure)
|
|
@@ -2050,7 +2050,7 @@ To re-login: /polydev:login`
|
|
|
2050
2050
|
if (model) {
|
|
2051
2051
|
console.error(`[Stdio Wrapper] Using model for ${providerEntry.cliId}: ${model}`);
|
|
2052
2052
|
}
|
|
2053
|
-
// Use adaptive timeout based on historical response times (instead of fixed
|
|
2053
|
+
// Use adaptive timeout based on historical response times (instead of fixed 400s)
|
|
2054
2054
|
const cliTimeout = this.getAdaptiveTimeout(providerEntry.cliId, gracefulTimeout);
|
|
2055
2055
|
let result = await this.cliManager.sendCliPrompt(providerEntry.cliId, prompt, mode, cliTimeout, model);
|
|
2056
2056
|
|
|
@@ -2194,7 +2194,7 @@ To re-login: /polydev:login`
|
|
|
2194
2194
|
if (result.success) successCount++;
|
|
2195
2195
|
completedCount++;
|
|
2196
2196
|
|
|
2197
|
-
// Resolve early if we have enough successes OR all
|
|
2197
|
+
// Resolve early if we have enough successes OR all complete
|
|
2198
2198
|
if (successCount >= needed || completedCount >= promises.length) {
|
|
2199
2199
|
resolved = true;
|
|
2200
2200
|
resolve([...results]); // Copy to prevent mutation from late arrivals
|
|
@@ -2713,16 +2713,16 @@ To re-login: /polydev:login`
|
|
|
2713
2713
|
|
|
2714
2714
|
/**
|
|
2715
2715
|
* Get adaptive timeout for a CLI based on historical response times
|
|
2716
|
-
* Returns timeout in ms (2.5x the average, with min 30s and max
|
|
2716
|
+
* Returns timeout in ms (2.5x the average, with min 30s and max 400s)
|
|
2717
2717
|
*/
|
|
2718
|
-
getAdaptiveTimeout(cliId, defaultTimeout =
|
|
2718
|
+
getAdaptiveTimeout(cliId, defaultTimeout = 400000) {
|
|
2719
2719
|
const times = this.cliResponseTimes[cliId];
|
|
2720
2720
|
if (!times || times.length === 0) {
|
|
2721
2721
|
return defaultTimeout; // No history, use default
|
|
2722
2722
|
}
|
|
2723
2723
|
const avg = times.reduce((a, b) => a + b, 0) / times.length;
|
|
2724
|
-
// 2.5x average, clamped between 30s and
|
|
2725
|
-
const adaptive = Math.min(
|
|
2724
|
+
// 2.5x average, clamped between 30s and 400s
|
|
2725
|
+
const adaptive = Math.min(400000, Math.max(30000, Math.round(avg * 2.5)));
|
|
2726
2726
|
console.error(`[Stdio Wrapper] Adaptive timeout for ${cliId}: ${adaptive}ms (avg: ${Math.round(avg)}ms from ${times.length} samples)`);
|
|
2727
2727
|
return adaptive;
|
|
2728
2728
|
}
|