Skip to main content
The Desktop Companion is a Tauri-based application that serves as the primary control center and supervisor for the Palyra ecosystem on desktop platforms (Windows, macOS, and Linux). It acts as a management layer that orchestrates the lifecycle of the core daemon (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 the ControlCenter 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

The ControlCenter 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:

State and Secret Management

The application maintains a persistent state in state.json apps/desktop/src-tauri/src/supervisor.rs#230.

Onboarding Flow

The companion guides the user through a multi-step setup process defined by DesktopOnboardingStep 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-240

Subsystems

Tauri Backend: Supervisor and Commands

This subsystem contains the Rust logic for managing the sidecars and handling IPC calls from the frontend. It includes the ControlCenter loop, the get_snapshot command for UI updates, and the supervisor.rs logic for process health checks.

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 the desktopApi.ts bridge to the Tauri backend.

Platform Support

The Desktop Companion is designed for cross-platform compatibility: Sources: apps/desktop/src-tauri/src/lib.rs#1-81, apps/desktop/src-tauri/src/supervisor.rs#1-218, apps/desktop/src-tauri/src/onboarding.rs#1-110, apps/desktop/src-tauri/src/desktop_state.rs#1-234

Child Pages