Skip to content

CodeEditorLand/Wind

Windβ€πŸƒ


Windβ€πŸƒ

The Breath of Land: VS Code Environment & Services for Tauri.

VS Code's workbench lives in the Chromium renderer. Every panel interaction that touches files or state crosses the Electron IPC 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."

License: CC0-1.0 NPM Version Tauri API Version Effect Version

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:

  1. Emulate the VS Code Sandbox: Through a sophisticated Preload.ts script, it shims critical Electron and Node.js APIs that VS Code's workbench code expects, creating a compatible execution context inside the Tauri WebView.
  2. Implement Core VS Code Services: It provides frontend implementations for key VS Code services via Polyfills/NativeModulePolyfill.ts, leveraging Effect-TS for highly reliable, composable, and maintainable logic.
  3. 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.

Key Featuresβ€πŸ”

  • Native Dialog Experience: Implements dialog services for File Open/Save dialogs using Tauri's native OS dialogs via Polyfills/NativeModulePolyfill.ts.
  • VS Code Environment Compliance: A sophisticated Preload.ts script establishes the crucial window.vscode global object, shimming ipcRenderer and process to bridge the gap between the VS Code 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 and Context.Tag from Effect-TS for clean dependency injection and composable service construction.
  • Clean Integration Layer: Provides a clear abstraction layer over Tauri APIs, isolating platform specifics and simplifying their usage within the application.

Core Architecture Principlesβ€πŸ—οΈ

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/

Deep Dive & Component Breakdownβ€πŸ”¬

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.


Windβ€πŸƒ in the Landβ€πŸžοΈ Ecosystemβ€β€β€πŸƒβ€+β€πŸžοΈ

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
Loading

Project Structureβ€πŸ—ΊοΈ

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.

Getting Startedβ€πŸš€

Installation πŸ“₯

pnpm add @codeeditorland/wind

Key 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

Usageβ€πŸš€

Wind is primarily integrated via its Preload.ts script and its Effect-TS layers.

  1. Integrate the Preload Script: Configure your tauri.config.json to include the bundled Preload.js from Wind in your main window's preload scripts.

  2. 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);

Available Effect Servicesβ€βš‘

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

See Alsoβ€πŸ”—


Licenseβ€βš–οΈ

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.


Changelogβ€πŸ“œ

See CHANGELOG.md for a history of changes specific to Windβ€πŸƒ.


Funding & Acknowledgementsβ€πŸ™πŸ»

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
Land PlayForm NLnet NGI0 Commons Fund

Project Maintainers: Source Open (Source/Open@Editor.Land) | GitHub Repository | Report an Issue | Security Policy

About

Windβ€πŸƒβ€+ Landβ€πŸžοΈ

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors

Languages