Skip to main content

Deep Dive

Air - Deep Dive

Technical architecture of the Air background daemon: gRPC service definitions, update pipeline, authentication, indexing, and connection lifecycle with Mountain.

Air is a standalone Rust binary structured around a central gRPC server that receives task delegation from Mountain. It runs as a persistent sidecar process alongside Mountain, offloading resource-intensive operations so the editor remains responsive. Internal modules handle distinct responsibilities: updates, downloads, authentication, and health monitoring.

Mermaid diagram

Key Modules

PathDescription
Source/Binary.rsBinary entry point; bootstraps Tokio runtime and starts daemon
Source/Initialize/Startup sequence: config loading, server binding, state init
Source/Vine/gRPC server implementation using tonic; routes incoming calls
Source/Updates/Update lifecycle: check, download, verify, apply patches
Source/Downloader/Resilient download manager with pause, resume, and retry
Source/Authentication/Cryptographic signing of binaries and secure token storage
Source/HTTP/HTTP client configured to use Mist local DNS resolver
Source/HealthCheck/Self-monitoring and watchdog for process health
Source/Metrics/Telemetry collection and reporting to Mountain
Source/Logging/Structured tracing output via the tracing crate
Source/CLI/Command-line argument parsing for daemon startup options
Source/Resilience/Retry logic and circuit breakers for network operations
Source/Security/Signature verification and secure storage utilities
Source/Configuration/Runtime configuration loading and hot-reload support
Source/Library.rsLibrary root exposing the public API for integration tests

Data Flow

The following sequence shows how Mountain delegates an update task to Air and receives progress notifications.

Mermaid diagram

Port allocation:

  • Air listens on [::1]:50053 (reserved for the Air daemon).
  • Cocoon uses [::1]:50052 (the VS Code extension host).

Integration Points

Connecting ElementDirectionMechanismDescription
MountainBidirectionalgRPC over Vine/Air.protoMountain delegates tasks; Air streams progress events back
MistInboundLocal DNS resolverAir configures its HTTP client to use Mist’s DNS for secure resolution
VineInboundProtocol definitionAir.proto defines service contracts; tonic generates Rust server stubs

Configuration

ParameterSourceDescription
Bind addressCLI flag / environmentDefault [::1]:50053; overridable for testing
Update server URLConfiguration fileBase URL for checking and downloading updates
Download cache directoryConfiguration fileWhere partial downloads are stored for resume
Health check intervalConfiguration fileFrequency of self-monitoring checks
Log levelRUST_LOG environment variableTracing filter for structured log output

Air is spawned automatically by Mountain at startup. Mountain detects whether an Air process is already running before spawning a new instance.