snow-flow 3.0.8 → 3.0.9

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.
@@ -279,25 +279,62 @@ class ServiceNowOAuth {
279
279
  console.log('šŸš€ Please open the authorization URL in your browser...');
280
280
  console.log('ā³ Waiting for OAuth callback...');
281
281
  // Auto-open browser if possible
282
- try {
283
- const { spawn } = require('child_process');
284
- const authUrl = this.generateAuthUrl(this.credentials.instance, this.credentials.clientId, redirectUri);
285
- // Try to open browser on macOS
286
- if (process.platform === 'darwin') {
287
- spawn('open', [authUrl]);
288
- }
289
- else if (process.platform === 'win32') {
290
- spawn('cmd', ['/c', 'start', authUrl]);
291
- }
292
- else if (process.platform === 'linux') {
293
- spawn('xdg-open', [authUrl]);
282
+ // Try to auto-open browser if not in headless environment
283
+ const isCodespaces = process.env.CODESPACES === 'true';
284
+ const isContainer = process.env.CONTAINER === 'true' || (0, fs_1.existsSync)('/.dockerenv');
285
+ const isHeadless = isCodespaces || isContainer || process.env.CI === 'true';
286
+ if (!isHeadless) {
287
+ try {
288
+ const { spawn } = require('child_process');
289
+ const authUrl = this.generateAuthUrl(this.credentials.instance, this.credentials.clientId, redirectUri);
290
+ let browserProcess;
291
+ // Try to open browser based on platform
292
+ if (process.platform === 'darwin') {
293
+ browserProcess = spawn('open', [authUrl], { detached: true, stdio: 'ignore' });
294
+ }
295
+ else if (process.platform === 'win32') {
296
+ browserProcess = spawn('cmd', ['/c', 'start', authUrl], { detached: true, stdio: 'ignore' });
297
+ }
298
+ else if (process.platform === 'linux') {
299
+ // Try multiple Linux browser openers
300
+ const openers = ['xdg-open', 'gnome-open', 'kde-open', 'sensible-browser'];
301
+ for (const opener of openers) {
302
+ try {
303
+ browserProcess = spawn(opener, [authUrl], { detached: true, stdio: 'ignore' });
304
+ break; // If successful, stop trying
305
+ }
306
+ catch (e) {
307
+ // Try next opener
308
+ continue;
309
+ }
310
+ }
311
+ }
312
+ else {
313
+ console.log('āš ļø Unknown OS:', process.platform);
314
+ }
315
+ // Prevent the spawn from keeping the process alive
316
+ if (browserProcess && browserProcess.unref) {
317
+ browserProcess.unref();
318
+ }
294
319
  }
295
- else {
296
- console.log('Unknown OS:', process.platform);
320
+ catch (err) {
321
+ // Silently fail - user can manually open URL
322
+ console.log('\nšŸ“‹ Browser auto-open failed. Please manually copy and open the URL above.');
297
323
  }
298
324
  }
299
- catch (err) {
300
- console.log('āš ļø Could not auto-open browser. Please open the URL manually.');
325
+ else {
326
+ console.log('\n🐳 Running in headless environment (Codespaces/Container/CI)');
327
+ console.log('šŸ“‹ Please manually copy and open the authorization URL above in your browser.');
328
+ if (isCodespaces) {
329
+ console.log('\nšŸ’” TIP for GitHub Codespaces:');
330
+ console.log(' 1. Copy the authorization URL above');
331
+ console.log(' 2. Open it in a new browser tab');
332
+ console.log(' 3. After authorizing, you\'ll be redirected to localhost:3005');
333
+ console.log(' 4. Copy the FULL redirect URL from your browser');
334
+ console.log(' 5. Open a new Codespaces terminal and run:');
335
+ console.log(' curl "http://localhost:3005/callback?code=YOUR_CODE&state=YOUR_STATE"');
336
+ console.log(' 6. Or use port forwarding in Codespaces to make port 3005 accessible');
337
+ }
301
338
  }
302
339
  });
303
340
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "3.0.8",
4
- "description": "Snow-Flow v3.0.8: CLAUDE CODE INTEGRATION ENHANCED! Added API_TIMEOUT_MS=1800000 (30 minutes) to init command for seamless Claude Code compatibility. Deployment false negatives fixed + extended timeout support for long-running operations. Ultimate universal verification + intelligent deployment recovery. 100% REAL implementation with TensorFlow.js neural networks, direct ServiceNow API integration, and intelligent memory management. Includes 100+ MCP tools for operations, development, ML, analytics, and security.",
3
+ "version": "3.0.9",
4
+ "description": "Snow-Flow v3.0.9: CODESPACES & CONTAINER SUPPORT! Fixed OAuth authentication for GitHub Codespaces, Docker containers, and headless environments. Intelligent browser opening with fallback for all platforms (macOS, Windows, Linux). No more xdg-open crashes! Includes manual auth instructions for restricted environments. Plus all v3.0.8 features: Claude Code 30-min timeout, deployment fixes, universal verification. 100+ MCP tools for complete ServiceNow automation.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
7
7
  "bin": {