Skip to content

CodeEditorLand/Mountain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,782 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mountain ⛰️

 + 

 + 


Mountain ⛰️

The Bedrock of Land: Native Backend & Service Host.

The RAM tax is not optional. VS Code with a medium project: 500 MB to 1.5 GB of RAM. Three open windows means three Chromium renderer processes, each carrying a full heap. Every OS interaction crosses a serialized JSON IPC pipe.

"Where Electron takes 200 ms to open a dialog, Mountain takes 2."

License: CC0-1.0 RustRust Version TauriTauri Version Tonic gRPC Version

📖 Rust API Documentation

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:

  1. Be the Native Core: Act as the primary Rust application, leveraging Tauri to create a lightweight, cross-platform windowing and WebView host.
  2. 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.
  3. Orchestrate Sidecars: Reliably launch, manage, and communicate with the Cocoon (Node.js) extension host sidecar via a robust gRPC interface.
  4. Power the User Interface: Serve as the backend for the Wind layer, responding to requests via Tauri commands and pushing state updates via Tauri events.

Key Features 🔐

  • Declarative Effect System: Built on a Rust ActionEffect system defined in the Common crate. Business logic is described as declarative, composable effects, executed by a central ApplicationRunTime.
  • gRPC-Powered IPC: Hosts a tonic-based gRPC server (Vine) to provide a strongly-typed, high-performance communication channel for the Cocoon extension host.
  • Centralized State Management: Utilizes a thread-safe, Tauri-managed ApplicationState 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 the portable-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 Wind and Cocoon to the appropriate native Environment provider or ActionEffect.

Core Architecture Principles 🏗️

Principle Description Key Components
Implementation of Contracts Implement the abstract service traits from Common, providing 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 ActionEffects, executed by ApplicationRunTime - composable, testable, and robust. RunTime/*, Track/EffectCreation.rs, Common
Centralized State Maintain a single, thread-safe ApplicationState struct managed by Tauri for data consistency across the entire application. ApplicationState/*
Secure & Performant IPC Use gRPC for all communication with the Cocoon sidecar, ensuring a well-defined and high-performance API boundary. Vine/*
UI–Backend Decoupling Interact with Wind exclusively through asynchronous Tauri commands and events, keeping the backend UI-agnostic. Binary.rs (invoke handler), Command/*

Deep Dive & Component Breakdown 🔬

To understand how Mountain's internal components are structured and how they implement the application's core logic, see Documentation/GitHub/DeepDive.md. This document explains the roles of ApplicationRunTime, ApplicationState, Handler, Environment, and the Vine gRPC layer.


Mountain ⛰️ in the Land 🏞️ Ecosystem ⛰️ + 🏞️

This diagram illustrates Mountain's central role as the native orchestrator for the entire Land application.

graph LR
    classDef mountain fill:#f0d0ff,stroke:#9b59b6,stroke-width:2px,color:#2c0050;
    classDef cocoon   fill:#d0d8ff,stroke:#4a6fa5,stroke-width:2px,color:#001050;
    classDef wind     fill:#cce8ff,stroke:#2980b9,stroke-width:2px,color:#00304a;
    classDef common   fill:#d4f5d4,stroke:#27ae60,stroke-width:1px,stroke-dasharray:5 5,color:#0a3a0a;
    classDef ipc      fill:#fff3c0,stroke:#f39c12,stroke-width:1px,stroke-dasharray:5 5,color:#5a3e00;

    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 --> ApplicationState
        TauriRuntime --> ApplicationRunTime
        ApplicationRunTime --> EnvironmentProviders
        TrackDispatcher --> ApplicationRunTime
    end

    subgraph "🖥️ Clients"
        WindUI["🍃 Wind / Sky - UI WebView"]:::wind
        CocoonSideCar["🦋 Cocoon - Extension Host (Node.js)"]:::cocoon
    end

    TauriRuntime -- hosts --> WindUI
    WindUI -- Tauri Command --> TrackDispatcher
    TrackDispatcher -- Tauri Events --> WindUI
    VinegRPC <-- gRPC --> CocoonSideCar
    VinegRPC -- forwards --> TrackDispatcher
    EnvironmentProviders -. implements traits .-> CommonCrate
Loading

Project Structure 🗺️

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 DTOs.
│   ├── Command/                     # Tauri command handlers for UI-specific requests.
│   ├── Environment/                 # Concrete implementations of 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 .proto into Rust code.

Development Setup 🛠️

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:

Crate / Package Purpose
Common Local path dependency - abstract traits & DTOs
Echo Local path dependency - work-stealing scheduler
keyring Secure OS keychain access
log & env_logger Structured logging
portable-pty Cross-platform native PTY for integrated terminal
serde & serde_json Serialization / deserialization
tauri ^2.x - windowing, WebView, command dispatch
tokio Async runtime
tonic gRPC server implementation

See Also 🔗


License ⚖️

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.


Changelog 📜

See CHANGELOG.md for a history of changes specific to Mountain ⛰️.


Funding & Acknowledgements 🙏🏻

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.

The project is operated by PlayForm, based in Sofia, Bulgaria.

PlayForm acts as the open-source steward for Code Editor Land under the NGI0 Commons Fund grant.

Land PlayForm NLnet NGI0 Commons Fund
Land PlayForm NLnet NGI0 Commons Fund

Project Maintainers: Source Open (Source/Open@Editor.Land) | GitHub Repository | Report an Issue | Security Policy

About

Mountain ⛰️ + Land 🏞️

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors

Languages