Skip to main content

Deep Dive

Grove - Deep Dive

Rust/WASM extension host, WebAssembly runtime, and sandboxed extension execution

Grove - Deep Dive

Grove is a native, sandboxed Rust/WASM extension host that runs VS Code extensions compiled to WebAssembly, complementing the Node.js-based Cocoon host.

Architecture 🏗️

Five-layer design: extension host controller, WASM runtime, VS Code API bridge, transport layer, and shared utilities.

Layer Breakdown

LayerKey Modules
Extension Host ControllerExtensionHost.rs, ExtensionManager.rs, Activation.rs, Lifecycle.rs, APIBridge.rs
WASM RuntimeRuntime.rs (WASMtime engine), ModuleLoader.rs, MemoryManager.rs, HostBridge.rs
TransportgRPCTransport.rs, IPCTransport.rs, WASMTransport.rs with pluggable Strategy.rs trait
APIvscode.rs, types.rs matching VS Code TypeScript types
Protocol/ServicesSpineConnection.rs, host services, shared utilities

Data Flow 🔄

  1. Mountain sends ActivateExtension via Grove.proto
  2. Grove loads extension manifest and compiles WASM module
  3. WASM runtime instantiates the module with host functions
  4. Extension calls host functions (e.g. vscode.workspace.readFile)
  5. HostBridge dispatches, Grove forwards service call to Mountain via Transport
  6. Mountain returns result, passed back through WASM to extension

WASM Runtime ⚡

  • Engine: WASMtime with per-extension memory limits
  • Module loading: Compilation and caching of WASM files
  • Memory management: Linear memory allocation and bounds enforcement
  • Host bridge: Registered functions available to extension WASM code

Transport Options 🚚

Selectable via Cargo features:

FeatureDescription
grpcgRPC via Mountain (default)
wasmWASMtime runtime (default)
ipcUnix/Windows IPC transport (Unix only)
allAll features enabled

Configuration ⚙️

OptionDefaultDescription
Standalone modeoffRun without Mountain for testing (--standalone)
Extension pathunsetLoad specific extension directly (--extension)
Memory limitplatform defaultPer-extension WASM memory ceiling
WASM targetwasm32-wasiExtensions must target this ABI

Integration 🔗

ElementDirectionMechanismDescription
MountainBidirectionalgRPC via Grove.protoExtension activation and API call forwarding
VineInboundProtocol definitionGrove.proto extends Vine service definitions
CocoonSiblingShared API surfaceSame VS Code API surface for portability