use super::AgentSession;
use crate::commands::{CommandContext, CommandOutput, CommandRegistry, SlashCommand};
use std::sync::{Arc, MutexGuard};
pub(super) fn registry(session: &AgentSession) -> MutexGuard<'_, CommandRegistry> {
session
.command_registry
.lock()
.expect("command_registry lock poisoned")
}
pub(super) fn register(session: &AgentSession, cmd: Arc<dyn SlashCommand>) {
registry(session).register(cmd);
}
pub(super) fn dispatch(
session: &AgentSession,
prompt: &str,
ctx: &CommandContext,
) -> Option<CommandOutput> {
registry(session).dispatch(prompt, ctx)
}