polydev-ai 1.8.78 → 1.8.79
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 +13 -26
- package/package.json +1 -1
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -400,7 +400,7 @@ class StdioMCPWrapper {
|
|
|
400
400
|
*/
|
|
401
401
|
async handleLoginTool(params, id) {
|
|
402
402
|
const http = require('http');
|
|
403
|
-
const {
|
|
403
|
+
const { spawn } = require('child_process');
|
|
404
404
|
|
|
405
405
|
return new Promise((resolve) => {
|
|
406
406
|
// Check if already authenticated
|
|
@@ -479,26 +479,17 @@ class StdioMCPWrapper {
|
|
|
479
479
|
|
|
480
480
|
console.error(`[Polydev] Opening browser for authentication: ${authUrl}`);
|
|
481
481
|
|
|
482
|
-
// Open browser
|
|
482
|
+
// Open browser - use spawn with detached for better reliability in stdio context
|
|
483
483
|
const platform = process.platform;
|
|
484
|
-
|
|
484
|
+
|
|
485
485
|
if (platform === 'darwin') {
|
|
486
|
-
|
|
487
|
-
args = [authUrl];
|
|
486
|
+
spawn('open', [authUrl], { detached: true, stdio: 'ignore' }).unref();
|
|
488
487
|
} else if (platform === 'win32') {
|
|
489
|
-
cmd
|
|
490
|
-
args = ['/c', 'start', '', authUrl];
|
|
488
|
+
spawn('cmd', ['/c', 'start', '', authUrl], { detached: true, stdio: 'ignore', shell: true }).unref();
|
|
491
489
|
} else {
|
|
492
|
-
|
|
493
|
-
args = [authUrl];
|
|
490
|
+
spawn('xdg-open', [authUrl], { detached: true, stdio: 'ignore' }).unref();
|
|
494
491
|
}
|
|
495
492
|
|
|
496
|
-
execFile(cmd, args, (err) => {
|
|
497
|
-
if (err) {
|
|
498
|
-
console.error('[Polydev] Could not open browser:', err.message);
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
|
|
502
493
|
// Timeout after 5 minutes
|
|
503
494
|
setTimeout(() => {
|
|
504
495
|
server.close();
|
|
@@ -2047,7 +2038,7 @@ class StdioMCPWrapper {
|
|
|
2047
2038
|
*/
|
|
2048
2039
|
async autoLoginOnStartup() {
|
|
2049
2040
|
const http = require('http');
|
|
2050
|
-
const {
|
|
2041
|
+
const { spawn } = require('child_process');
|
|
2051
2042
|
|
|
2052
2043
|
return new Promise((resolve) => {
|
|
2053
2044
|
const server = http.createServer((req, res) => {
|
|
@@ -2107,7 +2098,7 @@ class StdioMCPWrapper {
|
|
|
2107
2098
|
console.error(authUrl);
|
|
2108
2099
|
console.error('');
|
|
2109
2100
|
|
|
2110
|
-
// Open browser
|
|
2101
|
+
// Open browser - use spawn with detached for better reliability in stdio context
|
|
2111
2102
|
const platform = process.platform;
|
|
2112
2103
|
let cmd, args;
|
|
2113
2104
|
if (platform === 'darwin') {
|
|
@@ -2121,11 +2112,7 @@ class StdioMCPWrapper {
|
|
|
2121
2112
|
args = [authUrl];
|
|
2122
2113
|
}
|
|
2123
2114
|
|
|
2124
|
-
|
|
2125
|
-
if (err) {
|
|
2126
|
-
console.error('[!] Could not open browser automatically.');
|
|
2127
|
-
}
|
|
2128
|
-
});
|
|
2115
|
+
spawn(cmd, args, { detached: true, stdio: 'ignore' }).unref();
|
|
2129
2116
|
|
|
2130
2117
|
// Don't block forever - resolve after timeout
|
|
2131
2118
|
setTimeout(() => {
|
|
@@ -2231,16 +2218,16 @@ class StdioMCPWrapper {
|
|
|
2231
2218
|
console.error('Opening Polydev Models page for API key configuration...');
|
|
2232
2219
|
console.error('Add your API keys to unlock more models!\n');
|
|
2233
2220
|
|
|
2234
|
-
const {
|
|
2221
|
+
const { spawn } = require('child_process');
|
|
2235
2222
|
const modelsUrl = 'https://polydev.ai/dashboard/models';
|
|
2236
2223
|
const platform = process.platform;
|
|
2237
2224
|
|
|
2238
2225
|
if (platform === 'darwin') {
|
|
2239
|
-
|
|
2226
|
+
spawn('open', [modelsUrl], { detached: true, stdio: 'ignore' }).unref();
|
|
2240
2227
|
} else if (platform === 'win32') {
|
|
2241
|
-
|
|
2228
|
+
spawn('cmd', ['/c', 'start', '', modelsUrl], { detached: true, stdio: 'ignore', shell: true }).unref();
|
|
2242
2229
|
} else {
|
|
2243
|
-
|
|
2230
|
+
spawn('xdg-open', [modelsUrl], { detached: true, stdio: 'ignore' }).unref();
|
|
2244
2231
|
}
|
|
2245
2232
|
}
|
|
2246
2233
|
} catch (error) {
|