Tauri Desktop Integration
Relevant source files
The following files were used as context for generating this wiki page:
OpenWork utilizes the Tauri framework to provide a native desktop experience that bridges high-level web technologies with low-level system operations. The integration serves as a secure shell for the OpenCode engine, enabling local execution of agentic workflows while maintaining a premium, design-driven user interface.
In Host Mode, the Tauri application spawns and manages a local OpenCode server on the loopback address, allowing the frontend to communicate with the engine via an SDK while providing access to the local filesystem through authorized workspace roots.
Sources: README.md:164-180, ARCHITECTURE.md:46-55, AGENTS.md:32-40
System Architecture
The integration follows a multi-process architecture where the Tauri Rust core manages system-level tasks and the SolidJS frontend handles the user experience.
Component Relationship
The following diagram illustrates how the Tauri shell coordinates between the UI, the OpenCode engine, and the host operating system.
The Tauri Rust core acts as the orchestrator, managing process lifecycles and filesystem access that the browser-based UI cannot reach directly.
Sources: ARCHITECTURE.md:44-58, README.md:164-175, AGENTS.md:32-40
Command Implementation (Rust to JS IPC)
OpenWork implements custom Tauri commands to expose backend functionality to the frontend. These commands handle complex operations such as workspace management, skill installation, and configuration exports.
Workspace Management
Workspaces are managed through several specific commands that handle the lifecycle of project folders.
| Command | Description | File Path |
|---|---|---|
workspace_bootstrap | Initializes the workspace state and ensures starter files exist. | workspace.rs:25 |
workspace_create | Creates a new local workspace folder and initializes it with a preset. | workspace.rs:114 |
workspace_export_config | Packages .opencode config files into a ZIP archive for sharing. | workspace.rs:434 |
workspace_import_config | Unpacks a ZIP archive into a target directory to recreate a workspace. | workspace.rs:520 |
Sources: packages/desktop/src-tauri/src/commands/workspace.rs:25-520
Skill and Plugin Management
The integration allows the UI to manage OpenCode skills and plugins by manipulating the filesystem directly through Rust.
This flow ensures that the UI remains in sync with the physical files on disk, supporting local-first principles.
Sources: packages/desktop/src-tauri/src/commands/skills.rs:275-313, ARCHITECTURE.md:121-125
Filesystem and Security
Security is enforced through a layered authorization model. Tauri manages the native folder picker, while the Rust backend restricts operations to user-authorized roots.
Folder Authorization
- Selection: Users select allowed folders via the
tauri-plugin-dialog. - Persistence: Authorized roots are stored in
openwork.jsonwithin the workspace. - Enforcement: Rust commands verify paths against these authorized roots before performing writes.
Sources: ARCHITECTURE.md:154-170, packages/desktop/src-tauri/src/commands/workspace.rs:360-390, README.md:183-187
Implementation Detail: Config Export
The workspace_export_config command implements security by excluding sensitive files during the packaging process.
fn is_secret_name(name: &str) -> bool {
let lower = name.to_lowercase();
if lower == ".env" || lower.starts_with(".env.") {
return true;
}
// ... logic to exclude .key, .pem, credentials.json
false
}
Sources: packages/desktop/src-tauri/src/commands/workspace.rs:460-482
Dependency Stack
The desktop integration relies on several Tauri plugins and Rust crates to provide native functionality.
| Layer | Dependency | Purpose |
|---|---|---|
| Tauri Plugin | tauri-plugin-dialog | Native folder and file selection dialogs. |
| Tauri Plugin | tauri-plugin-shell | Spawning and managing the opencode serve process. |
| Tauri Plugin | tauri-plugin-opener | Opening files or revealing them in the OS file manager. |
| Rust Crate | walkdir | Recursive scanning of skill and workspace directories. |
| Rust Crate | zip | Handling workspace configuration export/import. |
Sources: packages/desktop/src-tauri/Cargo.toml:13-33, packages/app/package.json:34-40
Conclusion
The Tauri integration is the backbone of the OpenWork desktop experience. It provides the necessary system permissions and process management capabilities required to run the OpenCode engine locally, while abstracting these complexities away from the SolidJS frontend through a clean IPC command interface. This architecture ensures a secure, high-performance environment for executing agentic workflows.