@agenticmail/enterprise 0.5.150 → 0.5.152

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/dist/cli.js CHANGED
@@ -50,7 +50,7 @@ Skill Development:
50
50
  import("./cli-serve-DHVSPFW5.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
51
51
  break;
52
52
  case "agent":
53
- import("./cli-agent-TRGW5JEK.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
53
+ import("./cli-agent-F75N6PFL.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
54
54
  break;
55
55
  case "setup":
56
56
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.150",
3
+ "version": "0.5.152",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli-agent.ts CHANGED
@@ -596,10 +596,21 @@ async function startEmailPolling(
596
596
 
597
597
  async function pollOnce() {
598
598
  try {
599
- const messages = await emailProvider.listMessages('INBOX', { limit: 20 });
600
- const newMessages = messages.filter(m => !processedIds.has(m.uid));
599
+ // Search for unread messages first (most reliable for new email detection)
600
+ // Then also fetch recent messages to catch any that got auto-read
601
+ const unreadMsgs = await emailProvider.searchMessages({ seen: false }).catch(() => [] as any[]);
602
+ const recentMsgs = await emailProvider.listMessages('INBOX', { limit: 50 });
603
+ // Combine and deduplicate
604
+ const seenUids = new Set<string>();
605
+ const msgs: typeof recentMsgs = [];
606
+ for (const m of [...(unreadMsgs || []), ...recentMsgs]) {
607
+ if (!seenUids.has(m.uid)) { seenUids.add(m.uid); msgs.push(m); }
608
+ }
609
+ const newMessages = msgs.filter(m => !processedIds.has(m.uid));
601
610
  if (newMessages.length > 0) {
602
611
  console.log(`[email-poll] Found ${newMessages.length} new messages`);
612
+ } else {
613
+ console.log(`[email-poll] No new (${msgs.length} fetched, ${processedIds.size} known)`);
603
614
  }
604
615
 
605
616
  for (const envelope of newMessages) {