@agenticmail/core 0.9.5 → 0.9.6

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
@@ -1764,6 +1764,129 @@ declare function redactSecret(value: unknown): string;
1764
1764
  */
1765
1765
  declare function redactObject<T>(input: T, _depth?: number): T;
1766
1766
 
1767
+ /**
1768
+ * Persisted host-session registry.
1769
+ *
1770
+ * # What this is for
1771
+ *
1772
+ * When a sub-agent replies into the host bridge inbox
1773
+ * (`claudecode@localhost` / `codex@localhost`), the dispatcher
1774
+ * historically had no way to react: bridges are skipped by
1775
+ * `shouldWatch` because they belong to the human operator's host CLI,
1776
+ * not to an automated worker. The mail would sit unread until the
1777
+ * operator opened their CLI again — sometimes hours later, sometimes
1778
+ * never that day.
1779
+ *
1780
+ * This module is the missing link. Every time the host's mail-hook
1781
+ * fires (on `SessionStart` / `UserPromptSubmit` / `Stop`), it captures
1782
+ * the host CLI's current `session_id` and persists it here. The
1783
+ * dispatcher can then check "what session was running last?" and
1784
+ * attempt a headless resume against it when bridge mail arrives —
1785
+ * the same way Telegram bridges (Fola, etc.) keep a session alive
1786
+ * between bursts of activity.
1787
+ *
1788
+ * # The file
1789
+ *
1790
+ * `~/.agenticmail/host-sessions.json`:
1791
+ *
1792
+ * ```json
1793
+ * {
1794
+ * "version": 1,
1795
+ * "sessions": {
1796
+ * "claudecode": {
1797
+ * "sessionId": "01a2b3c4-…",
1798
+ * "workspace": "/Users/ope/Desktop/facebook-project",
1799
+ * "lastSeenMs": 1778905200000,
1800
+ * "model": "claude-sonnet-4-5"
1801
+ * },
1802
+ * "codex": {
1803
+ * "sessionId": "019a2b3c-…",
1804
+ * "workspace": "/Users/ope/Desktop/facebook-project",
1805
+ * "lastSeenMs": 1778905100000
1806
+ * }
1807
+ * }
1808
+ * }
1809
+ * ```
1810
+ *
1811
+ * Per host we keep ONE session — the most recent. If the operator
1812
+ * runs `claude` twice (e.g. one window for "general", one for "build
1813
+ * the LinkedIn clone"), we only track the last-active one. The
1814
+ * bridge resume always targets whichever was active most recently;
1815
+ * the operator's intuition matches that ("I just left my Claude
1816
+ * Code session a minute ago and the bridge ought to be able to
1817
+ * resume it").
1818
+ *
1819
+ * # Freshness semantics
1820
+ *
1821
+ * A session is considered "resumable" if `lastSeenMs` is within the
1822
+ * last 24 hours. Older than that, both Anthropic and OpenAI tend to
1823
+ * have evicted the session from their resume cache (cost-driven
1824
+ * decision; observed empirically). The dispatcher uses
1825
+ * `isSessionFresh(session, maxAgeMs)` to gate the resume attempt and
1826
+ * fall through to SMS / persistent storage when stale.
1827
+ *
1828
+ * # Atomic writes
1829
+ *
1830
+ * The mail-hook can fire concurrently with another hook on a
1831
+ * different host CLI window. The write path goes through a tmp file
1832
+ * + rename so a torn write can never leave a half-valid JSON file
1833
+ * that crashes the next reader. Same shape as `dispatcher-state.ts`.
1834
+ */
1835
+ /** Canonical names for the host integrations that own bridge inboxes. */
1836
+ type HostName = 'claudecode' | 'codex';
1837
+ /**
1838
+ * A snapshot of one host CLI's last-known session. Persisted to disk
1839
+ * by the mail-hook on every fire; loaded by the dispatcher when
1840
+ * bridge mail arrives so a resume can be attempted.
1841
+ */
1842
+ interface HostSession {
1843
+ /** Stable session_id from the host CLI (Claude Code or Codex). */
1844
+ sessionId: string;
1845
+ /** Wall-clock timestamp of the last hook fire on this session. */
1846
+ lastSeenMs: number;
1847
+ /** Optional: project cwd the host CLI was opened in. Used by
1848
+ * resume to spawn the headless turn in the right directory. */
1849
+ workspace?: string;
1850
+ /** Optional: model name the host session was using, surfaced
1851
+ * in logs for diagnostic context. */
1852
+ model?: string;
1853
+ }
1854
+ /** Default freshness window — sessions older than this are skipped. */
1855
+ declare const DEFAULT_SESSION_MAX_AGE_MS: number;
1856
+ /**
1857
+ * Record the current host session. Called from the mail-hook on
1858
+ * every fire with the `session_id` the host passed in. Updates the
1859
+ * existing record for that host or creates one — last write wins.
1860
+ *
1861
+ * Failures are swallowed so the mail-hook never crashes the host CLI
1862
+ * over a disk write. The bridge-wake path tolerates a missing record
1863
+ * (falls through to SMS).
1864
+ */
1865
+ declare function saveHostSession(host: HostName, session: Omit<HostSession, 'lastSeenMs'>): void;
1866
+ /**
1867
+ * Look up the most-recent session for a host. Returns null when no
1868
+ * record exists OR the record is older than `maxAgeMs` (default 24h).
1869
+ *
1870
+ * The age gate exists because both providers expire resume tokens
1871
+ * after roughly a day; attempting resume against a stale token is
1872
+ * almost always slower than starting fresh.
1873
+ */
1874
+ declare function loadHostSession(host: HostName, maxAgeMs?: number): HostSession | null;
1875
+ /**
1876
+ * Pure freshness predicate — exported for tests + for callers that
1877
+ * want to read the raw record (e.g. to print "last seen 2 hours ago"
1878
+ * in a diagnostic command).
1879
+ */
1880
+ declare function isSessionFresh(session: HostSession, maxAgeMs?: number): boolean;
1881
+ /**
1882
+ * Clear a host's recorded session. Called when the operator runs
1883
+ * `agenticmail-<host> uninstall` so the next install doesn't try to
1884
+ * resume a session that no longer exists.
1885
+ */
1886
+ declare function forgetHostSession(host: HostName): void;
1887
+ /** Exposed for tests + the `agenticmail status` diagnostic command. */
1888
+ declare function hostSessionStoragePath(): string;
1889
+
1767
1890
  /**
1768
1891
  * SSRF-safe URL validation for the AgenticMail API base URL.
1769
1892
  *
@@ -2371,4 +2494,4 @@ declare class AgentMemoryStore {
2371
2494
  renderForPrompt(memory: AgentMemoryRead | null): string;
2372
2495
  }
2373
2496
 
2374
- 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, 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 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, getDatabase, isInternalEmail, isValidPhoneNumber, normalizeAddress, normalizePhoneNumber, normalizeSubject, parseEmail, parseGoogleVoiceSms, recordToolCall, redactObject, redactSecret, resolveConfig, safeJoin, sanitizeEmail, saveConfig, scanOutboundEmail, scoreEmail, setTelemetryVersion, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
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 };
package/dist/index.d.ts CHANGED
@@ -1764,6 +1764,129 @@ declare function redactSecret(value: unknown): string;
1764
1764
  */
1765
1765
  declare function redactObject<T>(input: T, _depth?: number): T;
1766
1766
 
1767
+ /**
1768
+ * Persisted host-session registry.
1769
+ *
1770
+ * # What this is for
1771
+ *
1772
+ * When a sub-agent replies into the host bridge inbox
1773
+ * (`claudecode@localhost` / `codex@localhost`), the dispatcher
1774
+ * historically had no way to react: bridges are skipped by
1775
+ * `shouldWatch` because they belong to the human operator's host CLI,
1776
+ * not to an automated worker. The mail would sit unread until the
1777
+ * operator opened their CLI again — sometimes hours later, sometimes
1778
+ * never that day.
1779
+ *
1780
+ * This module is the missing link. Every time the host's mail-hook
1781
+ * fires (on `SessionStart` / `UserPromptSubmit` / `Stop`), it captures
1782
+ * the host CLI's current `session_id` and persists it here. The
1783
+ * dispatcher can then check "what session was running last?" and
1784
+ * attempt a headless resume against it when bridge mail arrives —
1785
+ * the same way Telegram bridges (Fola, etc.) keep a session alive
1786
+ * between bursts of activity.
1787
+ *
1788
+ * # The file
1789
+ *
1790
+ * `~/.agenticmail/host-sessions.json`:
1791
+ *
1792
+ * ```json
1793
+ * {
1794
+ * "version": 1,
1795
+ * "sessions": {
1796
+ * "claudecode": {
1797
+ * "sessionId": "01a2b3c4-…",
1798
+ * "workspace": "/Users/ope/Desktop/facebook-project",
1799
+ * "lastSeenMs": 1778905200000,
1800
+ * "model": "claude-sonnet-4-5"
1801
+ * },
1802
+ * "codex": {
1803
+ * "sessionId": "019a2b3c-…",
1804
+ * "workspace": "/Users/ope/Desktop/facebook-project",
1805
+ * "lastSeenMs": 1778905100000
1806
+ * }
1807
+ * }
1808
+ * }
1809
+ * ```
1810
+ *
1811
+ * Per host we keep ONE session — the most recent. If the operator
1812
+ * runs `claude` twice (e.g. one window for "general", one for "build
1813
+ * the LinkedIn clone"), we only track the last-active one. The
1814
+ * bridge resume always targets whichever was active most recently;
1815
+ * the operator's intuition matches that ("I just left my Claude
1816
+ * Code session a minute ago and the bridge ought to be able to
1817
+ * resume it").
1818
+ *
1819
+ * # Freshness semantics
1820
+ *
1821
+ * A session is considered "resumable" if `lastSeenMs` is within the
1822
+ * last 24 hours. Older than that, both Anthropic and OpenAI tend to
1823
+ * have evicted the session from their resume cache (cost-driven
1824
+ * decision; observed empirically). The dispatcher uses
1825
+ * `isSessionFresh(session, maxAgeMs)` to gate the resume attempt and
1826
+ * fall through to SMS / persistent storage when stale.
1827
+ *
1828
+ * # Atomic writes
1829
+ *
1830
+ * The mail-hook can fire concurrently with another hook on a
1831
+ * different host CLI window. The write path goes through a tmp file
1832
+ * + rename so a torn write can never leave a half-valid JSON file
1833
+ * that crashes the next reader. Same shape as `dispatcher-state.ts`.
1834
+ */
1835
+ /** Canonical names for the host integrations that own bridge inboxes. */
1836
+ type HostName = 'claudecode' | 'codex';
1837
+ /**
1838
+ * A snapshot of one host CLI's last-known session. Persisted to disk
1839
+ * by the mail-hook on every fire; loaded by the dispatcher when
1840
+ * bridge mail arrives so a resume can be attempted.
1841
+ */
1842
+ interface HostSession {
1843
+ /** Stable session_id from the host CLI (Claude Code or Codex). */
1844
+ sessionId: string;
1845
+ /** Wall-clock timestamp of the last hook fire on this session. */
1846
+ lastSeenMs: number;
1847
+ /** Optional: project cwd the host CLI was opened in. Used by
1848
+ * resume to spawn the headless turn in the right directory. */
1849
+ workspace?: string;
1850
+ /** Optional: model name the host session was using, surfaced
1851
+ * in logs for diagnostic context. */
1852
+ model?: string;
1853
+ }
1854
+ /** Default freshness window — sessions older than this are skipped. */
1855
+ declare const DEFAULT_SESSION_MAX_AGE_MS: number;
1856
+ /**
1857
+ * Record the current host session. Called from the mail-hook on
1858
+ * every fire with the `session_id` the host passed in. Updates the
1859
+ * existing record for that host or creates one — last write wins.
1860
+ *
1861
+ * Failures are swallowed so the mail-hook never crashes the host CLI
1862
+ * over a disk write. The bridge-wake path tolerates a missing record
1863
+ * (falls through to SMS).
1864
+ */
1865
+ declare function saveHostSession(host: HostName, session: Omit<HostSession, 'lastSeenMs'>): void;
1866
+ /**
1867
+ * Look up the most-recent session for a host. Returns null when no
1868
+ * record exists OR the record is older than `maxAgeMs` (default 24h).
1869
+ *
1870
+ * The age gate exists because both providers expire resume tokens
1871
+ * after roughly a day; attempting resume against a stale token is
1872
+ * almost always slower than starting fresh.
1873
+ */
1874
+ declare function loadHostSession(host: HostName, maxAgeMs?: number): HostSession | null;
1875
+ /**
1876
+ * Pure freshness predicate — exported for tests + for callers that
1877
+ * want to read the raw record (e.g. to print "last seen 2 hours ago"
1878
+ * in a diagnostic command).
1879
+ */
1880
+ declare function isSessionFresh(session: HostSession, maxAgeMs?: number): boolean;
1881
+ /**
1882
+ * Clear a host's recorded session. Called when the operator runs
1883
+ * `agenticmail-<host> uninstall` so the next install doesn't try to
1884
+ * resume a session that no longer exists.
1885
+ */
1886
+ declare function forgetHostSession(host: HostName): void;
1887
+ /** Exposed for tests + the `agenticmail status` diagnostic command. */
1888
+ declare function hostSessionStoragePath(): string;
1889
+
1767
1890
  /**
1768
1891
  * SSRF-safe URL validation for the AgenticMail API base URL.
1769
1892
  *
@@ -2371,4 +2494,4 @@ declare class AgentMemoryStore {
2371
2494
  renderForPrompt(memory: AgentMemoryRead | null): string;
2372
2495
  }
2373
2496
 
2374
- 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, 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 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, getDatabase, isInternalEmail, isValidPhoneNumber, normalizeAddress, normalizePhoneNumber, normalizeSubject, parseEmail, parseGoogleVoiceSms, recordToolCall, redactObject, redactSecret, resolveConfig, safeJoin, sanitizeEmail, saveConfig, scanOutboundEmail, scoreEmail, setTelemetryVersion, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
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 };