refactor(function): finish supervisor-to-agent vocabulary migration

The supervisor registry went kind-generic (TaskHandle::Agent | Job)
earlier in this branch, but the module holding the agent__* handlers
and two model-facing error strings still carried the old name:

- src/function/supervisor.rs -> src/function/agents.rs (it contains
  only agent__* tool handlers, pairing with function/jobs.rs; the
  kind-generic src/supervisor/ registry keeps its name)
- 'Supervisor tool failed' -> 'Agent tool failed'
- 'Unknown supervisor action' -> 'Unknown agent action'
This commit is contained in:
2026-08-26 14:57:36 -06:00
parent 304b8f635f
commit 429ae3cc8e
9 changed files with 18 additions and 18 deletions
@@ -524,7 +524,7 @@ pub async fn handle_agent_tool(
"task_complete" => handle_task_complete(ctx, args).await,
"task_fail" => handle_task_fail(ctx, args),
"reply_escalation" => handle_reply_escalation(ctx, args),
_ => bail!("Unknown supervisor action: {action}"),
_ => bail!("Unknown agent action: {action}"),
}
}
@@ -2150,7 +2150,7 @@ mod tests {
result
.unwrap_err()
.to_string()
.contains("Unknown supervisor action")
.contains("Unknown agent action")
);
}
+2 -2
View File
@@ -1,7 +1,7 @@
use super::agents::AGENT_FUNCTION_PREFIX;
use super::memory::MEMORY_FUNCTION_PREFIX;
use super::rag_query::RAG_FUNCTION_PREFIX;
use super::skill::SKILL_FUNCTION_PREFIX;
use super::supervisor::AGENT_FUNCTION_PREFIX;
use super::todo::TODO_FUNCTION_PREFIX;
use super::user_interaction::USER_FUNCTION_PREFIX;
use super::{FunctionDeclaration, JsonSchema, PATH_SEP, mcp_error_display, render_tool_result};
@@ -1217,7 +1217,7 @@ fn tail_chars(text: &str, max_chars: usize) -> Option<String> {
mod tests {
use super::*;
use crate::config::{AppConfig, AppState, WorkingMode};
use crate::function::supervisor::{
use crate::function::agents::{
GuardrailAction, check_pending_tasks_guardrail, handle_agent_tool,
};
use crate::supervisor::mailbox::Inbox;
+8 -8
View File
@@ -1,8 +1,8 @@
pub(crate) mod agents;
pub(crate) mod jobs;
pub(crate) mod memory;
pub(crate) mod rag_query;
pub(crate) mod skill;
pub(crate) mod supervisor;
pub(crate) mod todo;
pub(crate) mod user_interaction;
@@ -24,6 +24,7 @@ use crate::mcp::{
McpServersConfig, is_mcp_meta_function, render,
};
use crate::parsers::{bash, python, typescript};
use agents::AGENT_FUNCTION_PREFIX;
use anyhow::{Context, Result, anyhow, bail};
use futures_util::future;
use indexmap::IndexMap;
@@ -48,7 +49,6 @@ use std::{
time::{Duration, Instant},
};
use strum_macros::AsRefStr;
use supervisor::AGENT_FUNCTION_PREFIX;
use todo::TODO_FUNCTION_PREFIX;
use user_interaction::USER_FUNCTION_PREFIX;
@@ -684,9 +684,9 @@ impl Functions {
pub fn append_supervisor_functions(&mut self) {
self.declarations
.extend(supervisor::agent_function_declarations());
.extend(agents::agent_function_declarations());
self.declarations
.extend(supervisor::escalation_function_declarations());
.extend(agents::escalation_function_declarations());
}
pub fn append_job_functions(&mut self) {
@@ -700,7 +700,7 @@ impl Functions {
pub fn append_teammate_functions(&mut self) {
self.declarations
.extend(supervisor::teammate_function_declarations());
.extend(agents::teammate_function_declarations());
}
pub fn append_user_interaction_functions(&mut self) {
@@ -1595,10 +1595,10 @@ impl ToolCall {
})
}
_ if cmd_name.starts_with(AGENT_FUNCTION_PREFIX) => {
supervisor::handle_agent_tool(ctx, &cmd_name, &json_data)
agents::handle_agent_tool(ctx, &cmd_name, &json_data)
.await
.unwrap_or_else(|e| {
let error_msg = format!("Supervisor tool failed: {e}");
let error_msg = format!("Agent tool failed: {e}");
eprintln!("{}", muted_warning_text(&format!("⚠️ {error_msg} ⚠️")));
json!({"tool_call_error": error_msg})
})
@@ -4743,7 +4743,7 @@ mod tests {
run_async(call_with_args("agent__check", json!({"id": "x"})).eval(&mut ctx)).unwrap();
let err = out["tool_call_error"].as_str().unwrap();
assert!(err.starts_with("Supervisor tool failed"), "{err}");
assert!(err.starts_with("Agent tool failed"), "{err}");
assert!(err.contains("No supervisor active"), "{err}");
}