nothumanallowed 13.5.165 → 13.5.167

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.165",
3
+ "version": "13.5.167",
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 = '13.5.165';
8
+ export const VERSION = '13.5.167';
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 || [];
@@ -1331,26 +1336,28 @@ function emailLoadMessages() {
1331
1336
  function emailLoadGoogleMessages() {
1332
1337
  var listBody = document.getElementById('emailListBody');
1333
1338
  if (listBody) listBody.innerHTML = '<div style="padding:20px;text-align:center"><div class="spinner"></div></div>';
1334
- var q = emailState.labelId === 'INBOX' ? 'in:inbox' : 'in:' + emailState.labelId.toLowerCase();
1335
- if (emailState.search) q = emailState.search;
1336
- import('../services/google-gmail.mjs').then(function(gm) {
1337
- gm.listMessages(config, q, 50).then(function(refs) {
1338
- if (!refs || !refs.length) { emailState.messages = []; emailRenderMessageList(); return; }
1339
- var page = refs.slice(0, 50);
1340
- return Promise.all(page.slice(0, 20).map(function(r) { return gm.getMessage(config, r.id); }));
1341
- }).then(function(msgs) {
1342
- emailState.messages = (msgs || []).map(function(m) {
1343
- 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 };
1344
- });
1345
- emailState.total = emailState.messages.length;
1346
- emailRenderMessageList();
1339
+ // Use the server-side API endpoint avoids Node.js module imports in browser context
1340
+ var filter = (emailState.labelId === 'INBOX' || !emailState.labelId) ? 'all' : emailState.labelId.toLowerCase();
1341
+ var qs = '/api/emails?filter=' + encodeURIComponent(filter) + '&page=0&pageSize=50';
1342
+ if (emailState.search) qs = '/api/emails?filter=' + encodeURIComponent(emailState.search) + '&page=0&pageSize=50';
1343
+ apiGet(qs).then(function(r) {
1344
+ emailState.messages = (r.emails || []).map(function(m) {
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 };
1347
1346
  });
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
+ }
1352
+ emailRenderMessageList();
1348
1353
  }).catch(function() {
1349
- // Fallback to dash emails
1354
+ // Fallback to cached dash emails
1350
1355
  emailState.messages = (dash.emails || []).map(function(m) {
1351
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 };
1352
1357
  });
1353
1358
  emailState.total = emailState.messages.length;
1359
+ emailState.googleUnreadCount = emailState.messages.filter(function(m) { return !m.is_read; }).length;
1360
+ emailRenderSidebar();
1354
1361
  emailRenderMessageList();
1355
1362
  });
1356
1363
  }