palyrad) and the browser automation service (palyra-browserd), providing a unified interface for onboarding, health monitoring, and local agent interaction.
System Architecture
The application is structured into a Rust-based Tauri backend and a React-based frontend. The backend, referred to as the Control Center, is responsible for sidecar supervision, state persistence, and sensitive credential management.Desktop Component Interaction
The following diagram illustrates how theControlCenter manages internal services and interacts with the UI.
Tauri Control Center Overview
Sources: apps/desktop/src-tauri/src/supervisor.rs#201-218, apps/desktop/src-tauri/src/commands.rs#49-51, apps/desktop/src-tauri/src/desktop_state.rs#224-234
Core Responsibilities
Sidecar Supervision
TheControlCenter manages two primary sidecars defined by the ServiceKind enum: Gateway (palyrad) and Browserd (palyra-browserd) apps/desktop/src-tauri/src/supervisor.rs#30-33. It handles:
- Binary Resolution: Locating the correct executables for the current platform apps/desktop/src-tauri/src/supervisor.rs#43-60.
- Process Lifecycle: Spawning processes with
CREATE_NO_WINDOWon Windows apps/desktop/src-tauri/src/lib.rs#60-70 and managing restarts with exponential backoff apps/desktop/src-tauri/src/supervisor.rs#101-103. - Log Aggregation: Capturing
stdoutandstderrinto aVecDeque<LogLine>for real-time diagnostic viewing in the UI apps/desktop/src-tauri/src/supervisor.rs#105-119.
State and Secret Management
The application maintains a persistent state instate.json apps/desktop/src-tauri/src/supervisor.rs#230.
- DesktopStateFile: Stores non-sensitive configuration, onboarding progress (
DesktopOnboardingStep), and companion preferences apps/desktop/src-tauri/src/desktop_state.rs#224-234. - DesktopSecretStore: Utilizes the
palyra-vaultcrate to securely store thedesktop_admin_tokenanddesktop_browser_auth_tokenrequired for communicating with the sidecars apps/desktop/src-tauri/src/lib.rs#11-12, apps/desktop/src-tauri/src/desktop_state.rs#15-17.
Onboarding Flow
The companion guides the user through a multi-step setup process defined byDesktopOnboardingStep apps/desktop/src-tauri/src/desktop_state.rs#209-219. This includes environment validation, state root selection, sidecar initialization, and external connector setup (e.g., Discord, OpenAI) apps/desktop/src-tauri/src/onboarding.rs#78-110.
Code Entity Mapping
The following diagram maps high-level desktop features to their implementing Rust modules and structs. Desktop Code Entity Map Sources: apps/desktop/src-tauri/src/supervisor.rs#97-107, apps/desktop/src-tauri/src/onboarding.rs#78-110, apps/desktop/src-tauri/src/desktop_state.rs#236-240Subsystems
Tauri Backend: Supervisor and Commands
This subsystem contains the Rust logic for managing the sidecars and handling IPC calls from the frontend. It includes theControlCenter loop, the get_snapshot command for UI updates, and the supervisor.rs logic for process health checks.
- Key Files:
lib.rs,supervisor.rs,commands.rs,snapshot.rs. - For details, see Tauri Backend: Supervisor and Commands.
Desktop UI and Companion Shell
The frontend layer provides the “Companion Shell”—a persistent UI for interacting with agents and monitoring system status. It handles the visual onboarding wizard and provides thedesktopApi.ts bridge to the Tauri backend.
- Key Files:
apps/desktop/ui/App.tsx,apps/desktop/ui/desktopApi.ts. - For details, see Desktop UI and Companion Shell.
Platform Support
The Desktop Companion is designed for cross-platform compatibility:- Windows: Uses
creation_flagsto suppress console windows for sidecars apps/desktop/src-tauri/src/lib.rs#21-22. - Linux: Includes specific patches for
glibcompatibility apps/desktop/src-tauri/Cargo.toml#30-31. - macOS: Follows standard Tauri application packaging.