polydev-ai 1.8.79 → 1.8.80
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 +35 -13
- package/package.json +1 -1
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -479,16 +479,30 @@ class StdioMCPWrapper {
|
|
|
479
479
|
|
|
480
480
|
console.error(`[Polydev] Opening browser for authentication: ${authUrl}`);
|
|
481
481
|
|
|
482
|
-
// Open browser - use
|
|
482
|
+
// Open browser - use exec with shell for better reliability in MCP stdio context
|
|
483
|
+
const { exec } = require('child_process');
|
|
483
484
|
const platform = process.platform;
|
|
484
485
|
|
|
486
|
+
let openCommand;
|
|
485
487
|
if (platform === 'darwin') {
|
|
486
|
-
|
|
488
|
+
// Use osascript for more reliable browser opening on macOS
|
|
489
|
+
openCommand = `osascript -e 'open location "${authUrl}"'`;
|
|
487
490
|
} else if (platform === 'win32') {
|
|
488
|
-
|
|
491
|
+
openCommand = `start "" "${authUrl}"`;
|
|
489
492
|
} else {
|
|
490
|
-
|
|
493
|
+
openCommand = `xdg-open "${authUrl}"`;
|
|
491
494
|
}
|
|
495
|
+
|
|
496
|
+
exec(openCommand, (error) => {
|
|
497
|
+
if (error) {
|
|
498
|
+
console.error('[Polydev] Browser open failed, trying fallback...');
|
|
499
|
+
// Fallback to spawn
|
|
500
|
+
const { spawn } = require('child_process');
|
|
501
|
+
if (platform === 'darwin') {
|
|
502
|
+
spawn('open', [authUrl], { detached: true, stdio: 'ignore' }).unref();
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
});
|
|
492
506
|
|
|
493
507
|
// Timeout after 5 minutes
|
|
494
508
|
setTimeout(() => {
|
|
@@ -2098,21 +2112,29 @@ class StdioMCPWrapper {
|
|
|
2098
2112
|
console.error(authUrl);
|
|
2099
2113
|
console.error('');
|
|
2100
2114
|
|
|
2101
|
-
// Open browser - use
|
|
2115
|
+
// Open browser - use exec with shell for better reliability in stdio context
|
|
2116
|
+
const { exec } = require('child_process');
|
|
2102
2117
|
const platform = process.platform;
|
|
2103
|
-
let
|
|
2118
|
+
let openCommand;
|
|
2104
2119
|
if (platform === 'darwin') {
|
|
2105
|
-
|
|
2106
|
-
|
|
2120
|
+
// Use osascript for more reliable browser opening on macOS
|
|
2121
|
+
openCommand = `osascript -e 'open location "${authUrl}"'`;
|
|
2107
2122
|
} else if (platform === 'win32') {
|
|
2108
|
-
|
|
2109
|
-
args = ['/c', 'start', '', authUrl];
|
|
2123
|
+
openCommand = `start "" "${authUrl}"`;
|
|
2110
2124
|
} else {
|
|
2111
|
-
|
|
2112
|
-
args = [authUrl];
|
|
2125
|
+
openCommand = `xdg-open "${authUrl}"`;
|
|
2113
2126
|
}
|
|
2114
2127
|
|
|
2115
|
-
|
|
2128
|
+
exec(openCommand, (error) => {
|
|
2129
|
+
if (error) {
|
|
2130
|
+
console.error('[Polydev] Browser open failed, trying fallback...');
|
|
2131
|
+
// Fallback to spawn
|
|
2132
|
+
const { spawn } = require('child_process');
|
|
2133
|
+
if (platform === 'darwin') {
|
|
2134
|
+
spawn('open', [authUrl], { detached: true, stdio: 'ignore' }).unref();
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
2116
2138
|
|
|
2117
2139
|
// Don't block forever - resolve after timeout
|
|
2118
2140
|
setTimeout(() => {
|