palyrad) and the browser automation daemon (palyra-browserd). It provides a native shell for platform-specific features like system notifications, secure secret storage via OS keychains, and a streamlined onboarding experience for new nodes apps/desktop/README.md#3-5.
Core Role and Architecture
The application acts as a supervisor and a companion UI. It does not replace the core daemon’s logic but rather orchestrates its execution as a sidecar process apps/desktop/README.md#17-33.- Sidecar Management: Starts, stops, and restarts
palyradandpalyra-browserdapps/desktop/src-tauri/src/lib.rs#16-20. - Secure Handoff: Facilitates secure transitions to the Web Console using admin tokens and CSRF protection apps/desktop/README.md#42-46.
- State Persistence: Manages local settings, onboarding progress, and offline message drafts in a local
state.jsonapps/desktop/src-tauri/src/desktop_state.rs#88-101.
Desktop System Context
The following diagram illustrates how the Desktop App (Code Entity:ControlCenter) bridges the user’s OS environment to the Palyra services.
Diagram: Desktop Application Component Relationships
Sources: apps/desktop/src-tauri/src/supervisor.rs#201-218, apps/desktop/src-tauri/src/commands.rs#53-62, apps/desktop/src-tauri/src/desktop_state.rs#231-232
Sidecar Supervisor and Process Lifecycle
The desktop application manages the runtime lifecycle of the daemon binaries. It uses aControlCenter struct to maintain the state of ManagedService instances apps/desktop/src-tauri/src/supervisor.rs#97-107.
- Ports: By default, it assigns specific loopback ports:
7142(Gateway Admin),7443(Gateway gRPC), and7143(Browser Health) apps/desktop/src-tauri/src/lib.rs#16-20. - Lifecycle: The
supervisor_loopruns on a 500ms tick to ensure services are running ifdesired_runningis true apps/desktop/src-tauri/src/lib.rs#1-1. - Logging: It captures stdout/stderr from sidecars, redacting sensitive information before storing them in a bounded
VecDequefor UI display apps/desktop/src-tauri/src/supervisor.rs#105-105.
Desktop Onboarding and Companion UI
The onboarding flow is a state-machine driven sequence (DesktopOnboardingStep) that guides the user from initial setup to a fully functional node apps/desktop/src-tauri/src/desktop_state.rs#209-219.
- Onboarding Steps: Includes
Welcome,StateRootselection,GatewayInit, andOperatorAuthBootstrapapps/desktop/src-tauri/src/onboarding.rs#78-110. - Companion UI: A React-based interface that provides a “Quick Facts” dashboard, log viewer, and a simplified chat interface for interacting with the local agent apps/desktop/src-tauri/src/snapshot.rs#88-96.
- Offline Drafts: If the daemon is unreachable, the UI allows users to queue “Offline Drafts” which are persisted locally until the connection is restored apps/desktop/src-tauri/src/desktop_state.rs#177-200.
Integration and Data Flow
The Desktop App communicates with the sidecars exclusively via loopback (127.0.0.1) apps/desktop/README.md#91-91. It uses a ControlPlaneClient to fetch diagnostics and status from the palyrad admin surface to build a unified ControlCenterSnapshot apps/desktop/src-tauri/src/snapshot.rs#173-182.
Diagram: Data Aggregation Flow
Sources: apps/desktop/src-tauri/src/snapshot.rs#204-216, apps/desktop/src-tauri/src/onboarding.rs#162-185
Technical Constraints
| Constraint | Value | Source |
|---|---|---|
| Supervisor Tick | 500ms | apps/desktop/src-tauri/src/lib.rs#1 |
| Max Log Lines | 400 per service | apps/desktop/src-tauri/src/lib.rs#2 |
| Log Capacity | 2,048 events | apps/desktop/src-tauri/src/lib.rs#3 |
| Secret Max Size | 4,096 bytes | apps/desktop/src-tauri/src/lib.rs#10 |
| Supported OS | Windows, macOS | apps/desktop/README.md#9 |