nothumanallowed 14.2.2 → 14.2.3

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.2",
3
+ "version": "14.2.3",
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.2';
8
+ export const VERSION = '14.2.3';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -103,18 +103,26 @@ export function register(router) {
103
103
  stderr: stderr.trim()
104
104
  });
105
105
 
106
- // Self-restart: spawn new process with same args, then exit
107
- // Delay to allow HTTP response to flush
106
+ // Self-restart: resolve the NEW nha binary from npm global, spawn it, then exit.
107
+ // Must use the fresh binary path (not process.argv which points to the OLD code).
108
108
  setTimeout(async () => {
109
109
  try {
110
- const { spawn } = await import('child_process');
111
- const args = process.argv.slice(1);
112
- const child = spawn(process.argv[0], args, {
110
+ const { spawn, execSync } = await import('child_process');
111
+ // Find the nha binary in PATH (points to the newly installed version)
112
+ let nhaBin = 'nha';
113
+ try {
114
+ nhaBin = execSync('which nha', { encoding: 'utf-8', timeout: 3000 }).trim() || 'nha';
115
+ } catch { /* fallback to bare 'nha' */ }
116
+
117
+ const child = spawn(nhaBin, ['ui'], {
113
118
  detached: true,
114
119
  stdio: 'ignore',
115
- env: process.env,
120
+ env: { ...process.env, NHA_RESTARTED: '1' },
121
+ shell: true,
116
122
  });
117
123
  child.unref();
124
+ // Give the child process time to bind the port before we die
125
+ await new Promise((r) => setTimeout(r, 2000));
118
126
  } catch { /* ignore spawn errors */ }
119
127
  process.exit(0);
120
128
  }, 1500);