nothumanallowed 14.4.20 → 14.4.22

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": "14.4.20",
3
+ "version": "14.4.22",
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": {
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 = '14.4.20';
8
+ export const VERSION = '14.4.22';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -436,5 +436,24 @@ export async function startServer({ port = 3847, host = '127.0.0.1', noBrowser =
436
436
 
437
437
  if (!noBrowser) openBrowser(`http://localhost:${port}`);
438
438
 
439
+ // Cleanup sandbox processes on server shutdown
440
+ const cleanup = async () => {
441
+ try {
442
+ const { exec } = await import('child_process');
443
+ const { promisify } = await import('util');
444
+ const execAsync = promisify(exec);
445
+ for (let p = 4000; p <= 4010; p++) {
446
+ try {
447
+ const { stdout } = await execAsync(`lsof -ti:${p} 2>/dev/null || fuser ${p}/tcp 2>/dev/null`, { timeout: 2000 });
448
+ const pids = stdout.trim().split(/\s+/).filter(Boolean);
449
+ for (const pid of pids) { try { process.kill(parseInt(pid), 'SIGKILL'); } catch {} }
450
+ } catch {}
451
+ }
452
+ } catch {}
453
+ process.exit(0);
454
+ };
455
+ process.on('SIGINT', cleanup);
456
+ process.on('SIGTERM', cleanup);
457
+
439
458
  return server;
440
459
  }
@@ -118,10 +118,23 @@ class SandboxManager {
118
118
  }
119
119
 
120
120
  // ── Phase 3: Start server ─────────────────────────────────────────────
121
- // Kill orphan sandbox processes from previous runs (survive server restart)
121
+ // Kill orphan sandbox processes on ports 4000-4010 (survive server restart)
122
122
  try {
123
- await execAsync('pkill -f "NHA_SANDBOX=1" 2>/dev/null || true', { timeout: 3000 });
124
- await new Promise((r) => setTimeout(r, 500)); // wait for port release
123
+ if (process.platform === 'win32') {
124
+ for (let p = 4000; p <= 4010; p++) {
125
+ try { await execAsync(`for /f "tokens=5" %a in ('netstat -ano ^| findstr :${p} ^| findstr LISTENING') do taskkill /F /PID %a`, { timeout: 3000 }); } catch {}
126
+ }
127
+ } else {
128
+ // Try lsof first, then fuser
129
+ for (let p = 4000; p <= 4010; p++) {
130
+ try {
131
+ const { stdout } = await execAsync(`lsof -ti:${p} 2>/dev/null || fuser ${p}/tcp 2>/dev/null`, { timeout: 2000 });
132
+ const pids = stdout.trim().split(/\s+/).filter(Boolean);
133
+ for (const pid of pids) { try { process.kill(parseInt(pid), 'SIGKILL'); } catch {} }
134
+ } catch {}
135
+ }
136
+ }
137
+ await new Promise((r) => setTimeout(r, 800));
125
138
  } catch {}
126
139
  const port = await _findFreePort(4000, 4999);
127
140
  if (!port) {