/**
 * Telegram draft stream for streaming message previews.
 *
 * Uses sendMessage + editMessageText, or sendMessageDraft when available (DM / supported clients),
 * with automatic fallback and optional materialize for draft transport.
 */
import type { Bot } from 'grammy';
import type { ProgressStage } from '@xopcai/xopc/agent/lifecycle/progress.js';
export type TelegramDraftPreview = {
    text: string;
    parseMode?: 'HTML';
};
export interface TelegramDraftStreamOptions {
    api: Bot['api'];
    chatId: number | string;
    maxChars?: number;
    threadId?: number;
    replyToMessageId?: number;
    throttleMs?: number;
    /** Prefer draft API, real message edits, or auto (DM → draft when API exists). */
    previewTransport?: 'auto' | 'message' | 'draft';
    /** Minimum chars before first outbound preview (push notification quality). */
    minInitialChars?: number;
    /** Optional preview renderer (e.g. markdown → HTML). */
    renderText?: (text: string) => TelegramDraftPreview;
    /** Called when a late send resolves after forceNewMessage() rotated generations. */
    onSupersededPreview?: (preview: {
        messageId: number;
        textSnapshot: string;
        parseMode?: 'HTML';
    }) => void;
    warn?: (message: string) => void;
    /** When `renderText` is omitted, controls default text conversion (`HTML` = sanitize only). */
    parseMode?: 'Markdown' | 'HTML' | undefined;
    enableProgress?: boolean;
}
export interface TelegramDraftStream {
    update: (text: string) => void;
    updateWithProgress: (text: string, stage?: ProgressStage, detail?: string) => void;
    flush: () => Promise<void>;
    messageId: () => number | undefined;
    previewMode?: () => 'message' | 'draft';
    previewRevision?: () => number;
    lastDeliveredText?: () => string;
    clear: () => Promise<void>;
    stop: () => Promise<void>;
    materialize?: () => Promise<number | undefined>;
    forceNewMessage: () => void;
    sendMayHaveLanded?: () => boolean;
    setProgress: (stage: ProgressStage, detail?: string) => void;
}
/**
 * Create a draft stream for streaming message previews.
 */
export declare function createTelegramDraftStream(options: TelegramDraftStreamOptions): TelegramDraftStream;
export declare class DraftStreamManager {
    private streams;
    getOrCreate(key: string, options: TelegramDraftStreamOptions): TelegramDraftStream;
    get(key: string): TelegramDraftStream | undefined;
    stop(key: string): Promise<void>;
    stopAll(): Promise<void>;
    clear(key: string): Promise<void>;
}
export declare const draftStreamManager: DraftStreamManager;
export declare const __testing: {
    resetTelegramDraftStreamForTests(): void;
};
