The Desktop Host is an Electron-based wrapper for the Executor platform. It bundles the core SDK, a React-based frontend, and a production-grade CLI binary to provide a local-first, native experience. Its primary responsibilities include managing the lifecycle of the local server (Sidecar), supervising background daemons for persistent MCP access, handling auto-updates, and providing diagnostic tools for troubleshooting.
The application follows a standard Electron multi-process model, but introduces a third tier: the Sidecar.
The following diagram illustrates how the Electron Main process orchestrates the startup and connection between the UI and the local server.
Diagram: Desktop Process Orchestration
Sources: apps/desktop/src/main/index.ts90-104 apps/desktop/src/main/sidecar.ts4-11 apps/desktop/src/preload/index.ts10-116
The application manages two types of local server connections defined in SidecarConnection apps/desktop/src/main/sidecar.ts65-85:
spawn apps/desktop/src/main/sidecar.ts199-228 It is terminated when the app quits.launchd on macOS or systemd on Linux) that outlives the desktop window. This ensures MCP tools remain available to AI clients even if the UI is closed apps/desktop/src/main/sidecar.ts76-81The service.ts module interfaces with the bundled CLI to control these background daemons:
installSupervisedService: Shells out to executor install to register the OS-level service apps/desktop/src/main/service.ts126-137supervisedServiceStatus: Checks if the daemon is registered and running by parsing the output of executor service status apps/desktop/src/main/service.ts107-124Sources: apps/desktop/src/main/sidecar.ts65-85 apps/desktop/src/main/service.ts13-25 apps/desktop/src/main/service.ts107-161
The preload/index.ts file defines the ExecutorBridge, which exposes a limited set of Main process functions to the React frontend via contextBridge.exposeInMainWorld("executor", api) apps/desktop/src/preload/index.ts118
Settings like the server port are persisted using electron-store in settings.ts apps/desktop/src/main/settings.ts1-16 The application also includes a dedicated desktop-settings plugin that allows users to:
rotateLocalAuthToken) apps/desktop/src/main/settings.ts42Sources: apps/desktop/src/preload/index.ts1-120 apps/desktop/src/main/settings.ts1-49
The host uses electron-updater for background updates. The state machine in updater-state.ts tracks transitions from checking to downloaded apps/desktop/src/main/updater-state.ts
If the Sidecar fails to start or exits unexpectedly, the Main process replaces the web UI with a native-looking "Crash Screen" apps/desktop/src/main/crash-screen.ts1-7 This screen is a data: URL that retains access to the IPC bridge, allowing users to:
.executor data directory to a backup location and starts fresh apps/desktop/src/main/reset-state.ts46-47Sources: apps/desktop/src/main/index.ts18-20 apps/desktop/src/main/crash-screen.ts112-169 apps/desktop/src/main/reset-state.ts1-50
The desktop app is packaged using electron-builder. A critical step in the build pipeline is staging the sidecar binary.
The script scripts/build-sidecar.ts compiles the apps/cli package into a standalone binary and copies it into the Electron resources/executor directory apps/desktop/scripts/build-sidecar.ts1-15 This ensures the Desktop app always has a compatible version of the execution engine.
The electron-builder.config.ts handles:
x64 and arm64 via GitHub Actions matrix flags rather than pinning in config to avoid arch mismatch errors apps/desktop/electron-builder.config.ts22-28Sources: apps/desktop/scripts/build-sidecar.ts34-56 apps/desktop/electron-builder.config.ts1-63
| Component | Code Entity | Responsibility |
|---|---|---|
| Main Entry | index.ts | Bootstraps Electron, manages BrowserWindow. |
| Lifecycle | sidecar.ts | Spawns/monitors the executor CLI process. |
| IPC Bridge | ExecutorBridge | Secure communication between React and Node.js. |
| Service Control | service.ts | Manages launchd/systemd registrations. |
| Persistence | settings.ts | Manages settings.json via electron-store. |
| Diagnostics | diagnostics.ts | Collects logs and crash dumps for export. |
Diagram: Sidecar Readiness Contract This diagram shows the specific string-based handshake used to synchronize the Electron process with the Bun/CLI sidecar.
Sources: apps/desktop/src/main/sidecar.ts38-42 apps/desktop/src/sidecar/server.ts142-144 apps/desktop/src/main/index.ts141-146
Refresh this wiki