polydev-ai 1.9.18 → 1.9.19
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/mcp/stdio-wrapper.js +32 -31
- package/package.json +1 -1
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -845,14 +845,16 @@ Still waiting for login. Use /polydev:auth to check status after signing in.`
|
|
|
845
845
|
}
|
|
846
846
|
};
|
|
847
847
|
} catch (error) {
|
|
848
|
-
const
|
|
848
|
+
const errCode = error.cause?.code || error.code || '';
|
|
849
|
+
const cause = errCode ? ` (${errCode})` : (error.cause?.message ? ` (${error.cause.message})` : '');
|
|
850
|
+
console.error(`[Polydev] Re-auth failed: ${error.message}${cause}`);
|
|
849
851
|
return {
|
|
850
852
|
jsonrpc: '2.0',
|
|
851
853
|
id,
|
|
852
854
|
result: {
|
|
853
855
|
content: [{
|
|
854
856
|
type: 'text',
|
|
855
|
-
text: `${reason}\n\nCould not reach server: ${error.message}${cause}\
|
|
857
|
+
text: `${reason}\n\nCould not reach Polydev server: ${error.message}${cause}\n\nTroubleshooting:\n 1. Check your internet connection\n 2. Try: /polydev:login\n 3. Or run in terminal: npx polydev-ai`
|
|
856
858
|
}],
|
|
857
859
|
isError: true
|
|
858
860
|
}
|
|
@@ -940,25 +942,9 @@ Still waiting for login. Use /polydev:auth to check status after signing in.`
|
|
|
940
942
|
}
|
|
941
943
|
|
|
942
944
|
if (!this.isAuthenticated || !this.userToken) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
result: {
|
|
947
|
-
content: [{
|
|
948
|
-
type: 'text',
|
|
949
|
-
text: `POLYDEV STATUS
|
|
950
|
-
==============
|
|
951
|
-
|
|
952
|
-
Authentication: Not connected
|
|
953
|
-
|
|
954
|
-
To login:
|
|
955
|
-
1. Use the "login" tool (opens browser)
|
|
956
|
-
2. Or run: npx polydev-ai
|
|
957
|
-
|
|
958
|
-
Token will be saved automatically after login.`
|
|
959
|
-
}]
|
|
960
|
-
}
|
|
961
|
-
};
|
|
945
|
+
// No token found anywhere — auto-trigger login instead of showing static message
|
|
946
|
+
console.error('[Polydev] No token found, auto-triggering login flow...');
|
|
947
|
+
return await this.triggerReAuth(id, 'Not authenticated. Opening browser for login...');
|
|
962
948
|
}
|
|
963
949
|
|
|
964
950
|
try {
|
|
@@ -1053,6 +1039,16 @@ Configure: https://polydev.ai/dashboard/models`
|
|
|
1053
1039
|
return await this.triggerReAuth(id, 'Token invalid or expired.');
|
|
1054
1040
|
}
|
|
1055
1041
|
} catch (error) {
|
|
1042
|
+
// Categorize the error for clearer user messaging
|
|
1043
|
+
const errCode = error.cause?.code || error.code || '';
|
|
1044
|
+
const isNetwork = ['ECONNREFUSED', 'ENOTFOUND', 'ETIMEDOUT', 'ECONNRESET', 'UND_ERR_CONNECT_TIMEOUT', 'FETCH_ERROR'].includes(errCode)
|
|
1045
|
+
|| error.message?.includes('fetch') || error.message?.includes('network');
|
|
1046
|
+
const errorDetail = isNetwork
|
|
1047
|
+
? `Network error: ${error.message}${errCode ? ` (${errCode})` : ''}\nCheck your internet connection and try again.`
|
|
1048
|
+
: `Error: ${error.message}${errCode ? ` (${errCode})` : ''}`;
|
|
1049
|
+
|
|
1050
|
+
console.error(`[Polydev] Auth status check failed: ${error.message} (code: ${errCode})`);
|
|
1051
|
+
|
|
1056
1052
|
return {
|
|
1057
1053
|
jsonrpc: '2.0',
|
|
1058
1054
|
id,
|
|
@@ -1062,9 +1058,12 @@ Configure: https://polydev.ai/dashboard/models`
|
|
|
1062
1058
|
text: `POLYDEV STATUS
|
|
1063
1059
|
==============
|
|
1064
1060
|
|
|
1065
|
-
Could not verify status
|
|
1061
|
+
Could not verify authentication status.
|
|
1062
|
+
|
|
1063
|
+
${errorDetail}
|
|
1066
1064
|
|
|
1067
|
-
|
|
1065
|
+
To retry: /polydev:auth
|
|
1066
|
+
To re-login: /polydev:login`
|
|
1068
1067
|
}],
|
|
1069
1068
|
isError: true
|
|
1070
1069
|
}
|
|
@@ -1831,7 +1830,7 @@ Error: ${error.message}`
|
|
|
1831
1830
|
// Detect if we should exclude the current IDE's CLI to avoid recursive calls
|
|
1832
1831
|
const excludedCli = this.getExcludedCliForCurrentIDE();
|
|
1833
1832
|
if (excludedCli) {
|
|
1834
|
-
console.error(`[Stdio Wrapper]
|
|
1833
|
+
console.error(`[Stdio Wrapper] [CLI-FIRST] Skipping ${excludedCli} (same as current IDE — would cause recursive call)`);
|
|
1835
1834
|
}
|
|
1836
1835
|
|
|
1837
1836
|
// Build merged provider list: CLIs first, then API-only
|
|
@@ -1901,7 +1900,7 @@ Error: ${error.message}`
|
|
|
1901
1900
|
console.error(`[Stdio Wrapper] Provider breakdown: CLI=${cliProviderEntries.map(p => p.cliId).join(', ') || 'none'}, API-only=${apiOnlyProviders.map(p => p.provider).join(', ') || 'none'}`);
|
|
1902
1901
|
|
|
1903
1902
|
// Run ALL CLI prompts concurrently with fast-collect pattern
|
|
1904
|
-
// Resolves once we have maxPerspectives successes
|
|
1903
|
+
// Resolves once we have maxPerspectives successes OR all complete
|
|
1905
1904
|
if (cliProviderEntries.length > 0) {
|
|
1906
1905
|
const cliPromises = cliProviderEntries.map(async (providerEntry) => {
|
|
1907
1906
|
try {
|
|
@@ -1953,7 +1952,7 @@ Error: ${error.message}`
|
|
|
1953
1952
|
}
|
|
1954
1953
|
});
|
|
1955
1954
|
|
|
1956
|
-
// Fast-collect: resolve once we have maxPerspectives successes OR all complete
|
|
1955
|
+
// Fast-collect: resolve early once we have maxPerspectives successes OR all complete
|
|
1957
1956
|
localResults = await this.collectFirstNSuccesses(cliPromises, maxPerspectives);
|
|
1958
1957
|
console.error(`[Stdio Wrapper] Fast-collect: got ${localResults.filter(r => r.success).length} successful, ${localResults.filter(r => !r.success).length} failed out of ${cliPromises.length} CLIs`);
|
|
1959
1958
|
}
|
|
@@ -2664,7 +2663,7 @@ Error: ${error.message}`
|
|
|
2664
2663
|
const staleProviders = [];
|
|
2665
2664
|
for (const [providerId, status] of Object.entries(currentStatus)) {
|
|
2666
2665
|
if (this.isStale(status)) {
|
|
2667
|
-
const minutesOld = Math.floor((
|
|
2666
|
+
const minutesOld = Math.floor((now.getTime() - lastChecked.getTime()) / (1000 * 60));
|
|
2668
2667
|
const timeout = this.getSmartTimeout(status);
|
|
2669
2668
|
staleProviders.push({ providerId, minutesOld, timeout });
|
|
2670
2669
|
}
|
|
@@ -3153,16 +3152,18 @@ Dashboard: https://polydev.ai/dashboard`
|
|
|
3153
3152
|
console.error(`Credits: ${credits} | Tier: ${tier}`);
|
|
3154
3153
|
console.error('─'.repeat(50) + '\n');
|
|
3155
3154
|
} else {
|
|
3156
|
-
|
|
3155
|
+
// Don't clear isAuthenticated here — handleGetAuthStatus has its own
|
|
3156
|
+
// verification and triggerReAuth logic. Clearing here causes a race condition
|
|
3157
|
+
// where startup verification can invalidate auth before the user checks status.
|
|
3157
3158
|
console.error('─'.repeat(50));
|
|
3158
|
-
console.error('Polydev - Token
|
|
3159
|
+
console.error('Polydev - Token may be invalid');
|
|
3159
3160
|
console.error('─'.repeat(50));
|
|
3160
|
-
console.error('
|
|
3161
|
+
console.error('Server returned non-OK. Will re-verify on next auth check.');
|
|
3161
3162
|
console.error('Use the "login" tool or run: npx polydev-ai login');
|
|
3162
3163
|
console.error('─'.repeat(50) + '\n');
|
|
3163
3164
|
}
|
|
3164
3165
|
} catch (error) {
|
|
3165
|
-
console.error('[Polydev] Could not verify auth (offline?)');
|
|
3166
|
+
console.error('[Polydev] Could not verify auth (offline?):', error.message || 'unknown');
|
|
3166
3167
|
}
|
|
3167
3168
|
}
|
|
3168
3169
|
|