Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CodeEditorLand/Mountain

Repository files navigation

Mountain

⛰️

+

🏞️

+


Mountain ⛰️ The Bedrock of Land: Native Backend & Service Host

License: CC0-1.0 Rust Version Tauri Version Tonic gRPC Version

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 User Interface 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, which are 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 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 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 the User Interface (Wind) and extensions (Cocoon) to the appropriate native Environment provider or ActionEffect.

Core Architecture Principles πŸ—οΈ

Principle Description Key Components Involved
Implementation of Contracts Faithfully implement the abstract service traits 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 ActionEffects, 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/*

Deep Dive & Component Breakdown πŸ”¬

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.


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:#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
Loading

Project Structure Overview πŸ—ΊοΈ

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.

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:

  • 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.

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 πŸ“œ

Stay updated with our progress! 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.

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

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 3

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /