zeph_commands/handlers/
misc.rs1use std::future::Future;
7use std::pin::Pin;
8
9use crate::context::CommandContext;
10use crate::{CommandError, CommandHandler, CommandOutput, SlashCategory};
11
12pub struct CacheStatsCommand;
14
15impl CommandHandler<CommandContext<'_>> for CacheStatsCommand {
16 fn name(&self) -> &'static str {
17 "/cache-stats"
18 }
19
20 fn description(&self) -> &'static str {
21 "Show tool orchestrator cache statistics"
22 }
23
24 fn category(&self) -> SlashCategory {
25 SlashCategory::Debugging
26 }
27
28 fn handle<'a>(
29 &'a self,
30 ctx: &'a mut CommandContext<'_>,
31 _args: &'a str,
32 ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
33 Box::pin(async move {
34 let result = ctx.agent.cache_stats();
35 Ok(CommandOutput::Message(result))
36 })
37 }
38}
39
40pub struct ImageCommand;
45
46impl CommandHandler<CommandContext<'_>> for ImageCommand {
47 fn name(&self) -> &'static str {
48 "/image"
49 }
50
51 fn description(&self) -> &'static str {
52 "Attach an image to the next message"
53 }
54
55 fn args_hint(&self) -> &'static str {
56 "<path>"
57 }
58
59 fn category(&self) -> SlashCategory {
60 SlashCategory::Integration
61 }
62
63 fn handle<'a>(
64 &'a self,
65 ctx: &'a mut CommandContext<'_>,
66 args: &'a str,
67 ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
68 Box::pin(async move {
69 if args.is_empty() {
70 return Ok(CommandOutput::Message("Usage: /image <path>".to_owned()));
71 }
72 let result = ctx.agent.load_image(args).await?;
73 Ok(CommandOutput::Message(result))
74 })
75 }
76}