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
+1 -1
View File
@@ -1,7 +1,7 @@
use super::types::{METHOD_NOT_FOUND, PARSE_ERROR, Request, Response};
use crate::client::call_chat_completions_streaming;
use crate::config::{Input, RenderMode, RequestContext};
use crate::function::supervisor::{GuardrailAction, check_pending_tasks_guardrail};
use crate::function::agents::{GuardrailAction, check_pending_tasks_guardrail};
use crate::utils;
use crate::utils::AbortSignal;
use anyhow::Result;
+1 -1
View File
@@ -18,11 +18,11 @@ use super::{MessageContentToolCalls, prompts};
use crate::client::{Model, ModelType, list_models};
use crate::function::{
FunctionDeclaration, Functions, ToolCallTracker, ToolResult,
agents::AGENT_FUNCTION_PREFIX,
jobs::{DEFAULT_MAX_CONCURRENT_JOBS, JOB_FUNCTION_PREFIX, is_backgroundable_tool},
memory::MEMORY_FUNCTION_PREFIX,
rag_query::RAG_FUNCTION_PREFIX,
skill::SKILL_FUNCTION_PREFIX,
supervisor::AGENT_FUNCTION_PREFIX,
todo::TODO_FUNCTION_PREFIX,
user_interaction::USER_FUNCTION_PREFIX,
};
@@ -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}");
}
+1 -1
View File
@@ -2,7 +2,7 @@ use super::state::StateManager;
use super::structured;
use super::types::AgentNode;
use crate::config::RequestContext;
use crate::function::supervisor::run_agent_for_graph;
use crate::function::agents::run_agent_for_graph;
use anyhow::{Context, Result};
use serde_json::Value;
use std::time::Duration;
+1 -1
View File
@@ -6,9 +6,9 @@ use crate::config::prompts::DEFAULT_SKILL_INSTRUCTIONS;
use crate::config::{
Input, RequestContext, Role, RoleLike, SkillPolicy, should_inject_skill_instructions,
};
use crate::function::agents::{GuardrailAction, check_pending_tasks_guardrail};
use crate::function::jobs::reap_jobs;
use crate::function::skill::skill_function_declarations;
use crate::function::supervisor::{GuardrailAction, check_pending_tasks_guardrail};
use crate::utils::create_abort_signal;
use anyhow::{Context, Error, Result, anyhow, bail};
use log::warn;
+1 -1
View File
@@ -29,7 +29,7 @@ use crate::config::{
install_builtins, list_agents, load_env_file, macro_execute, sync_models,
};
use crate::config::{memory, paths};
use crate::function::supervisor::{GuardrailAction, check_pending_tasks_guardrail};
use crate::function::agents::{GuardrailAction, check_pending_tasks_guardrail};
use crate::mcp::McpServersConfig;
use crate::render::{prompt_theme, render_error};
use crate::repl::Repl;
+1 -1
View File
@@ -16,7 +16,7 @@ use crate::config::{
StateFlags, flatten_prompt_messages, macro_execute, resolve_prompt_args, sanitize_display_text,
};
use crate::config::{AssetCategory, paths};
use crate::function::supervisor::{GuardrailAction, check_pending_tasks_guardrail};
use crate::function::agents::{GuardrailAction, check_pending_tasks_guardrail};
use crate::render::render_error;
use crate::utils::{
AbortSignal, SHELL, abortable_run_with_spinner, create_abort_signal, dimmed_text,