polydev-ai 1.8.42 → 1.8.44
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 +14 -5
- package/mcp/stdio-wrapper.js +38 -5
- package/package.json +2 -2
package/lib/cliManager.js
CHANGED
|
@@ -585,8 +585,9 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
585
585
|
args = ['--model', model, ...args, prompt];
|
|
586
586
|
} else if (providerId === 'gemini_cli') {
|
|
587
587
|
// Gemini CLI: -m for model, -p for prompt (headless mode)
|
|
588
|
-
//
|
|
589
|
-
|
|
588
|
+
// Add prompt prefix to prevent tool planning in non-interactive mode
|
|
589
|
+
const geminiPrompt = `Answer directly without using any tools, file operations, or searches. Do not say "I will search" or "I will look up". Provide your analysis immediately.\n\n${prompt}`;
|
|
590
|
+
args = ['-m', model, '-p', geminiPrompt];
|
|
590
591
|
} else {
|
|
591
592
|
// Default: just append prompt
|
|
592
593
|
args = [...args, prompt];
|
|
@@ -594,8 +595,10 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
594
595
|
} else {
|
|
595
596
|
// No model specified
|
|
596
597
|
if (providerId === 'gemini_cli') {
|
|
597
|
-
// Gemini CLI
|
|
598
|
-
|
|
598
|
+
// Gemini CLI: -p for headless mode
|
|
599
|
+
// Add prompt prefix to prevent tool planning in non-interactive mode
|
|
600
|
+
const geminiPrompt = `Answer directly without using any tools, file operations, or searches. Do not say "I will search" or "I will look up". Provide your analysis immediately.\n\n${prompt}`;
|
|
601
|
+
args = ['-p', geminiPrompt];
|
|
599
602
|
} else {
|
|
600
603
|
args = [...args, prompt];
|
|
601
604
|
}
|
|
@@ -752,7 +755,13 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
752
755
|
const child = spawn(command, args, {
|
|
753
756
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
754
757
|
shell: process.platform === 'win32',
|
|
755
|
-
timeout: timeoutMs
|
|
758
|
+
timeout: timeoutMs,
|
|
759
|
+
// Explicitly pass environment to ensure HOME is available for CLI tools
|
|
760
|
+
// that read config from ~/.config or similar paths (e.g., Gemini CLI)
|
|
761
|
+
env: {
|
|
762
|
+
...process.env,
|
|
763
|
+
HOME: process.env.HOME || os.homedir()
|
|
764
|
+
}
|
|
756
765
|
});
|
|
757
766
|
|
|
758
767
|
if (child.stdin) {
|
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -265,7 +265,14 @@ class StdioMCPWrapper {
|
|
|
265
265
|
// Smart refresh scheduler (will be started after initialization)
|
|
266
266
|
this.refreshScheduler = null;
|
|
267
267
|
|
|
268
|
-
//
|
|
268
|
+
// CLI detection readiness tracking - requests will wait for this
|
|
269
|
+
// Create the promise NOW in constructor so it exists before any requests arrive
|
|
270
|
+
this._cliDetectionComplete = false;
|
|
271
|
+
this._cliDetectionReady = new Promise((resolve) => {
|
|
272
|
+
this._cliDetectionResolver = resolve;
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// Cache for user model preferences
|
|
269
276
|
this.userModelPreferences = null;
|
|
270
277
|
this.perspectivesPerMessage = 2; // Default to 2 perspectives
|
|
271
278
|
this.modelPreferencesCacheTime = null;
|
|
@@ -514,6 +521,7 @@ class StdioMCPWrapper {
|
|
|
514
521
|
|
|
515
522
|
// Force detection using CLI Manager (no remote API calls)
|
|
516
523
|
const results = await this.cliManager.forceCliDetection(providerId);
|
|
524
|
+
console.error(`[Stdio Wrapper] CLI detection results:`, JSON.stringify(results, null, 2));
|
|
517
525
|
|
|
518
526
|
// Save status locally to file-based cache
|
|
519
527
|
await this.saveLocalCliStatus(results);
|
|
@@ -651,7 +659,10 @@ class StdioMCPWrapper {
|
|
|
651
659
|
if (allProviders.length === 0) {
|
|
652
660
|
// Fallback: use legacy CLI-only flow
|
|
653
661
|
console.error(`[Stdio Wrapper] No allProviders, using legacy CLI-only flow`);
|
|
654
|
-
|
|
662
|
+
// NOTE: Use length check because empty array [] is truthy in JS
|
|
663
|
+
const userOrder = (this.userProviderOrder && this.userProviderOrder.length > 0)
|
|
664
|
+
? this.userProviderOrder
|
|
665
|
+
: ['claude_code', 'codex_cli', 'gemini_cli'];
|
|
655
666
|
const cliProviders = userOrder.slice(0, maxPerspectives).filter(p => availableClis.includes(p));
|
|
656
667
|
|
|
657
668
|
const cliPromises = cliProviders.map(async (providerId) => {
|
|
@@ -788,13 +799,24 @@ class StdioMCPWrapper {
|
|
|
788
799
|
*/
|
|
789
800
|
async getAllAvailableProviders() {
|
|
790
801
|
try {
|
|
802
|
+
// Wait for initial CLI detection to complete if it's still running
|
|
803
|
+
if (this._cliDetectionReady && !this._cliDetectionComplete) {
|
|
804
|
+
console.error('[Stdio Wrapper] Waiting for initial CLI detection to complete...');
|
|
805
|
+
await this._cliDetectionReady;
|
|
806
|
+
console.error('[Stdio Wrapper] CLI detection ready, proceeding with request');
|
|
807
|
+
}
|
|
808
|
+
|
|
791
809
|
const results = await this.cliManager.forceCliDetection();
|
|
810
|
+
console.error(`[Stdio Wrapper] CLI detection results:`, JSON.stringify(results, null, 2));
|
|
792
811
|
const availableProviders = [];
|
|
793
812
|
const unavailableProviders = [];
|
|
794
813
|
|
|
795
814
|
// Use user's provider order from dashboard (fetched via model-preferences API)
|
|
796
|
-
// Falls back to default order if not yet loaded
|
|
797
|
-
|
|
815
|
+
// Falls back to default order if not yet loaded or empty
|
|
816
|
+
// NOTE: Use length check because empty array [] is truthy in JS
|
|
817
|
+
const priorityOrder = (this.userProviderOrder && this.userProviderOrder.length > 0)
|
|
818
|
+
? this.userProviderOrder
|
|
819
|
+
: ['claude_code', 'codex_cli', 'gemini_cli'];
|
|
798
820
|
console.error(`[Stdio Wrapper] Using provider order: ${priorityOrder.join(' > ')}`);
|
|
799
821
|
|
|
800
822
|
for (const providerId of priorityOrder) {
|
|
@@ -1541,7 +1563,10 @@ class StdioMCPWrapper {
|
|
|
1541
1563
|
// Cache provider order from user's dashboard (respects display_order)
|
|
1542
1564
|
// This determines which CLIs/APIs to use first
|
|
1543
1565
|
// IMPORTANT: This is cached alongside modelPreferences and restored when cache is used
|
|
1544
|
-
|
|
1566
|
+
// NOTE: Use length check because empty array [] is truthy in JS
|
|
1567
|
+
this.userProviderOrder = (result.providerOrder && result.providerOrder.length > 0)
|
|
1568
|
+
? result.providerOrder
|
|
1569
|
+
: ['claude_code', 'codex_cli', 'gemini_cli'];
|
|
1545
1570
|
|
|
1546
1571
|
// NEW: Cache full list of all providers (CLI + API-only) from dashboard
|
|
1547
1572
|
// Format: [{ provider: 'openai', model: 'gpt-52-codex', cliId: 'codex_cli' }, { provider: 'x-ai', model: 'grok-4', cliId: null }, ...]
|
|
@@ -1645,15 +1670,23 @@ class StdioMCPWrapper {
|
|
|
1645
1670
|
console.error('Stdio MCP Wrapper ready and listening on stdin...');
|
|
1646
1671
|
|
|
1647
1672
|
// Run initial CLI detection in the background so MCP handshake isn't blocked.
|
|
1673
|
+
// The promise was already created in constructor so requests will wait for it
|
|
1648
1674
|
console.error('[Stdio Wrapper] Running initial CLI detection...');
|
|
1675
|
+
|
|
1649
1676
|
this.localForceCliDetection({})
|
|
1650
1677
|
.then(() => {
|
|
1651
1678
|
console.error('[Stdio Wrapper] Initial CLI detection completed');
|
|
1679
|
+
this._cliDetectionComplete = true;
|
|
1652
1680
|
})
|
|
1653
1681
|
.catch((error) => {
|
|
1654
1682
|
console.error('[Stdio Wrapper] Initial CLI detection failed:', error);
|
|
1683
|
+
this._cliDetectionComplete = true; // Mark complete even on failure
|
|
1655
1684
|
})
|
|
1656
1685
|
.finally(() => {
|
|
1686
|
+
// Resolve the readiness promise so waiting requests can proceed
|
|
1687
|
+
if (this._cliDetectionResolver) {
|
|
1688
|
+
this._cliDetectionResolver();
|
|
1689
|
+
}
|
|
1657
1690
|
// Start smart refresh scheduler after initial detection attempt
|
|
1658
1691
|
this.startSmartRefreshScheduler();
|
|
1659
1692
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polydev-ai",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.44",
|
|
4
4
|
"mcpName": "io.github.backspacevenkat/perspectives",
|
|
5
5
|
"description": "Agentic workflow assistant with CLI integration - get diverse perspectives from multiple LLMs when stuck or need enhanced reasoning",
|
|
6
6
|
"keywords": [
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"lucide-react": "^0.542.0",
|
|
69
69
|
"marked": "^16.2.1",
|
|
70
70
|
"next": "^15.5.7",
|
|
71
|
-
"polydev-ai": "^1.8.
|
|
71
|
+
"polydev-ai": "^1.8.42",
|
|
72
72
|
"posthog-js": "^1.157.2",
|
|
73
73
|
"prismjs": "^1.30.0",
|
|
74
74
|
"react": "^18.3.1",
|