nothumanallowed 14.2.4 → 14.2.5

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.2.4",
3
+ "version": "14.2.5",
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.2.4';
8
+ export const VERSION = '14.2.5';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -106,7 +106,7 @@ export function register(router) {
106
106
  // Restart daemon (Telegram/Discord) + self-restart UI server
107
107
  setTimeout(async () => {
108
108
  try {
109
- const { spawn, execSync } = await import('child_process');
109
+ const { execSync } = await import('child_process');
110
110
 
111
111
  // Restart ops daemon if running (so Telegram/Discord reconnect with new code)
112
112
  try {
@@ -117,22 +117,20 @@ export function register(router) {
117
117
  }
118
118
  } catch { /* daemon restart is best-effort */ }
119
119
 
120
- // Find the nha binary in PATH (points to the newly installed version)
121
- let nhaBin = 'nha';
122
- try {
123
- nhaBin = execSync('which nha', { encoding: 'utf-8', timeout: 3000 }).trim() || 'nha';
124
- } catch { /* fallback to bare 'nha' */ }
125
-
126
- const child = spawn(nhaBin, ['ui'], {
120
+ // Self-restart: launch a shell script that waits for us to die, then starts nha ui.
121
+ // This avoids the port-in-use race condition.
122
+ // Detect current port from the server's address
123
+ let port = '3847';
124
+ try { port = String(req.socket?.localPort || 3847); } catch {}
125
+ const { spawn } = await import('child_process');
126
+ const restartScript = `sleep 2 && nha ui --port ${port}`;
127
+ const child = spawn('sh', ['-c', restartScript], {
127
128
  detached: true,
128
129
  stdio: 'ignore',
129
130
  env: { ...process.env, NHA_RESTARTED: '1' },
130
- shell: true,
131
131
  });
132
132
  child.unref();
133
- // Give the child process time to bind the port before we die
134
- await new Promise((r) => setTimeout(r, 2000));
135
- } catch { /* ignore spawn errors */ }
133
+ } catch { /* ignore errors */ }
136
134
  process.exit(0);
137
135
  }, 1500);
138
136
  } catch (e) {