use crate::command::chat::permission_queue::AgentType;
use std::cell::RefCell;
use std::path::PathBuf;
thread_local! {
static CURRENT_AGENT_NAME: RefCell<String> = RefCell::new("Main".to_string());
static CURRENT_AGENT_TYPE: RefCell<AgentType> = const { RefCell::new(AgentType::Main) };
static THREAD_CWD: RefCell<Option<PathBuf>> = const { RefCell::new(None) };
}
pub fn set_current_agent_name(name: &str) {
CURRENT_AGENT_NAME.with(|cell| {
*cell.borrow_mut() = name.to_string();
});
}
pub fn set_current_agent_type(agent_type: AgentType) {
CURRENT_AGENT_TYPE.with(|cell| {
*cell.borrow_mut() = agent_type;
});
}
pub fn current_agent_name() -> String {
CURRENT_AGENT_NAME.with(|cell| cell.borrow().clone())
}
pub fn current_agent_type() -> AgentType {
CURRENT_AGENT_TYPE.with(|cell| cell.borrow().clone())
}
pub fn set_thread_cwd(path: &std::path::Path) {
THREAD_CWD.with(|cell| {
*cell.borrow_mut() = Some(path.to_path_buf());
});
}
pub fn thread_cwd() -> Option<PathBuf> {
THREAD_CWD.with(|cell| cell.borrow().clone())
}
pub fn clear_thread_cwd() {
THREAD_CWD.with(|cell| {
*cell.borrow_mut() = None;
});
}