@@ -1126,8 +1126,8 @@ is corrected or a list completed without building the application again.
11261126- ** A Tauri resource** : ` crates/engine/resources/identity/ ` (` names.txt ` , ` places/*.txt ` ) is
11271127 declared in ` bundle.resources ` and lands in ` <resources>/identity/ ` — beside the executable
11281128 on Windows and in a development or e2e build (` tauri-build ` copies it into the target
1129- directory), under the package's own folder on Linux. The two commands take the
1130- ` AppHandle ` for nothing else: ` resource_dir() ` , joined with ` identity ` . No Tauri permission
1129+ directory), under the package's own folder on Linux. The two commands read
1130+ ` Paths::resources ` , which the shell resolves from ` resource_dir() ` , joined with ` identity ` . No Tauri permission
11311131 is involved — Rust reads the files, the page never does.
11321132- ** Read once, kept for the session** (` data::library ` ): every file is read at the first card
11331133 and its text given away for as long as the application runs, every name drawn afterwards
@@ -5215,7 +5215,7 @@ already locked. ⚠️ `libraries::open_directory(app)` reads and parses `librar
52155215every call, so it is kept for what runs while ** no** library is open: ` vault_state ` ,
52165216` create_vault ` , ` unlock_vault ` and the recovery commands. Reading the thumbnail of a
52175217screenshot used to pay that lookup plus two ` create_dir_all ` ; ` attachments/ ` is now created
5218- once, by ` vault::gate::install ` . A module that reaches for ` app_data_dir() ` directly writes
5218+ once, by ` vault::gate::install ` . A module that reaches for ` Paths::profile ` directly writes
52195219into the profile, which holds no library. The one directory that lives there on purpose is
52205220` open/ ` , the decrypted attachment copies: they are ephemeral and swept wholesale, and one
52215221directory means one sweep catches every library's leftovers.
@@ -5281,7 +5281,9 @@ first launch's own pick of the seeded space is shown, not remembered: nothing wa
52815281
52825282⚠️ ` automaticBackups ` stays with the application deliberately: "copy my libraries at
52835283launch" is a habit rather than a property of one corpus, and it is the one key Rust reads
5284- out of that file before the front end has booted (` backup::copies::wanted ` ).
5284+ out of that file before the front end has booted (` backup::copies::wanted ` ). Rust reads the
5285+ JSON file itself (` backup::wanted_by_preference ` ), not through ` tauri-plugin-store ` : the core
5286+ knows no plugin.
52855287
52865288⚠️ ` LibraryPreferencesService ` is re-opened on ** every** switch, where the application's is
52875289opened once. A space id means nothing in another library, and a samples marker carried
@@ -5477,12 +5479,33 @@ ids, parents, positions, the request's kind (`http`, `graphql`, `websocket`) and
54775479- The launch copy and a restore carry them, being in the database; the library export
54785480 (` transfer::Bundle ` ) does not — a collection travels in a file of its own.
54795481
5482+ ## The engine and its host
5483+
5484+ The core (` crates/engine ` ) owns its state in one ` Engine ` , which the shell creates once and
5485+ manages as an ` Arc<Engine> ` : the ` Db ` slot (empty until ` vault::unlock ` ), the sends, runs and
5486+ sockets under way, the restore set aside. It asks the shell for two things only (` host.rs ` ):
5487+
5488+ - ** ` Paths ` ** , a plain struct resolved before the engine exists: ` profile ` (` app_data_dir() ` :
5489+ the registry, ` libraries/ ` , the application's ` preferences.json ` , ` open/ ` ) and ` resources `
5490+ (` resource_dir() ` : the identity lists). A struct, not a trait: every host only fills in two
5491+ paths.
5492+ - ** ` EventSink ` ** , the one trait: what the core says unasked, as an ` EngineEvent ` (a socket's
5493+ traffic, a script's console, a run's steps). The Tauri shell's ` TauriHost ` emits each under
5494+ the name the front listens to (` WEBSOCKET_EVENT ` , ` HTTP_CONSOLE_EVENT ` , ` HTTP_RUN_EVENT ` );
5495+ tests keep them in a ` RecordingSink ` .
5496+
5497+ What reaches the platform stays out of the core's work: the clipboard is read before an
5498+ attachment is stored and written after a QR code is drawn, and a decrypted attachment is opened
5499+ once its copy is written — by the command, not inside the body that holds the lock. ⚠️ During
5500+ the egui migration the commands still live in ` crates/engine ` and take an ` AppHandle ` to find
5501+ the engine (` db::engine ` ); ` db::blocking ` hands their body ` &Engine ` .
5502+
54805503## Persistence (Rust)
54815504
54825505Storage is ** SQLite** , queried through ** Diesel** and embedded via ` libsqlite3-sys ` with the
54835506` bundled ` feature — SQLite is compiled from source and statically linked, so nothing has to be
5484- installed or shipped alongside the executable. The database file lives in Tauri's
5485- ` app_data_dir() ` .
5507+ installed or shipped alongside the executable. The database file lives under the profile
5508+ ( ` Paths::profile ` , Tauri's ` app_data_dir() ` ) .
54865509
54875510- ** The store is plain functions.** ` notes::store ` and ` spaces::store ` take a
54885511 ` &mut SqliteConnection ` ; the ` #[tauri::command] ` s sit on top. That is what makes persistence
0 commit comments