/** * ask — SpecCore 万能 AI 入口引擎 * 四种模式:命令解释(explain) / 任务指引(guide) / 意图匹配(match) / 复杂编排(pipeline) */ import { type PlatformConfig } from './unified-config'; /** ask 模式 */ export type AskMode = 'explain' | 'guide' | 'match' | 'pipeline' | 'ambiguous'; /** 命令知识条目 */ export interface CommandKnowledge { name: string; aliases: string[]; description: string; usage: string; examples: string[]; related: string[]; triggers: string[]; /** * 同分 tie-break 显式优先级(缺省 0,值大者赢)。 * 歧义词条(如「验证」同挂 verify/validate)靠此裁决,不依赖数组声明顺序; * 新增词条若与现有词条共享触发词,必须显式声明 priority。 */ priority?: number; } /** Pipeline 步骤 */ export interface PipelineStep { order: number; command: string; args: string; explanation: string; dependsOn?: number; subagent?: string; } /** Pipeline 计划 */ export interface PipelinePlan { steps: PipelineStep[]; input: string; confirm: boolean; } /** Ask 结果 */ export interface AskResult { mode: AskMode; summary: string; detail: string; commands: string[]; pipeline?: PipelinePlan; /** AI 模式下可直接执行的命令(自动而非打印给人) */ autoExec?: { command: string; args: string; confirm?: boolean; }; /** 按需注入的项目名片块(用户句中出现端名/业务名/类型词时命中,未命中为空) */ projectCards?: string; } /** Ask 引擎选项 */ export interface AskEngineOptions { /** 显式 speccore 调用(来自 /spec-ask Skill),跳过意图域确认 */ explicit?: boolean; } declare const COMMAND_KB: CommandKnowledge[]; declare const WORKFLOWS: Record; /** 判断问句属于哪种模式 */ export declare function classifyMode(input: string): AskMode; export declare function askEngine(input: string, options?: AskEngineOptions): Promise; /** 从用户输入中提取时间 → YYYY-MM-DD HH:mm:ss */ export declare function extractTime(input: string): string; export { COMMAND_KB, WORKFLOWS }; /** * 从用户原话中解析端名(先标准端名 name,再中文描述 description/project_name)。 * 标准端名取最长命中,避免短名子串误伤(如 api 命中 admin-web 里的 api)。 */ export declare function resolvePlatformFromInput(input: string, platforms: PlatformConfig[]): PlatformConfig | null; /** * 从用户原话中解析端列表(多端,v8.3.381+)。优先级: * 1. 精确单端命中(端名/中文描述/工程名)——最具体意图优先, * 防止「会议预订后端工程」被类型词扩成所有后端; * 2. 类型词命中——「前端/前端项目」→ 全部 frontend 端,「后端/后端项目」→ 全部 backend 端, * 前后端同现 → 两类并集; * 3. 全量词命中——「所有端/所有工程/所有项目」→ 全部端; * 4. 无命中 → 空数组。 */ export declare function resolvePlatformsFromInput(input: string, platforms: PlatformConfig[]): PlatformConfig[]; /** * v8.3.255+/393+: 解析 global 命令族子命令,收口「技术分析 vs 反推需求」的语义分流: * - 反推词(fromCode 或句含「反推/逆向/生成需求」)→ from-source(源码反推需求文档) * - 显式要产品层(产品层/产品文档/需求文档/产品视角)→ analyze(保留 4a 产品层) * - 其余中性句(「全局分析…源码」等)→ analyze --no-product(纯技术文档,不再顺手反推需求) * 「分析源码」本身不携带产出物信息,默认按纯技术解读,需求文档仅在明确要求时生成。 */ export declare function resolveGlobalSubCommand(input: string, fromCode?: string | boolean): 'from-source' | 'analyze' | 'analyze --no-product'; /** * 为 global from-source 命令自动补端参数: * 用户句中出现 PROJECT.yaml 端名/描述或「前端/后端/所有端」类型词 → * --platform + --src (配了才加)。 * 配置加载失败时静默返回原命令,不影响主流程。 */ export declare function enrichFromSourceCommand(input: string, fullCommand: string): Promise<{ command: string; note?: string; }>; //# sourceMappingURL=ask-engine.d.ts.map