Skip to content

Latest commit

Β 

History

History
402 lines (341 loc) Β· 21.9 KB

File metadata and controls

402 lines (341 loc) Β· 21.9 KB

Windβ€πŸƒ


Windβ€πŸƒ

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

VS Code's workbench runs inside the Chromium renderer process, meaning every panel interaction that touches files or state must cross the Electron IPC bridge through untyped JSON serialization. Wind replaces that pipeline with typed Tauri commands routed to Rust handlers in Mountain's core, eliminating the untyped serialization layer entirely while preserving full VS Code workbench compatibility.

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

Welcome to Windβ€πŸƒ. This element provides the Effect-TS native service layer that enables Sky, Land's VS Code-based UI, to function within the Tauri shell. Wind recreates the essential VS Code renderer environment, implements core services through Effect-TS's typed error and dependency injection patterns, and connects the frontend to Mountain's Rust backend through Tauri's invoke and event system.

Wind operates through three primary mechanisms. The Preload.sh script shims Electron and Node.js APIs that the VS Code workbench expects, establishing a compatible execution context inside the Tauri WebView. The Effect/ directory contains the service implementations, each organized as an atomic module with Tag, Interface, Implementation, Layer, and Type subdirectories that compose into TauriLiveLayer, ElectronLiveLayer, and TestLayer stacks. The Mountain service maintains an RPC connection to the Rust backend for configuration, state synchronization, and native operations.


Key Featuresβ€πŸ”

Wind exposes Tauri's native OS file dialogs through an Effect-TS wrapper that surfaces typed, tagged errors for every failure path, providing an integrated dialog experience without the Electron IPC indirection. The Preload.ts script establishes the window.vscode global object and shims ipcRenderer and process so the VS Code workbench code interacts with a familiar environment while actually communicating through Tauri's invoke system. Every asynchronous operation and service uses Effect for structured concurrency, meaning all potential failures are explicitly typed rather than thrown as untyped exceptions. Service composition relies on Effect-TS's Layer and Context.Tag primitives, enabling clean dependency injection where individual services like Clipboard, Terminal, or Configuration can be swapped between live, mock, and test implementations without modifying consuming code. The abstraction layer isolates Tauri-specific details so application code works against stable service interfaces rather than platform-specific APIs.


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/, Types/
Modularity Each service follows an atomic directory structure with interface, implementation, tag, layer, and type subdirectories. Effect/ services
Robustness Effect-TS powers all service implementations, ensuring tagged error types and composable dependency injection via Layer. All Effect/ services with Layer and Tag patterns
Abstraction Clean layer over Tauri APIs replaces the untyped Electron IPC pipe with typed Tauri commands whose handlers live in Rust. Preload.ts, Effect/IPC/, Effect/Mountain/
Integration Sky's frontend requests connect to Mountain's backend capabilities through Tauri's invoke and 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. Preload.ts shims Electron APIs, creates window.vscode, and prepares the environment that Sky's VS Code code relies on. The Effect/ module exports all services and composed layer stacks, with TauriLiveLayer in Effect/Layers/Tauri.ts serving as the primary composition that merges sandbox, IPC, configuration, telemetry, Mountain, and dozens of UI and editor services into a single runnable layer. The code generator under Codegen/ walks the VS Code service catalog, extracts decorator matches and interface members, and emits bridge shape specifications that the Workbench* services implement. 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              # VS Code environment emulation in Tauri WebView.
    β”œβ”€β”€ Effect/                 # Effect-TS services (atomic structure).
    β”‚   β”œβ”€β”€ IPC/                # Inter-process communication via Tauri invoke.
    β”‚   β”œβ”€β”€ Sandbox/            # Preload globals and environment service.
    β”‚   β”œβ”€β”€ Configuration/      # Workbench configuration with sync.
    β”‚   β”œβ”€β”€ Telemetry/          # Logging, spans, and metrics (PostHog/OTLP).
    β”‚   β”œβ”€β”€ Mountain/           # Backend RPC connection service.
    β”‚   β”œβ”€β”€ MountainSync/       # Background configuration sync.
    β”‚   β”œβ”€β”€ Environment/        # System and platform detection.
    β”‚   β”œβ”€β”€ Health/             # Service health checks.
    β”‚   β”œβ”€β”€ Bootstrap/          # Multi-stage bootstrap orchestration.
    β”‚   β”œβ”€β”€ Clipboard/          # System clipboard access.
    β”‚   β”œβ”€β”€ Commands/           # VS Code command registry.
    β”‚   β”œβ”€β”€ Editor/             # Editor service abstraction.
    β”‚   β”œβ”€β”€ ActivityBar/        # Activity bar management.
    β”‚   β”œβ”€β”€ Panel/              # Bottom panel management.
    β”‚   β”œβ”€β”€ Sidebar/            # Sidebar management.
    β”‚   β”œβ”€β”€ StatusBar/          # Status bar management.
    β”‚   β”œβ”€β”€ Decorations/        # Editor decorations service.
    β”‚   β”œβ”€β”€ Extensions/         # Extension management.
    β”‚   β”œβ”€β”€ Files/              # File system operations.
    β”‚   β”œβ”€β”€ History/            # Editor history service.
    β”‚   β”œβ”€β”€ Keybinding/         # Keyboard shortcut binding.
    β”‚   β”œβ”€β”€ Label/              # Label service.
    β”‚   β”œβ”€β”€ Language/           # Language service.
    β”‚   β”œβ”€β”€ Lifecycle/          # Application lifecycle.
    β”‚   β”œβ”€β”€ Model/              # Text model service.
    β”‚   β”œβ”€β”€ Notification/       # Notification service.
    β”‚   β”œβ”€β”€ Output/             # Output panel service.
    β”‚   β”œβ”€β”€ Progress/           # Progress indication.
    β”‚   β”œβ”€β”€ QuickInput/         # Quick input UI.
    β”‚   β”œβ”€β”€ Search/             # Search service.
    β”‚   β”œβ”€β”€ Storage/            # Persistent storage.
    β”‚   β”œβ”€β”€ Terminal/           # Terminal service.
    β”‚   β”œβ”€β”€ TextFile/           # Text file service.
    β”‚   β”œβ”€β”€ TextModelResolver/  # Text model resolver.
    β”‚   β”œβ”€β”€ Themes/             # Theme management.
    β”‚   β”œβ”€β”€ WorkingCopy/        # Working copy service.
    β”‚   β”œβ”€β”€ Workspaces/         # Workspace management.
    β”‚   β”œβ”€β”€ NetworkRestrictions/# Network access restrictions.
    β”‚   β”œβ”€β”€ UserSettings/       # User settings bridge.
    β”‚   β”œβ”€β”€ Vine/               # Notification stream.
    β”‚   β”œβ”€β”€ LandWorkbench/      # Land workbench integration.
    β”‚   β”œβ”€β”€ Generated/          # Auto-generated VS Code service interfaces.
    β”‚   └── Layers/             # Layer compositions (Tauri, Electron, Test).
    β”œβ”€β”€ Bootstrap/             # Bootstrap type definitions for startup.
    β”œβ”€β”€ Codegen/               # VS Code service code generator.
    β”œβ”€β”€ Configuration/         # ESBuild and TypeScript configurations.
    β”œβ”€β”€ FileSystem/            # VS Code-like file system provider.
    β”œβ”€β”€ Function/              # Preload install helpers and IPC renderer creation.
    β”œβ”€β”€ IPC/                   # IPC channel and Sky event definitions.
    β”œβ”€β”€ Service/               # Tauri main process service.
    β”œβ”€β”€ Telemetry/             # PostHog telemetry bridge.
    β”œβ”€β”€ Types/                 # Sandbox, IPC, and error type definitions.
    β”œβ”€β”€ Utility/               # Shared utility functions.
    └── Workbench/             # Workbench integration service.

Getting Startedβ€πŸš€

Installation πŸ“₯

pnpm add @codeeditorland/wind

Key Dependencies:

Package Version Purpose
@tauri-apps/api 2.11.0 Tauri JS bridge
@tauri-apps/plugin-dialog 2.7.1 Native OS file dialogs
@codeeditorland/output 0.0.1 Shared output utilities
effect 3.21.2 Structured concurrency & DI
@effect/platform 0.96.1 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 Preload globals and environment
Configuration @codeeditorland/wind/Effect Workbench configuration with sync
Telemetry @codeeditorland/wind/Effect Logging, spans, and metrics
Mountain @codeeditorland/wind/Effect Backend RPC connection
MountainSync @codeeditorland/wind/Effect Background configuration sync
Environment @codeeditorland/wind/Effect System and platform detection
Health @codeeditorland/wind/Effect Service health checks
Bootstrap @codeeditorland/wind/Effect Multi-stage bootstrap orchestration
Clipboard @codeeditorland/wind/Effect System clipboard access
Commands @codeeditorland/wind/Effect VS Code command registry
Editor @codeeditorland/wind/Effect Editor service abstraction
ActivityBar @codeeditorland/wind/Effect Activity bar management
Panel @codeeditorland/wind/Effect Bottom panel management
Sidebar @codeeditorland/wind/Effect Sidebar management
StatusBar @codeeditorland/wind/Effect Status bar management
Decorations @codeeditorland/wind/Effect Editor decoration service
Extensions @codeeditorland/wind/Effect Extension management
Files @codeeditorland/wind/Effect File system operations
History @codeeditorland/wind/Effect Editor history
Keybinding @codeeditorland/wind/Effect Keyboard shortcut binding
Label @codeeditorland/wind/Effect Label service
Language @codeeditorland/wind/Effect Language service
Lifecycle @codeeditorland/wind/Effect Application lifecycle
Model @codeeditorland/wind/Effect Text model service
Notification @codeeditorland/wind/Effect Notification service
Output @codeeditorland/wind/Effect Output panel service
Progress @codeeditorland/wind/Effect Progress indication
QuickInput @codeeditorland/wind/Effect Quick input UI
Search @codeeditorland/wind/Effect Search service
Storage @codeeditorland/wind/Effect Persistent storage
Terminal @codeeditorland/wind/Effect Terminal service
TextFile @codeeditorland/wind/Effect Text file service
TextModelResolver @codeeditorland/wind/Effect Text model resolver
Themes @codeeditorland/wind/Effect Theme management
WorkingCopy @codeeditorland/wind/Effect Working copy service
Workspaces @codeeditorland/wind/Effect Workspace management
NetworkRestrictions @codeeditorland/wind/Effect Network access restrictions
UserSettings @codeeditorland/wind/Effect User settings bridge
Vine @codeeditorland/wind/Effect Notification stream
LandWorkbench @codeeditorland/wind/Effect Land workbench integration
Layers/Tauri @codeeditorland/wind/Effect/Layers/Tauri Complete Tauri layer stack
Layers/Electron @codeeditorland/wind/Effect/Layers/Electron Electron compatibility layer stack
Layers/Test @codeeditorland/wind/Effect/Layers/Test Test/mock layer stack
FileSystem @codeeditorland/wind/FileSystem VS Code-like file system provider
Workbench @codeeditorland/wind/Workbench Workbench integration service

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