/** * Web 端 Skill 公共能力模块(next-sdk) * - 提供解析、概况、systemPrompt 拼接、按路径/名称查文档 * - 提供 createSkillTools:供 remoter 注入 get_skill_content 工具,大模型可按需加载技能文档 */ /** 单个技能的概况信息(从主 SKILL.md 的 front matter 提取) */ export interface SkillMeta { /** 技能名称,与 skill 目录名一致 */ name: string; /** 技能描述,用于 systemPrompt */ description: string; /** 主 SKILL.md 相对路径,如 ./calculator/SKILL.md */ path: string; } /** * 从主 SKILL.md 的 YAML front matter 中用正则提取 name、description */ export declare function parseSkillFrontMatter(content: string | (() => Promise)): Promise<{ name: string; description: string; } | null>; /** * 获取所有「主 SKILL.md」的路径(一级子目录下的 SKILL.md) * - 对传入的 modules 先做 normalize,兼容任意 import.meta.glob 写法 */ export declare function getMainSkillPaths(modules: Record Promise)>): Promise; /** * 获取所有技能的概况列表(name、description、path),用于 systemPrompt 或列表展示 * - 内部统一对 modules 做 normalize,避免调用方关心路径细节 */ export declare function getSkillOverviews(modules: Record Promise)>): Promise; /** * 格式化为大模型 systemPrompt 可用的技能说明文本 * @param skills 不传则需由调用方传入从 getSkillOverviews 得到的结果 */ export declare function formatSkillsForSystemPrompt(skills: SkillMeta[]): string; /** * 根据相对路径获取某个技能文档的原始内容(支持 .md、.json、.xml 等文本格式) * - 自动对 modules 做 normalize,再按 path 查找 */ export declare function getSkillMdContent(modules: Record Promise)>, path: string): Promise; /** * 根据技能 name 查找其主 SKILL.md 的路径 * 支持匹配目录名(如 ecommerce)或 SKILL.md 内 frontmatter 定义的 name * - 依赖 getMainSkillPaths,内部已做 normalize */ export declare function getMainSkillPathByName(modules: Record Promise)>, name: string): Promise; /** AI SDK Tool 类型,用于 extraTools 合并,不写死泛型避免与 ai 包版本强绑定 */ export type SkillToolsSet = Record; /** * 根据 skillMdModules 创建供 AI 调用的工具集 * - get_skill_content: 按技能名或路径获取完整文档内容,便于大模型自动识别并加载技能 * remoter 可将返回的 tools 合并进 extraTools 注入 agent */ export declare function createSkillTools(modules: Record Promise)>): SkillToolsSet;