Skip to main content

Workspace Structure

The Jarvis Rust workspace at jarvis-rs/Cargo.toml defines 10 crates with clear separation of concerns:
[workspace]
members = [
    "crates/jarvis-app",
    "crates/jarvis-common",
    "crates/jarvis-config",
    "crates/jarvis-platform",
    "crates/jarvis-tiling",
    "crates/jarvis-renderer",
    "crates/jarvis-ai",
    "crates/jarvis-social",
    "crates/jarvis-webview",
    "crates/jarvis-relay",
]
All crates share a common version (0.1.0) and are published under the MIT license.

Crate Overview

jarvis-common

Foundation crate with shared types, errors, actions, and event bus

jarvis-config

TOML configuration loading, validation, themes, live reload

jarvis-platform

OS abstractions: clipboard, paths, crypto, keybinds

jarvis-tiling

Binary split tree layout engine and pane management

jarvis-renderer

GPU rendering: wgpu, shaders, UI chrome, effects

jarvis-ai

AI client implementations: Claude, Gemini, Whisper

jarvis-social

Social features: presence, chat, channels, identity

jarvis-webview

WebView management: wry wrapper, IPC, content provider

jarvis-app

Application shell: window, event loop, IPC dispatch

jarvis-relay

Standalone WebSocket relay for mobile-desktop bridging

jarvis-common

Type: Library
Dependencies: None (foundation crate)
Path: jarvis-rs/crates/jarvis-common/src/lib.rs
The foundation crate with zero internal-crate dependencies. Defines the shared vocabulary used across all other crates.

Key Modules


jarvis-config

Type: Library
Dependencies: jarvis-common
Path: jarvis-rs/crates/jarvis-config/src/lib.rs
Manages the entire configuration lifecycle with TOML parsing, theme support, plugin discovery, validation, and live reload.

Key Features

  • 25+ config sections as strongly-typed structs with serde defaults
  • Built-in themes with selective field overrides
  • Plugin discovery from {config_dir}/jarvis/plugins/
  • File system watcher for live config reload
  • Validation of colors, ranges, constraints
  • TOML round-trip (read and write)

Main Entry Point

use jarvis_config::load_config;

let config = load_config().expect("failed to load config");
println!("Theme: {}", config.theme.name);
println!("Font size: {}", config.font.size);
The load_config() function:
  1. Loads TOML from platform config directory
  2. Applies selected theme
  3. Discovers local plugins
  4. Validates all fields
  5. Returns JarvisConfig

Config Sections


jarvis-platform

Type: Library
Dependencies: jarvis-common, jarvis-config
Path: jarvis-rs/crates/jarvis-platform/src/lib.rs
OS-level abstractions and platform services.

Key Modules


jarvis-tiling

Type: Library
Dependencies: jarvis-common
Path: jarvis-rs/crates/jarvis-tiling/src/lib.rs
A pure-logic tiling window manager with no platform dependencies. See Tiling System for complete documentation.

Core Types

// Binary split tree
pub enum SplitNode {
    Leaf { pane_id: u32 },
    Split {
        direction: Direction,
        ratio: f64,
        first: Box<SplitNode>,
        second: Box<SplitNode>,
    },
}

// Horizontal (left/right) or Vertical (top/bottom)
pub enum Direction {
    Horizontal,
    Vertical,
}

// Central coordinator
pub struct TilingManager {
    tree: SplitNode,
    panes: HashMap<u32, Pane>,
    stacks: HashMap<u32, PaneStack>,
    focused: u32,
    zoomed: Option<u32>,
    layout_engine: LayoutEngine,
    next_id: u32,
}

Operations

  • split() - Split focused pane horizontally or vertically
  • close_focused() - Remove focused pane and collapse tree
  • focus_next() / focus_prev() - Cycle focus through panes
  • focus_direction() - Move focus in a direction
  • zoom_toggle() - Toggle fullscreen mode for focused pane
  • resize() - Adjust split ratio by keyboard
  • swap() - Swap focused pane with neighbor
  • compute_layout() - Convert tree to pixel rectangles

jarvis-renderer

Type: Library
Dependencies: jarvis-common, jarvis-config, jarvis-platform
Path: jarvis-rs/crates/jarvis-renderer/src/lib.rs
GPU rendering via wgpu (cross-platform Vulkan/Metal/DX12). See Renderer for complete documentation.

Key Components


jarvis-ai

Type: Library
Dependencies: jarvis-common
Path: jarvis-rs/crates/jarvis-ai/src/lib.rs
AI provider clients with a unified interface.

Trait

#[async_trait]
pub trait AiClient: Send + Sync {
    async fn send_message(
        &self,
        messages: &[Message],
        tools: &[ToolDefinition],
    ) -> Result<AiResponse, AiError>;

    async fn send_message_streaming(
        &self,
        messages: &[Message],
        tools: &[ToolDefinition],
        on_chunk: Box<dyn Fn(String) + Send + Sync>,
    ) -> Result<AiResponse, AiError>;
}

Providers

Claude

ClaudeClient - Claude API with SSE streaming

Gemini

GeminiClient - Google Gemini API

Whisper

WhisperClient - OpenAI Whisper transcription

Features

  • Streaming - SSE stream parsing for real-time responses
  • Tool calling - Function definitions and execution
  • Session management - Multi-turn conversations with tool-call loops
  • Token tracking - Cumulative usage across providers
  • Skill routing - Route user intents to appropriate provider

jarvis-social

Type: Library
Dependencies: jarvis-common
Path: jarvis-rs/crates/jarvis-social/src/lib.rs
Social features: presence, chat, identity, and experimental collaboration.

Core Features

Experimental Features

The following features are behind the experimental-collab feature flag and may change.
  • pair - Pair programming sessions with PairManager, PairSession, PairRole
  • voice - Voice chat rooms with VoiceManager, VoiceRoom, VoiceConfig
  • screen_share - Screen sharing with ScreenShareManager, ShareQuality

jarvis-webview

Type: Library
Dependencies: jarvis-common
Path: jarvis-rs/crates/jarvis-webview/src/lib.rs
WebView lifecycle management and IPC bridge via wry.

Key Components


jarvis-relay

Type: Binary (jarvis-relay)
Dependencies: None (standalone)
Path: jarvis-rs/crates/jarvis-relay/src/main.rs
A standalone WebSocket relay server for mobile-to-desktop bridging.

Architecture

Features

  • Session pairing - Desktop and mobile clients pair by session ID
  • Message relay - Forwards messages between paired clients
  • Rate limiting - Per-IP connection limiting and total session caps
  • Stale session reaping - Removes inactive sessions
  • E2E encryption - Never inspects message payloads (encrypted by CryptoService)

Modules

  • connection - WebSocket connection handling
  • protocol - Wire protocol for relay messages
  • session::SessionStore - Active session management
  • rate_limit::RateLimiter - Connection throttling

Usage

# Run relay server
jarvis-relay --port 8080 --host 0.0.0.0

# Desktop connects with session ID
# Mobile scans QR code and connects with same session ID
# Relay forwards messages between them

jarvis-app

Type: Binary (jarvis)
Dependencies: All other crates (except jarvis-relay)
Path: jarvis-rs/crates/jarvis-app/src/main.rs
The main application binary. Wires everything together.

Entry Point

fn main() -> Result<()> {
    // 1. Load environment
    load_dotenv();
    install_panic_hook();
    
    // 2. Parse CLI
    let args = cli::parse();
    
    // 3. Initialize logging
    tracing_subscriber::init();
    
    // 4. Load config
    let config = jarvis_config::load_config()?;
    
    // 5. Ensure directories
    jarvis_platform::paths::ensure_dirs()?;
    
    // 6. Build keybind registry
    let registry = KeybindRegistry::from_config(&config.keybinds);
    
    // 7. Create event loop
    let event_loop = EventLoop::new()?;
    let mut app = JarvisApp::new(config, registry);
    
    // 8. Enter event loop
    event_loop.run_app(&mut app)?;
    
    Ok(())
}

App State Modules (21 sub-modules)


Next Steps