Look up an agent adapter by name, returning an error if not found. This is a convenience method for CLI commands that need to validate the agent name and produce a helpful error message.
(&self, name: &str)
| 342 | /// This is a convenience method for CLI commands that need to validate |
| 343 | /// the agent name and produce a helpful error message. |
| 344 | pub fn require(&self, name: &str) -> AgentResult<&dyn AgentHook> { |
| 345 | self.get(name).ok_or_else(|| AgentError::AgentNotFound { |
| 346 | name: name.to_string(), |
| 347 | available: self.list().to_vec().join(", "), |
| 348 | }) |
| 349 | } |
| 350 | |
| 351 | /// Returns a list of all registered agent names, sorted alphabetically. |
| 352 | /// |