nothumanallowed 14.3.5 → 14.3.7

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.3.5",
3
+ "version": "14.3.7",
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.3.5';
8
+ export const VERSION = '14.3.7';
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: 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
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 { spawn } = await import('child_process');
126
- const restartScript = `sleep 2 && nha ui --port ${port}`;
127
- const child = spawn('sh', ['-c', restartScript], {
128
- detached: true,
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
- env: { ...process.env, NHA_RESTARTED: '1' },
130
+ shell: true,
131
131
  });
132
- child.unref();
133
132
  } catch { /* ignore errors */ }
134
133
  process.exit(0);
135
134
  }, 1500);
@@ -24,13 +24,26 @@ export function register(router) {
24
24
 
25
25
  router.get('/api/github', async (req, res) => {
26
26
  try {
27
- const { listNotificationsRaw } = await import('../../services/github.mjs');
27
+ const gh = await import('../../services/github.mjs');
28
28
  const config = loadConfig();
29
- const notifications = await listNotificationsRaw(config);
30
- sendJSON(res, 200, { notifications: Array.isArray(notifications) ? notifications : [] });
29
+ // Fetch user info + notifications + repos in parallel
30
+ const [userResp, notifications, repos] = await Promise.all([
31
+ gh.ghFetch ? gh.ghFetch(config, '/user').catch(() => null) : Promise.resolve(null),
32
+ gh.listNotificationsRaw(config).catch(() => []),
33
+ gh.listUserRepos ? gh.listUserRepos(config).catch(() => []) : Promise.resolve([]),
34
+ ]);
35
+ const user = userResp ? {
36
+ login: userResp.login,
37
+ name: userResp.name,
38
+ avatar: userResp.avatar_url,
39
+ repos: Array.isArray(repos) ? repos.slice(0, 20).map((r) => ({
40
+ full_name: r.full_name, description: r.description, open_issues: r.open_issues_count, private: r.private,
41
+ })) : [],
42
+ } : null;
43
+ sendJSON(res, 200, { user, notifications: Array.isArray(notifications) ? notifications : [] });
31
44
  } catch (e) {
32
45
  if (e.message?.includes('token') || e.message?.includes('not configured') || e.message?.includes('401')) {
33
- return sendJSON(res, 200, { notifications: [], error: 'GitHub token not configured or expired. Run: nha config set github-token YOUR_PAT' });
46
+ return sendJSON(res, 200, { notifications: [], error: 'GitHub token not configured or expired.' });
34
47
  }
35
48
  sendJSON(res, 200, { notifications: [], error: e.message });
36
49
  }
@@ -9,7 +9,7 @@ const GITHUB_API = 'https://api.github.com';
9
9
  /**
10
10
  * Authenticated fetch to GitHub API.
11
11
  */
12
- async function ghFetch(config, urlPath, options = {}) {
12
+ export async function ghFetch(config, urlPath, options = {}) {
13
13
  const token = config.github?.token;
14
14
  if (!token) throw new Error('GitHub token not configured. Run: nha config set github-token YOUR_PAT');
15
15