Skip to content

CodeEditorLand/Grove

Groveβ€πŸŒ³

Update
Issue
Star
Download

The Native Rust/WebAssembly Extension Host for Landβ€πŸžοΈ

VS Code extensions run with full Node.js capabilities in a shared process. A malicious or buggy extension can access any file, make any network request, and read another extension's state. The extension sandbox is a policy document, not a technical boundary.

"An extension can only touch what you explicitly grant. The sandbox is enforced by the hardware, not a policy."

License: CC0-1.0 Rust Rust Version Rust Rust Edition WebAssembly WASMtime Version

Rust API Documentationβ€πŸ“–


Overview

Groveβ€πŸŒ³ is the high-performance Rust/WebAssembly extension host for the Landβ€πŸžοΈ Code Editor. It complements Cocoonβ€πŸ¦‹ (Node.js) by providing a native environment for running Rust and WASM-compiled VS Code extensions. Grove offers secure sandboxing through WASMtime, multiple transport strategies (gRPC, IPC, WASM), and full compatibility with the VS Code API surface.

VS Code extensions run with full Node.js capabilities in a shared process - a malicious or buggy extension can access any file, make any network request, and read another extension's state. Grove solves this by enforcing sandboxing at the hardware level: an extension can only touch what you explicitly grant.

Grove is engineered to:

  1. Provide Native Extension Hosting - Execute Rust extensions with zero overhead through static linking or WASM sandboxing.
  2. Enable Secure Sandboxing - Isolate untrusted extensions using WASMtime's capability-based security model with configurable memory limits and resource controls.
  3. Support Multiple Transports - Communicate with Mountain ⛰️ via gRPC, IPC, or direct WASM host function calls for flexible deployment.
  4. Maintain Cocoon Compatibility - Share the same VS Code API surface and activation semantics for seamless extension porting between the Node.js and native hosting environments.

Key Featuresβ€πŸ”

WASM Runtime Integration - Full WebAssembly support through WASMtime, with capability-based security, configurable memory limits, WASMtime fuel metering to bound execution time, and explicit host-function grants. Extensions are sandboxed at the hardware level.

Multiple Transport Strategies - A strategy-pattern transport layer supporting gRPC (to Mountain ⛰️'s Vineβ€πŸŒΏ server on port 50051), IPC (Unix socket for local communication), WASM (direct host function calls), and Mistβ€πŸŒ«οΈ (message-bus integration with the Mist pub/sub system, behind the websocket Cargo feature).

Standalone Operation - Can run as an independent process with its own lifecycle, or connect to Mountain ⛰️ via gRPC for distributed deployment. The Transport/CommonAdapter unifies all transport backends behind a single interface.

Cross-Platform - Native support for macOS, Linux, and Windows with platform-specific optimizations. The Binary/Main/ entry point handles platform signal handling and daemon initialization.

VS Code API Compatibility - Implements vscode.d.ts type definitions through the APIBridge facade, with API/VSCode/ providing typed wrappers for the full VS Code extension API surface including commands, windows, and notifications.

Secure by Default - #![deny(unsafe_code)] at the crate level, WASMtime capability-based isolation, configurable memory limits per extension, and explicit host-function grants ensure no extension can escape its sandbox.


Core Architecture Principlesβ€πŸ—οΈ

Principle Description Key Components
Security First Isolate extensions via WASMtime's capability model with configurable resource limits. Unsafe code is denied at the crate level. WASM/Runtime, WASM/MemoryManager, WASM/HostBridge
Transport Agnosticism Multiple communication strategies behind a unified Transport/Strategy trait so deployment choice is a config flag, not a code change. Transport/Strategy, Transport/CommonAdapter, Transport/gRPCTransport, Transport/IPCTransport, Transport/WASMTransport, Transport/MistTransport
API Surface Parity Implement the full VS Code extension API (vscode.d.ts) so extensions port seamlessly between Cocoonβ€πŸ¦‹ and Groveβ€πŸŒ³. API/VSCode, API/Types, Host/APIBridge, Host/Activation
Composability Modular separation of host core, WASM runtime, transport layer, and protocol handling. Each module can be compiled and tested independently. Host/*, WASM/*, Transport/*, Protocol/*, API/*

System Architecture

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

    subgraph GROVE["Groveβ€πŸŒ³β€- Rust/WASM Extension Host"]
        direction TB
        subgraph HOST["Host/ - Extension Lifecycle"]
            ExtHost["ExtensionHost.rsβ€πŸ‘β€main controller"]:::grove
            ExtMgr["ExtensionManager.rsβ€πŸ”β€discovery + loading"]:::grove
            Activation["Activation/β€βš‘β€activation events"]:::grove
            Lifecycle["Lifecycle.rs"]:::grove
            APIBridge["APIBridge.rsβ€πŸŒ‰β€vscode.d.ts facade"]:::grove
            ExtHost --> ExtMgr --> Activation --> Lifecycle
            Activation --> APIBridge
        end
        subgraph API["API/ - VS Code API Surface"]
            VSCode["VSCode/β€πŸ“‹β€typed API wrappers"]:::grove
            Types["Types.rsβ€πŸ§±β€shared type definitions"]:::grove
            APIBridge --> VSCode --> Types
        end
        subgraph WASM_RT["WASM/ - WASMtime Runtime"]
            WASMRuntime["Runtime/β€πŸš€β€WASMtime engine + store"]:::wasm
            ModLoader["ModuleLoader/β€πŸ“¦β€compile + instantiate"]:::wasm
            MemMgr["MemoryManager/β€πŸ“β€allocation + limits"]:::wasm
            HostBridge["HostBridge/β€πŸ”—β€host↔WASM calls"]:::wasm
            WASMRuntime --> ModLoader
            ModLoader --> MemMgr
            WASMRuntime --> HostBridge
        end
        subgraph TRANSPORT["Transport/ - Strategy Pattern"]
            Strategy["Strategy.rs - trait"]:::transport
            CommonAdapter["CommonAdapter.rsβ€πŸ”Œβ€unified backend"]:::transport
            gRPC["gRPCTransport.rs"]:::transport
            IPC["IPCTransport.rs"]:::transport
            WASMTrans["WASMTransport.rs"]:::transport
            MistTrans["MistTransport.rsβ€πŸ’¬β€pub/sub bus"]:::transport
            Strategy --- CommonAdapter
            CommonAdapter --- gRPC
            CommonAdapter --- IPC
            CommonAdapter --- WASMTrans
            CommonAdapter --- MistTrans
        end
        subgraph PROTO["Protocol/"]
            SpineConn["SpineConnection.rsβ€πŸ¦΄β€Spine protocol"]:::grove
            SpineAction["SpineActionClient/β€πŸŽ¬β€action dispatch"]:::grove
            SpineConn --> SpineAction
        end

        APIBridge --> WASMRuntime
        HostBridge --> Strategy
        SpineConn --> gRPC
    end

    subgraph MOUNTAIN["Mountain ⛰️"]
        VineGRPC["Vine gRPC Serverβ€πŸŒΏ"]:::mountain
    end

    subgraph COCOON["Cocoonβ€πŸ¦‹β€complementary host"]
        CocoonRef["Node.js extension host same vscode API surface"]:::cocoon
    end

    gRPC -- gRPC :50051 --> VineGRPC
    IPC -- Unix socket --> VineGRPC
    MistTrans -. message bus, websocket feature .-> VineGRPC
    APIBridge -.shares API surface.-> CocoonRef
Loading

Connection paths:

Path Protocol Use Case
Groveβ€πŸŒ³ β†’ Mountain ⛰️ via gRPC Protobuf over gRPC on port 50051 Distributed deployment, remote extensions
Grove β†’ Mountain via IPC Unix domain socket Local single-machine communication
Grove β†’ Mountain via Mistβ€πŸŒ«οΈ Message-bus pub/sub (websocket feature) Event-driven, decoupled workflows
Grove β†’ Cocoonβ€πŸ¦‹ Shared API surface Extension portability between native and Node.js hosts
Extension β†’ WASMtime WASM host functions Sandboxed extension execution
APIBridge β†’ API/VSCode Direct call Typed VS Code API wrappers

Key Components

Component Path Description
ExtensionHost Source/Host/ExtensionHost.rs Main controller (ExtensionHostImpl) managing the full extension lifecycle
ExtensionManager Source/Host/ExtensionManager.rs Extension discovery, validation, and loading
Activation Source/Host/Activation/ Activation events and contribution point handling (ActivationEngine, ActivationEvent, ActivationHandler, ActivationContext, ActivationRecord, WildMatch)
Lifecycle Source/Host/Lifecycle.rs Extension state machine (install, enable, disable, uninstall)
APIBridge Source/Host/APIBridge.rs VS Code API facade implementing vscode.d.ts
VSCode API Source/API/VSCode/ Typed wrappers for the full VS Code extension API surface (VSCodeAPI, Window, Workspace, Env, CommandNamespace, LanguageNamespace, and more)
API Types Source/API/Types.rs Shared type definitions for extension API interactions
WASM Runtime Source/WASM/Runtime.rs WASMtime engine and store lifecycle
ModuleLoader Source/WASM/ModuleLoader.rs WASM module compilation and instantiation
MemoryManager Source/WASM/MemoryManager.rs Configurable memory limits and allocation tracking
HostBridge Source/WASM/HostBridge.rs Host-to-WASM function call dispatch
FunctionExport Source/WASM/FunctionExport/ Export host functions to WASM guest modules (HostFunctionRegistry, FunctionExportImpl, FunctionStats)
Transport Strategy Source/Transport/Strategy.rs Transport strategy trait definition
CommonAdapter Source/Transport/CommonAdapter.rs Unified transport backend routing
gRPC Transport Source/Transport/gRPCTransport.rs gRPC-based communication with Mountain
IPC Transport Source/Transport/IPCTransport.rs Inter-process communication (Unix socket)
WASM Transport Source/Transport/WASMTransport.rs Direct WASM host-function communication
Mist Transport Source/Transport/MistTransport.rs Message-bus integration with Mist pub/sub (behind the websocket Cargo feature)
Spine Connection Source/Protocol/SpineConnection.rs Spine protocol client connection
Spine Action Client Source/Protocol/SpineActionClient/ Action dispatch over Spine protocol (SpineActionClient, ReconnectStrategy, ConnectionStatus)
Configuration Service Source/Services/ConfigurationService.rs Service for managing extension-level configuration
Common Traits Source/Common/Traits.rs Shared trait definitions for the extension host
Common Error Source/Common/Error.rs Unified error types for the host layer
Runtime Build Source/Binary/Build/RuntimeBuild.rs Build-time runtime configuration
Service Register Source/Binary/Build/ServiceRegister.rs Service registration at build time
Entry Source/Binary/Main/Entry.rs Platform entry point and daemon initialization

Project Structureβ€πŸ—ΊοΈ

Element/Grove/
β”œβ”€β”€ Source/
β”‚   β”œβ”€β”€ Library.rs                     # Library root (cdylib + rlib)
β”‚   β”œβ”€β”€ main.rs                        # Binary entry point
β”‚   β”œβ”€β”€ DevLog.rs                      # Development logging infrastructure
β”‚   β”œβ”€β”€ API/                           # VS Code API surface
β”‚   β”‚   β”œβ”€β”€ mod.rs                     # Module re-exports
β”‚   β”‚   β”œβ”€β”€ Types.rs                   # Shared API type definitions
β”‚   β”‚   └── VSCode/                    # Typed VS Code extension API wrappers
β”‚   β”‚       β”œβ”€β”€ mod.rs
β”‚   β”‚       β”œβ”€β”€ VSCodeAPI.rs           # Aggregate API entry point
β”‚   β”‚       β”œβ”€β”€ Window.rs              # vscode.window namespace
β”‚   β”‚       β”œβ”€β”€ Workspace.rs           # vscode.workspace namespace
β”‚   β”‚       β”œβ”€β”€ WorkspaceConfiguration.rs
β”‚   β”‚       β”œβ”€β”€ CommandNamespace.rs    # vscode.commands namespace
β”‚   β”‚       β”œβ”€β”€ LanguageNamespace.rs   # vscode.languages namespace
β”‚   β”‚       β”œβ”€β”€ ExtensionNamespace.rs  # vscode.extensions namespace
β”‚   β”‚       β”œβ”€β”€ Env.rs                 # vscode.env namespace
β”‚   β”‚       β”œβ”€β”€ CompletionItemProvider.rs
β”‚   β”‚       β”œβ”€β”€ DiagnosticCollection.rs
β”‚   β”‚       β”œβ”€β”€ DocumentSelector.rs
β”‚   β”‚       β”œβ”€β”€ Disposable.rs
β”‚   β”‚       β”œβ”€β”€ OutputChannel.rs
β”‚   β”‚       β”œβ”€β”€ ProviderStore.rs
β”‚   β”‚       └── Tests.rs
β”‚   β”œβ”€β”€ Binary/                        # Binary initialization
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ Build/                     # Build-time configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ RuntimeBuild.rs        # Build-time runtime configuration
β”‚   β”‚   β”‚   └── ServiceRegister.rs     # Service registration at build time
β”‚   β”‚   └── Main/                      # Main entry point + platform init
β”‚   β”‚       β”œβ”€β”€ mod.rs
β”‚   β”‚       └── Entry.rs               # Platform entry point and daemon init
β”‚   β”œβ”€β”€ Common/                        # Shared traits and error types
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ Traits.rs                  # Core trait definitions
β”‚   β”‚   └── Error.rs                   # Unified error types
β”‚   β”œβ”€β”€ Host/                          # Extension lifecycle management
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ ExtensionHost.rs           # Main host controller (ExtensionHostImpl)
β”‚   β”‚   β”œβ”€β”€ ExtensionManager.rs        # Discovery and loading
β”‚   β”‚   β”œβ”€β”€ Lifecycle.rs               # Lifecycle state machine
β”‚   β”‚   β”œβ”€β”€ APIBridge.rs               # VS Code API facade
β”‚   β”‚   └── Activation/                # Activation events
β”‚   β”‚       β”œβ”€β”€ mod.rs
β”‚   β”‚       β”œβ”€β”€ ActivationEngine.rs    # Activation event dispatcher
β”‚   β”‚       β”œβ”€β”€ ActivationEvent.rs     # Activation event types
β”‚   β”‚       β”œβ”€β”€ ActivationHandler.rs   # Per-event activation handlers
β”‚   β”‚       β”œβ”€β”€ ActivationContext.rs   # Activation context state
β”‚   β”‚       β”œβ”€β”€ ActivationRecord.rs    # Activation history record
β”‚   β”‚       β”œβ”€β”€ WildMatch.rs           # Glob-style pattern matching
β”‚   β”‚       └── Tests.rs
β”‚   β”œβ”€β”€ Services/                      # Extension-level services
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   └── ConfigurationService.rs    # Extension configuration management
β”‚   β”œβ”€β”€ WASM/                          # WebAssembly runtime integration
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ Runtime.rs                 # WASMtime engine and store
β”‚   β”‚   β”œβ”€β”€ ModuleLoader.rs            # Module compilation + instantiation
β”‚   β”‚   β”œβ”€β”€ MemoryManager.rs           # Memory allocation and limits
β”‚   β”‚   β”œβ”€β”€ HostBridge.rs              # Host-to-WASM function calls
β”‚   β”‚   └── FunctionExport/            # Host function export to WASM
β”‚   β”‚       β”œβ”€β”€ mod.rs
β”‚   β”‚       β”œβ”€β”€ Default.rs
β”‚   β”‚       β”œβ”€β”€ ExportConfig.rs
β”‚   β”‚       β”œβ”€β”€ FunctionExportImpl.rs
β”‚   β”‚       β”œβ”€β”€ FunctionStats.rs
β”‚   β”‚       └── HostFunctionRegistry.rs
β”‚   β”œβ”€β”€ Transport/                     # Communication strategies
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ Strategy.rs                # Transport strategy trait
β”‚   β”‚   β”œβ”€β”€ CommonAdapter.rs           # Unified transport backend
β”‚   β”‚   β”œβ”€β”€ TransportConfig.rs         # Shared transport configuration
β”‚   β”‚   β”œβ”€β”€ TransportFactory.rs        # Transport construction helpers
β”‚   β”‚   β”œβ”€β”€ gRPCTransport.rs           # gRPC to Mountain
β”‚   β”‚   β”œβ”€β”€ IPCTransport.rs            # Inter-process (Unix only)
β”‚   β”‚   β”œβ”€β”€ WASMTransport.rs           # Direct WASM communication
β”‚   β”‚   └── MistTransport.rs           # Mist message-bus integration (behind `websocket` feature)
β”‚   └── Protocol/                      # Protocol handling
β”‚       β”œβ”€β”€ mod.rs
β”‚       β”œβ”€β”€ Constants.rs               # Protocol constants
β”‚       β”œβ”€β”€ MessageType.rs             # Wire message type definitions
β”‚       β”œβ”€β”€ ProtocolConfig.rs          # Protocol configuration
β”‚       β”œβ”€β”€ ProtocolError.rs           # Protocol error types
β”‚       β”œβ”€β”€ SpineConnection.rs         # Spine protocol client
β”‚       β”œβ”€β”€ SpineActionClient/         # Action dispatch over Spine protocol
β”‚       β”‚   β”œβ”€β”€ mod.rs
β”‚       β”‚   β”œβ”€β”€ SpineActionClient.rs
β”‚       β”‚   β”œβ”€β”€ SpineConfig.rs
β”‚       β”‚   β”œβ”€β”€ ReconnectStrategy.rs
β”‚       β”‚   β”œβ”€β”€ ConnectionStatus.rs
β”‚       β”‚   β”œβ”€β”€ GroveCapabilities.rs
β”‚       β”‚   β”œβ”€β”€ HostInfo.rs
β”‚       β”‚   β”œβ”€β”€ calculate_backoff.rs
β”‚       β”‚   └── Tests.rs
β”‚       └── Generated/                 # Code-generated protocol types
β”‚           └── grove.rs               # Generated gRPC service definitions
β”œβ”€β”€ Documentation/
β”‚   └── Rust/
β”‚       └── doc/                       # Cargo doc output
β”œβ”€β”€ Cargo.toml
└── LICENSE

In the Land Project

Grove serves as the native Rust/WASM extension host alongside Cocoonβ€πŸ¦‹ (the Node.js host). Together they provide the two execution environments for the Landβ€πŸžοΈ editor's extension model:

Host Language Runtime Sandboxing
Groveβ€πŸŒ³ Rust, WASM WASMtime Hardware-enforced via capability model
Cocoonβ€πŸ¦‹ TypeScript, JavaScript Node.js via Effect-TS Fiber-level process isolation

Grove communicates with Mountain ⛰️ via gRPC (port 50051), IPC (Unix socket), or the Mistβ€πŸŒ«οΈ message bus for event-driven workflows. It shares the same VS Code API surface as Cocoon, enabling seamless porting of extensions between the Node.js and native hosting environments.

The Transport/CommonAdapter abstracts all communication strategies behind a single interface, allowing deployment flexibility - standalone process, distributed via gRPC, or integrated with Mountain's Vine server.


Getting Startedβ€πŸš€

Prerequisites

  • Rust 1.95.0 or later (edition 2024)
  • Protocol Buffer compiler (optional, for proto file modifications)
  • For WASM builds: rustup target add wasm32-wasi

Build for Native

cd Element/Grove
cargo build --release

Build for WASM

cd Element/Grove
cargo build --target wasm32-wasi --release

Build with Features

# All features enabled
cargo build --release --features all

# WASM only
cargo build --release --features wasm

# gRPC only
cargo build --release --features grpc

Available Features

Feature Description
default Enables grpc and wasm
grpc gRPC transport support (tonic + prost)
wasm WebAssembly runtime support (wasmtime + wasmtime-wasi)
websocket Mist pub/sub WebSocket transport (MistTransport)
telemetry OpenTelemetry + Prometheus metrics export
dev Enables telemetry for local development builds
debug Enables dev
all grpc + wasm + telemetry

As a Library

use Grove::{Host::ExtensionHost::ExtensionHostImpl, Transport::Strategy::Transport};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let Host = ExtensionHostImpl::new(Transport::default()).await?;
    let ExtensionId = Host.load_extension(&"/path/to/extension".into()).await?;
    Host.activate(&ExtensionId).await?;
    Ok(())
}

Securityβ€πŸ”’

Grove enforces security at multiple layers:

Layer Mechanism
Crate level #![deny(unsafe_code)] - no unsafe code permitted
Runtime WASMtime capability-based isolation - each extension gets an independent sandbox
Memory Configurable per-extension memory limits via WASM/MemoryManager
Resources WASMtime fuel metering bounds per-extension execution time (WASM/Runtime)
Host functions Explicit capability grants - extensions must declare required host functions
Type safety Full Rust type system across the host-WASM boundary

Compatibility

Grove is designed to be compatible with:

Target Integration
Cocoonβ€πŸ¦‹ Shares VS Code API surface, activation semantics, and manifest parsing
VS Code Implements vscode.d.ts type definitions
Mountain ⛰️ Integrates via the GroveService gRPC protocol defined in Proto/Grove.proto
Mistβ€πŸŒ«οΈ Connects via MistTransport for event-driven pub/sub workflows

API Reference


Related Documentation

  • Architecture Overview - Landβ€πŸžοΈ system architecture
  • Why WebAssembly - Why WASM for extension sandboxing
  • Mountain ⛰️ - Native desktop shell and gRPC backend
  • Cocoonβ€πŸ¦‹ - Node.js/Effect-TS extension host
  • Mistβ€πŸŒ«οΈ - Pub/sub message bus for event-driven workflows

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.


Funding & Acknowledgementsβ€πŸ™πŸ»

Landβ€πŸžοΈ is proud to be an open-source endeavor. Our journey is significantly supported by the organizations and projects that believe in the future of open-source software.

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

Groveβ€πŸŒ³

Resources

License

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors