Welcome to Mountain! This element is the native Rust backend and Tauri
application shell for the Land Code Editor. It serves as the foundational
bedrock for the entire system, managing the application lifecycle, orchestrating
native OS operations, and providing high-performance services to the Wind
frontend and the Cocoon
extension host.
Mountain is engineered to:
- Be the Native Core: Act as the primary Rust application, leveraging Tauri to create a lightweight, cross-platform windowing and webview host.
- Provide High-Performance Services: Implement the abstract service traits
defined in the
Common
crate, offering native-speed implementations for filesystem I/O, process management, secure storage, and more. - Orchestrate Sidecars: Reliably launch, manage, and communicate with the
Cocoon
(Node.js) extension host sidecar via a robust gRPC interface. - Power the User Interface: Serve as the backend for the
Wind
User Interface layer, responding to requests via Tauri commands and pushing state updates via Tauri events.
- Declarative Effect System: Built on a Rust
ActionEffect
system defined in theCommon
crate. Business logic is described as declarative, composable effects, which are executed by a centralApplicationRunTime
. - gRPC-Powered IPC: Hosts a
tonic
-based gRPC server (Vine
) to provide a strongly-typed, high-performance communication channel for theCocoon
extension host. - Centralized State Management: Utilizes a thread-safe, Tauri-managed
ApplicationState
to act as the single source of truth for the entire application's state, from open documents to provider registrations. - Native PTY Management: Implements a full-featured integrated terminal
service by spawning and managing native pseudo-terminals (
PTY
) using theportable-pty
crate. - Secure Storage Integration: Leverages the native OS keychain via the
keyring
crate to securely store sensitive data like authentication tokens. - Robust Command Dispatching: A central
Track
dispatcher intelligently routes all incoming requests from the User Interface (Wind
) and extensions (Cocoon
) to the appropriate nativeEnvironment
provider orActionEffect
.
Principle | Description | Key Components Involved |
---|---|---|
Implementation of Contracts | Faithfully implement the abstract service trait s defined in the Common crate, providing the concrete logic for the application's architecture. |
Environment/* providers |
Separation of Concerns | Isolate service logic into distinct Environment provider modules, each responsible for a specific domain (e.g., FileSystem, Documents). |
Environment/* , Command/* |
Declarative Logic | Express complex operations as ActionEffect s, which are executed by the ApplicationRunTime . This makes logic composable, testable, and robust. |
RunTime/* , Track/EffectCreation.rs , Common |
Centralized State | Maintain a single, thread-safe ApplicationState struct managed by Tauri to ensure data consistency across the entire application. |
ApplicationState/* |
Secure & Performant IPC | Utilize gRPC for all communication with the Cocoon sidecar, ensuring a well-defined and high-performance API boundary. |
Vine/* |
User Interface-Backend Decoupling | Interact with the Wind frontend exclusively through asynchronous Tauri commands and events, ensuring the backend is User Interface-agnostic. |
Binary.rs (invoke handler), Command/* |
To understand how Mountain
's internal components are structured and how they
implement the application's core logic, please refer to the detailed technical
breakdown in docs/Deep Dive.md
. This document explains
the roles of the ApplicationRunTime
, ApplicationState
, Handler
,
Environment
, and the Vine
gRPC layer.
This diagram illustrates Mountain
's central role as the native orchestrator
for the entire Land application.
graph LR
classDef Mountain fill:#f9f,stroke:#333,stroke-width:2px;
classDef Cocoon fill:#ccf,stroke:#333,stroke-width:2px;
classDef Wind fill:#9cf,stroke:#333,stroke-width:2px;
classDef Common fill:#cfc,stroke:#333,stroke-width:1px;
classDef IPC fill:#ff9,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
subgraph "Mountain (Native Rust/Tauri Backend)"
TauriRuntime[Tauri App & Window]:::Mountain
ApplicationRunTime[ApplicationRunTime Engine]:::Mountain
ApplicationState["ApplicationState (Shared State)"]:::Mountain
TrackDispatcher[Track Dispatcher]:::Mountain
VinegRPC[Vine gRPC Server]:::IPC
EnvironmentProviders[Environment Providers]:::Mountain
CommonCrate["Common Crate (Traits & DTOs)"]:::Common
TauriRuntime -- Manages --> ApplicationState
TauriRuntime -- Manages --> ApplicationRunTime
ApplicationRunTime -- Executes effects via --> EnvironmentProviders
TrackDispatcher -- Routes requests to --> ApplicationRunTime
end
subgraph "Clients"
WindUI["Wind/Sky User Interface (WebView)"]:::Wind
CocoonSideCar["Cocoon Extension Host (Node.js)"]:::Cocoon
end
TauriRuntime -- Hosts --> WindUI
WindUI -- Tauri Command --> TrackDispatcher
TrackDispatcher -- Tauri Events --> WindUI
VinegRPC -- gRPC Protocol <--> CocoonSideCar; class VinegRPC,CocoonSideCar IPC
VinegRPC -- Forwards requests to --> TrackDispatcher
EnvironmentProviders -- Implements traits from --> CommonCrate
The Mountain
repository is organized to clearly separate concerns, following
the architectural patterns defined in Common
.
Mountain/
├── Source/
│ ├── Binary.rs # Tauri application entry point and setup.
│ ├── ApplicationState/ # Central, thread-safe state store and its DTOs.
│ ├── Command/ # Tauri command handlers for UI-specific requests.
│ ├── Environment/ # Concrete implementations of the `Common` provider traits.
│ ├── ExtensionManagement/ # Logic for scanning and parsing extensions.
│ ├── FileSystem/ # Native TreeView provider for the File Explorer.
│ ├── ProcessManagement/ # Logic for managing the `Cocoon` sidecar process.
│ ├── RunTime/ # The `ApplicationRunTime` engine that executes effects.
│ ├── Track/ # The central request dispatcher (`EffectCreation`).
│ ├── Update/ # Application self-updating logic.
│ ├── Vine/ # The gRPC server and client implementation (`tonic`).
│ └── WorkSpace/ # Logic for handling `.code-workspace` files.
├── Proto/
│ └── Vine.proto # The gRPC contract definition file.
└── build.rs # Build script to compile the .proto file into Rust code.
Mountain
is a Rust crate and a core component of the main Land
repository.
It is not intended to be built or run standalone. Please follow the instructions
in the main Land Repository README to
set up, build, and run the entire application.
Key Dependencies:
Common
(local path dependency).Echo
(local path dependency).keyring
: For secure secret storage.log
&env_logger
: For logging.portable-pty
: For the integrated terminal feature.serde
&serde_json
: For serialization.tauri
:^2.x
tokio
: For the asynchronous RunTime.tonic
: For the gRPC server implementation.
This project is released into the public domain under the Creative Commons CC0
Universal license. You are free to use, modify, distribute, and build upon
this work for any purpose, without any restrictions. For the full legal text,
see the LICENSE
file.
Stay updated with our progress! See CHANGELOG.md
for a history
of changes specific to Mountain.
Mountain is a core element of the Land ecosystem. This project is funded through NGI0 Commons Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more at the NLnet project page.
Land | PlayForm | NLnet | NGI0 Commons Fund |
---|---|---|---|
|
|
|
|
Project Maintainers: Source Open (Source/[email protected]) | GitHub Repository | Report an Issue | Security Policy