import { d as TelegramBotConfig, T as TelegramBot, e as TelegramCallbackQuery, k as TelegramUpdate, g as TelegramDocument, i as TelegramMessage, l as TelegramUser, j as TelegramPhotoSize, m as TelegramVoice, I as InlineKeyboardButton, a as InlineKeyboardMarkup, A as AnswerCallbackQueryOptions, E as EditMessageOptions, P as ParseMode, S as SendMessageOptions, b as SendPhotoOptions, c as SendVoiceOptions, f as TelegramChat, h as TelegramFile } from './types-CaN5aq6Y.js';

/**
 * Validate that an inbound Telegram webhook request carries the expected
 * shared secret. The body argument is accepted for forward compatibility
 * (e.g. if Telegram introduces a body signature in future) but is not
 * inspected today.
 */
declare function validateTelegramWebhook(headers: Record<string, string | undefined>, _body: string, secret: string): boolean;

declare class TelegramApiError extends Error {
    readonly method: string;
    readonly errorCode?: number;
    readonly description?: string;
    constructor(method: string, errorCode: number | undefined, description: string | undefined);
}
declare function createTelegramBot(config: TelegramBotConfig): TelegramBot;

interface DownloadedTelegramFile {
    data: Buffer;
    mimeType: string;
    fileName?: string;
    filePath: string;
}
declare function downloadTelegramFile(bot: TelegramBot, fileId: string, fetchImpl?: typeof fetch): Promise<DownloadedTelegramFile>;

interface RouterLogger {
    info: (msg: string, meta?: Record<string, unknown>) => void;
    warn: (msg: string, meta?: Record<string, unknown>) => void;
    error: (msg: string, meta?: Record<string, unknown>) => void;
}
interface RouterOptions {
    logger?: RouterLogger;
    /**
     * When a slash command has no registered handler, fall through to the
     * generic onText handler if present. Defaults to true.
     */
    fallbackSlashToText?: boolean;
}
interface BaseContext {
    bot: TelegramBot;
    chatId: number;
    userId: number;
    messageId: number;
    update: TelegramUpdate;
}
interface SlashCommandContext extends BaseContext {
    command: string;
    args: string;
    message: TelegramMessage;
    from?: TelegramUser;
}
interface CallbackContext {
    bot: TelegramBot;
    chatId: number;
    userId: number;
    messageId?: number;
    callbackQueryId: string;
    action: string;
    payload: string;
    data: string;
    query: TelegramCallbackQuery;
    update: TelegramUpdate;
}
interface TextContext extends BaseContext {
    text: string;
    message: TelegramMessage;
    from?: TelegramUser;
}
interface VoiceContext extends BaseContext {
    voice: TelegramVoice;
    message: TelegramMessage;
    from?: TelegramUser;
}
interface PhotoContext extends BaseContext {
    photo: TelegramPhotoSize[];
    caption?: string;
    message: TelegramMessage;
    from?: TelegramUser;
}
interface DocumentContext extends BaseContext {
    document: TelegramDocument;
    caption?: string;
    message: TelegramMessage;
    from?: TelegramUser;
}
type SlashHandler = (ctx: SlashCommandContext) => Promise<void> | void;
type CallbackHandler = (ctx: CallbackContext) => Promise<void> | void;
type TextHandler = (ctx: TextContext) => Promise<void> | void;
type VoiceHandler = (ctx: VoiceContext) => Promise<void> | void;
type PhotoHandler = (ctx: PhotoContext) => Promise<void> | void;
type DocumentHandler = (ctx: DocumentContext) => Promise<void> | void;
declare class TelegramRouter {
    private readonly bot;
    private readonly logger;
    private readonly fallbackSlashToText;
    private slashHandlers;
    private callbackHandlers;
    private textHandler?;
    private voiceHandler?;
    private photoHandler?;
    private documentHandler?;
    constructor(bot: TelegramBot, opts?: RouterOptions);
    onSlashCommand(name: string, handler: SlashHandler): void;
    onCallback(action: string, handler: CallbackHandler): void;
    onText(handler: TextHandler): void;
    onVoice(handler: VoiceHandler): void;
    onPhoto(handler: PhotoHandler): void;
    onDocument(handler: DocumentHandler): void;
    dispatch(update: TelegramUpdate): Promise<void>;
    private dispatchCallback;
    private dispatchText;
    private runHandler;
}

declare function escapeHtml(text: string): string;
declare function formatBold(text: string): string;
declare function formatItalic(text: string): string;
declare function formatCode(text: string): string;
declare function formatPre(text: string): string;
declare function formatLink(text: string, url: string): string;
declare function formatTierSeparator(label: string): string;
/**
 * Category → emoji map used by the inbox formatter. Re-exported so any
 * consumer building an inbox-style summary card uses the same icons.
 */
declare const INBOX_CATEGORY_EMOJI: Record<string, string>;
declare function formatEmoji(category: string): string;

declare function createInlineKeyboard(rows: InlineKeyboardButton[][]): InlineKeyboardMarkup;
/**
 * Build a callback button whose `callback_data` is `${action}|${payload}`.
 * The TelegramRouter parses this same shape on the receiving end, so the
 * round trip is symmetrical.
 */
declare function actionButton(text: string, action: string, payload?: string): InlineKeyboardButton;
declare function urlButton(text: string, url: string): InlineKeyboardButton;

type PendingProposalStatus = "PENDING" | "APPROVED" | "EDITED" | "DISCARDED" | "EXPIRED";
interface PendingProposal<T = unknown> {
    id: string;
    userId: string;
    chatId: number;
    /** Telegram message ID of the proposal card itself, once posted. */
    messageId?: number;
    /** Action discriminator — e.g. "CREATE_CONTACT_FROM_CARD". */
    action: string;
    payload: T;
    status: PendingProposalStatus;
    createdAt: Date;
    expiresAt?: Date;
}
/**
 * Storage contract. Consumers implement against whatever persistence layer
 * they use. agent-kit holds no runtime state and no default implementation.
 */
interface PendingProposalStore<T = unknown> {
    create(proposal: Omit<PendingProposal<T>, "id" | "createdAt" | "status">): Promise<PendingProposal<T>>;
    get(id: string): Promise<PendingProposal<T> | null>;
    update(id: string, patch: Partial<PendingProposal<T>>): Promise<void>;
    findActiveForUser(userId: string, action?: string): Promise<PendingProposal<T>[]>;
    /** Expire any PENDING proposals created before `beforeDate`. Returns count. */
    expire(beforeDate: Date): Promise<number>;
}
interface ApprovalKeyboardOptions {
    yesLabel?: string;
    editLabel?: string;
    discardLabel?: string;
    yesAction?: string;
    editAction?: string;
    discardAction?: string;
}
/**
 * Build the standard Yes / Edit / Discard inline keyboard for a proposal.
 *
 * callback_data is shaped `${action}|${proposalId}` so the TelegramRouter's
 * callback parser splits it cleanly.
 */
declare function createApprovalKeyboard(proposalId: string, opts?: ApprovalKeyboardOptions): InlineKeyboardMarkup;

declare const index_AnswerCallbackQueryOptions: typeof AnswerCallbackQueryOptions;
type index_ApprovalKeyboardOptions = ApprovalKeyboardOptions;
type index_CallbackContext = CallbackContext;
type index_DocumentContext = DocumentContext;
type index_DownloadedTelegramFile = DownloadedTelegramFile;
declare const index_EditMessageOptions: typeof EditMessageOptions;
declare const index_INBOX_CATEGORY_EMOJI: typeof INBOX_CATEGORY_EMOJI;
declare const index_InlineKeyboardButton: typeof InlineKeyboardButton;
declare const index_InlineKeyboardMarkup: typeof InlineKeyboardMarkup;
declare const index_ParseMode: typeof ParseMode;
type index_PendingProposal<T = unknown> = PendingProposal<T>;
type index_PendingProposalStatus = PendingProposalStatus;
type index_PendingProposalStore<T = unknown> = PendingProposalStore<T>;
type index_PhotoContext = PhotoContext;
type index_RouterLogger = RouterLogger;
type index_RouterOptions = RouterOptions;
declare const index_SendMessageOptions: typeof SendMessageOptions;
declare const index_SendPhotoOptions: typeof SendPhotoOptions;
declare const index_SendVoiceOptions: typeof SendVoiceOptions;
type index_SlashCommandContext = SlashCommandContext;
type index_TelegramApiError = TelegramApiError;
declare const index_TelegramApiError: typeof TelegramApiError;
declare const index_TelegramBot: typeof TelegramBot;
declare const index_TelegramBotConfig: typeof TelegramBotConfig;
declare const index_TelegramCallbackQuery: typeof TelegramCallbackQuery;
declare const index_TelegramChat: typeof TelegramChat;
declare const index_TelegramDocument: typeof TelegramDocument;
declare const index_TelegramFile: typeof TelegramFile;
declare const index_TelegramMessage: typeof TelegramMessage;
declare const index_TelegramPhotoSize: typeof TelegramPhotoSize;
type index_TelegramRouter = TelegramRouter;
declare const index_TelegramRouter: typeof TelegramRouter;
declare const index_TelegramUpdate: typeof TelegramUpdate;
declare const index_TelegramUser: typeof TelegramUser;
declare const index_TelegramVoice: typeof TelegramVoice;
type index_TextContext = TextContext;
type index_VoiceContext = VoiceContext;
declare const index_actionButton: typeof actionButton;
declare const index_createApprovalKeyboard: typeof createApprovalKeyboard;
declare const index_createInlineKeyboard: typeof createInlineKeyboard;
declare const index_createTelegramBot: typeof createTelegramBot;
declare const index_downloadTelegramFile: typeof downloadTelegramFile;
declare const index_escapeHtml: typeof escapeHtml;
declare const index_formatBold: typeof formatBold;
declare const index_formatCode: typeof formatCode;
declare const index_formatEmoji: typeof formatEmoji;
declare const index_formatItalic: typeof formatItalic;
declare const index_formatLink: typeof formatLink;
declare const index_formatPre: typeof formatPre;
declare const index_formatTierSeparator: typeof formatTierSeparator;
declare const index_urlButton: typeof urlButton;
declare const index_validateTelegramWebhook: typeof validateTelegramWebhook;
declare namespace index {
  export { index_AnswerCallbackQueryOptions as AnswerCallbackQueryOptions, type index_ApprovalKeyboardOptions as ApprovalKeyboardOptions, type index_CallbackContext as CallbackContext, type index_DocumentContext as DocumentContext, type index_DownloadedTelegramFile as DownloadedTelegramFile, index_EditMessageOptions as EditMessageOptions, index_INBOX_CATEGORY_EMOJI as INBOX_CATEGORY_EMOJI, index_InlineKeyboardButton as InlineKeyboardButton, index_InlineKeyboardMarkup as InlineKeyboardMarkup, index_ParseMode as ParseMode, type index_PendingProposal as PendingProposal, type index_PendingProposalStatus as PendingProposalStatus, type index_PendingProposalStore as PendingProposalStore, type index_PhotoContext as PhotoContext, type index_RouterLogger as RouterLogger, type index_RouterOptions as RouterOptions, index_SendMessageOptions as SendMessageOptions, index_SendPhotoOptions as SendPhotoOptions, index_SendVoiceOptions as SendVoiceOptions, type index_SlashCommandContext as SlashCommandContext, index_TelegramApiError as TelegramApiError, index_TelegramBot as TelegramBot, index_TelegramBotConfig as TelegramBotConfig, index_TelegramCallbackQuery as TelegramCallbackQuery, index_TelegramChat as TelegramChat, index_TelegramDocument as TelegramDocument, index_TelegramFile as TelegramFile, index_TelegramMessage as TelegramMessage, index_TelegramPhotoSize as TelegramPhotoSize, index_TelegramRouter as TelegramRouter, index_TelegramUpdate as TelegramUpdate, index_TelegramUser as TelegramUser, index_TelegramVoice as TelegramVoice, type index_TextContext as TextContext, type index_VoiceContext as VoiceContext, index_actionButton as actionButton, index_createApprovalKeyboard as createApprovalKeyboard, index_createInlineKeyboard as createInlineKeyboard, index_createTelegramBot as createTelegramBot, index_downloadTelegramFile as downloadTelegramFile, index_escapeHtml as escapeHtml, index_formatBold as formatBold, index_formatCode as formatCode, index_formatEmoji as formatEmoji, index_formatItalic as formatItalic, index_formatLink as formatLink, index_formatPre as formatPre, index_formatTierSeparator as formatTierSeparator, index_urlButton as urlButton, index_validateTelegramWebhook as validateTelegramWebhook };
}

export { type ApprovalKeyboardOptions as A, type CallbackContext as C, type DocumentContext as D, INBOX_CATEGORY_EMOJI as I, type PendingProposal as P, type RouterLogger as R, type SlashCommandContext as S, TelegramApiError as T, type VoiceContext as V, type DownloadedTelegramFile as a, type PendingProposalStatus as b, type PendingProposalStore as c, type PhotoContext as d, type RouterOptions as e, TelegramRouter as f, type TextContext as g, actionButton as h, createApprovalKeyboard as i, createInlineKeyboard as j, createTelegramBot as k, downloadTelegramFile as l, escapeHtml as m, formatBold as n, formatCode as o, formatEmoji as p, formatItalic as q, formatLink as r, formatPre as s, formatTierSeparator as t, index as u, urlButton as v, validateTelegramWebhook as w };
