import type { InteractionEvent, IncomingReaction } from "@copilotkit/channels-core"; import type { ProviderActor } from "@copilotkit/channels-ui"; import type { ConversationKey } from "./types.js"; /** * Stable string key shared by ingress (listener) and interaction decoding so * the bot's awaitChoice waiters resolve. Both paths MUST derive the * conversation key from this single helper — a mismatch silently strands * the waiter. */ export declare function conversationKeyOf(key: ConversationKey): string; /** * Derive a ConversationKey from a Telegram message/chat object. * * - Private chat → DM_SCOPE * - Forum supergroup with message_thread_id → "topic:" * - Other group → "user:" * * Non-forum groups are keyed by the SENDER's user id (not message ids) so that * each user has one ongoing conversation per group: a fresh @mention (which has * no reply, hence a unique message_id) continues the same conversation rather * than spawning a new one, and a callback_query (whose `message` is the BOT's * own message) still resolves to the clicking user's conversation. Pass an * explicit `userId` to override `message.from?.id` (callbacks must pass the * clicking user's id so the key matches ingress). */ export declare function deriveConversationKey(message: { message_id: number; message_thread_id?: number; chat: { id: number | string; type: string; is_forum?: boolean; }; reply_to_message?: { message_id: number; }; from?: { id: number; }; }, userId?: number): ConversationKey; /** * Map a Telegram `from` user to a ProviderActor. */ export declare function toProviderActor(from: { id: number; first_name?: string; last_name?: string; username?: string; }): ProviderActor | undefined; /** * Decode a Telegram `message_reaction` update into zero or more * {@link IncomingReaction} events — one per emoji that was added or removed. * Only `type === "emoji"` entries are considered; custom_emoji are ignored. */ export declare function decodeReaction(update: unknown): IncomingReaction[]; /** * Decode a Telegram callback_query update (grammY or raw Bot API) into a * bot InteractionEvent. * * Accepts either: * - A grammY update: `{ callback_query: { ... } }` * - A bare callback query object: `{ id, data, from, message }` */ export declare function decodeInteraction(raw: unknown): InteractionEvent | undefined; /** Build event-scoped Telegram identity facts without resolving a profile. */ export declare function telegramIdentityContext(input: { chat?: { id?: number | string; type?: string; }; conversationKey: string; trigger: string; eventId?: string; raw: unknown; }): { tenant: { id: string; }; installation: { id: string; }; conversation: { id: string; kind: string | undefined; }; trigger: string; event: { id: string | undefined; }; raw: unknown; }; //# sourceMappingURL=interaction.d.ts.map