UNPKG

agents

Version:

A home for your AI agents

109 lines (107 loc) • 3.44 kB
import { b as ChannelEmailIngress, c as ChannelRoute, n as Channel, s as ChannelParticipant } from "../../../channel-Bak_6zDP.js"; import { b as ChannelMessageSurface, x as ChannelMessageSurfaceInput } from "../../../protocol-CukuI73M.js"; import { Email } from "postal-mime"; //#region src/experimental/channels/email/email-surface.d.ts type EmailSurfaceAddress = | string | { email: string; name: string; }; type EmailSurfaceRecipients = | EmailSurfaceAddress | readonly EmailSurfaceAddress[]; type EmailMessageAddress = { from: EmailSurfaceAddress; to: EmailSurfaceRecipients; replyTo?: EmailSurfaceAddress; cc?: EmailSurfaceRecipients; bcc?: EmailSurfaceRecipients; headers?: Readonly<Record<string, string>>; subject?: string; inReplyTo?: string; references?: readonly string[]; }; type EmailMessageSurface = ChannelMessageSurface<string, EmailMessageAddress>; type EmailMessageSurfaceInput = ChannelMessageSurfaceInput<EmailMessageAddress>; //#endregion //#region src/experimental/channels/email/inbound-email.d.ts /** Parsed, provider-specific email retained while selecting an application route. */ type InboundEmailRaw = Email; type InboundEmailOptions = { /** Only accept messages delivered to this address. */ to?: string /** Only accept these envelope senders. */; from?: | string | readonly string[] /** Outbound sender to retain in normalized reply surfaces. */; replyFrom?: EmailSurfaceAddress; }; /** Parse Workers Email events into normalized Channel ingress events. */ declare function inboundEmail( options?: InboundEmailOptions ): ChannelEmailIngress<InboundEmailRaw>; //#endregion //#region src/experimental/channels/email/email.d.ts type EmailAddress = EmailSurfaceAddress; type EmailRecipients = EmailSurfaceRecipients; type ChannelEmailMessage = { from: EmailAddress; to: EmailAddress | EmailAddress[]; subject: string; text: string; replyTo?: EmailAddress; cc?: EmailAddress | EmailAddress[]; bcc?: EmailAddress | EmailAddress[]; headers?: Record<string, string>; }; /** The structural subset of a Cloudflare Email Service binding used here. */ interface EmailSendBinding { send(message: ChannelEmailMessage): Promise<{ messageId: string; }>; } /** Configuration for an email Channel. */ type EmailChannelOptions = { binding: EmailSendBinding; from: EmailAddress /** Subject used when a message does not provide a title. */; defaultTitle?: string; /** * Who sent an inbound email. Set it to receive email. The envelope sender * is not authenticated, so decide how far to trust it. Return null to drop * the email. */ participant?: ChannelParticipant<InboundEmailRaw>; /** * Pick the agent object an email reaches. Default: a room of the * participant's own. */ route?: ChannelRoute<InboundEmailRaw> /** Override inferred Workers Email ingress addresses. Needs `participant`. */; inbound?: InboundEmailOptions; }; /** Create a configured email Channel. */ declare function email(options: EmailChannelOptions): Channel<InboundEmailRaw>; //#endregion export { ChannelEmailMessage, EmailAddress, EmailChannelOptions, EmailMessageAddress, EmailMessageSurface, EmailMessageSurfaceInput, EmailRecipients, EmailSendBinding, EmailSurfaceAddress, EmailSurfaceRecipients, InboundEmailOptions, InboundEmailRaw, email, inboundEmail }; //# sourceMappingURL=index.d.ts.map