nothumanallowed 6.6.3 → 6.7.0

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": "6.6.3",
3
+ "version": "6.7.0",
4
4
  "description": "NotHumanAllowed — 38 AI agents for security, code, DevOps, data & daily ops. Per-agent memory, Telegram + Discord auto-responder, proactive intelligence daemon, voice chat, plugin system.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -133,11 +133,11 @@ TOOLS:
133
133
  Update ANY field of an existing calendar event: title, location, description, start time, end time.
134
134
  You MUST call calendar_find first to get the eventId. Only include fields that need to change. ALWAYS confirm before updating.
135
135
 
136
- 21. gmail_mark_read(messageId?: string, all?: boolean)
137
- Mark email(s) as read. If all=true, marks ALL unread emails as read. If messageId provided, marks that single email.
136
+ 21. gmail_mark_read(all?: boolean, count?: number, messageId?: string)
137
+ Mark emails as read. Options: all=true marks ALL unread. count=5 marks the last 5 unread. messageId marks one specific email.
138
138
 
139
- 22. gmail_mark_unread(messageId: string)
140
- Mark a specific email as unread.
139
+ 22. gmail_mark_unread(count?: number, messageId?: string)
140
+ Mark emails as unread. count=5 marks the last 5 read emails as unread. messageId marks one specific email.
141
141
 
142
142
  23. gmail_archive(messageId: string)
143
143
  Archive a specific email (removes from inbox).
@@ -434,23 +434,37 @@ async function executeTool(action, params, config) {
434
434
 
435
435
  // ── Gmail Mark Read/Unread/Archive ──────────────────────────────────
436
436
  case 'gmail_mark_read': {
437
+ const gm = await import('../services/google-gmail.mjs');
437
438
  if (params.all) {
438
- const { markAllAsRead } = await import('../services/mail-router.mjs');
439
- const result = await markAllAsRead(config);
439
+ const result = await gm.markAllAsRead(config);
440
440
  return `Done! ${result.count} email${result.count !== 1 ? 's' : ''} marked as read.`;
441
441
  }
442
+ if (params.count) {
443
+ const msgs = await gm.listMessages(config, 'is:unread', params.count);
444
+ if (msgs.length === 0) return 'No unread emails found.';
445
+ for (const m of msgs) { await gm.markAsRead(config, m.id); }
446
+ return `Done! ${msgs.length} email${msgs.length !== 1 ? 's' : ''} marked as read.`;
447
+ }
442
448
  if (params.messageId) {
443
- const { markAsRead } = await import('../services/mail-router.mjs');
444
- await markAsRead(config, params.messageId);
445
- return `Email ${params.messageId} marked as read.`;
449
+ await gm.markAsRead(config, params.messageId);
450
+ return 'Email marked as read.';
446
451
  }
447
- return 'Specify a messageId or set all=true to mark all as read.';
452
+ return 'Specify all=true, count=N, or a messageId.';
448
453
  }
449
454
 
450
455
  case 'gmail_mark_unread': {
451
- const { markAsUnread } = await import('../services/mail-router.mjs');
452
- await markAsUnread(config, params.messageId);
453
- return `Email ${params.messageId} marked as unread.`;
456
+ const gm = await import('../services/google-gmail.mjs');
457
+ if (params.count) {
458
+ const msgs = await gm.listMessages(config, 'in:inbox -is:unread', params.count);
459
+ if (msgs.length === 0) return 'No read emails found to mark as unread.';
460
+ for (const m of msgs) { await gm.markAsUnread(config, m.id); }
461
+ return `Done! ${msgs.length} email${msgs.length !== 1 ? 's' : ''} marked as unread.`;
462
+ }
463
+ if (params.messageId) {
464
+ await gm.markAsUnread(config, params.messageId);
465
+ return 'Email marked as unread.';
466
+ }
467
+ return 'Specify count=N or a messageId.';
454
468
  }
455
469
 
456
470
  case 'gmail_archive': {
@@ -98,11 +98,11 @@ TOOLS:
98
98
  16. calendar_update(eventId: string, summary?: string, location?: string, description?: string, start?: string, end?: string)
99
99
  Update ANY field of an existing calendar event. Only include fields that need to change. Confirm with the user first.
100
100
 
101
- 17. gmail_mark_read(messageId?: string, all?: boolean)
102
- Mark email(s) as read. If all=true, marks ALL unread emails as read. If messageId provided, marks that single email.
101
+ 17. gmail_mark_read(all?: boolean, count?: number, messageId?: string)
102
+ Mark emails as read. Options: all=true marks ALL unread. count=5 marks the last 5. messageId marks one specific email.
103
103
 
104
- 18. gmail_mark_unread(messageId: string)
105
- Mark a specific email as unread.
104
+ 18. gmail_mark_unread(count?: number, messageId?: string)
105
+ Mark emails as unread. count=5 marks the last 5 read emails as unread. messageId marks one specific email.
106
106
 
107
107
  19. gmail_archive(messageId: string)
108
108
  Archive a specific email (removes from inbox).
@@ -361,22 +361,38 @@ async function executeTool(action, params, config) {
361
361
  return `Event updated successfully (${changes}). ${params.location ? 'New location: ' + params.location : ''}`;
362
362
  }
363
363
  case 'gmail_mark_read': {
364
+ const gm = await import('../services/google-gmail.mjs');
365
+ const cfg = (await import('../config.mjs')).loadConfig();
364
366
  if (params.all) {
365
- const { markAllAsRead } = await import('../services/mail-router.mjs');
366
- const result = await markAllAsRead(config);
367
+ const result = await gm.markAllAsRead(cfg);
367
368
  return `Done! ${result.count} email${result.count !== 1 ? 's' : ''} marked as read.`;
368
369
  }
370
+ if (params.count) {
371
+ const msgs = await gm.listMessages(cfg, 'is:unread', params.count);
372
+ if (msgs.length === 0) return 'No unread emails found.';
373
+ for (const m of msgs) { await gm.markAsRead(cfg, m.id); }
374
+ return `Done! ${msgs.length} email${msgs.length !== 1 ? 's' : ''} marked as read.`;
375
+ }
369
376
  if (params.messageId) {
370
- const { markAsRead } = await import('../services/mail-router.mjs');
371
- await markAsRead(config, params.messageId);
372
- return `Email marked as read.`;
377
+ await gm.markAsRead(cfg, params.messageId);
378
+ return 'Email marked as read.';
373
379
  }
374
- return 'Specify a messageId or set all=true to mark all as read.';
380
+ return 'Specify all=true, count=N, or a messageId.';
375
381
  }
376
382
  case 'gmail_mark_unread': {
377
- const { markAsUnread } = await import('../services/mail-router.mjs');
378
- await markAsUnread(config, params.messageId);
379
- return `Email marked as unread.`;
383
+ const gm = await import('../services/google-gmail.mjs');
384
+ const cfg = (await import('../config.mjs')).loadConfig();
385
+ if (params.count) {
386
+ const msgs = await gm.listMessages(cfg, 'in:inbox -is:unread', params.count);
387
+ if (msgs.length === 0) return 'No read emails found to mark as unread.';
388
+ for (const m of msgs) { await gm.markAsUnread(cfg, m.id); }
389
+ return `Done! ${msgs.length} email${msgs.length !== 1 ? 's' : ''} marked as unread.`;
390
+ }
391
+ if (params.messageId) {
392
+ await gm.markAsUnread(cfg, params.messageId);
393
+ return 'Email marked as unread.';
394
+ }
395
+ return 'Specify count=N or a messageId.';
380
396
  }
381
397
  case 'gmail_archive': {
382
398
  const { archiveMessage } = await import('../services/mail-router.mjs');
@@ -675,10 +691,25 @@ export async function cmdUI(args) {
675
691
  return;
676
692
  }
677
693
 
678
- // GET /api/emails
694
+ // GET /api/emails?filter=unread|all (default: all inbox)
679
695
  if (method === 'GET' && pathname === '/api/emails') {
680
696
  try {
681
- const emails = await getUnreadImportant(config, 20);
697
+ const filter = url.searchParams.get('filter');
698
+ let emails;
699
+ if (filter === 'unread') {
700
+ emails = await getUnreadImportant(config, 20);
701
+ } else {
702
+ // Show all recent inbox emails (read + unread)
703
+ const gm = await import('../services/google-gmail.mjs');
704
+ const msgRefs = await gm.listMessages(config, 'in:inbox', 30);
705
+ emails = [];
706
+ for (const ref of msgRefs.slice(0, 30)) {
707
+ try {
708
+ const msg = await gm.getMessage(config, ref.id);
709
+ emails.push(msg);
710
+ } catch { /* skip */ }
711
+ }
712
+ }
682
713
  sendJSON(res, 200, { emails });
683
714
  } catch (e) {
684
715
  sendJSON(res, 200, { emails: [], error: e.message });
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 = '6.6.3';
8
+ export const VERSION = '6.7.0';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11