feat: 移除 SkillListTool,简化技能管理工具

This commit is contained in:
oudecheng 2026-05-22 14:01:22 +08:00
parent 5f0fdb7b2e
commit 2724334d52
3 changed files with 13 additions and 51 deletions

View File

@ -7,7 +7,7 @@ use crate::storage::{MemoryRepository, SchedulerJobRepository, SkillEventReposit
use crate::tools::{ use crate::tools::{
BashTool, CalculatorTool, FileEditTool, FileReadTool, FileWriteTool, BashTool, CalculatorTool, FileEditTool, FileReadTool, FileWriteTool,
HttpRequestTool, MemoryManageTool, MemorySearchTool, HttpRequestTool, MemoryManageTool, MemorySearchTool,
SchedulerManageTool, SessionMessageSender, SessionSendTool, SkillActivateTool, SkillListTool, SchedulerManageTool, SessionMessageSender, SessionSendTool, SkillActivateTool,
SkillManageTool, SubAgentRuntime, TaskTool, TimeTool, SkillManageTool, SubAgentRuntime, TaskTool, TimeTool,
ToolRegistry, WebFetchTool, ToolRegistry, WebFetchTool,
}; };
@ -102,9 +102,6 @@ impl ToolRegistryFactory {
self.skill_events.clone(), self.skill_events.clone(),
)); ));
} }
if self.is_enabled("skill_list") {
registry.register(SkillListTool::new(self.skills.clone()));
}
if self.is_enabled("skill_manage") { if self.is_enabled("skill_manage") {
registry.register(SkillManageTool::new(self.skills.clone())); registry.register(SkillManageTool::new(self.skills.clone()));
} }
@ -180,9 +177,6 @@ impl ToolRegistryFactory {
self.skill_events.clone(), self.skill_events.clone(),
)); ));
} }
if self.is_enabled("skill_list") {
registry.register(SkillListTool::new(self.skills.clone()));
}
// 进度通知工具 // 进度通知工具
if self.is_enabled("session_send") { if self.is_enabled("session_send") {

View File

@ -33,7 +33,7 @@ pub use session_send::{
}; };
pub use schema::{CleaningStrategy, SchemaCleanr}; pub use schema::{CleaningStrategy, SchemaCleanr};
pub use skill_activate::SkillActivateTool; pub use skill_activate::SkillActivateTool;
pub use skill_manage::{SkillListTool, SkillManageTool}; pub use skill_manage::SkillManageTool;
pub use task::{ pub use task::{
DefaultSubAgentRuntime, InMemoryTaskRepository, SubAgentRuntime, SubAgentRuntimeConfig, DefaultSubAgentRuntime, InMemoryTaskRepository, SubAgentRuntime, SubAgentRuntimeConfig,
TaskError, TaskRepository, TaskTool, TaskError, TaskRepository, TaskTool,

View File

@ -10,22 +10,12 @@ pub struct SkillManageTool {
skills: Arc<SkillRuntime>, skills: Arc<SkillRuntime>,
} }
pub struct SkillListTool {
skills: Arc<SkillRuntime>,
}
impl SkillManageTool { impl SkillManageTool {
pub fn new(skills: Arc<SkillRuntime>) -> Self { pub fn new(skills: Arc<SkillRuntime>) -> Self {
Self { skills } Self { skills }
} }
} }
impl SkillListTool {
pub fn new(skills: Arc<SkillRuntime>) -> Self {
Self { skills }
}
}
#[async_trait] #[async_trait]
impl Tool for SkillManageTool { impl Tool for SkillManageTool {
fn name(&self) -> &str { fn name(&self) -> &str {
@ -33,7 +23,16 @@ impl Tool for SkillManageTool {
} }
fn description(&self) -> &str { fn description(&self) -> &str {
"Manage PicoBot skills stored under .picobot/skills or ~/.picobot/skills, while discovery also reads .agents/skills, ~/.agents/skills, .openclaw/skills, and ~/.openclaw/skills. Supports actions: list, get, create, update, delete, disable, reload." "Manage PicoBot skills. Actions: list, get, create, update, delete, disable, reload.\n\n\
Skill Structure:\n\
- Folder name: kebab-case (lowercase with hyphens, e.g., 'my-cool-skill')\n\
- Required: SKILL.md with YAML frontmatter + Markdown body\n\
- Optional folders: scripts/, references/, assets/\n\
- Storage: .picobot/skills/{name}/SKILL.md or ~/.picobot/skills/{name}/SKILL.md\n\n\
Installing from Zip:\n\
- Extract skill folders to skills/ directory\n\
- If zip contains multiple skills, extract each subfolder separately\n\
- Final structure: skills/{skill-name}/SKILL.md"
} }
fn parameters_schema(&self) -> serde_json::Value { fn parameters_schema(&self) -> serde_json::Value {
@ -52,7 +51,7 @@ impl Tool for SkillManageTool {
}, },
"name": { "name": {
"type": "string", "type": "string",
"description": "Skill name" "description": "Skill folder name in kebab-case (e.g., 'my-cool-skill', 'code-review'). Must match the folder name under .picobot/skills/ or ~/.picobot/skills/"
}, },
"names": { "names": {
"type": "array", "type": "array",
@ -241,37 +240,6 @@ impl Tool for SkillManageTool {
} }
} }
#[async_trait]
impl Tool for SkillListTool {
fn name(&self) -> &str {
"skill_list"
}
fn description(&self) -> &str {
"List currently discovered PicoBot skills as a read-only operation. Use this when you only need to inspect available skills without modifying them."
}
fn parameters_schema(&self) -> serde_json::Value {
json!({
"type": "object",
"properties": {},
"additionalProperties": false
})
}
fn read_only(&self) -> bool {
true
}
async fn execute(&self, _args: serde_json::Value) -> anyhow::Result<ToolResult> {
Ok(ToolResult {
success: true,
output: serde_json::to_string_pretty(&list_skills_payload(&self.skills))?,
error: None,
})
}
}
fn error_result(message: &str) -> ToolResult { fn error_result(message: &str) -> ToolResult {
ToolResult { ToolResult {
success: false, success: false,