@@ -263,13 +263,87 @@ wit_library(
263263
264264## Available WASI Interfaces
265265
266- The following WASI interfaces are pre-configured and available:
266+ The following WASI interfaces are pre-configured and available with dual version support for maximum compatibility :
267267
268- | Package | Repository | Description |
269- | ---------| ------------| -------------|
270- | ` @wasi_io//:streams ` | ` wasi:[email protected] ` | I/O streams, error handling, polling
| 268+ ### WASI 0.2.3 (Latest - Full Feature Set)
271269
272- More WASI packages can be added to ` wit/wasi_deps.bzl ` as needed.
270+ | Package | Target | Interfaces | Description |
271+ | ---------| --------| -------------| -------------|
272+ | ` @wasi_io//:streams ` | ` wasi:[email protected] ` | ` error ` ,
` poll ` ,
` streams ` | I/O streams, error handling, polling
| 273+ | ` @wasi_cli//:cli ` | ` wasi:[email protected] ` | ` environment ` ,
` exit ` ,
` stdin ` ,
` stdout ` ,
` stderr ` ,
` terminal-* ` | CLI environment, standard I/O streams
| 274+ | ` @wasi_clocks//:clocks ` | ` wasi:[email protected] ` | ` wall-clock ` ,
` monotonic-clock ` | System time and timing operations
| 275+ | ` @wasi_random//:random ` | ` wasi:[email protected] ` | ` random ` ,
` insecure ` ,
` insecure-seed ` | Random number generation
| 276+ | ` @wasi_filesystem//:filesystem ` | ` wasi:[email protected] ` | ` types ` ,
` preopens ` | File system operations ⚠️
| 277+ | ` @wasi_sockets//:sockets ` | ` wasi:[email protected] ` | ` network ` ,
` udp ` ,
` tcp ` ,
` ip-name-lookup ` | Network operations ⚠️
| 278+ | ` @wasi_http//:http ` | ` wasi:[email protected] ` | ` types ` ,
` handler ` ,
` outgoing-handler ` ,
` proxy ` | HTTP client/server ⚠️
| 279+
280+ ### WASI 0.2.0 (Original - Maximum Compatibility)
281+
282+ | Package | Target | Interfaces | Description |
283+ | ---------| --------| -------------| -------------|
284+ | ` @wasi_io_v020//:streams ` | ` wasi:[email protected] ` | ` error ` ,
` poll ` ,
` streams ` | I/O streams (compatible version)
| 285+ | ` @wasi_cli_v020//:cli ` | ` wasi:[email protected] ` | ` environment ` ,
` exit ` ,
` stdin ` ,
` stdout ` ,
` stderr ` | CLI environment (compatible version)
| 286+ | ` @wasi_clocks_v020//:clocks ` | ` wasi:[email protected] ` | ` wall-clock ` ,
` monotonic-clock ` | System time (compatible version)
| 287+
288+ ### Status & Recommendations
289+
290+ - ✅ ** Core WASI (IO, CLI, Clocks, Random)** : Work perfectly with current toolchain
291+ - ⚠️ ** Advanced WASI (Filesystem, Sockets, HTTP)** : Complete architecture but may have toolchain compatibility issues
292+ - 🔄 ** Use 0.2.0 versions** : For maximum compatibility with older toolchains
293+ - 📈 ** Use 0.2.3 versions** : For latest features when toolchain supports
294+
295+ ### Usage Examples
296+
297+ ** Simple component (recommended start):**
298+ ``` starlark
299+ wit_library(
300+ name = " basic_component" ,
301+ srcs = [" basic.wit" ],
302+ deps = [
303+ " @wasi_io//:streams" , # Basic I/O
304+ " @wasi_clocks//:clocks" , # Timing
305+ ],
306+ )
307+ ```
308+
309+ ** CLI application:**
310+ ``` starlark
311+ wit_library(
312+ name = " cli_app" ,
313+ srcs = [" cli.wit" ],
314+ deps = [
315+ " @wasi_cli//:cli" , # CLI environment
316+ " @wasi_io//:streams" , # Standard I/O
317+ " @wasi_random//:random" , # Random numbers
318+ ],
319+ )
320+ ```
321+
322+ ** Advanced component (when toolchain supports):**
323+ ``` starlark
324+ wit_library(
325+ name = " web_service" ,
326+ srcs = [" service.wit" ],
327+ deps = [
328+ " @wasi_http//:http" , # HTTP operations
329+ " @wasi_filesystem//:filesystem" , # File access
330+ " @wasi_sockets//:sockets" , # Network sockets
331+ ],
332+ )
333+ ```
334+
335+ ** Maximum compatibility:**
336+ ``` starlark
337+ wit_library(
338+ name = " compat_component" ,
339+ srcs = [" compat.wit" ],
340+ deps = [
341+ " @wasi_cli_v020//:cli" ,
342+ " @wasi_io_v020//:streams" ,
343+ " @wasi_clocks_v020//:clocks" ,
344+ ],
345+ )
346+ ```
273347
274348## Working with WKG (WebAssembly Component Registry)
275349
0 commit comments