nothumanallowed 14.2.2 → 14.2.4
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/cli.mjs +49 -2
- package/src/constants.mjs +1 -1
- package/src/server/routes/config.mjs +23 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "14.2.
|
|
3
|
+
"version": "14.2.4",
|
|
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/cli.mjs
CHANGED
|
@@ -161,6 +161,39 @@ export async function main(argv) {
|
|
|
161
161
|
case '-v':
|
|
162
162
|
return cmdVersion();
|
|
163
163
|
|
|
164
|
+
case 'start': {
|
|
165
|
+
// Alias: nha start → nha ops start
|
|
166
|
+
const { cmdOps } = await import('./commands/ops.mjs');
|
|
167
|
+
return cmdOps(['start', ...args]);
|
|
168
|
+
}
|
|
169
|
+
case 'stop': {
|
|
170
|
+
// Alias: nha stop → nha ops stop
|
|
171
|
+
const { cmdOps: cmdOpsStop } = await import('./commands/ops.mjs');
|
|
172
|
+
return cmdOpsStop(['stop', ...args]);
|
|
173
|
+
}
|
|
174
|
+
case 'restart': {
|
|
175
|
+
// nha restart → stop + start
|
|
176
|
+
const { cmdOps: cmdOpsRestart } = await import('./commands/ops.mjs');
|
|
177
|
+
await cmdOpsRestart(['stop']);
|
|
178
|
+
return cmdOpsRestart(['start', ...args]);
|
|
179
|
+
}
|
|
180
|
+
case 'status': {
|
|
181
|
+
// Alias: nha status → nha ops status
|
|
182
|
+
const { cmdOps: cmdOpsStatus } = await import('./commands/ops.mjs');
|
|
183
|
+
return cmdOpsStatus(['status']);
|
|
184
|
+
}
|
|
185
|
+
case 'telegram':
|
|
186
|
+
case 'discord': {
|
|
187
|
+
// Alias: nha telegram → nha responder start (with info)
|
|
188
|
+
info(`The ${cmd} connector runs inside the ops daemon.`);
|
|
189
|
+
info('Commands:');
|
|
190
|
+
console.log(` nha ops start Start the daemon (includes ${cmd})`);
|
|
191
|
+
console.log(` nha ops stop Stop the daemon`);
|
|
192
|
+
console.log(` nha ops status Check status`);
|
|
193
|
+
console.log(` nha config set ${cmd === 'telegram' ? 'telegram-bot-token' : 'discord-bot-token'} YOUR_TOKEN`);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
164
197
|
case 'help':
|
|
165
198
|
case '--help':
|
|
166
199
|
case '-h':
|
|
@@ -205,9 +238,23 @@ async function cmdSelfUpdate() {
|
|
|
205
238
|
const output = execSync(cmd, { encoding: 'utf-8', timeout: 120_000, stdio: ['inherit', 'pipe', 'pipe'] });
|
|
206
239
|
if (output.includes('nothumanallowed@')) {
|
|
207
240
|
ok(`Updated to v${npmCheck.latest}!`);
|
|
208
|
-
console.log('');
|
|
209
|
-
info('Restart the UI to apply: kill the process and run "nha ui" again.');
|
|
210
241
|
if (usingSudo) info('(sudo was required on this system)');
|
|
242
|
+
// Auto-restart daemon if it was running (so Telegram/Discord reconnect)
|
|
243
|
+
try {
|
|
244
|
+
const { isRunning, stopDaemon } = await import('./services/ops-daemon.mjs');
|
|
245
|
+
if (isRunning()) {
|
|
246
|
+
info('Restarting ops daemon...');
|
|
247
|
+
await stopDaemon();
|
|
248
|
+
// Use the NEW nha binary to restart
|
|
249
|
+
const { execSync: execRestart } = await import('child_process');
|
|
250
|
+
try {
|
|
251
|
+
execRestart('nha ops start', { timeout: 10_000, stdio: 'inherit' });
|
|
252
|
+
ok('Ops daemon restarted (Telegram/Discord reconnected).');
|
|
253
|
+
} catch {
|
|
254
|
+
warn('Could not auto-restart daemon. Run: nha ops start');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
} catch {}
|
|
211
258
|
return;
|
|
212
259
|
}
|
|
213
260
|
} catch (e) {
|
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.
|
|
8
|
+
export const VERSION = '14.2.4';
|
|
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,35 @@ export function register(router) {
|
|
|
103
103
|
stderr: stderr.trim()
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
-
//
|
|
107
|
-
// Delay to allow HTTP response to flush
|
|
106
|
+
// Restart daemon (Telegram/Discord) + self-restart UI server
|
|
108
107
|
setTimeout(async () => {
|
|
109
108
|
try {
|
|
110
|
-
const { spawn } = await import('child_process');
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
const { spawn, execSync } = await import('child_process');
|
|
110
|
+
|
|
111
|
+
// Restart ops daemon if running (so Telegram/Discord reconnect with new code)
|
|
112
|
+
try {
|
|
113
|
+
const { isRunning, stopDaemon } = await import('../../services/ops-daemon.mjs');
|
|
114
|
+
if (isRunning()) {
|
|
115
|
+
await stopDaemon();
|
|
116
|
+
execSync('nha ops start', { timeout: 10_000, stdio: 'ignore' });
|
|
117
|
+
}
|
|
118
|
+
} catch { /* daemon restart is best-effort */ }
|
|
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'], {
|
|
113
127
|
detached: true,
|
|
114
128
|
stdio: 'ignore',
|
|
115
|
-
env: process.env,
|
|
129
|
+
env: { ...process.env, NHA_RESTARTED: '1' },
|
|
130
|
+
shell: true,
|
|
116
131
|
});
|
|
117
132
|
child.unref();
|
|
133
|
+
// Give the child process time to bind the port before we die
|
|
134
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
118
135
|
} catch { /* ignore spawn errors */ }
|
|
119
136
|
process.exit(0);
|
|
120
137
|
}, 1500);
|