polydev-ai 1.8.78 → 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.
@@ -400,7 +400,7 @@ class StdioMCPWrapper {
400
400
  */
401
401
  async handleLoginTool(params, id) {
402
402
  const http = require('http');
403
- const { execFile } = require('child_process');
403
+ const { spawn } = require('child_process');
404
404
 
405
405
  return new Promise((resolve) => {
406
406
  // Check if already authenticated
@@ -479,23 +479,28 @@ class StdioMCPWrapper {
479
479
 
480
480
  console.error(`[Polydev] Opening browser for authentication: ${authUrl}`);
481
481
 
482
- // Open browser
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
- let cmd, args;
485
+
486
+ let openCommand;
485
487
  if (platform === 'darwin') {
486
- cmd = 'open';
487
- args = [authUrl];
488
+ // Use osascript for more reliable browser opening on macOS
489
+ openCommand = `osascript -e 'open location "${authUrl}"'`;
488
490
  } else if (platform === 'win32') {
489
- cmd = 'cmd';
490
- args = ['/c', 'start', '', authUrl];
491
+ openCommand = `start "" "${authUrl}"`;
491
492
  } else {
492
- cmd = 'xdg-open';
493
- args = [authUrl];
493
+ openCommand = `xdg-open "${authUrl}"`;
494
494
  }
495
-
496
- execFile(cmd, args, (err) => {
497
- if (err) {
498
- console.error('[Polydev] Could not open browser:', err.message);
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
+ }
499
504
  }
500
505
  });
501
506
 
@@ -2047,7 +2052,7 @@ class StdioMCPWrapper {
2047
2052
  */
2048
2053
  async autoLoginOnStartup() {
2049
2054
  const http = require('http');
2050
- const { execFile } = require('child_process');
2055
+ const { spawn } = require('child_process');
2051
2056
 
2052
2057
  return new Promise((resolve) => {
2053
2058
  const server = http.createServer((req, res) => {
@@ -2107,23 +2112,27 @@ class StdioMCPWrapper {
2107
2112
  console.error(authUrl);
2108
2113
  console.error('');
2109
2114
 
2110
- // Open browser
2115
+ // Open browser - use exec with shell for better reliability in stdio context
2116
+ const { exec } = require('child_process');
2111
2117
  const platform = process.platform;
2112
- let cmd, args;
2118
+ let openCommand;
2113
2119
  if (platform === 'darwin') {
2114
- cmd = 'open';
2115
- args = [authUrl];
2120
+ // Use osascript for more reliable browser opening on macOS
2121
+ openCommand = `osascript -e 'open location "${authUrl}"'`;
2116
2122
  } else if (platform === 'win32') {
2117
- cmd = 'cmd';
2118
- args = ['/c', 'start', '', authUrl];
2123
+ openCommand = `start "" "${authUrl}"`;
2119
2124
  } else {
2120
- cmd = 'xdg-open';
2121
- args = [authUrl];
2125
+ openCommand = `xdg-open "${authUrl}"`;
2122
2126
  }
2123
2127
 
2124
- execFile(cmd, args, (err) => {
2125
- if (err) {
2126
- console.error('[!] Could not open browser automatically.');
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
+ }
2127
2136
  }
2128
2137
  });
2129
2138
 
@@ -2231,16 +2240,16 @@ class StdioMCPWrapper {
2231
2240
  console.error('Opening Polydev Models page for API key configuration...');
2232
2241
  console.error('Add your API keys to unlock more models!\n');
2233
2242
 
2234
- const { execFile } = require('child_process');
2243
+ const { spawn } = require('child_process');
2235
2244
  const modelsUrl = 'https://polydev.ai/dashboard/models';
2236
2245
  const platform = process.platform;
2237
2246
 
2238
2247
  if (platform === 'darwin') {
2239
- execFile('open', [modelsUrl]);
2248
+ spawn('open', [modelsUrl], { detached: true, stdio: 'ignore' }).unref();
2240
2249
  } else if (platform === 'win32') {
2241
- execFile('cmd', ['/c', 'start', '', modelsUrl]);
2250
+ spawn('cmd', ['/c', 'start', '', modelsUrl], { detached: true, stdio: 'ignore', shell: true }).unref();
2242
2251
  } else {
2243
- execFile('xdg-open', [modelsUrl]);
2252
+ spawn('xdg-open', [modelsUrl], { detached: true, stdio: 'ignore' }).unref();
2244
2253
  }
2245
2254
  }
2246
2255
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polydev-ai",
3
- "version": "1.8.78",
3
+ "version": "1.8.80",
4
4
  "engines": {
5
5
  "node": ">=20.x <=22.x"
6
6
  },