Introducing a new way to review your PRs.

Read the announcement

hcavarsan / pipedash

One dashboard for CI/CD pipelines across multiple providers

View on GitHub

19 documents · Updated Nov 23, 2026

docs / desktop-runtime

Desktop runtime and Tauri bridge

The desktop runtime is the native shell that starts Pipedash, connects the web UI to the Rust core, and adapts core events to desktop and mobile behavior. It provides one command bridge for data work and platform services for windows, menus, notifications, sharing, background work, updates, and app protection.

Runtime startup

Startup prepares the app data area, loads the saved run mode, and then shows setup, starts a remote client, or builds the local core. The web UI can start before the core is ready and use setup and status commands to guide the user.

flowchart TD
    A[Native process] --> B[Tauri builder]
    B --> C[Data directory and config]
    C --> D{Saved run mode}
    D -->|Unset| E[Onboarding]
    D -->|Client| F[Remote connection]
    D -->|Standalone| G{Ready and unlocked?}
    G -->|No| H[Setup or unlock screen]
    G -->|Yes| I[Core context]
    I --> J[Commands and event bus]
    F --> J

The entry point is crates/…/main.rs. It delegates to run, which installs Tauri plugins, registers commands, creates shared state, and starts the selected mode. Desktop builds include the web service, tray support, single-instance handling, and update support. Mobile builds include device plugins instead. crates/…/lib.rs• L49-85, crates/…/Cargo.toml• L45-67

The core is a replaceable session. Setup, launch, resume, and unlock can each create a core with a storage choice that matches the vault state. A new core replaces the old session and refreshes native projections so stale work does not update the UI. Startup can recover a corrupt database during launch, while setup and unlock report the error to their caller. crates/…/tests.rs• L62-99, crates/…/tests.rs• L124-169

Setup can also change a live configuration. The runtime detaches the current desktop projection before it applies the change, then resumes the core or reports that a restart or unlock is needed. crates/…/setup.rs• L70-112

References: crates/…/lib.rs• L49-85 crates/…/Cargo.toml• L45-67 crates/…/setup.rs• L70-112 crates/…/tests.rs• L124-169

Tauri command bridge

The Tauri command bridge gives the web UI a typed request path into the Rust core. The browser-facing service names commands and maps their results into domain types, while Rust checks readiness, validates inputs, calls the owning service, and returns a common error shape.

Commands cover the product actions that need native or core access:

  • Setup, configuration, storage, vault, and reset actions.
  • Provider discovery, sign-in, permissions, and pipeline data.
  • Pipeline runs, refresh, metrics, run logs, views, pins, and notifications.
  • Remote connection, local hosting, file export, native device actions, and updates.

The bridge is not a second business layer. It controls access to the active core and carries data between the web UI and the services that own the behavior. Calls from src/…/tauri.ts use time limits and, where safe, retry rules. Commands that need the core return an initialization error until a core exists, so setup and vault screens can use the same bridge before the app is ready. General settings use this same path, and a successful settings change schedules local notification synchronization. crates/…/lib.rs• L84-243, crates/…/setup.rs• L39-67, crates/…/settings.rs• L17-38

Pipeline commands provide the web UI with one request surface for pipeline state and actions. They cover cached pipeline data, run history, run details, triggers, cancellation, review, reruns, and pipeline enablement. Each command uses the active core, so the same readiness rule applies to reads and writes. crates/…/pipelines.rs• L25-180, crates/…/lib.rs• L111-128

Build watching adds a native activity path for a selected run. It permits one reserved watch session at a time, ties provider changes and native end notices to that session, and cancels in-flight work when the matching session ends. A replacement session is protected from late notices or provider removals that belong to an older session. Cancellation also prevents new provider work from starting and drains each interruption once. When desktop watching is unavailable, the reported status does not retain a private watch snapshot. crates/…/tests.rs• L95-195, crates/…/tests.rs• L212-254, crates/…/tests.rs• L323-344

Desktop settings use the same bridge to control the tray, background mode, system notifications, and automatic update checks. The settings contract keeps background mode dependent on the tray and preserves failed changes for a later retry. crates/…/settings.rs• L34-61, crates/…/settings.rs• L122-152

References: src/…/tauri.ts• L71-117 crates/…/lib.rs• L84-243 crates/…/setup.rs• L39-67 crates/…/settings.rs• L17-38 crates/…/pipelines.rs• L25-180 crates/…/settings.rs• L240-293

Core event bus

The event bus carries changes from the core to every surface that needs to react. The Tauri adapter sends named events to the web UI, filters notification events through local preferences, updates desktop projections, and forwards events to the desktop host when sharing is active.

sequenceDiagram
    participant Core
    participant Bus as Tauri event bus
    participant Web as Web UI
    participant Native as Platform services
    participant Host as Desktop host
    Core->>Bus: Core event
    Bus->>Web: Named event and payload
    Bus->>Native: Notification or mobile handling
    Bus->>Host: Broadcast event when desktop host is active

Most events keep the core event name and JSON payload. A notification is different: the bus emits only the copy admitted by notification preferences. This keeps the web UI, desktop history, system alerts, and mobile alerts aligned with one user choice. crates/…/tauri_event_bus.rs• L35-57, crates/…/tauri_event_bus.rs• L63-116

Desktop projections wake for pipeline and provider changes, then read either the local core or the connected server. A generation and connection epoch reject results from an old core or server. A mode or server change also clears private notices and old menu data before the new source is shown. crates/…/projection.rs• L101-159, crates/…/projection.rs• L180-264, crates/…/tests.rs• L223-316

References: crates/…/tauri_event_bus.rs• L19-24 crates/…/tauri_event_bus.rs• L63-116 crates/…/projection.rs• L180-264

Desktop host surfaces

Desktop support turns the same application state into native window, menu, tray, notification, sharing, and background behavior. The desktop projection can use the local core in standalone mode or request the same view data from a connected server in client mode.

The desktop host provides these user-facing surfaces:

  • A main window that can be restored, focused, hidden, or minimized.
  • A native menu and optional tray menu with pipeline status, pinned items, refresh, notifications, and lock actions.
  • System notifications that carry a target back to the web UI when the user opens them.
  • A local sharing host that exposes the application to paired devices when enabled.

The tray and menu are projections of current state rather than separate sources of truth. Core events and remote connection changes wake a projection refresh. This keeps the native surface useful while the window is hidden or the desktop is acting as a client of another host. Locked state removes private rows and service actions, while client mode shows server data only after the connection is ready. crates/…/desktop.rs• L102-137, crates/…/projection.rs• L180-236, crates/…/tests.rs• L115-144, crates/…/tests.rs• L298-355

Tray status gives a compact view of the same state. It considers watched activity, unread notices, pipeline failures, notification preferences, and remote connection state, with locked or unavailable sessions shown as offline. crates/…/tests.rs• L97-121, crates/…/tests.rs• L145-212

The desktop host is the computer-side sharing service. It starts only when enabled, publishes core events to connected clients, and updates its shared core when the local session changes. The related host and service model is described in Application hosts and Web service. crates/…/mod.rs• L222-267, crates/…/mod.rs• L302-347

The single-instance rule sends a second launch to the existing process and restores its main window. If the user closes the window while background mode is enabled, the runtime hides or minimizes it instead of exiting. Background mode requires a working tray. crates/…/lib.rs• L53-62, crates/…/desktop.rs• L149-176, crates/…/settings.rs• L131-144

Desktop settings

Desktop settings persist native behavior across launches. Tray visibility controls whether background mode is valid, notification consent controls system alerts, and automatic update checks control the update worker. A failed save stays visible and can be retried without discarding later changes. crates/…/settings.rs• L156-192, crates/…/tests.rs• L30-125

References: crates/…/settings.rs• L34-61 crates/…/settings.rs• L131-152 crates/…/tests.rs• L3-28

Desktop updates

The desktop update service checks for signed releases, reports a small status state machine to the web UI, and installs a selected update before restarting the app. Automatic checks wait until startup settles and run only when enabled and no check or install is already active. crates/…/updater.rs• L33-55, crates/…/updater.rs• L256-275

The release configuration creates updater artifacts, while the shared desktop configuration identifies the release endpoint and verifies its signing key. A failed install keeps the update available for another attempt. crates/…/tauri.conf.json• L23-40, crates/…/tauri.release.conf.json• L1, crates/…/updater.rs• L278-326

References: crates/…/updater.rs• L138-199 crates/…/updater.rs• L224-326 crates/…/tauri.conf.json• L23-40 crates/…/tauri.release.conf.json• L1

Mobile runtime

Mobile uses the same Tauri command and event model but replaces desktop window and tray behavior with phone and tablet services. iOS and Android share the Rust runtime while native plugin layers provide platform-specific work such as biometrics, sharing, privacy covers, badges, notification refresh, and build watching.

Mobile startup has two important differences from desktop:

  • Storage follows the current app container so an old container path does not remain in the config.
  • The app can resume a saved remote connection and can run headless Android refresh work through a Java bridge.

The web UI calls mobile-only features through src/…/mobile.ts. Native events and pending intents use named Tauri events plus a peek-and-ack flow, so a link or notification action is not lost while the web view is starting. src/…/mobile.ts• L17-27, src/…/mobile.ts• L38-97, crates/…/native.rs• L128-175

Android can start a headless refresh from Java without opening the main UI. The bridge initializes the Android TLS verifier and credential store once, runs notification refresh work, returns notices as JSON, and accepts cancellation. crates/…/android.rs• L22-49, crates/…/android.rs• L51-71

References: crates/…/lib.rs• L75-82 crates/…/lib.rs• L222-250 crates/…/android.rs• L51-71 src/…/mobile.ts• L38-97

Native plugin boundary

The native plugin boundary keeps device APIs outside the shared core. Rust exposes app-level operations such as haptics, appearance, accessibility, sharing, badges, privacy cover control, notification callbacks, and build-watch state. Mobile implementations forward those operations to iOS or Android, while non-mobile builds provide safe fallbacks or report unsupported actions.

The main native plugin is registered for every Tauri target. Its mobile implementation calls the platform plugin and receives callbacks through IPC channels. Its non-mobile implementation keeps build-watch state in memory and reports mobile-only features as unavailable or unsupported. crates/…/lib.rs• L10-61, crates/…/mobile.rs• L129-155, crates/…/unsupported.rs• L205-283

Push registration follows a separate boundary. iOS uses a native push plugin, while other targets use an unsupported implementation or the desktop push path. The application can therefore keep notification setup in one command flow without assuming that every platform can register for remote notifications. crates/…/lib.rs• L10-53, crates/…/mobile.rs• L38-65

Native notification actions and deep links become NativeIntent values. The runtime stores the latest intent, signals the web UI, and clears it only when the UI acknowledges the matching ID. This gives cold-start actions the same route into the application as actions received while it is open. crates/…/native.rs• L105-175, crates/…/native.rs• L204-253

Desktop credentials use the operating system keyring through a serialized token store. The store caches the current token set, supports encrypted export and import, and migrates older per-provider entries when they are read. crates/…/keyring_store.rs• L66-113, crates/…/keyring_store.rs• L178-256

References: crates/…/lib.rs• L41-61 crates/…/mobile.rs• L129-155 crates/…/unsupported.rs• L205-283 crates/…/lib.rs• L37-53 crates/…/native.rs• L105-175 crates/…/keyring_store.rs• L178-256

Application lock

Application lock protects the active session by removing the core from memory and clearing the session vault password. It is supported on mobile, where biometric or device-credential authentication can restore the session. Desktop exposes the lock action but does not enable biometric app-lock support.

The lock state has two parts: saved settings and the current locked flag. A configured mobile app starts locked after setup. If background locking is enabled, the app locks on resume only when the core is loaded and no authentication prompt is active. crates/…/app_lock.rs• L37-52, crates/…/app_lock.rs• L128-141, crates/…/app_lock.rs• L366-397

Locking detaches desktop projections, stops the core, clears the vault password, interrupts active watches, and emits a vault-locked event. Unlocking authenticates first, then rebuilds the core and starts background work only after storage has been checked. A saved vault password is kept in the device-only keychain only when app lock is enabled for an encrypted vault. crates/…/app_lock.rs• L341-363, crates/…/app_lock.rs• L447-486, crates/…/commands.rs• L1528-1606

The native privacy cover follows the lock settings. It can hide sensitive content while the app is in the background and is released only through an explicit native command after the app is ready. crates/…/native.rs• L255-269, crates/…/lib.rs• L463-482

References: crates/…/app_lock.rs• L128-141 crates/…/app_lock.rs• L341-363 crates/…/app_lock.rs• L447-556 crates/…/native.rs• L255-269

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the command name, argument casing, result type, timeout policy, and Rust handler aligned across src/…/tauri.ts, src/…/desktop.ts, src/…/mobile.ts, and the Tauri invoke list. For general settings, also preserve the follow-up local notification sync after a successful update.
  • When a core event changes, review its webview payload, notification admission, desktop projection wake rules, mobile handling, and host broadcast path.
  • When a lock or unlock transition changes, preserve the order that detaches projections, clears credentials, replaces the core, interrupts watches, and emits the vault event.
  • When a native intent changes, update deep-link parsing, notification action mapping, pending-intent acknowledgment, and the frontend event names together.
  • When a platform plugin adds a capability, define its mobile behavior and its non-mobile fallback before exposing it through a shared command.
  • When desktop settings or update phases change, keep the persisted settings shape, status JSON, frontend labels, updater configuration, and retry behavior aligned.
  • When build-watch state changes, keep session identity checks aligned across native status updates, provider removal, cancellation, deep-link targets, and replacement sessions.

Important failure modes

TriggerConsequenceGuard
A core command runs before setup or unlock creates a coreThe UI receives an initialization error instead of dataMaybeCoreContext rejects the call until the active core exists.
A second desktop launch startsThe existing window is restored instead of creating a second sessionThe single-instance plugin routes the launch to show_main_window.
The desktop window closes with background mode enabled but the tray is unavailableThe close is not intercepted, so the app may exitClose-to-tray requires a ready tray with no tray error.
A stale core event arrives after lock, reconnect, or session replacementOld private data can overwrite the current desktop projectionDesktop tickets use core generation and connection epoch checks.
A setup change is applied while the current projection still owns the old coreOld menu or tray data can survive the storage changeSetup detaches the projection and flushes the native menu before resume.
A mobile vault unlock has no saved device-only passwordBiometric authentication succeeds but the encrypted vault cannot resumeThe unlock response tells the user to turn app lock off and on again.
A non-mobile target requests a mobile-only native actionThe operation is unavailable or returns an unsupported errorThe native plugin supplies explicit fallback behavior per capability.
A notification or deep link arrives during cold startThe route can be missed if it is sent only as a transient eventNative intents remain pending until the frontend acknowledges the matching ID.
An update install fails after a release was foundThe user loses the ready update unless it remains pendingThe updater preserves the pending update and exposes a retryable failed state.
A late provider removal or native end notice belongs to an old build-watch sessionA replacement watch can be cancelled by unrelated workWatch sessions use reserved identity and match cancellation to the current session.
A build-watch session is cancelled while a provider request is activeThe request can continue after the watch has endedSession cancellation drops the in-flight task and prevents a cancelled session from starting new work.

Key files

FileWhy to read it
crates/…/lib.rsTauri app assembly, startup modes, state, plugins, and command registration.
crates/…/core_boot.rsCore creation, storage choice, replacement, unlock, and background start.
crates/…/setup.rsSetup status, configuration apply, and live session replacement.
crates/…/settings.rsGeneral settings access and the notification sync triggered by a successful update.
crates/…/pipelines.rsPipeline reads and actions exposed through the command bridge.
crates/…/tests.rsSession ownership, cancellation, native status matching, and selected-run navigation guarantees.
crates/…/projection.rsLocal and remote menu projection, event wake rules, and stale-result protection.
crates/…/desktop.rsDesktop state setup, window behavior, tray readiness, and lifecycle handling.
crates/…/settings.rsTray, background, notification, and update settings.
crates/…/updater.rsUpdate checks, status events, download progress, and restart flow.
crates/…/mod.rsComputer-side sharing host lifecycle and paired-device flow.
crates/…/app_lock.rsLock state, biometric unlock, session shutdown, and resume rules.
crates/…/native.rsDeep links, notification actions, pending intents, and native command wrappers.
crates/…/keyring_store.rsOperating system keyring storage and legacy token migration.
src/…/tauri.tsFrontend command client, type mapping, retry, and timeout behavior.
src/…/mobile.tsFrontend mobile command and event contracts.
crates/…/mobile.rsMobile native operation and callback boundary.
crates/…/unsupported.rsDesktop fallback behavior for mobile-native features.
crates/…/tauri.conf.jsonFrontend build link, desktop window, bundle, and signed update endpoint.