Welcome to Wind! This element is the vital Effect-TS native service
layer that allows Sky
(Land's VSCode-based UI) to breathe and function
within the Tauri shell. Wind meticulously recreates essential parts of
the VSCode renderer environment, provides robust implementations of core
services (like file dialogs and configuration), and integrates seamlessly with
the Mountain
backend via Tauri APIs. It replaces Electron-based
implementations with high-performance, OS-native equivalents, all underpinned by
Effect-TS for resilience and type safety.
Wind is engineered to:
- Emulate the VSCode Sandbox: Through a sophisticated
Preload.ts
script, it shims critical Electron and Node.js APIs that VSCode's workbench code expects, creating a compatible execution context. - Implement Core VSCode Services: It provides frontend implementations for
key VSCode services (e.g.,
IFileDialogService
), leveragingEffect-TS
for highly reliable, composable, and maintainable logic. - Integrate with Tauri & Native Capabilities: It offers a clean abstraction layer over Tauri APIs for file operations, dialogs, and OS information, making them accessible in a type-safe way through Effect-based wrappers.
- Native Dialog Experience: Implements VSCode's
IFileDialogService
for File Open/Save dialogs using Tauri's native OS dialogs. - VSCode Environment Compliance: A sophisticated
Preload.ts
script establishes the crucialwindow.vscode
global object, shimmingipcRenderer
andprocess
to bridge the gap between the VSCode workbench code and the Tauri runtime. - Effect-TS Powered Architecture: Employs
Effect
for 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
Layer
andContext.Tag
fromEffect-TS
for clean dependency injection and composable service construction via a single masterAppLayer
. - Clean Integration Layer: Provides a clear abstraction layer over Tauri APIs, isolating platform specifics and simplifying their usage within the application.
Principle | Description | Key Components Involved |
---|---|---|
Compatibility | Provide a high-fidelity VSCode renderer environment to maximize Sky 's reusability and minimize changes needed for VSCode UI components. |
Preload.ts , Platform/VSCode/* |
Modularity | Components (preload, services, integrations) are organized into distinct, cohesive modules for clarity and maintainability. | Application/* , Integration/* , Platform/* |
Robustness | Leverage Effect-TS for all service implementations and asynchronous operations, ensuring predictable error handling and composability. |
All Effect -based modules |
Abstraction | Create a clean Integration layer over Tauri APIs, isolating platform specifics and simplifying their usage within the application. |
Integration/Tauri/Wrap/* , Preload.ts |
Integration | Seamlessly connect Sky 's frontend requests with Mountain 's backend capabilities through Tauri's invoke /event system. |
Preload.ts (ipcRenderer shim), HostServiceTag |
To understand how Wind
's internal components interact to provide these
services, please refer to the detailed technical breakdown in
docs/Deep Dive.md
. This document explains the role of
the Preload
script, the Integration
layer, and how the Application
services are constructed with Effect-TS.
This diagram illustrates Wind
's central role between Sky
(the UI) and the
Tauri/Mountain
(backend) environment.
graph LR
classDef sky fill:#9cf,stroke:#333,stroke-width:2px;
classDef wind fill:#ffc,stroke:#333,stroke-width:2px;
classDef tauri fill:#f9d,stroke:#333,stroke-width:2px;
classDef mountain fill:#f9f,stroke:#333,stroke-width:2px;
classDef effectts fill:#cfc,stroke:#333,stroke-width:1px;
subgraph "Sky (Frontend UI - Tauri Webview)"
SkyApp["Sky Application Code (VSCode UI Components)"]:::sky
end
subgraph "Wind (VSCode Env & Services Layer - Runs in Webview)"
PreloadJS["Preload.js (Environment Shim)"]:::wind
WindEffectTSRuntime["Wind Effect-TS Runtime & Service Layers"]:::effectts
TauriIntegrations["Wind/Integration/Tauri (Tauri API Wrappers)"]:::wind
SkyApp -- Consumes services from --> WindEffectTSRuntime;
WindEffectTSRuntime -- Executes side-effects 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 environment for --> SkyApp
TauriIntegrations -- Calls --> TauriAPIs;
TauriAPIs -- Communicates with --> MountainBackend;
The Wind
repository is organized to clearly separate concerns:
Wind/
└── Source/
├── Preload.ts # Core script for VSCode environment emulation in Tauri.
├── Application/ # Core frontend service implementations (e.g., Dialog, Editor).
├── Integration/
│ └── Tauri/ # Bridge to Tauri APIs, wrapped in Effect-TS.
├── Platform/
│ └── VSCode/ # Definitions of core VSCode types and service Tags.
├── Effect/
│ └── Produce/ # Utilities for creating Effects from async code.
└── Configuration/
└── ESBuild/ # ESBuild configurations for bundling the project.
pnpm add @codeeditorland/wind
Key Dependencies:
@tauri-apps/api
:^2.x
@tauri-apps/plugin-dialog
:^2.x
effect
:^3.x
- VSCode platform code (e.g.,
vs/base
,vs/platform
), typically sourced from theLand/Dependency
submodule.
Wind
is primarily integrated via its Preload.ts
script and its Effect-TS
layers.
-
Integrate the Preload Script: Configure your
tauri.config.json
to include the bundledPreload.js
fromWind
in your main window's preload scripts. This is essential for setting up thewindow.vscode
environment. -
Use Services with Effect-TS: If your
Sky
frontend usesEffect-TS
, you can provide and useWind
's services in your application's main entry point.// In your main UI startup file (e.g., DesktopMain.ts) import { DialogServiceTag } from "@codeeditorland/wind/Application/Dialog"; import { AppLayer } from "@codeeditorland/wind/Application/Instantiation/Layer"; import { Effect, Layer, Runtime } from "effect"; // Build the full application runtime from Wind's master AppLayer. const AppRuntime = Layer.toRuntime(AppLayer).pipe( Effect.scoped, Effect.runSync, ); // Example of using the dialog service within an Effect const openFileEffect = Effect.gen(function* (_) { const dialogService = yield* _(DialogServiceTag); const uris = yield* _( Effect.tryPromise(() => dialogService.showOpenDialog({ canSelectFiles: true, title: "Open a File", }), ), ); if (uris && uris.length > 0) { yield* _(Effect.log(`Selected file: ${uris[0].toString()}`)); } else { yield* _(Effect.log("Dialog was cancelled.")); } }); // Run the effect using the configured runtime Runtime.runPromise(AppRuntime, openFileEffect);
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 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.
Land | PlayForm | NLnet | NGI0 Commons Fund |
---|---|---|---|
Project Maintainers: Source Open (Source/[email protected]) | GitHub Repository | Report an Issue | Security Policy