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.
The crate ships a binary (Air, Source/Binary.rs) and a library
(AirLibrary, Source/Library.rs). The binary is the daemon; the library is what
the integration tests and Mountain’s client link against.
Key Modules
| Path | Description |
|---|---|
Source/Binary.rs |
Binary entry point; bootstraps the Tokio runtime and starts the daemon |
Source/Library.rs |
Library root: constants (DefaultConfigFile = "Air.toml", DefaultBindAddress = "[::1]:50053"), error type, public API |
Source/Initialize/ |
Startup sequence, split into Build/, Command/, Configure/ and Service/; Configure/Port/SelectPort.rs resolves the bind port |
Source/Vine/ |
gRPC server implementation using tonic; registers AirService and routes incoming calls |
Source/ApplicationState/ |
Shared state: connection info and type, connection-health report, performance metrics |
Source/Client/ |
AirClient and AirServiceProvider - the client side of AirService, used by callers |
Source/Mountain/ |
MountainClient, MountainClientConfig, TlsConfig, Constants - Air’s outbound connection back to Mountain |
Source/Updates/ |
Update lifecycle: check, download, verify, apply; UpdateManager.rs holds the channel and signature policy |
Source/Downloader/ |
Resilient download manager with pause, resume, retry and progress reporting |
Source/Authentication/ |
Cryptographic signing of binaries and secure token storage |
Source/Security/ |
Signature verification and secure storage utilities |
Source/HTTP/ |
HTTP client built on Mist’s resolvers (LandDnsResolver, TokioResolver) |
Source/Indexing/ |
File content indexing for workspace search |
Source/HealthCheck/ |
Self-monitoring and watchdog for process health |
Source/Metrics/ |
Resource and request telemetry reported to Mountain |
Source/Tracing/ |
Distributed tracing: span events, trace generation, sampling config and propagation context |
Source/Logging/ |
Structured log output, split from tracing |
Source/Configuration/ |
AirConfiguration, ConfigurationManager, Schema, HotReload - file loading, validation and live reload |
Source/Daemon/ |
DaemonManager, DaemonStatus, ExitCode, Platform, PlatformInfo - daemon lifecycle (start, stop, restart, shutdown request) |
Source/Resilience/ |
Retry logic and circuit breakers for network operations |
Source/Plugins/ |
Plugin model: Plugin, PluginCapability, PluginDependency, ApiVersion, EventBus |
Source/CLI/ |
Command-line argument parsing for daemon startup options |
Source/DevLog.rs |
Development log helper used across the modules |
Protocol
Proto/Air.proto declares one service, AirService. The RPCs group by concern:
service AirService {
// Authentication
rpc Authenticate(AuthenticationRequest) returns (AuthenticationResponse);
// Updates
rpc CheckForUpdates(UpdateCheckRequest) returns (UpdateCheckResponse);
rpc DownloadUpdate(DownloadRequest) returns (DownloadResponse);
rpc ApplyUpdate(ApplyUpdateRequest) returns (ApplyUpdateResponse);
// Downloads
rpc DownloadFile(DownloadRequest) returns (DownloadResponse);
rpc DownloadStream(DownloadStreamRequest) returns (stream DownloadStreamResponse);
// File indexing
rpc IndexFiles(IndexRequest) returns (IndexResponse);
rpc SearchFiles(SearchRequest) returns (SearchResponse);
rpc GetFileInfo(FileInfoRequest) returns (FileInfoResponse);
// Status and monitoring
rpc GetStatus(StatusRequest) returns (StatusResponse);
rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse);
rpc GetMetrics(MetricsRequest) returns (MetricsResponse);
// Resource management
rpc GetResourceUsage(ResourceUsageRequest) returns (ResourceUsageResponse);
rpc SetResourceLimits(ResourceLimitsRequest) returns (ResourceLimitsResponse);
// Configuration
rpc GetConfiguration(ConfigurationRequest) returns (ConfigurationResponse);
rpc UpdateConfiguration(UpdateConfigurationRequest) returns (UpdateConfigurationResponse);
}
DownloadStream is the one server-streaming RPC; every other call is
request-response. AuthenticationRequest carries a provider identifier such as
github, gitlab or microsoft; UpdateCheckRequest carries a channel of
stable, beta or nightly.
Data Flow
The following sequence shows how Mountain delegates an update task to Air and receives progress notifications.
Port Allocation
- Air listens on
[::1]:50053(reserved for the Air daemon). - Cocoon uses
[::1]:50052(the VS Code extension host). 50054and50055are reserved -50054for a future SideCar service and50055for future metrics endpoints.
Source/Initialize/Configure/Port/SelectPort.rs resolves the bind address from a
--bind command-line argument when one is given, and from the
DefaultBindAddress constant ([::1]:50053) otherwise. It validates the
address and fails on an unparsable value; it does not probe for a free port.
Integration Points
| Connecting Element | Direction | Mechanism | Description |
|---|---|---|---|
| Mountain | Bidirectional | gRPC over Proto/Air.proto |
Mountain delegates tasks through AirService; Air streams progress back and sends heartbeats over its own MountainClient |
| Mist | Inbound | Local DNS resolver | Air’s HTTP client uses Mist::Resolver::LandDnsResolver for secure resolution |
| Vine | Inbound | Protocol definition | Proto/Air.proto defines the service contract; tonic-prost generates the Rust server and client stubs |
| Cache | Not connected | - | Cache is a Mountain-side crate; Air does not depend on it |
Configuration
Configuration is a file, not a set of loose environment variables.
ConfigurationManager resolves the path as <config_dir>/Air/Air.toml and
creates it from defaults on first run. The schema requires SchemaVersion
(default 1.0.0) and profile (default dev).
| Section | Field | Default |
|---|---|---|
grpc |
bind_address |
[::1]:50053 |
grpc |
max_connections |
100 |
grpc |
request_timeout |
30 |
authentication |
enabled |
true |
authentication |
credentials_path |
~/.Air/credentials |
authentication |
token_expiration |
24 |
authentication |
max_sessions |
10 |
update |
enabled |
true |
update |
check_interval_hours |
6 |
update |
server_url |
https://update.editor.land |
update |
auto_download |
true |
update |
auto_install |
false |
update |
channel |
stable |
download |
enabled |
true |
download |
max_concurrent_downloads |
5 |
download |
timeout |
300 |
download |
max_retries |
3 |
download |
cache_dir |
~/.Air/cache |
indexing |
enabled |
true |
indexing |
max_file_size_mb |
10 |
indexing |
update_interval |
30 |
indexing |
directory |
~/.Air/index |
indexing |
max_parallel_indexing |
10 |
logging |
level |
info |
logging |
file_path |
~/.Air/logs/Air.log |
logging |
console_enabled |
true |
logging |
max_file_size |
10 |
logging |
max_files |
5 |
performance |
memory_limit |
512 |
performance |
cpu_limit |
50 |
performance |
disk_limit |
1024 |
performance |
task_interval |
60 |
Any field can be overridden from the environment as
AIR_<SECTION>_<FIELD>, which is how Mountain sets
AIR_GRPC_BIND_ADDRESS when it spawns the daemon. HotReload watches the file
and applies changes without a restart; the gRPC bind address is the exception
that requires one.
AIR_LOG_DIR and AIR_LOG_FILE override where the log lands, and
AIR_LOG_JSON switches the encoder.
Lifecycle
Mountain spawns Air from Binary/Service/AirStart.rs with three
environment variables - AIR_GRPC_ADDRESS, AIR_GRPC_BIND_ADDRESS and
AIR_LOG_DIR - and then detaches: it holds no Child handle, drains the
child’s stdout and stderr into its own dev log, and never waits on it. Air is
therefore not a supervised child in the usual sense; it manages its own shutdown
through DaemonManager::RequestShutdown or the OS’s SIGTERM.
Two switches gate the spawn. The AirIntegration Cargo feature decides whether
the code is compiled in at all, and Spawn=false (or 0) disables it at
runtime. Because Mountain keeps no handle, it cannot tell whether a previous
Air is still alive - the guard is on the daemon side, where
DaemonManager returns ServiceUnavailable("Air daemon is already running")
instead of starting a second instance on the same address.
Limitations
- Signature verification is opt-in.
UpdateManagerreadsLAND_UPDATE_PUBLIC_KEY; when it is unset the log sayssignature verification is disabledand updates are applied on checksum alone. - No shutdown RPC.
Proto/Air.protodeclares noShutdownmethod. Shutdown is an in-process request or a signal, so a remote caller cannot stop the daemon over gRPC. - The index is a content index, not a language index.
Source/Indexing/builds a searchable content index for workspace search; symbol-level intelligence stays with the language servers in Cocoon. - Air is optional at launch.
AirStartlogsrunning without Airand returns success when the binary is missing or the spawn fails, so a broken Air build degrades features rather than failing the editor. - The port can move. A taken
50053sendsSelectPortto the next free port, so a client that hard-codes the number can miss the daemon.
Related Documentation
- Air overview
- Vine protocol
- Mountain deep dive
- Architecture - System-wide process and IPC model
The record this page documents, as the site files it: the six facts the claim is checked against, and the three files the manual names to check it.
WORKING, 06
- FORM:
- BACKGROUND SERVICE
- WRITTEN IN:
- RUST
- BOUNDARY:
- LOOPBACK DAEMON
- DEPENDS ON:
- MOUNTAIN
- MANUAL:
-
/DOC/DEEP-DIVE-AIR - EVIDENCE:
- MANIFEST PLACEHOLDER PLATE NOT IN BUILD
# TRACE / AIR 03 STEPS
- 01
Source/Binary.rsTHE DAEMON BINARY - 02
Source/HTTP/Client.rsTHE UPDATE CLIENT - 03
Source/Library.rsWHAT THE CRATE EXPORTS
SOURCE: /DOC/DEEP-DIVE-AIR