/** * 飞书卡片格式化模块 * 提供卡片构建和内容格式化功能 */ /** 卡片模板颜色 */ export type CardTemplate = 'blue' | 'wathet' | 'turquoise' | 'green' | 'yellow' | 'orange' | 'red' | 'carmine' | 'violet' | 'purple' | 'indigo' | 'grey'; /** 卡片标题 */ export interface CardHeader { title: { tag: 'plain_text'; content: string; }; template?: CardTemplate; } /** 飞书卡片结构 */ export interface FeishuCard { config?: { wide_screen_mode?: boolean; }; header?: CardHeader; elements: CardElement[]; } export type CardElement = MarkdownElement | DivElement | HrElement | NoteElement; export interface MarkdownElement { tag: 'markdown'; content: string; } export interface DivElement { tag: 'div'; text: { tag: 'plain_text' | 'lark_md'; content: string; }; } export interface HrElement { tag: 'hr'; } export interface NoteElement { tag: 'note'; elements: Array<{ tag: 'plain_text' | 'lark_md'; content: string; }>; } /** 创建卡片 */ export declare function createCard(content: string, title?: string, template?: CardTemplate): FeishuCard; /** 创建状态卡片 */ export declare function createStatusCard(status: string, details?: string): FeishuCard; /** 格式化代码块 */ export declare function formatCodeBlock(code: string, language?: string): string; /** 格式化工具输出 */ export declare function formatToolOutput(toolName: string, status: string, output?: string): string; /** 格式化思考块 */ export declare function formatThinkingBlock(text: string): string; /** 格式化错误信息 */ export declare function formatError(error: string): string; /** 截断内容以符合飞书限制 */ export declare function truncateContent(content: string): string; /** 转义 Markdown 特殊字符 */ export declare function escapeMarkdown(text: string): string; /** 格式化消息部分 */ export declare function formatMessageParts(parts: Array<{ type: string; text?: string; name?: string; state?: string; output?: string; }>): string; export interface StreamingCardParts { textContent: string; reasoningContent: string; toolCalls: Array<{ name: string; state: string; title?: string; input?: Record; output?: string; error?: string; }>; } export interface OrderedPart { type: 'text' | 'reasoning' | 'tool-call'; text?: string; name?: string; state?: string; title?: string; input?: Record; output?: string; error?: string; } export declare function categorizeMessageParts(parts: Array<{ type: string; text?: string; name?: string; state?: string; title?: string; input?: Record; output?: string; error?: string; }>): StreamingCardParts; interface CardBuildResult { cards: object[]; hasMore: boolean; } export declare function buildStreamingCardsV2(parts: OrderedPart[], isComplete: boolean, title?: string): CardBuildResult; export declare function buildStreamingCardV2(parts: StreamingCardParts, isComplete: boolean, title?: string): object; /** 构建流式卡片 */ export declare function buildStreamingCard(content: string, isComplete: boolean, title?: string): FeishuCard; export {}; //# sourceMappingURL=formatter.d.ts.map