@agenticmail/core 0.9.6 → 0.9.7

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/index.d.cts CHANGED
@@ -200,6 +200,20 @@ interface AgenticMailConfig {
200
200
  provider?: 'google_voice';
201
201
  configuredAt?: string;
202
202
  };
203
+ /**
204
+ * Operator's notification address. Used by the dispatcher's
205
+ * bridge-escalation path: when sub-agents mail a bridge inbox AND
206
+ * no fresh host session is available for a headless resume, the
207
+ * API forwards a digest to this address so the operator gets a
208
+ * phone push (via Gmail / Apple Mail / whichever app handles
209
+ * their address). Set during install — the host agent (claude /
210
+ * codex) collects it via the `setup_operator_email` MCP tool
211
+ * during bootstrap and persists it here.
212
+ *
213
+ * Optional. When unset, escalations are still recorded as a
214
+ * system event (visible in the web UI) but no email is sent.
215
+ */
216
+ operatorEmail?: string;
203
217
  masterKey: string;
204
218
  dataDir: string;
205
219
  }
@@ -1493,6 +1507,28 @@ declare class SmsManager {
1493
1507
  getSmsConfig(agentId: string): SmsConfig | null;
1494
1508
  /** Save SMS config to agent metadata */
1495
1509
  saveSmsConfig(agentId: string, config: SmsConfig): void;
1510
+ /**
1511
+ * Resolve the operator's "where do I get pinged" address from an
1512
+ * agent's SMS config. Used by the dispatcher's bridge-escalation
1513
+ * path: when sub-agents mail a bridge with no fresh host session
1514
+ * available, we email the operator a digest at this address. Their
1515
+ * phone's Gmail push notification surfaces it within seconds —
1516
+ * effectively a free, programmatic alert channel.
1517
+ *
1518
+ * Returns the configured `forwardingEmail` (the same Gmail Google
1519
+ * Voice forwards inbound SMS to, which the operator already has
1520
+ * push notifications enabled for) when SMS is configured AND
1521
+ * enabled. Returns null otherwise — caller falls through to a
1522
+ * silent log + system event.
1523
+ *
1524
+ * Why we don't try real-SMS delivery yet: Google Voice's
1525
+ * `<number>@txt.voice.google.com` email-to-SMS gateway was
1526
+ * deprecated by Google years ago. A future `carrier` field on
1527
+ * SmsConfig (Verizon vtext.com / AT&T txt.att.net / etc) will let
1528
+ * the operator opt into actual SMS, but that's a follow-up — the
1529
+ * email path already gets the operator a phone notification.
1530
+ */
1531
+ getAlertEmail(agentId: string): string | null;
1496
1532
  /** Remove SMS config from agent metadata */
1497
1533
  removeSmsConfig(agentId: string): void;
1498
1534
  /** Record an inbound SMS (parsed from email) */
@@ -1764,6 +1800,38 @@ declare function redactSecret(value: unknown): string;
1764
1800
  */
1765
1801
  declare function redactObject<T>(input: T, _depth?: number): T;
1766
1802
 
1803
+ /**
1804
+ * Operator preferences — small per-installation knobs that don't fit
1805
+ * cleanly in the bootstrap-managed `~/.agenticmail/config.json`.
1806
+ *
1807
+ * Currently just `operatorEmail` for bridge-escalation alerts. The
1808
+ * intent is a tiny mutable surface the host agent (claudecode /
1809
+ * codex) can update via MCP without touching the read-only-after-
1810
+ * bootstrap config blob.
1811
+ *
1812
+ * # Storage
1813
+ *
1814
+ * `~/.agenticmail/operator-prefs.json`:
1815
+ *
1816
+ * ```json
1817
+ * { "version": 1, "operatorEmail": "ope@gmail.com" }
1818
+ * ```
1819
+ *
1820
+ * Atomic writes (tmp + rename), tolerant of missing / corrupt
1821
+ * files (returns null and lets the caller decide). Lazy path
1822
+ * resolution so tests can override `homedir()` per-test.
1823
+ */
1824
+ /** Returns the operator's escalation email, or null if not set. */
1825
+ declare function getOperatorEmail(): string | null;
1826
+ /**
1827
+ * Set (or clear) the operator's escalation email. Pass `null` /
1828
+ * empty string to clear. Returns the canonical stored value (trimmed,
1829
+ * lowercased local-part preserved as-is per RFC 5321).
1830
+ */
1831
+ declare function setOperatorEmail(email: string | null): string | null;
1832
+ /** Exposed for tests + diagnostic CLI commands. */
1833
+ declare function operatorPrefsStoragePath(): string;
1834
+
1767
1835
  /**
1768
1836
  * Persisted host-session registry.
1769
1837
  *
@@ -2494,4 +2562,4 @@ declare class AgentMemoryStore {
2494
2562
  renderForPrompt(memory: AgentMemoryRead | null): string;
2495
2563
  }
2496
2564
 
2497
- export { AGENT_ROLES, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryFields, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, type CachedMessage, CloudflareClient, type CreateAgentOptions, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_SESSION_MAX_AGE_MS, DNSConfigurator, type Database, type DeletionReport, type DeletionSummary, DependencyChecker, DependencyInstaller, type DependencyStatus, type DnsRecord, type DnsSetupResult, type DomainInfo, DomainManager, type DomainModeConfig, type DomainPurchaseResult, DomainPurchaser, type DomainSearchResult, type DomainSetupResult, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type HostName, type HostSession, type InboundEmail, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, closeDatabase, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, hostSessionStoragePath, isInternalEmail, isSessionFresh, isValidPhoneNumber, loadHostSession, normalizeAddress, normalizePhoneNumber, normalizeSubject, parseEmail, parseGoogleVoiceSms, recordToolCall, redactObject, redactSecret, resolveConfig, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setTelemetryVersion, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
2565
+ export { AGENT_ROLES, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryFields, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, type CachedMessage, CloudflareClient, type CreateAgentOptions, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_SESSION_MAX_AGE_MS, DNSConfigurator, type Database, type DeletionReport, type DeletionSummary, DependencyChecker, DependencyInstaller, type DependencyStatus, type DnsRecord, type DnsSetupResult, type DomainInfo, DomainManager, type DomainModeConfig, type DomainPurchaseResult, DomainPurchaser, type DomainSearchResult, type DomainSetupResult, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type HostName, type HostSession, type InboundEmail, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, closeDatabase, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, hostSessionStoragePath, isInternalEmail, isSessionFresh, isValidPhoneNumber, loadHostSession, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseEmail, parseGoogleVoiceSms, recordToolCall, redactObject, redactSecret, resolveConfig, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
package/dist/index.d.ts CHANGED
@@ -200,6 +200,20 @@ interface AgenticMailConfig {
200
200
  provider?: 'google_voice';
201
201
  configuredAt?: string;
202
202
  };
203
+ /**
204
+ * Operator's notification address. Used by the dispatcher's
205
+ * bridge-escalation path: when sub-agents mail a bridge inbox AND
206
+ * no fresh host session is available for a headless resume, the
207
+ * API forwards a digest to this address so the operator gets a
208
+ * phone push (via Gmail / Apple Mail / whichever app handles
209
+ * their address). Set during install — the host agent (claude /
210
+ * codex) collects it via the `setup_operator_email` MCP tool
211
+ * during bootstrap and persists it here.
212
+ *
213
+ * Optional. When unset, escalations are still recorded as a
214
+ * system event (visible in the web UI) but no email is sent.
215
+ */
216
+ operatorEmail?: string;
203
217
  masterKey: string;
204
218
  dataDir: string;
205
219
  }
@@ -1493,6 +1507,28 @@ declare class SmsManager {
1493
1507
  getSmsConfig(agentId: string): SmsConfig | null;
1494
1508
  /** Save SMS config to agent metadata */
1495
1509
  saveSmsConfig(agentId: string, config: SmsConfig): void;
1510
+ /**
1511
+ * Resolve the operator's "where do I get pinged" address from an
1512
+ * agent's SMS config. Used by the dispatcher's bridge-escalation
1513
+ * path: when sub-agents mail a bridge with no fresh host session
1514
+ * available, we email the operator a digest at this address. Their
1515
+ * phone's Gmail push notification surfaces it within seconds —
1516
+ * effectively a free, programmatic alert channel.
1517
+ *
1518
+ * Returns the configured `forwardingEmail` (the same Gmail Google
1519
+ * Voice forwards inbound SMS to, which the operator already has
1520
+ * push notifications enabled for) when SMS is configured AND
1521
+ * enabled. Returns null otherwise — caller falls through to a
1522
+ * silent log + system event.
1523
+ *
1524
+ * Why we don't try real-SMS delivery yet: Google Voice's
1525
+ * `<number>@txt.voice.google.com` email-to-SMS gateway was
1526
+ * deprecated by Google years ago. A future `carrier` field on
1527
+ * SmsConfig (Verizon vtext.com / AT&T txt.att.net / etc) will let
1528
+ * the operator opt into actual SMS, but that's a follow-up — the
1529
+ * email path already gets the operator a phone notification.
1530
+ */
1531
+ getAlertEmail(agentId: string): string | null;
1496
1532
  /** Remove SMS config from agent metadata */
1497
1533
  removeSmsConfig(agentId: string): void;
1498
1534
  /** Record an inbound SMS (parsed from email) */
@@ -1764,6 +1800,38 @@ declare function redactSecret(value: unknown): string;
1764
1800
  */
1765
1801
  declare function redactObject<T>(input: T, _depth?: number): T;
1766
1802
 
1803
+ /**
1804
+ * Operator preferences — small per-installation knobs that don't fit
1805
+ * cleanly in the bootstrap-managed `~/.agenticmail/config.json`.
1806
+ *
1807
+ * Currently just `operatorEmail` for bridge-escalation alerts. The
1808
+ * intent is a tiny mutable surface the host agent (claudecode /
1809
+ * codex) can update via MCP without touching the read-only-after-
1810
+ * bootstrap config blob.
1811
+ *
1812
+ * # Storage
1813
+ *
1814
+ * `~/.agenticmail/operator-prefs.json`:
1815
+ *
1816
+ * ```json
1817
+ * { "version": 1, "operatorEmail": "ope@gmail.com" }
1818
+ * ```
1819
+ *
1820
+ * Atomic writes (tmp + rename), tolerant of missing / corrupt
1821
+ * files (returns null and lets the caller decide). Lazy path
1822
+ * resolution so tests can override `homedir()` per-test.
1823
+ */
1824
+ /** Returns the operator's escalation email, or null if not set. */
1825
+ declare function getOperatorEmail(): string | null;
1826
+ /**
1827
+ * Set (or clear) the operator's escalation email. Pass `null` /
1828
+ * empty string to clear. Returns the canonical stored value (trimmed,
1829
+ * lowercased local-part preserved as-is per RFC 5321).
1830
+ */
1831
+ declare function setOperatorEmail(email: string | null): string | null;
1832
+ /** Exposed for tests + diagnostic CLI commands. */
1833
+ declare function operatorPrefsStoragePath(): string;
1834
+
1767
1835
  /**
1768
1836
  * Persisted host-session registry.
1769
1837
  *
@@ -2494,4 +2562,4 @@ declare class AgentMemoryStore {
2494
2562
  renderForPrompt(memory: AgentMemoryRead | null): string;
2495
2563
  }
2496
2564
 
2497
- export { AGENT_ROLES, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryFields, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, type CachedMessage, CloudflareClient, type CreateAgentOptions, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_SESSION_MAX_AGE_MS, DNSConfigurator, type Database, type DeletionReport, type DeletionSummary, DependencyChecker, DependencyInstaller, type DependencyStatus, type DnsRecord, type DnsSetupResult, type DomainInfo, DomainManager, type DomainModeConfig, type DomainPurchaseResult, DomainPurchaser, type DomainSearchResult, type DomainSetupResult, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type HostName, type HostSession, type InboundEmail, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, closeDatabase, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, hostSessionStoragePath, isInternalEmail, isSessionFresh, isValidPhoneNumber, loadHostSession, normalizeAddress, normalizePhoneNumber, normalizeSubject, parseEmail, parseGoogleVoiceSms, recordToolCall, redactObject, redactSecret, resolveConfig, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setTelemetryVersion, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
2565
+ export { AGENT_ROLES, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryFields, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, type CachedMessage, CloudflareClient, type CreateAgentOptions, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_SESSION_MAX_AGE_MS, DNSConfigurator, type Database, type DeletionReport, type DeletionSummary, DependencyChecker, DependencyInstaller, type DependencyStatus, type DnsRecord, type DnsSetupResult, type DomainInfo, DomainManager, type DomainModeConfig, type DomainPurchaseResult, DomainPurchaser, type DomainSearchResult, type DomainSetupResult, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type HostName, type HostSession, type InboundEmail, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, closeDatabase, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, hostSessionStoragePath, isInternalEmail, isSessionFresh, isValidPhoneNumber, loadHostSession, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseEmail, parseGoogleVoiceSms, recordToolCall, redactObject, redactSecret, resolveConfig, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };