1use std::path::PathBuf;
7use std::sync::LazyLock;
8
9pub static CONFIG_DIR: LazyLock<PathBuf> = LazyLock::new(|| {
11 dirs::home_dir()
12 .expect("no home directory")
13 .join(".crabtalk")
14});
15
16pub static RUN_DIR: LazyLock<PathBuf> = LazyLock::new(|| CONFIG_DIR.join("run"));
18
19#[cfg(unix)]
21pub static SOCKET_PATH: LazyLock<PathBuf> = LazyLock::new(|| RUN_DIR.join("crabtalk.sock"));
22
23pub static TCP_PORT_FILE: LazyLock<PathBuf> = LazyLock::new(|| RUN_DIR.join("crabtalk.port"));
25
26pub static LOGS_DIR: LazyLock<PathBuf> = LazyLock::new(|| CONFIG_DIR.join("logs"));
28
29pub const CONFIG_FILE: &str = "config.toml";
31pub const SETTINGS_FILE: &str = "local/settings.toml";
33pub const LOCAL_DIR: &str = "local";
35pub const PLUGINS_DIR: &str = "plugins";
37pub const AGENTS_DIR: &str = "local/agents";
39pub const SKILLS_DIR: &str = "local/skills";
41
42pub static TOKENS_DIR: LazyLock<PathBuf> = LazyLock::new(|| CONFIG_DIR.join("tokens"));
44
45pub const DEFAULT_AGENT: &str = "crab";
47
48pub fn service_port_file(name: &str) -> PathBuf {
50 RUN_DIR.join(format!("{name}.port"))
51}
52
53pub fn service_log_path(name: &str) -> PathBuf {
55 LOGS_DIR.join(format!("{name}.log"))
56}