Files
nocodeandClaude Opus 5.5 49349d6ecd
CI / test (push) Has been cancelled
Linux port: first run, packaging, single instance, privacy and wiring
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>
2026-11-12 20:21:40 +01:00
..
2026-11-11 20:20:48 +01:00

capri-llm

Model backends for Capri: the managed local Ollama, OpenAI-compatible APIs (remote providers and Lemonade), API key storage and the inference settings sections. Spec: docs/spec/02-inference.md.

Integration

Public API

Item Purpose
Ollama::{new, base, version, show, load, chat, pull} unchanged
Ollama::{tags, ps, show_info, create, delete, unload, embed, upload_blob, raw_chat, chat_json} model management, embeddings (CPU, num_gpu: 0), structured replies
ChatRequest, Message, Options, ChatDone, ToolCall, ToolFunction, ModelEntry, RunningModel shared types; Message is the session format for every backend
LlmError new variant Api { code, message, status, detail }; public_message returns the user-facing text for API failures (Capri ), None for local errors
LlmBackend::{Local(Ollama), Api(OpenAi)} load, chat (same signature as Ollama::chat), chat_json, api_capabilities, context_tokens, label, from_settings(&Settings, &Ollama, &SecretStore)
OpenAi streaming SSE chat completions with tool calls and images, think: Some(true) → reasoning_effort: "medium" (OpenRouter: reasoning {effort, exclude}) when the connection has thinking, max-token caps 2048/8192, vision gate before any network I/O, credential-echo redaction, provider status → Capri texts, chat_json with json_object / strict json_schema (Anthropic) / prompt-only and a memoized fallback on the "too many optional parameters" and "compiled grammar is too large" 400s, test
openai::{strict_schema, optional_parameter_count, limit_optional_parameters, drop_optional_nulls, plain_json} schema helpers: no strict tool is ever sent; limit_optional_parameters(&mut tools, 24) rewrites the largest tools to nullable-required parameters until the request has ≤ 24 optional parameters
ApiConnection a saved connection (validated applies Capri rules)
SecretStore open(&paths.data) uses Secret Service (KWallet/ksecretd, gnome-keyring) over zbus, else <data>/secrets/credentials.json (0600). get/set/delete(account, origin); a key is only returned for the origin it was saved for. secure tells the UI which backend is in use
secrets::{normalize_api_key, api_key_problem, valid_hf_token, HF_ACCOUNT, HF_ORIGIN} key validation
server::{OllamaServer, resolve_model} unchanged API. Start now clears the child environment (allowlist), applies InferenceSection::device GPU masks, OLLAMA_GPU_OVERHEAD 768 MiB, LLAMA_ARG_THINK_BUDGET, TMPDIR, CAPRI_OLLAMA_PATH, and refuses Ollama older than min_ollama_version (0.40.10). New unload_and_stop
server::{device_environment, version_at_least} pure helpers

Settings sections (settings.json → sections)

  • inference (InferenceSection): embeddingModel, preloadModels, reasoningBudget, thinkingDefault, modelSetupRequired, modelCapabilities, modelContextLimit, resourceProfile, minOllamaVersion, device (auto, cpu, cuda:<GPU uuid>, rocm:<n>, vulkan:<n>), skipLocalModelOnApi.
  • api (ApiSection): enabled (API mode), active (connection id), connections (max 20). Keys are never in this file.
  • router (RouterSection): enabled, timeoutMs (25…250, default 150), model (capri-router:latest), baseModel (all-minilm:l6-v2).

The other Capri core keys already live in capri_core::Settings (model, upstreamModel, contextTokens, keepAlive, cpuThreads, acceleration, temperature, repeatLastN, ollamaPort).