import type { LLMConfig } from '../types.js'; /** 精简的角色摘要,供 LLM 选角色用 */ export interface RoleSummary { path: string; name: string; emoji?: string; description: string; category: string; } /** * 从 agents 目录构建精简的角色目录 */ export declare function buildRoleCatalog(agentsDir: string): RoleSummary[]; /** * 格式化角色目录为紧凑文本(给 LLM 看) */ export declare function formatCatalogForPrompt(roles: RoleSummary[]): string; /** * 检测用户输入是否为英文(不包含中文字符) */ export declare function detectLang(text: string): 'zh' | 'en'; /** * 构建发给 LLM 的 system prompt * @param catalog 角色目录文本 * @param options.autoRun 如果 true,生成的 YAML 不需要 inputs,用户描述直接嵌入 task * @param options.lang 语言:'zh' 中文提示词 + agency-agents-zh,'en' 英文提示词 + agency-agents */ export declare function buildComposeSystemPrompt(catalog: string, options?: { autoRun?: boolean; provider?: string; model?: string; lang?: 'zh' | 'en'; timeoutMs?: number; }): string; /** * 构建 user prompt */ export declare function buildComposeUserPrompt(description: string, lang?: 'zh' | 'en'): string; /** * 从 LLM 回复中提取 YAML 内容 */ export declare function extractYamlFromResponse(response: string): string; /** * 根据描述生成文件名(避免覆盖已有文件) */ export declare function generateFileName(description: string, dir?: string): string; /** * 执行 compose 流程 */ export declare function composeWorkflow(options: { description: string; agentsDir: string; llmConfig: LLMConfig; outputName?: string; /** 直接运行模式:生成的 YAML 不需要 inputs */ autoRun?: boolean; /** 语言:自动检测或指定 */ lang?: 'zh' | 'en'; /** 生成的 YAML 中写入的单步超时(ms);未指定时 API=300s / ollama=600s */ timeoutMs?: number; /** 锁定阵容:只用这些角色路径(如 "engineering/xxx"),LLM 仅在其间编排 DAG/task/变量 */ pinnedRoles?: string[]; /** 保存目录;默认 workflows/。用于把合成结果写到用户目录而非随包模板目录 */ saveDir?: string; }): Promise<{ yaml: string; savedPath: string; relativePath: string; warnings: string[]; }>; /** * 确定性修复幻觉角色:对每个不存在的 role,从角色库找到"够接近"的真实路径,直接在 YAML 文本里替换。 * 不依赖再调一次 LLM——只要有可信匹配,就保证替换为库里真实存在、可运行的角色。 * 仅替换 role 值中的精确路径(双/单引号包裹),避免误伤任务描述等其它文本。 * 返回已替换列表与仍无匹配(需 LLM 兜底)的角色。 */ export declare function repairInvalidRolesInYaml(yamlPath: string, invalidRoles: string[], validRolePaths: string[]): { replaced: { from: string; to: string; }[]; unresolved: string[]; }; /** * 自动修复 compose 生成 YAML 中的变量引用错误。 * * 核心约束:替换目标必须在当前 step 的 DAG 上游(递归 depends_on 闭包)内的 step.output 集合里。 * 这避免了"早期 step 引用下游 step output"的拓扑错误(旧版策略 2 模糊匹配会把 * personal_assessment 错误地指向 final_report 这种最终汇总 output)。 * * 如果某 step 没有上游或上游 output 都对不上,bad var 留给 LLM 二次修复(repairWithLLM)。 */ export declare function autoFixVariableRefs(yamlPath: string): Promise<{ fixed: number; details: { from: string; to: string; }[]; }>;