|
37 | 37 | </tr> |
38 | 38 | </table> |
39 | 39 |
|
| 40 | + |
40 | 41 | --- |
41 | 42 |
|
42 | | -# **Wind** 🍃 |
| 43 | +# **Wind** 🍃 |
| 44 | + |
| 45 | +> **VS Code's workbench lives in the Chromium renderer. Every panel interaction that touches files or state crosses the Electron IPC bridge twice: serialize to JSON, send over a pipe, deserialize on the other side.** |
43 | 46 |
|
44 | | -The Breath of Land: VSCode Environment & Services for Tauri |
| 47 | +_"No Electron IPC proxy. Workbench actions hit the OS directly."_ |
45 | 48 |
|
46 | 49 | [](https://github.com/CodeEditorLand/Wind/tree/Current/LICENSE) |
47 | 50 | [](https://www.npmjs.com/package/@codeeditorland/wind) |
48 | | -[<img src="https://cdn.simpleicons.org/tauri/24C8D8" width="14" alt="Tauri" />](https://tauri.app/) [](https://www.npmjs.com/package/@tauri-apps/api) |
49 | | -[<img src="https://cdn.simpleicons.org/effect" width="14" alt="Effect-TS" />](https://effect.website/) [](https://www.npmjs.com/package/effect) |
50 | | - |
51 | | -Welcome to **Wind**! This element is the vital **Effect-TS native service |
52 | | -layer** that allows `Sky` (Land's VSCode-based UI) to breathe and function |
53 | | -within the **Tauri** shell. **Wind** recreates essential parts of the VSCode |
54 | | -renderer environment, provides robust implementations of core services (like |
55 | | -file dialogs and configuration), and integrates seamlessly with the `Mountain` |
56 | | -backend via Tauri APIs. It replaces Electron-based implementations with |
57 | | -high-performance, OS-native equivalents, all underpinned by **Effect-TS** for |
58 | | -resilience and type safety. |
59 | | - |
60 | | -**What Wind gives you:** |
61 | | - |
62 | | -1. **VS Code workbench, without Electron.** Wind shims the Electron and Node.js |
63 | | - APIs that VS Code's workbench expects. The existing code runs unmodified in |
64 | | - Tauri's webview. |
65 | | -2. **Type-safe services with Effect-TS.** Every workbench service (file dialogs, |
66 | | - configuration, output channels) is a composable `Layer`. Errors are typed, |
67 | | - dependencies are explicit, and everything is testable. |
68 | | -3. **Native OS integration.** File dialogs, clipboard, and OS info use Tauri |
69 | | - native APIs. No Electron IPC proxy, no renderer-to-main roundtrip. |
70 | | - |
71 | | ---- |
72 | | - |
73 | | -## Key Features 🔐 |
74 | | - |
75 | | -- **Native Dialog Experience:** Implements dialog services for File Open/Save |
76 | | - dialogs using Tauri's native OS dialogs via |
77 | | - [`Polyfills/NativeModulePolyfill.ts`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Polyfills/NativeModulePolyfill.ts). |
78 | | -- **VSCode Environment Compliance:** A sophisticated |
79 | | - [`Preload.ts`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Preload.ts) |
80 | | - script establishes the crucial `window.vscode` global object, shimming |
81 | | - `ipcRenderer` and `process` to bridge the gap between the VSCode workbench |
82 | | - code and the Tauri runtime. |
83 | | -- **Effect-TS Powered Architecture:** Employs `Effect` for all asynchronous |
84 | | - operations and service logic, ensuring that all potential failures are |
85 | | - explicitly handled as typed, tagged errors for maximum robustness. |
86 | | -- **Declarative Dependency Management:** Uses `Layer` and `Context.Tag` from |
87 | | - `Effect-TS` for clean dependency injection and composable service |
88 | | - construction. |
89 | | -- **Clean Integration Layer:** Provides a clear abstraction layer over Tauri |
90 | | - APIs, isolating platform specifics and simplifying their usage within the |
91 | | - application. |
| 51 | +[<img src="https://editor.land/Image/Tauri.svg" width="14" alt="Tauri" />](https://tauri.app/) [](https://www.npmjs.com/package/@tauri-apps/api) |
| 52 | +[<img src="https://editor.land/Image/EffectTS.svg" width="14" alt="Effect-TS" />](https://effect.website/) [](https://www.npmjs.com/package/effect) |
92 | 53 |
|
93 | | ---- |
94 | | - |
95 | | -## Core Architecture Principles 🏗️ |
96 | | - |
97 | | -| Principle | Description | Key Components Involved | |
98 | | -| :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
99 | | -| **Compatibility** | Provide a high-fidelity VSCode renderer environment to maximize `Sky`'s reusability and minimize changes needed for VSCode UI components. | [`Preload.ts`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Preload.ts), [`Polyfills/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Polyfills/) | |
100 | | -| **Modularity** | Components (preload, services, integrations) are organized into distinct, cohesive modules for clarity and maintainability. | [`Effect/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/), [`Types/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Types/), [`Bootstrap/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Bootstrap/) | |
101 | | -| **Robustness** | Leverage `Effect-TS` for all service implementations and asynchronous operations, ensuring predictable error handling and composability. | All [`Effect/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/) services with `Layer` and `Tag` patterns | |
102 | | -| **Abstraction** | Create a clean layer over Tauri APIs, isolating platform specifics and simplifying their usage within the application. | [`Preload.ts`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Preload.ts), [`Effect/IPC/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/IPC/), [`Effect/Mountain/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Mountain/) | |
103 | | -| **Integration** | Seamlessly connect `Sky`'s frontend requests with `Mountain`'s backend capabilities through Tauri's `invoke`/event system. | [`Preload.ts`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Preload.ts) (ipcRenderer shim), [`Effect/Mountain/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Mountain/) | |
| 54 | +Wind re-implements the VS Code Workbench as composable Effect-TS Layers. Each workbench service (file dialogs, clipboard, configuration, output channels, status bar) is a typed Layer that can be provided, mocked, or replaced without touching other services. OS calls go directly through Mountain's Tauri bindings. No JSON serialization. The workbench can be tested in isolation by providing mock layers instead of a running Tauri instance. |
104 | 55 |
|
105 | 56 | --- |
106 | 57 |
|
107 | | -## Deep Dive & Component Breakdown 🔬 |
| 58 | +## What It Does 🔐 |
108 | 59 |
|
109 | | -The `Wind` architecture centers around the |
110 | | -[`Preload.ts`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Preload.ts) |
111 | | -script which sets up the VSCode compatibility layer, and the |
112 | | -[`Effect/`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/) |
113 | | -directory which contains all Effect-TS based services. See |
114 | | -[`Effect/index.ts`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/index.ts) |
115 | | -for the complete module exports and layer compositions. |
| 60 | +- **Direct OS access.** File dialogs, clipboard, and configuration hit the OS through Tauri bindings. No IPC proxy. |
| 61 | +- **Composable Effect-TS Layers.** Each workbench service is independently providable, mockable, and replaceable. |
| 62 | +- **Compile-time safety.** Refactoring a service breaks its consumers at compile time, not silently at runtime. |
| 63 | +- **Full testability.** Provide mock layers and test the workbench without a running Tauri instance. |
116 | 64 |
|
117 | 65 | --- |
118 | 66 |
|
119 | | -## `Wind` in the Land Ecosystem 🍃 + 🏞️ |
120 | | - |
121 | | -This diagram illustrates `Wind`'s central role between `Sky` (the UI) and the |
122 | | -Tauri/`Mountain` (backend) environment. |
| 67 | +## In the Ecosystem 🍃 + 🏞️ |
123 | 68 |
|
124 | 69 | ```mermaid |
125 | 70 | graph LR |
@@ -157,9 +102,7 @@ TauriAPIs -- Communicates with --> MountainBackend; |
157 | 102 |
|
158 | 103 | --- |
159 | 104 |
|
160 | | -## Project Structure Overview 🗺️ |
161 | | - |
162 | | -The `Wind` repository is organized to clearly separate concerns: |
| 105 | +## Project Structure 🗺️ |
163 | 106 |
|
164 | 107 | ``` |
165 | 108 | Wind/ |
@@ -193,112 +136,31 @@ Wind/ |
193 | 136 |
|
194 | 137 | --- |
195 | 138 |
|
196 | | -## Getting Started 🚀 |
197 | | - |
198 | | -### Installation 📥 |
199 | | - |
200 | | -```sh |
201 | | -pnpm add @codeeditorland/wind |
202 | | -``` |
203 | | - |
204 | | -**Key Dependencies:** |
205 | | - |
206 | | -- `@tauri-apps/api`: `2.10.1` |
207 | | -- `@tauri-apps/plugin-dialog`: `2.6.0` |
208 | | -- `effect`: `3.19.18` |
209 | | -- `@effect/platform`: `0.94.5` |
210 | | -- VSCode platform code (e.g., `vs/base`, `vs/platform`), typically sourced from |
211 | | - the `Land/Dependency` submodule. |
212 | | - |
213 | | -### Usage 🚀 |
214 | | - |
215 | | -`Wind` is primarily integrated via its |
216 | | -[`Preload.ts`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Preload.ts) |
217 | | -script and its `Effect-TS` layers. |
218 | | - |
219 | | -1. **Integrate the Preload Script:** Configure your `tauri.config.json` to |
220 | | - include the bundled `Preload.js` from `Wind` in your main window's preload |
221 | | - scripts. This is essential for setting up the `window.vscode` environment. |
222 | | - |
223 | | -2. **Use Services with Effect-TS:** If your `Sky` frontend uses `Effect-TS`, you |
224 | | - can provide and use `Wind`'s services in your application's main entry point. |
225 | | - |
226 | | -```ts |
227 | | -// In your main UI startup file (e.g., DesktopMain.ts) |
228 | | - |
229 | | -import { IPC } from "@codeeditorland/wind/Effect"; |
230 | | -import { TauriLiveLayer } from "@codeeditorland/wind/Effect/Layers/Tauri"; |
231 | | -import { Effect, Layer, Runtime } from "effect"; |
232 | | - |
233 | | -// Build the application runtime with Tauri live layer |
234 | | -const AppRuntime = Layer.toRuntime(TauriLiveLayer).pipe( |
235 | | - Effect.scoped, |
236 | | - Effect.runSync, |
237 | | -); |
238 | | - |
239 | | -// Example of using IPC within an Effect |
240 | | -const invokeEffect = Effect.gen(function* (_) { |
241 | | - const ipcService = yield* _(IPC); |
242 | | - |
243 | | - const result = yield* _( |
244 | | - ipcService.invoke("mountain_get_workbench_configuration"), |
245 | | - ); |
246 | | - |
247 | | - yield* _(Effect.log(`Configuration received: ${JSON.stringify(result)}`)); |
248 | | -}); |
249 | | - |
250 | | -// Run the effect using the configured runtime |
251 | | -Runtime.runPromise(AppRuntime, invokeEffect); |
252 | | -``` |
253 | | - |
254 | | -3. **Available Effect Services:** |
255 | | - |
256 | | -| Service | Import Path | Description | |
257 | | -| --------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | |
258 | | -| `IPC` | [`@codeeditorland/wind/Effect`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/index.ts) | Inter-process communication via Tauri | |
259 | | -| `Sandbox` | [`@codeeditorland/wind/Effect/Sandbox`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Sandbox/index.ts) | Preload globals and environment | |
260 | | -| `Configuration` | [`@codeeditorland/wind/Effect/Configuration`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Configuration.ts) | Workbench configuration management | |
261 | | -| `Telemetry` | [`@codeeditorland/wind/Effect/Telemetry`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Telemetry/index.ts) | Logging, spans, and metrics | |
262 | | -| `Mountain` | [`@codeeditorland/wind/Effect/Mountain`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Mountain/index.ts) | Backend RPC connection | |
263 | | -| `MountainSync` | [`@codeeditorland/wind/Effect/MountainSync`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/MountainSync/index.ts) | Background synchronization | |
264 | | -| `Environment` | [`@codeeditorland/wind/Effect/Environment`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Environment/index.ts) | System/platform detection | |
265 | | -| `Health` | [`@codeeditorland/wind/Effect/Health`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Health/index.ts) | Service health checks | |
266 | | -| `Bootstrap` | [`@codeeditorland/wind/Effect/Bootstrap`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Bootstrap/index.ts) | Multi-stage bootstrap orchestration | |
267 | | -| `Clipboard` | [`@codeeditorland/wind/Effect/Clipboard`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Clipboard.ts) | System clipboard access | |
268 | | -| `ActivityBar` | [`@codeeditorland/wind/Effect/ActivityBar`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/ActivityBar/index.ts) | VSCode activity bar management | |
269 | | -| `Panel` | [`@codeeditorland/wind/Effect/Panel`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Panel/index.ts) | VSCode panel management | |
270 | | -| `Sidebar` | [`@codeeditorland/wind/Effect/Sidebar`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/Sidebar/index.ts) | VSCode sidebar management | |
271 | | -| `StatusBar` | [`@codeeditorland/wind/Effect/StatusBar`](https://github.com/CodeEditorLand/Wind/tree/Current/Source/Effect/StatusBar/index.ts) | VSCode status bar management | |
272 | | - |
273 | | ---- |
274 | | - |
275 | | -## License ⚖️ |
276 | | - |
277 | | -This project is released into the public domain under the **Creative Commons CC0 |
278 | | -Universal** license. |
| 139 | +## Development 🛠️ |
279 | 140 |
|
280 | | -You are free to use, modify, distribute, and build upon this work for any |
281 | | -purpose, without any restrictions. For the full legal text, see the |
282 | | -[`LICENSE`](https://github.com/CodeEditorLand/Wind/tree/Current/) file. |
| 141 | +Wind is a component of the Land workspace. Follow the |
| 142 | +[Land Repository](https://github.com/CodeEditorLand/Land) instructions to |
| 143 | +build and run. |
283 | 144 |
|
284 | 145 | --- |
285 | 146 |
|
286 | | -## Changelog 📜 |
| 147 | +## License ⚖️ |
287 | 148 |
|
288 | | -Stay updated with our progress! See |
289 | | -[`CHANGELOG.md`](https://github.com/CodeEditorLand/Wind/tree/Current/) for a |
290 | | -history of changes specific to **Wind**. |
| 149 | +CC0 1.0 Universal. Public domain. No restrictions. |
| 150 | +[LICENSE](https://github.com/CodeEditorLand/Wind/tree/Current/LICENSE) |
291 | 151 |
|
292 | 152 | --- |
293 | 153 |
|
294 | | - |
295 | 154 | ## See Also |
296 | 155 |
|
| 156 | +- [Wind Documentation](https://editor.land/Doc/wind) |
297 | 157 | - [Architecture Overview](https://editor.land/Doc/architecture) |
298 | | -- [Cocoon](https://github.com/CodeEditorLand/Cocoon) |
299 | | -- [Sky](https://github.com/CodeEditorLand/Sky) |
| 158 | +- [Why Effect-TS](https://editor.land/Doc/why-effect-ts) |
| 159 | +- [Why Tauri](https://editor.land/Doc/why-tauri) |
300 | 160 | - [Mountain](https://github.com/CodeEditorLand/Mountain) |
301 | | -- [Worker](https://github.com/CodeEditorLand/Worker) |
| 161 | +- [Sky](https://github.com/CodeEditorLand/Sky) |
| 162 | +- [Cocoon](https://github.com/CodeEditorLand/Cocoon) |
| 163 | + |
302 | 164 |
|
303 | 165 | ## Funding & Acknowledgements 🙏🏻 |
304 | 166 |
|
|
0 commit comments