Skip to main content

walrus_core/
paths.rs

1//! Global paths for the walrus runtime.
2//!
3//! All crates resolve configuration, socket, and data paths through these
4//! constants so there is a single source of truth.
5
6use std::path::PathBuf;
7use std::sync::LazyLock;
8
9/// Global configuration directory (`~/.openwalrus/`).
10pub static CONFIG_DIR: LazyLock<PathBuf> = LazyLock::new(|| {
11    dirs::home_dir()
12        .expect("no home directory")
13        .join(".openwalrus")
14});
15
16/// Pinned socket path (`~/.openwalrus/walrus.sock`).
17pub static SOCKET_PATH: LazyLock<PathBuf> = LazyLock::new(|| CONFIG_DIR.join("walrus.sock"));
18
19/// TCP port file (`~/.openwalrus/walrus.tcp`). Contains the port number as text.
20pub static TCP_PORT_FILE: LazyLock<PathBuf> = LazyLock::new(|| CONFIG_DIR.join("walrus.tcp"));
21
22/// Logs directory (`~/.openwalrus/logs/`).
23pub static LOGS_DIR: LazyLock<PathBuf> = LazyLock::new(|| CONFIG_DIR.join("logs"));
24
25/// Agent working directory (`~/.openwalrus/home/`).
26pub static HOME_DIR: LazyLock<PathBuf> = LazyLock::new(|| CONFIG_DIR.join("home"));
27
28/// Agents subdirectory (contains *.md files).
29pub const AGENTS_DIR: &str = "agents";
30/// Skills subdirectory.
31pub const SKILLS_DIR: &str = "skills";
32/// Data subdirectory.
33pub const DATA_DIR: &str = "data";
34
35/// SQLite memory database filename.
36pub const MEMORY_DB: &str = "memory.db";
37
38/// Default agent name used when no custom agents are configured.
39pub const DEFAULT_AGENT: &str = "walrus";