# Tauri command bridge Active contributors: Douwe de Vries, vriesd ## Purpose The Tauri bridge exposes Rust operations to the React renderer through typed commands and generated TypeScript bindings. It keeps persistence and provider process logic out of the frontend. ## Key source files | File | Purpose | | --- | --- | | `src-tauri/src/commands.rs` | Command module registry. | | `src-tauri/src/commands/sessions.rs` | Session command handlers. | | `src-tauri/src/commands/entries.rs` | Entry command handlers. | | `src-tauri/src/commands/findings.rs` | Finding command handlers. | | `src-tauri/src/commands/generation.rs` | Generation context and AI action commands. | | `src-tauri/src/commands/files.rs` | Managed file and clipboard commands. | | `src-tauri/src/commands/error.rs` | Structured command error mapping. | | `src-tauri/src/specta_bindings.rs` | Command/type registration and TypeScript export. | | `frontend/src/tauri.ts` | Frontend wrapper over generated invoke functions. | | `frontend/src/tauriCommands.ts` | Stable frontend command helpers. | ## How it works Command handlers call `AppState::with_service` from `src-tauri/src/settings.rs`, which locks the core `SessionService`. Results are serialized back through Tauri and typed on the frontend through `frontend/src/bindings.ts`. ```mermaid graph LR View[React view] --> Wrapper[frontend/src/tauri.ts] Wrapper --> Bindings[frontend/src/bindings.ts] Bindings --> Command[src-tauri commands] Command --> State[AppState::with_service] State --> Core[SessionService] ``` ## Integration points The bridge connects [Frontend shell](systems--frontend-shell.md) to [Rust core](systems--rust-core.md). Generation commands also start [Generation jobs](systems--generation-jobs.md), and provider commands use [Provider detection](systems--provider-detection.md). ## Entry points for modification When adding a command, register it in `src-tauri/src/specta_bindings.rs`, implement it under `src-tauri/src/commands`, update frontend wrappers in `frontend/src/tauri.ts` if needed, and run `bun run bindings:check` or `bun run bindings:generate`.