nothumanallowed 13.5.166 → 13.5.168

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": "13.5.166",
3
+ "version": "13.5.168",
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": {
@@ -625,6 +625,29 @@ export async function cmdUI(args) {
625
625
  return;
626
626
  }
627
627
 
628
+ // POST /api/update-npm — install latest nothumanallowed package and restart
629
+ if (method === 'POST' && pathname === '/api/update-npm') {
630
+ sendJSON(res, 200, { ok: true, message: 'Update started' });
631
+ logRequest(method, pathname, 200, Date.now() - start);
632
+ // Stream npm install output via WebSocket, then restart
633
+ setTimeout(async () => {
634
+ const { spawn } = await import('child_process');
635
+ wsBroadcast({ type: 'npm-update', line: '⟳ Running: npm install -g nothumanallowed@latest\n' });
636
+ const child = spawn('npm', ['install', '-g', 'nothumanallowed@latest'], { stdio: ['ignore', 'pipe', 'pipe'] });
637
+ child.stdout.on('data', (d) => wsBroadcast({ type: 'npm-update', line: d.toString() }));
638
+ child.stderr.on('data', (d) => wsBroadcast({ type: 'npm-update', line: d.toString() }));
639
+ child.on('close', (code) => {
640
+ if (code === 0) {
641
+ wsBroadcast({ type: 'npm-update', line: '\n✅ Update complete! Restarting server...\n', done: true });
642
+ } else {
643
+ wsBroadcast({ type: 'npm-update', line: '\n❌ Update failed (exit code ' + code + '). Check output above.\n', error: true });
644
+ }
645
+ setTimeout(() => process.exit(0), 1500);
646
+ });
647
+ }, 100);
648
+ return;
649
+ }
650
+
628
651
  // GET /api/version/check — check npm registry for latest version
629
652
  if (method === 'GET' && pathname === '/api/version/check') {
630
653
  try {
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 = '13.5.166';
8
+ export const VERSION = '13.5.168';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -1135,6 +1135,7 @@ var emailState = {
1135
1135
  composing: false,
1136
1136
  composeData: null, // {to, subject, inReplyTo, references, replyType}
1137
1137
  quillEditor: null,
1138
+ googleUnreadCount: 0,
1138
1139
  };
1139
1140
 
1140
1141
  function renderEmails(el) {
@@ -1217,7 +1218,10 @@ function emailRenderSidebar() {
1217
1218
  for (var gi = 0; gi < googleFolders.length; gi++) {
1218
1219
  var gf = googleFolders[gi];
1219
1220
  var sel = emailState.labelId === gf.id;
1220
- h += '<div onclick="emailSelectGoogleFolder(\\x27' + gf.id + '\\x27,\\x27' + gf.name + '\\x27)" style="padding:7px 14px;cursor:pointer;font-size:12px;' + (sel ? 'background:var(--green3);color:var(--bg);font-weight:700' : 'color:var(--fg)') + '">' + gf.icon + ' ' + esc(gf.name) + '</div>';
1221
+ var gUnread = (gf.id === 'INBOX' && emailState.googleUnreadCount > 0)
1222
+ ? '<span style="margin-left:auto;background:var(--green3);color:var(--bg);border-radius:10px;padding:0 5px;font-size:9px;font-weight:700">' + emailState.googleUnreadCount + '</span>'
1223
+ : '';
1224
+ h += '<div onclick="emailSelectGoogleFolder(\\x27' + gf.id + '\\x27,\\x27' + gf.name + '\\x27)" style="padding:7px 14px;cursor:pointer;font-size:12px;display:flex;align-items:center;gap:6px;' + (sel ? 'background:var(--green3);color:var(--bg);font-weight:700' : 'color:var(--fg)') + '">' + gf.icon + ' ' + esc(gf.name) + gUnread + '</div>';
1221
1225
  }
1222
1226
  } else {
1223
1227
  // IMAP labels
@@ -1266,6 +1270,7 @@ function emailSelectAccount(accountId, type) {
1266
1270
  emailState.offset = 0;
1267
1271
  emailState.messages = [];
1268
1272
  emailState.activeMessageId = null;
1273
+ if (type !== 'google') emailState.googleUnreadCount = 0;
1269
1274
  if (type === 'imap') {
1270
1275
  apiGet('/api/imap/labels?accountId=' + accountId).then(function(r) {
1271
1276
  emailState.labels = r.labels || [];
@@ -1340,6 +1345,10 @@ function emailLoadGoogleMessages() {
1340
1345
  return { id: m.id, subject: m.subject, from_name: m.from, from_address: m.from, internal_date: m.date, body_preview: m.snippet, is_read: !m.isUnread, is_starred: false, has_attachments: false, _google: true };
1341
1346
  });
1342
1347
  emailState.total = emailState.messages.length;
1348
+ if (emailState.labelId === 'INBOX' || !emailState.labelId) {
1349
+ emailState.googleUnreadCount = emailState.messages.filter(function(m) { return !m.is_read; }).length;
1350
+ emailRenderSidebar();
1351
+ }
1343
1352
  emailRenderMessageList();
1344
1353
  }).catch(function() {
1345
1354
  // Fallback to cached dash emails
@@ -1347,6 +1356,8 @@ function emailLoadGoogleMessages() {
1347
1356
  return { id: m.id, subject: m.subject, from_name: m.from, from_address: m.from, internal_date: m.date, body_preview: m.snippet, is_read: !m.isUnread, is_starred: false, has_attachments: false, _google: true };
1348
1357
  });
1349
1358
  emailState.total = emailState.messages.length;
1359
+ emailState.googleUnreadCount = emailState.messages.filter(function(m) { return !m.is_read; }).length;
1360
+ emailRenderSidebar();
1350
1361
  emailRenderMessageList();
1351
1362
  });
1352
1363
  }
@@ -3797,9 +3808,56 @@ function handleDaemonEvent(msg) {
3797
3808
  }
3798
3809
  }
3799
3810
  break;
3811
+
3812
+ case 'npm-update':
3813
+ var upLog = document.getElementById('npmUpdateLog');
3814
+ if (upLog) {
3815
+ upLog.textContent += msg.line || '';
3816
+ upLog.scrollTop = upLog.scrollHeight;
3817
+ }
3818
+ if (msg.done) {
3819
+ var upStatus = document.getElementById('npmUpdateStatus');
3820
+ if (upStatus) upStatus.textContent = 'Restarting server — reconnecting...';
3821
+ // Poll until server is back up, then reload
3822
+ setTimeout(function pollReconnect() {
3823
+ fetch(API + '/api/status').then(function() {
3824
+ window.location.reload();
3825
+ }).catch(function() {
3826
+ setTimeout(pollReconnect, 1500);
3827
+ });
3828
+ }, 3000);
3829
+ }
3830
+ if (msg.error) {
3831
+ var upStatus2 = document.getElementById('npmUpdateStatus');
3832
+ if (upStatus2) { upStatus2.textContent = 'Update failed. See output above.'; upStatus2.style.color = 'var(--red)'; }
3833
+ var upBtn = document.getElementById('npmUpdateCloseBtn');
3834
+ if (upBtn) upBtn.style.display = 'inline-block';
3835
+ }
3836
+ break;
3800
3837
  }
3801
3838
  }
3802
3839
 
3840
+ function npmUpdate() {
3841
+ // Show modal
3842
+ var existing = document.getElementById('npmUpdateModal');
3843
+ if (existing) existing.remove();
3844
+ var modal = document.createElement('div');
3845
+ modal.id = 'npmUpdateModal';
3846
+ modal.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,.7);z-index:9999;display:flex;align-items:center;justify-content:center';
3847
+ modal.innerHTML =
3848
+ '<div style="background:var(--bg2);border:1px solid var(--border);border-radius:10px;padding:24px;width:540px;max-width:95vw;display:flex;flex-direction:column;gap:12px">' +
3849
+ '<div style="font-size:14px;font-weight:700;color:var(--fg)">&#8593; Updating NotHumanAllowed</div>' +
3850
+ '<div id="npmUpdateStatus" style="font-size:11px;color:var(--dim)">Installing latest version...</div>' +
3851
+ '<pre id="npmUpdateLog" style="background:var(--bg);border:1px solid var(--border);border-radius:6px;padding:12px;font-size:10px;color:var(--green);max-height:300px;overflow-y:auto;white-space:pre-wrap;word-break:break-all;margin:0"></pre>' +
3852
+ '<div style="display:flex;justify-content:flex-end">' +
3853
+ '<button id="npmUpdateCloseBtn" onclick="document.getElementById(String.fromCharCode(110,112,109,85,112,100,97,116,101,77,111,100,97,108)).remove()" style="display:none;padding:6px 16px;background:var(--bg);color:var(--dim);border:1px solid var(--border);border-radius:5px;cursor:pointer;font-size:11px">Close</button>' +
3854
+ '</div>' +
3855
+ '</div>';
3856
+ document.body.appendChild(modal);
3857
+ // Start update
3858
+ apiPost('/api/update-npm', {}).catch(function(){});
3859
+ }
3860
+
3803
3861
  // ---- VOICE INPUT (in chat view) ----
3804
3862
  var voiceRecognition = null;
3805
3863
  var voiceRecording = false;
@@ -4153,7 +4211,7 @@ function renderSidebar() {
4153
4211
  \x27<a href="https://nothumanallowed.com/docs/mobile" target="_blank" class="nav-item" style="text-decoration:none"><span class="nav-item__icon">&#128241;</span> \x27+t(\x27nav_mobile\x27)+\x27</a>\x27+
4154
4212
  \x27</div>\x27+
4155
4213
  \x27<div style="padding:12px 16px;margin-top:auto;border-top:1px solid var(--border);font-size:10px;color:var(--dim)">nothumanallowed.com<span style="margin-left:6px;opacity:.5">v${VERSION}</span>\x27+
4156
- (_updateInfo&&_updateInfo.updateAvailable?\x27<span style="margin-left:8px;background:#f59e0b;color:#000;border-radius:4px;padding:1px 6px;font-weight:700;cursor:pointer" title="Run: npm i -g nothumanallowed to update to v\x27+(_updateInfo.latest||\x27\x27)+\x27">&#8593; Update v\x27+(_updateInfo.latest||\x27\x27)+\x27</span>\x27:\x27\x27)+
4214
+ (_updateInfo&&_updateInfo.updateAvailable?\x27<span onclick="npmUpdate()" style="margin-left:8px;background:#f59e0b;color:#000;border-radius:4px;padding:1px 6px;font-weight:700;cursor:pointer" title="Click to update to v\x27+(_updateInfo.latest||\x27\x27)+\x27">&#8593; Update v\x27+(_updateInfo.latest||\x27\x27)+\x27</span>\x27:\x27\x27)+
4157
4215
  \x27</div>\x27;
4158
4216
  }
4159
4217