use std::future::Future;
use std::pin::Pin;
use crate::context::CommandContext;
use crate::{CommandError, CommandHandler, CommandOutput, SlashCategory};
pub struct GoalCommand;
impl CommandHandler<CommandContext<'_>> for GoalCommand {
fn name(&self) -> &'static str {
"/goal"
}
fn description(&self) -> &'static str {
"Manage long-horizon goals that persist across conversation turns"
}
fn args_hint(&self) -> &'static str {
"create <text> [--budget N] | pause | resume | complete | clear | status | list"
}
fn category(&self) -> SlashCategory {
SlashCategory::Session
}
fn handle<'a>(
&'a self,
ctx: &'a mut CommandContext<'_>,
args: &'a str,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
Box::pin(async move {
let result = ctx.agent.handle_goal(args).await.unwrap_or_else(|e| e.0);
Ok(CommandOutput::Message(result))
})
}
}