@agenticmail/core 0.9.23 → 0.9.24

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
@@ -5290,4 +5290,284 @@ declare class MemorySearchIndex {
5290
5290
  has(id: string): boolean;
5291
5291
  }
5292
5292
 
5293
- export { AGENT_ROLES, ASK_OPERATOR_TOOL, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryEntry, type AgentMemoryFields, AgentMemoryManager, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, type AudioAction, type AudioEditOptions, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, type CachedMessage, CloudflareClient, type CreateAgentOptions, type CreateMemoryInput, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_REALTIME_AUDIO_FORMAT, DEFAULT_REALTIME_MODEL, DEFAULT_REALTIME_VOICE, DEFAULT_SESSION_MAX_AGE_MS, DEFAULT_WEB_SEARCH_ENDPOINT, 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, ELKS_REALTIME_WS_PATH, type ElksRealtimeAudioFormat, type ElksRealtimeAudioMessage, type ElksRealtimeByeMessage, type ElksRealtimeHelloMessage, type ElksRealtimeInboundMessage, type ElksRealtimeOutboundMessage, ElksRealtimeTransport, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, GET_DATETIME_TOOL, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type GetDatetimeOptions, type GetUpdatesOptions, type HostName, type HostSession, type HostSessionResumeMode, type ImageAction, type ImageEditOptions, type InboundEmail, type InboundSmsEvent, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MEMORY_CATEGORIES, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type MediaBinary, type MediaCapability, type MediaCapabilityReport, type MediaFileResult, type MediaInfoResult, MediaManager, type MediaManagerOptions, type MediaStreamInfo, type MemoryCategory, type MemoryImportance, type MemoryQueryOptions, type MemoryRecaller, MemorySearchIndex, type MemorySource, type MemoryStats, OPENAI_REALTIME_URL, OPERATOR_QUERY_POLL_INTERVAL_MS, OPERATOR_QUERY_SUBJECT_TAG, OPERATOR_QUERY_TIMEOUT_MS, OPERATOR_QUERY_TIMEOUT_SENTINEL, type OpenClawPhoneMissionPolicy, type OperatorQueryNotificationInput, type OperatorQueryPollOptions, type OperatorQueryUrgency, type OperatorReplyKind, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, PHONE_CALL_CONTROL_PROVIDERS, 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 ParsedOperatorReply, type ParsedSms, type ParsedTelegramMessage, PathTraversalError, type PhoneAlternativePolicy, type PhoneCallMission, type PhoneConfirmPolicy, PhoneManager, type PhoneMissionStartValidationResult, type PhoneMissionState, type PhoneMissionTranscriptEntry, type PhoneMissionValidationIssue, type PhoneMissionValidationResult, type PhoneNumberRisk, type PhoneOperatorQuery, PhoneRateLimitError, type PhoneRegionScope, type PhoneTransportConfig, type PhoneTransportProfile, type PhoneTransportProvider, type PhoneTransportValidationResult, PhoneWebhookAuthError, type PhoneWebhookResult, type PlanBridgeWakeArgs, type PurchasedDomain, REALTIME_AUDIO_SAMPLE_RATE, REALTIME_MAX_AUDIO_FRAME_BASE64, REALTIME_TOOL_CALL_TIMEOUT_MS, REALTIME_TOOL_DEFINITIONS, RECALL_MEMORY_TOOL, REDACTED, RELAY_PRESETS, type RealtimeBridgePort, type RealtimeBridgeTranscriptEntry, type RealtimeInboundEvent, type RealtimeInstructionOptions, type RealtimeSessionConfigOptions, type RealtimeToolCall, type RealtimeToolDefinition, type RealtimeToolHandler, type RealtimeToolResult, type RealtimeTransportAdapter, type RealtimeTransportProvider, RealtimeVoiceBridge, type RealtimeVoiceBridgeOptions, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SEARCH_EMAIL_TOOL, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, type SendTelegramMessageOptions, type SendTelegramMessageResult, ServiceManager, type ServiceStatus, type SetWebhookOptions, 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, TELEGRAM_API_BASE, TELEGRAM_CHUNK_SIZE, TELEGRAM_MESSAGE_LIMIT, TELEGRAM_MIN_WEBHOOK_SECRET_LENGTH, TELEGRAM_OPERATOR_QUERY_TAG, TELEGRAM_STOP_WORDS, TELEGRAM_WEBHOOK_SECRET_RE, TELEPHONY_TRANSPORT_CAPABILITIES, TWILIO_MEDIA_SAMPLE_RATE, TWILIO_REALTIME_WS_PATH, TelegramApiError, type TelegramApiOptions, type TelegramBotInfo, type TelegramChatType, type TelegramConfig, TelegramManager, type TelegramMessage, type TelegramMode, type TelephonyTransportCapability, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type ToolExecutor, type TtsGenerateOptions, type TunnelConfig, TunnelManager, type TwilioConnectedMessage, type TwilioMarkMessage, type TwilioMediaMessage, type TwilioRealtimeInboundMessage, type TwilioRealtimeOutboundMessage, TwilioRealtimeTransport, type TwilioStartMessage, type TwilioStopMessage, type TwilioStreamTwiMLOptions, UnsafeApiUrlError, type UpdateMemoryInput, type ValidatedPhoneMissionStart, type VideoAction, type VideoEditOptions, type VideoTimelineEntry, type VideoUnderstandOptions, type VideoUnderstandResult, type VoiceCloneOptions, WARNING_THRESHOLD, WEB_SEARCH_TOOL, WEB_SEARCH_UNTRUSTED_PREFIX, type WatcherOptions, type WebSearchOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildElksAudioMessage, buildElksByeMessage, buildElksHandshakeMessages, buildElksInterruptMessage, buildElksListeningMessage, buildElksSendingMessage, buildInboundSecurityAdvisory, buildOpenAIRealtimeUrl, buildPhoneTransportConfig, buildRealtimeInstructions, buildRealtimeSessionConfig, buildRealtimeToolGuidance, buildTwilioClearMessage, buildTwilioMarkMessage, buildTwilioMediaMessage, buildTwilioSayTwiML, buildTwilioSignature, buildTwilioStreamTwiML, callTelegramApi, classifyEmailRoute, classifyPhoneNumberRisk, classifyResumeError, clearMediaCapabilityCache, closeDatabase, composeBridgeWakePrompt, createRealtimeTransport, createTestDatabase, createToolExecutor, debug, debugWarn, deleteTelegramWebhook, detectBinary, ensureDataDir, escapeXml, extractEmailAddress, extractVerificationCode, flushTelemetry, forgetHostSession, formatOperatorQueryTelegramMessage, getDatabase, getDatetime, getMediaCapabilities, getOperatorEmail, getSmsProvider, getTelegramChat, getTelegramMe, getTelegramUpdates, getTelegramWebhookInfo, hostSessionStoragePath, inferPhoneRegion, isInternalEmail, isLoopbackMailHost, isOperatorReplySender, isPhoneRegionAllowed, isSessionFresh, isTelegramChatAllowed, isTelegramStopCommand, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, nextTelegramOffset, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, operatorQuerySubject, parseElksRealtimeMessage, parseEmail, parseGoogleVoiceSms, parseOperatorQueryReply, parseTelegramOperatorReply, parseTelegramUpdate, parseTwilioRealtimeMessage, planBridgeWake, pollForOperatorAnswer, recallMemory, recordToolCall, redactBotToken, redactObject, redactPhoneTransportConfig, redactSecret, redactSmsConfig, redactTelegramConfig, requireBinary, requireWhisperModel, resolveConfig, resolveTlsRejectUnauthorized, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, sendTelegramMessage, setOperatorEmail, setTelegramWebhook, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, splitTelegramMessage, startRelayBridge, stem, stripTelegramMarkdown, threadIdFor, tokenize, tryJoin, validateApiUrl, validatePhoneMissionPolicy, validatePhoneMissionStart, validatePhoneTransportProfile, validateTwilioSignature, webSearch };
5293
+ /**
5294
+ * AgenticMail skill library — types.
5295
+ *
5296
+ * A "skill" is a structured how-to-act-like-a-skilled-human bundle for
5297
+ * a single real-world task an agent might be asked to do: negotiate a
5298
+ * bill, book a reservation, handle a debt collector, escalate to a
5299
+ * supervisor. Each skill is a JSON document with a fixed schema (this
5300
+ * file) so agents can load them on demand AND so humans / other agents
5301
+ * can contribute new ones without writing TypeScript.
5302
+ *
5303
+ * The skill schema is deliberately verbose. A skill that an agent
5304
+ * loads mid-call into its system prompt needs to teach it everything
5305
+ * a human would intuitively know: what to open with, what objections
5306
+ * to expect, how to phrase a graceful concession, when to walk away.
5307
+ * Sparse skills ("just be assertive") do not actually transfer
5308
+ * competence to a language model that has never made the call before.
5309
+ *
5310
+ * Why JSON, not Markdown / Python / a DSL:
5311
+ * - Stable, language-agnostic — community contributions can come
5312
+ * from anyone with a text editor; the schema validates and rejects
5313
+ * malformed contributions on PR.
5314
+ * - Embeddable in a Realtime API session.update — the JSON shape can
5315
+ * be rendered into a single `instructions` block at load time.
5316
+ * - Diffable on GitHub — reviewers can see exactly what changed,
5317
+ * phrase-by-phrase, in a PR.
5318
+ * - Searchable — registry-level fuzzy match on name / description /
5319
+ * tags / phrase contents works without any extra index layer.
5320
+ *
5321
+ * The schema is intentionally open to extension: every object has an
5322
+ * optional `extra: Record<string, unknown>` escape hatch so a
5323
+ * contributor can attach domain-specific fields without waiting for a
5324
+ * core schema bump. The MCP `skill_load` tool returns the raw object,
5325
+ * so an agent that recognises the extension can use it directly.
5326
+ */
5327
+ /** Wire-format JSON skill — the on-disk file shape. */
5328
+ interface Skill {
5329
+ /**
5330
+ * Globally-unique slug. Lowercase, hyphenated, no spaces.
5331
+ * Convention: `<verb>-<noun>` (`negotiate-bill-reduction`,
5332
+ * `book-restaurant-reservation`). Used as the `skill_load` argument
5333
+ * and as the JSON filename (`<id>.json`).
5334
+ */
5335
+ id: string;
5336
+ /** Human-readable title, sentence case. */
5337
+ name: string;
5338
+ /**
5339
+ * Semver. Bumped when the skill changes materially (new tactic
5340
+ * added, deprecation, etc). Agents that loaded an older version
5341
+ * mid-call keep their copy — versioning is for the registry, not
5342
+ * the in-flight session.
5343
+ */
5344
+ version: string;
5345
+ /**
5346
+ * Coarse-grained category. Keep this list short and stable; tags
5347
+ * are where the long tail lives.
5348
+ */
5349
+ category: SkillCategory;
5350
+ /** Free-form lowercase tags for search. */
5351
+ tags: string[];
5352
+ /**
5353
+ * One-sentence summary used in search results + the `skill_list`
5354
+ * tool's response. The first 80 characters are what an agent sees
5355
+ * when deciding whether to load the full skill.
5356
+ */
5357
+ description: string;
5358
+ /**
5359
+ * REQUIRED legal / safety disclaimer the agent must recite to the
5360
+ * other party at the start of the call when this skill is loaded.
5361
+ * Set to `null` for skills that need no disclaimer; set to a
5362
+ * literal string for skills with legal / medical / financial
5363
+ * sensitivity (debt collection, court representation, medical
5364
+ * triage). The agent's system prompt is updated to make this
5365
+ * disclaimer mandatory before any substantive turn.
5366
+ */
5367
+ disclaimer: string | null;
5368
+ /** When + why to reach for this skill. */
5369
+ context: SkillContext;
5370
+ /**
5371
+ * Three to seven principles the agent should internalise. These
5372
+ * are the strategic frame — concrete phrasing lives in `phrases`
5373
+ * and `tactics`. Mirror the kind of advice a friend who's GOOD at
5374
+ * this thing would give you in a 30-second pep talk.
5375
+ */
5376
+ principles: string[];
5377
+ /**
5378
+ * Named scripted phrases. Keys are stable identifiers
5379
+ * (`opener`, `objection_no_discounts`, `stall_thinking`) so a
5380
+ * tactic can reference a phrase by key.
5381
+ */
5382
+ phrases: Record<string, string>;
5383
+ /**
5384
+ * Ordered list of specific moves to attempt, with their preconditions
5385
+ * and scripts. Agents should try tactics in order, falling back to
5386
+ * the next when the previous fails.
5387
+ */
5388
+ tactics: SkillTactic[];
5389
+ /**
5390
+ * Hard rules the agent must NOT cross. These are checked at every
5391
+ * turn — if the agent is about to violate one, it should pull
5392
+ * back, possibly via `ask_operator`. Examples: don't lie about
5393
+ * the user's situation, don't commit money on the user's behalf
5394
+ * without confirmation, don't be abusive.
5395
+ */
5396
+ boundaries: string[];
5397
+ /** Signs the call is going well — keep doing what's working. */
5398
+ success_signals: string[];
5399
+ /** Signs the call is going badly — escalate or exit. */
5400
+ failure_signals: string[];
5401
+ /** How to end the call. Almost always invoked; design carefully. */
5402
+ exit_strategy: SkillExitStrategy;
5403
+ /**
5404
+ * Information the agent needs from the operator (via task brief or
5405
+ * `ask_operator` mid-call) BEFORE it can use this skill effectively.
5406
+ * Used by the mission planner to flag missing context up front.
5407
+ */
5408
+ required_user_info: string[];
5409
+ /** Free-form attribution: name or handle of the contributor. */
5410
+ contributed_by: string;
5411
+ /** ISO 8601. Set by the registry on first load if absent. */
5412
+ created_at?: string;
5413
+ /** ISO 8601. Bumped on every JSON edit. */
5414
+ updated_at?: string;
5415
+ /**
5416
+ * Forward-compatible extension hatch. Domain-specific fields a
5417
+ * contributor wants to attach without a core schema bump live
5418
+ * here. Agents that recognise the extension key use it; others
5419
+ * ignore it. Example: `extra.compliance_jurisdiction: 'US'`.
5420
+ */
5421
+ extra?: Record<string, unknown>;
5422
+ }
5423
+ /** Coarse-grained taxonomy. Extend ONLY via PR + a reviewer's nod. */
5424
+ type SkillCategory = 'negotiation' | 'customer-service' | 'reservations' | 'medical-admin' | 'legal-admin' | 'finance-admin' | 'real-estate' | 'travel' | 'subscription' | 'home-services' | 'social' | 'civic' | 'employment' | 'debt-collection' | 'other';
5425
+ /** When-to-use + preconditions block. */
5426
+ interface SkillContext {
5427
+ /** Plain-language description of the situation this skill fits. */
5428
+ when_to_use: string;
5429
+ /** What must be true before the agent picks up the phone. */
5430
+ preconditions: string[];
5431
+ /**
5432
+ * Realistic typical duration. Used to set the mission's
5433
+ * `maxCallDurationSeconds` policy automatically if not overridden.
5434
+ */
5435
+ estimated_call_duration_minutes: number;
5436
+ }
5437
+ /** A single move the agent can try. */
5438
+ interface SkillTactic {
5439
+ name: string;
5440
+ /** When to deploy this tactic. */
5441
+ when: string;
5442
+ /**
5443
+ * Verbatim script. The agent paraphrases to match its voice but
5444
+ * keeps the structural moves (mirror, ask for retention, etc).
5445
+ */
5446
+ script: string;
5447
+ /**
5448
+ * Optional priority order (1 = try first). Defaults to array order.
5449
+ * Lower-priority tactics are fallbacks.
5450
+ */
5451
+ priority?: number;
5452
+ }
5453
+ /** How to wrap the call up. Different ending for success vs failure. */
5454
+ interface SkillExitStrategy {
5455
+ /** What to do / say when the call hit its goal. */
5456
+ on_success: string;
5457
+ /** What to do / say when the goal isn't reachable on this call. */
5458
+ on_failure: string;
5459
+ /**
5460
+ * Optional follow-ups for the operator after the call ends —
5461
+ * tasks like "email the rep's confirmation number" or "calendar a
5462
+ * 30-day check-back". The mission report includes these.
5463
+ */
5464
+ follow_ups?: string[];
5465
+ }
5466
+ /** Skill summary returned by `skill_list` / `skill_search` (no body). */
5467
+ interface SkillSummary {
5468
+ id: string;
5469
+ name: string;
5470
+ category: SkillCategory;
5471
+ tags: string[];
5472
+ description: string;
5473
+ version: string;
5474
+ disclaimer_required: boolean;
5475
+ estimated_call_duration_minutes: number;
5476
+ }
5477
+ /** Failed-validation result from the schema validator. */
5478
+ interface SkillValidationError {
5479
+ path: string;
5480
+ message: string;
5481
+ }
5482
+
5483
+ /**
5484
+ * Skill registry — load, search, validate, list.
5485
+ *
5486
+ * Skills live in two places:
5487
+ *
5488
+ * 1. **Built-in** — JSON files bundled with `@agenticmail/core` at
5489
+ * `packages/core/src/skills/built-in/*.json`. These ship with
5490
+ * every install and form the starter library. Editing one in
5491
+ * a fork is fine, but the canonical copy is the one in the
5492
+ * monorepo — PRs to add or refine built-in skills are the
5493
+ * community contribution path.
5494
+ *
5495
+ * 2. **User-contributed** — JSON files dropped into
5496
+ * `~/.agenticmail/skills/*.json` at runtime. The registry
5497
+ * scans this directory on every `list` / `search` / `load`
5498
+ * call (cached for a few seconds) so a user can add a skill
5499
+ * without restarting the server. User-contributed skills
5500
+ * override built-ins when their `id` collides.
5501
+ *
5502
+ * The registry is filesystem-only — no DB. A skill is a leaf JSON
5503
+ * file, easy to diff in git, easy to write by hand. Loading skills
5504
+ * directly from `~/.agenticmail/skills/` (no manifest, no
5505
+ * `enabled: true`) is deliberate: the simplest contribution path
5506
+ * is "drop the file in, that's it."
5507
+ */
5508
+
5509
+ /** Manual cache invalidation — useful for tests + after a write. */
5510
+ declare function invalidateSkillCache(): void;
5511
+ /**
5512
+ * Schema validator. Returns a list of (path, message) — empty list
5513
+ * means the skill is structurally valid. Catches the classes of
5514
+ * mistakes a contributor is most likely to make:
5515
+ *
5516
+ * - Missing top-level required fields.
5517
+ * - Wrong types (`tactics` as object instead of array).
5518
+ * - Empty arrays where a non-empty one is required.
5519
+ * - Invalid `category` value.
5520
+ * - Tactic with empty `script`.
5521
+ *
5522
+ * Intentionally NOT a full JSON-schema implementation — the cost of
5523
+ * a dependency on `ajv` or similar isn't justified for our shape.
5524
+ */
5525
+ declare function validateSkill(s: unknown): SkillValidationError[];
5526
+ /** List all skills (summaries), optionally filtered. */
5527
+ declare function listSkills(opts?: {
5528
+ category?: SkillCategory;
5529
+ tag?: string;
5530
+ }): SkillSummary[];
5531
+ /**
5532
+ * Fuzzy-search skills by `query` against name, description, tags, and
5533
+ * the contents of `phrases` / `tactics.script` / `principles`. Returns
5534
+ * results ranked by a simple score (matches in name > tags > body).
5535
+ *
5536
+ * Intentionally low-tech — substring match, lowercased, no stemming.
5537
+ * For a corpus of <1000 skills this is fast enough that BM25 / vector
5538
+ * search is overkill, and the user-facing matcher should be
5539
+ * predictable rather than clever.
5540
+ */
5541
+ declare function searchSkills(query: string, limit?: number): SkillSummary[];
5542
+ /** Load the FULL skill body (everything an agent needs to act on it). */
5543
+ declare function loadSkill(id: string): Skill | null;
5544
+ /**
5545
+ * Save a new or updated skill to `~/.agenticmail/skills/<id>.json`.
5546
+ * Validates first; throws on invalid input. Bumps `updated_at`.
5547
+ *
5548
+ * Used by `agenticmail skill add` and by the future "build farm"
5549
+ * agents that draft skills programmatically — the same path either
5550
+ * way.
5551
+ */
5552
+ declare function saveUserSkill(skill: Skill): {
5553
+ path: string;
5554
+ };
5555
+ /** Where the user library lives (for surfacing in error messages / help). */
5556
+ declare function userSkillsDir(): string;
5557
+
5558
+ /**
5559
+ * Render a loaded skill into a single block of text suitable for
5560
+ * injection into an OpenAI Realtime `session.update.instructions`
5561
+ * (or any other plain-text system-prompt slot). The rendering is
5562
+ * intentionally verbose — language models perform best when the
5563
+ * tactical knowledge is spelled out narrative-style, not as a
5564
+ * skeletal outline.
5565
+ *
5566
+ * Convention: every rendered skill starts with a marker so the
5567
+ * agent can recognise it's operating with a loaded skill, and
5568
+ * ends with a separator so additional skills (loaded later in the
5569
+ * call) can be concatenated without ambiguity.
5570
+ */
5571
+ declare function renderSkillAsPrompt(skill: Skill): string;
5572
+
5573
+ export { AGENT_ROLES, ASK_OPERATOR_TOOL, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryEntry, type AgentMemoryFields, AgentMemoryManager, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, type AudioAction, type AudioEditOptions, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, type CachedMessage, CloudflareClient, type CreateAgentOptions, type CreateMemoryInput, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_REALTIME_AUDIO_FORMAT, DEFAULT_REALTIME_MODEL, DEFAULT_REALTIME_VOICE, DEFAULT_SESSION_MAX_AGE_MS, DEFAULT_WEB_SEARCH_ENDPOINT, 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, ELKS_REALTIME_WS_PATH, type ElksRealtimeAudioFormat, type ElksRealtimeAudioMessage, type ElksRealtimeByeMessage, type ElksRealtimeHelloMessage, type ElksRealtimeInboundMessage, type ElksRealtimeOutboundMessage, ElksRealtimeTransport, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, GET_DATETIME_TOOL, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type GetDatetimeOptions, type GetUpdatesOptions, type HostName, type HostSession, type HostSessionResumeMode, type ImageAction, type ImageEditOptions, type InboundEmail, type InboundSmsEvent, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MEMORY_CATEGORIES, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type MediaBinary, type MediaCapability, type MediaCapabilityReport, type MediaFileResult, type MediaInfoResult, MediaManager, type MediaManagerOptions, type MediaStreamInfo, type MemoryCategory, type MemoryImportance, type MemoryQueryOptions, type MemoryRecaller, MemorySearchIndex, type MemorySource, type MemoryStats, OPENAI_REALTIME_URL, OPERATOR_QUERY_POLL_INTERVAL_MS, OPERATOR_QUERY_SUBJECT_TAG, OPERATOR_QUERY_TIMEOUT_MS, OPERATOR_QUERY_TIMEOUT_SENTINEL, type OpenClawPhoneMissionPolicy, type OperatorQueryNotificationInput, type OperatorQueryPollOptions, type OperatorQueryUrgency, type OperatorReplyKind, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, PHONE_CALL_CONTROL_PROVIDERS, 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 ParsedOperatorReply, type ParsedSms, type ParsedTelegramMessage, PathTraversalError, type PhoneAlternativePolicy, type PhoneCallMission, type PhoneConfirmPolicy, PhoneManager, type PhoneMissionStartValidationResult, type PhoneMissionState, type PhoneMissionTranscriptEntry, type PhoneMissionValidationIssue, type PhoneMissionValidationResult, type PhoneNumberRisk, type PhoneOperatorQuery, PhoneRateLimitError, type PhoneRegionScope, type PhoneTransportConfig, type PhoneTransportProfile, type PhoneTransportProvider, type PhoneTransportValidationResult, PhoneWebhookAuthError, type PhoneWebhookResult, type PlanBridgeWakeArgs, type PurchasedDomain, REALTIME_AUDIO_SAMPLE_RATE, REALTIME_MAX_AUDIO_FRAME_BASE64, REALTIME_TOOL_CALL_TIMEOUT_MS, REALTIME_TOOL_DEFINITIONS, RECALL_MEMORY_TOOL, REDACTED, RELAY_PRESETS, type RealtimeBridgePort, type RealtimeBridgeTranscriptEntry, type RealtimeInboundEvent, type RealtimeInstructionOptions, type RealtimeSessionConfigOptions, type RealtimeToolCall, type RealtimeToolDefinition, type RealtimeToolHandler, type RealtimeToolResult, type RealtimeTransportAdapter, type RealtimeTransportProvider, RealtimeVoiceBridge, type RealtimeVoiceBridgeOptions, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SEARCH_EMAIL_TOOL, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, type SendTelegramMessageOptions, type SendTelegramMessageResult, ServiceManager, type ServiceStatus, type SetWebhookOptions, type SetupConfig, SetupManager, type SetupResult, type Severity, type Skill, type SkillCategory, type SkillContext, type SkillExitStrategy, type SkillSummary, type SkillTactic, type SkillValidationError, 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, TELEGRAM_API_BASE, TELEGRAM_CHUNK_SIZE, TELEGRAM_MESSAGE_LIMIT, TELEGRAM_MIN_WEBHOOK_SECRET_LENGTH, TELEGRAM_OPERATOR_QUERY_TAG, TELEGRAM_STOP_WORDS, TELEGRAM_WEBHOOK_SECRET_RE, TELEPHONY_TRANSPORT_CAPABILITIES, TWILIO_MEDIA_SAMPLE_RATE, TWILIO_REALTIME_WS_PATH, TelegramApiError, type TelegramApiOptions, type TelegramBotInfo, type TelegramChatType, type TelegramConfig, TelegramManager, type TelegramMessage, type TelegramMode, type TelephonyTransportCapability, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type ToolExecutor, type TtsGenerateOptions, type TunnelConfig, TunnelManager, type TwilioConnectedMessage, type TwilioMarkMessage, type TwilioMediaMessage, type TwilioRealtimeInboundMessage, type TwilioRealtimeOutboundMessage, TwilioRealtimeTransport, type TwilioStartMessage, type TwilioStopMessage, type TwilioStreamTwiMLOptions, UnsafeApiUrlError, type UpdateMemoryInput, type ValidatedPhoneMissionStart, type VideoAction, type VideoEditOptions, type VideoTimelineEntry, type VideoUnderstandOptions, type VideoUnderstandResult, type VoiceCloneOptions, WARNING_THRESHOLD, WEB_SEARCH_TOOL, WEB_SEARCH_UNTRUSTED_PREFIX, type WatcherOptions, type WebSearchOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildElksAudioMessage, buildElksByeMessage, buildElksHandshakeMessages, buildElksInterruptMessage, buildElksListeningMessage, buildElksSendingMessage, buildInboundSecurityAdvisory, buildOpenAIRealtimeUrl, buildPhoneTransportConfig, buildRealtimeInstructions, buildRealtimeSessionConfig, buildRealtimeToolGuidance, buildTwilioClearMessage, buildTwilioMarkMessage, buildTwilioMediaMessage, buildTwilioSayTwiML, buildTwilioSignature, buildTwilioStreamTwiML, callTelegramApi, classifyEmailRoute, classifyPhoneNumberRisk, classifyResumeError, clearMediaCapabilityCache, closeDatabase, composeBridgeWakePrompt, createRealtimeTransport, createTestDatabase, createToolExecutor, debug, debugWarn, deleteTelegramWebhook, detectBinary, ensureDataDir, escapeXml, extractEmailAddress, extractVerificationCode, flushTelemetry, forgetHostSession, formatOperatorQueryTelegramMessage, getDatabase, getDatetime, getMediaCapabilities, getOperatorEmail, getSmsProvider, getTelegramChat, getTelegramMe, getTelegramUpdates, getTelegramWebhookInfo, hostSessionStoragePath, inferPhoneRegion, invalidateSkillCache, isInternalEmail, isLoopbackMailHost, isOperatorReplySender, isPhoneRegionAllowed, isSessionFresh, isTelegramChatAllowed, isTelegramStopCommand, isValidPhoneNumber, listSkills, loadHostSession, loadSkill, mapProviderSmsStatus, nextTelegramOffset, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, operatorQuerySubject, parseElksRealtimeMessage, parseEmail, parseGoogleVoiceSms, parseOperatorQueryReply, parseTelegramOperatorReply, parseTelegramUpdate, parseTwilioRealtimeMessage, planBridgeWake, pollForOperatorAnswer, recallMemory, recordToolCall, redactBotToken, redactObject, redactPhoneTransportConfig, redactSecret, redactSmsConfig, redactTelegramConfig, renderSkillAsPrompt, requireBinary, requireWhisperModel, resolveConfig, resolveTlsRejectUnauthorized, safeJoin, sanitizeEmail, saveConfig, saveHostSession, saveUserSkill, scanOutboundEmail, scoreEmail, searchSkills, sendTelegramMessage, setOperatorEmail, setTelegramWebhook, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, splitTelegramMessage, startRelayBridge, stem, stripTelegramMarkdown, threadIdFor, tokenize, tryJoin, userSkillsDir, validateApiUrl, validatePhoneMissionPolicy, validatePhoneMissionStart, validatePhoneTransportProfile, validateSkill, validateTwilioSignature, webSearch };
package/dist/index.d.ts CHANGED
@@ -5290,4 +5290,284 @@ declare class MemorySearchIndex {
5290
5290
  has(id: string): boolean;
5291
5291
  }
5292
5292
 
5293
- export { AGENT_ROLES, ASK_OPERATOR_TOOL, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryEntry, type AgentMemoryFields, AgentMemoryManager, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, type AudioAction, type AudioEditOptions, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, type CachedMessage, CloudflareClient, type CreateAgentOptions, type CreateMemoryInput, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_REALTIME_AUDIO_FORMAT, DEFAULT_REALTIME_MODEL, DEFAULT_REALTIME_VOICE, DEFAULT_SESSION_MAX_AGE_MS, DEFAULT_WEB_SEARCH_ENDPOINT, 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, ELKS_REALTIME_WS_PATH, type ElksRealtimeAudioFormat, type ElksRealtimeAudioMessage, type ElksRealtimeByeMessage, type ElksRealtimeHelloMessage, type ElksRealtimeInboundMessage, type ElksRealtimeOutboundMessage, ElksRealtimeTransport, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, GET_DATETIME_TOOL, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type GetDatetimeOptions, type GetUpdatesOptions, type HostName, type HostSession, type HostSessionResumeMode, type ImageAction, type ImageEditOptions, type InboundEmail, type InboundSmsEvent, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MEMORY_CATEGORIES, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type MediaBinary, type MediaCapability, type MediaCapabilityReport, type MediaFileResult, type MediaInfoResult, MediaManager, type MediaManagerOptions, type MediaStreamInfo, type MemoryCategory, type MemoryImportance, type MemoryQueryOptions, type MemoryRecaller, MemorySearchIndex, type MemorySource, type MemoryStats, OPENAI_REALTIME_URL, OPERATOR_QUERY_POLL_INTERVAL_MS, OPERATOR_QUERY_SUBJECT_TAG, OPERATOR_QUERY_TIMEOUT_MS, OPERATOR_QUERY_TIMEOUT_SENTINEL, type OpenClawPhoneMissionPolicy, type OperatorQueryNotificationInput, type OperatorQueryPollOptions, type OperatorQueryUrgency, type OperatorReplyKind, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, PHONE_CALL_CONTROL_PROVIDERS, 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 ParsedOperatorReply, type ParsedSms, type ParsedTelegramMessage, PathTraversalError, type PhoneAlternativePolicy, type PhoneCallMission, type PhoneConfirmPolicy, PhoneManager, type PhoneMissionStartValidationResult, type PhoneMissionState, type PhoneMissionTranscriptEntry, type PhoneMissionValidationIssue, type PhoneMissionValidationResult, type PhoneNumberRisk, type PhoneOperatorQuery, PhoneRateLimitError, type PhoneRegionScope, type PhoneTransportConfig, type PhoneTransportProfile, type PhoneTransportProvider, type PhoneTransportValidationResult, PhoneWebhookAuthError, type PhoneWebhookResult, type PlanBridgeWakeArgs, type PurchasedDomain, REALTIME_AUDIO_SAMPLE_RATE, REALTIME_MAX_AUDIO_FRAME_BASE64, REALTIME_TOOL_CALL_TIMEOUT_MS, REALTIME_TOOL_DEFINITIONS, RECALL_MEMORY_TOOL, REDACTED, RELAY_PRESETS, type RealtimeBridgePort, type RealtimeBridgeTranscriptEntry, type RealtimeInboundEvent, type RealtimeInstructionOptions, type RealtimeSessionConfigOptions, type RealtimeToolCall, type RealtimeToolDefinition, type RealtimeToolHandler, type RealtimeToolResult, type RealtimeTransportAdapter, type RealtimeTransportProvider, RealtimeVoiceBridge, type RealtimeVoiceBridgeOptions, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SEARCH_EMAIL_TOOL, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, type SendTelegramMessageOptions, type SendTelegramMessageResult, ServiceManager, type ServiceStatus, type SetWebhookOptions, 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, TELEGRAM_API_BASE, TELEGRAM_CHUNK_SIZE, TELEGRAM_MESSAGE_LIMIT, TELEGRAM_MIN_WEBHOOK_SECRET_LENGTH, TELEGRAM_OPERATOR_QUERY_TAG, TELEGRAM_STOP_WORDS, TELEGRAM_WEBHOOK_SECRET_RE, TELEPHONY_TRANSPORT_CAPABILITIES, TWILIO_MEDIA_SAMPLE_RATE, TWILIO_REALTIME_WS_PATH, TelegramApiError, type TelegramApiOptions, type TelegramBotInfo, type TelegramChatType, type TelegramConfig, TelegramManager, type TelegramMessage, type TelegramMode, type TelephonyTransportCapability, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type ToolExecutor, type TtsGenerateOptions, type TunnelConfig, TunnelManager, type TwilioConnectedMessage, type TwilioMarkMessage, type TwilioMediaMessage, type TwilioRealtimeInboundMessage, type TwilioRealtimeOutboundMessage, TwilioRealtimeTransport, type TwilioStartMessage, type TwilioStopMessage, type TwilioStreamTwiMLOptions, UnsafeApiUrlError, type UpdateMemoryInput, type ValidatedPhoneMissionStart, type VideoAction, type VideoEditOptions, type VideoTimelineEntry, type VideoUnderstandOptions, type VideoUnderstandResult, type VoiceCloneOptions, WARNING_THRESHOLD, WEB_SEARCH_TOOL, WEB_SEARCH_UNTRUSTED_PREFIX, type WatcherOptions, type WebSearchOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildElksAudioMessage, buildElksByeMessage, buildElksHandshakeMessages, buildElksInterruptMessage, buildElksListeningMessage, buildElksSendingMessage, buildInboundSecurityAdvisory, buildOpenAIRealtimeUrl, buildPhoneTransportConfig, buildRealtimeInstructions, buildRealtimeSessionConfig, buildRealtimeToolGuidance, buildTwilioClearMessage, buildTwilioMarkMessage, buildTwilioMediaMessage, buildTwilioSayTwiML, buildTwilioSignature, buildTwilioStreamTwiML, callTelegramApi, classifyEmailRoute, classifyPhoneNumberRisk, classifyResumeError, clearMediaCapabilityCache, closeDatabase, composeBridgeWakePrompt, createRealtimeTransport, createTestDatabase, createToolExecutor, debug, debugWarn, deleteTelegramWebhook, detectBinary, ensureDataDir, escapeXml, extractEmailAddress, extractVerificationCode, flushTelemetry, forgetHostSession, formatOperatorQueryTelegramMessage, getDatabase, getDatetime, getMediaCapabilities, getOperatorEmail, getSmsProvider, getTelegramChat, getTelegramMe, getTelegramUpdates, getTelegramWebhookInfo, hostSessionStoragePath, inferPhoneRegion, isInternalEmail, isLoopbackMailHost, isOperatorReplySender, isPhoneRegionAllowed, isSessionFresh, isTelegramChatAllowed, isTelegramStopCommand, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, nextTelegramOffset, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, operatorQuerySubject, parseElksRealtimeMessage, parseEmail, parseGoogleVoiceSms, parseOperatorQueryReply, parseTelegramOperatorReply, parseTelegramUpdate, parseTwilioRealtimeMessage, planBridgeWake, pollForOperatorAnswer, recallMemory, recordToolCall, redactBotToken, redactObject, redactPhoneTransportConfig, redactSecret, redactSmsConfig, redactTelegramConfig, requireBinary, requireWhisperModel, resolveConfig, resolveTlsRejectUnauthorized, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, sendTelegramMessage, setOperatorEmail, setTelegramWebhook, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, splitTelegramMessage, startRelayBridge, stem, stripTelegramMarkdown, threadIdFor, tokenize, tryJoin, validateApiUrl, validatePhoneMissionPolicy, validatePhoneMissionStart, validatePhoneTransportProfile, validateTwilioSignature, webSearch };
5293
+ /**
5294
+ * AgenticMail skill library — types.
5295
+ *
5296
+ * A "skill" is a structured how-to-act-like-a-skilled-human bundle for
5297
+ * a single real-world task an agent might be asked to do: negotiate a
5298
+ * bill, book a reservation, handle a debt collector, escalate to a
5299
+ * supervisor. Each skill is a JSON document with a fixed schema (this
5300
+ * file) so agents can load them on demand AND so humans / other agents
5301
+ * can contribute new ones without writing TypeScript.
5302
+ *
5303
+ * The skill schema is deliberately verbose. A skill that an agent
5304
+ * loads mid-call into its system prompt needs to teach it everything
5305
+ * a human would intuitively know: what to open with, what objections
5306
+ * to expect, how to phrase a graceful concession, when to walk away.
5307
+ * Sparse skills ("just be assertive") do not actually transfer
5308
+ * competence to a language model that has never made the call before.
5309
+ *
5310
+ * Why JSON, not Markdown / Python / a DSL:
5311
+ * - Stable, language-agnostic — community contributions can come
5312
+ * from anyone with a text editor; the schema validates and rejects
5313
+ * malformed contributions on PR.
5314
+ * - Embeddable in a Realtime API session.update — the JSON shape can
5315
+ * be rendered into a single `instructions` block at load time.
5316
+ * - Diffable on GitHub — reviewers can see exactly what changed,
5317
+ * phrase-by-phrase, in a PR.
5318
+ * - Searchable — registry-level fuzzy match on name / description /
5319
+ * tags / phrase contents works without any extra index layer.
5320
+ *
5321
+ * The schema is intentionally open to extension: every object has an
5322
+ * optional `extra: Record<string, unknown>` escape hatch so a
5323
+ * contributor can attach domain-specific fields without waiting for a
5324
+ * core schema bump. The MCP `skill_load` tool returns the raw object,
5325
+ * so an agent that recognises the extension can use it directly.
5326
+ */
5327
+ /** Wire-format JSON skill — the on-disk file shape. */
5328
+ interface Skill {
5329
+ /**
5330
+ * Globally-unique slug. Lowercase, hyphenated, no spaces.
5331
+ * Convention: `<verb>-<noun>` (`negotiate-bill-reduction`,
5332
+ * `book-restaurant-reservation`). Used as the `skill_load` argument
5333
+ * and as the JSON filename (`<id>.json`).
5334
+ */
5335
+ id: string;
5336
+ /** Human-readable title, sentence case. */
5337
+ name: string;
5338
+ /**
5339
+ * Semver. Bumped when the skill changes materially (new tactic
5340
+ * added, deprecation, etc). Agents that loaded an older version
5341
+ * mid-call keep their copy — versioning is for the registry, not
5342
+ * the in-flight session.
5343
+ */
5344
+ version: string;
5345
+ /**
5346
+ * Coarse-grained category. Keep this list short and stable; tags
5347
+ * are where the long tail lives.
5348
+ */
5349
+ category: SkillCategory;
5350
+ /** Free-form lowercase tags for search. */
5351
+ tags: string[];
5352
+ /**
5353
+ * One-sentence summary used in search results + the `skill_list`
5354
+ * tool's response. The first 80 characters are what an agent sees
5355
+ * when deciding whether to load the full skill.
5356
+ */
5357
+ description: string;
5358
+ /**
5359
+ * REQUIRED legal / safety disclaimer the agent must recite to the
5360
+ * other party at the start of the call when this skill is loaded.
5361
+ * Set to `null` for skills that need no disclaimer; set to a
5362
+ * literal string for skills with legal / medical / financial
5363
+ * sensitivity (debt collection, court representation, medical
5364
+ * triage). The agent's system prompt is updated to make this
5365
+ * disclaimer mandatory before any substantive turn.
5366
+ */
5367
+ disclaimer: string | null;
5368
+ /** When + why to reach for this skill. */
5369
+ context: SkillContext;
5370
+ /**
5371
+ * Three to seven principles the agent should internalise. These
5372
+ * are the strategic frame — concrete phrasing lives in `phrases`
5373
+ * and `tactics`. Mirror the kind of advice a friend who's GOOD at
5374
+ * this thing would give you in a 30-second pep talk.
5375
+ */
5376
+ principles: string[];
5377
+ /**
5378
+ * Named scripted phrases. Keys are stable identifiers
5379
+ * (`opener`, `objection_no_discounts`, `stall_thinking`) so a
5380
+ * tactic can reference a phrase by key.
5381
+ */
5382
+ phrases: Record<string, string>;
5383
+ /**
5384
+ * Ordered list of specific moves to attempt, with their preconditions
5385
+ * and scripts. Agents should try tactics in order, falling back to
5386
+ * the next when the previous fails.
5387
+ */
5388
+ tactics: SkillTactic[];
5389
+ /**
5390
+ * Hard rules the agent must NOT cross. These are checked at every
5391
+ * turn — if the agent is about to violate one, it should pull
5392
+ * back, possibly via `ask_operator`. Examples: don't lie about
5393
+ * the user's situation, don't commit money on the user's behalf
5394
+ * without confirmation, don't be abusive.
5395
+ */
5396
+ boundaries: string[];
5397
+ /** Signs the call is going well — keep doing what's working. */
5398
+ success_signals: string[];
5399
+ /** Signs the call is going badly — escalate or exit. */
5400
+ failure_signals: string[];
5401
+ /** How to end the call. Almost always invoked; design carefully. */
5402
+ exit_strategy: SkillExitStrategy;
5403
+ /**
5404
+ * Information the agent needs from the operator (via task brief or
5405
+ * `ask_operator` mid-call) BEFORE it can use this skill effectively.
5406
+ * Used by the mission planner to flag missing context up front.
5407
+ */
5408
+ required_user_info: string[];
5409
+ /** Free-form attribution: name or handle of the contributor. */
5410
+ contributed_by: string;
5411
+ /** ISO 8601. Set by the registry on first load if absent. */
5412
+ created_at?: string;
5413
+ /** ISO 8601. Bumped on every JSON edit. */
5414
+ updated_at?: string;
5415
+ /**
5416
+ * Forward-compatible extension hatch. Domain-specific fields a
5417
+ * contributor wants to attach without a core schema bump live
5418
+ * here. Agents that recognise the extension key use it; others
5419
+ * ignore it. Example: `extra.compliance_jurisdiction: 'US'`.
5420
+ */
5421
+ extra?: Record<string, unknown>;
5422
+ }
5423
+ /** Coarse-grained taxonomy. Extend ONLY via PR + a reviewer's nod. */
5424
+ type SkillCategory = 'negotiation' | 'customer-service' | 'reservations' | 'medical-admin' | 'legal-admin' | 'finance-admin' | 'real-estate' | 'travel' | 'subscription' | 'home-services' | 'social' | 'civic' | 'employment' | 'debt-collection' | 'other';
5425
+ /** When-to-use + preconditions block. */
5426
+ interface SkillContext {
5427
+ /** Plain-language description of the situation this skill fits. */
5428
+ when_to_use: string;
5429
+ /** What must be true before the agent picks up the phone. */
5430
+ preconditions: string[];
5431
+ /**
5432
+ * Realistic typical duration. Used to set the mission's
5433
+ * `maxCallDurationSeconds` policy automatically if not overridden.
5434
+ */
5435
+ estimated_call_duration_minutes: number;
5436
+ }
5437
+ /** A single move the agent can try. */
5438
+ interface SkillTactic {
5439
+ name: string;
5440
+ /** When to deploy this tactic. */
5441
+ when: string;
5442
+ /**
5443
+ * Verbatim script. The agent paraphrases to match its voice but
5444
+ * keeps the structural moves (mirror, ask for retention, etc).
5445
+ */
5446
+ script: string;
5447
+ /**
5448
+ * Optional priority order (1 = try first). Defaults to array order.
5449
+ * Lower-priority tactics are fallbacks.
5450
+ */
5451
+ priority?: number;
5452
+ }
5453
+ /** How to wrap the call up. Different ending for success vs failure. */
5454
+ interface SkillExitStrategy {
5455
+ /** What to do / say when the call hit its goal. */
5456
+ on_success: string;
5457
+ /** What to do / say when the goal isn't reachable on this call. */
5458
+ on_failure: string;
5459
+ /**
5460
+ * Optional follow-ups for the operator after the call ends —
5461
+ * tasks like "email the rep's confirmation number" or "calendar a
5462
+ * 30-day check-back". The mission report includes these.
5463
+ */
5464
+ follow_ups?: string[];
5465
+ }
5466
+ /** Skill summary returned by `skill_list` / `skill_search` (no body). */
5467
+ interface SkillSummary {
5468
+ id: string;
5469
+ name: string;
5470
+ category: SkillCategory;
5471
+ tags: string[];
5472
+ description: string;
5473
+ version: string;
5474
+ disclaimer_required: boolean;
5475
+ estimated_call_duration_minutes: number;
5476
+ }
5477
+ /** Failed-validation result from the schema validator. */
5478
+ interface SkillValidationError {
5479
+ path: string;
5480
+ message: string;
5481
+ }
5482
+
5483
+ /**
5484
+ * Skill registry — load, search, validate, list.
5485
+ *
5486
+ * Skills live in two places:
5487
+ *
5488
+ * 1. **Built-in** — JSON files bundled with `@agenticmail/core` at
5489
+ * `packages/core/src/skills/built-in/*.json`. These ship with
5490
+ * every install and form the starter library. Editing one in
5491
+ * a fork is fine, but the canonical copy is the one in the
5492
+ * monorepo — PRs to add or refine built-in skills are the
5493
+ * community contribution path.
5494
+ *
5495
+ * 2. **User-contributed** — JSON files dropped into
5496
+ * `~/.agenticmail/skills/*.json` at runtime. The registry
5497
+ * scans this directory on every `list` / `search` / `load`
5498
+ * call (cached for a few seconds) so a user can add a skill
5499
+ * without restarting the server. User-contributed skills
5500
+ * override built-ins when their `id` collides.
5501
+ *
5502
+ * The registry is filesystem-only — no DB. A skill is a leaf JSON
5503
+ * file, easy to diff in git, easy to write by hand. Loading skills
5504
+ * directly from `~/.agenticmail/skills/` (no manifest, no
5505
+ * `enabled: true`) is deliberate: the simplest contribution path
5506
+ * is "drop the file in, that's it."
5507
+ */
5508
+
5509
+ /** Manual cache invalidation — useful for tests + after a write. */
5510
+ declare function invalidateSkillCache(): void;
5511
+ /**
5512
+ * Schema validator. Returns a list of (path, message) — empty list
5513
+ * means the skill is structurally valid. Catches the classes of
5514
+ * mistakes a contributor is most likely to make:
5515
+ *
5516
+ * - Missing top-level required fields.
5517
+ * - Wrong types (`tactics` as object instead of array).
5518
+ * - Empty arrays where a non-empty one is required.
5519
+ * - Invalid `category` value.
5520
+ * - Tactic with empty `script`.
5521
+ *
5522
+ * Intentionally NOT a full JSON-schema implementation — the cost of
5523
+ * a dependency on `ajv` or similar isn't justified for our shape.
5524
+ */
5525
+ declare function validateSkill(s: unknown): SkillValidationError[];
5526
+ /** List all skills (summaries), optionally filtered. */
5527
+ declare function listSkills(opts?: {
5528
+ category?: SkillCategory;
5529
+ tag?: string;
5530
+ }): SkillSummary[];
5531
+ /**
5532
+ * Fuzzy-search skills by `query` against name, description, tags, and
5533
+ * the contents of `phrases` / `tactics.script` / `principles`. Returns
5534
+ * results ranked by a simple score (matches in name > tags > body).
5535
+ *
5536
+ * Intentionally low-tech — substring match, lowercased, no stemming.
5537
+ * For a corpus of <1000 skills this is fast enough that BM25 / vector
5538
+ * search is overkill, and the user-facing matcher should be
5539
+ * predictable rather than clever.
5540
+ */
5541
+ declare function searchSkills(query: string, limit?: number): SkillSummary[];
5542
+ /** Load the FULL skill body (everything an agent needs to act on it). */
5543
+ declare function loadSkill(id: string): Skill | null;
5544
+ /**
5545
+ * Save a new or updated skill to `~/.agenticmail/skills/<id>.json`.
5546
+ * Validates first; throws on invalid input. Bumps `updated_at`.
5547
+ *
5548
+ * Used by `agenticmail skill add` and by the future "build farm"
5549
+ * agents that draft skills programmatically — the same path either
5550
+ * way.
5551
+ */
5552
+ declare function saveUserSkill(skill: Skill): {
5553
+ path: string;
5554
+ };
5555
+ /** Where the user library lives (for surfacing in error messages / help). */
5556
+ declare function userSkillsDir(): string;
5557
+
5558
+ /**
5559
+ * Render a loaded skill into a single block of text suitable for
5560
+ * injection into an OpenAI Realtime `session.update.instructions`
5561
+ * (or any other plain-text system-prompt slot). The rendering is
5562
+ * intentionally verbose — language models perform best when the
5563
+ * tactical knowledge is spelled out narrative-style, not as a
5564
+ * skeletal outline.
5565
+ *
5566
+ * Convention: every rendered skill starts with a marker so the
5567
+ * agent can recognise it's operating with a loaded skill, and
5568
+ * ends with a separator so additional skills (loaded later in the
5569
+ * call) can be concatenated without ambiguity.
5570
+ */
5571
+ declare function renderSkillAsPrompt(skill: Skill): string;
5572
+
5573
+ export { AGENT_ROLES, ASK_OPERATOR_TOOL, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryEntry, type AgentMemoryFields, AgentMemoryManager, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, type AudioAction, type AudioEditOptions, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, type CachedMessage, CloudflareClient, type CreateAgentOptions, type CreateMemoryInput, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_REALTIME_AUDIO_FORMAT, DEFAULT_REALTIME_MODEL, DEFAULT_REALTIME_VOICE, DEFAULT_SESSION_MAX_AGE_MS, DEFAULT_WEB_SEARCH_ENDPOINT, 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, ELKS_REALTIME_WS_PATH, type ElksRealtimeAudioFormat, type ElksRealtimeAudioMessage, type ElksRealtimeByeMessage, type ElksRealtimeHelloMessage, type ElksRealtimeInboundMessage, type ElksRealtimeOutboundMessage, ElksRealtimeTransport, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, GET_DATETIME_TOOL, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type GetDatetimeOptions, type GetUpdatesOptions, type HostName, type HostSession, type HostSessionResumeMode, type ImageAction, type ImageEditOptions, type InboundEmail, type InboundSmsEvent, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MEMORY_CATEGORIES, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type MediaBinary, type MediaCapability, type MediaCapabilityReport, type MediaFileResult, type MediaInfoResult, MediaManager, type MediaManagerOptions, type MediaStreamInfo, type MemoryCategory, type MemoryImportance, type MemoryQueryOptions, type MemoryRecaller, MemorySearchIndex, type MemorySource, type MemoryStats, OPENAI_REALTIME_URL, OPERATOR_QUERY_POLL_INTERVAL_MS, OPERATOR_QUERY_SUBJECT_TAG, OPERATOR_QUERY_TIMEOUT_MS, OPERATOR_QUERY_TIMEOUT_SENTINEL, type OpenClawPhoneMissionPolicy, type OperatorQueryNotificationInput, type OperatorQueryPollOptions, type OperatorQueryUrgency, type OperatorReplyKind, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, PHONE_CALL_CONTROL_PROVIDERS, 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 ParsedOperatorReply, type ParsedSms, type ParsedTelegramMessage, PathTraversalError, type PhoneAlternativePolicy, type PhoneCallMission, type PhoneConfirmPolicy, PhoneManager, type PhoneMissionStartValidationResult, type PhoneMissionState, type PhoneMissionTranscriptEntry, type PhoneMissionValidationIssue, type PhoneMissionValidationResult, type PhoneNumberRisk, type PhoneOperatorQuery, PhoneRateLimitError, type PhoneRegionScope, type PhoneTransportConfig, type PhoneTransportProfile, type PhoneTransportProvider, type PhoneTransportValidationResult, PhoneWebhookAuthError, type PhoneWebhookResult, type PlanBridgeWakeArgs, type PurchasedDomain, REALTIME_AUDIO_SAMPLE_RATE, REALTIME_MAX_AUDIO_FRAME_BASE64, REALTIME_TOOL_CALL_TIMEOUT_MS, REALTIME_TOOL_DEFINITIONS, RECALL_MEMORY_TOOL, REDACTED, RELAY_PRESETS, type RealtimeBridgePort, type RealtimeBridgeTranscriptEntry, type RealtimeInboundEvent, type RealtimeInstructionOptions, type RealtimeSessionConfigOptions, type RealtimeToolCall, type RealtimeToolDefinition, type RealtimeToolHandler, type RealtimeToolResult, type RealtimeTransportAdapter, type RealtimeTransportProvider, RealtimeVoiceBridge, type RealtimeVoiceBridgeOptions, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SEARCH_EMAIL_TOOL, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, type SendTelegramMessageOptions, type SendTelegramMessageResult, ServiceManager, type ServiceStatus, type SetWebhookOptions, type SetupConfig, SetupManager, type SetupResult, type Severity, type Skill, type SkillCategory, type SkillContext, type SkillExitStrategy, type SkillSummary, type SkillTactic, type SkillValidationError, 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, TELEGRAM_API_BASE, TELEGRAM_CHUNK_SIZE, TELEGRAM_MESSAGE_LIMIT, TELEGRAM_MIN_WEBHOOK_SECRET_LENGTH, TELEGRAM_OPERATOR_QUERY_TAG, TELEGRAM_STOP_WORDS, TELEGRAM_WEBHOOK_SECRET_RE, TELEPHONY_TRANSPORT_CAPABILITIES, TWILIO_MEDIA_SAMPLE_RATE, TWILIO_REALTIME_WS_PATH, TelegramApiError, type TelegramApiOptions, type TelegramBotInfo, type TelegramChatType, type TelegramConfig, TelegramManager, type TelegramMessage, type TelegramMode, type TelephonyTransportCapability, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type ToolExecutor, type TtsGenerateOptions, type TunnelConfig, TunnelManager, type TwilioConnectedMessage, type TwilioMarkMessage, type TwilioMediaMessage, type TwilioRealtimeInboundMessage, type TwilioRealtimeOutboundMessage, TwilioRealtimeTransport, type TwilioStartMessage, type TwilioStopMessage, type TwilioStreamTwiMLOptions, UnsafeApiUrlError, type UpdateMemoryInput, type ValidatedPhoneMissionStart, type VideoAction, type VideoEditOptions, type VideoTimelineEntry, type VideoUnderstandOptions, type VideoUnderstandResult, type VoiceCloneOptions, WARNING_THRESHOLD, WEB_SEARCH_TOOL, WEB_SEARCH_UNTRUSTED_PREFIX, type WatcherOptions, type WebSearchOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildElksAudioMessage, buildElksByeMessage, buildElksHandshakeMessages, buildElksInterruptMessage, buildElksListeningMessage, buildElksSendingMessage, buildInboundSecurityAdvisory, buildOpenAIRealtimeUrl, buildPhoneTransportConfig, buildRealtimeInstructions, buildRealtimeSessionConfig, buildRealtimeToolGuidance, buildTwilioClearMessage, buildTwilioMarkMessage, buildTwilioMediaMessage, buildTwilioSayTwiML, buildTwilioSignature, buildTwilioStreamTwiML, callTelegramApi, classifyEmailRoute, classifyPhoneNumberRisk, classifyResumeError, clearMediaCapabilityCache, closeDatabase, composeBridgeWakePrompt, createRealtimeTransport, createTestDatabase, createToolExecutor, debug, debugWarn, deleteTelegramWebhook, detectBinary, ensureDataDir, escapeXml, extractEmailAddress, extractVerificationCode, flushTelemetry, forgetHostSession, formatOperatorQueryTelegramMessage, getDatabase, getDatetime, getMediaCapabilities, getOperatorEmail, getSmsProvider, getTelegramChat, getTelegramMe, getTelegramUpdates, getTelegramWebhookInfo, hostSessionStoragePath, inferPhoneRegion, invalidateSkillCache, isInternalEmail, isLoopbackMailHost, isOperatorReplySender, isPhoneRegionAllowed, isSessionFresh, isTelegramChatAllowed, isTelegramStopCommand, isValidPhoneNumber, listSkills, loadHostSession, loadSkill, mapProviderSmsStatus, nextTelegramOffset, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, operatorQuerySubject, parseElksRealtimeMessage, parseEmail, parseGoogleVoiceSms, parseOperatorQueryReply, parseTelegramOperatorReply, parseTelegramUpdate, parseTwilioRealtimeMessage, planBridgeWake, pollForOperatorAnswer, recallMemory, recordToolCall, redactBotToken, redactObject, redactPhoneTransportConfig, redactSecret, redactSmsConfig, redactTelegramConfig, renderSkillAsPrompt, requireBinary, requireWhisperModel, resolveConfig, resolveTlsRejectUnauthorized, safeJoin, sanitizeEmail, saveConfig, saveHostSession, saveUserSkill, scanOutboundEmail, scoreEmail, searchSkills, sendTelegramMessage, setOperatorEmail, setTelegramWebhook, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, splitTelegramMessage, startRelayBridge, stem, stripTelegramMarkdown, threadIdFor, tokenize, tryJoin, userSkillsDir, validateApiUrl, validatePhoneMissionPolicy, validatePhoneMissionStart, validatePhoneTransportProfile, validateSkill, validateTwilioSignature, webSearch };