feat: Skills 渐进式披露机制 — Anthropic SKILL.md 解析器 + 文件加载

This commit is contained in:
carry
2026-06-07 22:51:44 +08:00
parent 513ab249fb
commit e47587f492
14 changed files with 1705 additions and 6 deletions
+12
View File
@@ -82,12 +82,24 @@ export interface SkillSegment {
* 第 2 层 — 详细描述 + 触发条件(点击展开单个 skill)
* 第 3 层 — 完整指令(再次点击展开 —— 触发时作为一条新消息追加到对话中)
*/
/**
* Skill 遵循 Anthropic 渐进式披露机制:
*
* 第 1 层 — 名称 + 一句话描述(始终可见,在 skills 面板中)
* 第 2 层 — 详细说明 + 触发条件(点击展开单个 skill)
* 第 3 层 — 完整指令(再次点击展开 —— 触发时注入上下文的 system prompt
*
* format 字段区分来源:
* 'custom' — 手工编写的 skill(使用 detail/triggers/instructions 自定义)
* 'anthropic' — 从 SKILL.md 解析(instructions 为原始 body
*/
export interface SkillItem {
name: string
description: string // 第 1 层:一句话描述
detail?: string // 第 2 层:详细说明(功能、输入输出、适用场景)
triggers?: string[] // 第 2 层:触发条件(用户说哪些话会触发此 skill)
instructions?: string // 第 3 层:注入 LLM 上下文的完整 system prompt
format?: 'custom' | 'anthropic' // 来源格式
}
export interface ToolOverviewSegment {