Linux port: first run, packaging, single instance, privacy and wiring
CI / test (push) Has been cancelled
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:
73 files changed
+4834
-517
No files matched your search
@@ -195,6 +195,16 @@ impl Brain {
|
||||
}
|
||||
}
|
||||
|
||||
/// Text of one document the owner attached to a message: PDF, DOCX, ODT or plain text
|
||||
/// (≤ 8 MiB, regular file, same limits as Brain documents).
|
||||
pub fn document_text(path: &Path) -> Result<String> {
|
||||
let bytes = capri_core::fsutil::read_regular(path, MAX_BYTES)?.context("The file is missing or too large (8 MiB at most).")?;
|
||||
let extension = path.extension().and_then(|e| e.to_str()).unwrap_or_default().to_lowercase();
|
||||
let text = if extension == "pdf" { pdf_pages(&bytes)?.join("\n") } else { text_from_file(&bytes, &extension)? };
|
||||
ensure!(!text.contains('\0'), "Binary files cannot be attached as text.");
|
||||
Ok(text.chars().take(MAX_TEXT).collect())
|
||||
}
|
||||
|
||||
fn pdf_pages(bytes: &[u8]) -> Result<Vec<String>> {
|
||||
// pdf-extract panics on some malformed files; a bad document must only be skipped.
|
||||
let pages = std::panic::catch_unwind(|| pdf_extract::extract_text_from_mem_by_pages(bytes))
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::brain::BrainRow;
|
||||
use crate::private::PrivateNote;
|
||||
use crate::saved::{matches, SavedMemory};
|
||||
use crate::{MemoryHandle, MemoryService, MemorySettings};
|
||||
use capri_core::i18n::t;
|
||||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct UiState {
|
||||
@@ -54,16 +55,16 @@ fn spawn<T: Send + 'static>(ui: &egui::Ui, memory: &MemoryHandle, work: impl FnO
|
||||
pub fn settings_ui(ui: &mut egui::Ui, store: &SettingsStore, memory: &MemoryHandle) {
|
||||
let mut settings: MemorySettings = store.section();
|
||||
let before = settings.clone();
|
||||
ui.heading("Memory");
|
||||
ui.checkbox(&mut settings.remember_across_conversations, "Remember across conversations");
|
||||
ui.heading(t("Memory"));
|
||||
ui.checkbox(&mut settings.remember_across_conversations, t("Remember across conversations"));
|
||||
saved_memory(ui, memory);
|
||||
ui.separator();
|
||||
ui.heading("Brain");
|
||||
ui.checkbox(&mut settings.brain_enabled, "Use local knowledge");
|
||||
ui.checkbox(&mut settings.brain_share_with_api, "Allow relevant Brain excerpts to be sent to an external API");
|
||||
ui.heading(t("Brain"));
|
||||
ui.checkbox(&mut settings.brain_enabled, t("Use local knowledge"));
|
||||
ui.checkbox(&mut settings.brain_share_with_api, t("Allow relevant Brain excerpts to be sent to an external API"));
|
||||
brain(ui, memory, settings.brain_enabled);
|
||||
ui.separator();
|
||||
ui.heading("Private memory");
|
||||
ui.heading(t("Private memory"));
|
||||
private_memory(ui, store, memory);
|
||||
if settings != before {
|
||||
if let Err(e) = store.set_section(&settings) {
|
||||
@@ -78,16 +79,16 @@ pub fn settings_ui(ui: &mut egui::Ui, store: &SettingsStore, memory: &MemoryHand
|
||||
fn saved_memory(ui: &mut egui::Ui, memory: &MemoryHandle) {
|
||||
let mut state = memory.ui.lock();
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("View saved memories").clicked() || state.saved.is_none() {
|
||||
if ui.button(t("View saved memories")).clicked() || state.saved.is_none() {
|
||||
state.saved = Some(memory.saved_memory());
|
||||
}
|
||||
if ui.button("Refresh").clicked() {
|
||||
if ui.button(t("Refresh")).clicked() {
|
||||
state.saved = Some(memory.saved_memory());
|
||||
}
|
||||
});
|
||||
ui.label("Add a memory");
|
||||
ui.label(t("Add a memory"));
|
||||
ui.add(egui::TextEdit::multiline(&mut state.new_memory).char_limit(1200).hint_text("A fact you want Capri to remember…"));
|
||||
if ui.button("Save fact").clicked() && !state.new_memory.trim().is_empty() {
|
||||
if ui.button(t("Save fact")).clicked() && !state.new_memory.trim().is_empty() {
|
||||
let text = state.new_memory.trim().to_string();
|
||||
state.saved_status = match memory.save_note(&text) {
|
||||
Ok(_) => {
|
||||
@@ -117,7 +118,7 @@ fn saved_memory(ui: &mut egui::Ui, memory: &MemoryHandle) {
|
||||
};
|
||||
ui.label(status);
|
||||
if saved.truncated {
|
||||
ui.label("Showing a limited list. Some notes could not be displayed.");
|
||||
ui.label(t("Showing a limited list. Some notes could not be displayed."));
|
||||
}
|
||||
egui::ScrollArea::vertical().id_salt("saved-memory").max_height(240.0).show(ui, |ui| {
|
||||
for item in shown {
|
||||
@@ -132,13 +133,13 @@ fn saved_memory(ui: &mut egui::Ui, memory: &MemoryHandle) {
|
||||
});
|
||||
}
|
||||
if !state.confirm_clear {
|
||||
if ui.button("Clear long-term memory").clicked() {
|
||||
if ui.button(t("Clear long-term memory")).clicked() {
|
||||
state.confirm_clear = true;
|
||||
}
|
||||
} else {
|
||||
ui.label("Delete saved notes about you? USER.md, MEMORY.md and notes in memory will be cleared. Conversation archives remain separate. This cannot be undone.");
|
||||
ui.label(t("Delete saved notes about you? USER.md, MEMORY.md and notes in memory will be cleared. Conversation archives remain separate. This cannot be undone."));
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("Clear").clicked() {
|
||||
if ui.button(t("Clear")).clicked() {
|
||||
state.clear_status = match memory.clear_long_term_memory() {
|
||||
Ok(()) => String::new(),
|
||||
Err(e) => format!("{e:#}"),
|
||||
@@ -146,7 +147,7 @@ fn saved_memory(ui: &mut egui::Ui, memory: &MemoryHandle) {
|
||||
state.saved = Some(memory.saved_memory());
|
||||
state.confirm_clear = false;
|
||||
}
|
||||
if ui.button("Cancel").clicked() {
|
||||
if ui.button(t("Cancel")).clicked() {
|
||||
state.confirm_clear = false;
|
||||
}
|
||||
});
|
||||
@@ -161,10 +162,10 @@ fn brain(ui: &mut egui::Ui, memory: &MemoryHandle, enabled: bool) {
|
||||
ui.label(if status.busy { "Indexing documents…".to_string() } else { format!("Documents indexed: {} · Skipped: {}", status.indexed, status.skipped) });
|
||||
let folder = memory.brain.folder.clone();
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("Open Brain folder").clicked() {
|
||||
if ui.button(t("Open Brain folder")).clicked() {
|
||||
let _ = std::process::Command::new("xdg-open").arg(&folder).spawn();
|
||||
}
|
||||
if ui.add_enabled(enabled && !status.busy, egui::Button::new("Refresh index")).clicked() {
|
||||
if ui.add_enabled(enabled && !status.busy, egui::Button::new(t("Refresh index"))).clicked() {
|
||||
spawn(ui, memory, |m| m.brain.refresh().map(|_| ()), |s, r: anyhow::Result<()>| s.brain_message = r.err().map(|e| format!("{e:#}")).unwrap_or_default());
|
||||
}
|
||||
});
|
||||
@@ -174,7 +175,7 @@ fn brain(ui: &mut egui::Ui, memory: &MemoryHandle, enabled: bool) {
|
||||
for name in documents {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(&name);
|
||||
if ui.small_button("Remove").clicked() {
|
||||
if ui.small_button(t("Remove")).clicked() {
|
||||
state.brain_message = match std::fs::remove_file(folder.join(&name)) {
|
||||
Ok(()) => String::new(),
|
||||
Err(e) => e.to_string(),
|
||||
@@ -184,7 +185,7 @@ fn brain(ui: &mut egui::Ui, memory: &MemoryHandle, enabled: bool) {
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
ui.add(egui::TextEdit::singleline(&mut state.add_document).hint_text("Path of a .txt, .md, .pdf, .docx or .odt file"));
|
||||
if ui.button("Add document").clicked() {
|
||||
if ui.button(t("Add document")).clicked() {
|
||||
let source = std::path::PathBuf::from(state.add_document.trim());
|
||||
state.brain_message = match source.file_name() {
|
||||
Some(name) if source.is_file() => match std::fs::copy(&source, folder.join(name)) {
|
||||
@@ -200,13 +201,13 @@ fn brain(ui: &mut egui::Ui, memory: &MemoryHandle, enabled: bool) {
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
ui.add(egui::TextEdit::singleline(&mut state.brain_query).char_limit(500).hint_text("Test search"));
|
||||
if ui.button("Search").clicked() {
|
||||
if ui.button(t("Search")).clicked() {
|
||||
state.brain_results = Some(if enabled { memory.brain.search(&state.brain_query) } else { vec![] });
|
||||
}
|
||||
});
|
||||
if let Some(rows) = &state.brain_results {
|
||||
if rows.is_empty() {
|
||||
ui.label("No matching knowledge found.");
|
||||
ui.label(t("No matching knowledge found."));
|
||||
}
|
||||
for row in rows {
|
||||
ui.group(|ui| {
|
||||
@@ -247,13 +248,13 @@ fn private_memory(ui: &mut egui::Ui, store: &SettingsStore, memory: &MemoryHandl
|
||||
if state.private_notes.is_empty() {
|
||||
state.private_notes = memory.vault.list().unwrap_or_default();
|
||||
}
|
||||
if ui.button("Lock now").clicked() {
|
||||
if ui.button(t("Lock now")).clicked() {
|
||||
memory.vault.lock();
|
||||
state.wipe_private();
|
||||
return;
|
||||
}
|
||||
ui.add(egui::TextEdit::multiline(&mut state.private_note).char_limit(1200).hint_text("Private note"));
|
||||
if ui.button("Save").clicked() {
|
||||
if ui.button(t("Save")).clicked() {
|
||||
match memory.vault.add(&state.private_note) {
|
||||
Ok(notes) => {
|
||||
state.private_notes = notes;
|
||||
@@ -266,7 +267,7 @@ fn private_memory(ui: &mut egui::Ui, store: &SettingsStore, memory: &MemoryHandl
|
||||
for note in &state.private_notes {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(¬e.text);
|
||||
if ui.small_button("Remove").clicked() {
|
||||
if ui.small_button(t("Remove")).clicked() {
|
||||
removed = Some(note.id.clone());
|
||||
}
|
||||
});
|
||||
@@ -278,7 +279,7 @@ fn private_memory(ui: &mut egui::Ui, store: &SettingsStore, memory: &MemoryHandl
|
||||
}
|
||||
}
|
||||
ui.add(egui::TextEdit::multiline(&mut state.private_message).char_limit(2000).hint_text("Private message"));
|
||||
if ui.add_enabled(!state.private_busy, egui::Button::new("Send privately")).clicked() {
|
||||
if ui.add_enabled(!state.private_busy, egui::Button::new(t("Send privately"))).clicked() {
|
||||
let text = state.private_message.clone();
|
||||
let settings = store.get();
|
||||
let mut options = serde_json::json!({"num_ctx": settings.context_tokens});
|
||||
@@ -320,7 +321,7 @@ fn private_memory(ui: &mut egui::Ui, store: &SettingsStore, memory: &MemoryHandl
|
||||
ui.collapsing("Change password", |ui| {
|
||||
ui.add(egui::TextEdit::singleline(&mut state.password).password(true).hint_text("Current password"));
|
||||
ui.add(egui::TextEdit::singleline(&mut state.new_password).password(true).hint_text("New password"));
|
||||
if ui.add_enabled(!state.private_busy, egui::Button::new("Change password")).clicked() {
|
||||
if ui.add_enabled(!state.private_busy, egui::Button::new(t("Change password"))).clicked() {
|
||||
let (old, new) = (std::mem::take(&mut state.password), std::mem::take(&mut state.new_password));
|
||||
state.private_busy = true;
|
||||
spawn(ui, memory, move |m| m.vault.change_password(&old, &new).map(|_| ()), |s, r| {
|
||||
|
||||
Reference in new issue
Block a user