palyrad), the browser automation daemon (palyra-browserd), and the local node host, providing a unified “companion shell” for human-in-the-loop interactions apps/desktop/README.md#17-35.
Architecture Overview
The Control Center operates as a bridge between the local operating system and the Palyra control plane. It encapsulates the complexity of sidecar management while exposing a React-based UI for monitoring and interaction.System Entity Mapping
The following diagram maps the high-level functional components to their respective implementation entities within theapps/desktop workspace.
Diagram: Desktop Component Mapping
Sources: apps/desktop/src-tauri/src/supervisor.rs#212-234, apps/desktop/src-tauri/src/desktop_state.rs#215-227, apps/desktop/src-tauri/src/commands.rs#67-76, apps/desktop/ui/src/App.tsx#60-61, apps/desktop/ui/src/lib/desktopApi.ts#1-2
Process Supervision
The core of the application is theControlCenter struct, which implements a 500ms supervisor tick loop apps/desktop/src-tauri/src/lib.rs#1-1. This loop ensures that desired services are running and healthy.
- Managed Services: Supports
Gateway,Browserd, andNodeHostapps/desktop/src-tauri/src/supervisor.rs#35-41. - Health Monitoring: Uses
HealthEndpointPayloadto verify sidecar liveness via HTTP/gRPC ports apps/desktop/src-tauri/src/supervisor.rs#203-209. - Log Draining: Aggregates
StdoutandStderrfrom sidecars into a boundedLogLinebuffer (max 400 lines per service) for diagnostic visibility apps/desktop/src-tauri/src/lib.rs#2-3, apps/desktop/src-tauri/src/supervisor.rs#116-116.
Desktop State and Companion UI
The Control Center maintains a localDesktopStateFile to persist user preferences, onboarding progress, and offline drafts apps/desktop/src-tauri/src/desktop_state.rs#215-227.
Companion Shell Features
The React-based UI (located inapps/desktop/ui) provides several key surfaces:
- Chat & Sessions: A session-aware chat interface that consumes the
/console/v1APIs apps/desktop/ui/src/App.tsx#50-56. - Approval Inbox: Local notification and actioning for pending security approvals apps/desktop/src-tauri/src/desktop_state.rs#43-49.
- Offline Drafts: Bounded queue for messages composed while the daemon is unreachable apps/desktop/src-tauri/src/desktop_state.rs#62-68.
- Onboarding: A step-by-step wizard (
DesktopOnboardingStep) guiding users through environment setup and provider authentication apps/desktop/src-tauri/src/desktop_state.rs#209-213.
Technical Summary
| Component | Entity | Responsibility |
|---|---|---|
| Supervisor Loop | SUPERVISOR_TICK_MS | 500ms interval for process health checks apps/desktop/src-tauri/src/lib.rs#1-1. |
| State Versioning | DESKTOP_STATE_SCHEMA_VERSION | Currently version 6; manages local JSON state migrations apps/desktop/src-tauri/src/lib.rs#9-9. |
| API Bridge | tauri::command | Exposes Rust ControlCenter methods to the React frontend apps/desktop/src-tauri/src/commands.rs#67-120. |
| Identity | CONSOLE_PRINCIPAL | Identifies the desktop app as admin:desktop-control-center for internal API calls apps/desktop/src-tauri/src/lib.rs#7-7. |
Communication Flow
The UI interacts with the supervisor through a set of asynchronous commands defined incommands.rs.
Diagram: UI-to-Supervisor Command Flow
Sources: apps/desktop/ui/src/lib/desktopApi.ts#1-2, apps/desktop/src-tauri/src/commands.rs#67-76, apps/desktop/src-tauri/src/snapshot.rs#37-40
Child Pages: