pub(crate) const SKILL: &str = "rho-agent-creator";
const REQUIRED_TOOLS: [&str; 5] = ["skill", "questionnaire", "read_file", "write", "rho"];
#[derive(Debug)]
pub(crate) struct MissingTools(Vec<&'static str>);
impl std::fmt::Display for MissingTools {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
formatter,
"could not start agent creator: active agent is missing required tools: {}",
self.0.join(", ")
)
}
}
impl std::error::Error for MissingTools {}
pub(crate) fn model_prompt(
request: &str,
has_tool: impl Fn(&str) -> bool,
) -> Result<String, MissingTools> {
let missing = REQUIRED_TOOLS
.into_iter()
.filter(|name| !has_tool(name))
.collect::<Vec<_>>();
if !missing.is_empty() {
return Err(MissingTools(missing));
}
Ok(if request.is_empty() {
"Create a new Rho agent through the guided workflow.".to_string()
} else {
format!("Create a new Rho agent through the guided workflow. User request: {request}")
})
}