CI / test (push) Has been cancelled
First run and backend - The companion opens without Ollama or a model (OFFLINE / SETUP REQUIRED), opens Settings > Language model and picks the model up once downloaded. - Model, provider and GPU changes apply without restarting (Ollama is restarted when launch settings change); no silent fallback from API mode. - Fatal startup errors are shown in a window; the fallback avatar loads again; the shipped Capri artwork is used when nothing was imported. Packaging and tooling - packaging/arch/PKGBUILD, capri.desktop (KWin ScreenShot2 key), icons, artwork under /usr/share/capri/assets, Gitea Actions CI. - xtask: `icons` and `release-check` (no private data or credentials). Runtime - One instance per data folder (flock + control socket): second launch shows the window; capri stop / restart / toggle / status (JSON, starts nothing) / doctor / setup / diagnostics export / purge. - A foreign program on the Ollama port is refused; an Ollama left behind by Capri is replaced. Privacy and security - No raw Ollama log on disk; API keys are never saved in plaintext (old ones move to the keyring); refused credential notes are stored as [Credentials omitted]; launched apps get an allow-listed environment. Fixes - Stop/Escape silence the voice; saved voice effects apply to replies; settings_control glitch settings apply; distinct KWin cursor scripts; KDE window capture authorized for source builds; Linux wording. - Voice pack references zipped with Windows separators are found. Wired features - Initiatives, request router, resource monitor, "clip that", questions about a snapshot, sleep mode, tap reactions, stopwatch, attachments, Internet mode button, voice-synced subtitles, wake visuals, dictation draft, tray switches, Spotify seek/shuffle/repeat; computer-control planner and classifier follow model switches and API mode. - Approval cards: one shown, 8 queued, deduplicated, cancelled on stop, failure, lock or pause; one Application access switch. Desktop - Compositor detection (no black overlay on i3 without picom), i3lock detection, unsupported desktops reported at startup, screenshot-only control without AT-SPI, fontconfig fallbacks, translatable feature pages with French translations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
2.9 KiB
Rust
84 lines
2.9 KiB
Rust
use std::path::PathBuf;
|
|
|
|
use anyhow::{Context, Result};
|
|
|
|
/// Where Capri keeps its files. `CAPRI_HOME` puts everything under one folder (tests, portable use);
|
|
/// otherwise the XDG base directories are used.
|
|
#[derive(Clone, Debug)]
|
|
pub struct Paths {
|
|
pub config: PathBuf,
|
|
pub data: PathBuf,
|
|
pub cache: PathBuf,
|
|
}
|
|
|
|
impl Paths {
|
|
pub fn discover() -> Result<Self> {
|
|
if let Some(home) = std::env::var_os("CAPRI_HOME") {
|
|
return Ok(Self::under(PathBuf::from(home)));
|
|
}
|
|
let dirs = directories::ProjectDirs::from("", "", "capri").context("No home directory")?;
|
|
Ok(Self {
|
|
config: dirs.config_dir().to_path_buf(),
|
|
data: dirs.data_dir().to_path_buf(),
|
|
cache: dirs.cache_dir().to_path_buf(),
|
|
})
|
|
}
|
|
|
|
pub fn under(root: PathBuf) -> Self {
|
|
Self { config: root.join("config"), data: root.join("data"), cache: root.join("cache") }
|
|
}
|
|
|
|
/// Workspace: PERSONALITY.md, USER.md, MEMORY.md, memory/, .capri/.
|
|
pub fn workspace(&self) -> PathBuf {
|
|
self.data.join("workspace")
|
|
}
|
|
/// Desktop state: transcript.json and other UI state.
|
|
pub fn state(&self) -> PathBuf {
|
|
self.data.join("desktop")
|
|
}
|
|
pub fn agent_db(&self) -> PathBuf {
|
|
self.data.join("agent").join("session.sqlite")
|
|
}
|
|
pub fn settings_file(&self) -> PathBuf {
|
|
self.config.join("settings.json")
|
|
}
|
|
pub fn logs(&self) -> PathBuf {
|
|
self.data.join("logs")
|
|
}
|
|
|
|
/// Runtime folder of this instance (lock, control socket, process markers):
|
|
/// `$XDG_RUNTIME_DIR/capri/<id>` on tmpfs, where `<id>` is the first 16 hex characters of
|
|
/// SHA-256 of the canonical data path, so `CAPRI_HOME` instances never collide.
|
|
/// Falls back to `<data>/run` when `XDG_RUNTIME_DIR` is unset. Not created here.
|
|
pub fn run(&self) -> PathBuf {
|
|
use sha2::{Digest, Sha256};
|
|
let data = std::fs::canonicalize(&self.data).unwrap_or_else(|_| self.data.clone());
|
|
let id = hex::encode(&Sha256::digest(data.as_os_str().as_encoded_bytes())[..8]);
|
|
match std::env::var_os("XDG_RUNTIME_DIR").map(PathBuf::from).filter(|d| d.is_absolute() && d.is_dir()) {
|
|
Some(runtime) => runtime.join("capri").join(id),
|
|
None => self.data.join("run"),
|
|
}
|
|
}
|
|
|
|
/// Creates the private directories (mode 0700).
|
|
pub fn ensure(&self) -> Result<()> {
|
|
use std::os::unix::fs::DirBuilderExt;
|
|
for dir in [
|
|
self.config.clone(),
|
|
self.data.clone(),
|
|
self.cache.clone(),
|
|
self.workspace(),
|
|
self.state(),
|
|
self.data.join("agent"),
|
|
self.logs(),
|
|
] {
|
|
std::fs::DirBuilder::new()
|
|
.recursive(true)
|
|
.mode(0o700)
|
|
.create(&dir)
|
|
.with_context(|| format!("Cannot create {}", dir.display()))?;
|
|
}
|
|
Ok(())
|
|
}
|
|
}
|