Back to Documentation
Desktop

Desktop App Internals

Tauri v2 shell, Rust command layer, PTY sessions, and UI state management.

•
14 min read
•

The desktop app is a Tauri v2 shell (version 2.9.1) running a React UI. Rust services expose commands for workflows, terminal sessions, and configuration while persisting state locally in SQLite. The capability-based permission model provides fine-grained security controls for filesystem access, HTTP requests, shell execution, and system notifications.

Desktop shell overview

Screenshot showing the plan editor, terminal tabs, and job status sidebar.

PlanToCode desktop shell
Click to expand
The desktop app showing the implementation plans panel and sidebar.

React UI and surface area

The React UI renders the task description editor, plan viewer, and terminal panels:

Tauri commands

Commands in desktop/src-tauri/src/commands/ expose Rust functionality to the React UI. Key modules include:

Key command modules:

  • workflow_commands.rs - Workflow orchestration
  • job_commands.rs - Job status and management
  • terminal_commands.rs - PTY session control
  • session_commands.rs - Session CRUD operations
  • implementation_plan_commands.rs - Plan generation
  • audio_commands.rs - Voice transcription
  • video_analysis_commands.rs - Video processing
  • device_commands.rs - Mobile device linking

Job processors and workflows

Job processing architecture in desktop/src-tauri/src/jobs/:

Job system components:

  • queue.rs - Priority queue with 8 concurrent workers
  • dispatcher.rs - Job execution dispatcher
  • registry.rs - Processor registration
  • workflow_orchestrator/ - Multi-stage workflow engine
  • processors/ - 12+ job type processors
  • streaming_handler.rs - LLM response streaming

Local persistence

SQLite storage in desktop/src-tauri/migrations/consolidated_schema.sql:

Core tables:

  • sessions - Project context and preferences
  • background_jobs - Job records with prompts/responses
  • terminal_sessions - PTY output logs
  • task_description_history - Task version history
  • file_selection_history - File selection tracking
  • project_system_prompts - Per-project overrides
  • key_value_store - Application settings

Terminal sessions

PTY terminal implementation:

Task description stability

The task description editor includes safeguards to prevent cursor jumps:

  • Remote updates are queued while the user is typing and flushed on idle or blur.
  • Selection state is tracked and restored after React re-renders.
  • Background writers call sessionActions.updateCurrentSessionFields to coordinate updates.
  • Multi-device sync uses sequence_number and version fields to resolve conflicts.

Explore related internals

The background jobs and data model docs explain how the desktop app persists and processes work.