/** * WeChat MP text normalization utilities * * Provides markdown-friendly text normalization that can be shared between * the reply pipeline (dispatch.ts) and direct outbound (outbound.ts). * * The normalization behavior is controlled by the `renderMarkdown` config: * - true (default): Apply markdown-friendly formatting for WeChat MP * - false: Minimal passthrough, preserving original text */ /** WeChat MP text message byte limit (2048 bytes) */ export declare const WECHAT_TEXT_BYTE_LIMIT = 2048; /** * Calculate UTF-8 byte length of a string. * @param str - The string to measure * @returns The byte length in UTF-8 encoding */ export declare function getUtf8ByteLength(str: string): number; /** * Split text by byte limit, respecting boundaries (paragraphs, sentences, spaces). * Ensures no multi-byte characters are truncated. * * @param text - The text to split * @param maxBytes - Maximum bytes per chunk (default: WECHAT_TEXT_BYTE_LIMIT) * @returns Array of text chunks, each within the byte limit */ export declare function splitTextByByteLimit(text: string, maxBytes?: number): string[]; /** * Truncate text to fit within a byte limit. * Tries to find a good boundary (paragraph, sentence, space) for truncation. * * @param text - The text to truncate * @param maxBytes - Maximum bytes for the result * @returns Truncated text within the byte limit */ export declare function truncateTextByByteLimit(text: string, maxBytes?: number): string; /** * Normalize text for WeChat MP delivery. * * When renderMarkdown is enabled (default), converts markdown to WeChat MP * friendly plain text. When disabled, returns text with minimal changes. * * @param text - The raw text to normalize * @param renderMarkdown - Whether to apply markdown-friendly formatting * @returns Normalized text ready for WeChat MP delivery */ export declare function normalizeWechatMpText(text: string, renderMarkdown: boolean): string; /** * Resolve the renderMarkdown setting from account config. * Defaults to true if not explicitly set to false. */ export declare function resolveRenderMarkdown(config: { renderMarkdown?: boolean; }): boolean; //# sourceMappingURL=text.d.ts.map