The Breath of Land: VS Code Environment & Services for Tauri.
VS Code's workbench lives in theChromiumrenderer. Every panel interaction that touches files or state crosses theElectronIPC bridge: serialize to JSON, send over a pipe, deserialize on the other side β in an untyped, unstructured way.
"Typed, Effect-TS native IPC. Workbench actions go through Tauri commands to
Rust handlers, not an Electron JSON pipe."
Welcome to Windβπ! This element is the vital Effect-TS native service
layer that allows Sky (Land's VS Code-based UI) to breathe and function
within the Tauri shell. Windβπ meticulously recreates essential parts of
the VS Code renderer environment, provides robust implementations of core
services (like file dialogs and configuration), and integrates seamlessly with
the Mountain backend via Tauri IPC. Rather than routing through an Electron
IPC pipe with untyped JSON, Wind dispatches through typed Tauri commands whose
handlers live in Mountain's Rust core β all underpinned by Effect-TS for
resilience and type safety.
Windβπ is engineered to:
- Emulate the
VS CodeSandbox: Through a sophisticatedPreload.tsscript, it shims criticalElectronandNode.jsAPIs thatVS Code's workbench code expects, creating a compatible execution context inside theTauriWebView. - Implement Core
VS CodeServices: It provides frontend implementations for keyVS Codeservices viaPolyfills/NativeModulePolyfill.ts, leveragingEffect-TSfor highly reliable, composable, and maintainable logic. - Integrate with
Tauri& Native Capabilities: It offers a clean abstraction layer overTauriAPIs for file operations, dialogs, and OS information, making them accessible in a type-safe way throughEffect-based wrappers.
- Native Dialog Experience: Implements dialog services for File Open/Save
dialogs using
Tauri's native OS dialogs viaPolyfills/NativeModulePolyfill.ts. VS CodeEnvironment Compliance: A sophisticatedPreload.tsscript establishes the crucialwindow.vscodeglobal object, shimmingipcRendererandprocessto bridge the gap between theVS Codeworkbench code and theTauriruntime.Effect-TSPowered Architecture: EmploysEffectfor all asynchronous operations and service logic, ensuring that all potential failures are explicitly handled as typed, tagged errors for maximum robustness.- Declarative Dependency Management: Uses
LayerandContext.TagfromEffect-TSfor clean dependency injection and composable service construction. - Clean Integration Layer: Provides a clear abstraction layer over
TauriAPIs, isolating platform specifics and simplifying their usage within the application.
| Principle | Description | Key Components |
|---|---|---|
| Compatibility | High-fidelity VS Code renderer environment to maximize Sky's reusability and minimize changes needed for VS Code UI components. |
Preload.ts, Polyfills/ |
| Modularity | Components (preload, services, integrations) are organized into distinct, cohesive modules for clarity and maintainability. | Effect/, Types/, Bootstrap/ |
| Robustness | Effect-TS for all service implementations and async operations, ensuring predictable error handling and composability. |
All Effect/ services with Layer and Tag patterns |
| Abstraction | Clean layer over Tauri APIs, replacing the untyped Electron IPC pipe with typed Tauri commands whose handlers live in Rust. |
Preload.ts, Effect/IPC/, Effect/Mountain/ |
| Integration | Seamlessly connect Sky's frontend requests with Mountain's backend capabilities through Tauri's invoke/event system. |
Preload.ts (ipcRenderer shim), Effect/Mountain/ |
The Wind architecture centers around the
Preload.ts
script which sets up the VS Code compatibility layer, and the
Effect/
directory which contains all Effect-TS based services. See
Effect/index.ts
for the complete module exports and layer compositions.
This diagram illustrates Wind's central role between Sky (the UI) and
Tauri / Mountain (backend).
graph LR
classDef sky fill:#cce8ff,stroke:#2980b9,stroke-width:2px,color:#003050;
classDef wind fill:#fffde0,stroke:#f0b429,stroke-width:2px,color:#4a3500;
classDef tauri fill:#ffe0f0,stroke:#c0396a,stroke-width:2px,color:#4a0020;
classDef mountain fill:#f0d0ff,stroke:#9b59b6,stroke-width:2px,color:#2c0050;
classDef effectts fill:#d4f5d4,stroke:#27ae60,stroke-width:1px,color:#0a3a0a;
subgraph "π Sky β Frontend UI (Tauri WebView)"
SkyApp["πΌοΈ Sky Application β VS Code UI"]:::sky
end
subgraph "π Wind β VS Code Env & Services Layer (WebView)"
PreloadJS["π Preload.js β Environment Shim"]:::wind
WindEffectTSRuntime["β‘ Wind Effect-TS Runtime & Service Layers"]:::effectts
TauriIntegrations["π Wind Effect Services β Tauri API Wrappers"]:::wind
SkyApp -- consumes --> WindEffectTSRuntime
WindEffectTSRuntime -- executes via --> TauriIntegrations
end
subgraph "β°οΈ Tauri Core & Mountain β Rust Backend"
TauriAPIs["βοΈ Tauri JS API & Plugins"]:::tauri
MountainBackend["π¦ Mountain Rust Core β Command Handlers"]:::mountain
end
TauriWindow["π― Tauri Window"] -- loads --> PreloadJS
PreloadJS -- prepares env for --> SkyApp
TauriIntegrations -- calls --> TauriAPIs
TauriAPIs -- communicates with --> MountainBackend
Wind/
βββ Source/
βββ Preload.ts # Core script: VS Code environment emulation in Tauri.
βββ Effect/ # Effect-TS services (atomic structure).
β βββ IPC/ # Inter-process communication service.
β βββ Sandbox/ # Preload globals service.
β βββ Configuration/ # Configuration service.
β βββ Telemetry/ # Logging, spans, metrics service.
β βββ Mountain/ # Backend connection & RPC service.
β βββ MountainSync/ # Background synchronization service.
β βββ Environment/ # System detection service.
β βββ Health/ # Service health checks.
β βββ Bootstrap/ # Orchestration of all stages.
β βββ Clipboard/ # System clipboard service.
β βββ ActivityBar/ # VS Code activity bar management.
β βββ Panel/ # VS Code bottom panel management.
β βββ Sidebar/ # VS Code sidebar management.
β βββ StatusBar/ # VS Code status bar management.
β βββ Layers/ # Layer compositions (Tauri, Electron).
βββ Bootstrap/ # Bootstrap type definitions.
βββ Configuration/ # ESBuild bundling configurations.
βββ FileSystem/ # VS Code-like file system provider.
βββ Function/ # Install helper functions.
βββ Polyfills/ # Polyfills for Electron/Node APIs.
βββ Types/ # Shared type definitions.
βββ Workbench/ # VS Code workbench integration.
pnpm add @codeeditorland/windKey Dependencies:
| Package | Version | Purpose |
|---|---|---|
@tauri-apps/api |
2.10.1 |
Tauri JS bridge |
@tauri-apps/plugin-dialog |
2.6.0 |
Native OS file dialogs |
effect |
3.19.18 |
Structured concurrency & DI |
@effect/platform |
0.94.5 |
Platform abstractions for Effect |
Wind is primarily integrated via its Preload.ts script and its Effect-TS layers.
-
Integrate the Preload Script: Configure your
tauri.config.jsonto include the bundledPreload.jsfromWindin your main window's preload scripts. -
Use Services with
Effect-TS:
import { IPC } from "@codeeditorland/wind/Effect";
import { TauriLiveLayer } from "@codeeditorland/wind/Effect/Layers/Tauri";
import { Effect, Layer, Runtime } from "effect";
// Build the application runtime with Tauri live layer
const AppRuntime = Layer.toRuntime(TauriLiveLayer).pipe(
Effect.scoped,
Effect.runSync,
);
// Example: invoke a Tauri command through the typed IPC service
const InvokeEffect = Effect.gen(function* (_) {
const IPCService = yield* _(IPC);
const Result = yield* _(
IPCService.invoke("mountain_get_workbench_configuration"),
);
yield* _(Effect.log(`Configuration received: ${JSON.stringify(Result)}`));
});
Runtime.runPromise(AppRuntime, InvokeEffect);| Service | Import Path | Description |
|---|---|---|
IPC |
@codeeditorland/wind/Effect |
Inter-process communication via Tauri |
Sandbox |
@codeeditorland/wind/Effect/Sandbox |
Preload globals and environment |
Configuration |
@codeeditorland/wind/Effect/Configuration |
Workbench configuration management |
Telemetry |
@codeeditorland/wind/Effect/Telemetry |
Logging, spans, and metrics |
Mountain |
@codeeditorland/wind/Effect/Mountain |
Backend RPC connection |
MountainSync |
@codeeditorland/wind/Effect/MountainSync |
Background synchronization |
Environment |
@codeeditorland/wind/Effect/Environment |
System/platform detection |
Health |
@codeeditorland/wind/Effect/Health |
Service health checks |
Bootstrap |
@codeeditorland/wind/Effect/Bootstrap |
Multi-stage bootstrap orchestration |
Clipboard |
@codeeditorland/wind/Effect/Clipboard |
System clipboard access |
ActivityBar |
@codeeditorland/wind/Effect/ActivityBar |
VS Code activity bar management |
Panel |
@codeeditorland/wind/Effect/Panel |
VS Code panel management |
Sidebar |
@codeeditorland/wind/Effect/Sidebar |
VS Code sidebar management |
StatusBar |
@codeeditorland/wind/Effect/StatusBar |
VS Code status bar management |
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.
See CHANGELOG.md for a
history of changes specific to Windβπ.
Windβπ 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.
The project is operated by PlayForm, based in Sofia, Bulgaria.
PlayForm acts as the open-source steward for Code Editor Land under the NGI0 Commons Fund grant.
| Land | PlayForm | NLnet | NGI0 Commons Fund |
|---|---|---|---|
|
|
|
|
|
Project Maintainers: Source Open (Source/Open@Editor.Land) | GitHub Repository | Report an Issue | Security Policy