| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- # -*- coding: utf-8 -*-
- """
- Skills 发现与辅助模块
- Skills 的实际定义现在位于各子目录的 SKILL.md 文件中:
- - src/skills/click-interpret-tun/SKILL.md 点选数据解读
- - src/skills/dialog-interpret/SKILL.md 对话式数据解读
- DeepAgents 的 create_deep_agent(skills=[...]) 参数直接加载这些目录,
- 读取 SKILL.md 的 YAML frontmatter 实现渐进式披露。
- 添加新 Skill 的步骤:
- 1. 在 src/skills/ 下创建新目录
- 2. 在该目录中创建 SKILL.md(含 YAML frontmatter)
- 3. 在 vent_agent.py 中添加对应的路径常量
- 4. 在 create_deep_agent() 的 skills= 参数中引用
- """
- from pathlib import Path
- # Skills 根目录
- SKILLS_ROOT = Path(__file__).parent
- def list_skills():
- """发现所有可用的 Skill 目录(包含 SKILL.md 的目录)。"""
- skills = []
- for d in sorted(SKILLS_ROOT.iterdir()):
- if d.is_dir() and (d / "SKILL.md").exists():
- skills.append(str(d))
- return skills
- def get_skill_path(name: str):
- """获取指定 Skill 的路径。"""
- path = SKILLS_ROOT / name
- if path.is_dir() and (path / "SKILL.md").exists():
- return str(path)
- return None
- if __name__ == "__main__":
- print("Available skills:")
- for s in list_skills():
- print(f" {s}")
|