nothumanallowed 14.3.4 → 14.3.6
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 +1 -1
- package/src/commands/ui.mjs +27 -0
- package/src/constants.mjs +1 -1
- package/src/server/routes/config.mjs +8 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.6",
|
|
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/commands/ui.mjs
CHANGED
|
@@ -38,6 +38,33 @@ export async function cmdUI(args) {
|
|
|
38
38
|
|
|
39
39
|
const host = explicitHost || '127.0.0.1';
|
|
40
40
|
|
|
41
|
+
// Kill any existing process on this port (prevents EADDRINUSE)
|
|
42
|
+
try {
|
|
43
|
+
const { execSync } = await import('child_process');
|
|
44
|
+
if (process.platform === 'win32') {
|
|
45
|
+
// Windows: find PID on port and kill it
|
|
46
|
+
const out = execSync(`netstat -ano | findstr :${port} | findstr LISTENING`, { encoding: 'utf-8', timeout: 3000 }).trim();
|
|
47
|
+
const pid = out.split(/\s+/).pop();
|
|
48
|
+
if (pid && pid !== String(process.pid)) {
|
|
49
|
+
execSync(`taskkill /F /PID ${pid}`, { timeout: 3000, stdio: 'ignore' });
|
|
50
|
+
console.log(` \x1b[33m!\x1b[0m Killed previous process on port ${port} (PID ${pid})`);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
// Unix/Mac: lsof to find and kill
|
|
54
|
+
const out = execSync(`lsof -ti:${port} 2>/dev/null`, { encoding: 'utf-8', timeout: 3000 }).trim();
|
|
55
|
+
if (out) {
|
|
56
|
+
const pids = out.split('\n').filter((p) => p && p !== String(process.pid));
|
|
57
|
+
for (const pid of pids) {
|
|
58
|
+
try { process.kill(parseInt(pid), 'SIGTERM'); } catch {}
|
|
59
|
+
}
|
|
60
|
+
if (pids.length > 0) {
|
|
61
|
+
console.log(` \x1b[33m!\x1b[0m Killed previous process on port ${port} (PID ${pids.join(', ')})`);
|
|
62
|
+
await new Promise((r) => setTimeout(r, 500)); // wait for port to free
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} catch { /* port is free */ }
|
|
67
|
+
|
|
41
68
|
// Auto-start ops daemon (Telegram + cron) if not already running
|
|
42
69
|
if (!isRunning()) {
|
|
43
70
|
const result = startDaemon();
|
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.3.
|
|
8
|
+
export const VERSION = '14.3.6';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
|
@@ -117,19 +117,18 @@ export function register(router) {
|
|
|
117
117
|
}
|
|
118
118
|
} catch { /* daemon restart is best-effort */ }
|
|
119
119
|
|
|
120
|
-
// Self-restart:
|
|
121
|
-
// This
|
|
122
|
-
// Detect current port from the server's address
|
|
120
|
+
// Self-restart: write a temp script, run it with nohup, then exit.
|
|
121
|
+
// This survives parent death on macOS/Linux/Windows.
|
|
123
122
|
let port = '3847';
|
|
124
123
|
try { port = String(req.socket?.localPort || 3847); } catch {}
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
const os = await import('os');
|
|
125
|
+
const tmpScript = path.join(os.default.tmpdir(), '.nha-restart.sh');
|
|
126
|
+
fs.writeFileSync(tmpScript, `#!/bin/sh\nsleep 3\nnha ui --port ${port}\n`, { mode: 0o755 });
|
|
127
|
+
execSync(`nohup ${tmpScript} > /dev/null 2>&1 &`, {
|
|
128
|
+
timeout: 3000,
|
|
129
129
|
stdio: 'ignore',
|
|
130
|
-
|
|
130
|
+
shell: true,
|
|
131
131
|
});
|
|
132
|
-
child.unref();
|
|
133
132
|
} catch { /* ignore errors */ }
|
|
134
133
|
process.exit(0);
|
|
135
134
|
}, 1500);
|