polydev-ai 1.9.5 → 1.9.7
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 +11 -4
- package/mcp/stdio-wrapper.js +12 -10
- package/package.json +1 -1
package/lib/cliManager.js
CHANGED
|
@@ -16,6 +16,13 @@ try {
|
|
|
16
16
|
|
|
17
17
|
const execAsync = promisify(exec);
|
|
18
18
|
|
|
19
|
+
// Known default models for each CLI tool (used when detection fails)
|
|
20
|
+
const CLI_DEFAULT_MODELS = {
|
|
21
|
+
'claude_code': 'claude-sonnet-4-5-20250929',
|
|
22
|
+
'gemini_cli': 'gemini-2.5-flash',
|
|
23
|
+
'codex_cli': 'o4-mini'
|
|
24
|
+
};
|
|
25
|
+
|
|
19
26
|
class CLIManager {
|
|
20
27
|
constructor(options = {}) {
|
|
21
28
|
this.providers = new Map();
|
|
@@ -548,7 +555,7 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
548
555
|
}
|
|
549
556
|
|
|
550
557
|
// Use detected model if available, otherwise fall back to what was requested or 'cli_default'
|
|
551
|
-
const actualModel = detectedModel || modelToUse || 'cli_default';
|
|
558
|
+
const actualModel = detectedModel || modelToUse || CLI_DEFAULT_MODELS[providerId] || 'cli_default';
|
|
552
559
|
|
|
553
560
|
if (detectedModel && detectedModel !== model) {
|
|
554
561
|
console.log(`[Polydev CLI] Codex CLI detected model: ${detectedModel} (requested: ${model || 'none'})`);
|
|
@@ -685,7 +692,7 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
685
692
|
|
|
686
693
|
// Detect actual model from CLI output
|
|
687
694
|
const detectedModel = this.detectModelFromOutput(providerId, result.stdout || '', result.stderr || '');
|
|
688
|
-
const actualModel = detectedModel || model || 'cli_default';
|
|
695
|
+
const actualModel = detectedModel || model || CLI_DEFAULT_MODELS[providerId] || 'cli_default';
|
|
689
696
|
|
|
690
697
|
if (detectedModel && detectedModel !== model) {
|
|
691
698
|
console.log(`[Polydev CLI] ${providerId} detected model: ${detectedModel} (requested: ${model || 'none'})`);
|
|
@@ -741,7 +748,7 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
741
748
|
|
|
742
749
|
// Detect actual model from fallback output
|
|
743
750
|
const detectedModel = this.detectModelFromOutput(providerId, fallbackResult.stdout || '', fallbackResult.stderr || '');
|
|
744
|
-
const actualModel = detectedModel || '
|
|
751
|
+
const actualModel = detectedModel || CLI_DEFAULT_MODELS[providerId] || 'cli_default';
|
|
745
752
|
|
|
746
753
|
if (detectedModel) {
|
|
747
754
|
console.log(`[Polydev CLI] ${providerId} fallback detected model: ${detectedModel}`);
|
|
@@ -1020,7 +1027,7 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
1020
1027
|
// Extract primary model from modelUsage
|
|
1021
1028
|
// The primary model is the one with highest cost - that's the user's configured main model
|
|
1022
1029
|
// (Haiku is used internally for quick tasks, but the expensive model is what the user chose)
|
|
1023
|
-
let primaryModel = 'cli_default';
|
|
1030
|
+
let primaryModel = CLI_DEFAULT_MODELS['claude_code'] || 'cli_default';
|
|
1024
1031
|
const modelUsage = json.modelUsage || {};
|
|
1025
1032
|
const modelNames = Object.keys(modelUsage);
|
|
1026
1033
|
|
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -1472,7 +1472,7 @@ Error: ${error.message}`
|
|
|
1472
1472
|
const { available: availableClis } = await this.getAllAvailableProviders();
|
|
1473
1473
|
console.error(`[Stdio Wrapper] Available CLIs: ${availableClis.join(', ') || 'none'}`);
|
|
1474
1474
|
|
|
1475
|
-
//
|
|
1475
|
+
// Get all providers from dashboard (user's configured providers + CLI-only)
|
|
1476
1476
|
const allProviders = this.allProviders || [];
|
|
1477
1477
|
|
|
1478
1478
|
// CLI to provider name mapping
|
|
@@ -1510,22 +1510,24 @@ Error: ${error.message}`
|
|
|
1510
1510
|
const providerName = cliToProviderMap[cliId];
|
|
1511
1511
|
usedProviderNames.add(providerName);
|
|
1512
1512
|
|
|
1513
|
-
// Check if user has a configured model for this provider
|
|
1514
|
-
//
|
|
1513
|
+
// Check if user has a configured model for this provider from their OWN API keys
|
|
1514
|
+
// IMPORTANT: Do NOT use credits-tier model names (they're internal to Polydev's API
|
|
1515
|
+
// and don't match CLI model names, e.g. 'gemini-3-flash' → ModelNotFoundError)
|
|
1516
|
+
// API key entries have no 'tier' field, credits entries have tier='normal'/'eco'/'premium'
|
|
1515
1517
|
const configuredProvider = allProviders.find(p => {
|
|
1516
1518
|
const normalized = normalizeProvider(p.provider);
|
|
1517
|
-
return normalized === providerName;
|
|
1519
|
+
return normalized === providerName && !p.tier; // Only match user's own API keys (no tier)
|
|
1518
1520
|
});
|
|
1519
1521
|
|
|
1520
1522
|
finalProviders.push({
|
|
1521
1523
|
provider: providerName,
|
|
1522
|
-
model: configuredProvider?.model || null,
|
|
1524
|
+
model: configuredProvider?.model || null, // null = use CLI's default model
|
|
1523
1525
|
cliId: cliId,
|
|
1524
1526
|
source: 'cli',
|
|
1525
|
-
tier:
|
|
1527
|
+
tier: null // CLIs don't use credits tiers
|
|
1526
1528
|
});
|
|
1527
1529
|
|
|
1528
|
-
console.error(`[Stdio Wrapper] [CLI-FIRST] Added CLI: ${cliId} (${providerName})${configuredProvider ? ` with
|
|
1530
|
+
console.error(`[Stdio Wrapper] [CLI-FIRST] Added CLI: ${cliId} (${providerName})${configuredProvider ? ` with user API key model: ${configuredProvider.model}` : ' with CLI default'}`);
|
|
1529
1531
|
}
|
|
1530
1532
|
|
|
1531
1533
|
// STEP 2: Fill remaining slots with API/credits providers (skip those already covered by CLI)
|
|
@@ -1823,9 +1825,9 @@ Error: ${error.message}`
|
|
|
1823
1825
|
|
|
1824
1826
|
// Fallback to descriptive defaults based on typical CLI models
|
|
1825
1827
|
const defaults = {
|
|
1826
|
-
'claude_code': 'claude-sonnet-4',
|
|
1827
|
-
'codex_cli': '
|
|
1828
|
-
'gemini_cli': 'gemini-2.5-
|
|
1828
|
+
'claude_code': 'claude-sonnet-4-5-20250929',
|
|
1829
|
+
'codex_cli': 'o4-mini',
|
|
1830
|
+
'gemini_cli': 'gemini-2.5-flash'
|
|
1829
1831
|
};
|
|
1830
1832
|
return defaults[providerId] || 'unknown';
|
|
1831
1833
|
}
|