fix: skill loading on agents

This commit is contained in:
2026-06-01 16:37:17 -06:00
parent f6b4bf05b6
commit 744dd213f5
2 changed files with 16 additions and 3 deletions
+7
View File
@@ -207,6 +207,13 @@ impl Agent {
functions.append_teammate_functions(); functions.append_teammate_functions();
functions.append_user_interaction_functions(); functions.append_user_interaction_functions();
if app.function_calling_support
&& app.skills_enabled
&& !matches!(agent_config.skills_enabled, Some(false))
{
functions.append_skill_functions();
}
agent_config.replace_tools_placeholder(&functions); agent_config.replace_tools_placeholder(&functions);
Ok(Self { Ok(Self {
+9 -3
View File
@@ -15,7 +15,7 @@ use super::{MessageContentToolCalls, prompts};
use crate::client::{Model, ModelType, list_models}; use crate::client::{Model, ModelType, list_models};
use crate::function::{ use crate::function::{
FunctionDeclaration, Functions, ToolCallTracker, ToolResult, FunctionDeclaration, Functions, ToolCallTracker, ToolResult,
user_interaction::USER_FUNCTION_PREFIX, skill::SKILL_FUNCTION_PREFIX, user_interaction::USER_FUNCTION_PREFIX,
}; };
use crate::mcp::{ use crate::mcp::{
MCP_DESCRIBE_META_FUNCTION_NAME_PREFIX, MCP_INVOKE_META_FUNCTION_NAME_PREFIX, MCP_DESCRIBE_META_FUNCTION_NAME_PREFIX, MCP_INVOKE_META_FUNCTION_NAME_PREFIX,
@@ -1145,7 +1145,9 @@ impl RequestContext {
.declarations() .declarations()
.iter() .iter()
.filter(|v| { .filter(|v| {
v.name.starts_with(USER_FUNCTION_PREFIX) && !existing.contains(&v.name) (v.name.starts_with(USER_FUNCTION_PREFIX)
|| v.name.starts_with(SKILL_FUNCTION_PREFIX))
&& !existing.contains(&v.name)
}) })
.cloned() .cloned()
.collect(); .collect();
@@ -1942,8 +1944,12 @@ impl RequestContext {
} }
_ => vec![], _ => vec![],
}; };
} else if cmd == ".edit" && args.first() == Some(&"skill") && args.len() == 2 { } else if (cmd == ".edit" && args.first() == Some(&"skill") && args.len() == 2)
|| (cmd == ".skill" && args.first() == Some(&"load") && args.len() == 2)
{
values = super::map_completion_values(paths::list_skills()); values = super::map_completion_values(paths::list_skills());
} else if cmd == ".skill" && args.first() == Some(&"unload") && args.len() == 2 {
values = super::map_completion_values(self.skill_registry.loaded_names());
} else if cmd == ".install" && args.first() == Some(&"remote") && args.len() >= 2 { } else if cmd == ".install" && args.first() == Some(&"remote") && args.len() >= 2 {
let prev = args.get(args.len() - 2).copied().unwrap_or(""); let prev = args.get(args.len() - 2).copied().unwrap_or("");
if prev == "--filter" { if prev == "--filter" {