@agenticmail/core 0.9.12 → 0.9.14
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.cjs +1041 -8
- package/dist/index.d.cts +304 -1
- package/dist/index.d.ts +304 -1
- package/dist/index.js +1008 -7
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -505,6 +505,22 @@ interface SendResultWithRaw extends SendResult {
|
|
|
505
505
|
/** Raw RFC822 message bytes (for appending to Sent folder) */
|
|
506
506
|
raw: Buffer;
|
|
507
507
|
}
|
|
508
|
+
/** True for loopback hosts — the bundled local mail server lives here. */
|
|
509
|
+
declare function isLoopbackMailHost(host: string | undefined): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Resolve the effective TLS `rejectUnauthorized` for a mail connection.
|
|
512
|
+
*
|
|
513
|
+
* GHSA-wjjv-3mj2-39hf made certificate verification the default — but
|
|
514
|
+
* the bundled local mail server (Stalwart on 127.0.0.1) presents a
|
|
515
|
+
* self-signed certificate, so verifying it always fails and breaks
|
|
516
|
+
* local agent-to-agent mail out of the box. A self-signed cert on a
|
|
517
|
+
* loopback address is not a meaningful MITM surface, so for loopback
|
|
518
|
+
* hosts verification defaults OFF. Remote hosts still verify by
|
|
519
|
+
* default. An explicit `tlsRejectUnauthorized` option always wins
|
|
520
|
+
* either way, so a deployment can still force-verify localhost or
|
|
521
|
+
* opt a remote host out if it really needs to.
|
|
522
|
+
*/
|
|
523
|
+
declare function resolveTlsRejectUnauthorized(host: string | undefined, explicit: boolean | undefined): boolean;
|
|
508
524
|
declare class MailSender {
|
|
509
525
|
private options;
|
|
510
526
|
private transporter;
|
|
@@ -1676,6 +1692,293 @@ declare class SmsPoller {
|
|
|
1676
1692
|
private pollOnce;
|
|
1677
1693
|
}
|
|
1678
1694
|
|
|
1695
|
+
declare const ELKS_REALTIME_AUDIO_FORMATS: readonly ["ulaw", "pcm_16000", "pcm_24000", "wav"];
|
|
1696
|
+
type ElksRealtimeAudioFormat = typeof ELKS_REALTIME_AUDIO_FORMATS[number];
|
|
1697
|
+
interface ElksRealtimeHelloMessage {
|
|
1698
|
+
t: 'hello';
|
|
1699
|
+
callid: string;
|
|
1700
|
+
from: string;
|
|
1701
|
+
to: string;
|
|
1702
|
+
[key: string]: unknown;
|
|
1703
|
+
}
|
|
1704
|
+
interface ElksRealtimeAudioMessage {
|
|
1705
|
+
t: 'audio';
|
|
1706
|
+
data: string;
|
|
1707
|
+
}
|
|
1708
|
+
interface ElksRealtimeByeMessage {
|
|
1709
|
+
t: 'bye';
|
|
1710
|
+
reason?: string;
|
|
1711
|
+
message?: string;
|
|
1712
|
+
[key: string]: unknown;
|
|
1713
|
+
}
|
|
1714
|
+
type ElksRealtimeInboundMessage = ElksRealtimeHelloMessage | ElksRealtimeAudioMessage | ElksRealtimeByeMessage;
|
|
1715
|
+
type ElksRealtimeOutboundMessage = {
|
|
1716
|
+
t: 'listening';
|
|
1717
|
+
format: ElksRealtimeAudioFormat;
|
|
1718
|
+
} | {
|
|
1719
|
+
t: 'sending';
|
|
1720
|
+
format: ElksRealtimeAudioFormat;
|
|
1721
|
+
} | {
|
|
1722
|
+
t: 'audio';
|
|
1723
|
+
data: string;
|
|
1724
|
+
} | {
|
|
1725
|
+
t: 'interrupt';
|
|
1726
|
+
} | {
|
|
1727
|
+
t: 'bye';
|
|
1728
|
+
};
|
|
1729
|
+
declare function parseElksRealtimeMessage(input: unknown): ElksRealtimeInboundMessage;
|
|
1730
|
+
declare function buildElksListeningMessage(format?: ElksRealtimeAudioFormat): ElksRealtimeOutboundMessage;
|
|
1731
|
+
declare function buildElksSendingMessage(format?: ElksRealtimeAudioFormat): ElksRealtimeOutboundMessage;
|
|
1732
|
+
declare function buildElksAudioMessage(data: string | Uint8Array): ElksRealtimeOutboundMessage;
|
|
1733
|
+
declare function buildElksInterruptMessage(): ElksRealtimeOutboundMessage;
|
|
1734
|
+
declare function buildElksByeMessage(): ElksRealtimeOutboundMessage;
|
|
1735
|
+
declare function buildElksHandshakeMessages(options?: {
|
|
1736
|
+
listenFormat?: ElksRealtimeAudioFormat;
|
|
1737
|
+
sendFormat?: ElksRealtimeAudioFormat;
|
|
1738
|
+
}): ElksRealtimeOutboundMessage[];
|
|
1739
|
+
|
|
1740
|
+
declare const PHONE_REGION_SCOPES: readonly ["AT", "DE", "EU", "WORLD"];
|
|
1741
|
+
type PhoneRegionScope = typeof PHONE_REGION_SCOPES[number];
|
|
1742
|
+
declare const TELEPHONY_TRANSPORT_CAPABILITIES: readonly ["sms", "call_control", "realtime_media", "recording_supported"];
|
|
1743
|
+
type TelephonyTransportCapability = typeof TELEPHONY_TRANSPORT_CAPABILITIES[number];
|
|
1744
|
+
declare const PHONE_MISSION_STATES: readonly ["draft", "approved", "dialing", "connected", "conversing", "needs_operator", "completed", "failed", "cancelled"];
|
|
1745
|
+
type PhoneMissionState = typeof PHONE_MISSION_STATES[number];
|
|
1746
|
+
type PhoneNumberRisk = 'invalid' | 'standard' | 'premium_or_special';
|
|
1747
|
+
/**
|
|
1748
|
+
* Server-side hard ceilings for a phone mission policy.
|
|
1749
|
+
*
|
|
1750
|
+
* Hardening (#42-H1 / #43-H2) — `policy` is supplied by the calling agent,
|
|
1751
|
+
* so a caller-set `maxCallDurationSeconds: 999999` or `maxCostPerMission:
|
|
1752
|
+
* 1e9` is self-authorized and meaningless as a limit. These constants are
|
|
1753
|
+
* the real ceiling: `validatePhoneMissionPolicy` clamps every caller value
|
|
1754
|
+
* down to (at most) the server cap, so the effective policy can only ever
|
|
1755
|
+
* be MORE restrictive than the server, never less. A phone mission places
|
|
1756
|
+
* real, billed calls — these bounds are the financial blast-radius cap.
|
|
1757
|
+
*/
|
|
1758
|
+
declare const PHONE_SERVER_MAX_CALL_DURATION_SECONDS = 3600;
|
|
1759
|
+
declare const PHONE_SERVER_MAX_COST_PER_MISSION = 5;
|
|
1760
|
+
declare const PHONE_SERVER_MAX_ATTEMPTS = 3;
|
|
1761
|
+
/** Hard cap on the free-text `task` fed to the voice runtime. */
|
|
1762
|
+
declare const PHONE_TASK_MAX_LENGTH = 2000;
|
|
1763
|
+
interface PhoneConfirmPolicy {
|
|
1764
|
+
paymentDetails: 'never';
|
|
1765
|
+
contractCommitment: 'never';
|
|
1766
|
+
costOverLimit: 'needs_operator';
|
|
1767
|
+
sensitivePersonalData: 'needs_operator';
|
|
1768
|
+
unclearAlternative: 'needs_operator';
|
|
1769
|
+
}
|
|
1770
|
+
interface PhoneAlternativePolicy {
|
|
1771
|
+
maxTimeShiftMinutes: number;
|
|
1772
|
+
}
|
|
1773
|
+
interface OpenClawPhoneMissionPolicy {
|
|
1774
|
+
policyVersion: 1;
|
|
1775
|
+
regionAllowlist: PhoneRegionScope[];
|
|
1776
|
+
maxCallDurationSeconds: number;
|
|
1777
|
+
maxCostPerMission: number;
|
|
1778
|
+
maxAttempts: number;
|
|
1779
|
+
transcriptEnabled: boolean;
|
|
1780
|
+
recordingEnabled: boolean;
|
|
1781
|
+
confirmPolicy: PhoneConfirmPolicy;
|
|
1782
|
+
alternativePolicy: PhoneAlternativePolicy;
|
|
1783
|
+
}
|
|
1784
|
+
interface StartPhoneMissionInput {
|
|
1785
|
+
to: string;
|
|
1786
|
+
task: string;
|
|
1787
|
+
policy: OpenClawPhoneMissionPolicy;
|
|
1788
|
+
voiceRuntimeRef?: string;
|
|
1789
|
+
}
|
|
1790
|
+
interface PhoneTransportProfile {
|
|
1791
|
+
provider: string;
|
|
1792
|
+
phoneNumber: string;
|
|
1793
|
+
capabilities: TelephonyTransportCapability[];
|
|
1794
|
+
supportedRegions: PhoneRegionScope[];
|
|
1795
|
+
}
|
|
1796
|
+
interface PhoneMissionValidationIssue {
|
|
1797
|
+
code: string;
|
|
1798
|
+
field: string;
|
|
1799
|
+
message: string;
|
|
1800
|
+
}
|
|
1801
|
+
type PhoneMissionValidationResult = {
|
|
1802
|
+
ok: true;
|
|
1803
|
+
policy: OpenClawPhoneMissionPolicy;
|
|
1804
|
+
issues: [];
|
|
1805
|
+
} | {
|
|
1806
|
+
ok: false;
|
|
1807
|
+
issues: PhoneMissionValidationIssue[];
|
|
1808
|
+
};
|
|
1809
|
+
type PhoneTransportValidationResult = {
|
|
1810
|
+
ok: true;
|
|
1811
|
+
transport: PhoneTransportProfile;
|
|
1812
|
+
issues: [];
|
|
1813
|
+
} | {
|
|
1814
|
+
ok: false;
|
|
1815
|
+
issues: PhoneMissionValidationIssue[];
|
|
1816
|
+
};
|
|
1817
|
+
interface ValidatedPhoneMissionStart {
|
|
1818
|
+
to: string;
|
|
1819
|
+
task: string;
|
|
1820
|
+
policy: OpenClawPhoneMissionPolicy;
|
|
1821
|
+
targetRegion: PhoneRegionScope;
|
|
1822
|
+
transport: PhoneTransportProfile;
|
|
1823
|
+
voiceRuntimeRef?: string;
|
|
1824
|
+
}
|
|
1825
|
+
type PhoneMissionStartValidationResult = {
|
|
1826
|
+
ok: true;
|
|
1827
|
+
mission: ValidatedPhoneMissionStart;
|
|
1828
|
+
issues: [];
|
|
1829
|
+
} | {
|
|
1830
|
+
ok: false;
|
|
1831
|
+
issues: PhoneMissionValidationIssue[];
|
|
1832
|
+
};
|
|
1833
|
+
declare function validatePhoneMissionPolicy(policy: unknown): PhoneMissionValidationResult;
|
|
1834
|
+
declare function validatePhoneTransportProfile(transport: unknown): PhoneTransportValidationResult;
|
|
1835
|
+
declare function inferPhoneRegion(phoneNumber: string): PhoneRegionScope | null;
|
|
1836
|
+
declare function isPhoneRegionAllowed(region: PhoneRegionScope, allowlist: readonly PhoneRegionScope[]): boolean;
|
|
1837
|
+
declare function classifyPhoneNumberRisk(phoneNumber: string): PhoneNumberRisk;
|
|
1838
|
+
declare function validatePhoneMissionStart(input: unknown, transport: unknown, options?: {
|
|
1839
|
+
allowPremiumOrSpecialNumbers?: boolean;
|
|
1840
|
+
}): PhoneMissionStartValidationResult;
|
|
1841
|
+
|
|
1842
|
+
type PhoneTransportProvider = '46elks';
|
|
1843
|
+
/**
|
|
1844
|
+
* Abuse / cost controls for the call-control surface. A phone mission
|
|
1845
|
+
* places a real, billed outbound call, so /calls/start needs hard limits
|
|
1846
|
+
* that the caller cannot raise (see #43-H1).
|
|
1847
|
+
*/
|
|
1848
|
+
declare const PHONE_RATE_LIMIT_PER_MINUTE = 5;
|
|
1849
|
+
declare const PHONE_RATE_LIMIT_PER_HOUR = 30;
|
|
1850
|
+
declare const PHONE_MAX_CONCURRENT_MISSIONS = 3;
|
|
1851
|
+
/** Minimum entropy for an agent-supplied webhook secret (#43-H8). */
|
|
1852
|
+
declare const PHONE_MIN_WEBHOOK_SECRET_LENGTH = 24;
|
|
1853
|
+
/**
|
|
1854
|
+
* Thrown by the webhook handlers for ANY authentication failure —
|
|
1855
|
+
* unknown mission, missing token, or wrong token alike. Uniform on
|
|
1856
|
+
* purpose: the route maps it to a single 403 + generic body so an
|
|
1857
|
+
* unauthenticated caller cannot tell a real missionId from a fake one
|
|
1858
|
+
* (#43-H3 — the 404-vs-403 enumeration oracle).
|
|
1859
|
+
*/
|
|
1860
|
+
declare class PhoneWebhookAuthError extends Error {
|
|
1861
|
+
readonly isPhoneWebhookAuthError = true;
|
|
1862
|
+
constructor();
|
|
1863
|
+
}
|
|
1864
|
+
/** Thrown when /calls/start is refused by a rate/concurrency limit (#43-H1). */
|
|
1865
|
+
declare class PhoneRateLimitError extends Error {
|
|
1866
|
+
readonly isPhoneRateLimitError = true;
|
|
1867
|
+
constructor(message: string);
|
|
1868
|
+
}
|
|
1869
|
+
interface PhoneTransportConfig extends PhoneTransportProfile {
|
|
1870
|
+
provider: PhoneTransportProvider;
|
|
1871
|
+
username: string;
|
|
1872
|
+
password: string;
|
|
1873
|
+
webhookBaseUrl: string;
|
|
1874
|
+
webhookSecret: string;
|
|
1875
|
+
apiUrl?: string;
|
|
1876
|
+
configuredAt: string;
|
|
1877
|
+
}
|
|
1878
|
+
interface PhoneMissionTranscriptEntry {
|
|
1879
|
+
at: string;
|
|
1880
|
+
source: 'system' | 'provider' | 'agent' | 'operator';
|
|
1881
|
+
text: string;
|
|
1882
|
+
metadata?: Record<string, unknown>;
|
|
1883
|
+
}
|
|
1884
|
+
interface PhoneCallMission {
|
|
1885
|
+
id: string;
|
|
1886
|
+
agentId: string;
|
|
1887
|
+
status: PhoneMissionState;
|
|
1888
|
+
from: string;
|
|
1889
|
+
to: string;
|
|
1890
|
+
task: string;
|
|
1891
|
+
policy: OpenClawPhoneMissionPolicy;
|
|
1892
|
+
transport: PhoneTransportProfile;
|
|
1893
|
+
provider: PhoneTransportProvider;
|
|
1894
|
+
providerCallId?: string;
|
|
1895
|
+
transcript: PhoneMissionTranscriptEntry[];
|
|
1896
|
+
metadata: Record<string, unknown>;
|
|
1897
|
+
createdAt: string;
|
|
1898
|
+
updatedAt: string;
|
|
1899
|
+
}
|
|
1900
|
+
interface StartPhoneCallOptions {
|
|
1901
|
+
dryRun?: boolean;
|
|
1902
|
+
fetchFn?: typeof fetch;
|
|
1903
|
+
now?: Date;
|
|
1904
|
+
}
|
|
1905
|
+
interface StartPhoneCallResult {
|
|
1906
|
+
mission: PhoneCallMission;
|
|
1907
|
+
providerRequest?: {
|
|
1908
|
+
url: string;
|
|
1909
|
+
body: Record<string, string>;
|
|
1910
|
+
};
|
|
1911
|
+
providerResponse?: unknown;
|
|
1912
|
+
}
|
|
1913
|
+
interface PhoneWebhookResult {
|
|
1914
|
+
mission: PhoneCallMission;
|
|
1915
|
+
action: Record<string, unknown>;
|
|
1916
|
+
}
|
|
1917
|
+
declare function redactPhoneTransportConfig(config: PhoneTransportConfig): PhoneTransportConfig;
|
|
1918
|
+
declare class PhoneManager {
|
|
1919
|
+
private db;
|
|
1920
|
+
private encryptionKey?;
|
|
1921
|
+
private initialized;
|
|
1922
|
+
/** Per-agent outbound-call timestamps (ms) for the in-memory rate limiter. */
|
|
1923
|
+
private readonly callTimestamps;
|
|
1924
|
+
constructor(db: Database, encryptionKey?: string | undefined);
|
|
1925
|
+
/**
|
|
1926
|
+
* Abuse / cost gate for /calls/start (#43-H1). Each non-dry-run call is
|
|
1927
|
+
* a real billed outbound call, so before dialing we enforce:
|
|
1928
|
+
* - a hard cap on concurrently-active (non-terminal) missions, and
|
|
1929
|
+
* - a per-agent token-bucket rate limit (per-minute + per-hour).
|
|
1930
|
+
* Throws {@link PhoneRateLimitError} (-> HTTP 429) when a limit is hit.
|
|
1931
|
+
* Call only on the real path — dry runs place no call and are exempt.
|
|
1932
|
+
*/
|
|
1933
|
+
private enforceCallLimits;
|
|
1934
|
+
private encryptConfig;
|
|
1935
|
+
private decryptConfig;
|
|
1936
|
+
private ensureTables;
|
|
1937
|
+
getPhoneTransportConfig(agentId: string): PhoneTransportConfig | null;
|
|
1938
|
+
savePhoneTransportConfig(agentId: string, config: PhoneTransportConfig): PhoneTransportConfig;
|
|
1939
|
+
getMission(missionId: string, agentId?: string): PhoneCallMission | null;
|
|
1940
|
+
listMissions(agentId: string, opts?: {
|
|
1941
|
+
limit?: number;
|
|
1942
|
+
offset?: number;
|
|
1943
|
+
status?: PhoneMissionState;
|
|
1944
|
+
}): PhoneCallMission[];
|
|
1945
|
+
startMission(agentId: string, input: StartPhoneMissionInput, options?: StartPhoneCallOptions): Promise<StartPhoneCallResult>;
|
|
1946
|
+
/**
|
|
1947
|
+
* Verify a webhook request and return the mission, or throw a uniform
|
|
1948
|
+
* {@link PhoneWebhookAuthError} for ANY failure (unknown mission, no
|
|
1949
|
+
* token, wrong token). Uniform on purpose — no 404-vs-403 oracle.
|
|
1950
|
+
*/
|
|
1951
|
+
private authenticateWebhook;
|
|
1952
|
+
handleVoiceStartWebhook(missionId: string, providedToken: string, payload?: Record<string, unknown>): PhoneWebhookResult;
|
|
1953
|
+
handleHangupWebhook(missionId: string, providedToken: string, payload?: Record<string, unknown>): PhoneCallMission;
|
|
1954
|
+
/**
|
|
1955
|
+
* Read the call cost off a 46elks hangup payload, add it to the
|
|
1956
|
+
* mission's running total, and flag a policy-cap breach (#43-H2).
|
|
1957
|
+
* Cost is only knowable post-call from the provider — the preventive
|
|
1958
|
+
* cost controls are the duration ceiling, rate limit, and concurrency
|
|
1959
|
+
* cap; this is the after-the-fact accounting + alerting.
|
|
1960
|
+
*/
|
|
1961
|
+
private buildCostMetadataPatch;
|
|
1962
|
+
private buildVoiceStartAction;
|
|
1963
|
+
cancelMission(agentId: string, missionId: string): PhoneCallMission;
|
|
1964
|
+
private build46ElksCallRequest;
|
|
1965
|
+
private insertMission;
|
|
1966
|
+
private updateProviderCall;
|
|
1967
|
+
private updateMissionStatus;
|
|
1968
|
+
}
|
|
1969
|
+
declare function buildPhoneTransportConfig(input: {
|
|
1970
|
+
provider?: unknown;
|
|
1971
|
+
phoneNumber?: unknown;
|
|
1972
|
+
username?: unknown;
|
|
1973
|
+
password?: unknown;
|
|
1974
|
+
webhookBaseUrl?: unknown;
|
|
1975
|
+
webhookSecret?: unknown;
|
|
1976
|
+
apiUrl?: unknown;
|
|
1977
|
+
capabilities?: unknown;
|
|
1978
|
+
supportedRegions?: unknown;
|
|
1979
|
+
configuredAt?: string;
|
|
1980
|
+
}): PhoneTransportConfig;
|
|
1981
|
+
|
|
1679
1982
|
/**
|
|
1680
1983
|
* AgenticMail Anonymous Telemetry
|
|
1681
1984
|
*
|
|
@@ -2719,4 +3022,4 @@ declare class AgentMemoryStore {
|
|
|
2719
3022
|
renderForPrompt(memory: AgentMemoryRead | null): string;
|
|
2720
3023
|
}
|
|
2721
3024
|
|
|
2722
|
-
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, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, 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 HostSessionResumeMode, type InboundEmail, type InboundSmsEvent, 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 PlanBridgeWakeArgs, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SmsProvider, 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, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, classifyResumeError, closeDatabase, composeBridgeWakePrompt, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, getSmsProvider, hostSessionStoragePath, isInternalEmail, isSessionFresh, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseEmail, parseGoogleVoiceSms, planBridgeWake, recordToolCall, redactObject, redactSecret, redactSmsConfig, resolveConfig, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
|
|
3025
|
+
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, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, 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, ELKS_REALTIME_AUDIO_FORMATS, type ElksRealtimeAudioFormat, type ElksRealtimeAudioMessage, type ElksRealtimeByeMessage, type ElksRealtimeHelloMessage, type ElksRealtimeInboundMessage, type ElksRealtimeOutboundMessage, 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 HostSessionResumeMode, type InboundEmail, type InboundSmsEvent, 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 OpenClawPhoneMissionPolicy, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, PHONE_MAX_CONCURRENT_MISSIONS, PHONE_MIN_WEBHOOK_SECRET_LENGTH, PHONE_MISSION_STATES, PHONE_RATE_LIMIT_PER_HOUR, PHONE_RATE_LIMIT_PER_MINUTE, PHONE_REGION_SCOPES, PHONE_SERVER_MAX_ATTEMPTS, PHONE_SERVER_MAX_CALL_DURATION_SECONDS, PHONE_SERVER_MAX_COST_PER_MISSION, PHONE_TASK_MAX_LENGTH, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PhoneAlternativePolicy, type PhoneCallMission, type PhoneConfirmPolicy, PhoneManager, type PhoneMissionStartValidationResult, type PhoneMissionState, type PhoneMissionTranscriptEntry, type PhoneMissionValidationIssue, type PhoneMissionValidationResult, type PhoneNumberRisk, PhoneRateLimitError, type PhoneRegionScope, type PhoneTransportConfig, type PhoneTransportProfile, type PhoneTransportProvider, type PhoneTransportValidationResult, PhoneWebhookAuthError, type PhoneWebhookResult, type PlanBridgeWakeArgs, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SmsProvider, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, type StartPhoneCallOptions, type StartPhoneCallResult, type StartPhoneMissionInput, TELEPHONY_TRANSPORT_CAPABILITIES, type TelephonyTransportCapability, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, type ValidatedPhoneMissionStart, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildElksAudioMessage, buildElksByeMessage, buildElksHandshakeMessages, buildElksInterruptMessage, buildElksListeningMessage, buildElksSendingMessage, buildInboundSecurityAdvisory, buildPhoneTransportConfig, classifyEmailRoute, classifyPhoneNumberRisk, classifyResumeError, closeDatabase, composeBridgeWakePrompt, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, getSmsProvider, hostSessionStoragePath, inferPhoneRegion, isInternalEmail, isLoopbackMailHost, isPhoneRegionAllowed, isSessionFresh, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseElksRealtimeMessage, parseEmail, parseGoogleVoiceSms, planBridgeWake, recordToolCall, redactObject, redactPhoneTransportConfig, redactSecret, redactSmsConfig, resolveConfig, resolveTlsRejectUnauthorized, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, startRelayBridge, threadIdFor, tryJoin, validateApiUrl, validatePhoneMissionPolicy, validatePhoneMissionStart, validatePhoneTransportProfile };
|
package/dist/index.d.ts
CHANGED
|
@@ -505,6 +505,22 @@ interface SendResultWithRaw extends SendResult {
|
|
|
505
505
|
/** Raw RFC822 message bytes (for appending to Sent folder) */
|
|
506
506
|
raw: Buffer;
|
|
507
507
|
}
|
|
508
|
+
/** True for loopback hosts — the bundled local mail server lives here. */
|
|
509
|
+
declare function isLoopbackMailHost(host: string | undefined): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Resolve the effective TLS `rejectUnauthorized` for a mail connection.
|
|
512
|
+
*
|
|
513
|
+
* GHSA-wjjv-3mj2-39hf made certificate verification the default — but
|
|
514
|
+
* the bundled local mail server (Stalwart on 127.0.0.1) presents a
|
|
515
|
+
* self-signed certificate, so verifying it always fails and breaks
|
|
516
|
+
* local agent-to-agent mail out of the box. A self-signed cert on a
|
|
517
|
+
* loopback address is not a meaningful MITM surface, so for loopback
|
|
518
|
+
* hosts verification defaults OFF. Remote hosts still verify by
|
|
519
|
+
* default. An explicit `tlsRejectUnauthorized` option always wins
|
|
520
|
+
* either way, so a deployment can still force-verify localhost or
|
|
521
|
+
* opt a remote host out if it really needs to.
|
|
522
|
+
*/
|
|
523
|
+
declare function resolveTlsRejectUnauthorized(host: string | undefined, explicit: boolean | undefined): boolean;
|
|
508
524
|
declare class MailSender {
|
|
509
525
|
private options;
|
|
510
526
|
private transporter;
|
|
@@ -1676,6 +1692,293 @@ declare class SmsPoller {
|
|
|
1676
1692
|
private pollOnce;
|
|
1677
1693
|
}
|
|
1678
1694
|
|
|
1695
|
+
declare const ELKS_REALTIME_AUDIO_FORMATS: readonly ["ulaw", "pcm_16000", "pcm_24000", "wav"];
|
|
1696
|
+
type ElksRealtimeAudioFormat = typeof ELKS_REALTIME_AUDIO_FORMATS[number];
|
|
1697
|
+
interface ElksRealtimeHelloMessage {
|
|
1698
|
+
t: 'hello';
|
|
1699
|
+
callid: string;
|
|
1700
|
+
from: string;
|
|
1701
|
+
to: string;
|
|
1702
|
+
[key: string]: unknown;
|
|
1703
|
+
}
|
|
1704
|
+
interface ElksRealtimeAudioMessage {
|
|
1705
|
+
t: 'audio';
|
|
1706
|
+
data: string;
|
|
1707
|
+
}
|
|
1708
|
+
interface ElksRealtimeByeMessage {
|
|
1709
|
+
t: 'bye';
|
|
1710
|
+
reason?: string;
|
|
1711
|
+
message?: string;
|
|
1712
|
+
[key: string]: unknown;
|
|
1713
|
+
}
|
|
1714
|
+
type ElksRealtimeInboundMessage = ElksRealtimeHelloMessage | ElksRealtimeAudioMessage | ElksRealtimeByeMessage;
|
|
1715
|
+
type ElksRealtimeOutboundMessage = {
|
|
1716
|
+
t: 'listening';
|
|
1717
|
+
format: ElksRealtimeAudioFormat;
|
|
1718
|
+
} | {
|
|
1719
|
+
t: 'sending';
|
|
1720
|
+
format: ElksRealtimeAudioFormat;
|
|
1721
|
+
} | {
|
|
1722
|
+
t: 'audio';
|
|
1723
|
+
data: string;
|
|
1724
|
+
} | {
|
|
1725
|
+
t: 'interrupt';
|
|
1726
|
+
} | {
|
|
1727
|
+
t: 'bye';
|
|
1728
|
+
};
|
|
1729
|
+
declare function parseElksRealtimeMessage(input: unknown): ElksRealtimeInboundMessage;
|
|
1730
|
+
declare function buildElksListeningMessage(format?: ElksRealtimeAudioFormat): ElksRealtimeOutboundMessage;
|
|
1731
|
+
declare function buildElksSendingMessage(format?: ElksRealtimeAudioFormat): ElksRealtimeOutboundMessage;
|
|
1732
|
+
declare function buildElksAudioMessage(data: string | Uint8Array): ElksRealtimeOutboundMessage;
|
|
1733
|
+
declare function buildElksInterruptMessage(): ElksRealtimeOutboundMessage;
|
|
1734
|
+
declare function buildElksByeMessage(): ElksRealtimeOutboundMessage;
|
|
1735
|
+
declare function buildElksHandshakeMessages(options?: {
|
|
1736
|
+
listenFormat?: ElksRealtimeAudioFormat;
|
|
1737
|
+
sendFormat?: ElksRealtimeAudioFormat;
|
|
1738
|
+
}): ElksRealtimeOutboundMessage[];
|
|
1739
|
+
|
|
1740
|
+
declare const PHONE_REGION_SCOPES: readonly ["AT", "DE", "EU", "WORLD"];
|
|
1741
|
+
type PhoneRegionScope = typeof PHONE_REGION_SCOPES[number];
|
|
1742
|
+
declare const TELEPHONY_TRANSPORT_CAPABILITIES: readonly ["sms", "call_control", "realtime_media", "recording_supported"];
|
|
1743
|
+
type TelephonyTransportCapability = typeof TELEPHONY_TRANSPORT_CAPABILITIES[number];
|
|
1744
|
+
declare const PHONE_MISSION_STATES: readonly ["draft", "approved", "dialing", "connected", "conversing", "needs_operator", "completed", "failed", "cancelled"];
|
|
1745
|
+
type PhoneMissionState = typeof PHONE_MISSION_STATES[number];
|
|
1746
|
+
type PhoneNumberRisk = 'invalid' | 'standard' | 'premium_or_special';
|
|
1747
|
+
/**
|
|
1748
|
+
* Server-side hard ceilings for a phone mission policy.
|
|
1749
|
+
*
|
|
1750
|
+
* Hardening (#42-H1 / #43-H2) — `policy` is supplied by the calling agent,
|
|
1751
|
+
* so a caller-set `maxCallDurationSeconds: 999999` or `maxCostPerMission:
|
|
1752
|
+
* 1e9` is self-authorized and meaningless as a limit. These constants are
|
|
1753
|
+
* the real ceiling: `validatePhoneMissionPolicy` clamps every caller value
|
|
1754
|
+
* down to (at most) the server cap, so the effective policy can only ever
|
|
1755
|
+
* be MORE restrictive than the server, never less. A phone mission places
|
|
1756
|
+
* real, billed calls — these bounds are the financial blast-radius cap.
|
|
1757
|
+
*/
|
|
1758
|
+
declare const PHONE_SERVER_MAX_CALL_DURATION_SECONDS = 3600;
|
|
1759
|
+
declare const PHONE_SERVER_MAX_COST_PER_MISSION = 5;
|
|
1760
|
+
declare const PHONE_SERVER_MAX_ATTEMPTS = 3;
|
|
1761
|
+
/** Hard cap on the free-text `task` fed to the voice runtime. */
|
|
1762
|
+
declare const PHONE_TASK_MAX_LENGTH = 2000;
|
|
1763
|
+
interface PhoneConfirmPolicy {
|
|
1764
|
+
paymentDetails: 'never';
|
|
1765
|
+
contractCommitment: 'never';
|
|
1766
|
+
costOverLimit: 'needs_operator';
|
|
1767
|
+
sensitivePersonalData: 'needs_operator';
|
|
1768
|
+
unclearAlternative: 'needs_operator';
|
|
1769
|
+
}
|
|
1770
|
+
interface PhoneAlternativePolicy {
|
|
1771
|
+
maxTimeShiftMinutes: number;
|
|
1772
|
+
}
|
|
1773
|
+
interface OpenClawPhoneMissionPolicy {
|
|
1774
|
+
policyVersion: 1;
|
|
1775
|
+
regionAllowlist: PhoneRegionScope[];
|
|
1776
|
+
maxCallDurationSeconds: number;
|
|
1777
|
+
maxCostPerMission: number;
|
|
1778
|
+
maxAttempts: number;
|
|
1779
|
+
transcriptEnabled: boolean;
|
|
1780
|
+
recordingEnabled: boolean;
|
|
1781
|
+
confirmPolicy: PhoneConfirmPolicy;
|
|
1782
|
+
alternativePolicy: PhoneAlternativePolicy;
|
|
1783
|
+
}
|
|
1784
|
+
interface StartPhoneMissionInput {
|
|
1785
|
+
to: string;
|
|
1786
|
+
task: string;
|
|
1787
|
+
policy: OpenClawPhoneMissionPolicy;
|
|
1788
|
+
voiceRuntimeRef?: string;
|
|
1789
|
+
}
|
|
1790
|
+
interface PhoneTransportProfile {
|
|
1791
|
+
provider: string;
|
|
1792
|
+
phoneNumber: string;
|
|
1793
|
+
capabilities: TelephonyTransportCapability[];
|
|
1794
|
+
supportedRegions: PhoneRegionScope[];
|
|
1795
|
+
}
|
|
1796
|
+
interface PhoneMissionValidationIssue {
|
|
1797
|
+
code: string;
|
|
1798
|
+
field: string;
|
|
1799
|
+
message: string;
|
|
1800
|
+
}
|
|
1801
|
+
type PhoneMissionValidationResult = {
|
|
1802
|
+
ok: true;
|
|
1803
|
+
policy: OpenClawPhoneMissionPolicy;
|
|
1804
|
+
issues: [];
|
|
1805
|
+
} | {
|
|
1806
|
+
ok: false;
|
|
1807
|
+
issues: PhoneMissionValidationIssue[];
|
|
1808
|
+
};
|
|
1809
|
+
type PhoneTransportValidationResult = {
|
|
1810
|
+
ok: true;
|
|
1811
|
+
transport: PhoneTransportProfile;
|
|
1812
|
+
issues: [];
|
|
1813
|
+
} | {
|
|
1814
|
+
ok: false;
|
|
1815
|
+
issues: PhoneMissionValidationIssue[];
|
|
1816
|
+
};
|
|
1817
|
+
interface ValidatedPhoneMissionStart {
|
|
1818
|
+
to: string;
|
|
1819
|
+
task: string;
|
|
1820
|
+
policy: OpenClawPhoneMissionPolicy;
|
|
1821
|
+
targetRegion: PhoneRegionScope;
|
|
1822
|
+
transport: PhoneTransportProfile;
|
|
1823
|
+
voiceRuntimeRef?: string;
|
|
1824
|
+
}
|
|
1825
|
+
type PhoneMissionStartValidationResult = {
|
|
1826
|
+
ok: true;
|
|
1827
|
+
mission: ValidatedPhoneMissionStart;
|
|
1828
|
+
issues: [];
|
|
1829
|
+
} | {
|
|
1830
|
+
ok: false;
|
|
1831
|
+
issues: PhoneMissionValidationIssue[];
|
|
1832
|
+
};
|
|
1833
|
+
declare function validatePhoneMissionPolicy(policy: unknown): PhoneMissionValidationResult;
|
|
1834
|
+
declare function validatePhoneTransportProfile(transport: unknown): PhoneTransportValidationResult;
|
|
1835
|
+
declare function inferPhoneRegion(phoneNumber: string): PhoneRegionScope | null;
|
|
1836
|
+
declare function isPhoneRegionAllowed(region: PhoneRegionScope, allowlist: readonly PhoneRegionScope[]): boolean;
|
|
1837
|
+
declare function classifyPhoneNumberRisk(phoneNumber: string): PhoneNumberRisk;
|
|
1838
|
+
declare function validatePhoneMissionStart(input: unknown, transport: unknown, options?: {
|
|
1839
|
+
allowPremiumOrSpecialNumbers?: boolean;
|
|
1840
|
+
}): PhoneMissionStartValidationResult;
|
|
1841
|
+
|
|
1842
|
+
type PhoneTransportProvider = '46elks';
|
|
1843
|
+
/**
|
|
1844
|
+
* Abuse / cost controls for the call-control surface. A phone mission
|
|
1845
|
+
* places a real, billed outbound call, so /calls/start needs hard limits
|
|
1846
|
+
* that the caller cannot raise (see #43-H1).
|
|
1847
|
+
*/
|
|
1848
|
+
declare const PHONE_RATE_LIMIT_PER_MINUTE = 5;
|
|
1849
|
+
declare const PHONE_RATE_LIMIT_PER_HOUR = 30;
|
|
1850
|
+
declare const PHONE_MAX_CONCURRENT_MISSIONS = 3;
|
|
1851
|
+
/** Minimum entropy for an agent-supplied webhook secret (#43-H8). */
|
|
1852
|
+
declare const PHONE_MIN_WEBHOOK_SECRET_LENGTH = 24;
|
|
1853
|
+
/**
|
|
1854
|
+
* Thrown by the webhook handlers for ANY authentication failure —
|
|
1855
|
+
* unknown mission, missing token, or wrong token alike. Uniform on
|
|
1856
|
+
* purpose: the route maps it to a single 403 + generic body so an
|
|
1857
|
+
* unauthenticated caller cannot tell a real missionId from a fake one
|
|
1858
|
+
* (#43-H3 — the 404-vs-403 enumeration oracle).
|
|
1859
|
+
*/
|
|
1860
|
+
declare class PhoneWebhookAuthError extends Error {
|
|
1861
|
+
readonly isPhoneWebhookAuthError = true;
|
|
1862
|
+
constructor();
|
|
1863
|
+
}
|
|
1864
|
+
/** Thrown when /calls/start is refused by a rate/concurrency limit (#43-H1). */
|
|
1865
|
+
declare class PhoneRateLimitError extends Error {
|
|
1866
|
+
readonly isPhoneRateLimitError = true;
|
|
1867
|
+
constructor(message: string);
|
|
1868
|
+
}
|
|
1869
|
+
interface PhoneTransportConfig extends PhoneTransportProfile {
|
|
1870
|
+
provider: PhoneTransportProvider;
|
|
1871
|
+
username: string;
|
|
1872
|
+
password: string;
|
|
1873
|
+
webhookBaseUrl: string;
|
|
1874
|
+
webhookSecret: string;
|
|
1875
|
+
apiUrl?: string;
|
|
1876
|
+
configuredAt: string;
|
|
1877
|
+
}
|
|
1878
|
+
interface PhoneMissionTranscriptEntry {
|
|
1879
|
+
at: string;
|
|
1880
|
+
source: 'system' | 'provider' | 'agent' | 'operator';
|
|
1881
|
+
text: string;
|
|
1882
|
+
metadata?: Record<string, unknown>;
|
|
1883
|
+
}
|
|
1884
|
+
interface PhoneCallMission {
|
|
1885
|
+
id: string;
|
|
1886
|
+
agentId: string;
|
|
1887
|
+
status: PhoneMissionState;
|
|
1888
|
+
from: string;
|
|
1889
|
+
to: string;
|
|
1890
|
+
task: string;
|
|
1891
|
+
policy: OpenClawPhoneMissionPolicy;
|
|
1892
|
+
transport: PhoneTransportProfile;
|
|
1893
|
+
provider: PhoneTransportProvider;
|
|
1894
|
+
providerCallId?: string;
|
|
1895
|
+
transcript: PhoneMissionTranscriptEntry[];
|
|
1896
|
+
metadata: Record<string, unknown>;
|
|
1897
|
+
createdAt: string;
|
|
1898
|
+
updatedAt: string;
|
|
1899
|
+
}
|
|
1900
|
+
interface StartPhoneCallOptions {
|
|
1901
|
+
dryRun?: boolean;
|
|
1902
|
+
fetchFn?: typeof fetch;
|
|
1903
|
+
now?: Date;
|
|
1904
|
+
}
|
|
1905
|
+
interface StartPhoneCallResult {
|
|
1906
|
+
mission: PhoneCallMission;
|
|
1907
|
+
providerRequest?: {
|
|
1908
|
+
url: string;
|
|
1909
|
+
body: Record<string, string>;
|
|
1910
|
+
};
|
|
1911
|
+
providerResponse?: unknown;
|
|
1912
|
+
}
|
|
1913
|
+
interface PhoneWebhookResult {
|
|
1914
|
+
mission: PhoneCallMission;
|
|
1915
|
+
action: Record<string, unknown>;
|
|
1916
|
+
}
|
|
1917
|
+
declare function redactPhoneTransportConfig(config: PhoneTransportConfig): PhoneTransportConfig;
|
|
1918
|
+
declare class PhoneManager {
|
|
1919
|
+
private db;
|
|
1920
|
+
private encryptionKey?;
|
|
1921
|
+
private initialized;
|
|
1922
|
+
/** Per-agent outbound-call timestamps (ms) for the in-memory rate limiter. */
|
|
1923
|
+
private readonly callTimestamps;
|
|
1924
|
+
constructor(db: Database, encryptionKey?: string | undefined);
|
|
1925
|
+
/**
|
|
1926
|
+
* Abuse / cost gate for /calls/start (#43-H1). Each non-dry-run call is
|
|
1927
|
+
* a real billed outbound call, so before dialing we enforce:
|
|
1928
|
+
* - a hard cap on concurrently-active (non-terminal) missions, and
|
|
1929
|
+
* - a per-agent token-bucket rate limit (per-minute + per-hour).
|
|
1930
|
+
* Throws {@link PhoneRateLimitError} (-> HTTP 429) when a limit is hit.
|
|
1931
|
+
* Call only on the real path — dry runs place no call and are exempt.
|
|
1932
|
+
*/
|
|
1933
|
+
private enforceCallLimits;
|
|
1934
|
+
private encryptConfig;
|
|
1935
|
+
private decryptConfig;
|
|
1936
|
+
private ensureTables;
|
|
1937
|
+
getPhoneTransportConfig(agentId: string): PhoneTransportConfig | null;
|
|
1938
|
+
savePhoneTransportConfig(agentId: string, config: PhoneTransportConfig): PhoneTransportConfig;
|
|
1939
|
+
getMission(missionId: string, agentId?: string): PhoneCallMission | null;
|
|
1940
|
+
listMissions(agentId: string, opts?: {
|
|
1941
|
+
limit?: number;
|
|
1942
|
+
offset?: number;
|
|
1943
|
+
status?: PhoneMissionState;
|
|
1944
|
+
}): PhoneCallMission[];
|
|
1945
|
+
startMission(agentId: string, input: StartPhoneMissionInput, options?: StartPhoneCallOptions): Promise<StartPhoneCallResult>;
|
|
1946
|
+
/**
|
|
1947
|
+
* Verify a webhook request and return the mission, or throw a uniform
|
|
1948
|
+
* {@link PhoneWebhookAuthError} for ANY failure (unknown mission, no
|
|
1949
|
+
* token, wrong token). Uniform on purpose — no 404-vs-403 oracle.
|
|
1950
|
+
*/
|
|
1951
|
+
private authenticateWebhook;
|
|
1952
|
+
handleVoiceStartWebhook(missionId: string, providedToken: string, payload?: Record<string, unknown>): PhoneWebhookResult;
|
|
1953
|
+
handleHangupWebhook(missionId: string, providedToken: string, payload?: Record<string, unknown>): PhoneCallMission;
|
|
1954
|
+
/**
|
|
1955
|
+
* Read the call cost off a 46elks hangup payload, add it to the
|
|
1956
|
+
* mission's running total, and flag a policy-cap breach (#43-H2).
|
|
1957
|
+
* Cost is only knowable post-call from the provider — the preventive
|
|
1958
|
+
* cost controls are the duration ceiling, rate limit, and concurrency
|
|
1959
|
+
* cap; this is the after-the-fact accounting + alerting.
|
|
1960
|
+
*/
|
|
1961
|
+
private buildCostMetadataPatch;
|
|
1962
|
+
private buildVoiceStartAction;
|
|
1963
|
+
cancelMission(agentId: string, missionId: string): PhoneCallMission;
|
|
1964
|
+
private build46ElksCallRequest;
|
|
1965
|
+
private insertMission;
|
|
1966
|
+
private updateProviderCall;
|
|
1967
|
+
private updateMissionStatus;
|
|
1968
|
+
}
|
|
1969
|
+
declare function buildPhoneTransportConfig(input: {
|
|
1970
|
+
provider?: unknown;
|
|
1971
|
+
phoneNumber?: unknown;
|
|
1972
|
+
username?: unknown;
|
|
1973
|
+
password?: unknown;
|
|
1974
|
+
webhookBaseUrl?: unknown;
|
|
1975
|
+
webhookSecret?: unknown;
|
|
1976
|
+
apiUrl?: unknown;
|
|
1977
|
+
capabilities?: unknown;
|
|
1978
|
+
supportedRegions?: unknown;
|
|
1979
|
+
configuredAt?: string;
|
|
1980
|
+
}): PhoneTransportConfig;
|
|
1981
|
+
|
|
1679
1982
|
/**
|
|
1680
1983
|
* AgenticMail Anonymous Telemetry
|
|
1681
1984
|
*
|
|
@@ -2719,4 +3022,4 @@ declare class AgentMemoryStore {
|
|
|
2719
3022
|
renderForPrompt(memory: AgentMemoryRead | null): string;
|
|
2720
3023
|
}
|
|
2721
3024
|
|
|
2722
|
-
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, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, 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 HostSessionResumeMode, type InboundEmail, type InboundSmsEvent, 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 PlanBridgeWakeArgs, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SmsProvider, 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, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, classifyResumeError, closeDatabase, composeBridgeWakePrompt, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, getSmsProvider, hostSessionStoragePath, isInternalEmail, isSessionFresh, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseEmail, parseGoogleVoiceSms, planBridgeWake, recordToolCall, redactObject, redactSecret, redactSmsConfig, resolveConfig, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
|
|
3025
|
+
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, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, 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, ELKS_REALTIME_AUDIO_FORMATS, type ElksRealtimeAudioFormat, type ElksRealtimeAudioMessage, type ElksRealtimeByeMessage, type ElksRealtimeHelloMessage, type ElksRealtimeInboundMessage, type ElksRealtimeOutboundMessage, 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 HostSessionResumeMode, type InboundEmail, type InboundSmsEvent, 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 OpenClawPhoneMissionPolicy, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, PHONE_MAX_CONCURRENT_MISSIONS, PHONE_MIN_WEBHOOK_SECRET_LENGTH, PHONE_MISSION_STATES, PHONE_RATE_LIMIT_PER_HOUR, PHONE_RATE_LIMIT_PER_MINUTE, PHONE_REGION_SCOPES, PHONE_SERVER_MAX_ATTEMPTS, PHONE_SERVER_MAX_CALL_DURATION_SECONDS, PHONE_SERVER_MAX_COST_PER_MISSION, PHONE_TASK_MAX_LENGTH, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PhoneAlternativePolicy, type PhoneCallMission, type PhoneConfirmPolicy, PhoneManager, type PhoneMissionStartValidationResult, type PhoneMissionState, type PhoneMissionTranscriptEntry, type PhoneMissionValidationIssue, type PhoneMissionValidationResult, type PhoneNumberRisk, PhoneRateLimitError, type PhoneRegionScope, type PhoneTransportConfig, type PhoneTransportProfile, type PhoneTransportProvider, type PhoneTransportValidationResult, PhoneWebhookAuthError, type PhoneWebhookResult, type PlanBridgeWakeArgs, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SmsProvider, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, type StartPhoneCallOptions, type StartPhoneCallResult, type StartPhoneMissionInput, TELEPHONY_TRANSPORT_CAPABILITIES, type TelephonyTransportCapability, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, type ValidatedPhoneMissionStart, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildElksAudioMessage, buildElksByeMessage, buildElksHandshakeMessages, buildElksInterruptMessage, buildElksListeningMessage, buildElksSendingMessage, buildInboundSecurityAdvisory, buildPhoneTransportConfig, classifyEmailRoute, classifyPhoneNumberRisk, classifyResumeError, closeDatabase, composeBridgeWakePrompt, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, getSmsProvider, hostSessionStoragePath, inferPhoneRegion, isInternalEmail, isLoopbackMailHost, isPhoneRegionAllowed, isSessionFresh, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseElksRealtimeMessage, parseEmail, parseGoogleVoiceSms, planBridgeWake, recordToolCall, redactObject, redactPhoneTransportConfig, redactSecret, redactSmsConfig, resolveConfig, resolveTlsRejectUnauthorized, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, startRelayBridge, threadIdFor, tryJoin, validateApiUrl, validatePhoneMissionPolicy, validatePhoneMissionStart, validatePhoneTransportProfile };
|