use std::collections::HashMap;
use anyhow::{anyhow, Result};
use crate::context_mgmt::compact_messages;
use crate::conversation::message::{Message, SystemNotificationType};
use crate::recipe::build_recipe::build_recipe_from_template_with_positional_params;
use super::Agent;
pub const COMPACT_TRIGGERS: &[&str] =
&["/compact", "Please compact this conversation", "/summarize"];
pub struct CommandDef {
pub name: &'static str,
pub description: &'static str,
}
static COMMANDS: &[CommandDef] = &[
CommandDef {
name: "prompts",
description: "List available prompts, optionally filtered by extension",
},
CommandDef {
name: "prompt",
description: "Execute a prompt or show its info with --info",
},
CommandDef {
name: "compact",
description: "Compact the conversation history",
},
CommandDef {
name: "clear",
description: "Clear the conversation history",
},
CommandDef {
name: "skills",
description: "List installed skills and other available sources",
},
];
pub fn list_commands() -> &'static [CommandDef] {
COMMANDS
}
impl Agent {
pub async fn execute_command(
&self,
message_text: &str,
session_id: &str,
) -> Result