/** * platform-inference.ts — 功能单元端推断(六层机制) * * 六层递进(确定性 → 概率性): * Layer 1 显式声明 —— 需求文档中「涉及端」字段(置信度 1.0) * Layer 2 _matrix 声明 —— 010-requirements/features/{feature}/_matrix.md(置信度 0.95) * Layer 3 目录结构 —— 功能单元目录下的端子目录(置信度 0.9) * Layer 4 关键词映射 —— 功能名/需求里的端关键词(置信度 0.75) * Layer 5 宿主 AI —— 前四层都无法确定时,生成判断 prompt(置信度 0.5) * Layer 6 人工确认 —— 置信度 < 0.8 或端数 > 3 时,标记需确认 * * 原则:优先确定性机制,AI 只作补充,人工确认兜底。确认后写入 _matrix.md 持久化。 * * v8.3.185+ */ export type PlatformInferenceSource = 'explicit' | 'matrix' | 'directory' | 'keyword' | 'ai-required' | 'none'; export interface PlatformInferenceResult { platforms: string[]; confidence: number; source: PlatformInferenceSource; uncertainties: string[]; needsConfirm: boolean; aiPrompt?: string; } export interface InferFeaturePlatformsOptions { featureName: string; /** 功能单元目录(010-requirements/features/{feature}/),用于读 _matrix.md + 目录结构 */ featureDir?: string; /** 需求文档内容(显式声明检测 + 关键词) */ requirementContent?: string; /** CONSTITUTION 端列表(全部标准端名) */ allPlatforms: string[]; } export declare function inferFeaturePlatforms(options: InferFeaturePlatformsOptions): Promise; /** * v8.3.279: 把高置信度推断结果写回 _matrix.md 的 platforms 字段(持久化)。 * 只替换 platforms 块(保持 feature/type/dependencies/apis 其余字段不变), * 并在块上方标注推断来源与置信度注释(可人工修改);重复写回时旧注释不叠加。 */ export declare function persistInferredPlatforms(featureDir: string, platforms: string[], source: PlatformInferenceSource, confidence: number): Promise; /** * v8.3.279: 对「声明为空」的单元批量跑六层推断,高置信度结果写回 _matrix.md。 * 返回合并后的「单元 → 声明端」映射与推断过程清单。 * 已声明单元不重复推断(幂等);前四层无结果(需 AI/人工)的单元记入 pending,全端兜底。 */ export declare function inferAndPersistFeaturePlatforms(featuresDir: string, features: string[], allPlatforms: string[], existingMap: Map): Promise<{ map: Map; inferred: { feature: string; platforms: string[]; source: PlatformInferenceSource; confidence: number; }[]; pending: string[]; }>; /** * AI/人工确认后的单元矩阵回写:platforms + 可选 dependencies/apis。 * platforms 走 persistInferredPlatforms(source=explicit,置信度 1.0, * 带「推断来源」注释可人工改);dependencies/apis 行级替换(保留其余字段)。 */ export declare function persistConfirmedUnitMatrix(featureDir: string, platforms: string[], dependencies?: string[], apis?: string[]): Promise; /** 切分后端分析结果 */ export interface PostUnitizePlatformAnalysis { /** 确定性来源自动回写的单元 */ autoWritten: { feature: string; platforms: string[]; source: PlatformInferenceSource; confidence: number; }[]; /** 已声明单端、但检出额外可能端的单元(不自动覆盖,交宿主 AI 确认) */ expandCandidates: { feature: string; declared: string[]; extra: string[]; aiPrompt: string; }[]; /** 前四层无果、需 AI 语义判断的单元 */ pending: { feature: string; aiPrompt: string; }[]; } /** * v8.3.362+: 切分完成后立即分析功能单元的涉及端(方案 A 落地)。 * - 声明为空 → 六层推断,确定性来源(explicit/directory/keyword)自动回写 _matrix; * - 声明非空 → keyword 层检出声明外的额外端 → 超集候选,不自动覆盖单端声明; * - 前四层无果 → 输出 AI 判断 prompt,宿主 AI 判断后经 unitize --confirm-platforms 回写。 */ export declare function analyzeUnitPlatformsAfterUnitize(featuresDir: string, unitNames: string[], allPlatforms: string[]): Promise; //# sourceMappingURL=platform-inference.d.ts.map