polydev-ai 1.8.13 → 1.8.14
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 +37 -0
- package/mcp/stdio-wrapper.js +5 -0
- package/package.json +1 -1
package/lib/cliManager.js
CHANGED
|
@@ -183,6 +183,7 @@ class CLIManager {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
let authenticated = false;
|
|
186
|
+
let quotaExhausted = false;
|
|
186
187
|
|
|
187
188
|
// For Claude Code, skip command-based auth check and use file-based detection directly
|
|
188
189
|
// This avoids the recursion issue when running from within Claude Code
|
|
@@ -211,6 +212,12 @@ class CLIManager {
|
|
|
211
212
|
|
|
212
213
|
authenticated = this.parseAuthenticationStatus(provider.id, authOutput);
|
|
213
214
|
|
|
215
|
+
// Check for quota exhaustion (authenticated but rate limited)
|
|
216
|
+
if (provider.id === 'gemini_cli') {
|
|
217
|
+
quotaExhausted = authOutput.includes('exhausted your daily quota') ||
|
|
218
|
+
authOutput.includes('quota') && authOutput.includes('exhausted');
|
|
219
|
+
}
|
|
220
|
+
|
|
214
221
|
} catch (authError) {
|
|
215
222
|
if (process.env.POLYDEV_CLI_DEBUG) {
|
|
216
223
|
console.log(`[CLI Debug] Auth check failed for ${provider.id}:`, authError);
|
|
@@ -262,6 +269,7 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
262
269
|
return {
|
|
263
270
|
available: true,
|
|
264
271
|
authenticated,
|
|
272
|
+
quota_exhausted: quotaExhausted,
|
|
265
273
|
version,
|
|
266
274
|
path: cliPath,
|
|
267
275
|
last_checked: new Date(),
|
|
@@ -437,6 +445,19 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
437
445
|
};
|
|
438
446
|
}
|
|
439
447
|
|
|
448
|
+
// Check if CLI has quota exhausted - skip and suggest API fallback
|
|
449
|
+
if (providerStatus.quota_exhausted) {
|
|
450
|
+
console.log(`[Polydev CLI] ${provider.name} has exhausted daily quota, skipping CLI (use API fallback)`);
|
|
451
|
+
return {
|
|
452
|
+
success: false,
|
|
453
|
+
error: `${provider.name} has exhausted daily quota. Use API fallback.`,
|
|
454
|
+
error_code: 'QUOTA_EXHAUSTED',
|
|
455
|
+
latency_ms: Date.now() - startTime,
|
|
456
|
+
provider: providerId,
|
|
457
|
+
timestamp: new Date()
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
440
461
|
// Log model being used
|
|
441
462
|
if (model) {
|
|
442
463
|
console.log(`[Polydev CLI] Using model for ${providerId}: ${model}`);
|
|
@@ -611,6 +632,22 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
611
632
|
}
|
|
612
633
|
|
|
613
634
|
lastErrorMessage = result.error;
|
|
635
|
+
|
|
636
|
+
// Check for quota exhaustion error during execution
|
|
637
|
+
const combinedOutput = ((result.stdout || '') + ' ' + (result.stderr || '') + ' ' + (result.error || '')).toLowerCase();
|
|
638
|
+
if (combinedOutput.includes('exhausted') && combinedOutput.includes('quota') ||
|
|
639
|
+
combinedOutput.includes('rate limit') ||
|
|
640
|
+
combinedOutput.includes('too many requests')) {
|
|
641
|
+
console.log(`[Polydev CLI] ${providerId} quota/rate limit error detected during execution`);
|
|
642
|
+
return {
|
|
643
|
+
success: false,
|
|
644
|
+
error: `${provider.name} quota/rate limit exceeded. Use API fallback.`,
|
|
645
|
+
error_code: 'QUOTA_EXHAUSTED',
|
|
646
|
+
latency_ms: Date.now() - startTime,
|
|
647
|
+
provider: providerId,
|
|
648
|
+
timestamp: new Date()
|
|
649
|
+
};
|
|
650
|
+
}
|
|
614
651
|
} catch (error) {
|
|
615
652
|
lastErrorMessage = error instanceof Error ? error.message : String(error);
|
|
616
653
|
|
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -559,6 +559,11 @@ class StdioMCPWrapper {
|
|
|
559
559
|
for (const providerId of priorityOrder) {
|
|
560
560
|
const status = results[providerId];
|
|
561
561
|
if (status && status.available && status.authenticated) {
|
|
562
|
+
// Skip providers with quota exhausted - they'll use API fallback
|
|
563
|
+
if (status.quota_exhausted) {
|
|
564
|
+
console.error(`[Stdio Wrapper] Skipping ${providerId} - quota exhausted, will use API fallback`);
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
562
567
|
availableProviders.push(providerId);
|
|
563
568
|
}
|
|
564
569
|
}
|
package/package.json
CHANGED