@agenticmail/enterprise 0.5.152 → 0.5.153

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-F75N6PFL.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
53
+ import("./cli-agent-7TWEYMAP.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
54
54
  break;
55
55
  case "setup":
56
56
  default:
package/dist/index.js CHANGED
@@ -84,7 +84,7 @@ import {
84
84
  GoogleEmailProvider,
85
85
  MicrosoftEmailProvider,
86
86
  createEmailProvider
87
- } from "./chunk-UWSWQRGB.js";
87
+ } from "./chunk-VEPWCYAL.js";
88
88
  import "./chunk-RO537U6H.js";
89
89
  import "./chunk-DRXMYYKN.js";
90
90
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.152",
3
+ "version": "0.5.153",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -72,12 +72,17 @@ export class GoogleEmailProvider implements IEmailProvider {
72
72
 
73
73
  // Batch fetch message metadata
74
74
  const envelopes: EmailEnvelope[] = [];
75
+ let skipped = 0;
75
76
  for (const msg of data.messages) {
76
77
  try {
77
78
  const detail = await this.gmailFetch(`/messages/${msg.id}?format=metadata&metadataHeaders=From&metadataHeaders=To&metadataHeaders=Subject&metadataHeaders=Date`);
78
79
  envelopes.push(this.metadataToEnvelope(detail));
79
- } catch { /* skip individual errors */ }
80
+ } catch (e: any) {
81
+ skipped++;
82
+ console.error(`[gmail] Failed to fetch metadata for ${msg.id}: ${e.message?.slice(0, 100)}`);
83
+ }
80
84
  }
85
+ if (skipped > 0) console.warn(`[gmail] Skipped ${skipped}/${data.messages.length} messages due to errors`);
81
86
  return envelopes;
82
87
  }
83
88
 
package/src/cli-agent.ts CHANGED
@@ -596,21 +596,21 @@ async function startEmailPolling(
596
596
 
597
597
  async function pollOnce() {
598
598
  try {
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 });
599
+ // Search for recent emails using after: filter (Gmail API can have eventual consistency delays)
600
+ const today = new Date().toISOString().split('T')[0]; // YYYY-MM-DD
601
+ const recentSearch = await emailProvider.searchMessages({ since: today }).catch(() => [] as any[]);
602
+ const inboxList = await emailProvider.listMessages('INBOX', { limit: 50 });
603
603
  // Combine and deduplicate
604
604
  const seenUids = new Set<string>();
605
- const msgs: typeof recentMsgs = [];
606
- for (const m of [...(unreadMsgs || []), ...recentMsgs]) {
605
+ const msgs: typeof inboxList = [];
606
+ for (const m of [...(recentSearch || []), ...inboxList]) {
607
607
  if (!seenUids.has(m.uid)) { seenUids.add(m.uid); msgs.push(m); }
608
608
  }
609
609
  const newMessages = msgs.filter(m => !processedIds.has(m.uid));
610
610
  if (newMessages.length > 0) {
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)`);
611
+ console.log(`[email-poll] Found ${newMessages.length} new messages (${msgs.length} total, ${processedIds.size} known)`);
612
+ } else if (msgs.length < processedIds.size) {
613
+ console.log(`[email-poll] No new (${msgs.length} fetched < ${processedIds.size} known — possible API gap)`);
614
614
  }
615
615
 
616
616
  for (const envelope of newMessages) {