Environment:0xranx OpenContext Tauri Desktop
| Knowledge Sources | |
|---|---|
| Domains | Desktop, Infrastructure |
| Last Updated | 2026-10-24 10:00 GMT |
Overview
Tauri 2 desktop runtime with Rust backend commands, PTY terminal support, and IPC event streaming for the OpenContext desktop application.
Description
This environment provides the Tauri 2 desktop application framework for OpenContext. The Rust backend (`src-tauri/`) exposes Tauri commands for agent streaming, AI chat, context management, search, and terminal sessions. It uses `tauri-plugin-shell` and `tauri-plugin-clipboard-manager` plugins. The release profile uses `lto = true`, `opt-level = "s"`, and `strip = true` for optimized binaries. Agent events are emitted via Tauri's event system to the React frontend.
Usage
Use this environment for desktop agent chat, terminal sessions, and any Tauri command invocation. It is the mandatory prerequisite for `codex_exec`, `emit_agent_event`, `useAgentStreaming`, `codex_permission_response`, and `useAgentSessions` implementations.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | macOS, Windows, Linux | macOS builds as universal binary |
| Hardware | Any modern CPU | 4GB+ RAM recommended |
| Disk | 100MB for built binary | Plus Tauri build cache |
Dependencies
Rust Packages
- `tauri` = 2 (with `image-png`, `tray-icon` features)
- `tauri-plugin-shell` = 2
- `tauri-plugin-clipboard-manager` = 2
- `opencontext-core` (path dep, with `search` feature)
- `tokio` = 1 (rt-multi-thread, macros, sync)
- `reqwest` = 0.12 (json, stream)
- `futures` = 0.3
- `portable-pty` = 0.8 (terminal)
- `serde` = 1, `serde_json` = 1
- `log` = 0.4
Build Dependencies
- `tauri-build` = 2
- Tauri CLI: `@tauri-apps/cli` >= 2
npm Packages
- `@tauri-apps/api` >= 2.9.1
- `@tauri-apps/plugin-shell` >= 2.3.3
- `@tauri-apps/plugin-clipboard-manager` >= 2.3.2
Credentials
No credentials required for the Tauri runtime itself. Agent API keys are managed by the backend.
Quick Install
# Install Tauri CLI
npm install -D @tauri-apps/cli
# Run desktop app in dev mode
npm run tauri:dev
# Build production binary
npm run tauri:build
# macOS universal binary
npm run tauri:build:mac
Code Evidence
Tauri command definition from `src-tauri/src/commands/agent.rs:1528-1533`:
#[tauri::command]
pub(crate) fn codex_exec(
app: tauri::AppHandle,
state: State<AppState>,
options: CodexExecOptions,
) -> CmdResult<serde_json::Value> {
Agent event emission from `src-tauri/src/commands/agent.rs:35-63`:
// emit_agent_event uses app.emit() to send events to the frontend
app.emit(&event_name, &payload);
Release profile optimization from `src-tauri/Cargo.toml:24-29`:
[profile.release]
panic = "abort"
codegen-units = 1
lto = true
opt-level = "s"
strip = true
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `tauri: command not found` | Tauri CLI not installed | `npm install -D @tauri-apps/cli` |
| Windows build fails on Linux | Windows builds must run on Windows or CI | Use `gh workflow run desktop-build.yml` |
| `portable-pty` build error | Missing system PTY libraries | Install `libudev-dev` on Linux |
Compatibility Notes
- Windows builds: Must run on Windows or via CI (`npm run tauri:build:win` prints an error on non-Windows).
- macOS universal binary: Built via `tauri build --target universal-apple-darwin`.
- Release optimization: `opt-level = "s"` optimizes for size, not speed. `lto = true` and `strip = true` further reduce binary size.