Linux port: first run, packaging, single instance, privacy and wiring
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>
This commit is contained in:
nocodeandClaude Opus 5.5 committed 2026-11-12 20:15:49 +01:00
1 parent a2abf01280
commit 844435f21f
73 files changed
+4834 -517

No files matched your search

+55 -11
View File
@@ -1,6 +1,8 @@
//! API keys and the Hugging Face token: Secret Service over D-Bus
//! (`org.freedesktop.secrets`: KWallet/ksecretd on KDE, gnome-keyring or ksecretd on i3),
//! with a private 0600 file fallback. Secrets are never logged and never in `Debug` output.
//! (`org.freedesktop.secrets`: KWallet/ksecretd on KDE, gnome-keyring or KeePassXC on i3).
//! Without a Secret Service nothing new is saved (fail closed); keys an older build wrote to
//! the private 0600 file stay readable and move into the keyring once it is available.
//! Secrets are never logged and never in `Debug` output.
use std::collections::{BTreeMap, HashMap};
use std::path::{Path, PathBuf};
use std::time::Duration;
@@ -26,9 +28,13 @@ pub struct SecretStore(Backend);
#[derive(Clone)]
enum Backend {
Service { conn: zbus::Connection, session: OwnedObjectPath },
File(PathBuf),
/// `writable` only for explicit file stores (tests); the fallback is read-only.
File { path: PathBuf, writable: bool },
}
/// Shown when a key cannot be saved because no keyring answers.
pub const NO_KEYRING: &str = "Secure credential storage is unavailable: no Secret Service is running. Start KWallet (KDE Plasma), or gnome-keyring or KeePassXC with its Secret Service option (i3), then save the key again.";
impl std::fmt::Debug for SecretStore {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(if self.secure() { "SecretStore(secret-service)" } else { "SecretStore(file)" })
@@ -48,18 +54,41 @@ async fn proxy<'a>(conn: &zbus::Connection, path: &'a str, interface: &'a str) -
impl SecretStore {
/// Secret Service when reachable, else `<data>/secrets/credentials.json`.
pub async fn open(data_dir: &Path) -> Self {
let legacy = data_dir.join("secrets").join("credentials.json");
match tokio::time::timeout(Duration::from_secs(3), Self::service()).await {
Ok(Ok(backend)) => Self(backend),
Ok(Ok(backend)) => {
let store = Self(backend);
store.migrate(&legacy).await;
store
}
_ => {
// TODO: falls back to a plaintext 0600 file when no Secret Service runs; refuse to save when `!secure()` to fail closed.
tracing::warn!("Secret Service unavailable; API keys use a private file");
Self::file(data_dir.join("secrets").join("credentials.json"))
tracing::warn!("Secret Service unavailable; API keys cannot be saved until a keyring runs");
Self(Backend::File { path: legacy, writable: false })
}
}
}
/// Moves keys from the plaintext file of older builds into the keyring, then deletes the file.
async fn migrate(&self, legacy: &Path) {
let Ok(entries) = read_file(legacy) else { return };
if entries.is_empty() {
return;
}
for (account, entry) in &entries {
if let Err(e) = self.set(account, &entry.origin, &entry.secret).await {
tracing::warn!("saved access not moved to the keyring: {e:#}");
return;
}
}
match std::fs::remove_file(legacy) {
Ok(()) => tracing::info!(count = entries.len(), "saved access moved to the keyring"),
Err(e) => tracing::warn!("plaintext credentials file not removed: {e}"),
}
}
/// File store that also saves (tests and explicit tooling only).
pub fn file(path: PathBuf) -> Self {
Self(Backend::File(path))
Self(Backend::File { path, writable: true })
}
/// True when secrets are held by the desktop keyring.
@@ -120,7 +149,7 @@ impl SecretStore {
let (_, _, value, _): Secret = item.call("GetSecret", &(session,)).await.context("Saved access could not be read. Save it again.")?;
Ok(Some(String::from_utf8(value).context("Saved access could not be read. Save it again.")?))
}
Backend::File(path) => Ok(read_file(path)?.remove(account).filter(|e| e.origin == origin).map(|e| e.secret)),
Backend::File { path, .. } => Ok(read_file(path)?.remove(account).filter(|e| e.origin == origin).map(|e| e.secret)),
}
}
@@ -148,7 +177,8 @@ impl SecretStore {
}
bail!("Secure credential storage is unavailable.")
}
Backend::File(path) => {
Backend::File { writable: false, .. } => bail!(NO_KEYRING),
Backend::File { path, writable: true } => {
let mut entries = read_file(path)?;
entries.insert(account.into(), FileEntry { origin: origin.into(), secret: secret.into() });
write_file(path, &entries)
@@ -168,7 +198,8 @@ impl SecretStore {
}
Ok(())
}
Backend::File(path) => {
// Deleting is allowed even read-only: it removes a plaintext secret.
Backend::File { path, .. } => {
let mut entries = read_file(path)?;
if entries.remove(account).is_some() {
write_file(path, &entries)?;
@@ -241,6 +272,19 @@ mod tests {
assert_eq!(store.get("c1", "https://a.example").await.unwrap(), None);
}
#[tokio::test]
async fn without_keyring_nothing_new_is_saved() {
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("secrets/credentials.json");
SecretStore::file(path.clone()).set("old", "https://a.example", "sk-legacy-key").await.unwrap();
let fallback = SecretStore(Backend::File { path: path.clone(), writable: false });
assert_eq!(fallback.set("new", "https://a.example", "sk-12345678").await.unwrap_err().to_string(), NO_KEYRING);
// A key from an older build stays usable and can be removed.
assert_eq!(fallback.get("old", "https://a.example").await.unwrap().as_deref(), Some("sk-legacy-key"));
fallback.delete("old").await.unwrap();
assert_eq!(fallback.get("old", "https://a.example").await.unwrap(), None);
}
#[test]
fn key_normalization_and_validation() {
assert_eq!(normalize_api_key("\u{feff} \"sk-abcdefgh\" \n"), "sk-abcdefgh");