zeph_commands/handlers/
agent_cmd.rs1use std::future::Future;
7use std::pin::Pin;
8
9use crate::context::CommandContext;
10use crate::{CommandError, CommandHandler, CommandOutput, SlashCategory};
11
12pub struct AgentCommand;
18
19impl CommandHandler<CommandContext<'_>> for AgentCommand {
20 fn name(&self) -> &'static str {
21 "/agent"
22 }
23
24 fn description(&self) -> &'static str {
25 "Manage sub-agents"
26 }
27
28 fn args_hint(&self) -> &'static str {
29 "[subcommand]"
30 }
31
32 fn category(&self) -> SlashCategory {
33 SlashCategory::Integration
34 }
35
36 fn handle<'a>(
37 &'a self,
38 ctx: &'a mut CommandContext<'_>,
39 args: &'a str,
40 ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
41 Box::pin(async move {
42 let input = if args.is_empty() {
43 "/agent".to_owned()
44 } else {
45 format!("/agent {args}")
46 };
47 match ctx.agent.handle_agent_dispatch(&input).await? {
48 Some(msg) => Ok(CommandOutput::Message(msg)),
49 None => Ok(CommandOutput::Silent),
50 }
51 })
52 }
53}