import type { SessionAuthContext } from "#channel/types.js"; import { type ChatSdkChannel, type ChatSdkChannelEvents } from "#public/channels/chat-sdk/index.js"; import type { Message, Thread } from "#compiled/chat/index.js"; import { type iMessageAdapter, type iMessageCredentialProvider, type iMessageWebhookVerifier } from "#compiled/@photon-ai/chat-adapter-imessage/index.js"; /** Photon project credentials used by {@link photonIMessageChannel}. */ export type PhotonIMessageChannelCredentials = iMessageCredentialProvider; /** Context passed to {@link PhotonIMessageChannelConfig.onMessage}. */ export interface PhotonInboundMessageContext { /** Low-level Chat SDK thread for iMessage-specific operations. */ readonly thread: Thread; } /** Result of {@link PhotonIMessageChannelConfig.onMessage}. Return `null` to drop the message. */ export type PhotonInboundResult = { readonly auth: SessionAuthContext | null; readonly context?: readonly string[]; } | null; /** Sync or async {@link PhotonInboundResult}. */ export type PhotonInboundResultOrPromise = PhotonInboundResult | Promise; /** Configuration for {@link photonIMessageChannel}. */ export interface PhotonIMessageChannelConfig { /** Lazy Photon project credentials, such as `connectPhotonCredentials(...)`. */ readonly credentials: PhotonIMessageChannelCredentials; /** Per-event overrides for the underlying Chat SDK channel. */ readonly events?: ChatSdkChannelEvents<{ imessage: iMessageAdapter; }>; /** Inbound message policy. Defaults to dispatching every message with no user auth. */ readonly onMessage?: (ctx: PhotonInboundMessageContext, message: Message) => PhotonInboundResultOrPromise; /** Override the default webhook route (`/eve/v1/photon`). */ readonly route?: string; /** Display name used by the Chat SDK runtime. Defaults to `"eve"`. */ readonly userName?: string; /** Photon webhook signing secret. Falls back to `IMESSAGE_WEBHOOK_SECRET`. */ readonly webhookSecret?: string; /** Trusted webhook verifier. Takes precedence over `webhookSecret`. */ readonly webhookVerifier?: iMessageWebhookVerifier; } /** First-class eve channel backed by Photon iMessage. */ export interface PhotonIMessageChannel extends ChatSdkChannel { } /** * Creates an eve channel for Photon-powered iMessage. * * @example * ```ts * import { connectPhotonCredentials } from "@vercel/connect/eve"; * import { photonIMessageChannel } from "eve/channels/photon"; * * export default photonIMessageChannel({ * credentials: connectPhotonCredentials("photon/my-agent"), * }); * ``` */ export declare function photonIMessageChannel(config: PhotonIMessageChannelConfig): PhotonIMessageChannel;