|
|
|
The Native Rust/WebAssembly Extension Host for LandβποΈ
VS Code extensions run with full
Node.jscapabilities 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."
Rust API Documentationβπ
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:
- Provide Native Extension Hosting - Execute
Rustextensions with zero overhead through static linking orWASMsandboxing. - Enable Secure Sandboxing - Isolate untrusted extensions using
WASMtime's capability-based security model with configurable memory limits and resource controls. - Support Multiple Transports - Communicate with
Mountainββ°οΈ viagRPC,IPC, or directWASMhost function calls for flexible deployment. - Maintain Cocoon Compatibility - Share the same VS Code API surface and
activation semantics for seamless extension porting between the
Node.jsand native hosting environments.
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.
| 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/* |
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
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 |
| 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 |
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
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.
- Rust 1.95.0 or later (edition 2024)
- Protocol Buffer compiler (optional, for proto file modifications)
- For
WASMbuilds:rustup target add wasm32-wasi
cd Element/Grove
cargo build --releasecd Element/Grove
cargo build --target wasm32-wasi --release# All features enabled
cargo build --release --features all
# WASM only
cargo build --release --features wasm
# gRPC only
cargo build --release --features grpc| 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 |
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(())
}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 |
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 |
- Rust API Documentationβπ
- Architecture Overview - LandβποΈ system architecture
- Why WebAssembly - Why
WASMfor extension sandboxing - Mountainββ°οΈ - Native
desktop shell and
gRPCbackend - Cocoonβπ¦ -
Node.js/Effect-TSextension host - Mistβπ«οΈ - Pub/sub message bus for event-driven workflows
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.
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 |
|---|---|---|---|
Project Maintainers: Source Open (Source/Open@editor.land) | GitHub Repository | Report an Issue | Security Policy