Documentation
¶
Index ¶
Constants ¶
View Source
const SkillCallerKey skillCallKey = "skill_caller"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Skill ¶
type Skill struct {
// frontmatter 字段
Name string `yaml:"name"` // 必填,max 64 字符
Description string `yaml:"description"` // 必填,max 1024 字符
License string `yaml:"license"`
Compatibility string `yaml:"compatibility"`
AllowedTools []string `yaml:"allowed-tools"`
Metadata map[string]any `yaml:"metadata"`
Parameters map[string]any `yaml:"parameters"`
Category string `yaml:"category"`
Tags []string `yaml:"tags"`
Timeout time.Duration `yaml:"timeout"`
// 指令正文(不含 frontmatter)
Body string `yaml:"-"`
// 运行时字段
Path string `yaml:"-"`
EnvVars []string
}
Skill Agent Skill 定义
func ParseSkillMarkdown ¶
ParseSkillMarkdown 解析 Skill Markdown 文档 Skill 现在只支持指令型:frontmatter 定义元数据,正文作为指令内容返回
func (*Skill) ToToolMetadata ¶
func (s *Skill) ToToolMetadata() tools.ToolMetadata
ToToolMetadata 转换为工具元数据
type SkillFrontmatter ¶
type SkillFrontmatter struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
License string `yaml:"license"`
Compatibility string `yaml:"compatibility"`
AllowedTools string `yaml:"allowed-tools"`
Metadata map[string]any `yaml:"metadata"`
Parameters map[string]any `yaml:"parameters"`
// 自定义扩展
Category string `yaml:"category"`
Tags []string `yaml:"tags"`
Timeout int `yaml:"timeout"` // 秒
EnvVars string `yaml:"env_vars"` // 空格分隔的环境变量名
}
SkillFrontmatter 对应 SKILL.md 的 YAML frontmatter
type SkillLoader ¶
type SkillLoader struct {
// contains filtered or unexported fields
}
SkillLoader Skill 加载器
func NewSkillLoader ¶
func NewSkillLoader(registry *SkillRegistry, toolRegistry *tools.ToolRegistry) *SkillLoader
NewSkillLoader 创建 Skill 加载器
func (*SkillLoader) LoadFromDir ¶
func (sl *SkillLoader) LoadFromDir(dir string) error
LoadFromDir 从目录加载标准 Skill 目录结构
func (*SkillLoader) LoadFromFile ¶
func (sl *SkillLoader) LoadFromFile(path string) error
LoadFromFile 从 Markdown 文件加载 Skill
func (*SkillLoader) LoadFromString ¶
func (sl *SkillLoader) LoadFromString(content string) error
LoadFromString 从字符串加载 Skill
func (*SkillLoader) Register ¶
func (sl *SkillLoader) Register(skill Skill) error
Register 注册 Skill 为 Agent 可调用的工具
type SkillRegistry ¶
type SkillRegistry struct {
// contains filtered or unexported fields
}
SkillRegistry Skill 注册表
Click to show internal directories.
Click to hide internal directories.