Skip to main content

Deep Dive

Grove - Deep Dive

Deep dive into Grove, the native, sandboxed Rust/WASM extension host that provides an environment for running VS Code extensions compiled to WebAssembly or native Rust, complementing the Node.js-based Cocoon host.

Grove - Deep Dive

Grove provides the technical foundation Rust/WASM extension host within the Land project. Grove provides a native, sandboxed environment for running VS Code extensions compiled to WebAssembly or native Rust, complementing the Node.js-based Cocoon host.


Architecture

Grove is organized into five layers: the extension host controller that manages the lifecycle, the WASM runtime that provides sandboxed execution, the VS Code API bridge that presents the standard extension API, the transport layer that communicates with Mountain, and shared utility modules.

Mermaid diagram ---

Key Modules

PathDescription
Source/lib.rsLibrary root; exports public API for integration and testing
Source/main.rsBinary entry point; parses CLI and starts the extension host
Source/Binary/CLI argument handling and standalone vs connected mode selection
Source/Host/ExtensionHost.rsMain controller: coordinates extension loading, activation, and service provision
Source/Host/ExtensionManager.rsExtension discovery, manifest parsing, and loading
Source/Host/Activation.rsActivation event processing (onLanguage, onCommand, etc.)
Source/Host/Lifecycle.rsExtension activate/deactivate lifecycle management
Source/Host/APIBridge.rsVS Code API facade implementation for Rust/WASM extensions
Source/WASM/Runtime.rsWASMtime engine and store management with memory limits
Source/WASM/ModuleLoader.rsWASM module compilation, caching, and instantiation
Source/WASM/MemoryManager.rsWASM linear memory allocation and bounds enforcement
Source/WASM/HostBridge.rsHost function exports to WASM modules
Source/WASM/FunctionExport.rsRegistered host functions available to extension WASM code
Source/Transport/Strategy.rsTransport strategy trait for pluggable communication
Source/Transport/gRPCTransport.rsgRPC communication with Mountain via tonic
Source/Transport/IPCTransport.rsUnix/Windows IPC transport for same-host communication
Source/Transport/WASMTransport.rsDirect in-process WASM function call transport
Source/Protocol/SpineConnection.rsSpine protocol client for extension host coordination

Data Flow

Mermaid diagram ---

Integration Points

Connecting ElementDirectionMechanismDescription
MountainBidirectionalgRPC via VineMountain activates extensions; Grove forwards API calls back to Mountain
CocoonSiblingShared API surfaceGrove implements the same VS Code API surface as Cocoon for extension portability

Configuration

OptionCLI Flag / FeatureDefaultDescription
Standalone mode--standaloneoffRun without Mountain connection for testing
Extension path--extensionunsetLoad a specific extension directly
Transportfeature flaggRPCSelect grpc, ipc, or wasm transport via Cargo features
Memory limitruntime configplatform defaultPer-extension WASM memory ceiling enforced by WASMtime
WASM build targetwasm32-wasinativeExtensions must target wasm32-wasi for WASM mode

Cargo features

FeatureDescription
grpcgRPC transport support (included in default)
wasmWASMtime WASM runtime (included in default)
ipcUnix/Windows IPC transport (Unix only)
allAll features enabled