From c0949b19d464f5d70bc1051195a3ae0e6a012df9 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 12 Jun 2026 12:47:55 -0600 Subject: [PATCH] update to Wasmtime 46 and WASI v0.3.0 Also: - bump version to 0.25.0 - update build.rs to be compatible with WASI-SDK 34-rc1 - minor tweaks to CONTRIBUTING.md --- .github/workflows/test.yaml | 2 +- CONTRIBUTING.md | 4 +- Cargo.lock | 447 +++++------ Cargo.toml | 8 +- build.rs | 8 +- examples/cli-p3/README.md | 20 +- examples/cli/README.md | 4 +- examples/http-p3/README.md | 20 +- examples/http/README.md | 4 +- examples/matrix-math/README.md | 4 +- examples/sandbox/README.md | 4 +- examples/tcp-p3/README.md | 4 +- examples/tcp/README.md | 4 +- pyproject.toml | 2 +- src/test/tests.rs | 12 +- tests/bindings.rs | 6 +- tests/componentize.rs | 6 +- wit/deps/{cli => cli-0.2.0}/command.wit | 0 wit/deps/{cli => cli-0.2.0}/environment.wit | 0 wit/deps/{cli => cli-0.2.0}/exit.wit | 0 wit/deps/{cli => cli-0.2.0}/imports.wit | 0 wit/deps/{cli => cli-0.2.0}/run.wit | 0 wit/deps/{cli => cli-0.2.0}/stdio.wit | 0 wit/deps/{cli => cli-0.2.0}/terminal.wit | 0 wit/deps/cli-0.3.0-rc-2026-01-06.wit | 256 ------ wit/deps/cli-0.3.0-rc-2026-03-15.wit | 256 ------ .../cli.wit} | 156 ++-- wit/deps/cli-0.3.0/deps/clocks.wit | 43 + wit/deps/cli-0.3.0/deps/filesystem.wit | 149 ++++ wit/deps/cli-0.3.0/deps/random.wit | 18 + wit/deps/cli-0.3.0/deps/sockets.wit | 116 +++ .../monotonic-clock.wit | 0 .../{clocks => clocks-0.2.0}/wall-clock.wit | 0 wit/deps/{clocks => clocks-0.2.0}/world.wit | 0 wit/deps/clocks-0.3.0-rc-2026-01-06.wit | 161 ---- wit/deps/clocks-0.3.0-rc-2026-03-15.wit | 161 ---- .../clocks.wit} | 34 +- .../preopens.wit | 0 .../types.wit | 0 .../world.wit | 0 wit/deps/filesystem-0.3.0-rc-2026-01-06.wit | 553 ------------- wit/deps/filesystem-0.3.0-rc-2026-02-09.wit | 566 ------------- wit/deps/filesystem-0.3.0/deps/clocks.wit | 19 + .../filesystem.wit} | 104 +-- wit/deps/{http => http-0.2.0}/handler.wit | 0 wit/deps/{http => http-0.2.0}/proxy.wit | 0 wit/deps/{http => http-0.2.0}/types.wit | 0 wit/deps/http-0.3.0-rc-2026-01-06.wit | 457 ----------- wit/deps/http-0.3.0-rc-2026-02-09.wit | 479 ----------- wit/deps/http-0.3.0/deps/cli.wit | 28 + wit/deps/http-0.3.0/deps/clocks.wit | 43 + wit/deps/http-0.3.0/deps/random.wit | 18 + .../http.wit} | 92 +-- wit/deps/{io => io-0.2.0}/error.wit | 0 wit/deps/{io => io-0.2.0}/poll.wit | 0 wit/deps/{io => io-0.2.0}/streams.wit | 0 wit/deps/{io => io-0.2.0}/world.wit | 0 .../insecure-seed.wit | 0 .../{random => random-0.2.0}/insecure.wit | 0 wit/deps/{random => random-0.2.0}/random.wit | 0 wit/deps/{random => random-0.2.0}/world.wit | 0 wit/deps/random-0.3.0-rc-2026-01-06.wit | 92 --- wit/deps/random-0.3.0-rc-2026-02-09.wit | 92 --- .../random.wit} | 26 +- .../instance-network.wit | 0 .../ip-name-lookup.wit | 0 .../{sockets => sockets-0.2.0}/network.wit | 0 .../tcp-create-socket.wit | 0 wit/deps/{sockets => sockets-0.2.0}/tcp.wit | 0 .../udp-create-socket.wit | 0 wit/deps/{sockets => sockets-0.2.0}/udp.wit | 0 wit/deps/{sockets => sockets-0.2.0}/world.wit | 0 wit/deps/sockets-0.3.0-rc-2026-01-06.wit | 752 ----------------- wit/deps/sockets-0.3.0-rc-2026-02-09.wit | 758 ------------------ wit/deps/sockets-0.3.0/deps/clocks.wit | 6 + .../sockets.wit} | 128 +-- 76 files changed, 963 insertions(+), 5159 deletions(-) rename wit/deps/{cli => cli-0.2.0}/command.wit (100%) rename wit/deps/{cli => cli-0.2.0}/environment.wit (100%) rename wit/deps/{cli => cli-0.2.0}/exit.wit (100%) rename wit/deps/{cli => cli-0.2.0}/imports.wit (100%) rename wit/deps/{cli => cli-0.2.0}/run.wit (100%) rename wit/deps/{cli => cli-0.2.0}/stdio.wit (100%) rename wit/deps/{cli => cli-0.2.0}/terminal.wit (100%) delete mode 100644 wit/deps/cli-0.3.0-rc-2026-01-06.wit delete mode 100644 wit/deps/cli-0.3.0-rc-2026-03-15.wit rename wit/deps/{cli-0.3.0-rc-2026-02-09.wit => cli-0.3.0/cli.wit} (62%) create mode 100644 wit/deps/cli-0.3.0/deps/clocks.wit create mode 100644 wit/deps/cli-0.3.0/deps/filesystem.wit create mode 100644 wit/deps/cli-0.3.0/deps/random.wit create mode 100644 wit/deps/cli-0.3.0/deps/sockets.wit rename wit/deps/{clocks => clocks-0.2.0}/monotonic-clock.wit (100%) rename wit/deps/{clocks => clocks-0.2.0}/wall-clock.wit (100%) rename wit/deps/{clocks => clocks-0.2.0}/world.wit (100%) delete mode 100644 wit/deps/clocks-0.3.0-rc-2026-01-06.wit delete mode 100644 wit/deps/clocks-0.3.0-rc-2026-03-15.wit rename wit/deps/{clocks-0.3.0-rc-2026-02-09.wit => clocks-0.3.0/clocks.wit} (89%) rename wit/deps/{filesystem => filesystem-0.2.0}/preopens.wit (100%) rename wit/deps/{filesystem => filesystem-0.2.0}/types.wit (100%) rename wit/deps/{filesystem => filesystem-0.2.0}/world.wit (100%) delete mode 100644 wit/deps/filesystem-0.3.0-rc-2026-01-06.wit delete mode 100644 wit/deps/filesystem-0.3.0-rc-2026-02-09.wit create mode 100644 wit/deps/filesystem-0.3.0/deps/clocks.wit rename wit/deps/{filesystem-0.3.0-rc-2026-03-15.wit => filesystem-0.3.0/filesystem.wit} (91%) rename wit/deps/{http => http-0.2.0}/handler.wit (100%) rename wit/deps/{http => http-0.2.0}/proxy.wit (100%) rename wit/deps/{http => http-0.2.0}/types.wit (100%) delete mode 100644 wit/deps/http-0.3.0-rc-2026-01-06.wit delete mode 100644 wit/deps/http-0.3.0-rc-2026-02-09.wit create mode 100644 wit/deps/http-0.3.0/deps/cli.wit create mode 100644 wit/deps/http-0.3.0/deps/clocks.wit create mode 100644 wit/deps/http-0.3.0/deps/random.wit rename wit/deps/{http-0.3.0-rc-2026-03-15.wit => http-0.3.0/http.wit} (91%) rename wit/deps/{io => io-0.2.0}/error.wit (100%) rename wit/deps/{io => io-0.2.0}/poll.wit (100%) rename wit/deps/{io => io-0.2.0}/streams.wit (100%) rename wit/deps/{io => io-0.2.0}/world.wit (100%) rename wit/deps/{random => random-0.2.0}/insecure-seed.wit (100%) rename wit/deps/{random => random-0.2.0}/insecure.wit (100%) rename wit/deps/{random => random-0.2.0}/random.wit (100%) rename wit/deps/{random => random-0.2.0}/world.wit (100%) delete mode 100644 wit/deps/random-0.3.0-rc-2026-01-06.wit delete mode 100644 wit/deps/random-0.3.0-rc-2026-02-09.wit rename wit/deps/{random-0.3.0-rc-2026-03-15.wit => random-0.3.0/random.wit} (88%) rename wit/deps/{sockets => sockets-0.2.0}/instance-network.wit (100%) rename wit/deps/{sockets => sockets-0.2.0}/ip-name-lookup.wit (100%) rename wit/deps/{sockets => sockets-0.2.0}/network.wit (100%) rename wit/deps/{sockets => sockets-0.2.0}/tcp-create-socket.wit (100%) rename wit/deps/{sockets => sockets-0.2.0}/tcp.wit (100%) rename wit/deps/{sockets => sockets-0.2.0}/udp-create-socket.wit (100%) rename wit/deps/{sockets => sockets-0.2.0}/udp.wit (100%) rename wit/deps/{sockets => sockets-0.2.0}/world.wit (100%) delete mode 100644 wit/deps/sockets-0.3.0-rc-2026-01-06.wit delete mode 100644 wit/deps/sockets-0.3.0-rc-2026-02-09.wit create mode 100644 wit/deps/sockets-0.3.0/deps/clocks.wit rename wit/deps/{sockets-0.3.0-rc-2026-03-15.wit => sockets-0.3.0/sockets.wit} (93%) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2c2d083b..6ba75eae 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -116,7 +116,7 @@ jobs: - uses: taiki-e/install-action@v2 with: - tool: wasmtime-cli@43.0.0 + tool: wasmtime-cli@46.0.1 - uses: actions/setup-python@v5 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 24894c62..fdb62edb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,13 +74,13 @@ Be sure to run `git diff` and verify everything looks right before proceeding, and make manual edits if necessary. Next, commit your changes and open a PR. Once that PR is merged, tag and sign -the commit using `git tag -s v0.23.0` and push it using e.g. `git push v0.23.0`. +the commit using `git tag -s v0.23.0` and push it using `git push v0.23.0`. Merging the PR to main will also kick off a release build, updating the `canary` release. When that finishes, go to the [canary release page](https://github.com/bytecodealliance/componentize-py/releases/tag/canary) and download the `componentize_py-0.23.0-*.whl` and -`componentize_py-0.23.0.tar.gz` file, move them into a newly-created `dist` +`componentize_py-0.23.0.tar.gz` files, move them into a newly-created `dist` directory, and run the following: ```shell diff --git a/Cargo.lock b/Cargo.lock index 732c56d6..4a9442c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -307,7 +307,7 @@ checksum = "20a158160765c6a7d0d8c072a53d772e4cb243f38b04bfcf6b4939cfbe7482e7" dependencies = [ "cap-primitives", "cap-std", - "rustix 1.1.4", + "rustix", "smallvec", ] @@ -323,22 +323,12 @@ dependencies = [ "io-lifetimes", "ipnet", "maybe-owned", - "rustix 1.1.4", + "rustix", "rustix-linux-procfs", "windows-sys 0.59.0", "winx", ] -[[package]] -name = "cap-rand" -version = "3.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8144c22e24bbcf26ade86cb6501a0916c46b7e4787abdb0045a467eb1645a1d" -dependencies = [ - "ambient-authority", - "rand 0.8.6", -] - [[package]] name = "cap-std" version = "3.4.5" @@ -348,7 +338,7 @@ dependencies = [ "cap-primitives", "io-extras", "io-lifetimes", - "rustix 1.1.4", + "rustix", ] [[package]] @@ -361,7 +351,7 @@ dependencies = [ "cap-primitives", "iana-time-zone", "once_cell", - "rustix 1.1.4", + "rustix", "winx", ] @@ -389,6 +379,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] + [[package]] name = "clap" version = "4.6.1" @@ -460,7 +461,7 @@ dependencies = [ [[package]] name = "componentize-py" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "assert_cmd", @@ -503,7 +504,7 @@ dependencies = [ [[package]] name = "componentize-py-runtime" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "num-bigint", @@ -515,7 +516,7 @@ dependencies = [ [[package]] name = "componentize-py-test-generator" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "getrandom 0.2.17", @@ -567,29 +568,38 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "cranelift-assembler-x64" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc822414b18d1f5b1b33ce1441534e311e62fef86ebb5b9d382af857d0272c9" +checksum = "e06aeba2c965fc446d13c56a6ccb2631b78445d7544543dd9a25289977630914" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c646808b06f4532478d8d6057d74f15c3322f10d995d9486e7dcea405bf521a" +checksum = "ee2d2dde4ec1352715595b5cfa6fe2e5b8ebb9da3457b3ee8db0aa2808c069aa" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5996f01a686b2349cdb379083ec5ad3e8cb8767fb2d495d3a4f2ee4163a18d" +checksum = "03b4982ef9fa54ec9eee841e891e7ddc5434be1250e88de31572e000c888f30b" dependencies = [ "cranelift-entity", "wasmtime-internal-core", @@ -597,9 +607,9 @@ dependencies = [ [[package]] name = "cranelift-bitset" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523fea83273f6a985520f57788809a4de2165794d9ab00fb1254fceb4f5aa00c" +checksum = "529143118c4eeb58c39ecb02319557d512be6c61348486422974ab8e3906b8a8" dependencies = [ "serde", "serde_derive", @@ -608,9 +618,9 @@ dependencies = [ [[package]] name = "cranelift-codegen" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d73d1e372730b5f64ed1a2bd9f01fe4686c8ec14a28034e3084e530c8d951878" +checksum = "b7780677247ad3577e3a6a3ebf43f39b325a11d6393db72b2c9968a910d4d13d" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -622,13 +632,16 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli", - "hashbrown 0.16.1", + "hashbrown 0.17.1", "libm", "log", + "postcard", "pulley-interpreter", "regalloc2", "rustc-hash", "serde", + "serde_derive", + "sha2", "smallvec", "target-lexicon", "wasmtime-internal-core", @@ -636,9 +649,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0319c18165e93dc1ebf78946a8da0b1c341c95b4a39729a69574671639bdb5f" +checksum = "ac9645250416cbf92454fe61160e17e026e0ce405906a54500b114f923ddffc9" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -649,24 +662,24 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9195cd8aeecb55e401aa96b2eaa55921636e8246c127ed7908f7ef7e0d40f270" +checksum = "20ee8d222ff0fd3681791979afbf88586ac9f49010d3db96b3cbe4c96759aee3" [[package]] name = "cranelift-control" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8976c2154b74136322befc74222ab5c7249edd7e2604f8cbef2b94975541ffb9" +checksum = "591abe6f5312bd2c4220f1b3bead56c2ad00257c52668015ba013b85dcf2a17a" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6038b3147c7982f4951150d5f96c7c06c1e7214b99d4b4a98607aadf8ded89d1" +checksum = "a5300c49cf940526fe771517b3b3eabd5d0ff164ee61698579cf403fe8d3af3c" dependencies = [ "cranelift-bitset", "serde", @@ -676,11 +689,12 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbd294abe236e23cc3d907b0936226b6a8342db7636daa9c7c72be1e323420e" +checksum = "da4adbf760207fdbbe130f1191cce01cdef66831a9f648b1f39ff2800d126d45" dependencies = [ "cranelift-codegen", + "hashbrown 0.17.1", "log", "smallvec", "target-lexicon", @@ -688,15 +702,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a90b6ed3aba84189352a87badeb93b2126d3724225a42dc67fdce53d1b139c" +checksum = "8315b21ff018226a42a60a4702c2dd75f6447cac26e9bca622e14c22088c2ff5" [[package]] name = "cranelift-native" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ec0cc1a54e22925eacf4fc3dc815f907734d3b377899d19d52bec04863e853" +checksum = "d506ef23a60715bde451b06620b14402166ded3b648454fccbf04f3e46a4aa70" dependencies = [ "cranelift-codegen", "libc", @@ -705,9 +719,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.130.2" +version = "0.133.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "948865622f87f30907bb46fbb081b235ae63c1896a99a83c26a003305c1fa82d" +checksum = "48ed47e602652e3410f9387fc0db70fefadcee4d78a78881421aabcab4e26b89" [[package]] name = "crc32fast" @@ -872,17 +886,6 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" -[[package]] -name = "fd-lock" -version = "4.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" -dependencies = [ - "cfg-if", - "rustix 1.1.4", - "windows-sys 0.59.0", -] - [[package]] name = "filetime" version = "0.2.29" @@ -958,7 +961,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" dependencies = [ "io-lifetimes", - "rustix 1.1.4", + "rustix", "windows-sys 0.59.0", ] @@ -1116,6 +1119,7 @@ dependencies = [ "cfg-if", "libc", "r-efi 6.0.0", + "rand_core 0.10.1", "wasip2", "wasip3", ] @@ -1158,6 +1162,11 @@ name = "hashbrown" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash 0.2.0", + "serde", + "serde_core", +] [[package]] name = "heck" @@ -1568,12 +1577,6 @@ dependencies = [ "libc", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -1600,12 +1603,9 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "mach2" -version = "0.4.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" -dependencies = [ - "libc", -] +checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" [[package]] name = "maybe-owned" @@ -1625,7 +1625,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad38eb12aea514a0466ea40a80fd8cc83637065948eb4a426e4aa46261175227" dependencies = [ - "rustix 1.1.4", + "rustix", ] [[package]] @@ -1685,12 +1685,12 @@ dependencies = [ [[package]] name = "object" -version = "0.38.1" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271638cd5fa9cca89c4c304675ca658efc4e64a66c716b7cfe1afb4b9611dbbc" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" dependencies = [ "crc32fast", - "hashbrown 0.16.1", + "hashbrown 0.17.1", "indexmap", "memchr", ] @@ -1841,7 +1841,7 @@ dependencies = [ "bitflags", "num-traits", "rand 0.9.4", - "rand_chacha 0.9.0", + "rand_chacha", "rand_xorshift", "regex-syntax", "rusty-fork", @@ -1851,9 +1851,9 @@ dependencies = [ [[package]] name = "pulley-interpreter" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ec12fe19a9588315a49fe5704502a9c02d6a198303314b0c7c86123b06d29e5" +checksum = "38b92604caae1a1899b6a5b54967289dd538177c626004c91accf9d0ec7e4a12" dependencies = [ "cranelift-bitset", "log", @@ -1863,9 +1863,9 @@ dependencies = [ [[package]] name = "pulley-macros" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f7d5ef31ebf1b46cd7e722ffef934e670d7e462f49aa01cde07b9b76dca580" +checksum = "5a7ac85c0bb3fb351f10d531230aaa5e366b46d7c4e5328e5f02801d6dac1165" dependencies = [ "proc-macro2", "quote", @@ -2014,35 +2014,25 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" -[[package]] -name = "rand" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - [[package]] name = "rand" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" dependencies = [ - "rand_chacha 0.9.0", + "rand_chacha", "rand_core 0.9.5", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "rand" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.1", ] [[package]] @@ -2060,9 +2050,6 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] [[package]] name = "rand_core" @@ -2073,6 +2060,12 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "rand_xorshift" version = "0.4.0" @@ -2133,6 +2126,7 @@ dependencies = [ "hashbrown 0.17.1", "log", "rustc-hash", + "serde", "smallvec", ] @@ -2231,19 +2225,6 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - [[package]] name = "rustix" version = "1.1.4" @@ -2253,7 +2234,7 @@ dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys 0.12.1", + "linux-raw-sys", "windows-sys 0.61.2", ] @@ -2264,7 +2245,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" dependencies = [ "once_cell", - "rustix 1.1.4", + "rustix", ] [[package]] @@ -2409,19 +2390,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - [[package]] name = "sha2" version = "0.10.9" @@ -2429,7 +2397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -2538,22 +2506,6 @@ dependencies = [ "syn", ] -[[package]] -name = "system-interface" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4592f674ce18521c2a81483873a49596655b179f71c5e05d10c1fe66c78745" -dependencies = [ - "bitflags", - "cap-fs-ext", - "cap-std", - "fd-lock", - "io-lifetimes", - "rustix 0.38.44", - "windows-sys 0.59.0", - "winx", -] - [[package]] name = "tar" version = "0.4.46" @@ -2580,7 +2532,7 @@ dependencies = [ "fastrand", "getrandom 0.4.2", "once_cell", - "rustix 1.1.4", + "rustix", "windows-sys 0.61.2", ] @@ -2916,12 +2868,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - [[package]] name = "untrusted" version = "0.9.0" @@ -3067,22 +3013,18 @@ dependencies = [ [[package]] name = "wasm-compose" -version = "0.245.1" +version = "0.251.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd23d12cc95c451c1306db5bc63075fbebb612bb70c53b4237b1ce5bc178343" +checksum = "b089037d7eb453ed57b560fe7833de0707411c8b9fdc429745ced77e2a1bacb9" dependencies = [ "anyhow", "heck", - "im-rc", "indexmap", "log", "petgraph", - "serde", - "serde_derive", - "serde_yaml", "smallvec", - "wasm-encoder 0.245.1", - "wasmparser 0.245.1", + "wasm-encoder 0.251.0", + "wasmparser 0.251.0", "wat", ] @@ -3106,6 +3048,16 @@ dependencies = [ "wasmparser 0.245.1", ] +[[package]] +name = "wasm-encoder" +version = "0.251.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a879a421bd17c528b74721b2abf4c62e8f1d1889c2ba8c3c50d02deaf2ce395" +dependencies = [ + "leb128fmt", + "wasmparser 0.251.0", +] + [[package]] name = "wasm-encoder" version = "0.252.0" @@ -3173,6 +3125,19 @@ dependencies = [ "serde", ] +[[package]] +name = "wasmparser" +version = "0.251.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "437970b35b1a85cfde9c74b2398352d8d653f3bd8e3a3db0c063ea8f5b4b36ff" +dependencies = [ + "bitflags", + "hashbrown 0.17.1", + "indexmap", + "semver", + "serde", +] + [[package]] name = "wasmparser" version = "0.252.0" @@ -3186,20 +3151,20 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.245.1" +version = "0.251.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41517a3716fbb8ccf46daa9c1325f760fcbff5168e75c7392288e410b91ac8" +checksum = "8798c1a699bd25648b6708eefe94d97c6f9891febb94b42cca1f7a4b086ea64e" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.245.1", + "wasmparser 0.251.0", ] [[package]] name = "wasmtime" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb1ed5899dde98357cfdcf647a4614498798719793898245b4b34e663addabf" +checksum = "c4213d2f019a5e44aa8a61d8826dd33a505bff79f749b14a8bafd67321cb9351" dependencies = [ "addr2line", "async-trait", @@ -3222,7 +3187,7 @@ dependencies = [ "postcard", "pulley-interpreter", "rayon", - "rustix 1.1.4", + "rustix", "semver", "serde", "serde_derive", @@ -3231,8 +3196,8 @@ dependencies = [ "target-lexicon", "tempfile", "wasm-compose", - "wasm-encoder 0.245.1", - "wasmparser 0.245.1", + "wasm-encoder 0.251.0", + "wasmparser 0.251.0", "wasmtime-environ", "wasmtime-internal-cache", "wasmtime-internal-component-macro", @@ -3244,16 +3209,16 @@ dependencies = [ "wasmtime-internal-jit-icache-coherence", "wasmtime-internal-unwinder", "wasmtime-internal-versioned-export-macros", - "wasmtime-internal-winch", "wat", "windows-sys 0.61.2", + "wit-parser 0.251.0", ] [[package]] name = "wasmtime-environ" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4172382dcc785c31d0e862c6780a18f5dd437914d22c4691351f965ef751c821" +checksum = "d45863de41977ec6453e859cf843d456fa3fcb45a659b66d16e794f90ec4f5b7" dependencies = [ "anyhow", "cpp_demangle", @@ -3261,7 +3226,7 @@ dependencies = [ "cranelift-bitset", "cranelift-entity", "gimli", - "hashbrown 0.16.1", + "hashbrown 0.17.1", "indexmap", "log", "object", @@ -3273,8 +3238,8 @@ dependencies = [ "sha2", "smallvec", "target-lexicon", - "wasm-encoder 0.245.1", - "wasmparser 0.245.1", + "wasm-encoder 0.251.0", + "wasmparser 0.251.0", "wasmprinter", "wasmtime-internal-component-util", "wasmtime-internal-core", @@ -3282,15 +3247,15 @@ dependencies = [ [[package]] name = "wasmtime-internal-cache" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ed398988226d7aa0505ac6bb576e09532ad722d702ec4e66365d78ed695c95f" +checksum = "438bc7dc45fb75297d75f79a9a0ce852345d13ebc6a6863f6f688f013836a9dd" dependencies = [ "base64", "directories-next", "log", "postcard", - "rustix 1.1.4", + "rustix", "serde", "serde_derive", "sha2", @@ -3302,9 +3267,9 @@ dependencies = [ [[package]] name = "wasmtime-internal-component-macro" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae5ec9fff073ff13b81732d56a9515d761c245750bcda09093827f84130ebc25" +checksum = "f1e48f8d4966d62a10b6d70722bc432c1e163890be2801d3b5784589ad36ffc3" dependencies = [ "anyhow", "proc-macro2", @@ -3312,32 +3277,32 @@ dependencies = [ "syn", "wasmtime-internal-component-util", "wasmtime-internal-wit-bindgen", - "wit-parser 0.245.1", + "wit-parser 0.251.0", ] [[package]] name = "wasmtime-internal-component-util" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "935d9ab293ba27d1ec9aa7bc1b3a43993dbe961af2a8f23f90a11e1331b4c13f" +checksum = "819ad5abd5822a22dbf4014475cdfd1fe790707761cd732d74aaa3ba4d5ba489" [[package]] name = "wasmtime-internal-core" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3820b174f477d2a7083209d1ad5353fcdb11eaea434b2137b8681029460dd3" +checksum = "3fc28372e36eaf8cf70faa83b5779137f7e99c8d18569a125d1580e735cc9e4d" dependencies = [ "anyhow", - "hashbrown 0.16.1", + "hashbrown 0.17.1", "libm", "serde", ] [[package]] name = "wasmtime-internal-cranelift" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1679d205caf9766c6aa309d45bb3e7c634d7725e3164404df33824b9f7c4fb7" +checksum = "a433efc6e35112a5457e1dc8bc4d8d39820ac7722267e89bc04e5df641f32124" dependencies = [ "cfg-if", "cranelift-codegen", @@ -3353,7 +3318,7 @@ dependencies = [ "smallvec", "target-lexicon", "thiserror 2.0.18", - "wasmparser 0.245.1", + "wasmparser 0.251.0", "wasmtime-environ", "wasmtime-internal-core", "wasmtime-internal-unwinder", @@ -3362,14 +3327,14 @@ dependencies = [ [[package]] name = "wasmtime-internal-fiber" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e505254058be5b0df458d670ee42d9eafe2349d04c1296e9dc01071dc20a85" +checksum = "18a1d3a39d0d210f6b8574ee96a4315e0a14c67f3a1fc3cd5372cb10d2fb4422" dependencies = [ "cc", "cfg-if", "libc", - "rustix 1.1.4", + "rustix", "wasmtime-environ", "wasmtime-internal-versioned-export-macros", "windows-sys 0.61.2", @@ -3377,21 +3342,21 @@ dependencies = [ [[package]] name = "wasmtime-internal-jit-debug" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c2e05b345f1773e59c20e6ad7298fd6857cdea245023d88bb659c96d8f0ea72" +checksum = "9f667288cb4dfa68a4639ffac4d5628535dda64ebdc2b990526efb12b30ba803" dependencies = [ "cc", "object", - "rustix 1.1.4", + "rustix", "wasmtime-internal-versioned-export-macros", ] [[package]] name = "wasmtime-internal-jit-icache-coherence" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b86701b234a4643e3f111869aa792b3a05a06e02d486ee9cb6c04dae16b52dab" +checksum = "eba651d44ab0faad4c58106b3adb45068189fb65ef50f0c404b6d9e3bf81a357" dependencies = [ "cfg-if", "libc", @@ -3401,9 +3366,9 @@ dependencies = [ [[package]] name = "wasmtime-internal-unwinder" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63558d801beb83dde9b336eb4ae049019aee26627926edb32cd119d7e4c83cd" +checksum = "2ecc52563b0558af2a7487eb710de07cc4532564b55528876129238e83118cb1" dependencies = [ "cfg-if", "cranelift-codegen", @@ -3414,65 +3379,47 @@ dependencies = [ [[package]] name = "wasmtime-internal-versioned-export-macros" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "737c4d956fc3a848541a064afb683dd2771132a6b125be5baaf95c4379aa47df" +checksum = "e747f4a074699ba1b4e4d841fb263f9b7df5bd1555181c4752bf5990d21ba676" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "wasmtime-internal-winch" -version = "43.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f599b79545e3bba0b7913406055ebede5bb0dabee9ba2015ef25a9f4c9f47807" -dependencies = [ - "cranelift-codegen", - "gimli", - "log", - "object", - "target-lexicon", - "wasmparser 0.245.1", - "wasmtime-environ", - "wasmtime-internal-cranelift", - "winch-codegen", -] - [[package]] name = "wasmtime-internal-wit-bindgen" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2192a77a00b9a67800c2b4e1c70fb6abca79d6b529e53a2ef9dcdcc36090330d" +checksum = "80009f46991622814196d96fac6fc0a938f46b5cba737a8f4e21e24e5a03856f" dependencies = [ "anyhow", "bitflags", "heck", "indexmap", - "wit-parser 0.245.1", + "wit-parser 0.251.0", ] [[package]] name = "wasmtime-wasi" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c7daf53ba2f64aa089f47d9a54bec654a45b7b1b55660efecfb09a2e6cfbcf" +checksum = "e9f65ef30a2c5478873cdb619085a7a649d3ce41cc3eaf298a7ce3dee96a8e11" dependencies = [ "async-trait", "bitflags", "bytes", "cap-fs-ext", "cap-net-ext", - "cap-rand", "cap-std", "cap-time-ext", - "fs-set-times", + "cfg-if", "futures", "io-extras", "io-lifetimes", - "rustix 1.1.4", - "system-interface", + "rand 0.10.2", + "rustix", "thiserror 2.0.18", "tokio", "tracing", @@ -3485,9 +3432,9 @@ dependencies = [ [[package]] name = "wasmtime-wasi-io" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2c9c6cd3daf62a4fb75ac4742c976fee1939686ffe461a366ce6446c58a58a0" +checksum = "cee57d5fef4976b1ab542615f4cef2c43278eb549d8078939668ea0f13d5c696" dependencies = [ "async-trait", "bytes", @@ -3558,9 +3505,9 @@ dependencies = [ [[package]] name = "wiggle" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8cfd3db2f05619c6f36f257d84327c11546e28d61e3a1c1220aaad553bc4b0" +checksum = "e03df88bf1a6068b02851aa3ef9427d285118f5c1c153b068a8995c69dd9562a" dependencies = [ "bitflags", "thiserror 2.0.18", @@ -3572,9 +3519,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd7a197903e5b4ff5e13aef9c891960d71e92073600ecf4c86c7e795ac1c803" +checksum = "e014aec8661b613154377e4b49dbbb0dfc4f424efcee749782054576c00537d9" dependencies = [ "heck", "proc-macro2", @@ -3586,9 +3533,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "43.0.2" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6410b86fcec207070d9372b215d3470bad67215e6bbac46981a16999c4abbc28" +checksum = "f67310a8ae5190b7f3dcacf8697f2890701a3a8427b3e77ed91d3632dcedaceb" dependencies = [ "proc-macro2", "quote", @@ -3627,25 +3574,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "winch-codegen" -version = "43.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52dbb0cf07b0dfe7b7a1ca8efb8f94ba98bd0fb144c411ea1665c78f0449e958" -dependencies = [ - "cranelift-assembler-x64", - "cranelift-codegen", - "gimli", - "regalloc2", - "smallvec", - "target-lexicon", - "thiserror 2.0.18", - "wasmparser 0.245.1", - "wasmtime-environ", - "wasmtime-internal-core", - "wasmtime-internal-cranelift", -] - [[package]] name = "windows-core" version = "0.62.2" @@ -4106,6 +4034,25 @@ dependencies = [ "wasmparser 0.245.1", ] +[[package]] +name = "wit-parser" +version = "0.251.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e960732e824fab95099971a09e638979347c94ca48568d3c854c945729196947" +dependencies = [ + "anyhow", + "hashbrown 0.17.1", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.251.0", +] + [[package]] name = "witx" version = "0.9.1" @@ -4131,7 +4078,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" dependencies = [ "libc", - "rustix 1.1.4", + "rustix", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9224ba92..f4a96d67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,8 +28,8 @@ pyo3 = { version = "0.28.3", features = [ "abi3-py39", "extension-module", ], optional = true } -wasmtime = "43.0.0" -wasmtime-wasi = { version = "43.0.0", features = [ "p3" ] } +wasmtime = "46.0.1" +wasmtime-wasi = { version = "46.0.1", features = [ "p3" ] } once_cell = "1.20.2" component-init-transform = "0.2.0" async-trait = "0.1.83" @@ -79,13 +79,13 @@ reqwest = { version = "0.12.15", default-features = false, features = [ ] } tar = "0.4.41" zstd = "0.13.2" -componentize-py-test-generator = { path = "test-generator", version = "0.24.0" } +componentize-py-test-generator = { path = "test-generator", version = "0.25.0" } flate2 = "1.1.1" wasmparser = "0.245.0" wasm-encoder = "0.245.0" [workspace] -package.version = "0.24.0" +package.version = "0.25.0" package.edition = "2024" package.license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" package.repository = "https://github.com/bytecodealliance/componentize-py" diff --git a/build.rs b/build.rs index ec07afa0..6c6e44ac 100644 --- a/build.rs +++ b/build.rs @@ -592,7 +592,7 @@ fn add_compile_envs(wasi_sdk: &Path, command: &mut Command) { .env("RANLIB", wasi_sdk.join("bin/ranlib")) .env( "CFLAGS", - format!("--target=wasm32-wasi --sysroot={sysroot} -I{sysroot}/include/wasm32-wasip1 -D_WASI_EMULATED_SIGNAL -fPIC"), + format!("--target=wasm32-wasip2 --sysroot={sysroot} -I{sysroot}/include/wasm32-wasip2 -D_WASI_EMULATED_SIGNAL -fPIC"), ) .env( "LDFLAGS", @@ -687,9 +687,9 @@ fn build_sqlite(wasi_sdk: &Path, install_dir: &Path) -> Result<()> { // Note: Don't set SQLITE_THREADSAFE here - let --disable-threadsafe handle it // to avoid macro redefinition warnings let sqlite_cflags = format!( - "--target=wasm32-wasi \ + "--target=wasm32-wasip2 \ --sysroot={sysroot_str} \ - -I{sysroot_str}/include/wasm32-wasip1 \ + -I{sysroot_str}/include/wasm32-wasip2 \ -D_WASI_EMULATED_SIGNAL \ -D_WASI_EMULATED_PROCESS_CLOCKS \ -fPIC \ @@ -713,7 +713,7 @@ fn build_sqlite(wasi_sdk: &Path, install_dir: &Path) -> Result<()> { "LDFLAGS", format!("--target=wasm32-wasip2 --sysroot={sysroot_str} -L{sysroot_str}/lib",), ) - .arg("--host=wasm32-wasi") + .arg("--host=wasm32-wasip2") .arg(format!("--prefix={install_dir_str}")) .arg("--disable-shared") .arg("--enable-static") diff --git a/examples/cli-p3/README.md b/examples/cli-p3/README.md index 80268de4..ef3e136b 100644 --- a/examples/cli-p3/README.md +++ b/examples/cli-p3/README.md @@ -1,32 +1,32 @@ # Example: `cli-p3` This is an example of how to use [componentize-py] and [Wasmtime] to build and -run a Python-based component targetting version `0.3.0-rc-2026-03-15` of the -[wasi-cli] `command` world. +run a Python-based component targetting version `0.3.0` of the [wasi-cli] +`command` world. [componentize-py]: https://github.com/bytecodealliance/componentize-py [Wasmtime]: https://github.com/bytecodealliance/wasmtime -[wasi-cli]: https://github.com/WebAssembly/WASI/tree/v0.3.0-rc-2026-03-15/proposals/cli/wit-0.3.0-draft +[wasi-cli]: https://github.com/WebAssembly/WASI/tree/v0.3.0/proposals/cli/wit ## Prerequisites -* `Wasmtime` 43.0.0 -* `componentize-py` 0.24.0 +* `Wasmtime` 46.0.0 +* `componentize-py` 0.25.0 Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If you don't have `cargo`, you can download and install from -https://github.com/bytecodealliance/wasmtime/releases/tag/v43.0.0. +https://github.com/bytecodealliance/wasmtime/releases/tag/v46.0.0. ``` -cargo install --version 43.0.0 wasmtime-cli -pip install componentize-py==0.24.0 +cargo install --version 46.0.0 wasmtime-cli +pip install componentize-py==0.25.0 ``` ## Running the demo ``` -componentize-py -d ../../wit -w wasi:cli/command@0.3.0-rc-2026-03-15 componentize app -o cli.wasm -wasmtime run -Sp3 -Wcomponent-model-async cli.wasm +componentize-py -d ../../wit -w wasi:cli/command@0.3.0 componentize app -o cli.wasm +wasmtime run cli.wasm ``` The `wasmtime run` command above should print "Hello, world!". diff --git a/examples/cli/README.md b/examples/cli/README.md index e3e1861e..94ae6995 100644 --- a/examples/cli/README.md +++ b/examples/cli/README.md @@ -10,7 +10,7 @@ run a Python-based component targetting the [wasi-cli] `command` world. ## Prerequisites * `Wasmtime` 38.0.0 or later -* `componentize-py` 0.24.0 +* `componentize-py` 0.25.0 Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If you don't have `cargo`, you can download and install from @@ -18,7 +18,7 @@ https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0. ``` cargo install --version 38.0.0 wasmtime-cli -pip install componentize-py==0.24.0 +pip install componentize-py==0.25.0 ``` ## Running the demo diff --git a/examples/http-p3/README.md b/examples/http-p3/README.md index ea4a5fdf..e876d22b 100644 --- a/examples/http-p3/README.md +++ b/examples/http-p3/README.md @@ -1,25 +1,25 @@ # Example: `http-p3` This is an example of how to use [componentize-py] and [Wasmtime] to build and -run a Python-based component targetting version `0.3.0-rc-2026-03-15` of the -[wasi-http] `service` world. +run a Python-based component targetting version `0.3.0` of the [wasi-http] +`service` world. [componentize-py]: https://github.com/bytecodealliance/componentize-py [Wasmtime]: https://github.com/bytecodealliance/wasmtime -[wasi-http]: https://github.com/WebAssembly/wasi-http +[wasi-http]: https://github.com/WebAssembly/WASI/tree/v0.3.0/proposals/http/wit ## Prerequisites -* `Wasmtime` 43.0.0 -* `componentize-py` 0.24.0 +* `Wasmtime` 46.0.0 +* `componentize-py` 0.25.0 Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If you don't have `cargo`, you can download and install from -https://github.com/bytecodealliance/wasmtime/releases/tag/v43.0.0. +https://github.com/bytecodealliance/wasmtime/releases/tag/v46.0.0. ``` -cargo install --version 43.0.0 wasmtime-cli -pip install componentize-py==0.24.0 +cargo install --version 46.0.0 wasmtime-cli +pip install componentize-py==0.25.0 ``` ## Running the demo @@ -27,8 +27,8 @@ pip install componentize-py==0.24.0 First, build the app and run it: ``` -componentize-py -d ../../wit -w wasi:http/service@0.3.0-rc-2026-03-15 componentize app -o http.wasm -wasmtime serve -Sp3,common -Wcomponent-model-async http.wasm +componentize-py -d ../../wit -w wasi:http/service@0.3.0 componentize app -o http.wasm +wasmtime serve -Scommon http.wasm ``` Then, in another terminal, use cURL to send a request to the app: diff --git a/examples/http/README.md b/examples/http/README.md index 85854055..e5f411af 100644 --- a/examples/http/README.md +++ b/examples/http/README.md @@ -10,7 +10,7 @@ run a Python-based component targetting the [wasi-http] `proxy` world. ## Prerequisites * `Wasmtime` 38.0.0 or later -* `componentize-py` 0.24.0 +* `componentize-py` 0.25.0 Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If you don't have `cargo`, you can download and install from @@ -18,7 +18,7 @@ https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0. ``` cargo install --version 38.0.0 wasmtime-cli -pip install componentize-py==0.24.0 +pip install componentize-py==0.25.0 ``` ## Running the demo diff --git a/examples/matrix-math/README.md b/examples/matrix-math/README.md index d822f1e4..ec27e3fc 100644 --- a/examples/matrix-math/README.md +++ b/examples/matrix-math/README.md @@ -11,7 +11,7 @@ within a guest component. ## Prerequisites * `wasmtime` 38.0.0 or later -* `componentize-py` 0.24.0 +* `componentize-py` 0.25.0 * `NumPy`, built for WASI Note that we use an unofficial build of NumPy since the upstream project does @@ -23,7 +23,7 @@ https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0. ``` cargo install --version 38.0.0 wasmtime-cli -pip install componentize-py==0.24.0 +pip install componentize-py==0.25.0 curl -OL https://github.com/dicej/wasi-wheels/releases/download/v0.0.2/numpy-wasi.tar.gz tar xf numpy-wasi.tar.gz ``` diff --git a/examples/sandbox/README.md b/examples/sandbox/README.md index 801c6cae..86e20464 100644 --- a/examples/sandbox/README.md +++ b/examples/sandbox/README.md @@ -12,10 +12,10 @@ versions have a different API for working with components, and this example has not yet been updated to use it. * `wasmtime-py` 38.0.0 -* `componentize-py` 0.24.0 +* `componentize-py` 0.25.0 ``` -pip install componentize-py==0.24.0 wasmtime==38.0.0 +pip install componentize-py==0.25.0 wasmtime==38.0.0 ``` ## Running the demo diff --git a/examples/tcp-p3/README.md b/examples/tcp-p3/README.md index c2d43ed9..06c075a7 100644 --- a/examples/tcp-p3/README.md +++ b/examples/tcp-p3/README.md @@ -12,7 +12,7 @@ run a Python-based component targetting version `0.3.0-rc-2026-03-15` of the ## Prerequisites * `Wasmtime` 43.0.0 -* `componentize-py` 0.24.0 +* `componentize-py` 0.25.0 Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If you don't have `cargo`, you can download and install from @@ -20,7 +20,7 @@ https://github.com/bytecodealliance/wasmtime/releases/tag/v43.0.0. ``` cargo install --version 43.0.0 wasmtime-cli -pip install componentize-py==0.24.0 +pip install componentize-py==0.25.0 ``` ## Running the demo diff --git a/examples/tcp/README.md b/examples/tcp/README.md index 9ae5819e..6f20d601 100644 --- a/examples/tcp/README.md +++ b/examples/tcp/README.md @@ -11,7 +11,7 @@ making an outbound TCP request using `wasi-sockets`. ## Prerequisites * `Wasmtime` 38.0.0 or later -* `componentize-py` 0.24.0 +* `componentize-py` 0.25.0 Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If you don't have `cargo`, you can download and install from @@ -19,7 +19,7 @@ https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0. ``` cargo install --version 38.0.0 wasmtime-cli -pip install componentize-py==0.24.0 +pip install componentize-py==0.25.0 ``` ## Running the demo diff --git a/pyproject.toml b/pyproject.toml index ea57f84d..a5cc4a99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ features = ["pyo3/extension-module"] [project] name = "componentize-py" -version = "0.24.0" +version = "0.25.0" description = "Tool to package Python applications as WebAssembly components" readme = "README.md" license = { file = "LICENSE" } diff --git a/src/test/tests.rs b/src/test/tests.rs index 729182c8..1c61452e 100644 --- a/src/test/tests.rs +++ b/src/test/tests.rs @@ -83,8 +83,8 @@ impl TestsImports for Ctx { } } -impl TestsImportsWithStore for HasSelf { - async fn sleep(_: &Accessor, delay_millis: u32) -> wasmtime::Result<()> { +impl TestsImportsWithStore for HasSelf { + async fn sleep(_: &Accessor, delay_millis: u32) -> wasmtime::Result<()> { tokio::time::sleep(Duration::from_millis(delay_millis as _)).await; Ok(()) } @@ -241,8 +241,8 @@ fn simple_import_and_export() -> Result<()> { fn simple_async_import_and_export() -> Result<()> { impl componentize_py::test::simple_async_import_and_export::Host for Ctx {} - impl componentize_py::test::simple_async_import_and_export::HostWithStore for HasSelf { - async fn foo(_: &Accessor, v: u32) -> wasmtime::Result { + impl componentize_py::test::simple_async_import_and_export::HostWithStore for HasSelf { + async fn foo(_: &Accessor, v: u32) -> wasmtime::Result { tokio::time::sleep(DELAY).await; Ok(v + 2) } @@ -1395,8 +1395,8 @@ fn test_short_reads_host(delay: bool) -> Result<()> { Host, HostHostThing, HostHostThingWithStore, }; - impl HostHostThingWithStore for HasSelf { - async fn get( + impl HostHostThingWithStore for HasSelf { + async fn get( accessor: &Accessor, this: Resource, ) -> wasmtime::Result { diff --git a/tests/bindings.rs b/tests/bindings.rs index 4d39e3c8..fed2a1cc 100644 --- a/tests/bindings.rs +++ b/tests/bindings.rs @@ -39,7 +39,7 @@ fn lint_cli_p3_bindings() -> anyhow::Result<()> { )?; let path = dir.path().join("cli-p3"); - generate_bindings(&path, "wasi:cli/command@0.3.0-rc-2026-03-15")?; + generate_bindings(&path, "wasi:cli/command@0.3.0")?; assert!(predicate::path::is_dir().eval(&path.join("wit_world"))); @@ -91,7 +91,7 @@ fn lint_http_p3_bindings() -> anyhow::Result<()> { )?; let path = dir.path().join("http-p3"); - generate_bindings(&path, "wasi:http/service@0.3.0-rc-2026-03-15")?; + generate_bindings(&path, "wasi:http/service@0.3.0")?; assert!(predicate::path::is_dir().eval(&path.join("wit_world"))); @@ -181,7 +181,7 @@ fn lint_tcp_p3_bindings() -> anyhow::Result<()> { )?; let path = dir.path().join("tcp-p3"); - generate_bindings(&path, "wasi:cli/command@0.3.0-rc-2026-03-15")?; + generate_bindings(&path, "wasi:cli/command@0.3.0")?; assert!(predicate::path::is_dir().eval(&path.join("wit_world"))); diff --git a/tests/componentize.rs b/tests/componentize.rs index 4fb4e963..a1bb1ec1 100644 --- a/tests/componentize.rs +++ b/tests/componentize.rs @@ -20,7 +20,7 @@ fn cli_example() -> anyhow::Result<()> { #[test] fn cli_p3_example() -> anyhow::Result<()> { - test_cli_example("cli-p3", "wasi:cli/command@0.3.0-rc-2026-03-15") + test_cli_example("cli-p3", "wasi:cli/command@0.3.0") } fn test_cli_example(name: &str, world: &str) -> anyhow::Result<()> { @@ -65,7 +65,7 @@ fn http_example() -> anyhow::Result<()> { #[test] fn http_p3_example() -> anyhow::Result<()> { - test_http_example("http-p3", "wasi:http/service@0.3.0-rc-2026-03-15", 8081) + test_http_example("http-p3", "wasi:http/service@0.3.0", 8081) } fn test_http_example(name: &str, world: &str, port: u16) -> anyhow::Result<()> { @@ -247,7 +247,7 @@ fn tcp_example() -> anyhow::Result<()> { #[test] fn tcp_p3_example() -> anyhow::Result<()> { - test_tcp_example("tcp-p3", "wasi:cli/command@0.3.0-rc-2026-03-15") + test_tcp_example("tcp-p3", "wasi:cli/command@0.3.0") } fn test_tcp_example(name: &str, world: &str) -> anyhow::Result<()> { diff --git a/wit/deps/cli/command.wit b/wit/deps/cli-0.2.0/command.wit similarity index 100% rename from wit/deps/cli/command.wit rename to wit/deps/cli-0.2.0/command.wit diff --git a/wit/deps/cli/environment.wit b/wit/deps/cli-0.2.0/environment.wit similarity index 100% rename from wit/deps/cli/environment.wit rename to wit/deps/cli-0.2.0/environment.wit diff --git a/wit/deps/cli/exit.wit b/wit/deps/cli-0.2.0/exit.wit similarity index 100% rename from wit/deps/cli/exit.wit rename to wit/deps/cli-0.2.0/exit.wit diff --git a/wit/deps/cli/imports.wit b/wit/deps/cli-0.2.0/imports.wit similarity index 100% rename from wit/deps/cli/imports.wit rename to wit/deps/cli-0.2.0/imports.wit diff --git a/wit/deps/cli/run.wit b/wit/deps/cli-0.2.0/run.wit similarity index 100% rename from wit/deps/cli/run.wit rename to wit/deps/cli-0.2.0/run.wit diff --git a/wit/deps/cli/stdio.wit b/wit/deps/cli-0.2.0/stdio.wit similarity index 100% rename from wit/deps/cli/stdio.wit rename to wit/deps/cli-0.2.0/stdio.wit diff --git a/wit/deps/cli/terminal.wit b/wit/deps/cli-0.2.0/terminal.wit similarity index 100% rename from wit/deps/cli/terminal.wit rename to wit/deps/cli-0.2.0/terminal.wit diff --git a/wit/deps/cli-0.3.0-rc-2026-01-06.wit b/wit/deps/cli-0.3.0-rc-2026-01-06.wit deleted file mode 100644 index 0f987bf3..00000000 --- a/wit/deps/cli-0.3.0-rc-2026-01-06.wit +++ /dev/null @@ -1,256 +0,0 @@ -package wasi:cli@0.3.0-rc-2026-01-06; - -@since(version = 0.3.0-rc-2026-01-06) -interface environment { - /// Get the POSIX-style environment variables. - /// - /// Each environment variable is provided as a pair of string variable names - /// and string value. - /// - /// Morally, these are a value import, but until value imports are available - /// in the component model, this import function should return the same - /// values each time it is called. - @since(version = 0.3.0-rc-2026-01-06) - get-environment: func() -> list>; - - /// Get the POSIX-style arguments to the program. - @since(version = 0.3.0-rc-2026-01-06) - get-arguments: func() -> list; - - /// Return a path that programs should use as their initial current working - /// directory, interpreting `.` as shorthand for this. - @since(version = 0.3.0-rc-2026-01-06) - get-initial-cwd: func() -> option; -} - -@since(version = 0.3.0-rc-2026-01-06) -interface exit { - /// Exit the current instance and any linked instances. - @since(version = 0.3.0-rc-2026-01-06) - exit: func(status: result); - - /// Exit the current instance and any linked instances, reporting the - /// specified status code to the host. - /// - /// The meaning of the code depends on the context, with 0 usually meaning - /// "success", and other values indicating various types of failure. - /// - /// This function does not return; the effect is analogous to a trap, but - /// without the connotation that something bad has happened. - @unstable(feature = cli-exit-with-code) - exit-with-code: func(status-code: u8); -} - -@since(version = 0.3.0-rc-2026-01-06) -interface run { - /// Run the program. - @since(version = 0.3.0-rc-2026-01-06) - run: async func() -> result; -} - -@since(version = 0.3.0-rc-2026-01-06) -interface types { - @since(version = 0.3.0-rc-2026-01-06) - enum error-code { - /// Input/output error - io, - /// Invalid or incomplete multibyte or wide character - illegal-byte-sequence, - /// Broken pipe - pipe, - } -} - -@since(version = 0.3.0-rc-2026-01-06) -interface stdin { - use types.{error-code}; - - /// Return a stream for reading from stdin. - /// - /// This function returns a stream which provides data read from stdin, - /// and a future to signal read results. - /// - /// If the stream's readable end is dropped the future will resolve to success. - /// - /// If the stream's writable end is dropped the future will either resolve to - /// success if stdin was closed by the writer or to an error-code if reading - /// failed for some other reason. - /// - /// Multiple streams may be active at the same time. The behavior of concurrent - /// reads is implementation-specific. - @since(version = 0.3.0-rc-2026-01-06) - read-via-stream: func() -> tuple, future>>; -} - -@since(version = 0.3.0-rc-2026-01-06) -interface stdout { - use types.{error-code}; - - /// Write the given stream to stdout. - /// - /// If the stream's writable end is dropped this function will either return - /// success once the entire contents of the stream have been written or an - /// error-code representing a failure. - /// - /// Otherwise if there is an error the readable end of the stream will be - /// dropped and this function will return an error-code. - @since(version = 0.3.0-rc-2026-01-06) - write-via-stream: async func(data: stream) -> result<_, error-code>; -} - -@since(version = 0.3.0-rc-2026-01-06) -interface stderr { - use types.{error-code}; - - /// Write the given stream to stderr. - /// - /// If the stream's writable end is dropped this function will either return - /// success once the entire contents of the stream have been written or an - /// error-code representing a failure. - /// - /// Otherwise if there is an error the readable end of the stream will be - /// dropped and this function will return an error-code. - @since(version = 0.3.0-rc-2026-01-06) - write-via-stream: async func(data: stream) -> result<_, error-code>; -} - -/// Terminal input. -/// -/// In the future, this may include functions for disabling echoing, -/// disabling input buffering so that keyboard events are sent through -/// immediately, querying supported features, and so on. -@since(version = 0.3.0-rc-2026-01-06) -interface terminal-input { - /// The input side of a terminal. - @since(version = 0.3.0-rc-2026-01-06) - resource terminal-input; -} - -/// Terminal output. -/// -/// In the future, this may include functions for querying the terminal -/// size, being notified of terminal size changes, querying supported -/// features, and so on. -@since(version = 0.3.0-rc-2026-01-06) -interface terminal-output { - /// The output side of a terminal. - @since(version = 0.3.0-rc-2026-01-06) - resource terminal-output; -} - -/// An interface providing an optional `terminal-input` for stdin as a -/// link-time authority. -@since(version = 0.3.0-rc-2026-01-06) -interface terminal-stdin { - @since(version = 0.3.0-rc-2026-01-06) - use terminal-input.{terminal-input}; - - /// If stdin is connected to a terminal, return a `terminal-input` handle - /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-01-06) - get-terminal-stdin: func() -> option; -} - -/// An interface providing an optional `terminal-output` for stdout as a -/// link-time authority. -@since(version = 0.3.0-rc-2026-01-06) -interface terminal-stdout { - @since(version = 0.3.0-rc-2026-01-06) - use terminal-output.{terminal-output}; - - /// If stdout is connected to a terminal, return a `terminal-output` handle - /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-01-06) - get-terminal-stdout: func() -> option; -} - -/// An interface providing an optional `terminal-output` for stderr as a -/// link-time authority. -@since(version = 0.3.0-rc-2026-01-06) -interface terminal-stderr { - @since(version = 0.3.0-rc-2026-01-06) - use terminal-output.{terminal-output}; - - /// If stderr is connected to a terminal, return a `terminal-output` handle - /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-01-06) - get-terminal-stderr: func() -> option; -} - -@since(version = 0.3.0-rc-2026-01-06) -world imports { - @since(version = 0.3.0-rc-2026-01-06) - import environment; - @since(version = 0.3.0-rc-2026-01-06) - import exit; - @since(version = 0.3.0-rc-2026-01-06) - import types; - @since(version = 0.3.0-rc-2026-01-06) - import stdin; - @since(version = 0.3.0-rc-2026-01-06) - import stdout; - @since(version = 0.3.0-rc-2026-01-06) - import stderr; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-input; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-output; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-stdin; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-stdout; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-stderr; - import wasi:clocks/types@0.3.0-rc-2026-01-06; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-01-06; - import wasi:clocks/system-clock@0.3.0-rc-2026-01-06; - @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-01-06; - import wasi:filesystem/types@0.3.0-rc-2026-01-06; - import wasi:filesystem/preopens@0.3.0-rc-2026-01-06; - import wasi:sockets/types@0.3.0-rc-2026-01-06; - import wasi:sockets/ip-name-lookup@0.3.0-rc-2026-01-06; - import wasi:random/random@0.3.0-rc-2026-01-06; - import wasi:random/insecure@0.3.0-rc-2026-01-06; - import wasi:random/insecure-seed@0.3.0-rc-2026-01-06; -} -@since(version = 0.3.0-rc-2026-01-06) -world command { - @since(version = 0.3.0-rc-2026-01-06) - import environment; - @since(version = 0.3.0-rc-2026-01-06) - import exit; - @since(version = 0.3.0-rc-2026-01-06) - import types; - @since(version = 0.3.0-rc-2026-01-06) - import stdin; - @since(version = 0.3.0-rc-2026-01-06) - import stdout; - @since(version = 0.3.0-rc-2026-01-06) - import stderr; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-input; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-output; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-stdin; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-stdout; - @since(version = 0.3.0-rc-2026-01-06) - import terminal-stderr; - import wasi:clocks/types@0.3.0-rc-2026-01-06; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-01-06; - import wasi:clocks/system-clock@0.3.0-rc-2026-01-06; - @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-01-06; - import wasi:filesystem/types@0.3.0-rc-2026-01-06; - import wasi:filesystem/preopens@0.3.0-rc-2026-01-06; - import wasi:sockets/types@0.3.0-rc-2026-01-06; - import wasi:sockets/ip-name-lookup@0.3.0-rc-2026-01-06; - import wasi:random/random@0.3.0-rc-2026-01-06; - import wasi:random/insecure@0.3.0-rc-2026-01-06; - import wasi:random/insecure-seed@0.3.0-rc-2026-01-06; - - @since(version = 0.3.0-rc-2026-01-06) - export run; -} diff --git a/wit/deps/cli-0.3.0-rc-2026-03-15.wit b/wit/deps/cli-0.3.0-rc-2026-03-15.wit deleted file mode 100644 index 8ba52c5c..00000000 --- a/wit/deps/cli-0.3.0-rc-2026-03-15.wit +++ /dev/null @@ -1,256 +0,0 @@ -package wasi:cli@0.3.0-rc-2026-03-15; - -@since(version = 0.3.0-rc-2026-03-15) -interface environment { - /// Get the POSIX-style environment variables. - /// - /// Each environment variable is provided as a pair of string variable names - /// and string value. - /// - /// Morally, these are a value import, but until value imports are available - /// in the component model, this import function should return the same - /// values each time it is called. - @since(version = 0.3.0-rc-2026-03-15) - get-environment: func() -> list>; - - /// Get the POSIX-style arguments to the program. - @since(version = 0.3.0-rc-2026-03-15) - get-arguments: func() -> list; - - /// Return a path that programs should use as their initial current working - /// directory, interpreting `.` as shorthand for this. - @since(version = 0.3.0-rc-2026-03-15) - get-initial-cwd: func() -> option; -} - -@since(version = 0.3.0-rc-2026-03-15) -interface exit { - /// Exit the current instance and any linked instances. - @since(version = 0.3.0-rc-2026-03-15) - exit: func(status: result); - - /// Exit the current instance and any linked instances, reporting the - /// specified status code to the host. - /// - /// The meaning of the code depends on the context, with 0 usually meaning - /// "success", and other values indicating various types of failure. - /// - /// This function does not return; the effect is analogous to a trap, but - /// without the connotation that something bad has happened. - @unstable(feature = cli-exit-with-code) - exit-with-code: func(status-code: u8); -} - -@since(version = 0.3.0-rc-2026-03-15) -interface run { - /// Run the program. - @since(version = 0.3.0-rc-2026-03-15) - run: async func() -> result; -} - -@since(version = 0.3.0-rc-2026-03-15) -interface types { - @since(version = 0.3.0-rc-2026-03-15) - enum error-code { - /// Input/output error - io, - /// Invalid or incomplete multibyte or wide character - illegal-byte-sequence, - /// Broken pipe - pipe, - } -} - -@since(version = 0.3.0-rc-2026-03-15) -interface stdin { - use types.{error-code}; - - /// Return a stream for reading from stdin. - /// - /// This function returns a stream which provides data read from stdin, - /// and a future to signal read results. - /// - /// If the stream's readable end is dropped the future will resolve to success. - /// - /// If the stream's writable end is dropped the future will either resolve to - /// success if stdin was closed by the writer or to an error-code if reading - /// failed for some other reason. - /// - /// Multiple streams may be active at the same time. The behavior of concurrent - /// reads is implementation-specific. - @since(version = 0.3.0-rc-2026-03-15) - read-via-stream: func() -> tuple, future>>; -} - -@since(version = 0.3.0-rc-2026-03-15) -interface stdout { - use types.{error-code}; - - /// Write the given stream to stdout. - /// - /// If the stream's writable end is dropped this function will either return - /// success once the entire contents of the stream have been written or an - /// error-code representing a failure. - /// - /// Otherwise if there is an error the readable end of the stream will be - /// dropped and this function will return an error-code. - @since(version = 0.3.0-rc-2026-03-15) - write-via-stream: func(data: stream) -> future>; -} - -@since(version = 0.3.0-rc-2026-03-15) -interface stderr { - use types.{error-code}; - - /// Write the given stream to stderr. - /// - /// If the stream's writable end is dropped this function will either return - /// success once the entire contents of the stream have been written or an - /// error-code representing a failure. - /// - /// Otherwise if there is an error the readable end of the stream will be - /// dropped and this function will return an error-code. - @since(version = 0.3.0-rc-2026-03-15) - write-via-stream: func(data: stream) -> future>; -} - -/// Terminal input. -/// -/// In the future, this may include functions for disabling echoing, -/// disabling input buffering so that keyboard events are sent through -/// immediately, querying supported features, and so on. -@since(version = 0.3.0-rc-2026-03-15) -interface terminal-input { - /// The input side of a terminal. - @since(version = 0.3.0-rc-2026-03-15) - resource terminal-input; -} - -/// Terminal output. -/// -/// In the future, this may include functions for querying the terminal -/// size, being notified of terminal size changes, querying supported -/// features, and so on. -@since(version = 0.3.0-rc-2026-03-15) -interface terminal-output { - /// The output side of a terminal. - @since(version = 0.3.0-rc-2026-03-15) - resource terminal-output; -} - -/// An interface providing an optional `terminal-input` for stdin as a -/// link-time authority. -@since(version = 0.3.0-rc-2026-03-15) -interface terminal-stdin { - @since(version = 0.3.0-rc-2026-03-15) - use terminal-input.{terminal-input}; - - /// If stdin is connected to a terminal, return a `terminal-input` handle - /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-03-15) - get-terminal-stdin: func() -> option; -} - -/// An interface providing an optional `terminal-output` for stdout as a -/// link-time authority. -@since(version = 0.3.0-rc-2026-03-15) -interface terminal-stdout { - @since(version = 0.3.0-rc-2026-03-15) - use terminal-output.{terminal-output}; - - /// If stdout is connected to a terminal, return a `terminal-output` handle - /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-03-15) - get-terminal-stdout: func() -> option; -} - -/// An interface providing an optional `terminal-output` for stderr as a -/// link-time authority. -@since(version = 0.3.0-rc-2026-03-15) -interface terminal-stderr { - @since(version = 0.3.0-rc-2026-03-15) - use terminal-output.{terminal-output}; - - /// If stderr is connected to a terminal, return a `terminal-output` handle - /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-03-15) - get-terminal-stderr: func() -> option; -} - -@since(version = 0.3.0-rc-2026-03-15) -world imports { - @since(version = 0.3.0-rc-2026-03-15) - import environment; - @since(version = 0.3.0-rc-2026-03-15) - import exit; - @since(version = 0.3.0-rc-2026-03-15) - import types; - @since(version = 0.3.0-rc-2026-03-15) - import stdin; - @since(version = 0.3.0-rc-2026-03-15) - import stdout; - @since(version = 0.3.0-rc-2026-03-15) - import stderr; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-input; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-output; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-stdin; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-stdout; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-stderr; - import wasi:clocks/types@0.3.0-rc-2026-03-15; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15; - import wasi:clocks/system-clock@0.3.0-rc-2026-03-15; - @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-03-15; - import wasi:filesystem/types@0.3.0-rc-2026-03-15; - import wasi:filesystem/preopens@0.3.0-rc-2026-03-15; - import wasi:sockets/types@0.3.0-rc-2026-03-15; - import wasi:sockets/ip-name-lookup@0.3.0-rc-2026-03-15; - import wasi:random/random@0.3.0-rc-2026-03-15; - import wasi:random/insecure@0.3.0-rc-2026-03-15; - import wasi:random/insecure-seed@0.3.0-rc-2026-03-15; -} -@since(version = 0.3.0-rc-2026-03-15) -world command { - @since(version = 0.3.0-rc-2026-03-15) - import environment; - @since(version = 0.3.0-rc-2026-03-15) - import exit; - @since(version = 0.3.0-rc-2026-03-15) - import types; - @since(version = 0.3.0-rc-2026-03-15) - import stdin; - @since(version = 0.3.0-rc-2026-03-15) - import stdout; - @since(version = 0.3.0-rc-2026-03-15) - import stderr; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-input; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-output; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-stdin; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-stdout; - @since(version = 0.3.0-rc-2026-03-15) - import terminal-stderr; - import wasi:clocks/types@0.3.0-rc-2026-03-15; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15; - import wasi:clocks/system-clock@0.3.0-rc-2026-03-15; - @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-03-15; - import wasi:filesystem/types@0.3.0-rc-2026-03-15; - import wasi:filesystem/preopens@0.3.0-rc-2026-03-15; - import wasi:sockets/types@0.3.0-rc-2026-03-15; - import wasi:sockets/ip-name-lookup@0.3.0-rc-2026-03-15; - import wasi:random/random@0.3.0-rc-2026-03-15; - import wasi:random/insecure@0.3.0-rc-2026-03-15; - import wasi:random/insecure-seed@0.3.0-rc-2026-03-15; - - @since(version = 0.3.0-rc-2026-03-15) - export run; -} diff --git a/wit/deps/cli-0.3.0-rc-2026-02-09.wit b/wit/deps/cli-0.3.0/cli.wit similarity index 62% rename from wit/deps/cli-0.3.0-rc-2026-02-09.wit rename to wit/deps/cli-0.3.0/cli.wit index 4f8bbf8a..7aae56c1 100644 --- a/wit/deps/cli-0.3.0-rc-2026-02-09.wit +++ b/wit/deps/cli-0.3.0/cli.wit @@ -1,6 +1,6 @@ -package wasi:cli@0.3.0-rc-2026-02-09; +package wasi:cli@0.3.0; -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface environment { /// Get the POSIX-style environment variables. /// @@ -10,23 +10,23 @@ interface environment { /// Morally, these are a value import, but until value imports are available /// in the component model, this import function should return the same /// values each time it is called. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) get-environment: func() -> list>; /// Get the POSIX-style arguments to the program. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) get-arguments: func() -> list; /// Return a path that programs should use as their initial current working /// directory, interpreting `.` as shorthand for this. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) get-initial-cwd: func() -> option; } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface exit { /// Exit the current instance and any linked instances. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) exit: func(status: result); /// Exit the current instance and any linked instances, reporting the @@ -37,20 +37,20 @@ interface exit { /// /// This function does not return; the effect is analogous to a trap, but /// without the connotation that something bad has happened. - @unstable(feature = cli-exit-with-code) + @since(version = 0.3.0) exit-with-code: func(status-code: u8); } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface run { /// Run the program. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) run: async func() -> result; } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface types { - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) enum error-code { /// Input/output error io, @@ -61,7 +61,7 @@ interface types { } } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface stdin { use types.{error-code}; @@ -78,11 +78,11 @@ interface stdin { /// /// Multiple streams may be active at the same time. The behavior of concurrent /// reads is implementation-specific. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) read-via-stream: func() -> tuple, future>>; } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface stdout { use types.{error-code}; @@ -94,11 +94,11 @@ interface stdout { /// /// Otherwise if there is an error the readable end of the stream will be /// dropped and this function will return an error-code. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) write-via-stream: func(data: stream) -> future>; } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface stderr { use types.{error-code}; @@ -110,7 +110,7 @@ interface stderr { /// /// Otherwise if there is an error the readable end of the stream will be /// dropped and this function will return an error-code. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) write-via-stream: func(data: stream) -> future>; } @@ -119,10 +119,10 @@ interface stderr { /// In the future, this may include functions for disabling echoing, /// disabling input buffering so that keyboard events are sent through /// immediately, querying supported features, and so on. -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface terminal-input { /// The input side of a terminal. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) resource terminal-input; } @@ -131,126 +131,126 @@ interface terminal-input { /// In the future, this may include functions for querying the terminal /// size, being notified of terminal size changes, querying supported /// features, and so on. -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface terminal-output { /// The output side of a terminal. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) resource terminal-output; } /// An interface providing an optional `terminal-input` for stdin as a /// link-time authority. -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface terminal-stdin { - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) use terminal-input.{terminal-input}; /// If stdin is connected to a terminal, return a `terminal-input` handle /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) get-terminal-stdin: func() -> option; } /// An interface providing an optional `terminal-output` for stdout as a /// link-time authority. -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface terminal-stdout { - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) use terminal-output.{terminal-output}; /// If stdout is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) get-terminal-stdout: func() -> option; } /// An interface providing an optional `terminal-output` for stderr as a /// link-time authority. -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface terminal-stderr { - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) use terminal-output.{terminal-output}; /// If stderr is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) get-terminal-stderr: func() -> option; } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) world imports { - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import environment; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import exit; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import types; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import stdin; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import stdout; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import stderr; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-input; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-output; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-stdin; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-stdout; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-stderr; - import wasi:clocks/types@0.3.0-rc-2026-02-09; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-02-09; - import wasi:clocks/system-clock@0.3.0-rc-2026-02-09; + import wasi:clocks/types@0.3.0; + import wasi:clocks/monotonic-clock@0.3.0; + import wasi:clocks/system-clock@0.3.0; @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-02-09; - import wasi:filesystem/types@0.3.0-rc-2026-02-09; - import wasi:filesystem/preopens@0.3.0-rc-2026-02-09; - import wasi:sockets/types@0.3.0-rc-2026-02-09; - import wasi:sockets/ip-name-lookup@0.3.0-rc-2026-02-09; - import wasi:random/random@0.3.0-rc-2026-02-09; - import wasi:random/insecure@0.3.0-rc-2026-02-09; - import wasi:random/insecure-seed@0.3.0-rc-2026-02-09; + import wasi:clocks/timezone@0.3.0; + import wasi:filesystem/types@0.3.0; + import wasi:filesystem/preopens@0.3.0; + import wasi:sockets/types@0.3.0; + import wasi:sockets/ip-name-lookup@0.3.0; + import wasi:random/random@0.3.0; + import wasi:random/insecure@0.3.0; + import wasi:random/insecure-seed@0.3.0; } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) world command { - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import environment; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import exit; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import types; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import stdin; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import stdout; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import stderr; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-input; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-output; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-stdin; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-stdout; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import terminal-stderr; - import wasi:clocks/types@0.3.0-rc-2026-02-09; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-02-09; - import wasi:clocks/system-clock@0.3.0-rc-2026-02-09; + import wasi:clocks/types@0.3.0; + import wasi:clocks/monotonic-clock@0.3.0; + import wasi:clocks/system-clock@0.3.0; @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-02-09; - import wasi:filesystem/types@0.3.0-rc-2026-02-09; - import wasi:filesystem/preopens@0.3.0-rc-2026-02-09; - import wasi:sockets/types@0.3.0-rc-2026-02-09; - import wasi:sockets/ip-name-lookup@0.3.0-rc-2026-02-09; - import wasi:random/random@0.3.0-rc-2026-02-09; - import wasi:random/insecure@0.3.0-rc-2026-02-09; - import wasi:random/insecure-seed@0.3.0-rc-2026-02-09; + import wasi:clocks/timezone@0.3.0; + import wasi:filesystem/types@0.3.0; + import wasi:filesystem/preopens@0.3.0; + import wasi:sockets/types@0.3.0; + import wasi:sockets/ip-name-lookup@0.3.0; + import wasi:random/random@0.3.0; + import wasi:random/insecure@0.3.0; + import wasi:random/insecure-seed@0.3.0; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) export run; } diff --git a/wit/deps/cli-0.3.0/deps/clocks.wit b/wit/deps/cli-0.3.0/deps/clocks.wit new file mode 100644 index 00000000..871adf02 --- /dev/null +++ b/wit/deps/cli-0.3.0/deps/clocks.wit @@ -0,0 +1,43 @@ +package wasi:clocks@0.3.0; + +interface types { + type duration = u64; +} + +interface monotonic-clock { + use types.{duration}; + + type mark = u64; + + now: func() -> mark; + + get-resolution: func() -> duration; + + wait-until: async func(when: mark); + + wait-for: async func(how-long: duration); +} + +interface system-clock { + use types.{duration}; + + record instant { + seconds: s64, + nanoseconds: u32, + } + + now: func() -> instant; + + get-resolution: func() -> duration; +} + +interface timezone { + use system-clock.{instant}; + + iana-id: func() -> option; + + utc-offset: func(when: instant) -> option; + + to-debug-string: func() -> string; +} + diff --git a/wit/deps/cli-0.3.0/deps/filesystem.wit b/wit/deps/cli-0.3.0/deps/filesystem.wit new file mode 100644 index 00000000..492d2ca0 --- /dev/null +++ b/wit/deps/cli-0.3.0/deps/filesystem.wit @@ -0,0 +1,149 @@ +package wasi:filesystem@0.3.0; + +interface types { + use wasi:clocks/system-clock@0.3.0.{instant}; + + type filesize = u64; + + variant descriptor-type { + block-device, + character-device, + directory, + fifo, + symbolic-link, + regular-file, + socket, + other(option), + } + + flags descriptor-flags { + read, + write, + file-integrity-sync, + data-integrity-sync, + requested-write-sync, + mutate-directory, + } + + flags path-flags { + symlink-follow, + } + + flags open-flags { + create, + directory, + exclusive, + truncate, + } + + type link-count = u64; + + record descriptor-stat { + %type: descriptor-type, + link-count: link-count, + size: filesize, + data-access-timestamp: option, + data-modification-timestamp: option, + status-change-timestamp: option, + } + + variant new-timestamp { + no-change, + now, + timestamp(instant), + } + + record directory-entry { + %type: descriptor-type, + name: string, + } + + variant error-code { + access, + already, + bad-descriptor, + busy, + deadlock, + quota, + exist, + file-too-large, + illegal-byte-sequence, + in-progress, + interrupted, + invalid, + io, + is-directory, + loop, + too-many-links, + message-size, + name-too-long, + no-device, + no-entry, + no-lock, + insufficient-memory, + insufficient-space, + not-directory, + not-empty, + not-recoverable, + unsupported, + no-tty, + no-such-device, + overflow, + not-permitted, + pipe, + read-only, + invalid-seek, + text-file-busy, + cross-device, + other(option), + } + + enum advice { + normal, + sequential, + random, + will-need, + dont-need, + no-reuse, + } + + record metadata-hash-value { + lower: u64, + upper: u64, + } + + resource descriptor { + read-via-stream: func(offset: filesize) -> tuple, future>>; + write-via-stream: func(data: stream, offset: filesize) -> future>; + append-via-stream: func(data: stream) -> future>; + advise: async func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; + sync-data: async func() -> result<_, error-code>; + get-flags: async func() -> result; + get-type: async func() -> result; + set-size: async func(size: filesize) -> result<_, error-code>; + set-times: async func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; + read-directory: func() -> tuple, future>>; + sync: async func() -> result<_, error-code>; + create-directory-at: async func(path: string) -> result<_, error-code>; + stat: async func() -> result; + stat-at: async func(path-flags: path-flags, path: string) -> result; + set-times-at: async func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; + link-at: async func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; + open-at: async func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; + readlink-at: async func(path: string) -> result; + remove-directory-at: async func(path: string) -> result<_, error-code>; + rename-at: async func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; + symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>; + unlink-file-at: async func(path: string) -> result<_, error-code>; + is-same-object: async func(other: borrow) -> bool; + metadata-hash: async func() -> result; + metadata-hash-at: async func(path-flags: path-flags, path: string) -> result; + } +} + +interface preopens { + use types.{descriptor}; + + get-directories: func() -> list>; +} + diff --git a/wit/deps/cli-0.3.0/deps/random.wit b/wit/deps/cli-0.3.0/deps/random.wit new file mode 100644 index 00000000..f6cfb813 --- /dev/null +++ b/wit/deps/cli-0.3.0/deps/random.wit @@ -0,0 +1,18 @@ +package wasi:random@0.3.0; + +interface random { + get-random-bytes: func(max-len: u64) -> list; + + get-random-u64: func() -> u64; +} + +interface insecure { + get-insecure-random-bytes: func(max-len: u64) -> list; + + get-insecure-random-u64: func() -> u64; +} + +interface insecure-seed { + get-insecure-seed: func() -> tuple; +} + diff --git a/wit/deps/cli-0.3.0/deps/sockets.wit b/wit/deps/cli-0.3.0/deps/sockets.wit new file mode 100644 index 00000000..da14ae8b --- /dev/null +++ b/wit/deps/cli-0.3.0/deps/sockets.wit @@ -0,0 +1,116 @@ +package wasi:sockets@0.3.0; + +interface types { + use wasi:clocks/types@0.3.0.{duration}; + + variant error-code { + access-denied, + not-supported, + invalid-argument, + out-of-memory, + timeout, + invalid-state, + address-not-bindable, + address-in-use, + remote-unreachable, + connection-refused, + connection-broken, + connection-reset, + connection-aborted, + datagram-too-large, + other(option), + } + + enum ip-address-family { + ipv4, + ipv6, + } + + type ipv4-address = tuple; + + type ipv6-address = tuple; + + variant ip-address { + ipv4(ipv4-address), + ipv6(ipv6-address), + } + + record ipv4-socket-address { + port: u16, + address: ipv4-address, + } + + record ipv6-socket-address { + port: u16, + flow-info: u32, + address: ipv6-address, + scope-id: u32, + } + + variant ip-socket-address { + ipv4(ipv4-socket-address), + ipv6(ipv6-socket-address), + } + + resource tcp-socket { + create: static func(address-family: ip-address-family) -> result; + bind: func(local-address: ip-socket-address) -> result<_, error-code>; + connect: async func(remote-address: ip-socket-address) -> result<_, error-code>; + listen: func() -> result, error-code>; + send: func(data: stream) -> future>; + receive: func() -> tuple, future>>; + get-local-address: func() -> result; + get-remote-address: func() -> result; + get-is-listening: func() -> bool; + get-address-family: func() -> ip-address-family; + set-listen-backlog-size: func(value: u64) -> result<_, error-code>; + get-keep-alive-enabled: func() -> result; + set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; + get-keep-alive-idle-time: func() -> result; + set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; + get-keep-alive-interval: func() -> result; + set-keep-alive-interval: func(value: duration) -> result<_, error-code>; + get-keep-alive-count: func() -> result; + set-keep-alive-count: func(value: u32) -> result<_, error-code>; + get-hop-limit: func() -> result; + set-hop-limit: func(value: u8) -> result<_, error-code>; + get-receive-buffer-size: func() -> result; + set-receive-buffer-size: func(value: u64) -> result<_, error-code>; + get-send-buffer-size: func() -> result; + set-send-buffer-size: func(value: u64) -> result<_, error-code>; + } + + resource udp-socket { + create: static func(address-family: ip-address-family) -> result; + bind: func(local-address: ip-socket-address) -> result<_, error-code>; + connect: func(remote-address: ip-socket-address) -> result<_, error-code>; + disconnect: func() -> result<_, error-code>; + send: async func(data: list, remote-address: option) -> result<_, error-code>; + receive: async func() -> result, ip-socket-address>, error-code>; + get-local-address: func() -> result; + get-remote-address: func() -> result; + get-address-family: func() -> ip-address-family; + get-unicast-hop-limit: func() -> result; + set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; + get-receive-buffer-size: func() -> result; + set-receive-buffer-size: func(value: u64) -> result<_, error-code>; + get-send-buffer-size: func() -> result; + set-send-buffer-size: func(value: u64) -> result<_, error-code>; + } +} + +interface ip-name-lookup { + use types.{ip-address}; + + variant error-code { + access-denied, + invalid-argument, + name-unresolvable, + temporary-resolver-failure, + permanent-resolver-failure, + other(option), + } + + resolve-addresses: async func(name: string) -> result, error-code>; +} + diff --git a/wit/deps/clocks/monotonic-clock.wit b/wit/deps/clocks-0.2.0/monotonic-clock.wit similarity index 100% rename from wit/deps/clocks/monotonic-clock.wit rename to wit/deps/clocks-0.2.0/monotonic-clock.wit diff --git a/wit/deps/clocks/wall-clock.wit b/wit/deps/clocks-0.2.0/wall-clock.wit similarity index 100% rename from wit/deps/clocks/wall-clock.wit rename to wit/deps/clocks-0.2.0/wall-clock.wit diff --git a/wit/deps/clocks/world.wit b/wit/deps/clocks-0.2.0/world.wit similarity index 100% rename from wit/deps/clocks/world.wit rename to wit/deps/clocks-0.2.0/world.wit diff --git a/wit/deps/clocks-0.3.0-rc-2026-01-06.wit b/wit/deps/clocks-0.3.0-rc-2026-01-06.wit deleted file mode 100644 index fc59f5a2..00000000 --- a/wit/deps/clocks-0.3.0-rc-2026-01-06.wit +++ /dev/null @@ -1,161 +0,0 @@ -package wasi:clocks@0.3.0-rc-2026-01-06; - -/// This interface common types used throughout wasi:clocks. -@since(version = 0.3.0-rc-2026-01-06) -interface types { - /// A duration of time, in nanoseconds. - @since(version = 0.3.0-rc-2026-01-06) - type duration = u64; -} - -/// WASI Monotonic Clock is a clock API intended to let users measure elapsed -/// time. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -/// -/// A monotonic clock is a clock which has an unspecified initial value, and -/// successive reads of the clock will produce non-decreasing values. -@since(version = 0.3.0-rc-2026-01-06) -interface monotonic-clock { - use types.{duration}; - - /// A mark on a monotonic clock is a number of nanoseconds since an - /// unspecified initial value, and can only be compared to instances from - /// the same monotonic-clock. - @since(version = 0.3.0-rc-2026-01-06) - type mark = u64; - - /// Read the current value of the clock. - /// - /// The clock is monotonic, therefore calling this function repeatedly will - /// produce a sequence of non-decreasing values. - /// - /// For completeness, this function traps if it's not possible to represent - /// the value of the clock in a `mark`. Consequently, implementations - /// should ensure that the starting time is low enough to avoid the - /// possibility of overflow in practice. - @since(version = 0.3.0-rc-2026-01-06) - now: func() -> mark; - - /// Query the resolution of the clock. Returns the duration of time - /// corresponding to a clock tick. - @since(version = 0.3.0-rc-2026-01-06) - get-resolution: func() -> duration; - - /// Wait until the specified mark has occurred. - @since(version = 0.3.0-rc-2026-01-06) - wait-until: async func(when: mark); - - /// Wait for the specified duration to elapse. - @since(version = 0.3.0-rc-2026-01-06) - wait-for: async func(how-long: duration); -} - -/// WASI System Clock is a clock API intended to let users query the current -/// time. The clock is not necessarily monotonic as it may be reset. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -/// -/// External references may be reset, so this clock is not necessarily -/// monotonic, making it unsuitable for measuring elapsed time. -/// -/// It is intended for reporting the current date and time for humans. -@since(version = 0.3.0-rc-2026-01-06) -interface system-clock { - use types.{duration}; - - /// An "instant", or "exact time", is a point in time without regard to any - /// time zone: just the time since a particular external reference point, - /// often called an "epoch". - /// - /// Here, the epoch is 1970-01-01T00:00:00Z, also known as - /// [POSIX's Seconds Since the Epoch], also known as [Unix Time]. - /// - /// Note that even if the seconds field is negative, incrementing - /// nanoseconds always represents moving forwards in time. - /// For example, `{ -1 seconds, 999999999 nanoseconds }` represents the - /// instant one nanosecond before the epoch. - /// For more on various different ways to represent time, see - /// https://tc39.es/proposal-temporal/docs/timezone.html - /// - /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 - /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time - @since(version = 0.3.0-rc-2026-01-06) - record instant { - seconds: s64, - nanoseconds: u32, - } - - /// Read the current value of the clock. - /// - /// This clock is not monotonic, therefore calling this function repeatedly - /// will not necessarily produce a sequence of non-decreasing values. - /// - /// The nanoseconds field of the output is always less than 1000000000. - @since(version = 0.3.0-rc-2026-01-06) - now: func() -> instant; - - /// Query the resolution of the clock. Returns the smallest duration of time - /// that the implementation permits distinguishing. - @since(version = 0.3.0-rc-2026-01-06) - get-resolution: func() -> duration; -} - -@unstable(feature = clocks-timezone) -interface timezone { - @unstable(feature = clocks-timezone) - use system-clock.{instant}; - - /// Return the IANA identifier of the currently configured timezone. This - /// should be an identifier from the IANA Time Zone Database. - /// - /// For displaying to a user, the identifier should be converted into a - /// localized name by means of an internationalization API. - /// - /// If the implementation does not expose an actual timezone, or is unable - /// to provide mappings from times to deltas between the configured timezone - /// and UTC, or determining the current timezone fails, or the timezone does - /// not have an IANA identifier, this returns nothing. - @unstable(feature = clocks-timezone) - iana-id: func() -> option; - - /// The number of nanoseconds difference between UTC time and the local - /// time of the currently configured timezone, at the exact time of - /// `instant`. - /// - /// The magnitude of the returned value will always be less than - /// 86,400,000,000,000 which is the number of nanoseconds in a day - /// (24*60*60*1e9). - /// - /// If the implementation does not expose an actual timezone, or is unable - /// to provide mappings from times to deltas between the configured timezone - /// and UTC, or determining the current timezone fails, this returns - /// nothing. - @unstable(feature = clocks-timezone) - utc-offset: func(when: instant) -> option; - - /// Returns a string that is suitable to assist humans in debugging whether - /// any timezone is available, and if so, which. This may be the same string - /// as `iana-id`, or a formatted representation of the UTC offset such as - /// `-04:00`, or something else. - /// - /// WARNING: The returned string should not be consumed mechanically! It may - /// change across platforms, hosts, or other implementation details. Parsing - /// this string is a major platform-compatibility hazard. - @unstable(feature = clocks-timezone) - to-debug-string: func() -> string; -} - -@since(version = 0.3.0-rc-2026-01-06) -world imports { - @since(version = 0.3.0-rc-2026-01-06) - import types; - @since(version = 0.3.0-rc-2026-01-06) - import monotonic-clock; - @since(version = 0.3.0-rc-2026-01-06) - import system-clock; - @unstable(feature = clocks-timezone) - import timezone; -} diff --git a/wit/deps/clocks-0.3.0-rc-2026-03-15.wit b/wit/deps/clocks-0.3.0-rc-2026-03-15.wit deleted file mode 100644 index 19fc4bcd..00000000 --- a/wit/deps/clocks-0.3.0-rc-2026-03-15.wit +++ /dev/null @@ -1,161 +0,0 @@ -package wasi:clocks@0.3.0-rc-2026-03-15; - -/// This interface common types used throughout wasi:clocks. -@since(version = 0.3.0-rc-2026-03-15) -interface types { - /// A duration of time, in nanoseconds. - @since(version = 0.3.0-rc-2026-03-15) - type duration = u64; -} - -/// WASI Monotonic Clock is a clock API intended to let users measure elapsed -/// time. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -/// -/// A monotonic clock is a clock which has an unspecified initial value, and -/// successive reads of the clock will produce non-decreasing values. -@since(version = 0.3.0-rc-2026-03-15) -interface monotonic-clock { - use types.{duration}; - - /// A mark on a monotonic clock is a number of nanoseconds since an - /// unspecified initial value, and can only be compared to instances from - /// the same monotonic-clock. - @since(version = 0.3.0-rc-2026-03-15) - type mark = u64; - - /// Read the current value of the clock. - /// - /// The clock is monotonic, therefore calling this function repeatedly will - /// produce a sequence of non-decreasing values. - /// - /// For completeness, this function traps if it's not possible to represent - /// the value of the clock in a `mark`. Consequently, implementations - /// should ensure that the starting time is low enough to avoid the - /// possibility of overflow in practice. - @since(version = 0.3.0-rc-2026-03-15) - now: func() -> mark; - - /// Query the resolution of the clock. Returns the duration of time - /// corresponding to a clock tick. - @since(version = 0.3.0-rc-2026-03-15) - get-resolution: func() -> duration; - - /// Wait until the specified mark has occurred. - @since(version = 0.3.0-rc-2026-03-15) - wait-until: async func(when: mark); - - /// Wait for the specified duration to elapse. - @since(version = 0.3.0-rc-2026-03-15) - wait-for: async func(how-long: duration); -} - -/// WASI System Clock is a clock API intended to let users query the current -/// time. The clock is not necessarily monotonic as it may be reset. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -/// -/// External references may be reset, so this clock is not necessarily -/// monotonic, making it unsuitable for measuring elapsed time. -/// -/// It is intended for reporting the current date and time for humans. -@since(version = 0.3.0-rc-2026-03-15) -interface system-clock { - use types.{duration}; - - /// An "instant", or "exact time", is a point in time without regard to any - /// time zone: just the time since a particular external reference point, - /// often called an "epoch". - /// - /// Here, the epoch is 1970-01-01T00:00:00Z, also known as - /// [POSIX's Seconds Since the Epoch], also known as [Unix Time]. - /// - /// Note that even if the seconds field is negative, incrementing - /// nanoseconds always represents moving forwards in time. - /// For example, `{ -1 seconds, 999999999 nanoseconds }` represents the - /// instant one nanosecond before the epoch. - /// For more on various different ways to represent time, see - /// https://tc39.es/proposal-temporal/docs/timezone.html - /// - /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 - /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time - @since(version = 0.3.0-rc-2026-03-15) - record instant { - seconds: s64, - nanoseconds: u32, - } - - /// Read the current value of the clock. - /// - /// This clock is not monotonic, therefore calling this function repeatedly - /// will not necessarily produce a sequence of non-decreasing values. - /// - /// The nanoseconds field of the output is always less than 1000000000. - @since(version = 0.3.0-rc-2026-03-15) - now: func() -> instant; - - /// Query the resolution of the clock. Returns the smallest duration of time - /// that the implementation permits distinguishing. - @since(version = 0.3.0-rc-2026-03-15) - get-resolution: func() -> duration; -} - -@unstable(feature = clocks-timezone) -interface timezone { - @unstable(feature = clocks-timezone) - use system-clock.{instant}; - - /// Return the IANA identifier of the currently configured timezone. This - /// should be an identifier from the IANA Time Zone Database. - /// - /// For displaying to a user, the identifier should be converted into a - /// localized name by means of an internationalization API. - /// - /// If the implementation does not expose an actual timezone, or is unable - /// to provide mappings from times to deltas between the configured timezone - /// and UTC, or determining the current timezone fails, or the timezone does - /// not have an IANA identifier, this returns nothing. - @unstable(feature = clocks-timezone) - iana-id: func() -> option; - - /// The number of nanoseconds difference between UTC time and the local - /// time of the currently configured timezone, at the exact time of - /// `instant`. - /// - /// The magnitude of the returned value will always be less than - /// 86,400,000,000,000 which is the number of nanoseconds in a day - /// (24*60*60*1e9). - /// - /// If the implementation does not expose an actual timezone, or is unable - /// to provide mappings from times to deltas between the configured timezone - /// and UTC, or determining the current timezone fails, this returns - /// nothing. - @unstable(feature = clocks-timezone) - utc-offset: func(when: instant) -> option; - - /// Returns a string that is suitable to assist humans in debugging whether - /// any timezone is available, and if so, which. This may be the same string - /// as `iana-id`, or a formatted representation of the UTC offset such as - /// `-04:00`, or something else. - /// - /// WARNING: The returned string should not be consumed mechanically! It may - /// change across platforms, hosts, or other implementation details. Parsing - /// this string is a major platform-compatibility hazard. - @unstable(feature = clocks-timezone) - to-debug-string: func() -> string; -} - -@since(version = 0.3.0-rc-2026-03-15) -world imports { - @since(version = 0.3.0-rc-2026-03-15) - import types; - @since(version = 0.3.0-rc-2026-03-15) - import monotonic-clock; - @since(version = 0.3.0-rc-2026-03-15) - import system-clock; - @unstable(feature = clocks-timezone) - import timezone; -} diff --git a/wit/deps/clocks-0.3.0-rc-2026-02-09.wit b/wit/deps/clocks-0.3.0/clocks.wit similarity index 89% rename from wit/deps/clocks-0.3.0-rc-2026-02-09.wit rename to wit/deps/clocks-0.3.0/clocks.wit index 71986bab..d8b8cfe4 100644 --- a/wit/deps/clocks-0.3.0-rc-2026-02-09.wit +++ b/wit/deps/clocks-0.3.0/clocks.wit @@ -1,10 +1,10 @@ -package wasi:clocks@0.3.0-rc-2026-02-09; +package wasi:clocks@0.3.0; /// This interface common types used throughout wasi:clocks. -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface types { /// A duration of time, in nanoseconds. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) type duration = u64; } @@ -16,14 +16,14 @@ interface types { /// /// A monotonic clock is a clock which has an unspecified initial value, and /// successive reads of the clock will produce non-decreasing values. -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface monotonic-clock { use types.{duration}; /// A mark on a monotonic clock is a number of nanoseconds since an /// unspecified initial value, and can only be compared to instances from /// the same monotonic-clock. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) type mark = u64; /// Read the current value of the clock. @@ -35,20 +35,20 @@ interface monotonic-clock { /// the value of the clock in a `mark`. Consequently, implementations /// should ensure that the starting time is low enough to avoid the /// possibility of overflow in practice. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) now: func() -> mark; /// Query the resolution of the clock. Returns the duration of time /// corresponding to a clock tick. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) get-resolution: func() -> duration; /// Wait until the specified mark has occurred. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) wait-until: async func(when: mark); /// Wait for the specified duration to elapse. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) wait-for: async func(how-long: duration); } @@ -62,7 +62,7 @@ interface monotonic-clock { /// monotonic, making it unsuitable for measuring elapsed time. /// /// It is intended for reporting the current date and time for humans. -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) interface system-clock { use types.{duration}; @@ -82,7 +82,7 @@ interface system-clock { /// /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) record instant { seconds: s64, nanoseconds: u32, @@ -94,12 +94,12 @@ interface system-clock { /// will not necessarily produce a sequence of non-decreasing values. /// /// The nanoseconds field of the output is always less than 1000000000. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) now: func() -> instant; /// Query the resolution of the clock. Returns the smallest duration of time /// that the implementation permits distinguishing. - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) get-resolution: func() -> duration; } @@ -148,13 +148,13 @@ interface timezone { to-debug-string: func() -> string; } -@since(version = 0.3.0-rc-2026-02-09) +@since(version = 0.3.0) world imports { - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import types; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import monotonic-clock; - @since(version = 0.3.0-rc-2026-02-09) + @since(version = 0.3.0) import system-clock; @unstable(feature = clocks-timezone) import timezone; diff --git a/wit/deps/filesystem/preopens.wit b/wit/deps/filesystem-0.2.0/preopens.wit similarity index 100% rename from wit/deps/filesystem/preopens.wit rename to wit/deps/filesystem-0.2.0/preopens.wit diff --git a/wit/deps/filesystem/types.wit b/wit/deps/filesystem-0.2.0/types.wit similarity index 100% rename from wit/deps/filesystem/types.wit rename to wit/deps/filesystem-0.2.0/types.wit diff --git a/wit/deps/filesystem/world.wit b/wit/deps/filesystem-0.2.0/world.wit similarity index 100% rename from wit/deps/filesystem/world.wit rename to wit/deps/filesystem-0.2.0/world.wit diff --git a/wit/deps/filesystem-0.3.0-rc-2026-01-06.wit b/wit/deps/filesystem-0.3.0-rc-2026-01-06.wit deleted file mode 100644 index 0ac149cb..00000000 --- a/wit/deps/filesystem-0.3.0-rc-2026-01-06.wit +++ /dev/null @@ -1,553 +0,0 @@ -package wasi:filesystem@0.3.0-rc-2026-01-06; - -/// WASI filesystem is a filesystem API primarily intended to let users run WASI -/// programs that access their files on their existing filesystems, without -/// significant overhead. -/// -/// It is intended to be roughly portable between Unix-family platforms and -/// Windows, though it does not hide many of the major differences. -/// -/// Paths are passed as interface-type `string`s, meaning they must consist of -/// a sequence of Unicode Scalar Values (USVs). Some filesystems may contain -/// paths which are not accessible by this API. -/// -/// The directory separator in WASI is always the forward-slash (`/`). -/// -/// All paths in WASI are relative paths, and are interpreted relative to a -/// `descriptor` referring to a base directory. If a `path` argument to any WASI -/// function starts with `/`, or if any step of resolving a `path`, including -/// `..` and symbolic link steps, reaches a directory outside of the base -/// directory, or reaches a symlink to an absolute or rooted path in the -/// underlying filesystem, the function fails with `error-code::not-permitted`. -/// -/// For more information about WASI path resolution and sandboxing, see -/// [WASI filesystem path resolution]. -/// -/// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md -@since(version = 0.3.0-rc-2026-01-06) -interface types { - @since(version = 0.3.0-rc-2026-01-06) - use wasi:clocks/system-clock@0.3.0-rc-2026-01-06.{instant}; - - /// File size or length of a region within a file. - @since(version = 0.3.0-rc-2026-01-06) - type filesize = u64; - - /// The type of a filesystem object referenced by a descriptor. - /// - /// Note: This was called `filetype` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - enum descriptor-type { - /// The type of the descriptor or file is unknown or is different from - /// any of the other types specified. - unknown, - /// The descriptor refers to a block device inode. - block-device, - /// The descriptor refers to a character device inode. - character-device, - /// The descriptor refers to a directory inode. - directory, - /// The descriptor refers to a named pipe. - fifo, - /// The file refers to a symbolic link inode. - symbolic-link, - /// The descriptor refers to a regular file inode. - regular-file, - /// The descriptor refers to a socket. - socket, - } - - /// Descriptor flags. - /// - /// Note: This was called `fdflags` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - flags descriptor-flags { - /// Read mode: Data can be read. - read, - /// Write mode: Data can be written to. - write, - /// Request that writes be performed according to synchronized I/O file - /// integrity completion. The data stored in the file and the file's - /// metadata are synchronized. This is similar to `O_SYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - file-integrity-sync, - /// Request that writes be performed according to synchronized I/O data - /// integrity completion. Only the data stored in the file is - /// synchronized. This is similar to `O_DSYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - data-integrity-sync, - /// Requests that reads be performed at the same level of integrity - /// requested for writes. This is similar to `O_RSYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - requested-write-sync, - /// Mutating directories mode: Directory contents may be mutated. - /// - /// When this flag is unset on a descriptor, operations using the - /// descriptor which would create, rename, delete, modify the data or - /// metadata of filesystem objects, or obtain another handle which - /// would permit any of those, shall fail with `error-code::read-only` if - /// they would otherwise succeed. - /// - /// This may only be set on directories. - mutate-directory, - } - - /// Flags determining the method of how paths are resolved. - @since(version = 0.3.0-rc-2026-01-06) - flags path-flags { - /// As long as the resolved path corresponds to a symbolic link, it is - /// expanded. - symlink-follow, - } - - /// Open flags used by `open-at`. - @since(version = 0.3.0-rc-2026-01-06) - flags open-flags { - /// Create file if it does not exist, similar to `O_CREAT` in POSIX. - create, - /// Fail if not a directory, similar to `O_DIRECTORY` in POSIX. - directory, - /// Fail if file already exists, similar to `O_EXCL` in POSIX. - exclusive, - /// Truncate file to size 0, similar to `O_TRUNC` in POSIX. - truncate, - } - - /// Number of hard links to an inode. - @since(version = 0.3.0-rc-2026-01-06) - type link-count = u64; - - /// File attributes. - /// - /// Note: This was called `filestat` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - record descriptor-stat { - /// File type. - %type: descriptor-type, - /// Number of hard links to the file. - link-count: link-count, - /// For regular files, the file size in bytes. For symbolic links, the - /// length in bytes of the pathname contained in the symbolic link. - size: filesize, - /// Last data access timestamp. - /// - /// If the `option` is none, the platform doesn't maintain an access - /// timestamp for this file. - data-access-timestamp: option, - /// Last data modification timestamp. - /// - /// If the `option` is none, the platform doesn't maintain a - /// modification timestamp for this file. - data-modification-timestamp: option, - /// Last file status-change timestamp. - /// - /// If the `option` is none, the platform doesn't maintain a - /// status-change timestamp for this file. - status-change-timestamp: option, - } - - /// When setting a timestamp, this gives the value to set it to. - @since(version = 0.3.0-rc-2026-01-06) - variant new-timestamp { - /// Leave the timestamp set to its previous value. - no-change, - /// Set the timestamp to the current time of the system clock associated - /// with the filesystem. - now, - /// Set the timestamp to the given value. - timestamp(instant), - } - - /// A directory entry. - record directory-entry { - /// The type of the file referred to by this directory entry. - %type: descriptor-type, - /// The name of the object. - name: string, - } - - /// Error codes returned by functions, similar to `errno` in POSIX. - /// Not all of these error codes are returned by the functions provided by this - /// API; some are used in higher-level library layers, and others are provided - /// merely for alignment with POSIX. - enum error-code { - /// Permission denied, similar to `EACCES` in POSIX. - access, - /// Connection already in progress, similar to `EALREADY` in POSIX. - already, - /// Bad descriptor, similar to `EBADF` in POSIX. - bad-descriptor, - /// Device or resource busy, similar to `EBUSY` in POSIX. - busy, - /// Resource deadlock would occur, similar to `EDEADLK` in POSIX. - deadlock, - /// Storage quota exceeded, similar to `EDQUOT` in POSIX. - quota, - /// File exists, similar to `EEXIST` in POSIX. - exist, - /// File too large, similar to `EFBIG` in POSIX. - file-too-large, - /// Illegal byte sequence, similar to `EILSEQ` in POSIX. - illegal-byte-sequence, - /// Operation in progress, similar to `EINPROGRESS` in POSIX. - in-progress, - /// Interrupted function, similar to `EINTR` in POSIX. - interrupted, - /// Invalid argument, similar to `EINVAL` in POSIX. - invalid, - /// I/O error, similar to `EIO` in POSIX. - io, - /// Is a directory, similar to `EISDIR` in POSIX. - is-directory, - /// Too many levels of symbolic links, similar to `ELOOP` in POSIX. - loop, - /// Too many links, similar to `EMLINK` in POSIX. - too-many-links, - /// Message too large, similar to `EMSGSIZE` in POSIX. - message-size, - /// Filename too long, similar to `ENAMETOOLONG` in POSIX. - name-too-long, - /// No such device, similar to `ENODEV` in POSIX. - no-device, - /// No such file or directory, similar to `ENOENT` in POSIX. - no-entry, - /// No locks available, similar to `ENOLCK` in POSIX. - no-lock, - /// Not enough space, similar to `ENOMEM` in POSIX. - insufficient-memory, - /// No space left on device, similar to `ENOSPC` in POSIX. - insufficient-space, - /// Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX. - not-directory, - /// Directory not empty, similar to `ENOTEMPTY` in POSIX. - not-empty, - /// State not recoverable, similar to `ENOTRECOVERABLE` in POSIX. - not-recoverable, - /// Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX. - unsupported, - /// Inappropriate I/O control operation, similar to `ENOTTY` in POSIX. - no-tty, - /// No such device or address, similar to `ENXIO` in POSIX. - no-such-device, - /// Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX. - overflow, - /// Operation not permitted, similar to `EPERM` in POSIX. - not-permitted, - /// Broken pipe, similar to `EPIPE` in POSIX. - pipe, - /// Read-only file system, similar to `EROFS` in POSIX. - read-only, - /// Invalid seek, similar to `ESPIPE` in POSIX. - invalid-seek, - /// Text file busy, similar to `ETXTBSY` in POSIX. - text-file-busy, - /// Cross-device link, similar to `EXDEV` in POSIX. - cross-device, - } - - /// File or memory access pattern advisory information. - @since(version = 0.3.0-rc-2026-01-06) - enum advice { - /// The application has no advice to give on its behavior with respect - /// to the specified data. - normal, - /// The application expects to access the specified data sequentially - /// from lower offsets to higher offsets. - sequential, - /// The application expects to access the specified data in a random - /// order. - random, - /// The application expects to access the specified data in the near - /// future. - will-need, - /// The application expects that it will not access the specified data - /// in the near future. - dont-need, - /// The application expects to access the specified data once and then - /// not reuse it thereafter. - no-reuse, - } - - /// A 128-bit hash value, split into parts because wasm doesn't have a - /// 128-bit integer type. - @since(version = 0.3.0-rc-2026-01-06) - record metadata-hash-value { - /// 64 bits of a 128-bit hash value. - lower: u64, - /// Another 64 bits of a 128-bit hash value. - upper: u64, - } - - /// A descriptor is a reference to a filesystem object, which may be a file, - /// directory, named pipe, special file, or other object on which filesystem - /// calls may be made. - @since(version = 0.3.0-rc-2026-01-06) - resource descriptor { - /// Return a stream for reading from a file. - /// - /// Multiple read, write, and append streams may be active on the same open - /// file and they do not interfere with each other. - /// - /// This function returns a `stream` which provides the data received from the - /// file, and a `future` providing additional error information in case an - /// error is encountered. - /// - /// If no error is encountered, `stream.read` on the `stream` will return - /// `read-status::closed` with no `error-context` and the future resolves to - /// the value `ok`. If an error is encountered, `stream.read` on the - /// `stream` returns `read-status::closed` with an `error-context` and the future - /// resolves to `err` with an `error-code`. - /// - /// Note: This is similar to `pread` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - read-via-stream: func(offset: filesize) -> tuple, future>>; - /// Return a stream for writing to a file, if available. - /// - /// May fail with an error-code describing why the file cannot be written. - /// - /// It is valid to write past the end of a file; the file is extended to the - /// extent of the write, with bytes between the previous end and the start of - /// the write set to zero. - /// - /// This function returns once either full contents of the stream are - /// written or an error is encountered. - /// - /// Note: This is similar to `pwrite` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - write-via-stream: async func(data: stream, offset: filesize) -> result<_, error-code>; - /// Return a stream for appending to a file, if available. - /// - /// May fail with an error-code describing why the file cannot be appended. - /// - /// This function returns once either full contents of the stream are - /// written or an error is encountered. - /// - /// Note: This is similar to `write` with `O_APPEND` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - append-via-stream: async func(data: stream) -> result<_, error-code>; - /// Provide file advisory information on a descriptor. - /// - /// This is similar to `posix_fadvise` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - advise: async func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; - /// Synchronize the data of a file to disk. - /// - /// This function succeeds with no effect if the file descriptor is not - /// opened for writing. - /// - /// Note: This is similar to `fdatasync` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - sync-data: async func() -> result<_, error-code>; - /// Get flags associated with a descriptor. - /// - /// Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX. - /// - /// Note: This returns the value that was the `fs_flags` value returned - /// from `fdstat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - get-flags: async func() -> result; - /// Get the dynamic type of a descriptor. - /// - /// Note: This returns the same value as the `type` field of the `fd-stat` - /// returned by `stat`, `stat-at` and similar. - /// - /// Note: This returns similar flags to the `st_mode & S_IFMT` value provided - /// by `fstat` in POSIX. - /// - /// Note: This returns the value that was the `fs_filetype` value returned - /// from `fdstat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - get-type: async func() -> result; - /// Adjust the size of an open file. If this increases the file's size, the - /// extra bytes are filled with zeros. - /// - /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - set-size: async func(size: filesize) -> result<_, error-code>; - /// Adjust the timestamps of an open file or directory. - /// - /// Note: This is similar to `futimens` in POSIX. - /// - /// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - set-times: async func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - /// Read directory entries from a directory. - /// - /// On filesystems where directories contain entries referring to themselves - /// and their parents, often named `.` and `..` respectively, these entries - /// are omitted. - /// - /// This always returns a new stream which starts at the beginning of the - /// directory. Multiple streams may be active on the same directory, and they - /// do not interfere with each other. - /// - /// This function returns a future, which will resolve to an error code if - /// reading full contents of the directory fails. - @since(version = 0.3.0-rc-2026-01-06) - read-directory: async func() -> tuple, future>>; - /// Synchronize the data and metadata of a file to disk. - /// - /// This function succeeds with no effect if the file descriptor is not - /// opened for writing. - /// - /// Note: This is similar to `fsync` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - sync: async func() -> result<_, error-code>; - /// Create a directory. - /// - /// Note: This is similar to `mkdirat` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - create-directory-at: async func(path: string) -> result<_, error-code>; - /// Return the attributes of an open file or directory. - /// - /// Note: This is similar to `fstat` in POSIX, except that it does not return - /// device and inode information. For testing whether two descriptors refer to - /// the same underlying filesystem object, use `is-same-object`. To obtain - /// additional data that can be used do determine whether a file has been - /// modified, use `metadata-hash`. - /// - /// Note: This was called `fd_filestat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - stat: async func() -> result; - /// Return the attributes of a file or directory. - /// - /// Note: This is similar to `fstatat` in POSIX, except that it does not - /// return device and inode information. See the `stat` description for a - /// discussion of alternatives. - /// - /// Note: This was called `path_filestat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-01-06) - stat-at: async func(path-flags: path-flags, path: string) -> result; - /// Adjust the timestamps of a file or directory. - /// - /// Note: This is similar to `utimensat` in POSIX. - /// - /// Note: This was called `path_filestat_set_times` in earlier versions of - /// WASI. - @since(version = 0.3.0-rc-2026-01-06) - set-times-at: async func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - /// Create a hard link. - /// - /// Fails with `error-code::no-entry` if the old path does not exist, - /// with `error-code::exist` if the new path already exists, and - /// `error-code::not-permitted` if the old path is not a file. - /// - /// Note: This is similar to `linkat` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - link-at: async func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - /// Open a file or directory. - /// - /// If `flags` contains `descriptor-flags::mutate-directory`, and the base - /// descriptor doesn't have `descriptor-flags::mutate-directory` set, - /// `open-at` fails with `error-code::read-only`. - /// - /// If `flags` contains `write` or `mutate-directory`, or `open-flags` - /// contains `truncate` or `create`, and the base descriptor doesn't have - /// `descriptor-flags::mutate-directory` set, `open-at` fails with - /// `error-code::read-only`. - /// - /// Note: This is similar to `openat` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - open-at: async func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; - /// Read the contents of a symbolic link. - /// - /// If the contents contain an absolute or rooted path in the underlying - /// filesystem, this function fails with `error-code::not-permitted`. - /// - /// Note: This is similar to `readlinkat` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - readlink-at: async func(path: string) -> result; - /// Remove a directory. - /// - /// Return `error-code::not-empty` if the directory is not empty. - /// - /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - remove-directory-at: async func(path: string) -> result<_, error-code>; - /// Rename a filesystem object. - /// - /// Note: This is similar to `renameat` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - rename-at: async func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - /// Create a symbolic link (also known as a "symlink"). - /// - /// If `old-path` starts with `/`, the function fails with - /// `error-code::not-permitted`. - /// - /// Note: This is similar to `symlinkat` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>; - /// Unlink a filesystem object that is not a directory. - /// - /// Return `error-code::is-directory` if the path refers to a directory. - /// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. - @since(version = 0.3.0-rc-2026-01-06) - unlink-file-at: async func(path: string) -> result<_, error-code>; - /// Test whether two descriptors refer to the same filesystem object. - /// - /// In POSIX, this corresponds to testing whether the two descriptors have the - /// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. - /// wasi-filesystem does not expose device and inode numbers, so this function - /// may be used instead. - @since(version = 0.3.0-rc-2026-01-06) - is-same-object: async func(other: borrow) -> bool; - /// Return a hash of the metadata associated with a filesystem object referred - /// to by a descriptor. - /// - /// This returns a hash of the last-modification timestamp and file size, and - /// may also include the inode number, device number, birth timestamp, and - /// other metadata fields that may change when the file is modified or - /// replaced. It may also include a secret value chosen by the - /// implementation and not otherwise exposed. - /// - /// Implementations are encouraged to provide the following properties: - /// - /// - If the file is not modified or replaced, the computed hash value should - /// usually not change. - /// - If the object is modified or replaced, the computed hash value should - /// usually change. - /// - The inputs to the hash should not be easily computable from the - /// computed hash. - /// - /// However, none of these is required. - @since(version = 0.3.0-rc-2026-01-06) - metadata-hash: async func() -> result; - /// Return a hash of the metadata associated with a filesystem object referred - /// to by a directory descriptor and a relative path. - /// - /// This performs the same hash computation as `metadata-hash`. - @since(version = 0.3.0-rc-2026-01-06) - metadata-hash-at: async func(path-flags: path-flags, path: string) -> result; - } -} - -@since(version = 0.3.0-rc-2026-01-06) -interface preopens { - @since(version = 0.3.0-rc-2026-01-06) - use types.{descriptor}; - - /// Return the set of preopened directories, and their paths. - @since(version = 0.3.0-rc-2026-01-06) - get-directories: func() -> list>; -} - -@since(version = 0.3.0-rc-2026-01-06) -world imports { - @since(version = 0.3.0-rc-2026-01-06) - import wasi:clocks/types@0.3.0-rc-2026-01-06; - @since(version = 0.3.0-rc-2026-01-06) - import wasi:clocks/system-clock@0.3.0-rc-2026-01-06; - @since(version = 0.3.0-rc-2026-01-06) - import types; - @since(version = 0.3.0-rc-2026-01-06) - import preopens; -} diff --git a/wit/deps/filesystem-0.3.0-rc-2026-02-09.wit b/wit/deps/filesystem-0.3.0-rc-2026-02-09.wit deleted file mode 100644 index 8fb83041..00000000 --- a/wit/deps/filesystem-0.3.0-rc-2026-02-09.wit +++ /dev/null @@ -1,566 +0,0 @@ -package wasi:filesystem@0.3.0-rc-2026-02-09; - -/// WASI filesystem is a filesystem API primarily intended to let users run WASI -/// programs that access their files on their existing filesystems, without -/// significant overhead. -/// -/// Paths are passed as interface-type `string`s, meaning they must consist of -/// a sequence of Unicode Scalar Values (USVs). Some filesystems may contain -/// paths which are not accessible by this API. -/// -/// The directory separator in WASI is always the forward-slash (`/`). -/// -/// All paths in WASI are relative paths, and are interpreted relative to a -/// `descriptor` referring to a base directory. If a `path` argument to any WASI -/// function starts with `/`, or if any step of resolving a `path`, including -/// `..` and symbolic link steps, reaches a directory outside of the base -/// directory, or reaches a symlink to an absolute or rooted path in the -/// underlying filesystem, the function fails with `error-code::not-permitted`. -/// -/// For more information about WASI path resolution and sandboxing, see -/// [WASI filesystem path resolution]. -/// -/// Though this package presents a portable interface modelled on POSIX, it -/// prioritizes compatibility over portability: allowing users to access their -/// files on their machine is more important than exposing a single semantics -/// across all platforms. Notably, depending on the underlying operating system -/// and file system: -/// * Paths may be case-folded or not. -/// * Deleting (unlinking) a file may fail if there are other file descriptors -/// open. -/// * Durability and atomicity of changes to underlying files when there are -/// concurrent writers. -/// -/// Users that need well-defined, portable semantics should use a key-value -/// store or a database instead. -/// -/// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md -@since(version = 0.3.0-rc-2026-02-09) -interface types { - @since(version = 0.3.0-rc-2026-02-09) - use wasi:clocks/system-clock@0.3.0-rc-2026-02-09.{instant}; - - /// File size or length of a region within a file. - @since(version = 0.3.0-rc-2026-02-09) - type filesize = u64; - - /// The type of a filesystem object referenced by a descriptor. - /// - /// Note: This was called `filetype` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - enum descriptor-type { - /// The type of the descriptor or file is unknown or is different from - /// any of the other types specified. - unknown, - /// The descriptor refers to a block device inode. - block-device, - /// The descriptor refers to a character device inode. - character-device, - /// The descriptor refers to a directory inode. - directory, - /// The descriptor refers to a named pipe. - fifo, - /// The file refers to a symbolic link inode. - symbolic-link, - /// The descriptor refers to a regular file inode. - regular-file, - /// The descriptor refers to a socket. - socket, - } - - /// Descriptor flags. - /// - /// Note: This was called `fdflags` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - flags descriptor-flags { - /// Read mode: Data can be read. - read, - /// Write mode: Data can be written to. - write, - /// Request that writes be performed according to synchronized I/O file - /// integrity completion. The data stored in the file and the file's - /// metadata are synchronized. This is similar to `O_SYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - file-integrity-sync, - /// Request that writes be performed according to synchronized I/O data - /// integrity completion. Only the data stored in the file is - /// synchronized. This is similar to `O_DSYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - data-integrity-sync, - /// Requests that reads be performed at the same level of integrity - /// requested for writes. This is similar to `O_RSYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - requested-write-sync, - /// Mutating directories mode: Directory contents may be mutated. - /// - /// When this flag is unset on a descriptor, operations using the - /// descriptor which would create, rename, delete, modify the data or - /// metadata of filesystem objects, or obtain another handle which - /// would permit any of those, shall fail with `error-code::read-only` if - /// they would otherwise succeed. - /// - /// This may only be set on directories. - mutate-directory, - } - - /// Flags determining the method of how paths are resolved. - @since(version = 0.3.0-rc-2026-02-09) - flags path-flags { - /// As long as the resolved path corresponds to a symbolic link, it is - /// expanded. - symlink-follow, - } - - /// Open flags used by `open-at`. - @since(version = 0.3.0-rc-2026-02-09) - flags open-flags { - /// Create file if it does not exist, similar to `O_CREAT` in POSIX. - create, - /// Fail if not a directory, similar to `O_DIRECTORY` in POSIX. - directory, - /// Fail if file already exists, similar to `O_EXCL` in POSIX. - exclusive, - /// Truncate file to size 0, similar to `O_TRUNC` in POSIX. - truncate, - } - - /// Number of hard links to an inode. - @since(version = 0.3.0-rc-2026-02-09) - type link-count = u64; - - /// File attributes. - /// - /// Note: This was called `filestat` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - record descriptor-stat { - /// File type. - %type: descriptor-type, - /// Number of hard links to the file. - link-count: link-count, - /// For regular files, the file size in bytes. For symbolic links, the - /// length in bytes of the pathname contained in the symbolic link. - size: filesize, - /// Last data access timestamp. - /// - /// If the `option` is none, the platform doesn't maintain an access - /// timestamp for this file. - data-access-timestamp: option, - /// Last data modification timestamp. - /// - /// If the `option` is none, the platform doesn't maintain a - /// modification timestamp for this file. - data-modification-timestamp: option, - /// Last file status-change timestamp. - /// - /// If the `option` is none, the platform doesn't maintain a - /// status-change timestamp for this file. - status-change-timestamp: option, - } - - /// When setting a timestamp, this gives the value to set it to. - @since(version = 0.3.0-rc-2026-02-09) - variant new-timestamp { - /// Leave the timestamp set to its previous value. - no-change, - /// Set the timestamp to the current time of the system clock associated - /// with the filesystem. - now, - /// Set the timestamp to the given value. - timestamp(instant), - } - - /// A directory entry. - @since(version = 0.3.0-rc-2026-02-09) - record directory-entry { - /// The type of the file referred to by this directory entry. - %type: descriptor-type, - /// The name of the object. - name: string, - } - - /// Error codes returned by functions, similar to `errno` in POSIX. - /// Not all of these error codes are returned by the functions provided by this - /// API; some are used in higher-level library layers, and others are provided - /// merely for alignment with POSIX. - @since(version = 0.3.0-rc-2026-02-09) - enum error-code { - /// Permission denied, similar to `EACCES` in POSIX. - access, - /// Connection already in progress, similar to `EALREADY` in POSIX. - already, - /// Bad descriptor, similar to `EBADF` in POSIX. - bad-descriptor, - /// Device or resource busy, similar to `EBUSY` in POSIX. - busy, - /// Resource deadlock would occur, similar to `EDEADLK` in POSIX. - deadlock, - /// Storage quota exceeded, similar to `EDQUOT` in POSIX. - quota, - /// File exists, similar to `EEXIST` in POSIX. - exist, - /// File too large, similar to `EFBIG` in POSIX. - file-too-large, - /// Illegal byte sequence, similar to `EILSEQ` in POSIX. - illegal-byte-sequence, - /// Operation in progress, similar to `EINPROGRESS` in POSIX. - in-progress, - /// Interrupted function, similar to `EINTR` in POSIX. - interrupted, - /// Invalid argument, similar to `EINVAL` in POSIX. - invalid, - /// I/O error, similar to `EIO` in POSIX. - io, - /// Is a directory, similar to `EISDIR` in POSIX. - is-directory, - /// Too many levels of symbolic links, similar to `ELOOP` in POSIX. - loop, - /// Too many links, similar to `EMLINK` in POSIX. - too-many-links, - /// Message too large, similar to `EMSGSIZE` in POSIX. - message-size, - /// Filename too long, similar to `ENAMETOOLONG` in POSIX. - name-too-long, - /// No such device, similar to `ENODEV` in POSIX. - no-device, - /// No such file or directory, similar to `ENOENT` in POSIX. - no-entry, - /// No locks available, similar to `ENOLCK` in POSIX. - no-lock, - /// Not enough space, similar to `ENOMEM` in POSIX. - insufficient-memory, - /// No space left on device, similar to `ENOSPC` in POSIX. - insufficient-space, - /// Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX. - not-directory, - /// Directory not empty, similar to `ENOTEMPTY` in POSIX. - not-empty, - /// State not recoverable, similar to `ENOTRECOVERABLE` in POSIX. - not-recoverable, - /// Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX. - unsupported, - /// Inappropriate I/O control operation, similar to `ENOTTY` in POSIX. - no-tty, - /// No such device or address, similar to `ENXIO` in POSIX. - no-such-device, - /// Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX. - overflow, - /// Operation not permitted, similar to `EPERM` in POSIX. - not-permitted, - /// Broken pipe, similar to `EPIPE` in POSIX. - pipe, - /// Read-only file system, similar to `EROFS` in POSIX. - read-only, - /// Invalid seek, similar to `ESPIPE` in POSIX. - invalid-seek, - /// Text file busy, similar to `ETXTBSY` in POSIX. - text-file-busy, - /// Cross-device link, similar to `EXDEV` in POSIX. - cross-device, - } - - /// File or memory access pattern advisory information. - @since(version = 0.3.0-rc-2026-02-09) - enum advice { - /// The application has no advice to give on its behavior with respect - /// to the specified data. - normal, - /// The application expects to access the specified data sequentially - /// from lower offsets to higher offsets. - sequential, - /// The application expects to access the specified data in a random - /// order. - random, - /// The application expects to access the specified data in the near - /// future. - will-need, - /// The application expects that it will not access the specified data - /// in the near future. - dont-need, - /// The application expects to access the specified data once and then - /// not reuse it thereafter. - no-reuse, - } - - /// A 128-bit hash value, split into parts because wasm doesn't have a - /// 128-bit integer type. - @since(version = 0.3.0-rc-2026-02-09) - record metadata-hash-value { - /// 64 bits of a 128-bit hash value. - lower: u64, - /// Another 64 bits of a 128-bit hash value. - upper: u64, - } - - /// A descriptor is a reference to a filesystem object, which may be a file, - /// directory, named pipe, special file, or other object on which filesystem - /// calls may be made. - @since(version = 0.3.0-rc-2026-02-09) - resource descriptor { - /// Return a stream for reading from a file. - /// - /// Multiple read, write, and append streams may be active on the same open - /// file and they do not interfere with each other. - /// - /// This function returns a `stream` which provides the data received from the - /// file, and a `future` providing additional error information in case an - /// error is encountered. - /// - /// If no error is encountered, `stream.read` on the `stream` will return - /// `read-status::closed` with no `error-context` and the future resolves to - /// the value `ok`. If an error is encountered, `stream.read` on the - /// `stream` returns `read-status::closed` with an `error-context` and the future - /// resolves to `err` with an `error-code`. - /// - /// Note: This is similar to `pread` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - read-via-stream: func(offset: filesize) -> tuple, future>>; - /// Return a stream for writing to a file, if available. - /// - /// May fail with an error-code describing why the file cannot be written. - /// - /// It is valid to write past the end of a file; the file is extended to the - /// extent of the write, with bytes between the previous end and the start of - /// the write set to zero. - /// - /// This function returns once either full contents of the stream are - /// written or an error is encountered. - /// - /// Note: This is similar to `pwrite` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - write-via-stream: func(data: stream, offset: filesize) -> future>; - /// Return a stream for appending to a file, if available. - /// - /// May fail with an error-code describing why the file cannot be appended. - /// - /// This function returns once either full contents of the stream are - /// written or an error is encountered. - /// - /// Note: This is similar to `write` with `O_APPEND` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - append-via-stream: func(data: stream) -> future>; - /// Provide file advisory information on a descriptor. - /// - /// This is similar to `posix_fadvise` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - advise: async func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; - /// Synchronize the data of a file to disk. - /// - /// This function succeeds with no effect if the file descriptor is not - /// opened for writing. - /// - /// Note: This is similar to `fdatasync` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - sync-data: async func() -> result<_, error-code>; - /// Get flags associated with a descriptor. - /// - /// Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX. - /// - /// Note: This returns the value that was the `fs_flags` value returned - /// from `fdstat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - get-flags: async func() -> result; - /// Get the dynamic type of a descriptor. - /// - /// Note: This returns the same value as the `type` field of the `fd-stat` - /// returned by `stat`, `stat-at` and similar. - /// - /// Note: This returns similar flags to the `st_mode & S_IFMT` value provided - /// by `fstat` in POSIX. - /// - /// Note: This returns the value that was the `fs_filetype` value returned - /// from `fdstat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - get-type: async func() -> result; - /// Adjust the size of an open file. If this increases the file's size, the - /// extra bytes are filled with zeros. - /// - /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - set-size: async func(size: filesize) -> result<_, error-code>; - /// Adjust the timestamps of an open file or directory. - /// - /// Note: This is similar to `futimens` in POSIX. - /// - /// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - set-times: async func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - /// Read directory entries from a directory. - /// - /// On filesystems where directories contain entries referring to themselves - /// and their parents, often named `.` and `..` respectively, these entries - /// are omitted. - /// - /// This always returns a new stream which starts at the beginning of the - /// directory. Multiple streams may be active on the same directory, and they - /// do not interfere with each other. - /// - /// This function returns a future, which will resolve to an error code if - /// reading full contents of the directory fails. - @since(version = 0.3.0-rc-2026-02-09) - read-directory: func() -> tuple, future>>; - /// Synchronize the data and metadata of a file to disk. - /// - /// This function succeeds with no effect if the file descriptor is not - /// opened for writing. - /// - /// Note: This is similar to `fsync` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - sync: async func() -> result<_, error-code>; - /// Create a directory. - /// - /// Note: This is similar to `mkdirat` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - create-directory-at: async func(path: string) -> result<_, error-code>; - /// Return the attributes of an open file or directory. - /// - /// Note: This is similar to `fstat` in POSIX, except that it does not return - /// device and inode information. For testing whether two descriptors refer to - /// the same underlying filesystem object, use `is-same-object`. To obtain - /// additional data that can be used do determine whether a file has been - /// modified, use `metadata-hash`. - /// - /// Note: This was called `fd_filestat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - stat: async func() -> result; - /// Return the attributes of a file or directory. - /// - /// Note: This is similar to `fstatat` in POSIX, except that it does not - /// return device and inode information. See the `stat` description for a - /// discussion of alternatives. - /// - /// Note: This was called `path_filestat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-02-09) - stat-at: async func(path-flags: path-flags, path: string) -> result; - /// Adjust the timestamps of a file or directory. - /// - /// Note: This is similar to `utimensat` in POSIX. - /// - /// Note: This was called `path_filestat_set_times` in earlier versions of - /// WASI. - @since(version = 0.3.0-rc-2026-02-09) - set-times-at: async func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - /// Create a hard link. - /// - /// Fails with `error-code::no-entry` if the old path does not exist, - /// with `error-code::exist` if the new path already exists, and - /// `error-code::not-permitted` if the old path is not a file. - /// - /// Note: This is similar to `linkat` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - link-at: async func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - /// Open a file or directory. - /// - /// If `flags` contains `descriptor-flags::mutate-directory`, and the base - /// descriptor doesn't have `descriptor-flags::mutate-directory` set, - /// `open-at` fails with `error-code::read-only`. - /// - /// If `flags` contains `write` or `mutate-directory`, or `open-flags` - /// contains `truncate` or `create`, and the base descriptor doesn't have - /// `descriptor-flags::mutate-directory` set, `open-at` fails with - /// `error-code::read-only`. - /// - /// Note: This is similar to `openat` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - open-at: async func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; - /// Read the contents of a symbolic link. - /// - /// If the contents contain an absolute or rooted path in the underlying - /// filesystem, this function fails with `error-code::not-permitted`. - /// - /// Note: This is similar to `readlinkat` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - readlink-at: async func(path: string) -> result; - /// Remove a directory. - /// - /// Return `error-code::not-empty` if the directory is not empty. - /// - /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - remove-directory-at: async func(path: string) -> result<_, error-code>; - /// Rename a filesystem object. - /// - /// Note: This is similar to `renameat` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - rename-at: async func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - /// Create a symbolic link (also known as a "symlink"). - /// - /// If `old-path` starts with `/`, the function fails with - /// `error-code::not-permitted`. - /// - /// Note: This is similar to `symlinkat` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>; - /// Unlink a filesystem object that is not a directory. - /// - /// Return `error-code::is-directory` if the path refers to a directory. - /// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. - @since(version = 0.3.0-rc-2026-02-09) - unlink-file-at: async func(path: string) -> result<_, error-code>; - /// Test whether two descriptors refer to the same filesystem object. - /// - /// In POSIX, this corresponds to testing whether the two descriptors have the - /// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. - /// wasi-filesystem does not expose device and inode numbers, so this function - /// may be used instead. - @since(version = 0.3.0-rc-2026-02-09) - is-same-object: async func(other: borrow) -> bool; - /// Return a hash of the metadata associated with a filesystem object referred - /// to by a descriptor. - /// - /// This returns a hash of the last-modification timestamp and file size, and - /// may also include the inode number, device number, birth timestamp, and - /// other metadata fields that may change when the file is modified or - /// replaced. It may also include a secret value chosen by the - /// implementation and not otherwise exposed. - /// - /// Implementations are encouraged to provide the following properties: - /// - /// - If the file is not modified or replaced, the computed hash value should - /// usually not change. - /// - If the object is modified or replaced, the computed hash value should - /// usually change. - /// - The inputs to the hash should not be easily computable from the - /// computed hash. - /// - /// However, none of these is required. - @since(version = 0.3.0-rc-2026-02-09) - metadata-hash: async func() -> result; - /// Return a hash of the metadata associated with a filesystem object referred - /// to by a directory descriptor and a relative path. - /// - /// This performs the same hash computation as `metadata-hash`. - @since(version = 0.3.0-rc-2026-02-09) - metadata-hash-at: async func(path-flags: path-flags, path: string) -> result; - } -} - -@since(version = 0.3.0-rc-2026-02-09) -interface preopens { - @since(version = 0.3.0-rc-2026-02-09) - use types.{descriptor}; - - /// Return the set of preopened directories, and their paths. - @since(version = 0.3.0-rc-2026-02-09) - get-directories: func() -> list>; -} - -@since(version = 0.3.0-rc-2026-02-09) -world imports { - @since(version = 0.3.0-rc-2026-02-09) - import wasi:clocks/types@0.3.0-rc-2026-02-09; - @since(version = 0.3.0-rc-2026-02-09) - import wasi:clocks/system-clock@0.3.0-rc-2026-02-09; - @since(version = 0.3.0-rc-2026-02-09) - import types; - @since(version = 0.3.0-rc-2026-02-09) - import preopens; -} diff --git a/wit/deps/filesystem-0.3.0/deps/clocks.wit b/wit/deps/filesystem-0.3.0/deps/clocks.wit new file mode 100644 index 00000000..2594e024 --- /dev/null +++ b/wit/deps/filesystem-0.3.0/deps/clocks.wit @@ -0,0 +1,19 @@ +package wasi:clocks@0.3.0; + +interface types { + type duration = u64; +} + +interface system-clock { + use types.{duration}; + + record instant { + seconds: s64, + nanoseconds: u32, + } + + now: func() -> instant; + + get-resolution: func() -> duration; +} + diff --git a/wit/deps/filesystem-0.3.0-rc-2026-03-15.wit b/wit/deps/filesystem-0.3.0/filesystem.wit similarity index 91% rename from wit/deps/filesystem-0.3.0-rc-2026-03-15.wit rename to wit/deps/filesystem-0.3.0/filesystem.wit index 697681f3..e4a778f3 100644 --- a/wit/deps/filesystem-0.3.0-rc-2026-03-15.wit +++ b/wit/deps/filesystem-0.3.0/filesystem.wit @@ -1,4 +1,4 @@ -package wasi:filesystem@0.3.0-rc-2026-03-15; +package wasi:filesystem@0.3.0; /// WASI filesystem is a filesystem API primarily intended to let users run WASI /// programs that access their files on their existing filesystems, without @@ -35,19 +35,19 @@ package wasi:filesystem@0.3.0-rc-2026-03-15; /// store or a database instead. /// /// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface types { - @since(version = 0.3.0-rc-2026-03-15) - use wasi:clocks/system-clock@0.3.0-rc-2026-03-15.{instant}; + @since(version = 0.3.0) + use wasi:clocks/system-clock@0.3.0.{instant}; /// File size or length of a region within a file. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type filesize = u64; /// The type of a filesystem object referenced by a descriptor. /// /// Note: This was called `filetype` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant descriptor-type { /// The descriptor refers to a block device inode. block-device, @@ -71,7 +71,7 @@ interface types { /// Descriptor flags. /// /// Note: This was called `fdflags` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) flags descriptor-flags { /// Read mode: Data can be read. read, @@ -113,7 +113,7 @@ interface types { } /// Flags determining the method of how paths are resolved. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) flags path-flags { /// As long as the resolved path corresponds to a symbolic link, it is /// expanded. @@ -121,7 +121,7 @@ interface types { } /// Open flags used by `open-at`. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) flags open-flags { /// Create file if it does not exist, similar to `O_CREAT` in POSIX. create, @@ -134,13 +134,13 @@ interface types { } /// Number of hard links to an inode. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type link-count = u64; /// File attributes. /// /// Note: This was called `filestat` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) record descriptor-stat { /// File type. %type: descriptor-type, @@ -167,7 +167,7 @@ interface types { } /// When setting a timestamp, this gives the value to set it to. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant new-timestamp { /// Leave the timestamp set to its previous value. no-change, @@ -179,7 +179,7 @@ interface types { } /// A directory entry. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) record directory-entry { /// The type of the file referred to by this directory entry. %type: descriptor-type, @@ -191,7 +191,7 @@ interface types { /// Not all of these error codes are returned by the functions provided by this /// API; some are used in higher-level library layers, and others are provided /// merely for alignment with POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant error-code { /// Permission denied, similar to `EACCES` in POSIX. access, @@ -272,7 +272,7 @@ interface types { } /// File or memory access pattern advisory information. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) enum advice { /// The application has no advice to give on its behavior with respect /// to the specified data. @@ -296,7 +296,7 @@ interface types { /// A 128-bit hash value, split into parts because wasm doesn't have a /// 128-bit integer type. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) record metadata-hash-value { /// 64 bits of a 128-bit hash value. lower: u64, @@ -307,7 +307,7 @@ interface types { /// A descriptor is a reference to a filesystem object, which may be a file, /// directory, named pipe, special file, or other object on which filesystem /// calls may be made. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) resource descriptor { /// Return a stream for reading from a file. /// @@ -325,7 +325,7 @@ interface types { /// resolves to `err` with an `error-code`. /// /// Note: This is similar to `pread` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) read-via-stream: func(offset: filesize) -> tuple, future>>; /// Return a stream for writing to a file, if available. /// @@ -339,7 +339,7 @@ interface types { /// written or an error is encountered. /// /// Note: This is similar to `pwrite` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) write-via-stream: func(data: stream, offset: filesize) -> future>; /// Return a stream for appending to a file, if available. /// @@ -349,12 +349,12 @@ interface types { /// written or an error is encountered. /// /// Note: This is similar to `write` with `O_APPEND` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) append-via-stream: func(data: stream) -> future>; /// Provide file advisory information on a descriptor. /// /// This is similar to `posix_fadvise` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) advise: async func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; /// Synchronize the data of a file to disk. /// @@ -362,7 +362,7 @@ interface types { /// opened for writing. /// /// Note: This is similar to `fdatasync` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) sync-data: async func() -> result<_, error-code>; /// Get flags associated with a descriptor. /// @@ -370,7 +370,7 @@ interface types { /// /// Note: This returns the value that was the `fs_flags` value returned /// from `fdstat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-flags: async func() -> result; /// Get the dynamic type of a descriptor. /// @@ -382,20 +382,20 @@ interface types { /// /// Note: This returns the value that was the `fs_filetype` value returned /// from `fdstat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-type: async func() -> result; /// Adjust the size of an open file. If this increases the file's size, the /// extra bytes are filled with zeros. /// /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-size: async func(size: filesize) -> result<_, error-code>; /// Adjust the timestamps of an open file or directory. /// /// Note: This is similar to `futimens` in POSIX. /// /// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-times: async func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; /// Read directory entries from a directory. /// @@ -409,7 +409,7 @@ interface types { /// /// This function returns a future, which will resolve to an error code if /// reading full contents of the directory fails. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) read-directory: func() -> tuple, future>>; /// Synchronize the data and metadata of a file to disk. /// @@ -417,12 +417,12 @@ interface types { /// opened for writing. /// /// Note: This is similar to `fsync` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) sync: async func() -> result<_, error-code>; /// Create a directory. /// /// Note: This is similar to `mkdirat` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) create-directory-at: async func(path: string) -> result<_, error-code>; /// Return the attributes of an open file or directory. /// @@ -433,7 +433,7 @@ interface types { /// modified, use `metadata-hash`. /// /// Note: This was called `fd_filestat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) stat: async func() -> result; /// Return the attributes of a file or directory. /// @@ -442,7 +442,7 @@ interface types { /// discussion of alternatives. /// /// Note: This was called `path_filestat_get` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) stat-at: async func(path-flags: path-flags, path: string) -> result; /// Adjust the timestamps of a file or directory. /// @@ -450,7 +450,7 @@ interface types { /// /// Note: This was called `path_filestat_set_times` in earlier versions of /// WASI. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-times-at: async func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; /// Create a hard link. /// @@ -459,7 +459,7 @@ interface types { /// `error-code::not-permitted` if the old path is not a file. /// /// Note: This is similar to `linkat` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) link-at: async func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; /// Open a file or directory. /// @@ -473,7 +473,7 @@ interface types { /// `error-code::read-only`. /// /// Note: This is similar to `openat` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) open-at: async func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; /// Read the contents of a symbolic link. /// @@ -481,19 +481,19 @@ interface types { /// filesystem, this function fails with `error-code::not-permitted`. /// /// Note: This is similar to `readlinkat` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) readlink-at: async func(path: string) -> result; /// Remove a directory. /// /// Return `error-code::not-empty` if the directory is not empty. /// /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) remove-directory-at: async func(path: string) -> result<_, error-code>; /// Rename a filesystem object. /// /// Note: This is similar to `renameat` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) rename-at: async func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; /// Create a symbolic link (also known as a "symlink"). /// @@ -501,7 +501,7 @@ interface types { /// `error-code::not-permitted`. /// /// Note: This is similar to `symlinkat` in POSIX. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>; /// Unlink a filesystem object that is not a directory. /// @@ -512,7 +512,7 @@ interface types { /// If the filesystem object is a directory, `error-code::access` or /// `error-code::is-directory` may be returned instead of the /// POSIX-specified `error-code::not-permitted`. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) unlink-file-at: async func(path: string) -> result<_, error-code>; /// Test whether two descriptors refer to the same filesystem object. /// @@ -520,7 +520,7 @@ interface types { /// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. /// wasi-filesystem does not expose device and inode numbers, so this function /// may be used instead. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) is-same-object: async func(other: borrow) -> bool; /// Return a hash of the metadata associated with a filesystem object referred /// to by a descriptor. @@ -541,35 +541,35 @@ interface types { /// computed hash. /// /// However, none of these is required. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) metadata-hash: async func() -> result; /// Return a hash of the metadata associated with a filesystem object referred /// to by a directory descriptor and a relative path. /// /// This performs the same hash computation as `metadata-hash`. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) metadata-hash-at: async func(path-flags: path-flags, path: string) -> result; } } -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface preopens { - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) use types.{descriptor}; /// Return the set of preopened directories, and their paths. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-directories: func() -> list>; } -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) world imports { - @since(version = 0.3.0-rc-2026-03-15) - import wasi:clocks/types@0.3.0-rc-2026-03-15; - @since(version = 0.3.0-rc-2026-03-15) - import wasi:clocks/system-clock@0.3.0-rc-2026-03-15; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) + import wasi:clocks/types@0.3.0; + @since(version = 0.3.0) + import wasi:clocks/system-clock@0.3.0; + @since(version = 0.3.0) import types; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import preopens; } diff --git a/wit/deps/http/handler.wit b/wit/deps/http-0.2.0/handler.wit similarity index 100% rename from wit/deps/http/handler.wit rename to wit/deps/http-0.2.0/handler.wit diff --git a/wit/deps/http/proxy.wit b/wit/deps/http-0.2.0/proxy.wit similarity index 100% rename from wit/deps/http/proxy.wit rename to wit/deps/http-0.2.0/proxy.wit diff --git a/wit/deps/http/types.wit b/wit/deps/http-0.2.0/types.wit similarity index 100% rename from wit/deps/http/types.wit rename to wit/deps/http-0.2.0/types.wit diff --git a/wit/deps/http-0.3.0-rc-2026-01-06.wit b/wit/deps/http-0.3.0-rc-2026-01-06.wit deleted file mode 100644 index 3860af76..00000000 --- a/wit/deps/http-0.3.0-rc-2026-01-06.wit +++ /dev/null @@ -1,457 +0,0 @@ -package wasi:http@0.3.0-rc-2026-01-06; - -/// This interface defines all of the types and methods for implementing HTTP -/// Requests and Responses, as well as their headers, trailers, and bodies. -interface types { - use wasi:clocks/types@0.3.0-rc-2026-01-06.{duration}; - - /// This type corresponds to HTTP standard Methods. - variant method { - get, - head, - post, - put, - delete, - connect, - options, - trace, - patch, - other(string), - } - - /// This type corresponds to HTTP standard Related Schemes. - variant scheme { - HTTP, - HTTPS, - other(string), - } - - /// Defines the case payload type for `DNS-error` above: - record DNS-error-payload { - rcode: option, - info-code: option, - } - - /// Defines the case payload type for `TLS-alert-received` above: - record TLS-alert-received-payload { - alert-id: option, - alert-message: option, - } - - /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: - record field-size-payload { - field-name: option, - field-size: option, - } - - /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// - variant error-code { - DNS-timeout, - DNS-error(DNS-error-payload), - destination-not-found, - destination-unavailable, - destination-IP-prohibited, - destination-IP-unroutable, - connection-refused, - connection-terminated, - connection-timeout, - connection-read-timeout, - connection-write-timeout, - connection-limit-reached, - TLS-protocol-error, - TLS-certificate-error, - TLS-alert-received(TLS-alert-received-payload), - HTTP-request-denied, - HTTP-request-length-required, - HTTP-request-body-size(option), - HTTP-request-method-invalid, - HTTP-request-URI-invalid, - HTTP-request-URI-too-long, - HTTP-request-header-section-size(option), - HTTP-request-header-size(option), - HTTP-request-trailer-section-size(option), - HTTP-request-trailer-size(field-size-payload), - HTTP-response-incomplete, - HTTP-response-header-section-size(option), - HTTP-response-header-size(field-size-payload), - HTTP-response-body-size(option), - HTTP-response-trailer-section-size(option), - HTTP-response-trailer-size(field-size-payload), - HTTP-response-transfer-coding(option), - HTTP-response-content-coding(option), - HTTP-response-timeout, - HTTP-upgrade-failed, - HTTP-protocol-error, - loop-detected, - configuration-error, - /// This is a catch-all error for anything that doesn't fit cleanly into a - /// more specific case. It also includes an optional string for an - /// unstructured description of the error. Users should not depend on the - /// string for diagnosing errors, as it's not required to be consistent - /// between implementations. - internal-error(option), - } - - /// This type enumerates the different kinds of errors that may occur when - /// setting or appending to a `fields` resource. - variant header-error { - /// This error indicates that a `field-name` or `field-value` was - /// syntactically invalid when used with an operation that sets headers in a - /// `fields`. - invalid-syntax, - /// This error indicates that a forbidden `field-name` was used when trying - /// to set a header in a `fields`. - forbidden, - /// This error indicates that the operation on the `fields` was not - /// permitted because the fields are immutable. - immutable, - } - - /// This type enumerates the different kinds of errors that may occur when - /// setting fields of a `request-options` resource. - variant request-options-error { - /// Indicates the specified field is not supported by this implementation. - not-supported, - /// Indicates that the operation on the `request-options` was not permitted - /// because it is immutable. - immutable, - } - - /// Field names are always strings. - /// - /// Field names should always be treated as case insensitive by the `fields` - /// resource for the purposes of equality checking. - type field-name = string; - - /// Field values should always be ASCII strings. However, in - /// reality, HTTP implementations often have to interpret malformed values, - /// so they are provided as a list of bytes. - type field-value = list; - - /// This following block defines the `fields` resource which corresponds to - /// HTTP standard Fields. Fields are a common representation used for both - /// Headers and Trailers. - /// - /// A `fields` may be mutable or immutable. A `fields` created using the - /// constructor, `from-list`, or `clone` will be mutable, but a `fields` - /// resource given by other means (including, but not limited to, - /// `request.headers`) might be be immutable. In an immutable fields, the - /// `set`, `append`, and `delete` operations will fail with - /// `header-error.immutable`. - /// - /// A `fields` resource should store `field-name`s and `field-value`s in their - /// original casing used to construct or mutate the `fields` resource. The `fields` - /// resource should use that original casing when serializing the fields for - /// transport or when returning them from a method. - resource fields { - /// Construct an empty HTTP Fields. - /// - /// The resulting `fields` is mutable. - constructor(); - /// Construct an HTTP Fields. - /// - /// The resulting `fields` is mutable. - /// - /// The list represents each name-value pair in the Fields. Names - /// which have multiple values are represented by multiple entries in this - /// list with the same name. - /// - /// The tuple is a pair of the field name, represented as a string, and - /// Value, represented as a list of bytes. In a valid Fields, all names - /// and values are valid UTF-8 strings. However, values are not always - /// well-formed, so they are represented as a raw list of bytes. - /// - /// An error result will be returned if any header or value was - /// syntactically invalid, or if a header was forbidden. - from-list: static func(entries: list>) -> result; - /// Get all of the values corresponding to a name. If the name is not present - /// in this `fields`, an empty list is returned. However, if the name is - /// present but empty, this is represented by a list with one or more - /// empty field-values present. - get: func(name: field-name) -> list; - /// Returns `true` when the name is present in this `fields`. If the name is - /// syntactically invalid, `false` is returned. - has: func(name: field-name) -> bool; - /// Set all of the values for a name. Clears any existing values for that - /// name, if they have been set. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - set: func(name: field-name, value: list) -> result<_, header-error>; - /// Delete all values for a name. Does nothing if no values for the name - /// exist. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - delete: func(name: field-name) -> result<_, header-error>; - /// Delete all values for a name. Does nothing if no values for the name - /// exist. - /// - /// Returns all values previously corresponding to the name, if any. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - get-and-delete: func(name: field-name) -> result, header-error>; - /// Append a value for a name. Does not change or delete any existing - /// values for that name. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - append: func(name: field-name, value: field-value) -> result<_, header-error>; - /// Retrieve the full set of names and values in the Fields. Like the - /// constructor, the list represents each name-value pair. - /// - /// The outer list represents each name-value pair in the Fields. Names - /// which have multiple values are represented by multiple entries in this - /// list with the same name. - /// - /// The names and values are always returned in the original casing and in - /// the order in which they will be serialized for transport. - copy-all: func() -> list>; - /// Make a deep copy of the Fields. Equivalent in behavior to calling the - /// `fields` constructor on the return value of `copy-all`. The resulting - /// `fields` is mutable. - clone: func() -> fields; - } - - /// Headers is an alias for Fields. - type headers = fields; - - /// Trailers is an alias for Fields. - type trailers = fields; - - /// Represents an HTTP Request. - resource request { - /// Construct a new `request` with a default `method` of `GET`, and - /// `none` values for `path-with-query`, `scheme`, and `authority`. - /// - /// `headers` is the HTTP Headers for the Request. - /// - /// `contents` is the optional body content stream with `none` - /// representing a zero-length content stream. - /// Once it is closed, `trailers` future must resolve to a result. - /// If `trailers` resolves to an error, underlying connection - /// will be closed immediately. - /// - /// `options` is optional `request-options` resource to be used - /// if the request is sent over a network connection. - /// - /// It is possible to construct, or manipulate with the accessor functions - /// below, a `request` with an invalid combination of `scheme` - /// and `authority`, or `headers` which are not permitted to be sent. - /// It is the obligation of the `handler.handle` implementation - /// to reject invalid constructions of `request`. - /// - /// The returned future resolves to result of transmission of this request. - new: static func(headers: headers, contents: option>, trailers: future, error-code>>, options: option) -> tuple>>; - /// Get the Method for the Request. - get-method: func() -> method; - /// Set the Method for the Request. Fails if the string present in a - /// `method.other` argument is not a syntactically valid method. - set-method: func(method: method) -> result; - /// Get the combination of the HTTP Path and Query for the Request. When - /// `none`, this represents an empty Path and empty Query. - get-path-with-query: func() -> option; - /// Set the combination of the HTTP Path and Query for the Request. When - /// `none`, this represents an empty Path and empty Query. Fails is the - /// string given is not a syntactically valid path and query uri component. - set-path-with-query: func(path-with-query: option) -> result; - /// Get the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. - get-scheme: func() -> option; - /// Set the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. Fails if the - /// string given is not a syntactically valid uri scheme. - set-scheme: func(scheme: option) -> result; - /// Get the authority of the Request's target URI. A value of `none` may be used - /// with Related Schemes which do not require an authority. The HTTP and - /// HTTPS schemes always require an authority. - get-authority: func() -> option; - /// Set the authority of the Request's target URI. A value of `none` may be used - /// with Related Schemes which do not require an authority. The HTTP and - /// HTTPS schemes always require an authority. Fails if the string given is - /// not a syntactically valid URI authority. - set-authority: func(authority: option) -> result; - /// Get the `request-options` to be associated with this request - /// - /// The returned `request-options` resource is immutable: `set-*` operations - /// will fail if invoked. - /// - /// This `request-options` resource is a child: it must be dropped before - /// the parent `request` is dropped, or its ownership is transferred to - /// another component by e.g. `handler.handle`. - get-options: func() -> option; - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - get-headers: func() -> headers; - /// Get body of the Request. - /// - /// Stream returned by this method represents the contents of the body. - /// Once the stream is reported as closed, callers should await the returned - /// future to determine whether the body was received successfully. - /// The future will only resolve after the stream is reported as closed. - /// - /// This function takes a `res` future as a parameter, which can be used to - /// communicate an error in handling of the request. - /// - /// Note that function will move the `request`, but references to headers or - /// request options acquired from it previously will remain valid. - consume-body: static func(this: request, res: future>) -> tuple, future, error-code>>>; - } - - /// Parameters for making an HTTP Request. Each of these parameters is - /// currently an optional timeout applicable to the transport layer of the - /// HTTP protocol. - /// - /// These timeouts are separate from any the user may use to bound an - /// asynchronous call. - resource request-options { - /// Construct a default `request-options` value. - constructor(); - /// The timeout for the initial connect to the HTTP Server. - get-connect-timeout: func() -> option; - /// Set the timeout for the initial connect to the HTTP Server. An error - /// return value indicates that this timeout is not supported or that this - /// handle is immutable. - set-connect-timeout: func(duration: option) -> result<_, request-options-error>; - /// The timeout for receiving the first byte of the Response body. - get-first-byte-timeout: func() -> option; - /// Set the timeout for receiving the first byte of the Response body. An - /// error return value indicates that this timeout is not supported or that - /// this handle is immutable. - set-first-byte-timeout: func(duration: option) -> result<_, request-options-error>; - /// The timeout for receiving subsequent chunks of bytes in the Response - /// body stream. - get-between-bytes-timeout: func() -> option; - /// Set the timeout for receiving subsequent chunks of bytes in the Response - /// body stream. An error return value indicates that this timeout is not - /// supported or that this handle is immutable. - set-between-bytes-timeout: func(duration: option) -> result<_, request-options-error>; - /// Make a deep copy of the `request-options`. - /// The resulting `request-options` is mutable. - clone: func() -> request-options; - } - - /// This type corresponds to the HTTP standard Status Code. - type status-code = u16; - - /// Represents an HTTP Response. - resource response { - /// Construct a new `response`, with a default `status-code` of `200`. - /// If a different `status-code` is needed, it must be set via the - /// `set-status-code` method. - /// - /// `headers` is the HTTP Headers for the Response. - /// - /// `contents` is the optional body content stream with `none` - /// representing a zero-length content stream. - /// Once it is closed, `trailers` future must resolve to a result. - /// If `trailers` resolves to an error, underlying connection - /// will be closed immediately. - /// - /// The returned future resolves to result of transmission of this response. - new: static func(headers: headers, contents: option>, trailers: future, error-code>>) -> tuple>>; - /// Get the HTTP Status Code for the Response. - get-status-code: func() -> status-code; - /// Set the HTTP Status Code for the Response. Fails if the status-code - /// given is not a valid http status code. - set-status-code: func(status-code: status-code) -> result; - /// Get the headers associated with the Response. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - get-headers: func() -> headers; - /// Get body of the Response. - /// - /// Stream returned by this method represents the contents of the body. - /// Once the stream is reported as closed, callers should await the returned - /// future to determine whether the body was received successfully. - /// The future will only resolve after the stream is reported as closed. - /// - /// This function takes a `res` future as a parameter, which can be used to - /// communicate an error in handling of the response. - /// - /// Note that function will move the `response`, but references to headers - /// acquired from it previously will remain valid. - consume-body: static func(this: response, res: future>) -> tuple, future, error-code>>>; - } -} - -/// This interface defines a handler of HTTP Requests. -/// -/// In a `wasi:http/service` this interface is exported to respond to an -/// incoming HTTP Request with a Response. -/// -/// In `wasi:http/middleware` this interface is both exported and imported as -/// the "downstream" and "upstream" directions of the middleware chain. -interface handler { - use types.{request, response, error-code}; - - /// This function may be called with either an incoming request read from the - /// network or a request synthesized or forwarded by another component. - handle: async func(request: request) -> result; -} - -/// This interface defines an HTTP client for sending "outgoing" requests. -/// -/// Most components are expected to import this interface to provide the -/// capability to send HTTP requests to arbitrary destinations on a network. -/// -/// The type signature of `client.send` is the same as `handler.handle`. This -/// duplication is currently necessary because some Component Model tooling -/// (including WIT itself) is unable to represent a component importing two -/// instances of the same interface. A `client.send` import may be linked -/// directly to a `handler.handle` export to bypass the network. -interface client { - use types.{request, response, error-code}; - - /// This function may be used to either send an outgoing request over the - /// network or to forward it to another component. - send: async func(request: request) -> result; -} - -/// The `wasi:http/service` world captures a broad category of HTTP services -/// including web applications, API servers, and proxies. It may be `include`d -/// in more specific worlds such as `wasi:http/middleware`. -world service { - import wasi:cli/types@0.3.0-rc-2026-01-06; - import wasi:cli/stdout@0.3.0-rc-2026-01-06; - import wasi:cli/stderr@0.3.0-rc-2026-01-06; - import wasi:cli/stdin@0.3.0-rc-2026-01-06; - import wasi:clocks/types@0.3.0-rc-2026-01-06; - import types; - import client; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-01-06; - import wasi:clocks/system-clock@0.3.0-rc-2026-01-06; - @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-01-06; - import wasi:random/random@0.3.0-rc-2026-01-06; - import wasi:random/insecure@0.3.0-rc-2026-01-06; - import wasi:random/insecure-seed@0.3.0-rc-2026-01-06; - - export handler; -} -/// The `wasi:http/middleware` world captures HTTP services that forward HTTP -/// Requests to another handler. -/// -/// Components may implement this world to allow them to participate in handler -/// "chains" where a `request` flows through handlers on its way to some terminal -/// `service` and corresponding `response` flows in the opposite direction. -world middleware { - import wasi:clocks/types@0.3.0-rc-2026-01-06; - import types; - import handler; - import wasi:cli/types@0.3.0-rc-2026-01-06; - import wasi:cli/stdout@0.3.0-rc-2026-01-06; - import wasi:cli/stderr@0.3.0-rc-2026-01-06; - import wasi:cli/stdin@0.3.0-rc-2026-01-06; - import client; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-01-06; - import wasi:clocks/system-clock@0.3.0-rc-2026-01-06; - @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-01-06; - import wasi:random/random@0.3.0-rc-2026-01-06; - import wasi:random/insecure@0.3.0-rc-2026-01-06; - import wasi:random/insecure-seed@0.3.0-rc-2026-01-06; - - export handler; -} diff --git a/wit/deps/http-0.3.0-rc-2026-02-09.wit b/wit/deps/http-0.3.0-rc-2026-02-09.wit deleted file mode 100644 index 442b18ea..00000000 --- a/wit/deps/http-0.3.0-rc-2026-02-09.wit +++ /dev/null @@ -1,479 +0,0 @@ -package wasi:http@0.3.0-rc-2026-02-09; - -/// This interface defines all of the types and methods for implementing HTTP -/// Requests and Responses, as well as their headers, trailers, and bodies. -@since(version = 0.3.0-rc-2026-02-09) -interface types { - use wasi:clocks/types@0.3.0-rc-2026-02-09.{duration}; - - /// This type corresponds to HTTP standard Methods. - @since(version = 0.3.0-rc-2026-02-09) - variant method { - get, - head, - post, - put, - delete, - connect, - options, - trace, - patch, - other(string), - } - - /// This type corresponds to HTTP standard Related Schemes. - @since(version = 0.3.0-rc-2026-02-09) - variant scheme { - HTTP, - HTTPS, - other(string), - } - - /// Defines the case payload type for `DNS-error` above: - @since(version = 0.3.0-rc-2026-02-09) - record DNS-error-payload { - rcode: option, - info-code: option, - } - - /// Defines the case payload type for `TLS-alert-received` above: - @since(version = 0.3.0-rc-2026-02-09) - record TLS-alert-received-payload { - alert-id: option, - alert-message: option, - } - - /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: - @since(version = 0.3.0-rc-2026-02-09) - record field-size-payload { - field-name: option, - field-size: option, - } - - /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// - @since(version = 0.3.0-rc-2026-02-09) - variant error-code { - DNS-timeout, - DNS-error(DNS-error-payload), - destination-not-found, - destination-unavailable, - destination-IP-prohibited, - destination-IP-unroutable, - connection-refused, - connection-terminated, - connection-timeout, - connection-read-timeout, - connection-write-timeout, - connection-limit-reached, - TLS-protocol-error, - TLS-certificate-error, - TLS-alert-received(TLS-alert-received-payload), - HTTP-request-denied, - HTTP-request-length-required, - HTTP-request-body-size(option), - HTTP-request-method-invalid, - HTTP-request-URI-invalid, - HTTP-request-URI-too-long, - HTTP-request-header-section-size(option), - HTTP-request-header-size(option), - HTTP-request-trailer-section-size(option), - HTTP-request-trailer-size(field-size-payload), - HTTP-response-incomplete, - HTTP-response-header-section-size(option), - HTTP-response-header-size(field-size-payload), - HTTP-response-body-size(option), - HTTP-response-trailer-section-size(option), - HTTP-response-trailer-size(field-size-payload), - HTTP-response-transfer-coding(option), - HTTP-response-content-coding(option), - HTTP-response-timeout, - HTTP-upgrade-failed, - HTTP-protocol-error, - loop-detected, - configuration-error, - /// This is a catch-all error for anything that doesn't fit cleanly into a - /// more specific case. It also includes an optional string for an - /// unstructured description of the error. Users should not depend on the - /// string for diagnosing errors, as it's not required to be consistent - /// between implementations. - internal-error(option), - } - - /// This type enumerates the different kinds of errors that may occur when - /// setting or appending to a `fields` resource. - @since(version = 0.3.0-rc-2026-02-09) - variant header-error { - /// This error indicates that a `field-name` or `field-value` was - /// syntactically invalid when used with an operation that sets headers in a - /// `fields`. - invalid-syntax, - /// This error indicates that a forbidden `field-name` was used when trying - /// to set a header in a `fields`. - forbidden, - /// This error indicates that the operation on the `fields` was not - /// permitted because the fields are immutable. - immutable, - } - - /// This type enumerates the different kinds of errors that may occur when - /// setting fields of a `request-options` resource. - @since(version = 0.3.0-rc-2026-02-09) - variant request-options-error { - /// Indicates the specified field is not supported by this implementation. - not-supported, - /// Indicates that the operation on the `request-options` was not permitted - /// because it is immutable. - immutable, - } - - /// Field names are always strings. - /// - /// Field names should always be treated as case insensitive by the `fields` - /// resource for the purposes of equality checking. - @since(version = 0.3.0-rc-2026-02-09) - type field-name = string; - - /// Field values should always be ASCII strings. However, in - /// reality, HTTP implementations often have to interpret malformed values, - /// so they are provided as a list of bytes. - @since(version = 0.3.0-rc-2026-02-09) - type field-value = list; - - /// This following block defines the `fields` resource which corresponds to - /// HTTP standard Fields. Fields are a common representation used for both - /// Headers and Trailers. - /// - /// A `fields` may be mutable or immutable. A `fields` created using the - /// constructor, `from-list`, or `clone` will be mutable, but a `fields` - /// resource given by other means (including, but not limited to, - /// `request.headers`) might be be immutable. In an immutable fields, the - /// `set`, `append`, and `delete` operations will fail with - /// `header-error.immutable`. - /// - /// A `fields` resource should store `field-name`s and `field-value`s in their - /// original casing used to construct or mutate the `fields` resource. The `fields` - /// resource should use that original casing when serializing the fields for - /// transport or when returning them from a method. - @since(version = 0.3.0-rc-2026-02-09) - resource fields { - /// Construct an empty HTTP Fields. - /// - /// The resulting `fields` is mutable. - constructor(); - /// Construct an HTTP Fields. - /// - /// The resulting `fields` is mutable. - /// - /// The list represents each name-value pair in the Fields. Names - /// which have multiple values are represented by multiple entries in this - /// list with the same name. - /// - /// The tuple is a pair of the field name, represented as a string, and - /// Value, represented as a list of bytes. In a valid Fields, all names - /// and values are valid UTF-8 strings. However, values are not always - /// well-formed, so they are represented as a raw list of bytes. - /// - /// An error result will be returned if any header or value was - /// syntactically invalid, or if a header was forbidden. - from-list: static func(entries: list>) -> result; - /// Get all of the values corresponding to a name. If the name is not present - /// in this `fields`, an empty list is returned. However, if the name is - /// present but empty, this is represented by a list with one or more - /// empty field-values present. - get: func(name: field-name) -> list; - /// Returns `true` when the name is present in this `fields`. If the name is - /// syntactically invalid, `false` is returned. - has: func(name: field-name) -> bool; - /// Set all of the values for a name. Clears any existing values for that - /// name, if they have been set. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - set: func(name: field-name, value: list) -> result<_, header-error>; - /// Delete all values for a name. Does nothing if no values for the name - /// exist. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - delete: func(name: field-name) -> result<_, header-error>; - /// Delete all values for a name. Does nothing if no values for the name - /// exist. - /// - /// Returns all values previously corresponding to the name, if any. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - get-and-delete: func(name: field-name) -> result, header-error>; - /// Append a value for a name. Does not change or delete any existing - /// values for that name. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - append: func(name: field-name, value: field-value) -> result<_, header-error>; - /// Retrieve the full set of names and values in the Fields. Like the - /// constructor, the list represents each name-value pair. - /// - /// The outer list represents each name-value pair in the Fields. Names - /// which have multiple values are represented by multiple entries in this - /// list with the same name. - /// - /// The names and values are always returned in the original casing and in - /// the order in which they will be serialized for transport. - copy-all: func() -> list>; - /// Make a deep copy of the Fields. Equivalent in behavior to calling the - /// `fields` constructor on the return value of `copy-all`. The resulting - /// `fields` is mutable. - clone: func() -> fields; - } - - /// Headers is an alias for Fields. - @since(version = 0.3.0-rc-2026-02-09) - type headers = fields; - - /// Trailers is an alias for Fields. - @since(version = 0.3.0-rc-2026-02-09) - type trailers = fields; - - /// Represents an HTTP Request. - @since(version = 0.3.0-rc-2026-02-09) - resource request { - /// Construct a new `request` with a default `method` of `GET`, and - /// `none` values for `path-with-query`, `scheme`, and `authority`. - /// - /// `headers` is the HTTP Headers for the Request. - /// - /// `contents` is the optional body content stream with `none` - /// representing a zero-length content stream. - /// Once it is closed, `trailers` future must resolve to a result. - /// If `trailers` resolves to an error, underlying connection - /// will be closed immediately. - /// - /// `options` is optional `request-options` resource to be used - /// if the request is sent over a network connection. - /// - /// It is possible to construct, or manipulate with the accessor functions - /// below, a `request` with an invalid combination of `scheme` - /// and `authority`, or `headers` which are not permitted to be sent. - /// It is the obligation of the `handler.handle` implementation - /// to reject invalid constructions of `request`. - /// - /// The returned future resolves to result of transmission of this request. - new: static func(headers: headers, contents: option>, trailers: future, error-code>>, options: option) -> tuple>>; - /// Get the Method for the Request. - get-method: func() -> method; - /// Set the Method for the Request. Fails if the string present in a - /// `method.other` argument is not a syntactically valid method. - set-method: func(method: method) -> result; - /// Get the combination of the HTTP Path and Query for the Request. When - /// `none`, this represents an empty Path and empty Query. - get-path-with-query: func() -> option; - /// Set the combination of the HTTP Path and Query for the Request. When - /// `none`, this represents an empty Path and empty Query. Fails is the - /// string given is not a syntactically valid path and query uri component. - set-path-with-query: func(path-with-query: option) -> result; - /// Get the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. - get-scheme: func() -> option; - /// Set the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. Fails if the - /// string given is not a syntactically valid uri scheme. - set-scheme: func(scheme: option) -> result; - /// Get the authority of the Request's target URI. A value of `none` may be used - /// with Related Schemes which do not require an authority. The HTTP and - /// HTTPS schemes always require an authority. - get-authority: func() -> option; - /// Set the authority of the Request's target URI. A value of `none` may be used - /// with Related Schemes which do not require an authority. The HTTP and - /// HTTPS schemes always require an authority. Fails if the string given is - /// not a syntactically valid URI authority. - set-authority: func(authority: option) -> result; - /// Get the `request-options` to be associated with this request - /// - /// The returned `request-options` resource is immutable: `set-*` operations - /// will fail if invoked. - /// - /// This `request-options` resource is a child: it must be dropped before - /// the parent `request` is dropped, or its ownership is transferred to - /// another component by e.g. `handler.handle`. - get-options: func() -> option; - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - get-headers: func() -> headers; - /// Get body of the Request. - /// - /// Stream returned by this method represents the contents of the body. - /// Once the stream is reported as closed, callers should await the returned - /// future to determine whether the body was received successfully. - /// The future will only resolve after the stream is reported as closed. - /// - /// This function takes a `res` future as a parameter, which can be used to - /// communicate an error in handling of the request. - /// - /// Note that function will move the `request`, but references to headers or - /// request options acquired from it previously will remain valid. - consume-body: static func(this: request, res: future>) -> tuple, future, error-code>>>; - } - - /// Parameters for making an HTTP Request. Each of these parameters is - /// currently an optional timeout applicable to the transport layer of the - /// HTTP protocol. - /// - /// These timeouts are separate from any the user may use to bound an - /// asynchronous call. - @since(version = 0.3.0-rc-2026-02-09) - resource request-options { - /// Construct a default `request-options` value. - constructor(); - /// The timeout for the initial connect to the HTTP Server. - get-connect-timeout: func() -> option; - /// Set the timeout for the initial connect to the HTTP Server. An error - /// return value indicates that this timeout is not supported or that this - /// handle is immutable. - set-connect-timeout: func(duration: option) -> result<_, request-options-error>; - /// The timeout for receiving the first byte of the Response body. - get-first-byte-timeout: func() -> option; - /// Set the timeout for receiving the first byte of the Response body. An - /// error return value indicates that this timeout is not supported or that - /// this handle is immutable. - set-first-byte-timeout: func(duration: option) -> result<_, request-options-error>; - /// The timeout for receiving subsequent chunks of bytes in the Response - /// body stream. - get-between-bytes-timeout: func() -> option; - /// Set the timeout for receiving subsequent chunks of bytes in the Response - /// body stream. An error return value indicates that this timeout is not - /// supported or that this handle is immutable. - set-between-bytes-timeout: func(duration: option) -> result<_, request-options-error>; - /// Make a deep copy of the `request-options`. - /// The resulting `request-options` is mutable. - clone: func() -> request-options; - } - - /// This type corresponds to the HTTP standard Status Code. - @since(version = 0.3.0-rc-2026-02-09) - type status-code = u16; - - /// Represents an HTTP Response. - @since(version = 0.3.0-rc-2026-02-09) - resource response { - /// Construct a new `response`, with a default `status-code` of `200`. - /// If a different `status-code` is needed, it must be set via the - /// `set-status-code` method. - /// - /// `headers` is the HTTP Headers for the Response. - /// - /// `contents` is the optional body content stream with `none` - /// representing a zero-length content stream. - /// Once it is closed, `trailers` future must resolve to a result. - /// If `trailers` resolves to an error, underlying connection - /// will be closed immediately. - /// - /// The returned future resolves to result of transmission of this response. - new: static func(headers: headers, contents: option>, trailers: future, error-code>>) -> tuple>>; - /// Get the HTTP Status Code for the Response. - get-status-code: func() -> status-code; - /// Set the HTTP Status Code for the Response. Fails if the status-code - /// given is not a valid http status code. - set-status-code: func(status-code: status-code) -> result; - /// Get the headers associated with the Response. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - get-headers: func() -> headers; - /// Get body of the Response. - /// - /// Stream returned by this method represents the contents of the body. - /// Once the stream is reported as closed, callers should await the returned - /// future to determine whether the body was received successfully. - /// The future will only resolve after the stream is reported as closed. - /// - /// This function takes a `res` future as a parameter, which can be used to - /// communicate an error in handling of the response. - /// - /// Note that function will move the `response`, but references to headers - /// acquired from it previously will remain valid. - consume-body: static func(this: response, res: future>) -> tuple, future, error-code>>>; - } -} - -/// This interface defines a handler of HTTP Requests. -/// -/// In a `wasi:http/service` this interface is exported to respond to an -/// incoming HTTP Request with a Response. -/// -/// In `wasi:http/middleware` this interface is both exported and imported as -/// the "downstream" and "upstream" directions of the middleware chain. -@since(version = 0.3.0-rc-2026-02-09) -interface handler { - use types.{request, response, error-code}; - - /// This function may be called with either an incoming request read from the - /// network or a request synthesized or forwarded by another component. - handle: async func(request: request) -> result; -} - -/// This interface defines an HTTP client for sending "outgoing" requests. -/// -/// Most components are expected to import this interface to provide the -/// capability to send HTTP requests to arbitrary destinations on a network. -/// -/// The type signature of `client.send` is the same as `handler.handle`. This -/// duplication is currently necessary because some Component Model tooling -/// (including WIT itself) is unable to represent a component importing two -/// instances of the same interface. A `client.send` import may be linked -/// directly to a `handler.handle` export to bypass the network. -@since(version = 0.3.0-rc-2026-02-09) -interface client { - use types.{request, response, error-code}; - - /// This function may be used to either send an outgoing request over the - /// network or to forward it to another component. - send: async func(request: request) -> result; -} - -/// The `wasi:http/service` world captures a broad category of HTTP services -/// including web applications, API servers, and proxies. It may be `include`d -/// in more specific worlds such as `wasi:http/middleware`. -@since(version = 0.3.0-rc-2026-02-09) -world service { - import wasi:cli/types@0.3.0-rc-2026-02-09; - import wasi:cli/stdout@0.3.0-rc-2026-02-09; - import wasi:cli/stderr@0.3.0-rc-2026-02-09; - import wasi:cli/stdin@0.3.0-rc-2026-02-09; - import wasi:clocks/types@0.3.0-rc-2026-02-09; - import types; - import client; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-02-09; - import wasi:clocks/system-clock@0.3.0-rc-2026-02-09; - @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-02-09; - import wasi:random/random@0.3.0-rc-2026-02-09; - import wasi:random/insecure@0.3.0-rc-2026-02-09; - import wasi:random/insecure-seed@0.3.0-rc-2026-02-09; - - export handler; -} -/// The `wasi:http/middleware` world captures HTTP services that forward HTTP -/// Requests to another handler. -/// -/// Components may implement this world to allow them to participate in handler -/// "chains" where a `request` flows through handlers on its way to some terminal -/// `service` and corresponding `response` flows in the opposite direction. -@since(version = 0.3.0-rc-2026-02-09) -world middleware { - import wasi:clocks/types@0.3.0-rc-2026-02-09; - import types; - import handler; - import wasi:cli/types@0.3.0-rc-2026-02-09; - import wasi:cli/stdout@0.3.0-rc-2026-02-09; - import wasi:cli/stderr@0.3.0-rc-2026-02-09; - import wasi:cli/stdin@0.3.0-rc-2026-02-09; - import client; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-02-09; - import wasi:clocks/system-clock@0.3.0-rc-2026-02-09; - @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-02-09; - import wasi:random/random@0.3.0-rc-2026-02-09; - import wasi:random/insecure@0.3.0-rc-2026-02-09; - import wasi:random/insecure-seed@0.3.0-rc-2026-02-09; - - export handler; -} diff --git a/wit/deps/http-0.3.0/deps/cli.wit b/wit/deps/http-0.3.0/deps/cli.wit new file mode 100644 index 00000000..d0b02bb8 --- /dev/null +++ b/wit/deps/http-0.3.0/deps/cli.wit @@ -0,0 +1,28 @@ +package wasi:cli@0.3.0; + +interface types { + enum error-code { + io, + illegal-byte-sequence, + pipe, + } +} + +interface stdout { + use types.{error-code}; + + write-via-stream: func(data: stream) -> future>; +} + +interface stderr { + use types.{error-code}; + + write-via-stream: func(data: stream) -> future>; +} + +interface stdin { + use types.{error-code}; + + read-via-stream: func() -> tuple, future>>; +} + diff --git a/wit/deps/http-0.3.0/deps/clocks.wit b/wit/deps/http-0.3.0/deps/clocks.wit new file mode 100644 index 00000000..871adf02 --- /dev/null +++ b/wit/deps/http-0.3.0/deps/clocks.wit @@ -0,0 +1,43 @@ +package wasi:clocks@0.3.0; + +interface types { + type duration = u64; +} + +interface monotonic-clock { + use types.{duration}; + + type mark = u64; + + now: func() -> mark; + + get-resolution: func() -> duration; + + wait-until: async func(when: mark); + + wait-for: async func(how-long: duration); +} + +interface system-clock { + use types.{duration}; + + record instant { + seconds: s64, + nanoseconds: u32, + } + + now: func() -> instant; + + get-resolution: func() -> duration; +} + +interface timezone { + use system-clock.{instant}; + + iana-id: func() -> option; + + utc-offset: func(when: instant) -> option; + + to-debug-string: func() -> string; +} + diff --git a/wit/deps/http-0.3.0/deps/random.wit b/wit/deps/http-0.3.0/deps/random.wit new file mode 100644 index 00000000..f6cfb813 --- /dev/null +++ b/wit/deps/http-0.3.0/deps/random.wit @@ -0,0 +1,18 @@ +package wasi:random@0.3.0; + +interface random { + get-random-bytes: func(max-len: u64) -> list; + + get-random-u64: func() -> u64; +} + +interface insecure { + get-insecure-random-bytes: func(max-len: u64) -> list; + + get-insecure-random-u64: func() -> u64; +} + +interface insecure-seed { + get-insecure-seed: func() -> tuple; +} + diff --git a/wit/deps/http-0.3.0-rc-2026-03-15.wit b/wit/deps/http-0.3.0/http.wit similarity index 91% rename from wit/deps/http-0.3.0-rc-2026-03-15.wit rename to wit/deps/http-0.3.0/http.wit index c1c1e68e..08458f7c 100644 --- a/wit/deps/http-0.3.0-rc-2026-03-15.wit +++ b/wit/deps/http-0.3.0/http.wit @@ -1,13 +1,13 @@ -package wasi:http@0.3.0-rc-2026-03-15; +package wasi:http@0.3.0; /// This interface defines all of the types and methods for implementing HTTP /// Requests and Responses, as well as their headers, trailers, and bodies. -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface types { - use wasi:clocks/types@0.3.0-rc-2026-03-15.{duration}; + use wasi:clocks/types@0.3.0.{duration}; /// This type corresponds to HTTP standard Methods. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant method { get, head, @@ -22,7 +22,7 @@ interface types { } /// This type corresponds to HTTP standard Related Schemes. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant scheme { HTTP, HTTPS, @@ -30,21 +30,21 @@ interface types { } /// Defines the case payload type for `DNS-error` above: - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) record DNS-error-payload { rcode: option, info-code: option, } /// Defines the case payload type for `TLS-alert-received` above: - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) record TLS-alert-received-payload { alert-id: option, alert-message: option, } /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) record field-size-payload { field-name: option, field-size: option, @@ -52,7 +52,7 @@ interface types { /// These cases are inspired by the IANA HTTP Proxy Error Types: /// - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant error-code { DNS-timeout, DNS-error(DNS-error-payload), @@ -102,7 +102,7 @@ interface types { /// This type enumerates the different kinds of errors that may occur when /// setting or appending to a `fields` resource. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant header-error { /// This error indicates that a `field-name` or `field-value` was /// syntactically invalid when used with an operation that sets headers in a @@ -130,7 +130,7 @@ interface types { /// This type enumerates the different kinds of errors that may occur when /// setting fields of a `request-options` resource. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant request-options-error { /// Indicates the specified field is not supported by this implementation. not-supported, @@ -150,13 +150,13 @@ interface types { /// /// Field names should always be treated as case insensitive by the `fields` /// resource for the purposes of equality checking. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type field-name = string; /// Field values should always be ASCII strings. However, in /// reality, HTTP implementations often have to interpret malformed values, /// so they are provided as a list of bytes. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type field-value = list; /// This following block defines the `fields` resource which corresponds to @@ -178,7 +178,7 @@ interface types { /// Implementations may impose limits on individual field values and on total /// aggregate field section size. Operations that would exceed these limits /// fail with `header-error.size-exceeded` - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) resource fields { /// Construct an empty HTTP Fields. /// @@ -254,15 +254,15 @@ interface types { } /// Headers is an alias for Fields. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type headers = fields; /// Trailers is an alias for Fields. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type trailers = fields; /// Represents an HTTP Request. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) resource request { /// Construct a new `request` with a default `method` of `GET`, and /// `none` values for `path-with-query`, `scheme`, and `authority`. @@ -349,7 +349,7 @@ interface types { /// /// These timeouts are separate from any the user may use to bound an /// asynchronous call. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) resource request-options { /// Construct a default `request-options` value. constructor(); @@ -378,11 +378,11 @@ interface types { } /// This type corresponds to the HTTP standard Status Code. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type status-code = u16; /// Represents an HTTP Response. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) resource response { /// Construct a new `response`, with a default `status-code` of `200`. /// If a different `status-code` is needed, it must be set via the @@ -431,7 +431,7 @@ interface types { /// /// In `wasi:http/middleware` this interface is both exported and imported as /// the "downstream" and "upstream" directions of the middleware chain. -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface handler { use types.{request, response, error-code}; @@ -450,7 +450,7 @@ interface handler { /// (including WIT itself) is unable to represent a component importing two /// instances of the same interface. A `client.send` import may be linked /// directly to a `handler.handle` export to bypass the network. -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface client { use types.{request, response, error-code}; @@ -462,22 +462,22 @@ interface client { /// The `wasi:http/service` world captures a broad category of HTTP services /// including web applications, API servers, and proxies. It may be `include`d /// in more specific worlds such as `wasi:http/middleware`. -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) world service { - import wasi:cli/types@0.3.0-rc-2026-03-15; - import wasi:cli/stdout@0.3.0-rc-2026-03-15; - import wasi:cli/stderr@0.3.0-rc-2026-03-15; - import wasi:cli/stdin@0.3.0-rc-2026-03-15; - import wasi:clocks/types@0.3.0-rc-2026-03-15; + import wasi:cli/types@0.3.0; + import wasi:cli/stdout@0.3.0; + import wasi:cli/stderr@0.3.0; + import wasi:cli/stdin@0.3.0; + import wasi:clocks/types@0.3.0; import types; import client; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15; - import wasi:clocks/system-clock@0.3.0-rc-2026-03-15; + import wasi:clocks/monotonic-clock@0.3.0; + import wasi:clocks/system-clock@0.3.0; @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-03-15; - import wasi:random/random@0.3.0-rc-2026-03-15; - import wasi:random/insecure@0.3.0-rc-2026-03-15; - import wasi:random/insecure-seed@0.3.0-rc-2026-03-15; + import wasi:clocks/timezone@0.3.0; + import wasi:random/random@0.3.0; + import wasi:random/insecure@0.3.0; + import wasi:random/insecure-seed@0.3.0; export handler; } @@ -487,23 +487,23 @@ world service { /// Components may implement this world to allow them to participate in handler /// "chains" where a `request` flows through handlers on its way to some terminal /// `service` and corresponding `response` flows in the opposite direction. -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) world middleware { - import wasi:clocks/types@0.3.0-rc-2026-03-15; + import wasi:clocks/types@0.3.0; import types; import handler; - import wasi:cli/types@0.3.0-rc-2026-03-15; - import wasi:cli/stdout@0.3.0-rc-2026-03-15; - import wasi:cli/stderr@0.3.0-rc-2026-03-15; - import wasi:cli/stdin@0.3.0-rc-2026-03-15; + import wasi:cli/types@0.3.0; + import wasi:cli/stdout@0.3.0; + import wasi:cli/stderr@0.3.0; + import wasi:cli/stdin@0.3.0; import client; - import wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15; - import wasi:clocks/system-clock@0.3.0-rc-2026-03-15; + import wasi:clocks/monotonic-clock@0.3.0; + import wasi:clocks/system-clock@0.3.0; @unstable(feature = clocks-timezone) - import wasi:clocks/timezone@0.3.0-rc-2026-03-15; - import wasi:random/random@0.3.0-rc-2026-03-15; - import wasi:random/insecure@0.3.0-rc-2026-03-15; - import wasi:random/insecure-seed@0.3.0-rc-2026-03-15; + import wasi:clocks/timezone@0.3.0; + import wasi:random/random@0.3.0; + import wasi:random/insecure@0.3.0; + import wasi:random/insecure-seed@0.3.0; export handler; } diff --git a/wit/deps/io/error.wit b/wit/deps/io-0.2.0/error.wit similarity index 100% rename from wit/deps/io/error.wit rename to wit/deps/io-0.2.0/error.wit diff --git a/wit/deps/io/poll.wit b/wit/deps/io-0.2.0/poll.wit similarity index 100% rename from wit/deps/io/poll.wit rename to wit/deps/io-0.2.0/poll.wit diff --git a/wit/deps/io/streams.wit b/wit/deps/io-0.2.0/streams.wit similarity index 100% rename from wit/deps/io/streams.wit rename to wit/deps/io-0.2.0/streams.wit diff --git a/wit/deps/io/world.wit b/wit/deps/io-0.2.0/world.wit similarity index 100% rename from wit/deps/io/world.wit rename to wit/deps/io-0.2.0/world.wit diff --git a/wit/deps/random/insecure-seed.wit b/wit/deps/random-0.2.0/insecure-seed.wit similarity index 100% rename from wit/deps/random/insecure-seed.wit rename to wit/deps/random-0.2.0/insecure-seed.wit diff --git a/wit/deps/random/insecure.wit b/wit/deps/random-0.2.0/insecure.wit similarity index 100% rename from wit/deps/random/insecure.wit rename to wit/deps/random-0.2.0/insecure.wit diff --git a/wit/deps/random/random.wit b/wit/deps/random-0.2.0/random.wit similarity index 100% rename from wit/deps/random/random.wit rename to wit/deps/random-0.2.0/random.wit diff --git a/wit/deps/random/world.wit b/wit/deps/random-0.2.0/world.wit similarity index 100% rename from wit/deps/random/world.wit rename to wit/deps/random-0.2.0/world.wit diff --git a/wit/deps/random-0.3.0-rc-2026-01-06.wit b/wit/deps/random-0.3.0-rc-2026-01-06.wit deleted file mode 100644 index 8bb87314..00000000 --- a/wit/deps/random-0.3.0-rc-2026-01-06.wit +++ /dev/null @@ -1,92 +0,0 @@ -package wasi:random@0.3.0-rc-2026-01-06; - -/// The insecure-seed interface for seeding hash-map DoS resistance. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -@since(version = 0.3.0-rc-2026-01-06) -interface insecure-seed { - /// Return a 128-bit value that may contain a pseudo-random value. - /// - /// The returned value is not required to be computed from a CSPRNG, and may - /// even be entirely deterministic. Host implementations are encouraged to - /// provide pseudo-random values to any program exposed to - /// attacker-controlled content, to enable DoS protection built into many - /// languages' hash-map implementations. - /// - /// This function is intended to only be called once, by a source language - /// to initialize Denial Of Service (DoS) protection in its hash-map - /// implementation. - /// - /// # Expected future evolution - /// - /// This will likely be changed to a value import, to prevent it from being - /// called multiple times and potentially used for purposes other than DoS - /// protection. - @since(version = 0.3.0-rc-2026-01-06) - get-insecure-seed: func() -> tuple; -} - -/// The insecure interface for insecure pseudo-random numbers. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -@since(version = 0.3.0-rc-2026-01-06) -interface insecure { - /// Return `len` insecure pseudo-random bytes. - /// - /// This function is not cryptographically secure. Do not use it for - /// anything related to security. - /// - /// There are no requirements on the values of the returned bytes, however - /// implementations are encouraged to return evenly distributed values with - /// a long period. - @since(version = 0.3.0-rc-2026-01-06) - get-insecure-random-bytes: func(len: u64) -> list; - - /// Return an insecure pseudo-random `u64` value. - /// - /// This function returns the same type of pseudo-random data as - /// `get-insecure-random-bytes`, represented as a `u64`. - @since(version = 0.3.0-rc-2026-01-06) - get-insecure-random-u64: func() -> u64; -} - -/// WASI Random is a random data API. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -@since(version = 0.3.0-rc-2026-01-06) -interface random { - /// Return `len` cryptographically-secure random or pseudo-random bytes. - /// - /// This function must produce data at least as cryptographically secure and - /// fast as an adequately seeded cryptographically-secure pseudo-random - /// number generator (CSPRNG). It must not block, from the perspective of - /// the calling program, under any circumstances, including on the first - /// request and on requests for numbers of bytes. The returned data must - /// always be unpredictable. - /// - /// This function must always return fresh data. Deterministic environments - /// must omit this function, rather than implementing it with deterministic - /// data. - @since(version = 0.3.0-rc-2026-01-06) - get-random-bytes: func(len: u64) -> list; - - /// Return a cryptographically-secure random or pseudo-random `u64` value. - /// - /// This function returns the same type of data as `get-random-bytes`, - /// represented as a `u64`. - @since(version = 0.3.0-rc-2026-01-06) - get-random-u64: func() -> u64; -} - -@since(version = 0.3.0-rc-2026-01-06) -world imports { - @since(version = 0.3.0-rc-2026-01-06) - import random; - @since(version = 0.3.0-rc-2026-01-06) - import insecure; - @since(version = 0.3.0-rc-2026-01-06) - import insecure-seed; -} diff --git a/wit/deps/random-0.3.0-rc-2026-02-09.wit b/wit/deps/random-0.3.0-rc-2026-02-09.wit deleted file mode 100644 index 521df6e5..00000000 --- a/wit/deps/random-0.3.0-rc-2026-02-09.wit +++ /dev/null @@ -1,92 +0,0 @@ -package wasi:random@0.3.0-rc-2026-02-09; - -/// The insecure-seed interface for seeding hash-map DoS resistance. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -@since(version = 0.3.0-rc-2026-02-09) -interface insecure-seed { - /// Return a 128-bit value that may contain a pseudo-random value. - /// - /// The returned value is not required to be computed from a CSPRNG, and may - /// even be entirely deterministic. Host implementations are encouraged to - /// provide pseudo-random values to any program exposed to - /// attacker-controlled content, to enable DoS protection built into many - /// languages' hash-map implementations. - /// - /// This function is intended to only be called once, by a source language - /// to initialize Denial Of Service (DoS) protection in its hash-map - /// implementation. - /// - /// # Expected future evolution - /// - /// This will likely be changed to a value import, to prevent it from being - /// called multiple times and potentially used for purposes other than DoS - /// protection. - @since(version = 0.3.0-rc-2026-02-09) - get-insecure-seed: func() -> tuple; -} - -/// The insecure interface for insecure pseudo-random numbers. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -@since(version = 0.3.0-rc-2026-02-09) -interface insecure { - /// Return `len` insecure pseudo-random bytes. - /// - /// This function is not cryptographically secure. Do not use it for - /// anything related to security. - /// - /// There are no requirements on the values of the returned bytes, however - /// implementations are encouraged to return evenly distributed values with - /// a long period. - @since(version = 0.3.0-rc-2026-02-09) - get-insecure-random-bytes: func(len: u64) -> list; - - /// Return an insecure pseudo-random `u64` value. - /// - /// This function returns the same type of pseudo-random data as - /// `get-insecure-random-bytes`, represented as a `u64`. - @since(version = 0.3.0-rc-2026-02-09) - get-insecure-random-u64: func() -> u64; -} - -/// WASI Random is a random data API. -/// -/// It is intended to be portable at least between Unix-family platforms and -/// Windows. -@since(version = 0.3.0-rc-2026-02-09) -interface random { - /// Return `len` cryptographically-secure random or pseudo-random bytes. - /// - /// This function must produce data at least as cryptographically secure and - /// fast as an adequately seeded cryptographically-secure pseudo-random - /// number generator (CSPRNG). It must not block, from the perspective of - /// the calling program, under any circumstances, including on the first - /// request and on requests for numbers of bytes. The returned data must - /// always be unpredictable. - /// - /// This function must always return fresh data. Deterministic environments - /// must omit this function, rather than implementing it with deterministic - /// data. - @since(version = 0.3.0-rc-2026-02-09) - get-random-bytes: func(len: u64) -> list; - - /// Return a cryptographically-secure random or pseudo-random `u64` value. - /// - /// This function returns the same type of data as `get-random-bytes`, - /// represented as a `u64`. - @since(version = 0.3.0-rc-2026-02-09) - get-random-u64: func() -> u64; -} - -@since(version = 0.3.0-rc-2026-02-09) -world imports { - @since(version = 0.3.0-rc-2026-02-09) - import random; - @since(version = 0.3.0-rc-2026-02-09) - import insecure; - @since(version = 0.3.0-rc-2026-02-09) - import insecure-seed; -} diff --git a/wit/deps/random-0.3.0-rc-2026-03-15.wit b/wit/deps/random-0.3.0/random.wit similarity index 88% rename from wit/deps/random-0.3.0-rc-2026-03-15.wit rename to wit/deps/random-0.3.0/random.wit index 026f44a1..0b9a55fc 100644 --- a/wit/deps/random-0.3.0-rc-2026-03-15.wit +++ b/wit/deps/random-0.3.0/random.wit @@ -1,10 +1,10 @@ -package wasi:random@0.3.0-rc-2026-03-15; +package wasi:random@0.3.0; /// The insecure-seed interface for seeding hash-map DoS resistance. /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface insecure-seed { /// Return a 128-bit value that may contain a pseudo-random value. /// @@ -23,7 +23,7 @@ interface insecure-seed { /// This will likely be changed to a value import, to prevent it from being /// called multiple times and potentially used for purposes other than DoS /// protection. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-insecure-seed: func() -> tuple; } @@ -31,7 +31,7 @@ interface insecure-seed { /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface insecure { /// Return up to `max-len` insecure pseudo-random bytes. /// @@ -48,14 +48,14 @@ interface insecure { /// Implementations MUST return at least 1 byte when `max-len` is greater /// than zero. When `max-len` is zero, implementations MUST return an empty /// list without trapping. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-insecure-random-bytes: func(max-len: u64) -> list; /// Return an insecure pseudo-random `u64` value. /// /// This function returns the same type of pseudo-random data as /// `get-insecure-random-bytes`, represented as a `u64`. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-insecure-random-u64: func() -> u64; } @@ -63,7 +63,7 @@ interface insecure { /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface random { /// Return up to `max-len` cryptographically-secure random or pseudo-random /// bytes. @@ -85,23 +85,23 @@ interface random { /// This function must always return fresh data. Deterministic environments /// must omit this function, rather than implementing it with deterministic /// data. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-random-bytes: func(max-len: u64) -> list; /// Return a cryptographically-secure random or pseudo-random `u64` value. /// /// This function returns the same type of data as `get-random-bytes`, /// represented as a `u64`. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-random-u64: func() -> u64; } -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) world imports { - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import random; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import insecure; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import insecure-seed; } diff --git a/wit/deps/sockets/instance-network.wit b/wit/deps/sockets-0.2.0/instance-network.wit similarity index 100% rename from wit/deps/sockets/instance-network.wit rename to wit/deps/sockets-0.2.0/instance-network.wit diff --git a/wit/deps/sockets/ip-name-lookup.wit b/wit/deps/sockets-0.2.0/ip-name-lookup.wit similarity index 100% rename from wit/deps/sockets/ip-name-lookup.wit rename to wit/deps/sockets-0.2.0/ip-name-lookup.wit diff --git a/wit/deps/sockets/network.wit b/wit/deps/sockets-0.2.0/network.wit similarity index 100% rename from wit/deps/sockets/network.wit rename to wit/deps/sockets-0.2.0/network.wit diff --git a/wit/deps/sockets/tcp-create-socket.wit b/wit/deps/sockets-0.2.0/tcp-create-socket.wit similarity index 100% rename from wit/deps/sockets/tcp-create-socket.wit rename to wit/deps/sockets-0.2.0/tcp-create-socket.wit diff --git a/wit/deps/sockets/tcp.wit b/wit/deps/sockets-0.2.0/tcp.wit similarity index 100% rename from wit/deps/sockets/tcp.wit rename to wit/deps/sockets-0.2.0/tcp.wit diff --git a/wit/deps/sockets/udp-create-socket.wit b/wit/deps/sockets-0.2.0/udp-create-socket.wit similarity index 100% rename from wit/deps/sockets/udp-create-socket.wit rename to wit/deps/sockets-0.2.0/udp-create-socket.wit diff --git a/wit/deps/sockets/udp.wit b/wit/deps/sockets-0.2.0/udp.wit similarity index 100% rename from wit/deps/sockets/udp.wit rename to wit/deps/sockets-0.2.0/udp.wit diff --git a/wit/deps/sockets/world.wit b/wit/deps/sockets-0.2.0/world.wit similarity index 100% rename from wit/deps/sockets/world.wit rename to wit/deps/sockets-0.2.0/world.wit diff --git a/wit/deps/sockets-0.3.0-rc-2026-01-06.wit b/wit/deps/sockets-0.3.0-rc-2026-01-06.wit deleted file mode 100644 index d7ebe150..00000000 --- a/wit/deps/sockets-0.3.0-rc-2026-01-06.wit +++ /dev/null @@ -1,752 +0,0 @@ -package wasi:sockets@0.3.0-rc-2026-01-06; - -@since(version = 0.3.0-rc-2026-01-06) -interface types { - @since(version = 0.3.0-rc-2026-01-06) - use wasi:clocks/types@0.3.0-rc-2026-01-06.{duration}; - - /// Error codes. - /// - /// In theory, every API can return any error code. - /// In practice, API's typically only return the errors documented per API - /// combined with a couple of errors that are always possible: - /// - `unknown` - /// - `access-denied` - /// - `not-supported` - /// - `out-of-memory` - /// - /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. - @since(version = 0.3.0-rc-2026-01-06) - enum error-code { - /// Unknown error - unknown, - /// Access denied. - /// - /// POSIX equivalent: EACCES, EPERM - access-denied, - /// The operation is not supported. - /// - /// POSIX equivalent: EOPNOTSUPP - not-supported, - /// One of the arguments is invalid. - /// - /// POSIX equivalent: EINVAL - invalid-argument, - /// Not enough memory to complete the operation. - /// - /// POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY - out-of-memory, - /// The operation timed out before it could finish completely. - timeout, - /// The operation is not valid in the socket's current state. - invalid-state, - /// A bind operation failed because the provided address is not an address that the `network` can bind to. - address-not-bindable, - /// A bind operation failed because the provided address is already in use or because there are no ephemeral ports available. - address-in-use, - /// The remote address is not reachable - remote-unreachable, - /// The TCP connection was forcefully rejected - connection-refused, - /// The TCP connection was reset. - connection-reset, - /// A TCP connection was aborted. - connection-aborted, - /// The size of a datagram sent to a UDP socket exceeded the maximum - /// supported size. - datagram-too-large, - } - - @since(version = 0.3.0-rc-2026-01-06) - enum ip-address-family { - /// Similar to `AF_INET` in POSIX. - ipv4, - /// Similar to `AF_INET6` in POSIX. - ipv6, - } - - @since(version = 0.3.0-rc-2026-01-06) - type ipv4-address = tuple; - - @since(version = 0.3.0-rc-2026-01-06) - type ipv6-address = tuple; - - @since(version = 0.3.0-rc-2026-01-06) - variant ip-address { - ipv4(ipv4-address), - ipv6(ipv6-address), - } - - @since(version = 0.3.0-rc-2026-01-06) - record ipv4-socket-address { - /// sin_port - port: u16, - /// sin_addr - address: ipv4-address, - } - - @since(version = 0.3.0-rc-2026-01-06) - record ipv6-socket-address { - /// sin6_port - port: u16, - /// sin6_flowinfo - flow-info: u32, - /// sin6_addr - address: ipv6-address, - /// sin6_scope_id - scope-id: u32, - } - - @since(version = 0.3.0-rc-2026-01-06) - variant ip-socket-address { - ipv4(ipv4-socket-address), - ipv6(ipv6-socket-address), - } - - /// A TCP socket resource. - /// - /// The socket can be in one of the following states: - /// - `unbound` - /// - `bound` (See note below) - /// - `listening` - /// - `connecting` - /// - `connected` - /// - `closed` - /// See - /// for more information. - /// - /// Note: Except where explicitly mentioned, whenever this documentation uses - /// the term "bound" without backticks it actually means: in the `bound` state *or higher*. - /// (i.e. `bound`, `listening`, `connecting` or `connected`) - /// - /// In addition to the general error codes documented on the - /// `types::error-code` type, TCP socket methods may always return - /// `error(invalid-state)` when in the `closed` state. - @since(version = 0.3.0-rc-2026-01-06) - resource tcp-socket { - /// Create a new TCP socket. - /// - /// Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX. - /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. - /// - /// Unlike POSIX, WASI sockets have no notion of a socket-level - /// `O_NONBLOCK` flag. Instead they fully rely on the Component Model's - /// async support. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - create: static func(address-family: ip-address-family) -> result; - /// Bind the socket to the provided IP address and port. - /// - /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which - /// network interface(s) to bind to. - /// If the TCP/UDP port is zero, the socket will be bound to a random free port. - /// - /// Bind can be attempted multiple times on the same socket, even with - /// different arguments on each iteration. But never concurrently and - /// only as long as the previous bind failed. Once a bind succeeds, the - /// binding can't be changed anymore. - /// - /// # Typical errors - /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) - /// - `invalid-argument`: `local-address` is not a unicast address. (EINVAL) - /// - `invalid-argument`: `local-address` is an IPv4-mapped IPv6 address. (EINVAL) - /// - `invalid-state`: The socket is already bound. (EINVAL) - /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) - /// - `address-in-use`: Address is already in use. (EADDRINUSE) - /// - `address-not-bindable`: `local-address` is not an address that can be bound to. (EADDRNOTAVAIL) - /// - /// # Implementors note - /// When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT - /// state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR - /// socket option should be set implicitly on all platforms, except on Windows where this is the default behavior - /// and SO_REUSEADDR performs something different entirely. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - bind: func(local-address: ip-socket-address) -> result<_, error-code>; - /// Connect to a remote endpoint. - /// - /// On success, the socket is transitioned into the `connected` state and this function returns a connection resource. - /// - /// After a failed connection attempt, the socket will be in the `closed` - /// state and the only valid action left is to `drop` the socket. A single - /// socket can not be used to connect more than once. - /// - /// # Typical errors - /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) - /// - `invalid-argument`: `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS) - /// - `invalid-argument`: `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos) - /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows) - /// - `invalid-argument`: The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows) - /// - `invalid-state`: The socket is already in the `connecting` state. (EALREADY) - /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN) - /// - `invalid-state`: The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows) - /// - `timeout`: Connection timed out. (ETIMEDOUT) - /// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) - /// - `connection-reset`: The connection was reset. (ECONNRESET) - /// - `connection-aborted`: The connection was aborted. (ECONNABORTED) - /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - connect: async func(remote-address: ip-socket-address) -> result<_, error-code>; - /// Start listening and return a stream of new inbound connections. - /// - /// Transitions the socket into the `listening` state. This can be called - /// at most once per socket. - /// - /// If the socket is not already explicitly bound, this function will - /// implicitly bind the socket to a random free port. - /// - /// Normally, the returned sockets are bound, in the `connected` state - /// and immediately ready for I/O. Though, depending on exact timing and - /// circumstances, a newly accepted connection may already be `closed` - /// by the time the server attempts to perform its first I/O on it. This - /// is true regardless of whether the WASI implementation uses - /// "synthesized" sockets or not (see Implementors Notes below). - /// - /// The following properties are inherited from the listener socket: - /// - `address-family` - /// - `keep-alive-enabled` - /// - `keep-alive-idle-time` - /// - `keep-alive-interval` - /// - `keep-alive-count` - /// - `hop-limit` - /// - `receive-buffer-size` - /// - `send-buffer-size` - /// - /// # Typical errors - /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN, EINVAL on BSD) - /// - `invalid-state`: The socket is already in the `listening` state. - /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) - /// - /// # Implementors note - /// This method returns a single perpetual stream that should only close - /// on fatal errors (if any). Yet, the POSIX' `accept` function may also - /// return transient errors (e.g. ECONNABORTED). The exact details differ - /// per operation system. For example, the Linux manual mentions: - /// - /// > Linux accept() passes already-pending network errors on the new - /// > socket as an error code from accept(). This behavior differs from - /// > other BSD socket implementations. For reliable operation the - /// > application should detect the network errors defined for the - /// > protocol after accept() and treat them like EAGAIN by retrying. - /// > In the case of TCP/IP, these are ENETDOWN, EPROTO, ENOPROTOOPT, - /// > EHOSTDOWN, ENONET, EHOSTUNREACH, EOPNOTSUPP, and ENETUNREACH. - /// Source: https://man7.org/linux/man-pages/man2/accept.2.html - /// - /// WASI implementations have two options to handle this: - /// - Optionally log it and then skip over non-fatal errors returned by - /// `accept`. Guest code never gets to see these failures. Or: - /// - Synthesize a `tcp-socket` resource that exposes the error when - /// attempting to send or receive on it. Guest code then sees these - /// failures as regular I/O errors. - /// - /// In either case, the stream returned by this `listen` method remains - /// operational. - /// - /// # References - /// - - /// - - /// - - /// - - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - listen: func() -> result, error-code>; - /// Transmit data to peer. - /// - /// The caller should close the stream when it has no more data to send - /// to the peer. Under normal circumstances this will cause a FIN packet - /// to be sent out. Closing the stream is equivalent to calling - /// `shutdown(SHUT_WR)` in POSIX. - /// - /// This function may be called at most once and returns once the full - /// contents of the stream are transmitted or an error is encountered. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) - /// - `connection-reset`: The connection was reset. (ECONNRESET) - /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - send: async func(data: stream) -> result<_, error-code>; - /// Read data from peer. - /// - /// This function returns a `stream` which provides the data received from the - /// socket, and a `future` providing additional error information in case the - /// socket is closed abnormally. - /// - /// If the socket is closed normally, `stream.read` on the `stream` will return - /// `read-status::closed` with no `error-context` and the future resolves to - /// the value `ok`. If the socket is closed abnormally, `stream.read` on the - /// `stream` returns `read-status::closed` with an `error-context` and the future - /// resolves to `err` with an `error-code`. - /// - /// `receive` is meant to be called only once per socket. If it is called more - /// than once, the subsequent calls return a new `stream` that fails as if it - /// were closed abnormally. - /// - /// If the caller is not expecting to receive any data from the peer, - /// they may drop the stream. Any data still in the receive queue - /// will be discarded. This is equivalent to calling `shutdown(SHUT_RD)` - /// in POSIX. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) - /// - `connection-reset`: The connection was reset. (ECONNRESET) - /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - receive: func() -> tuple, future>>; - /// Get the bound local address. - /// - /// POSIX mentions: - /// > If the socket has not been bound to a local name, the value - /// > stored in the object pointed to by `address` is unspecified. - /// - /// WASI is stricter and requires `get-local-address` to return `invalid-state` when the socket hasn't been bound yet. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not bound to any local address. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - get-local-address: func() -> result; - /// Get the remote address. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - get-remote-address: func() -> result; - /// Whether the socket is in the `listening` state. - /// - /// Equivalent to the SO_ACCEPTCONN socket option. - @since(version = 0.3.0-rc-2026-01-06) - get-is-listening: func() -> bool; - /// Whether this is a IPv4 or IPv6 socket. - /// - /// This is the value passed to the constructor. - /// - /// Equivalent to the SO_DOMAIN socket option. - @since(version = 0.3.0-rc-2026-01-06) - get-address-family: func() -> ip-address-family; - /// Hints the desired listen queue size. Implementations are free to ignore this. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// - /// # Typical errors - /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. - /// - `invalid-argument`: (set) The provided value was 0. - /// - `invalid-state`: (set) The socket is in the `connecting` or `connected` state. - @since(version = 0.3.0-rc-2026-01-06) - set-listen-backlog-size: func(value: u64) -> result<_, error-code>; - /// Enables or disables keepalive. - /// - /// The keepalive behavior can be adjusted using: - /// - `keep-alive-idle-time` - /// - `keep-alive-interval` - /// - `keep-alive-count` - /// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true. - /// - /// Equivalent to the SO_KEEPALIVE socket option. - @since(version = 0.3.0-rc-2026-01-06) - get-keep-alive-enabled: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; - /// Amount of time the connection has to be idle before TCP starts sending keepalive packets. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS) - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-01-06) - get-keep-alive-idle-time: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; - /// The time between keepalive packets. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the TCP_KEEPINTVL socket option. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-01-06) - get-keep-alive-interval: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-keep-alive-interval: func(value: duration) -> result<_, error-code>; - /// The maximum amount of keepalive packets TCP should send before aborting the connection. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the TCP_KEEPCNT socket option. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-01-06) - get-keep-alive-count: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-keep-alive-count: func(value: u32) -> result<_, error-code>; - /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The TTL value must be 1 or higher. - @since(version = 0.3.0-rc-2026-01-06) - get-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-hop-limit: func(value: u8) -> result<_, error-code>; - /// The kernel buffer space reserved for sends/receives on this socket. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-01-06) - get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-01-06) - get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - } - - /// A UDP socket handle. - @since(version = 0.3.0-rc-2026-01-06) - resource udp-socket { - /// Create a new UDP socket. - /// - /// Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX. - /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. - /// - /// Unlike POSIX, WASI sockets have no notion of a socket-level - /// `O_NONBLOCK` flag. Instead they fully rely on the Component Model's - /// async support. - /// - /// # References: - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - create: static func(address-family: ip-address-family) -> result; - /// Bind the socket to the provided IP address and port. - /// - /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which - /// network interface(s) to bind to. - /// If the port is zero, the socket will be bound to a random free port. - /// - /// # Typical errors - /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) - /// - `invalid-state`: The socket is already bound. (EINVAL) - /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) - /// - `address-in-use`: Address is already in use. (EADDRINUSE) - /// - `address-not-bindable`: `local-address` is not an address that can be bound to. (EADDRNOTAVAIL) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - bind: func(local-address: ip-socket-address) -> result<_, error-code>; - /// Associate this socket with a specific peer address. - /// - /// On success, the `remote-address` of the socket is updated. - /// The `local-address` may be updated as well, based on the best network - /// path to `remote-address`. If the socket was not already explicitly - /// bound, this function will implicitly bind the socket to a random - /// free port. - /// - /// When a UDP socket is "connected", the `send` and `receive` methods - /// are limited to communicating with that peer only: - /// - `send` can only be used to send to this destination. - /// - `receive` will only return datagrams sent from the provided `remote-address`. - /// - /// The name "connect" was kept to align with the existing POSIX - /// terminology. Other than that, this function only changes the local - /// socket configuration and does not generate any network traffic. - /// The peer is not aware of this "connection". - /// - /// This method may be called multiple times on the same socket to change - /// its association, but only the most recent one will be effective. - /// - /// # Typical errors - /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) - /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) - /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) - /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) - /// - /// # Implementors note - /// If the socket is already connected, some platforms (e.g. Linux) - /// require a disconnect before connecting to a different peer address. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - connect: func(remote-address: ip-socket-address) -> result<_, error-code>; - /// Dissociate this socket from its peer address. - /// - /// After calling this method, `send` & `receive` are free to communicate - /// with any address again. - /// - /// The POSIX equivalent of this is calling `connect` with an `AF_UNSPEC` address. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not connected. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - disconnect: func() -> result<_, error-code>; - /// Send a message on the socket to a particular peer. - /// - /// If the socket is connected, the peer address may be left empty. In - /// that case this is equivalent to `send` in POSIX. Otherwise it is - /// equivalent to `sendto`. - /// - /// Additionally, if the socket is connected, a `remote-address` argument - /// _may_ be provided but then it must be identical to the address - /// passed to `connect`. - /// - /// Implementations may trap if the `data` length exceeds 64 KiB. - /// - /// # Typical errors - /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) - /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) - /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) - /// - `invalid-argument`: The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `connect`. (EISCONN) - /// - `invalid-argument`: The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ) - /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - `connection-refused`: The connection was refused. (ECONNREFUSED) - /// - `datagram-too-large`: The datagram is too large. (EMSGSIZE) - /// - /// # References - /// - - /// - - /// - - /// - - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - send: async func(data: list, remote-address: option) -> result<_, error-code>; - /// Receive a message on the socket. - /// - /// On success, the return value contains a tuple of the received data - /// and the address of the sender. Theoretical maximum length of the - /// data is 64 KiB. Though in practice, it will typically be less than - /// 1500 bytes. - /// - /// If the socket is connected, the sender address is guaranteed to - /// match the remote address passed to `connect`. - /// - /// # Typical errors - /// - `invalid-state`: The socket has not been bound yet. - /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - `connection-refused`: The connection was refused. (ECONNREFUSED) - /// - /// # References - /// - - /// - - /// - - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - receive: async func() -> result, ip-socket-address>, error-code>; - /// Get the current bound address. - /// - /// POSIX mentions: - /// > If the socket has not been bound to a local name, the value - /// > stored in the object pointed to by `address` is unspecified. - /// - /// WASI is stricter and requires `get-local-address` to return `invalid-state` when the socket hasn't been bound yet. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not bound to any local address. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - get-local-address: func() -> result; - /// Get the address the socket is currently "connected" to. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not "connected" to a specific remote address. (ENOTCONN) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - get-remote-address: func() -> result; - /// Whether this is a IPv4 or IPv6 socket. - /// - /// This is the value passed to the constructor. - /// - /// Equivalent to the SO_DOMAIN socket option. - @since(version = 0.3.0-rc-2026-01-06) - get-address-family: func() -> ip-address-family; - /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The TTL value must be 1 or higher. - @since(version = 0.3.0-rc-2026-01-06) - get-unicast-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; - /// The kernel buffer space reserved for sends/receives on this socket. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-01-06) - get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-01-06) - get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-01-06) - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - } -} - -@since(version = 0.3.0-rc-2026-01-06) -interface ip-name-lookup { - @since(version = 0.3.0-rc-2026-01-06) - use types.{ip-address}; - - /// Lookup error codes. - @since(version = 0.3.0-rc-2026-01-06) - enum error-code { - /// Unknown error - unknown, - /// Access denied. - /// - /// POSIX equivalent: EACCES, EPERM - access-denied, - /// `name` is a syntactically invalid domain name or IP address. - /// - /// POSIX equivalent: EINVAL - invalid-argument, - /// Name does not exist or has no suitable associated IP addresses. - /// - /// POSIX equivalent: EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY - name-unresolvable, - /// A temporary failure in name resolution occurred. - /// - /// POSIX equivalent: EAI_AGAIN - temporary-resolver-failure, - /// A permanent failure in name resolution occurred. - /// - /// POSIX equivalent: EAI_FAIL - permanent-resolver-failure, - } - - /// Resolve an internet host name to a list of IP addresses. - /// - /// Unicode domain names are automatically converted to ASCII using IDNA encoding. - /// If the input is an IP address string, the address is parsed and returned - /// as-is without making any external requests. - /// - /// See the wasi-socket proposal README.md for a comparison with getaddrinfo. - /// - /// The results are returned in connection order preference. - /// - /// This function never succeeds with 0 results. It either fails or succeeds - /// with at least one address. Additionally, this function never returns - /// IPv4-mapped IPv6 addresses. - /// - /// The returned future will resolve to an error code in case of failure. - /// It will resolve to success once the returned stream is exhausted. - /// - /// # References: - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-01-06) - resolve-addresses: async func(name: string) -> result, error-code>; -} - -@since(version = 0.3.0-rc-2026-01-06) -world imports { - @since(version = 0.3.0-rc-2026-01-06) - import wasi:clocks/types@0.3.0-rc-2026-01-06; - @since(version = 0.3.0-rc-2026-01-06) - import types; - @since(version = 0.3.0-rc-2026-01-06) - import ip-name-lookup; -} diff --git a/wit/deps/sockets-0.3.0-rc-2026-02-09.wit b/wit/deps/sockets-0.3.0-rc-2026-02-09.wit deleted file mode 100644 index aa9d4d7f..00000000 --- a/wit/deps/sockets-0.3.0-rc-2026-02-09.wit +++ /dev/null @@ -1,758 +0,0 @@ -package wasi:sockets@0.3.0-rc-2026-02-09; - -@since(version = 0.3.0-rc-2026-02-09) -interface types { - @since(version = 0.3.0-rc-2026-02-09) - use wasi:clocks/types@0.3.0-rc-2026-02-09.{duration}; - - /// Error codes. - /// - /// In theory, every API can return any error code. - /// In practice, API's typically only return the errors documented per API - /// combined with a couple of errors that are always possible: - /// - `unknown` - /// - `access-denied` - /// - `not-supported` - /// - `out-of-memory` - /// - /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. - @since(version = 0.3.0-rc-2026-02-09) - enum error-code { - /// Unknown error - unknown, - /// Access denied. - /// - /// POSIX equivalent: EACCES, EPERM - access-denied, - /// The operation is not supported. - /// - /// POSIX equivalent: EOPNOTSUPP - not-supported, - /// One of the arguments is invalid. - /// - /// POSIX equivalent: EINVAL - invalid-argument, - /// Not enough memory to complete the operation. - /// - /// POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY - out-of-memory, - /// The operation timed out before it could finish completely. - timeout, - /// The operation is not valid in the socket's current state. - invalid-state, - /// A bind operation failed because the provided address is not an address that the `network` can bind to. - address-not-bindable, - /// A bind operation failed because the provided address is already in use or because there are no ephemeral ports available. - address-in-use, - /// The remote address is not reachable - remote-unreachable, - /// The TCP connection was forcefully rejected - connection-refused, - /// The TCP connection was reset. - connection-reset, - /// A TCP connection was aborted. - connection-aborted, - /// The size of a datagram sent to a UDP socket exceeded the maximum - /// supported size. - datagram-too-large, - } - - @since(version = 0.3.0-rc-2026-02-09) - enum ip-address-family { - /// Similar to `AF_INET` in POSIX. - ipv4, - /// Similar to `AF_INET6` in POSIX. - ipv6, - } - - @since(version = 0.3.0-rc-2026-02-09) - type ipv4-address = tuple; - - @since(version = 0.3.0-rc-2026-02-09) - type ipv6-address = tuple; - - @since(version = 0.3.0-rc-2026-02-09) - variant ip-address { - ipv4(ipv4-address), - ipv6(ipv6-address), - } - - @since(version = 0.3.0-rc-2026-02-09) - record ipv4-socket-address { - /// sin_port - port: u16, - /// sin_addr - address: ipv4-address, - } - - @since(version = 0.3.0-rc-2026-02-09) - record ipv6-socket-address { - /// sin6_port - port: u16, - /// sin6_flowinfo - flow-info: u32, - /// sin6_addr - address: ipv6-address, - /// sin6_scope_id - scope-id: u32, - } - - @since(version = 0.3.0-rc-2026-02-09) - variant ip-socket-address { - ipv4(ipv4-socket-address), - ipv6(ipv6-socket-address), - } - - /// A TCP socket resource. - /// - /// The socket can be in one of the following states: - /// - `unbound` - /// - `bound` (See note below) - /// - `listening` - /// - `connecting` - /// - `connected` - /// - `closed` - /// See - /// for more information. - /// - /// Note: Except where explicitly mentioned, whenever this documentation uses - /// the term "bound" without backticks it actually means: in the `bound` state *or higher*. - /// (i.e. `bound`, `listening`, `connecting` or `connected`) - /// - /// In addition to the general error codes documented on the - /// `types::error-code` type, TCP socket methods may always return - /// `error(invalid-state)` when in the `closed` state. - @since(version = 0.3.0-rc-2026-02-09) - resource tcp-socket { - /// Create a new TCP socket. - /// - /// Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX. - /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. - /// - /// Unlike POSIX, WASI sockets have no notion of a socket-level - /// `O_NONBLOCK` flag. Instead they fully rely on the Component Model's - /// async support. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - create: static func(address-family: ip-address-family) -> result; - /// Bind the socket to the provided IP address and port. - /// - /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which - /// network interface(s) to bind to. - /// If the TCP/UDP port is zero, the socket will be bound to a random free port. - /// - /// Bind can be attempted multiple times on the same socket, even with - /// different arguments on each iteration. But never concurrently and - /// only as long as the previous bind failed. Once a bind succeeds, the - /// binding can't be changed anymore. - /// - /// # Typical errors - /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) - /// - `invalid-argument`: `local-address` is not a unicast address. (EINVAL) - /// - `invalid-argument`: `local-address` is an IPv4-mapped IPv6 address. (EINVAL) - /// - `invalid-state`: The socket is already bound. (EINVAL) - /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) - /// - `address-in-use`: Address is already in use. (EADDRINUSE) - /// - `address-not-bindable`: `local-address` is not an address that can be bound to. (EADDRNOTAVAIL) - /// - /// # Implementors note - /// When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT - /// state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR - /// socket option should be set implicitly on all platforms, except on Windows where this is the default behavior - /// and SO_REUSEADDR performs something different entirely. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - bind: func(local-address: ip-socket-address) -> result<_, error-code>; - /// Connect to a remote endpoint. - /// - /// On success, the socket is transitioned into the `connected` state and this function returns a connection resource. - /// - /// After a failed connection attempt, the socket will be in the `closed` - /// state and the only valid action left is to `drop` the socket. A single - /// socket can not be used to connect more than once. - /// - /// # Typical errors - /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) - /// - `invalid-argument`: `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS) - /// - `invalid-argument`: `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos) - /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows) - /// - `invalid-argument`: The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows) - /// - `invalid-state`: The socket is already in the `connecting` state. (EALREADY) - /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN) - /// - `invalid-state`: The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows) - /// - `timeout`: Connection timed out. (ETIMEDOUT) - /// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) - /// - `connection-reset`: The connection was reset. (ECONNRESET) - /// - `connection-aborted`: The connection was aborted. (ECONNABORTED) - /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - connect: async func(remote-address: ip-socket-address) -> result<_, error-code>; - /// Start listening and return a stream of new inbound connections. - /// - /// Transitions the socket into the `listening` state. This can be called - /// at most once per socket. - /// - /// If the socket is not already explicitly bound, this function will - /// implicitly bind the socket to a random free port. - /// - /// Normally, the returned sockets are bound, in the `connected` state - /// and immediately ready for I/O. Though, depending on exact timing and - /// circumstances, a newly accepted connection may already be `closed` - /// by the time the server attempts to perform its first I/O on it. This - /// is true regardless of whether the WASI implementation uses - /// "synthesized" sockets or not (see Implementors Notes below). - /// - /// The following properties are inherited from the listener socket: - /// - `address-family` - /// - `keep-alive-enabled` - /// - `keep-alive-idle-time` - /// - `keep-alive-interval` - /// - `keep-alive-count` - /// - `hop-limit` - /// - `receive-buffer-size` - /// - `send-buffer-size` - /// - /// # Typical errors - /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN, EINVAL on BSD) - /// - `invalid-state`: The socket is already in the `listening` state. - /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) - /// - /// # Implementors note - /// This method returns a single perpetual stream that should only close - /// on fatal errors (if any). Yet, the POSIX' `accept` function may also - /// return transient errors (e.g. ECONNABORTED). The exact details differ - /// per operation system. For example, the Linux manual mentions: - /// - /// > Linux accept() passes already-pending network errors on the new - /// > socket as an error code from accept(). This behavior differs from - /// > other BSD socket implementations. For reliable operation the - /// > application should detect the network errors defined for the - /// > protocol after accept() and treat them like EAGAIN by retrying. - /// > In the case of TCP/IP, these are ENETDOWN, EPROTO, ENOPROTOOPT, - /// > EHOSTDOWN, ENONET, EHOSTUNREACH, EOPNOTSUPP, and ENETUNREACH. - /// Source: https://man7.org/linux/man-pages/man2/accept.2.html - /// - /// WASI implementations have two options to handle this: - /// - Optionally log it and then skip over non-fatal errors returned by - /// `accept`. Guest code never gets to see these failures. Or: - /// - Synthesize a `tcp-socket` resource that exposes the error when - /// attempting to send or receive on it. Guest code then sees these - /// failures as regular I/O errors. - /// - /// In either case, the stream returned by this `listen` method remains - /// operational. - /// - /// WASI requires `listen` to perform an implicit bind if the socket - /// has not already been bound. Not all platforms (notably Windows) - /// exhibit this behavior out of the box. On platforms that require it, - /// the WASI implementation can emulate this behavior by performing - /// the bind itself if the guest hasn't already done so. - /// - /// # References - /// - - /// - - /// - - /// - - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - listen: func() -> result, error-code>; - /// Transmit data to peer. - /// - /// The caller should close the stream when it has no more data to send - /// to the peer. Under normal circumstances this will cause a FIN packet - /// to be sent out. Closing the stream is equivalent to calling - /// `shutdown(SHUT_WR)` in POSIX. - /// - /// This function may be called at most once and returns once the full - /// contents of the stream are transmitted or an error is encountered. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) - /// - `connection-reset`: The connection was reset. (ECONNRESET) - /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - send: func(data: stream) -> future>; - /// Read data from peer. - /// - /// This function returns a `stream` which provides the data received from the - /// socket, and a `future` providing additional error information in case the - /// socket is closed abnormally. - /// - /// If the socket is closed normally, `stream.read` on the `stream` will return - /// `read-status::closed` with no `error-context` and the future resolves to - /// the value `ok`. If the socket is closed abnormally, `stream.read` on the - /// `stream` returns `read-status::closed` with an `error-context` and the future - /// resolves to `err` with an `error-code`. - /// - /// `receive` is meant to be called only once per socket. If it is called more - /// than once, the subsequent calls return a new `stream` that fails as if it - /// were closed abnormally. - /// - /// If the caller is not expecting to receive any data from the peer, - /// they may drop the stream. Any data still in the receive queue - /// will be discarded. This is equivalent to calling `shutdown(SHUT_RD)` - /// in POSIX. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) - /// - `connection-reset`: The connection was reset. (ECONNRESET) - /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - receive: func() -> tuple, future>>; - /// Get the bound local address. - /// - /// POSIX mentions: - /// > If the socket has not been bound to a local name, the value - /// > stored in the object pointed to by `address` is unspecified. - /// - /// WASI is stricter and requires `get-local-address` to return `invalid-state` when the socket hasn't been bound yet. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not bound to any local address. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - get-local-address: func() -> result; - /// Get the remote address. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - get-remote-address: func() -> result; - /// Whether the socket is in the `listening` state. - /// - /// Equivalent to the SO_ACCEPTCONN socket option. - @since(version = 0.3.0-rc-2026-02-09) - get-is-listening: func() -> bool; - /// Whether this is a IPv4 or IPv6 socket. - /// - /// This is the value passed to the constructor. - /// - /// Equivalent to the SO_DOMAIN socket option. - @since(version = 0.3.0-rc-2026-02-09) - get-address-family: func() -> ip-address-family; - /// Hints the desired listen queue size. Implementations are free to ignore this. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// - /// # Typical errors - /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. - /// - `invalid-argument`: (set) The provided value was 0. - /// - `invalid-state`: (set) The socket is in the `connecting` or `connected` state. - @since(version = 0.3.0-rc-2026-02-09) - set-listen-backlog-size: func(value: u64) -> result<_, error-code>; - /// Enables or disables keepalive. - /// - /// The keepalive behavior can be adjusted using: - /// - `keep-alive-idle-time` - /// - `keep-alive-interval` - /// - `keep-alive-count` - /// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true. - /// - /// Equivalent to the SO_KEEPALIVE socket option. - @since(version = 0.3.0-rc-2026-02-09) - get-keep-alive-enabled: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; - /// Amount of time the connection has to be idle before TCP starts sending keepalive packets. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS) - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-02-09) - get-keep-alive-idle-time: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; - /// The time between keepalive packets. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the TCP_KEEPINTVL socket option. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-02-09) - get-keep-alive-interval: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-keep-alive-interval: func(value: duration) -> result<_, error-code>; - /// The maximum amount of keepalive packets TCP should send before aborting the connection. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the TCP_KEEPCNT socket option. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-02-09) - get-keep-alive-count: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-keep-alive-count: func(value: u32) -> result<_, error-code>; - /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The TTL value must be 1 or higher. - @since(version = 0.3.0-rc-2026-02-09) - get-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-hop-limit: func(value: u8) -> result<_, error-code>; - /// The kernel buffer space reserved for sends/receives on this socket. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-02-09) - get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-02-09) - get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - } - - /// A UDP socket handle. - @since(version = 0.3.0-rc-2026-02-09) - resource udp-socket { - /// Create a new UDP socket. - /// - /// Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX. - /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. - /// - /// Unlike POSIX, WASI sockets have no notion of a socket-level - /// `O_NONBLOCK` flag. Instead they fully rely on the Component Model's - /// async support. - /// - /// # References: - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - create: static func(address-family: ip-address-family) -> result; - /// Bind the socket to the provided IP address and port. - /// - /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which - /// network interface(s) to bind to. - /// If the port is zero, the socket will be bound to a random free port. - /// - /// # Typical errors - /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) - /// - `invalid-state`: The socket is already bound. (EINVAL) - /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) - /// - `address-in-use`: Address is already in use. (EADDRINUSE) - /// - `address-not-bindable`: `local-address` is not an address that can be bound to. (EADDRNOTAVAIL) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - bind: func(local-address: ip-socket-address) -> result<_, error-code>; - /// Associate this socket with a specific peer address. - /// - /// On success, the `remote-address` of the socket is updated. - /// The `local-address` may be updated as well, based on the best network - /// path to `remote-address`. If the socket was not already explicitly - /// bound, this function will implicitly bind the socket to a random - /// free port. - /// - /// When a UDP socket is "connected", the `send` and `receive` methods - /// are limited to communicating with that peer only: - /// - `send` can only be used to send to this destination. - /// - `receive` will only return datagrams sent from the provided `remote-address`. - /// - /// The name "connect" was kept to align with the existing POSIX - /// terminology. Other than that, this function only changes the local - /// socket configuration and does not generate any network traffic. - /// The peer is not aware of this "connection". - /// - /// This method may be called multiple times on the same socket to change - /// its association, but only the most recent one will be effective. - /// - /// # Typical errors - /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) - /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) - /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) - /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) - /// - /// # Implementors note - /// If the socket is already connected, some platforms (e.g. Linux) - /// require a disconnect before connecting to a different peer address. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - connect: func(remote-address: ip-socket-address) -> result<_, error-code>; - /// Dissociate this socket from its peer address. - /// - /// After calling this method, `send` & `receive` are free to communicate - /// with any address again. - /// - /// The POSIX equivalent of this is calling `connect` with an `AF_UNSPEC` address. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not connected. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - disconnect: func() -> result<_, error-code>; - /// Send a message on the socket to a particular peer. - /// - /// If the socket is connected, the peer address may be left empty. In - /// that case this is equivalent to `send` in POSIX. Otherwise it is - /// equivalent to `sendto`. - /// - /// Additionally, if the socket is connected, a `remote-address` argument - /// _may_ be provided but then it must be identical to the address - /// passed to `connect`. - /// - /// Implementations may trap if the `data` length exceeds 64 KiB. - /// - /// # Typical errors - /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) - /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) - /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) - /// - `invalid-argument`: The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `connect`. (EISCONN) - /// - `invalid-argument`: The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ) - /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - `connection-refused`: The connection was refused. (ECONNREFUSED) - /// - `datagram-too-large`: The datagram is too large. (EMSGSIZE) - /// - /// # References - /// - - /// - - /// - - /// - - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - send: async func(data: list, remote-address: option) -> result<_, error-code>; - /// Receive a message on the socket. - /// - /// On success, the return value contains a tuple of the received data - /// and the address of the sender. Theoretical maximum length of the - /// data is 64 KiB. Though in practice, it will typically be less than - /// 1500 bytes. - /// - /// If the socket is connected, the sender address is guaranteed to - /// match the remote address passed to `connect`. - /// - /// # Typical errors - /// - `invalid-state`: The socket has not been bound yet. - /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - /// - `connection-refused`: The connection was refused. (ECONNREFUSED) - /// - /// # References - /// - - /// - - /// - - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - receive: async func() -> result, ip-socket-address>, error-code>; - /// Get the current bound address. - /// - /// POSIX mentions: - /// > If the socket has not been bound to a local name, the value - /// > stored in the object pointed to by `address` is unspecified. - /// - /// WASI is stricter and requires `get-local-address` to return `invalid-state` when the socket hasn't been bound yet. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not bound to any local address. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - get-local-address: func() -> result; - /// Get the address the socket is currently "connected" to. - /// - /// # Typical errors - /// - `invalid-state`: The socket is not "connected" to a specific remote address. (ENOTCONN) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - get-remote-address: func() -> result; - /// Whether this is a IPv4 or IPv6 socket. - /// - /// This is the value passed to the constructor. - /// - /// Equivalent to the SO_DOMAIN socket option. - @since(version = 0.3.0-rc-2026-02-09) - get-address-family: func() -> ip-address-family; - /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The TTL value must be 1 or higher. - @since(version = 0.3.0-rc-2026-02-09) - get-unicast-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; - /// The kernel buffer space reserved for sends/receives on this socket. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// Any other value will never cause an error, but it might be silently clamped and/or rounded. - /// I.e. after setting a value, reading the same setting back may return a different value. - /// - /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-02-09) - get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-02-09) - get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-02-09) - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - } -} - -@since(version = 0.3.0-rc-2026-02-09) -interface ip-name-lookup { - @since(version = 0.3.0-rc-2026-02-09) - use types.{ip-address}; - - /// Lookup error codes. - @since(version = 0.3.0-rc-2026-02-09) - enum error-code { - /// Unknown error - unknown, - /// Access denied. - /// - /// POSIX equivalent: EACCES, EPERM - access-denied, - /// `name` is a syntactically invalid domain name or IP address. - /// - /// POSIX equivalent: EINVAL - invalid-argument, - /// Name does not exist or has no suitable associated IP addresses. - /// - /// POSIX equivalent: EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY - name-unresolvable, - /// A temporary failure in name resolution occurred. - /// - /// POSIX equivalent: EAI_AGAIN - temporary-resolver-failure, - /// A permanent failure in name resolution occurred. - /// - /// POSIX equivalent: EAI_FAIL - permanent-resolver-failure, - } - - /// Resolve an internet host name to a list of IP addresses. - /// - /// Unicode domain names are automatically converted to ASCII using IDNA encoding. - /// If the input is an IP address string, the address is parsed and returned - /// as-is without making any external requests. - /// - /// See the wasi-socket proposal README.md for a comparison with getaddrinfo. - /// - /// The results are returned in connection order preference. - /// - /// This function never succeeds with 0 results. It either fails or succeeds - /// with at least one address. Additionally, this function never returns - /// IPv4-mapped IPv6 addresses. - /// - /// The returned future will resolve to an error code in case of failure. - /// It will resolve to success once the returned stream is exhausted. - /// - /// # References: - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-02-09) - resolve-addresses: async func(name: string) -> result, error-code>; -} - -@since(version = 0.3.0-rc-2026-02-09) -world imports { - @since(version = 0.3.0-rc-2026-02-09) - import wasi:clocks/types@0.3.0-rc-2026-02-09; - @since(version = 0.3.0-rc-2026-02-09) - import types; - @since(version = 0.3.0-rc-2026-02-09) - import ip-name-lookup; -} diff --git a/wit/deps/sockets-0.3.0/deps/clocks.wit b/wit/deps/sockets-0.3.0/deps/clocks.wit new file mode 100644 index 00000000..dd7eafdc --- /dev/null +++ b/wit/deps/sockets-0.3.0/deps/clocks.wit @@ -0,0 +1,6 @@ +package wasi:clocks@0.3.0; + +interface types { + type duration = u64; +} + diff --git a/wit/deps/sockets-0.3.0-rc-2026-03-15.wit b/wit/deps/sockets-0.3.0/sockets.wit similarity index 93% rename from wit/deps/sockets-0.3.0-rc-2026-03-15.wit rename to wit/deps/sockets-0.3.0/sockets.wit index cde2e4d6..0dd27a4f 100644 --- a/wit/deps/sockets-0.3.0-rc-2026-03-15.wit +++ b/wit/deps/sockets-0.3.0/sockets.wit @@ -1,9 +1,9 @@ -package wasi:sockets@0.3.0-rc-2026-03-15; +package wasi:sockets@0.3.0; -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface types { - @since(version = 0.3.0-rc-2026-03-15) - use wasi:clocks/types@0.3.0-rc-2026-03-15.{duration}; + @since(version = 0.3.0) + use wasi:clocks/types@0.3.0.{duration}; /// Error codes. /// @@ -16,7 +16,7 @@ interface types { /// - `out-of-memory` /// /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant error-code { /// Access denied. /// @@ -80,7 +80,7 @@ interface types { other(option), } - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) enum ip-address-family { /// Similar to `AF_INET` in POSIX. ipv4, @@ -88,19 +88,19 @@ interface types { ipv6, } - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type ipv4-address = tuple; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) type ipv6-address = tuple; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant ip-address { ipv4(ipv4-address), ipv6(ipv6-address), } - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) record ipv4-socket-address { /// sin_port port: u16, @@ -108,7 +108,7 @@ interface types { address: ipv4-address, } - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) record ipv6-socket-address { /// sin6_port port: u16, @@ -120,7 +120,7 @@ interface types { scope-id: u32, } - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant ip-socket-address { ipv4(ipv4-socket-address), ipv6(ipv6-socket-address), @@ -135,7 +135,7 @@ interface types { /// - `connecting` /// - `connected` /// - `closed` - /// See + /// See /// for more information. /// /// Note: Except where explicitly mentioned, whenever this documentation uses @@ -158,7 +158,7 @@ interface types { /// In addition to the general error codes documented on the /// `types::error-code` type, TCP socket methods may always return /// `error(invalid-state)` when in the `closed` state. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) resource tcp-socket { /// Create a new TCP socket. /// @@ -178,7 +178,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) create: static func(address-family: ip-address-family) -> result; /// Bind the socket to the provided IP address and port. /// @@ -213,7 +213,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) bind: func(local-address: ip-socket-address) -> result<_, error-code>; /// Connect to a remote endpoint. /// @@ -249,7 +249,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) connect: async func(remote-address: ip-socket-address) -> result<_, error-code>; /// Start listening and return a stream of new inbound connections. /// @@ -321,7 +321,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) listen: func() -> result, error-code>; /// Transmit data to peer. /// @@ -345,7 +345,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) send: func(data: stream) -> future>; /// Read data from peer. /// @@ -374,7 +374,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) receive: func() -> tuple, future>>; /// Get the bound local address. /// @@ -393,7 +393,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-local-address: func() -> result; /// Get the remote address. /// @@ -405,19 +405,19 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-remote-address: func() -> result; /// Whether the socket is in the `listening` state. /// /// Equivalent to the SO_ACCEPTCONN socket option. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-is-listening: func() -> bool; /// Whether this is a IPv4 or IPv6 socket. /// /// This is the value passed to the constructor. /// /// Equivalent to the SO_DOMAIN socket option. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-address-family: func() -> ip-address-family; /// Hints the desired listen queue size. Implementations are free to /// ignore this. @@ -430,7 +430,7 @@ interface types { /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. /// - `invalid-argument`: (set) The provided value was 0. /// - `invalid-state`: (set) The socket is in the `connecting` or `connected` state. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-listen-backlog-size: func(value: u64) -> result<_, error-code>; /// Enables or disables keepalive. /// @@ -442,9 +442,9 @@ interface types { /// false, but only come into effect when `keep-alive-enabled` is true. /// /// Equivalent to the SO_KEEPALIVE socket option. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-keep-alive-enabled: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; /// Amount of time the connection has to be idle before TCP starts /// sending keepalive packets. @@ -458,9 +458,9 @@ interface types { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-keep-alive-idle-time: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; /// The time between keepalive packets. /// @@ -473,9 +473,9 @@ interface types { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-keep-alive-interval: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-keep-alive-interval: func(value: duration) -> result<_, error-code>; /// The maximum amount of keepalive packets TCP should send before /// aborting the connection. @@ -489,9 +489,9 @@ interface types { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-keep-alive-count: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-keep-alive-count: func(value: u32) -> result<_, error-code>; /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. /// @@ -499,9 +499,9 @@ interface types { /// /// # Typical errors /// - `invalid-argument`: (set) The TTL value must be 1 or higher. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-hop-limit: func(value: u8) -> result<_, error-code>; /// Kernel buffer space reserved for sending/receiving on this socket. /// Implementations usually treat this as a cap the buffer can grow to, @@ -524,18 +524,18 @@ interface types { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-send-buffer-size: func(value: u64) -> result<_, error-code>; } /// A UDP socket handle. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) resource udp-socket { /// Create a new UDP socket. /// @@ -552,7 +552,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) create: static func(address-family: ip-address-family) -> result; /// Bind the socket to the provided IP address and port. /// @@ -573,7 +573,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) bind: func(local-address: ip-socket-address) -> result<_, error-code>; /// Associate this socket with a specific peer address. /// @@ -611,7 +611,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) connect: func(remote-address: ip-socket-address) -> result<_, error-code>; /// Dissociate this socket from its peer address. /// @@ -628,7 +628,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) disconnect: func() -> result<_, error-code>; /// Send a message on the socket to a particular peer. /// @@ -672,7 +672,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) send: async func(data: list, remote-address: option) -> result<_, error-code>; /// Receive a message on the socket. /// @@ -697,7 +697,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) receive: async func() -> result, ip-socket-address>, error-code>; /// Get the current bound address. /// @@ -716,7 +716,7 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-local-address: func() -> result; /// Get the address the socket is currently "connected" to. /// @@ -728,14 +728,14 @@ interface types { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-remote-address: func() -> result; /// Whether this is a IPv4 or IPv6 socket. /// /// This is the value passed to the constructor. /// /// Equivalent to the SO_DOMAIN socket option. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-address-family: func() -> ip-address-family; /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. /// @@ -743,9 +743,9 @@ interface types { /// /// # Typical errors /// - `invalid-argument`: (set) The TTL value must be 1 or higher. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-unicast-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; /// Kernel buffer space reserved for sending/receiving on this socket. /// Implementations usually treat this as a cap the buffer can grow to, @@ -760,24 +760,24 @@ interface types { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) set-send-buffer-size: func(value: u64) -> result<_, error-code>; } } -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface ip-name-lookup { - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) use types.{ip-address}; /// Lookup error codes. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) variant error-code { /// Access denied. /// @@ -824,16 +824,16 @@ interface ip-name-lookup { /// - /// - /// - - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) resolve-addresses: async func(name: string) -> result, error-code>; } -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) world imports { - @since(version = 0.3.0-rc-2026-03-15) - import wasi:clocks/types@0.3.0-rc-2026-03-15; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) + import wasi:clocks/types@0.3.0; + @since(version = 0.3.0) import types; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import ip-name-lookup; }