feat: created built-in functions for listing, loading, and unloading skills

This commit is contained in:
2026-06-01 12:58:42 -06:00
parent aa2e627a5f
commit cdc4bd154a
5 changed files with 334 additions and 7 deletions
+15
View File
@@ -1,3 +1,4 @@
pub(crate) mod skill;
pub(crate) mod supervisor;
pub(crate) mod todo;
pub(crate) mod user_interaction;
@@ -32,6 +33,7 @@ use std::{
process::{Command, Stdio},
};
use strum_macros::AsRefStr;
use skill::SKILL_FUNCTION_PREFIX;
use supervisor::SUPERVISOR_FUNCTION_PREFIX;
use todo::TODO_FUNCTION_PREFIX;
use user_interaction::USER_FUNCTION_PREFIX;
@@ -353,6 +355,12 @@ impl Functions {
self.declarations.extend(todo::todo_function_declarations());
}
#[allow(dead_code)]
pub fn append_skill_functions(&mut self) {
self.declarations
.extend(skill::skill_function_declarations());
}
pub fn append_supervisor_functions(&mut self) {
self.declarations
.extend(supervisor::supervisor_function_declarations());
@@ -1039,6 +1047,13 @@ impl ToolCall {
json!({"tool_call_error": error_msg})
})
}
_ if cmd_name.starts_with(SKILL_FUNCTION_PREFIX) => {
skill::handle_skill_tool(ctx, &cmd_name, &json_data).unwrap_or_else(|e| {
let error_msg = format!("Skill tool failed: {e}");
eprintln!("{}", warning_text(&format!("⚠️ {error_msg} ⚠️")));
json!({"tool_call_error": error_msg})
})
}
_ if cmd_name.starts_with(SUPERVISOR_FUNCTION_PREFIX) => {
supervisor::handle_supervisor_tool(ctx, &cmd_name, &json_data)
.await