import { VisionModelConfig } from './vision-engine'; /** Prompt 类型 */ export type PromptCommand = 'execute' | 'analyze' | 'split' | 'plan'; /** 技术栈信息 */ export interface TechStack { language?: string; framework?: string; database?: string; cache?: string; frontend?: string; } /** API 接口定义 */ export interface ApiSpec { method: string; path: string; description: string; requestBody?: string; responseBody?: string; } /** 数据模型 */ export interface DataModel { name: string; table?: string; fields: { name: string; type: string; description: string; }[]; } /** 业务规则 */ export interface BusinessRule { rule: string; condition?: string; } /** 任务额外上下文文件 */ export interface TaskExtraSpec { name: string; path: string; content: string; } /** 全局知识库目录条目 */ export interface TOCEntry { /** 文件相对路径(如 synthesis/ARCHITECTURE.md) */ path: string; /** 文件简述 */ description: string; /** ## 标题列表 */ sections: string[]; /** 首段摘要(标题后第一段非空内容,≤200字) */ summary?: string; /** 涉及的端列表(从路径/内容推断) */ platforms?: string[]; /** 文件行数(AI 判断阅读成本) */ lineCount?: number; /** 关键词标签(从 ## 标题提取核心词) */ tags?: string[]; } /** 全局上下文(从 GLOBAL 层注入) */ export interface GlobalContext { /** 全局索引摘要(INDEX.md 全文,必读) */ indexSummary?: string; /** v8.3.129+: 关键全局文件全文注入(BUSINESS_RULES.md 等) */ keyFileSummaries?: { path: string; content: string; }[]; /** 全局知识库目录(AI 按需 Read) */ toc: TOCEntry[]; } /** SpecCore 结构化 Prompt */ export interface SpecCorePrompt { marker: '[SPECCORE_PROMPT]'; version: string; command: PromptCommand; iteration: string; task?: string; platform?: string; techStack: TechStack; apiSpecs: ApiSpec[]; dataModels: DataModel[]; businessRules: BusinessRule[]; extraSpecs: TaskExtraSpec[]; globalContext?: GlobalContext; taskContext?: string; projectPaths?: string; rulesContent?: string; codeGraphSummary?: string; keyConstraints?: string[]; contextBudget?: number; instruction: string; outputHint: string; agentContext?: string; subagent?: string; rawPrompt?: string; } /** * 加载全局上下文(带 TOC 缓存) * 策略:必读的 INDEX.md 直接注入 + 其余文件只给目录,AI 自己 Read */ export declare function loadGlobalContext(cwd: string, _command: PromptCommand, platform?: string, feature?: string): Promise; /** * 格式化全局上下文为 Markdown 字符串(供 formatPrompt 和 split.ts 共用) */ export declare function formatGlobalContext(ctx: GlobalContext, platform?: string): string; export declare function buildPrompt(command: PromptCommand, options: { cwd?: string; iteration?: string; task?: string; taskDir?: string; platform?: string; contextType?: 'full' | 'incremental' | 'platform-only' | 'contract-only'; contextBudget?: number; subagent?: string; analyzeOptions?: any; withCode?: boolean; }): Promise; /** * 将 Prompt 序列化为 AI 可读的文本(输出到 stdout) * 带动态裁剪:超出预算时按优先级逐级简化 */ export declare function formatPrompt(prompt: SpecCorePrompt, maxTokens?: number): string; /** 实际构建 prompt 文本(无裁剪逻辑) */ export declare function buildPromptText(prompt: SpecCorePrompt): string; /** * 解析 AI 返回的 JSON 文件列表 */ /** v8.3.124+: 解析 AI 响应中的 INFO_GAP 标记 */ export declare function extractInfoGaps(response: string): string[]; export declare function parseAiResponse(response: string): { files: { path: string; content: string; }[]; infoGaps?: string[]; } | null; /** 缺参数请求 */ export interface NeedsInfoRequest { marker: '[SPECCORE_NEEDS_INFO]'; command: string; missing: string[]; provided: Record; hint: string; availableOptions?: { iterations?: string[]; tasks?: string[]; platforms?: string[]; }; } /** * 输出缺参数请求到 stdout,退出码 11。 * 重格式:包含命令说明、参数表、可用选项、使用示例、推荐命令。 */ export declare function outputNeedsInfo(req: Omit): void; /** 每次 buildPrompt 开始时重置(避免跨命令串味) */ export declare function resetAssetAudit(): void; /** 生成资产审计块(无记录时返回空串) */ export declare function getAssetAuditText(): string; /** * 统一处理 Markdown 内容:展开链接 + 提取图片 * 在 loadExtraSpecs / loadAllTaskContext 的文件加载后调用 * v8.3.97+: 导出供 analyze-engine / analyze 命令使用 */ export declare function processMarkdownContent(content: string, filePath: string, seenPaths: Set, visionConfig?: VisionModelConfig, options?: { maxLinkDepth?: number; maxLinkChars?: number; maxSvgChars?: number; }): Promise; /** * v8.3.344+: 扫描迭代素材资产(原型 HTML + 参考截图/设计稿/提取图片)。 * 补齐盲区:此前只有「被已加载文档以 Markdown 链接引用」的资产会进入上下文, * 010-requirements/prototypes/ 与 assets/ 下未被引用的原型/截图完全无通道。 * 策略:CLI 渲染 HTML 原型语义结构(ARIA 树 + 截图)与视觉描述关键图片, * 其余列路径清单——宿主 AI 按需打开原文件。限额防撑爆上下文。 * 导出供单测直接调用(构造临时迭代目录即可验证注入行为)。 */ export declare function collectIterationMediaAssets(iterDir: string, visionConfig?: VisionModelConfig): Promise; //# sourceMappingURL=prompt-builder.d.ts.map