/** * 邮件收发的契约(设计稿 docs/superpowers/specs/2026-08-25-mail-design.md §7.1;ADR-013)。 * * 只有 zod schema 与推导类型。账号视图**永不含密文**(ADR-009 §4):只回 `secretBound`。 * 入参按 `kind` 分两形 —— 标准协议(IMAP/SMTP)与企业微信邮件 API(应用邮箱), * 两条路的共同点是「轮询拉 + MIME 解析」,腾讯没有带内容的推送。 */ import { z } from 'zod'; export declare const MAIL_ACCOUNT_KINDS: readonly ["imap-smtp", "wecom"]; export declare const mailAccountKindSchema: z.ZodEnum<{ "imap-smtp": "imap-smtp"; wecom: "wecom"; }>; export type MailAccountKind = z.infer; export declare const MAIL_ACCOUNT_KIND_LABEL: Readonly>; /** 标准协议:默认值就是腾讯企业邮箱官方帮助给的服务器与 SSL 端口 */ export declare const imapSmtpSettingsSchema: z.ZodObject<{ imapHost: z.ZodDefault; imapPort: z.ZodDefault; imapTls: z.ZodDefault; smtpHost: z.ZodDefault; smtpPort: z.ZodDefault; smtpTls: z.ZodDefault; login: z.ZodOptional; folder: z.ZodDefault; }, z.core.$strip>; export type ImapSmtpSettings = z.infer; /** 企业微信邮件 API:corpid + 自建应用 secret(密封,不在 settings 里) */ export declare const wecomSettingsSchema: z.ZodObject<{ corpId: z.ZodString; apiBase: z.ZodDefault; }, z.core.$strip>; export type WecomSettings = z.infer; export declare const mailAccountInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ settings: z.ZodPrefault; imapPort: z.ZodDefault; imapTls: z.ZodDefault; smtpHost: z.ZodDefault; smtpPort: z.ZodDefault; smtpTls: z.ZodDefault; login: z.ZodOptional; folder: z.ZodDefault; }, z.core.$strip>>; secret: z.ZodOptional>; name: z.ZodString; displayName: z.ZodDefault; enabled: z.ZodDefault; isDefault: z.ZodDefault; pollIntervalSec: z.ZodDefault; channelId: z.ZodDefault>>; backfillFrom: z.ZodDefault>; kind: z.ZodLiteral<"imap-smtp">; address: z.ZodEmail; }, z.core.$strip>, z.ZodObject<{ settings: z.ZodObject<{ corpId: z.ZodString; apiBase: z.ZodDefault; }, z.core.$strip>; secret: z.ZodOptional>; name: z.ZodString; displayName: z.ZodDefault; enabled: z.ZodDefault; isDefault: z.ZodDefault; pollIntervalSec: z.ZodDefault; channelId: z.ZodDefault>>; backfillFrom: z.ZodDefault>; kind: z.ZodLiteral<"wecom">; }, z.core.$strip>], "kind">; export type MailAccountInput = z.infer; export declare const mailAccountStatusSchema: z.ZodObject<{ lastPolledAt: z.ZodNullable; lastPollError: z.ZodNullable; lastInboundAt: z.ZodNullable; cursor: z.ZodNullable; polling: z.ZodBoolean; }, z.core.$strip>; export declare const mailAccountViewSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ settings: z.ZodObject<{ imapHost: z.ZodDefault; imapPort: z.ZodDefault; imapTls: z.ZodDefault; smtpHost: z.ZodDefault; smtpPort: z.ZodDefault; smtpTls: z.ZodDefault; login: z.ZodOptional; folder: z.ZodDefault; }, z.core.$strip>; id: z.ZodString; name: z.ZodString; address: z.ZodString; displayName: z.ZodString; enabled: z.ZodBoolean; isDefault: z.ZodBoolean; pollIntervalSec: z.ZodNumber; channelId: z.ZodNullable; backfillFrom: z.ZodNullable; secretBound: z.ZodBoolean; status: z.ZodObject<{ lastPolledAt: z.ZodNullable; lastPollError: z.ZodNullable; lastInboundAt: z.ZodNullable; cursor: z.ZodNullable; polling: z.ZodBoolean; }, z.core.$strip>; createdAt: z.ZodISODateTime; updatedAt: z.ZodISODateTime; kind: z.ZodLiteral<"imap-smtp">; }, z.core.$strip>, z.ZodObject<{ settings: z.ZodObject<{ corpId: z.ZodString; apiBase: z.ZodDefault; }, z.core.$strip>; id: z.ZodString; name: z.ZodString; address: z.ZodString; displayName: z.ZodString; enabled: z.ZodBoolean; isDefault: z.ZodBoolean; pollIntervalSec: z.ZodNumber; channelId: z.ZodNullable; backfillFrom: z.ZodNullable; secretBound: z.ZodBoolean; status: z.ZodObject<{ lastPolledAt: z.ZodNullable; lastPollError: z.ZodNullable; lastInboundAt: z.ZodNullable; cursor: z.ZodNullable; polling: z.ZodBoolean; }, z.core.$strip>; createdAt: z.ZodISODateTime; updatedAt: z.ZodISODateTime; kind: z.ZodLiteral<"wecom">; }, z.core.$strip>], "kind">; export type MailAccountView = z.infer; /** 探测报告:收 / 发各说各的;wecom 的发信一栏 `checked:false` —— 拿到 token 不等于能发 */ export declare const mailProbeReportSchema: z.ZodObject<{ kind: z.ZodEnum<{ "imap-smtp": "imap-smtp"; wecom: "wecom"; }>; address: z.ZodOptional; receive: z.ZodObject<{ ok: z.ZodBoolean; error: z.ZodOptional; latencyMs: z.ZodOptional; }, z.core.$strip>; send: z.ZodObject<{ checked: z.ZodBoolean; ok: z.ZodOptional; error: z.ZodOptional; note: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; export type MailProbeReport = z.infer; export declare const MAIL_DELIVERY_STATES: readonly ["dispatching", "done", "failed", "skipped"]; export declare const mailDeliveryStateSchema: z.ZodEnum<{ failed: "failed"; done: "done"; dispatching: "dispatching"; skipped: "skipped"; }>; export type MailDeliveryState = z.infer; export declare const mailDeliveryViewSchema: z.ZodObject<{ subscriber: z.ZodString; state: z.ZodEnum<{ failed: "failed"; done: "done"; dispatching: "dispatching"; skipped: "skipped"; }>; error: z.ZodNullable; startedAt: z.ZodISODateTime; finishedAt: z.ZodNullable; }, z.core.$strip>; export type MailDeliveryView = z.infer; export declare const mailAddressSchema: z.ZodObject<{ address: z.ZodString; name: z.ZodString; }, z.core.$strip>; export type MailAddress = z.infer; export declare const mailInboundAttachmentSchema: z.ZodObject<{ index: z.ZodNumber; name: z.ZodString; contentType: z.ZodString; size: z.ZodNumber; ref: z.ZodNullable; note: z.ZodString; }, z.core.$strip>; export type MailInboundAttachment = z.infer; export declare const mailInboundSummarySchema: z.ZodObject<{ id: z.ZodString; accountId: z.ZodString; messageId: z.ZodString; from: z.ZodObject<{ address: z.ZodString; name: z.ZodString; }, z.core.$strip>; to: z.ZodArray>; cc: z.ZodArray>; subject: z.ZodString; sentAt: z.ZodNullable; receivedAt: z.ZodISODateTime; textPreview: z.ZodString; hasHtml: z.ZodBoolean; attachments: z.ZodArray; note: z.ZodString; }, z.core.$strip>>; deliveries: z.ZodArray; error: z.ZodNullable; startedAt: z.ZodISODateTime; finishedAt: z.ZodNullable; }, z.core.$strip>>; }, z.core.$strip>; export type MailInboundSummary = z.infer; export declare const mailInboundDetailSchema: z.ZodObject<{ id: z.ZodString; accountId: z.ZodString; messageId: z.ZodString; from: z.ZodObject<{ address: z.ZodString; name: z.ZodString; }, z.core.$strip>; to: z.ZodArray>; cc: z.ZodArray>; subject: z.ZodString; sentAt: z.ZodNullable; receivedAt: z.ZodISODateTime; textPreview: z.ZodString; hasHtml: z.ZodBoolean; attachments: z.ZodArray; note: z.ZodString; }, z.core.$strip>>; deliveries: z.ZodArray; error: z.ZodNullable; startedAt: z.ZodISODateTime; finishedAt: z.ZodNullable; }, z.core.$strip>>; inReplyTo: z.ZodNullable; references: z.ZodArray; text: z.ZodNullable; html: z.ZodNullable; size: z.ZodNumber; rawAvailable: z.ZodBoolean; }, z.core.$strip>; export type MailInboundDetail = z.infer; export declare const mailSendInputSchema: z.ZodObject<{ accountId: z.ZodOptional; from: z.ZodOptional; to: z.ZodArray; cc: z.ZodDefault>; bcc: z.ZodDefault>; subject: z.ZodString; text: z.ZodOptional; html: z.ZodOptional; inReplyTo: z.ZodOptional; references: z.ZodDefault>; attachments: z.ZodDefault; dataBase64: z.ZodOptional; uploadRef: z.ZodOptional; }, z.core.$strip>>>; idempotencyKey: z.ZodOptional; requestedBy: z.ZodObject<{ kind: z.ZodEnum<{ channel: "channel"; tool: "tool"; ops: "ops"; }>; taskId: z.ZodOptional; staffId: z.ZodOptional; tool: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; export type MailSendInput = z.infer; export declare const MAIL_OUTBOUND_STATES: readonly ["sending", "sent", "failed"]; export declare const mailOutboundStateSchema: z.ZodEnum<{ failed: "failed"; sending: "sending"; sent: "sent"; }>; export type MailOutboundState = z.infer; export declare const mailSendResultSchema: z.ZodObject<{ outboundId: z.ZodString; accountId: z.ZodString; messageId: z.ZodString; state: z.ZodEnum<{ failed: "failed"; sent: "sent"; }>; error: z.ZodOptional; providerRef: z.ZodOptional; }, z.core.$strip>; export type MailSendResult = z.infer; export declare const mailOutboundViewSchema: z.ZodObject<{ id: z.ZodString; accountId: z.ZodString; messageId: z.ZodString; to: z.ZodArray; cc: z.ZodArray; bcc: z.ZodArray; subject: z.ZodString; state: z.ZodEnum<{ failed: "failed"; sending: "sending"; sent: "sent"; }>; error: z.ZodNullable; providerRef: z.ZodNullable; requestedBy: z.ZodRecord; createdAt: z.ZodISODateTime; sentAt: z.ZodNullable; }, z.core.$strip>; export type MailOutboundView = z.infer; export declare const mailPollOutcomeSchema: z.ZodObject<{ accountId: z.ZodString; pulled: z.ZodNumber; stored: z.ZodNumber; dispatched: z.ZodNumber; more: z.ZodBoolean; error: z.ZodOptional; }, z.core.$strip>; export type MailPollOutcome = z.infer;