nothumanallowed 13.5.131 → 13.5.132

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "13.5.131",
3
+ "version": "13.5.132",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5445,48 +5445,70 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
5445
5445
 
5446
5446
  let _lastMissingModule = null;
5447
5447
  let _lastCrashError = null;
5448
+ let _stderrBuffer = ''; // accumulate full stderr for rich error context
5448
5449
  proc.stdout.on('data', d => { const l = d.toString().trim(); if (l) sendLog(' [server] ' + l); });
5449
5450
  proc.stderr.on('data', d => {
5450
5451
  const raw = d.toString();
5452
+ _stderrBuffer += raw;
5451
5453
  // MODULE_NOT_FOUND
5452
5454
  const modMatch = raw.match(/Cannot find module '([^']+)'/);
5453
5455
  if (modMatch) {
5454
5456
  const missingMod = modMatch[1];
5455
5457
  _lastMissingModule = missingMod;
5456
- _lastCrashError = "Cannot find module '" + missingMod + "'";
5458
+ _lastCrashError = "Cannot find module '" + missingMod + "'\n" + _stderrBuffer.slice(0, 1500);
5457
5459
  sendLog(' ❌ Modulo mancante: ' + missingMod);
5458
5460
  if (!global._wcAutoFixQueue) global._wcAutoFixQueue = [];
5459
5461
  global._wcAutoFixQueue.push({ type: 'module_not_found', module: missingMod, dir: sandboxDir, ts: Date.now() });
5460
5462
  sendLog(' 🤖 Avvio auto-fix...');
5461
5463
  return;
5462
5464
  }
5463
- // TypeError / SyntaxError / ReferenceError — capture for autofix
5465
+ // TypeError / SyntaxError / ReferenceError / Error — capture with full stack
5464
5466
  const crashMatch = raw.match(/^(TypeError|SyntaxError|ReferenceError|Error):\s+(.+)/m);
5465
5467
  if (crashMatch) {
5466
- _lastCrashError = crashMatch[1] + ': ' + crashMatch[2].trim();
5467
- sendLog(' ❌ ' + _lastCrashError);
5468
+ _lastCrashError = crashMatch[1] + ': ' + crashMatch[2].trim() + '\n' + _stderrBuffer.slice(0, 1500);
5469
+ sendLog(' ❌ ' + crashMatch[1] + ': ' + crashMatch[2].trim());
5468
5470
  if (!global._wcAutoFixQueue) global._wcAutoFixQueue = [];
5469
5471
  global._wcAutoFixQueue.push({ type: 'crash_error', error: _lastCrashError, dir: sandboxDir, ts: Date.now() });
5470
5472
  sendLog(' 🤖 Avvio auto-fix...');
5471
5473
  return;
5472
5474
  }
5473
- // Skip node internals noise
5475
+ // Log everything else (including at-lines during crash) for visibility
5474
5476
  const l = raw.trim();
5475
- if (!l || l.startsWith('at ') || l.startsWith('(node:') || l === '^') return;
5477
+ if (!l || l.startsWith('(node:') || l === '^') return;
5476
5478
  sendLog(' [server] ' + l);
5477
5479
  });
5478
5480
 
5479
- // Wait for server to be ready (max 10s)
5481
+ // Wait for server to be ready (max 30s).
5482
+ // If process exits early (crash), report the error immediately so the client
5483
+ // can trigger auto-fix while the SSE connection is still open.
5480
5484
  await new Promise((resolve, reject) => {
5481
5485
  let attempts = 0;
5486
+ const MAX_ATTEMPTS = 60; // 30s at 500ms intervals
5487
+ let crashed = false;
5488
+
5489
+ proc.on('exit', (code) => {
5490
+ if (crashed || code === 0) return;
5491
+ crashed = true;
5492
+ // Give stderr a moment to flush
5493
+ setTimeout(() => {
5494
+ const errMsg = _lastCrashError || (_lastMissingModule ? "Cannot find module '" + _lastMissingModule + "'" : 'Server crashed (exit code ' + code + ')');
5495
+ reject(new Error(errMsg));
5496
+ }, 300);
5497
+ });
5498
+
5482
5499
  const tryConnect = () => {
5483
- const s = netMod.createConnection(freePort, '127.0.0.1');
5484
- s.on('connect', () => { s.destroy(); resolve(); });
5485
- s.on('error', () => {
5486
- s.destroy();
5487
- if (++attempts > 20) reject(new Error(_lastMissingModule ? "Cannot find module '" + _lastMissingModule + "'" : 'Server non risponde dopo 10s'));
5488
- else setTimeout(tryConnect, 500);
5489
- });
5500
+ if (crashed) return;
5501
+ const s = netMod.createConnection(freePort, '127.0.0.1');
5502
+ s.on('connect', () => { s.destroy(); resolve(); });
5503
+ s.on('error', () => {
5504
+ s.destroy();
5505
+ if (crashed) return;
5506
+ if (++attempts > MAX_ATTEMPTS) {
5507
+ reject(new Error(_lastCrashError || (_lastMissingModule ? "Cannot find module '" + _lastMissingModule + "'" : 'Server non risponde dopo 30s')));
5508
+ } else {
5509
+ setTimeout(tryConnect, 500);
5510
+ }
5511
+ });
5490
5512
  };
5491
5513
  setTimeout(tryConnect, 1000);
5492
5514
  });
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '13.5.131';
8
+ export const VERSION = '13.5.132';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11