import type { LLMConfig } from '../types.js'; export type PromptMode = 'system' | 'user'; export interface PromptVersion { content: string; note?: string; created: string; source?: 'original' | 'optimize' | 'manual' | 'garden'; } export interface PromptRecord { kind: 'prompt'; name: string; mode: PromptMode; favorite?: boolean; versions: PromptVersion[]; created: string; } /** 提示词库目录:默认 ~/.ao/prompts,可用 AO_PROMPTS_DIR 覆盖。 */ export declare function promptsDir(): string; export declare function slugify(name: string): string; /** 构建「优化提示词」的 meta system prompt。 */ export declare function buildOptimizeMetaPrompt(mode: PromptMode, lang?: 'zh' | 'en'): string; /** 去掉 LLM 偶尔仍加上的 ```围栏 / "这是优化后的..." 前缀。 */ export declare function cleanOptimizedOutput(raw: string): string; /** 调 LLM 优化一段提示词,返回优化后的文本。 */ export declare function optimizePrompt(options: { rawPrompt: string; mode: PromptMode; llmConfig: LLMConfig; lang?: 'zh' | 'en'; }): Promise; /** * 用某版提示词实跑一个样例输入,返回真实输出(用于「测试 / 对比」)。 * system 模式:prompt 作为 system,testInput 作为 user。 * user 模式:把 prompt 和样例拼成 user 消息(prompt 通常已自带任务)。 */ export declare function testPrompt(options: { prompt: string; mode: PromptMode; testInput: string; llmConfig: LLMConfig; }): Promise; /** * 多结果评估:让 LLM 当裁判,给同一任务下的多个输出打分排序(「多结果对比」)。 * 返回 ranking(含分数 + 一句话理由)和 best 标签。裁判 JSON 解析失败时回退为「均分、无定论」。 */ export declare function scoreOutputs(options: { testInput: string; candidates: { label: string; output: string; }[]; llmConfig: LLMConfig; lang?: 'zh' | 'en'; }): Promise<{ ranking: { label: string; score: number; reason: string; }[]; best: string | null; }>; export declare function serializePrompt(rec: PromptRecord): string; export declare function parsePromptFile(filePath: string): PromptRecord; export declare function savePrompt(rec: PromptRecord, dir?: string): string; export declare function listPrompts(dir?: string): { file: string; record: PromptRecord; }[]; export declare function loadPrompt(ref: string, dir?: string): PromptRecord; export declare function removePrompt(ref: string, dir?: string): string | null; /** 追加一个新版本(沉淀迭代历史)。返回更新后的记录。 */ export declare function appendVersion(rec: PromptRecord, version: PromptVersion): PromptRecord; export interface GardenSeed { id: string; name: string; mode: PromptMode; lang: 'zh' | 'en'; tags: string[]; content: string; } /** 一小撮高频起手模板,给「不知道从哪写起」的用户一个起点。 */ export declare const PROMPT_GARDEN: GardenSeed[];