The 2026-05-12 engine-slop pass removed runtime std::env::set_var mutation from src-tauri/src/lib.rs and replaced it with warn_if_x11_env_unset_on_wayland. With no launcher owning the contract, Linux Wayland dogfood was about to regress. run.sh: - now owns Linux launcher env defaults via case "$(uname -s)" LIBCLANG_PATH=/usr/lib64/llvm21/lib64 (user-set wins) WEBKIT_DISABLE_DMABUF_RENDERER=1 (always on Linux; user-set wins) GDK_BACKEND=x11, WINIT_UNIX_BACKEND=x11 (Wayland only; user-set wins) - 60s Vite readiness timeout - detects early Vite exit (kill -0 + wait) instead of hanging forever - trap installed before wait so Ctrl-C cleans up - args forwarded: ./run.sh --release etc. - non-exec final Tauri launch preserved so cleanup trap fires package.json: - "dev:tauri": "./run.sh" — canonical discoverable dev command Docs: - README, dev-setup, architecture-map runtime + launcher pages updated with the new contract; canonical command is npm run dev:tauri (./run.sh as direct equivalent) - dev-launcher-and-scripts.md replaces the incorrect "kills process group" claim with honest "kills the spawned npm process" - dev-setup.md path /CORBEL-Projects/magnotia → /CORBEL-Projects/transcription-app - gpu-tuning/plan.md gets a superseded note rather than rewriting the original rationale - engine-slop-residuals.md gains Area F (packaged-binary launcher contract) with honest wrapper-vs-.desktop trade-off documented Verification: bash -n run.sh; shellcheck clean; cargo check -p magnotia green; npm pkg get 'scripts.dev:tauri' returns "./run.sh"; stale-ref sweep clean across living docs.
name, type, slice, last_verified
| name | type | slice | last_verified |
|---|---|---|---|
| Slice 02 — Tauri runtime | architecture-map-page | 02-tauri-runtime | 2026/05/12 |
Slice 02 — Tauri runtime
Where you are: Architecture map → Tauri runtime
Plain English summary. The Tauri runtime is the bridge between Magnotia's Svelte frontend and the Rust workspace crates. It owns app startup (database init, panic hook, plugin wiring, preferences injection), the system tray, the secondary windows (task float, transcript viewer, transcription preview), and the entire #[tauri::command] surface that the frontend invokes for audio capture, transcription, LLM cleanup, task and transcript CRUD, paste, TTS, hotkeys, diagnostics, and more. Everything that runs on the host process but is not pure crate logic lives here.
At a glance
- Path:
src-tauri/ - Total LOC (Rust + Cargo + JSON, excluding
gen/): ~8,690. - Tauri version:
2(seesrc-tauri/Cargo.toml:44). - Bundle identifier:
uk.co.corbel.magnotia(src-tauri/tauri.conf.json:5). - Plugins (always-on):
tauri-plugin-opener,tauri-plugin-dialog,tauri-plugin-notification. - Plugins (desktop-only, gated
cfg(not(target_os = "android"))):tauri-plugin-global-shortcut,tauri-plugin-autostart(LaunchAgent),tauri-plugin-window-state. Thetray-iconTauri feature is also desktop-only. - Workspace crates pulled in:
magnotia-core,magnotia-audio,magnotia-transcription(default-features off,whisperre-enabled here),magnotia-ai-formatting,magnotia-storage,magnotia-cloud-providers,magnotia-hotkey,magnotia-llm. - Tauri commands exposed via
invoke_handlerinsrc-tauri/src/lib.rs:321: 71 commands. - Capability files:
src-tauri/capabilities/main.json(main window) andsrc-tauri/capabilities/secondary-windows.json(task float, transcript viewer, transcription preview). - Command modules: 22
#[tauri::command]modules plus 3 utility modules (mod.rs,power.rs,security.rs). - Integration tests:
src-tauri/tests/config_hardening.rs(3 tests guarding CSP, updater signing, secondary-window permissions).
Map of this slice
App boot, config, tests:
- App lifecycle.
src-tauri/src/main.rsandsrc-tauri/src/lib.rs. Run entry, AppState construction, plugin wiring, preferences injection, Linux launcher-env warning, panic hook, error-log pruning, command registration. - System tray. Desktop-only tray icon and menu (
src-tauri/src/tray.rs). - Tauri config.
tauri.conf.jsonplus the Linux native-decorations overlay; CSP, window defaults, bundle settings. - Capabilities and ACL. The two ACL files in
capabilities/, what each scopes, and the Phase 9 high-risk-permission firewall. - Cargo and features.
Cargo.toml, thewhispercargo feature, the per-target dependency blocks,build.rs,.cargo/config.toml. - Tests. Config-hardening regression tests.
Command modules (entry index):
- Commands index. Every command file with a one-liner.
Individual command pages (linked from the commands index):
- Audio capture, Live transcription, Paste at cursor, Models registry and runtime, Transcription, Local LLM, Text to speech, Tasks and decomposition, Transcripts CRUD, Diagnostics and reports, Implementation intentions, Profiles, Window management, Hotkey bridge, Feedback capture, Power assertions and security, Small commands, mod.rs registration.
How this slice connects to others
- Frontend (slice 01). Every
#[tauri::command]is invoked from Svelte via@tauri-apps/api/coreinvoke(). Events emitted viaapp.emit(...)are consumed vialisten()in the frontend. Live transcription uses typedtauri::ipc::Channelinstead of plain events; the channel pair is created on the JS side and passed in as command args. - Audio + transcription (slice 03).
commands::audiocallsmagnotia_audio::{MicrophoneCapture, WavWriter, decode_audio_file_limited, resample_to_16khz, probe_audio_duration_secs}.commands::transcriptionandcommands::livecallmagnotia_transcription::LocalEngineplusmagnotia_audio::StreamingResampler.commands::modelscallsmagnotia_transcription::{model_manager, load_whisper, load_parakeet}. - LLM + formatting + MCP (slice 04).
commands::llmcallsmagnotia_llm::{LlmEngine, model_manager, ContentTags, LlmModelId}andmagnotia_ai_formatting::{llm_cleanup_text, LlmPromptPreset}.commands::taskscallsmagnotia_llm::prompts::FeedbackExampleand the engine'sdecompose_task_with_feedback/extract_tasks_with_feedback/extract_content_tags.commands::transcriptionandcommands::livecallmagnotia_ai_formatting::{post_process_segments, FormatMode, PostProcessOptions}.commands::profilescallsmagnotia_ai_formatting::extract_correctionsfor auto-learned vocabulary. - Core + storage + hotkey + build (slice 05). Everything DB-touching goes through
magnotia_storage(init,database_path,get_setting,set_setting,prune_error_log, the full set of CRUD helpers,app_data_dir,crashes_dir,logs_dir,list_recent_errors,log_error).commands::hardwareandcommands::modelscallmagnotia_core::{hardware, model_registry, recommendation, types, constants}.commands::meetingcallsmagnotia_core::process_watch.commands::hotkeyis a thin Tauri wrapper aroundmagnotia_hotkey::{EvdevHotkeyListener, HotkeyCombo, HotkeyEvent}.build.rsis the build-system half of the slice (CSP regression guard plus ggml multi-definition link arg).
Open questions / debt
commands/live.rsis 1,737 LOC. The runtime, loop state, speech gate, dedup, and chunking logic share the file. Splitting per concern would track against the broader refactor pass already mooted in the in-repo code review (docs/code-review-2026-04-22.md). Seecommands/live.mdfor the breakdown.commands::update::install_updatereturns a hard-coded "Updates are disabled until release signing is configured." (src-tauri/src/commands/update.rs:15). The integration testupdater_is_signed_or_absent(src-tauri/tests/config_hardening.rs:35) only asserts that if an updater config ships, it carries a non-empty pubkey. There is currently no updater config intauri.conf.json, so the test is an empty no-op.commands::power::PowerAssertionis a no-op on Linux and Windows (src-tauri/src/commands/power.rs:90). Only macOS has a real implementation viaobjc2. The doc comment promisesSetThreadExecutionState(Windows) and logind inhibitors (Linux), but neither is wired up. Symptom: long live-dictation sessions on Linux can be idled by the compositor.src-tauri/.cargo/config.tomlhard-codesLIBCLANG_PATH = "C:\\Program Files\\LLVM\\bin"(Windows). It is harmless on non-Windows hosts (env var is just unused) but it is a foot-gun if someone moves Clang elsewhere on Windows. See Cargo and features.- The Linux rendering workaround in
lib.rs(warn_if_x11_env_unset_on_wayland) now warns when the launcher has not set the expected env vars; it no longer mutates the process environment. In development,run.sh/npm run dev:tauriowns the defaults (WEBKIT_DISABLE_DMABUF_RENDERER=1on Linux;GDK_BACKEND=x11andWINIT_UNIX_BACKEND=x11on Wayland). The user opt-out remainsWEBKIT_DISABLE_DMABUF_RENDERER=0, set before launching. commands::diagnostics::install_panic_hookwrites a "minimal text dump" without backtraces unless the user hasRUST_BACKTRACE=1set (src-tauri/src/commands/diagnostics.rs:42). The packaged binary does not set it, so production crash dumps will lack stack traces. Document or default-enable.commands::audio::list_audio_devicesis gatedensure_main_windowbut thesecondary-windowscapability does not invoke it, which is correct. Theclipboard::copy_to_clipboardcommand, by contrast, has no main-window guard and any window with thecore:defaultpermission can call it; intentional, but worth flagging.
Existing in-repo docs
docs/code-review-2026-04-22.md. The MAJOR / MINOR review that motivated several of the safety helpers seen here (the parallel-mode loopback CSP guard inbuild.rs, secondary-window high-risk-permission test, RB-06 worker-join incommands::audio, RB-07compose_acceleratorsincommands::models, RB-08 macOS App Nap power assertion incommands::power).docs/issues/. Open issue threads, several of which the diagnostic-report bundler exists to feed.docs/whisper-ecosystem/brief.md. Source of the numbered "brief items" cited in code comments (item #2 = loopback LLM CSP, item #9 = App Nap, items #10/#17 = paste / replace flows, item #19 = progressive WAV writer, item #28 = sequential-GPU mode).docs/handovers/. Daily handover docs that cite specific command surfaces; useful when the in-source comments cite a "RB-NN review point".docs/dev-setup.md. Linux + Windows + macOS toolchain setup, including the Vulkan loader install required for GPU-backed whisper.cpp.