Skip to main content
The Palyra Desktop Application (the “Desktop Companion”) is a Tauri-based distribution that provides a local control-center for supervising Palyra services. It acts as a supervisor for the core daemon (palyrad), the browser automation service (palyra-browserd), and the local node host (palyra node). Beyond process management, it layers a native “Companion Shell” that includes ambient runtime features like a tray-based quick panel, voice overlay, and global hotkeys.

Architecture Overview

The application follows a standard Tauri split: a Rust-based backend (“src-tauri”) for system-level supervision and a React/Vite frontend (“ui”) for the operator interface.

Component Relationship

The following diagram illustrates how the desktop application bridges the user’s desktop environment with the Palyra core services. Title: Desktop Application Bridge Architecture Sources: apps/desktop/src-tauri/src/lib.rs#1-45, apps/desktop/src-tauri/src/supervisor.rs#1-15, apps/desktop/README.md#45-57

The Supervisor (ControlCenter)

The ControlCenter is the central struct in the Rust backend responsible for the lifecycle of local Palyra services. It maintains the ManagedService state for each sidecar and performs periodic reconciliation.

Managed Services

The supervisor manages three primary service kinds:
  1. Gateway (palyrad): The central daemon.
  2. Browserd (palyra-browserd): The gRPC-based browser automation engine.
  3. NodeHost (palyra node host): The first-party execution node for local capabilities.

Implementation Details

Title: Service Lifecycle State Machine Sources: apps/desktop/src-tauri/src/supervisor.rs#128-140, apps/desktop/src-tauri/src/supervisor.rs#190-199, apps/desktop/src-tauri/src/tests.rs#130-136

Desktop State and Profile Registry

The application maintains its own persisted state separate from the daemon’s configuration. This is stored in a JSON state file (typically desktop-state.json).

Key State Entities

Onboarding Flow

The desktop application guides the user through a multi-step onboarding process:
  1. Welcome: Introduction to the companion.
  2. State Root Selection: Choosing where Palyra data will be stored.
  3. Profile Initialization: Setting up the default local profile.
  4. Connector Setup: Guided flow for Discord or other communication channels apps/desktop/src-tauri/src/onboarding.rs#15-35.
Sources: apps/desktop/src-tauri/src/desktop_state.rs#1-30, apps/desktop/src-tauri/src/onboarding.rs#40-60

Companion Shell and UI (React)

The frontend is a React application built with Vite and HeroUI, communicating with the Rust backend via Tauri’s invoke API.

Domain Architecture

The UI is structured around the useDesktopCompanion hook, which provides a DesktopCompanionSnapshot containing:
  • control_center: Status of the supervised processes and local ports.
  • session_catalog: Recent chat sessions retrieved from the local gateway.
  • approvals: Pending tool execution requests requiring operator intervention.
  • inventory: Available devices and capabilities apps/desktop/ui/src/lib/desktopApi.ts#223-264.

Ambient Runtime Features

The application provides “ambient” surfaces that are accessible outside the main window:

Snapshot and Redaction

To ensure security, the snapshot.rs module redacts sensitive information before sending it to the UI. It uses redact_url_strict and redact_auth_error_strict from palyra-common to sanitize log lines and error messages apps/desktop/src-tauri/src/snapshot.rs#18-23. Title: Desktop UI Data Flow Sources: apps/desktop/ui/src/App.tsx#117-160, apps/desktop/src-tauri/src/snapshot.rs#1-15, apps/desktop/src-tauri/src/commands.rs#146-162

Desktop Node Enrollment

The desktop application automates the enrollment of the local machine as a Palyra node.
  1. Code Generation: It requests a pairing code from the local gateway via /console/v1/pairing/requests/code apps/desktop/README.md#57-63.
  2. Installation: It executes palyra node install using the generated code.
  3. Supervision: Once enrolled, the supervisor keeps palyra node run --json alive and parses its output to surface device health in the UI apps/desktop/README.md#63-65, apps/desktop/src-tauri/src/supervisor.rs#51-55.
Sources: apps/desktop/README.md#87-106, apps/desktop/src-tauri/src/supervisor.rs#68-74