diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 6a67c1d..5df26d4 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -36,6 +36,6 @@ jobs: go-version: 'stable' - uses: bytecodealliance/actions/wasmtime/setup@v1 with: - version: "44.0.1" + version: "46.0.1" - run: rustup update stable --no-self-update && rustup default stable - run: cargo test --workspace diff --git a/.gitignore b/.gitignore index 7a590a5..79ba9b2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,10 @@ examples/*/go.mod examples/*/go.sum examples/*/wasi_* examples/*/wit_* +tests/fixtures/*/go.mod +tests/fixtures/*/go.sum +tests/fixtures/*/wasi_* +tests/fixtures/*/wit_* # Not generated !examples/wasip1/go.mod diff --git a/Cargo.lock b/Cargo.lock index 3ddbedd..a913247 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59317f77929f0e679d39364702289274de2f0f0b22cbf50b2b8cff2169a0b27a" +dependencies = [ + "gimli", +] + [[package]] name = "aho-corasick" version = "1.1.4" @@ -11,6 +20,27 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "1.0.0" @@ -63,9 +93,26 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.102" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3" + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" + +[[package]] +name = "async-trait" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "atomic-waker" @@ -107,11 +154,23 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" +dependencies = [ + "allocator-api2", +] [[package]] name = "bytes" @@ -128,6 +187,74 @@ dependencies = [ "libbz2-rs-sys", ] +[[package]] +name = "cap-fs-ext" +version = "3.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5528f85b1e134ae811704e41ef80930f56e795923f866813255bc342cc20654" +dependencies = [ + "cap-primitives", + "cap-std", + "io-lifetimes", + "windows-sys 0.52.0", +] + +[[package]] +name = "cap-net-ext" +version = "3.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20a158160765c6a7d0d8c072a53d772e4cb243f38b04bfcf6b4939cfbe7482e7" +dependencies = [ + "cap-primitives", + "cap-std", + "rustix", + "smallvec", +] + +[[package]] +name = "cap-primitives" +version = "3.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6cf3aea8a5081171859ef57bc1606b1df6999df4f1110f8eef68b30098d1d3a" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes", + "ipnet", + "maybe-owned", + "rustix", + "rustix-linux-procfs", + "windows-sys 0.52.0", + "winx", +] + +[[package]] +name = "cap-std" +version = "3.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6dc3090992a735d23219de5c204927163d922f42f575a0189b005c62d37549a" +dependencies = [ + "cap-primitives", + "io-extras", + "io-lifetimes", + "rustix", +] + +[[package]] +name = "cap-time-ext" +version = "3.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "def102506ce40c11710a9b16e614af0cde8e76ae51b1f48c04b8d79f4b671a80" +dependencies = [ + "ambient-authority", + "cap-primitives", + "iana-time-zone", + "once_cell", + "rustix", + "winx", +] + [[package]] name = "cc" version = "1.2.58" @@ -158,6 +285,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" @@ -207,6 +345,15 @@ dependencies = [ "cc", ] +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror 2.0.18", +] + [[package]] name = "colorchoice" version = "1.0.5" @@ -235,11 +382,11 @@ dependencies = [ "reqwest", "serde", "tar", - "toml", + "toml 1.1.2+spec-1.1.0", "which", "wit-bindgen-go", "wit-component", - "wit-parser", + "wit-parser 0.252.0", ] [[package]] @@ -268,6 +415,252 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "cpp_demangle" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +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.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06aeba2c965fc446d13c56a6ccb2631b78445d7544543dd9a25289977630914" +dependencies = [ + "cranelift-assembler-x64-meta", +] + +[[package]] +name = "cranelift-assembler-x64-meta" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2d2dde4ec1352715595b5cfa6fe2e5b8ebb9da3457b3ee8db0aa2808c069aa" +dependencies = [ + "cranelift-srcgen", +] + +[[package]] +name = "cranelift-bforest" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b4982ef9fa54ec9eee841e891e7ddc5434be1250e88de31572e000c888f30b" +dependencies = [ + "cranelift-entity", + "wasmtime-internal-core", +] + +[[package]] +name = "cranelift-bitset" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "529143118c4eeb58c39ecb02319557d512be6c61348486422974ab8e3906b8a8" +dependencies = [ + "serde", + "serde_derive", + "wasmtime-internal-core", +] + +[[package]] +name = "cranelift-codegen" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7780677247ad3577e3a6a3ebf43f39b325a11d6393db72b2c9968a910d4d13d" +dependencies = [ + "bumpalo", + "cranelift-assembler-x64", + "cranelift-bforest", + "cranelift-bitset", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.17.1", + "libm", + "log", + "postcard", + "pulley-interpreter", + "regalloc2", + "rustc-hash", + "serde", + "serde_derive", + "sha2", + "smallvec", + "target-lexicon", + "wasmtime-internal-core", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac9645250416cbf92454fe61160e17e026e0ce405906a54500b114f923ddffc9" +dependencies = [ + "cranelift-assembler-x64-meta", + "cranelift-codegen-shared", + "cranelift-srcgen", + "heck", + "pulley-interpreter", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ee8d222ff0fd3681791979afbf88586ac9f49010d3db96b3cbe4c96759aee3" + +[[package]] +name = "cranelift-control" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "591abe6f5312bd2c4220f1b3bead56c2ad00257c52668015ba013b85dcf2a17a" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5300c49cf940526fe771517b3b3eabd5d0ff164ee61698579cf403fe8d3af3c" +dependencies = [ + "cranelift-bitset", + "serde", + "serde_derive", + "wasmtime-internal-core", +] + +[[package]] +name = "cranelift-frontend" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da4adbf760207fdbbe130f1191cce01cdef66831a9f648b1f39ff2800d126d45" +dependencies = [ + "cranelift-codegen", + "hashbrown 0.17.1", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8315b21ff018226a42a60a4702c2dd75f6447cac26e9bca622e14c22088c2ff5" + +[[package]] +name = "cranelift-native" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d506ef23a60715bde451b06620b14402166ded3b648454fccbf04f3e46a4aa70" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-srcgen" +version = "0.133.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ed47e602652e3410f9387fc0db70fefadcee4d78a78881421aabcab4e26b89" + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + [[package]] name = "dirs" version = "6.0.0" @@ -285,10 +678,21 @@ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", - "redox_users", + "redox_users 0.5.2", "windows-sys 0.61.2", ] +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users 0.4.6", + "winapi", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -306,6 +710,24 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "either" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "encoding_rs" version = "0.8.35" @@ -331,6 +753,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + [[package]] name = "filetime" version = "0.2.27" @@ -348,6 +776,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "fnv" version = "1.0.7" @@ -369,6 +803,17 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs-set-times" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" +dependencies = [ + "io-lifetimes", + "rustix", + "windows-sys 0.52.0", +] + [[package]] name = "fs_extra" version = "1.3.0" @@ -376,20 +821,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] -name = "futures-channel" +name = "futures" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ + "futures-channel", "futures-core", + "futures-io", "futures-sink", + "futures-task", + "futures-util", ] [[package]] -name = "futures-core" +name = "futures-channel" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-io" @@ -415,6 +874,7 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ + "futures-channel", "futures-core", "futures-io", "futures-sink", @@ -424,6 +884,30 @@ dependencies = [ "slab", ] +[[package]] +name = "fxprof-processed-profile" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25234f20a3ec0a962a61770cfe39ecf03cb529a6e474ad8cff025ed497eda557" +dependencies = [ + "bitflags", + "debugid", + "rustc-hash", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.17" @@ -446,11 +930,35 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi", + "r-efi 5.3.0", "wasip2", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", +] + +[[package]] +name = "gimli" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c" +dependencies = [ + "fnv", + "hashbrown 0.16.1", + "indexmap", + "stable_deref_trait", +] + [[package]] name = "h2" version = "0.4.13" @@ -470,6 +978,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + [[package]] name = "hashbrown" version = "0.17.1" @@ -477,6 +991,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ "foldhash", + "serde", + "serde_core", ] [[package]] @@ -586,6 +1102,30 @@ dependencies = [ "windows-registry", ] +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "2.2.0" @@ -702,11 +1242,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", "serde", "serde_core", ] +[[package]] +name = "io-extras" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2285ddfe3054097ef4b2fe909ef8c3bcd1ea52a8f0d274416caebeef39f04a65" +dependencies = [ + "io-lifetimes", + "windows-sys 0.52.0", +] + +[[package]] +name = "io-lifetimes" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06432fb54d3be7964ecd3649233cddf80db2832f47fec34c01f65b3d9d774983" + [[package]] name = "ipnet" version = "2.12.0" @@ -729,12 +1285,41 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + [[package]] name = "jni" version = "0.21.1" @@ -801,6 +1386,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "leb128" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83bff1d572d6b9aeef67ddfc8448e4a3737909cb28e81f97c791b9018703e52" + [[package]] name = "leb128fmt" version = "0.1.0" @@ -815,9 +1406,15 @@ checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" [[package]] name = "libc" -version = "0.2.184" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libm" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" @@ -855,12 +1452,33 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "mach2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" + +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + [[package]] name = "memchr" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" +[[package]] +name = "memfd" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad38eb12aea514a0466ea40a80fd8cc83637065948eb4a426e4aa46261175227" +dependencies = [ + "rustix", +] + [[package]] name = "mime" version = "0.3.17" @@ -878,6 +1496,18 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "object" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" +dependencies = [ + "crc32fast", + "hashbrown 0.17.1", + "indexmap", + "memchr", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -908,18 +1538,46 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + [[package]] name = "pin-project-lite" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + [[package]] name = "plain" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + [[package]] name = "potential_utf" version = "0.1.5" @@ -947,6 +1605,29 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "pulley-interpreter" +version = "46.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b92604caae1a1899b6a5b54967289dd538177c626004c91accf9d0ec7e4a12" +dependencies = [ + "cranelift-bitset", + "log", + "pulley-macros", + "wasmtime-internal-core", +] + +[[package]] +name = "pulley-macros" +version = "46.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7ac85c0bb3fb351f10d531230aaa5e366b46d7c4e5328e5f02801d6dac1165" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "quinn" version = "0.11.9" @@ -977,7 +1658,7 @@ dependencies = [ "bytes", "getrandom 0.3.4", "lru-slab", - "rand", + "rand 0.9.2", "ring", "rustc-hash", "rustls", @@ -1018,6 +1699,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" version = "0.9.2" @@ -1025,7 +1712,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha", - "rand_core", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", ] [[package]] @@ -1035,7 +1733,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.5", ] [[package]] @@ -1047,6 +1745,32 @@ 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 = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.7.3" @@ -1056,6 +1780,17 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", +] + [[package]] name = "redox_users" version = "0.5.2" @@ -1067,11 +1802,26 @@ dependencies = [ "thiserror 2.0.18", ] +[[package]] +name = "regalloc2" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de2c52737737f8609e94f975dee22854a2d5c125772d4b1cf292120f4d45c186" +dependencies = [ + "allocator-api2", + "bumpalo", + "hashbrown 0.17.1", + "log", + "rustc-hash", + "serde", + "smallvec", +] + [[package]] name = "regex" -version = "1.12.3" +version = "1.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" dependencies = [ "aho-corasick", "memchr", @@ -1092,15 +1842,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "reqwest" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0" +checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" dependencies = [ "base64", "bytes", @@ -1150,6 +1900,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc-hash" version = "2.1.2" @@ -1169,6 +1925,16 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "rustix-linux-procfs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" +dependencies = [ + "once_cell", + "rustix", +] + [[package]] name = "rustls" version = "0.23.37" @@ -1296,6 +2062,10 @@ name = "semver" version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] [[package]] name = "serde" @@ -1349,6 +2119,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1366,6 +2147,9 @@ name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] [[package]] name = "socket2" @@ -1458,6 +2242,34 @@ dependencies = [ "xattr", ] +[[package]] +name = "target-lexicon" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "tests" version = "0.3.4" @@ -1469,6 +2281,8 @@ dependencies = [ "reqwest", "tar", "tokio", + "wasmtime", + "wasmtime-wasi", ] [[package]] @@ -1538,9 +2352,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.50.0" +version = "1.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" dependencies = [ "bytes", "libc", @@ -1553,9 +2367,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.6.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", @@ -1585,6 +2399,21 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + [[package]] name = "toml" version = "1.1.2+spec-1.1.0" @@ -1594,10 +2423,19 @@ dependencies = [ "indexmap", "serde_core", "serde_spanned", - "toml_datetime", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "toml_writer", - "winnow", + "winnow 1.0.1", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", ] [[package]] @@ -1615,7 +2453,7 @@ version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ - "winnow", + "winnow 1.0.1", ] [[package]] @@ -1676,9 +2514,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.36" @@ -1694,6 +2544,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + [[package]] name = "unicode-ident" version = "1.0.24" @@ -1701,162 +2557,548 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] -name = "unicode-xid" -version = "0.2.6" +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf80a72845275afea99e7f2b434723d3bc7e38470fcd1c7ed39a599c73319a53" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03623de6905b7206edd0a75f69f747f134b7f0a2323392d664448bf2d3c5d87e" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-compose" +version = "0.251.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b089037d7eb453ed57b560fe7833de0707411c8b9fdc429745ced77e2a1bacb9" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "log", + "petgraph", + "smallvec", + "wasm-encoder 0.251.0", + "wasmparser 0.251.0", + "wat", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8185ae345fa5687c054626ff9a50e7089797a343d9904d1dc9820eb4c4d3196f" +dependencies = [ + "leb128fmt", + "wasmparser 0.252.0", +] + +[[package]] +name = "wasm-metadata" +version = "0.252.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b7e08e02a3cd55bf778009d4cd6faae50da011f293644daf78a531a32d6d142" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder 0.252.0", + "wasmparser 0.252.0", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3eb099dcadcde5be9eef55e3a337128efd4e44b4c93122487e4d2e4e1c6627c" +dependencies = [ + "bitflags", + "hashbrown 0.17.1", + "indexmap", + "semver", +] + +[[package]] +name = "wasmprinter" +version = "0.251.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8798c1a699bd25648b6708eefe94d97c6f9891febb94b42cca1f7a4b086ea64e" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser 0.251.0", +] + +[[package]] +name = "wasmtime" +version = "46.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4213d2f019a5e44aa8a61d8826dd33a505bff79f749b14a8bafd67321cb9351" +dependencies = [ + "addr2line", + "async-trait", + "bitflags", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "futures", + "fxprof-processed-profile", + "gimli", + "ittapi", + "libc", + "log", + "mach2", + "memfd", + "object", + "once_cell", + "postcard", + "pulley-interpreter", + "rayon", + "rustix", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "target-lexicon", + "tempfile", + "wasm-compose", + "wasm-encoder 0.251.0", + "wasmparser 0.251.0", + "wasmtime-environ", + "wasmtime-internal-cache", + "wasmtime-internal-component-macro", + "wasmtime-internal-component-util", + "wasmtime-internal-core", + "wasmtime-internal-cranelift", + "wasmtime-internal-fiber", + "wasmtime-internal-jit-debug", + "wasmtime-internal-jit-icache-coherence", + "wasmtime-internal-unwinder", + "wasmtime-internal-versioned-export-macros", + "wat", + "windows-sys 0.61.2", + "wit-parser 0.251.0", +] + +[[package]] +name = "wasmtime-environ" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "d45863de41977ec6453e859cf843d456fa3fcb45a659b66d16e794f90ec4f5b7" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-bforest", + "cranelift-bitset", + "cranelift-entity", + "gimli", + "hashbrown 0.17.1", + "indexmap", + "log", + "object", + "postcard", + "rustc-demangle", + "semver", + "serde", + "serde_derive", + "sha2", + "smallvec", + "target-lexicon", + "wasm-encoder 0.251.0", + "wasmparser 0.251.0", + "wasmprinter", + "wasmtime-internal-component-util", + "wasmtime-internal-core", +] [[package]] -name = "untrusted" -version = "0.9.0" +name = "wasmtime-internal-cache" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +checksum = "438bc7dc45fb75297d75f79a9a0ce852345d13ebc6a6863f6f688f013836a9dd" +dependencies = [ + "base64", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2", + "toml 0.9.12+spec-1.1.0", + "wasmtime-environ", + "windows-sys 0.61.2", + "zstd", +] [[package]] -name = "url" -version = "2.5.8" +name = "wasmtime-internal-component-macro" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +checksum = "f1e48f8d4966d62a10b6d70722bc432c1e163890be2801d3b5784589ad36ffc3" dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", + "anyhow", + "proc-macro2", + "quote", + "syn", + "wasmtime-internal-component-util", + "wasmtime-internal-wit-bindgen", + "wit-parser 0.251.0", ] [[package]] -name = "utf8_iter" -version = "1.0.4" +name = "wasmtime-internal-component-util" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +checksum = "819ad5abd5822a22dbf4014475cdfd1fe790707761cd732d74aaa3ba4d5ba489" [[package]] -name = "utf8parse" -version = "0.2.2" +name = "wasmtime-internal-core" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +checksum = "3fc28372e36eaf8cf70faa83b5779137f7e99c8d18569a125d1580e735cc9e4d" +dependencies = [ + "anyhow", + "hashbrown 0.17.1", + "libm", + "serde", +] [[package]] -name = "walkdir" -version = "2.5.0" +name = "wasmtime-internal-cranelift" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +checksum = "a433efc6e35112a5457e1dc8bc4d8d39820ac7722267e89bc04e5df641f32124" dependencies = [ - "same-file", - "winapi-util", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "gimli", + "itertools", + "log", + "object", + "pulley-interpreter", + "smallvec", + "target-lexicon", + "thiserror 2.0.18", + "wasmparser 0.251.0", + "wasmtime-environ", + "wasmtime-internal-core", + "wasmtime-internal-unwinder", + "wasmtime-internal-versioned-export-macros", ] [[package]] -name = "want" -version = "0.3.1" +name = "wasmtime-internal-fiber" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +checksum = "18a1d3a39d0d210f6b8574ee96a4315e0a14c67f3a1fc3cd5372cb10d2fb4422" dependencies = [ - "try-lock", + "cc", + "cfg-if", + "libc", + "rustix", + "wasmtime-environ", + "wasmtime-internal-versioned-export-macros", + "windows-sys 0.61.2", ] [[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" +name = "wasmtime-internal-jit-debug" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +checksum = "9f667288cb4dfa68a4639ffac4d5628535dda64ebdc2b990526efb12b30ba803" +dependencies = [ + "cc", + "object", + "rustix", + "wasmtime-internal-versioned-export-macros", +] [[package]] -name = "wasip2" -version = "1.0.2+wasi-0.2.9" +name = "wasmtime-internal-jit-icache-coherence" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +checksum = "eba651d44ab0faad4c58106b3adb45068189fb65ef50f0c404b6d9e3bf81a357" dependencies = [ - "wit-bindgen", + "cfg-if", + "libc", + "wasmtime-internal-core", + "windows-sys 0.61.2", ] [[package]] -name = "wasm-bindgen" -version = "0.2.117" +name = "wasmtime-internal-unwinder" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0" +checksum = "2ecc52563b0558af2a7487eb710de07cc4532564b55528876129238e83118cb1" dependencies = [ "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", + "cranelift-codegen", + "log", + "object", + "wasmtime-environ", ] [[package]] -name = "wasm-bindgen-futures" -version = "0.4.67" +name = "wasmtime-internal-versioned-export-macros" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03623de6905b7206edd0a75f69f747f134b7f0a2323392d664448bf2d3c5d87e" +checksum = "e747f4a074699ba1b4e4d841fb263f9b7df5bd1555181c4752bf5990d21ba676" dependencies = [ - "js-sys", - "wasm-bindgen", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "wasm-bindgen-macro" -version = "0.2.117" +name = "wasmtime-internal-wit-bindgen" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be" +checksum = "80009f46991622814196d96fac6fc0a938f46b5cba737a8f4e21e24e5a03856f" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "anyhow", + "bitflags", + "heck", + "indexmap", + "wit-parser 0.251.0", ] [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.117" +name = "wasmtime-wasi" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2" +checksum = "e9f65ef30a2c5478873cdb619085a7a649d3ce41cc3eaf298a7ce3dee96a8e11" dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", + "async-trait", + "bitflags", + "bytes", + "cap-fs-ext", + "cap-net-ext", + "cap-std", + "cap-time-ext", + "cfg-if", + "futures", + "io-extras", + "io-lifetimes", + "rand 0.10.2", + "rustix", + "thiserror 2.0.18", + "tokio", + "tracing", + "url", + "wasmtime", + "wasmtime-wasi-io", + "wiggle", + "windows-sys 0.61.2", ] [[package]] -name = "wasm-bindgen-shared" -version = "0.2.117" +name = "wasmtime-wasi-io" +version = "46.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b" +checksum = "cee57d5fef4976b1ab542615f4cef2c43278eb549d8078939668ea0f13d5c696" dependencies = [ - "unicode-ident", + "async-trait", + "bytes", + "futures", + "tracing", + "wasmtime", ] [[package]] -name = "wasm-encoder" -version = "0.249.0" +name = "wast" +version = "35.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69830ccbbf41c55eb585991659fb70867ef628193af3a495f09a6956f7615e59" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" dependencies = [ - "leb128fmt", - "wasmparser", + "leb128", ] [[package]] -name = "wasm-metadata" -version = "0.249.0" +name = "wast" +version = "252.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf6f124f965aeeec4ed97f7176a7bb2c862f550d098d488ff258db2867893894" +checksum = "942a3449d6a593fccc111a6241c8df52bda168af30e40bf9580d4394d7374c65" dependencies = [ - "anyhow", - "indexmap", - "wasm-encoder", - "wasmparser", + "bumpalo", + "leb128fmt", + "memchr", + "unicode-width", + "wasm-encoder 0.252.0", ] [[package]] -name = "wasmparser" -version = "0.249.0" +name = "wat" +version = "1.252.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30538cae9a794215f490b532df01c557e2e2bfac92569482554acd0992a102ea" +checksum = "c72a4ba7088f7bac94cf516e49882bdf97068904a563768cf249efc839ec42cb" dependencies = [ - "bitflags", - "hashbrown", - "indexmap", - "semver", + "wast 252.0.0", ] [[package]] @@ -1890,13 +3132,69 @@ dependencies = [ [[package]] name = "which" -version = "8.0.2" +version = "8.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81995fafaaaf6ae47a7d0cc83c67caf92aeb7e5331650ae6ff856f7c0c60c459" +checksum = "48d7cd18d4acb58fb3cdfe9ea54e6cd96a4e7d4cc45c56338b236e82dad47248" dependencies = [ "libc", ] +[[package]] +name = "wiggle" +version = "46.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e03df88bf1a6068b02851aa3ef9427d285118f5c1c153b068a8995c69dd9562a" +dependencies = [ + "bitflags", + "thiserror 2.0.18", + "tracing", + "wasmtime", + "wasmtime-environ", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "46.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e014aec8661b613154377e4b49dbbb0dfc4f424efcee749782054576c00537d9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", + "wasmtime-environ", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "46.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f67310a8ae5190b7f3dcacf8697f2890701a3a8427b3e77ed91d3632dcedaceb" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wiggle-generate", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.11" @@ -1906,6 +3204,47 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "windows-link" version = "0.2.1" @@ -2163,12 +3502,28 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" + [[package]] name = "winnow" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5" +[[package]] +name = "winx" +version = "0.36.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d" +dependencies = [ + "bitflags", + "windows-sys 0.52.0", +] + [[package]] name = "wit-bindgen" version = "0.51.0" @@ -2177,22 +3532,22 @@ checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" [[package]] name = "wit-bindgen-core" -version = "0.57.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=95995ce0abdfec2609d44d04537fe5378c1349c0#95995ce0abdfec2609d44d04537fe5378c1349c0" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=4642b6bcc4283361b5d85eb00b00addf618458a9#4642b6bcc4283361b5d85eb00b00addf618458a9" dependencies = [ "anyhow", "heck", - "wit-parser", + "wit-parser 0.252.0", ] [[package]] name = "wit-bindgen-go" -version = "0.57.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=95995ce0abdfec2609d44d04537fe5378c1349c0#95995ce0abdfec2609d44d04537fe5378c1349c0" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=4642b6bcc4283361b5d85eb00b00addf618458a9#4642b6bcc4283361b5d85eb00b00addf618458a9" dependencies = [ "anyhow", "heck", - "wasm-encoder", + "wasm-encoder 0.252.0", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2200,9 +3555,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.249.0" +version = "0.252.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66a8d940b203e145ddd71f7790118f4ae17f240c670a3b80fe3c2373d7c0e57" +checksum = "76db0662b590f45d33d0e363fa13539a5a1eecd35d5a12fe208c335461c1053d" dependencies = [ "anyhow", "bitflags", @@ -2211,20 +3566,20 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder", + "wasm-encoder 0.252.0", "wasm-metadata", - "wasmparser", - "wit-parser", + "wasmparser 0.252.0", + "wit-parser 0.252.0", ] [[package]] name = "wit-parser" -version = "0.249.0" +version = "0.251.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50840f2e2cf170d910858089d7dfb3e97c6f9a0d6ec7bff7f7cc28f5aeacc15f" +checksum = "e960732e824fab95099971a09e638979347c94ca48568d3c854c945729196947" dependencies = [ "anyhow", - "hashbrown", + "hashbrown 0.17.1", "id-arena", "indexmap", "log", @@ -2233,7 +3588,38 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser", + "wasmparser 0.251.0", +] + +[[package]] +name = "wit-parser" +version = "0.252.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4266bea110371c620ccf3201c5023676046bc4556e5c7cfb5d500bda5ebc162d" +dependencies = [ + "anyhow", + "hashbrown 0.17.1", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-ident", + "wasmparser 0.252.0", +] + +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror 1.0.69", + "wast 35.0.2", ] [[package]] @@ -2360,3 +3746,31 @@ name = "zmij" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.16+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 1b04ec7..e9d4dbe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,10 +12,10 @@ crate-type = ["cdylib", "rlib"] members = ["./tests"] [workspace.dependencies] -anyhow = "1.0.102" +anyhow = "1.0.103" bzip2 = "0.6.1" once_cell = "1.21.3" -reqwest = { version = "0.13.3", features = ["blocking"] } +reqwest = { version = "0.13.4", features = ["blocking"] } tar = "0.4.46" [workspace.package] @@ -43,11 +43,11 @@ bzip2 = { workspace = true } reqwest = { workspace = true } tar = { workspace = true } clap = { version = "4.6.1", features = ["derive"] } -regex = "1.12.3" +regex = "1.12.4" serde = { version = "1.0.228", features = ["derive"] } toml = "1.1.0" -wit-bindgen-go = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "95995ce0abdfec2609d44d04537fe5378c1349c0" } -wit-component = "0.249.0" -wit-parser = "0.249.0" -which = "8.0.2" +wit-bindgen-go = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "4642b6bcc4283361b5d85eb00b00addf618458a9" } +wit-component = "0.252.0" +wit-parser = "0.252.0" +which = "8.0.4" dirs = "6.0.0" diff --git a/examples/multiple-worlds/wit1/deps/cli.wit b/examples/multiple-worlds/wit1/deps/cli.wit deleted file mode 100644 index 8ba52c5..0000000 --- a/examples/multiple-worlds/wit1/deps/cli.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/examples/multiple-worlds/wit1/deps/clocks.wit b/examples/multiple-worlds/wit1/deps/clocks.wit deleted file mode 100644 index 19fc4bc..0000000 --- a/examples/multiple-worlds/wit1/deps/clocks.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/examples/multiple-worlds/wit1/deps/filesystem.wit b/examples/multiple-worlds/wit1/deps/filesystem.wit deleted file mode 100644 index 697681f..0000000 --- a/examples/multiple-worlds/wit1/deps/filesystem.wit +++ /dev/null @@ -1,575 +0,0 @@ -package wasi:filesystem@0.3.0-rc-2026-03-15; - -/// 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-03-15) -interface types { - @since(version = 0.3.0-rc-2026-03-15) - use wasi:clocks/system-clock@0.3.0-rc-2026-03-15.{instant}; - - /// File size or length of a region within a file. - @since(version = 0.3.0-rc-2026-03-15) - 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) - variant descriptor-type { - /// 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, - /// The type of the descriptor or file is different from any of the - /// other types specified. - other(option), - } - - /// Descriptor flags. - /// - /// Note: This was called `fdflags` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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-03-15) - 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-03-15) - 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-03-15) - variant 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, - /// A catch-all for errors not captured by the existing variants. - /// Implementations can use this to extend the error type without - /// breaking existing code. - other(option), - } - - /// File or memory access pattern advisory information. - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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) - 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-03-15) - 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-03-15) - 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) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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) - 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-03-15) - symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>; - /// Unlink a filesystem object that is not a directory. - /// - /// This is similar to `unlinkat(fd, path, 0)` in POSIX. - /// - /// Error returns are as specified by POSIX. - /// - /// 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) - 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-03-15) - 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-03-15) - 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) - metadata-hash-at: async func(path-flags: path-flags, path: string) -> result; - } -} - -@since(version = 0.3.0-rc-2026-03-15) -interface preopens { - @since(version = 0.3.0-rc-2026-03-15) - use types.{descriptor}; - - /// Return the set of preopened directories, and their paths. - @since(version = 0.3.0-rc-2026-03-15) - get-directories: func() -> list>; -} - -@since(version = 0.3.0-rc-2026-03-15) -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) - import types; - @since(version = 0.3.0-rc-2026-03-15) - import preopens; -} diff --git a/examples/multiple-worlds/wit1/deps/random.wit b/examples/multiple-worlds/wit1/deps/random.wit deleted file mode 100644 index 026f44a..0000000 --- a/examples/multiple-worlds/wit1/deps/random.wit +++ /dev/null @@ -1,107 +0,0 @@ -package wasi:random@0.3.0-rc-2026-03-15; - -/// 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) -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-03-15) - 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-03-15) -interface insecure { - /// Return up to `max-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. - /// - /// Implementations MAY return fewer bytes than requested (a short read). - /// Callers that require exactly `max-len` bytes MUST call this function in - /// a loop until the desired number of bytes has been accumulated. - /// 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) - 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) - 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-03-15) -interface random { - /// Return up to `max-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. - /// - /// Implementations MAY return fewer bytes than requested (a short read). - /// Callers that require exactly `max-len` bytes MUST call this function in - /// a loop until the desired number of bytes has been accumulated. - /// 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. - /// - /// 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) - 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) - get-random-u64: func() -> u64; -} - -@since(version = 0.3.0-rc-2026-03-15) -world imports { - @since(version = 0.3.0-rc-2026-03-15) - import random; - @since(version = 0.3.0-rc-2026-03-15) - import insecure; - @since(version = 0.3.0-rc-2026-03-15) - import insecure-seed; -} diff --git a/examples/multiple-worlds/wit1/deps/sockets.wit b/examples/multiple-worlds/wit1/deps/sockets.wit deleted file mode 100644 index cde2e4d..0000000 --- a/examples/multiple-worlds/wit1/deps/sockets.wit +++ /dev/null @@ -1,839 +0,0 @@ -package wasi:sockets@0.3.0-rc-2026-03-15; - -@since(version = 0.3.0-rc-2026-03-15) -interface types { - @since(version = 0.3.0-rc-2026-03-15) - use wasi:clocks/types@0.3.0-rc-2026-03-15.{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: - /// - `other` - /// - `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-03-15) - variant error-code { - /// Access denied. - /// - /// POSIX equivalent: EACCES, EPERM - access-denied, - /// The operation is not supported. - /// - /// POSIX equivalent: EOPNOTSUPP, ENOPROTOOPT, EPFNOSUPPORT, EPROTONOSUPPORT, ESOCKTNOSUPPORT - not-supported, - /// One of the arguments is invalid. - /// - /// POSIX equivalent: EINVAL, EDESTADDRREQ, EAFNOSUPPORT - invalid-argument, - /// Not enough memory to complete the operation. - /// - /// POSIX equivalent: ENOMEM, ENOBUFS - out-of-memory, - /// The operation timed out before it could finish completely. - /// - /// POSIX equivalent: ETIMEDOUT - timeout, - /// The operation is not valid in the socket's current state. - invalid-state, - /// The local address is not available. - /// - /// POSIX equivalent: EADDRNOTAVAIL - address-not-bindable, - /// A bind operation failed because the provided address is already in - /// use or because there are no ephemeral ports available. - /// - /// POSIX equivalent: EADDRINUSE - address-in-use, - /// The remote address is not reachable. - /// - /// POSIX equivalent: EHOSTUNREACH, EHOSTDOWN, ENETDOWN, ENETUNREACH, ENONET - remote-unreachable, - /// The connection was forcefully rejected. - /// - /// POSIX equivalent: ECONNREFUSED - connection-refused, - /// A write failed because the connection was broken. - /// - /// POSIX equivalent: EPIPE - connection-broken, - /// The connection was reset. - /// - /// POSIX equivalent: ECONNRESET - connection-reset, - /// The connection was aborted. - /// - /// POSIX equivalent: ECONNABORTED - connection-aborted, - /// The size of a datagram sent to a UDP socket exceeded the maximum - /// supported size. - /// - /// POSIX equivalent: EMSGSIZE - datagram-too-large, - /// A catch-all for errors not captured by the existing variants. - /// Implementations can use this to extend the error type without - /// breaking existing code. - other(option), - } - - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - type ipv4-address = tuple; - - @since(version = 0.3.0-rc-2026-03-15) - type ipv6-address = tuple; - - @since(version = 0.3.0-rc-2026-03-15) - variant ip-address { - ipv4(ipv4-address), - ipv6(ipv6-address), - } - - @since(version = 0.3.0-rc-2026-03-15) - record ipv4-socket-address { - /// sin_port - port: u16, - /// sin_addr - address: ipv4-address, - } - - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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`) - /// - /// WASI uses shared ownership semantics: the `tcp-socket` handle and all - /// derived `stream` and `future` values reference a single underlying OS - /// socket: - /// - Send/receive streams remain functional after the original `tcp-socket` - /// handle is dropped. - /// - The stream returned by `listen` behaves similarly. - /// - Client sockets returned by `tcp-socket::listen` are independent and do - /// not keep the listening socket alive. - /// - /// The OS socket is closed only after the last handle is dropped. This - /// model has observable effects; for example, it affects when the local - /// port binding is released. - /// - /// 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) - 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. - /// - /// # Typical errors - /// - `not-supported`: The `address-family` is not supported. (EAFNOSUPPORT) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-03-15) - 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 - /// The 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. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-03-15) - 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 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. - /// - /// 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-03-15) - 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-03-15) - 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) - /// - `invalid-state`: `send` has already been called on this socket. - /// - `connection-broken`: The connection is not writable anymore. (EPIPE, ECONNABORTED on Windows) - /// - `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-03-15) - send: func(data: stream) -> future>; - /// Read data from peer. - /// - /// Returns a `stream` of data sent by the peer. The implementation - /// drops the stream once no more data is available. At that point, the - /// returned `future` resolves to: - /// - `ok` after a graceful shutdown from the peer (i.e. a FIN packet), or - /// - `err` if the socket was closed abnormally. - /// - /// `receive` may be called only once per socket. Subsequent calls return - /// a closed stream and a future resolved to `err(invalid-state)`. - /// - /// If the caller is not expecting to receive any more data from the peer, - /// they should 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) - /// - `invalid-state`: `receive` has already been called on this socket. - /// - `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-03-15) - 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-03-15) - 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-03-15) - 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) - 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) - 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-03-15) - 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-03-15) - get-keep-alive-enabled: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// 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-03-15) - get-keep-alive-idle-time: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// Equivalent to the TCP_KEEPINTVL socket option. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) - get-keep-alive-interval: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// Equivalent to the TCP_KEEPCNT socket option. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) - get-keep-alive-count: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - get-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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, - /// rather than allocating the full amount immediately. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// This is only a performance hint. The implementation may ignore it or - /// tweak it based on real traffic patterns. - /// Linux and macOS appear to behave differently depending on whether a - /// buffer size was explicitly set. When set, they tend to honor it; when - /// not set, they dynamically adjust the buffer size as the connection - /// progresses. This is especially noticeable when comparing the values - /// from before and after connection establishment. - /// - /// 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-03-15) - get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-03-15) - get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - } - - /// A UDP socket handle. - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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 remote 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-03-15) - 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`. - /// - /// If the socket has not been explicitly bound, it will be - /// implicitly bound to a random free port. - /// - /// 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) - /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) - /// - /// # Implementors note - /// WASI requires `send` to perform an implicit bind if the socket - /// has not been bound. Not all platforms (notably Windows) exhibit - /// this behavior natively. On such platforms, the WASI implementation - /// should emulate it by performing the bind if the guest has not - /// already done so. - /// - /// # References - /// - - /// - - /// - - /// - - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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-03-15) - get-unicast-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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, - /// rather than allocating the full amount immediately. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// 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-03-15) - get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-03-15) - get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - } -} - -@since(version = 0.3.0-rc-2026-03-15) -interface ip-name-lookup { - @since(version = 0.3.0-rc-2026-03-15) - use types.{ip-address}; - - /// Lookup error codes. - @since(version = 0.3.0-rc-2026-03-15) - variant error-code { - /// 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, - /// A catch-all for errors not captured by the existing variants. - /// Implementations can use this to extend the error type without - /// breaking existing code. - other(option), - } - - /// 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. - /// - /// # References: - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-03-15) - resolve-addresses: async func(name: string) -> result, error-code>; -} - -@since(version = 0.3.0-rc-2026-03-15) -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 types; - @since(version = 0.3.0-rc-2026-03-15) - import ip-name-lookup; -} diff --git a/examples/sdk/component/README.md b/examples/sdk/component/README.md index ca7f8c9..94860c4 100644 --- a/examples/sdk/component/README.md +++ b/examples/sdk/component/README.md @@ -6,7 +6,7 @@ - [**componentize-go**](https://github.com/bytecodealliance/componentize-go) - Latest version - [**go**](https://go.dev/dl/) - v1.25.9 -- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v44.0.1 +- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v46.0.1 ### Run diff --git a/examples/sdk/component/go.mod b/examples/sdk/component/go.mod index 7285adc..e5b1474 100644 --- a/examples/sdk/component/go.mod +++ b/examples/sdk/component/go.mod @@ -6,4 +6,4 @@ replace pkg => ../pkg require pkg v0.0.0-00010101000000-000000000000 -require go.bytecodealliance.org/pkg v0.2.1 // indirect +require go.bytecodealliance.org/pkg v0.2.2 // indirect diff --git a/examples/sdk/component/go.sum b/examples/sdk/component/go.sum index a18d6dc..c2ef3ce 100644 --- a/examples/sdk/component/go.sum +++ b/examples/sdk/component/go.sum @@ -1,2 +1,2 @@ -go.bytecodealliance.org/pkg v0.2.1 h1:TdRagooIcCW3UmlKqVO4cDR3GNDyfDnbiBzGI6TOvyg= -go.bytecodealliance.org/pkg v0.2.1/go.mod h1:OjA+V8g3uUFixeCKFfamm6sYhTJdg8fvwEdJ2GO0GSk= +go.bytecodealliance.org/pkg v0.2.2 h1:O0wrZ3Mk/h9pN5747kuuIVsYlwf03kLFw+czFMV9hec= +go.bytecodealliance.org/pkg v0.2.2/go.mod h1:OjA+V8g3uUFixeCKFfamm6sYhTJdg8fvwEdJ2GO0GSk= diff --git a/examples/sdk/pkg/bindings/exports/wit_exports/wit_exports.go b/examples/sdk/pkg/bindings/exports/wit_exports/wit_exports.go index 73c5b71..0d2fda0 100644 --- a/examples/sdk/pkg/bindings/exports/wit_exports/wit_exports.go +++ b/examples/sdk/pkg/bindings/exports/wit_exports/wit_exports.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wit_exports @@ -22,7 +22,7 @@ var staticPinner = runtime.Pinner{} var exportReturnArea = uintptr(witRuntime.Allocate(&staticPinner, 0, 1)) var syncExportPinner = runtime.Pinner{} -//go:wasmexport [async-lift]wasi:cli/run@0.3.0-rc-2026-03-15#run +//go:wasmexport [async-lift]wasi:cli/run@0.3.0#run func wasm_export_wasi_cli_run_run() int32 { return int32(witAsync.Run(func() { @@ -43,10 +43,10 @@ func wasm_export_wasi_cli_run_run() int32 { })) } -//go:wasmexport [callback][async-lift]wasi:cli/run@0.3.0-rc-2026-03-15#run +//go:wasmexport [callback][async-lift]wasi:cli/run@0.3.0#run func wasm_export_callback_wasi_cli_run_run(event0 uint32, event1 uint32, event2 uint32) uint32 { return witAsync.Callback(event0, event1, event2) } -//go:wasmimport [export]wasi:cli/run@0.3.0-rc-2026-03-15 [task-return]run +//go:wasmimport [export]wasi:cli/run@0.3.0 [task-return]run func wasm_export_task_return_wasi_cli_run_run(arg0 int32) diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_environment/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_environment/wit_bindings.go index c952847..12718c8 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_environment/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_environment/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_environment @@ -17,7 +17,7 @@ import ( "unsafe" ) -//go:wasmimport wasi:cli/environment@0.3.0-rc-2026-03-15 get-environment +//go:wasmimport wasi:cli/environment@0.3.0 get-environment func wasm_import_get_environment(arg0 uintptr) func GetEnvironment() []witTypes.Tuple2[string, string] { @@ -40,7 +40,7 @@ func GetEnvironment() []witTypes.Tuple2[string, string] { } -//go:wasmimport wasi:cli/environment@0.3.0-rc-2026-03-15 get-arguments +//go:wasmimport wasi:cli/environment@0.3.0 get-arguments func wasm_import_get_arguments(arg0 uintptr) func GetArguments() []string { @@ -62,7 +62,7 @@ func GetArguments() []string { } -//go:wasmimport wasi:cli/environment@0.3.0-rc-2026-03-15 get-initial-cwd +//go:wasmimport wasi:cli/environment@0.3.0 get-initial-cwd func wasm_import_get_initial_cwd(arg0 uintptr) func GetInitialCwd() witTypes.Option[string] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_exit/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_exit/wit_bindings.go index ef6c5e4..a618132 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_exit/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_exit/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_exit @@ -14,7 +14,7 @@ import ( witTypes "go.bytecodealliance.org/pkg/wit/types" ) -//go:wasmimport wasi:cli/exit@0.3.0-rc-2026-03-15 exit +//go:wasmimport wasi:cli/exit@0.3.0 exit func wasm_import_exit(arg0 int32) func Exit(status witTypes.Result[witTypes.Unit, witTypes.Unit]) { @@ -33,3 +33,12 @@ func Exit(status witTypes.Result[witTypes.Unit, witTypes.Unit]) { wasm_import_exit(option) } + +//go:wasmimport wasi:cli/exit@0.3.0 exit-with-code +func wasm_import_exit_with_code(arg0 int32) + +func ExitWithCode(statusCode uint8) { + + wasm_import_exit_with_code(int32(statusCode)) + +} diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_stderr/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_stderr/wit_bindings.go index afe3e3a..44c3b15 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_stderr/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_stderr/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_stderr @@ -17,19 +17,19 @@ import ( "unsafe" ) -//go:wasmimport wasi:cli/stderr@0.3.0-rc-2026-03-15 [future-new-1]write-via-stream +//go:wasmimport wasi:cli/stderr@0.3.0 [future-new-1]write-via-stream func wasm_future_new_result_unit_wasi_cli_types_error_code() uint64 -//go:wasmimport wasi:cli/stderr@0.3.0-rc-2026-03-15 [async-lower][future-read-1]write-via-stream +//go:wasmimport wasi:cli/stderr@0.3.0 [async-lower][future-read-1]write-via-stream func wasm_future_read_result_unit_wasi_cli_types_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:cli/stderr@0.3.0-rc-2026-03-15 [async-lower][future-write-1]write-via-stream +//go:wasmimport wasi:cli/stderr@0.3.0 [async-lower][future-write-1]write-via-stream func wasm_future_write_result_unit_wasi_cli_types_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:cli/stderr@0.3.0-rc-2026-03-15 [future-drop-readable-1]write-via-stream +//go:wasmimport wasi:cli/stderr@0.3.0 [future-drop-readable-1]write-via-stream func wasm_future_drop_readable_result_unit_wasi_cli_types_error_code(handle int32) -//go:wasmimport wasi:cli/stderr@0.3.0-rc-2026-03-15 [future-drop-writable-1]write-via-stream +//go:wasmimport wasi:cli/stderr@0.3.0 [future-drop-writable-1]write-via-stream func wasm_future_drop_writable_result_unit_wasi_cli_types_error_code(handle int32) func wasm_future_lift_result_unit_wasi_cli_types_error_code(src unsafe.Pointer) witTypes.Result[witTypes.Unit, wasi_cli_types.ErrorCode] { @@ -96,7 +96,7 @@ func LiftFutureResultUnitWasiCliTypesErrorCode(handle int32) *witTypes.FutureRea type ErrorCode = wasi_cli_types.ErrorCode -//go:wasmimport wasi:cli/stderr@0.3.0-rc-2026-03-15 write-via-stream +//go:wasmimport wasi:cli/stderr@0.3.0 write-via-stream func wasm_import_write_via_stream(arg0 int32) int32 func WriteViaStream(data *witTypes.StreamReader[uint8]) *witTypes.FutureReader[witTypes.Result[witTypes.Unit, wasi_cli_types.ErrorCode]] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_stdin/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_stdin/wit_bindings.go index cdcb27e..6dcade6 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_stdin/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_stdin/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_stdin @@ -18,19 +18,19 @@ import ( "unsafe" ) -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [stream-new-0]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [stream-new-0]read-via-stream func wasm_stream_new_u8() uint64 -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [async-lower][stream-read-0]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [async-lower][stream-read-0]read-via-stream func wasm_stream_read_u8(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [async-lower][stream-write-0]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [async-lower][stream-write-0]read-via-stream func wasm_stream_write_u8(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [stream-drop-readable-0]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [stream-drop-readable-0]read-via-stream func wasm_stream_drop_readable_u8(handle int32) -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [stream-drop-writable-0]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [stream-drop-writable-0]read-via-stream func wasm_stream_drop_writable_u8(handle int32) var wasm_stream_vtable_u8 = witTypes.StreamVtable[uint8]{ @@ -56,19 +56,19 @@ func LiftStreamU8(handle int32) *witTypes.StreamReader[uint8] { return witTypes.MakeStreamReader[uint8](&wasm_stream_vtable_u8, handle) } -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [future-new-1]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [future-new-1]read-via-stream func wasm_future_new_result_unit_wasi_cli_types_error_code() uint64 -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [async-lower][future-read-1]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [async-lower][future-read-1]read-via-stream func wasm_future_read_result_unit_wasi_cli_types_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [async-lower][future-write-1]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [async-lower][future-write-1]read-via-stream func wasm_future_write_result_unit_wasi_cli_types_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [future-drop-readable-1]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [future-drop-readable-1]read-via-stream func wasm_future_drop_readable_result_unit_wasi_cli_types_error_code(handle int32) -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 [future-drop-writable-1]read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 [future-drop-writable-1]read-via-stream func wasm_future_drop_writable_result_unit_wasi_cli_types_error_code(handle int32) func wasm_future_lift_result_unit_wasi_cli_types_error_code(src unsafe.Pointer) witTypes.Result[witTypes.Unit, wasi_cli_types.ErrorCode] { @@ -135,7 +135,7 @@ func LiftFutureResultUnitWasiCliTypesErrorCode(handle int32) *witTypes.FutureRea type ErrorCode = wasi_cli_types.ErrorCode -//go:wasmimport wasi:cli/stdin@0.3.0-rc-2026-03-15 read-via-stream +//go:wasmimport wasi:cli/stdin@0.3.0 read-via-stream func wasm_import_read_via_stream(arg0 uintptr) func ReadViaStream() (*witTypes.StreamReader[uint8], *witTypes.FutureReader[witTypes.Result[witTypes.Unit, wasi_cli_types.ErrorCode]]) { diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_stdout/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_stdout/wit_bindings.go index dde8d65..546a6d8 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_stdout/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_stdout/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_stdout @@ -17,19 +17,19 @@ import ( "unsafe" ) -//go:wasmimport wasi:cli/stdout@0.3.0-rc-2026-03-15 [future-new-1]write-via-stream +//go:wasmimport wasi:cli/stdout@0.3.0 [future-new-1]write-via-stream func wasm_future_new_result_unit_wasi_cli_types_error_code() uint64 -//go:wasmimport wasi:cli/stdout@0.3.0-rc-2026-03-15 [async-lower][future-read-1]write-via-stream +//go:wasmimport wasi:cli/stdout@0.3.0 [async-lower][future-read-1]write-via-stream func wasm_future_read_result_unit_wasi_cli_types_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:cli/stdout@0.3.0-rc-2026-03-15 [async-lower][future-write-1]write-via-stream +//go:wasmimport wasi:cli/stdout@0.3.0 [async-lower][future-write-1]write-via-stream func wasm_future_write_result_unit_wasi_cli_types_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:cli/stdout@0.3.0-rc-2026-03-15 [future-drop-readable-1]write-via-stream +//go:wasmimport wasi:cli/stdout@0.3.0 [future-drop-readable-1]write-via-stream func wasm_future_drop_readable_result_unit_wasi_cli_types_error_code(handle int32) -//go:wasmimport wasi:cli/stdout@0.3.0-rc-2026-03-15 [future-drop-writable-1]write-via-stream +//go:wasmimport wasi:cli/stdout@0.3.0 [future-drop-writable-1]write-via-stream func wasm_future_drop_writable_result_unit_wasi_cli_types_error_code(handle int32) func wasm_future_lift_result_unit_wasi_cli_types_error_code(src unsafe.Pointer) witTypes.Result[witTypes.Unit, wasi_cli_types.ErrorCode] { @@ -96,7 +96,7 @@ func LiftFutureResultUnitWasiCliTypesErrorCode(handle int32) *witTypes.FutureRea type ErrorCode = wasi_cli_types.ErrorCode -//go:wasmimport wasi:cli/stdout@0.3.0-rc-2026-03-15 write-via-stream +//go:wasmimport wasi:cli/stdout@0.3.0 write-via-stream func wasm_import_write_via_stream(arg0 int32) int32 func WriteViaStream(data *witTypes.StreamReader[uint8]) *witTypes.FutureReader[witTypes.Result[witTypes.Unit, wasi_cli_types.ErrorCode]] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_input/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_input/wit_bindings.go index bd1d688..8c8e175 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_input/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_input/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_terminal_input @@ -15,7 +15,7 @@ import ( "runtime" ) -//go:wasmimport wasi:cli/terminal-input@0.3.0-rc-2026-03-15 [resource-drop]terminal-input +//go:wasmimport wasi:cli/terminal-input@0.3.0 [resource-drop]terminal-input func resourceDropTerminalInput(handle int32) // The input side of a terminal. diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_output/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_output/wit_bindings.go index 0f2ab1d..8fe3f47 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_output/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_output/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_terminal_output @@ -15,7 +15,7 @@ import ( "runtime" ) -//go:wasmimport wasi:cli/terminal-output@0.3.0-rc-2026-03-15 [resource-drop]terminal-output +//go:wasmimport wasi:cli/terminal-output@0.3.0 [resource-drop]terminal-output func resourceDropTerminalOutput(handle int32) // The output side of a terminal. diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stderr/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stderr/wit_bindings.go index efc04ef..2626c0a 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stderr/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stderr/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_terminal_stderr @@ -20,7 +20,7 @@ import ( type TerminalOutput = wasi_cli_terminal_output.TerminalOutput -//go:wasmimport wasi:cli/terminal-stderr@0.3.0-rc-2026-03-15 get-terminal-stderr +//go:wasmimport wasi:cli/terminal-stderr@0.3.0 get-terminal-stderr func wasm_import_get_terminal_stderr(arg0 uintptr) func GetTerminalStderr() witTypes.Option[*wasi_cli_terminal_output.TerminalOutput] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stdin/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stdin/wit_bindings.go index ad0b9f0..273bb23 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stdin/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stdin/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_terminal_stdin @@ -20,7 +20,7 @@ import ( type TerminalInput = wasi_cli_terminal_input.TerminalInput -//go:wasmimport wasi:cli/terminal-stdin@0.3.0-rc-2026-03-15 get-terminal-stdin +//go:wasmimport wasi:cli/terminal-stdin@0.3.0 get-terminal-stdin func wasm_import_get_terminal_stdin(arg0 uintptr) func GetTerminalStdin() witTypes.Option[*wasi_cli_terminal_input.TerminalInput] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stdout/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stdout/wit_bindings.go index 1810fd3..1e2510f 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stdout/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_terminal_stdout/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_terminal_stdout @@ -20,7 +20,7 @@ import ( type TerminalOutput = wasi_cli_terminal_output.TerminalOutput -//go:wasmimport wasi:cli/terminal-stdout@0.3.0-rc-2026-03-15 get-terminal-stdout +//go:wasmimport wasi:cli/terminal-stdout@0.3.0 get-terminal-stdout func wasm_import_get_terminal_stdout(arg0 uintptr) func GetTerminalStdout() witTypes.Option[*wasi_cli_terminal_output.TerminalOutput] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_cli_types/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_cli_types/wit_bindings.go index 2d69b72..624c230 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_cli_types/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_cli_types/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_cli_types diff --git a/examples/sdk/pkg/bindings/imports/wasi_clocks_monotonic_clock/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_clocks_monotonic_clock/wit_bindings.go index 7dc0edb..d43437a 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_clocks_monotonic_clock/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_clocks_monotonic_clock/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_clocks_monotonic_clock @@ -17,7 +17,7 @@ import ( type Duration = uint64 type Mark = uint64 -//go:wasmimport wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15 now +//go:wasmimport wasi:clocks/monotonic-clock@0.3.0 now func wasm_import_now() int64 func Now() uint64 { @@ -27,7 +27,7 @@ func Now() uint64 { } -//go:wasmimport wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15 get-resolution +//go:wasmimport wasi:clocks/monotonic-clock@0.3.0 get-resolution func wasm_import_get_resolution() int64 func GetResolution() uint64 { @@ -37,7 +37,7 @@ func GetResolution() uint64 { } -//go:wasmimport wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15 [async-lower]wait-until +//go:wasmimport wasi:clocks/monotonic-clock@0.3.0 [async-lower]wait-until func wasm_import_wait_until(arg0 int64) int32 func WaitUntil(when uint64) { @@ -46,7 +46,7 @@ func WaitUntil(when uint64) { } -//go:wasmimport wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15 [async-lower]wait-for +//go:wasmimport wasi:clocks/monotonic-clock@0.3.0 [async-lower]wait-for func wasm_import_wait_for(arg0 int64) int32 func WaitFor(howLong uint64) { diff --git a/examples/sdk/pkg/bindings/imports/wasi_clocks_system_clock/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_clocks_system_clock/wit_bindings.go index 29e3545..4d3d889 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_clocks_system_clock/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_clocks_system_clock/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_clocks_system_clock @@ -23,7 +23,7 @@ type Instant struct { Nanoseconds uint32 } -//go:wasmimport wasi:clocks/system-clock@0.3.0-rc-2026-03-15 now +//go:wasmimport wasi:clocks/system-clock@0.3.0 now func wasm_import_now(arg0 uintptr) func Now() Instant { @@ -37,7 +37,7 @@ func Now() Instant { } -//go:wasmimport wasi:clocks/system-clock@0.3.0-rc-2026-03-15 get-resolution +//go:wasmimport wasi:clocks/system-clock@0.3.0 get-resolution func wasm_import_get_resolution() int64 func GetResolution() uint64 { diff --git a/examples/sdk/pkg/bindings/imports/wasi_clocks_types/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_clocks_types/wit_bindings.go index ef67fd1..49f7194 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_clocks_types/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_clocks_types/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_clocks_types diff --git a/examples/sdk/pkg/bindings/imports/wasi_filesystem_preopens/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_filesystem_preopens/wit_bindings.go index f6616ab..af9b06f 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_filesystem_preopens/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_filesystem_preopens/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_filesystem_preopens @@ -20,7 +20,7 @@ import ( type Descriptor = wasi_filesystem_types.Descriptor -//go:wasmimport wasi:filesystem/preopens@0.3.0-rc-2026-03-15 get-directories +//go:wasmimport wasi:filesystem/preopens@0.3.0 get-directories func wasm_import_get_directories(arg0 uintptr) func GetDirectories() []witTypes.Tuple2[*wasi_filesystem_types.Descriptor, string] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_filesystem_types/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_filesystem_types/wit_bindings.go index 173ca4d..3ed55d0 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_filesystem_types/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_filesystem_types/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_filesystem_types @@ -19,19 +19,19 @@ import ( "unsafe" ) -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [stream-new-0][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [stream-new-0][method]descriptor.read-via-stream func wasm_stream_new_u8() uint64 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][stream-read-0][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][stream-read-0][method]descriptor.read-via-stream func wasm_stream_read_u8(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][stream-write-0][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][stream-write-0][method]descriptor.read-via-stream func wasm_stream_write_u8(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [stream-drop-readable-0][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [stream-drop-readable-0][method]descriptor.read-via-stream func wasm_stream_drop_readable_u8(handle int32) -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [stream-drop-writable-0][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [stream-drop-writable-0][method]descriptor.read-via-stream func wasm_stream_drop_writable_u8(handle int32) var wasm_stream_vtable_u8 = witTypes.StreamVtable[uint8]{ @@ -57,19 +57,19 @@ func LiftStreamU8(handle int32) *witTypes.StreamReader[uint8] { return witTypes.MakeStreamReader[uint8](&wasm_stream_vtable_u8, handle) } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [future-new-1][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [future-new-1][method]descriptor.read-via-stream func wasm_future_new_result_unit_error_code() uint64 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][future-read-1][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][future-read-1][method]descriptor.read-via-stream func wasm_future_read_result_unit_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][future-write-1][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][future-write-1][method]descriptor.read-via-stream func wasm_future_write_result_unit_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [future-drop-readable-1][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [future-drop-readable-1][method]descriptor.read-via-stream func wasm_future_drop_readable_result_unit_error_code(handle int32) -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [future-drop-writable-1][method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [future-drop-writable-1][method]descriptor.read-via-stream func wasm_future_drop_writable_result_unit_error_code(handle int32) func wasm_future_lift_result_unit_error_code(src unsafe.Pointer) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -467,19 +467,19 @@ func LiftFutureResultUnitErrorCode(handle int32) *witTypes.FutureReader[witTypes return witTypes.MakeFutureReader[witTypes.Result[witTypes.Unit, ErrorCode]](&wasm_future_vtable_result_unit_error_code, handle) } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [stream-new-0][method]descriptor.read-directory +//go:wasmimport wasi:filesystem/types@0.3.0 [stream-new-0][method]descriptor.read-directory func wasm_stream_new_directory_entry() uint64 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][stream-read-0][method]descriptor.read-directory +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][stream-read-0][method]descriptor.read-directory func wasm_stream_read_directory_entry(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][stream-write-0][method]descriptor.read-directory +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][stream-write-0][method]descriptor.read-directory func wasm_stream_write_directory_entry(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [stream-drop-readable-0][method]descriptor.read-directory +//go:wasmimport wasi:filesystem/types@0.3.0 [stream-drop-readable-0][method]descriptor.read-directory func wasm_stream_drop_readable_directory_entry(handle int32) -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [stream-drop-writable-0][method]descriptor.read-directory +//go:wasmimport wasi:filesystem/types@0.3.0 [stream-drop-writable-0][method]descriptor.read-directory func wasm_stream_drop_writable_directory_entry(handle int32) func wasm_stream_lift_directory_entry(src unsafe.Pointer) DirectoryEntry { @@ -938,7 +938,7 @@ type MetadataHashValue struct { Upper uint64 } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [resource-drop]descriptor +//go:wasmimport wasi:filesystem/types@0.3.0 [resource-drop]descriptor func resourceDropDescriptor(handle int32) type Descriptor struct { @@ -981,7 +981,7 @@ func DescriptorFromBorrowHandle(handleValue int32) *Descriptor { return &Descriptor{handle} } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [method]descriptor.read-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [method]descriptor.read-via-stream func wasm_import_method_descriptor_read_via_stream(arg0 int32, arg1 int64, arg2 uintptr) func (self *Descriptor) ReadViaStream(offset uint64) (*witTypes.StreamReader[uint8], *witTypes.FutureReader[witTypes.Result[witTypes.Unit, ErrorCode]]) { @@ -996,7 +996,7 @@ func (self *Descriptor) ReadViaStream(offset uint64) (*witTypes.StreamReader[uin } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [method]descriptor.write-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [method]descriptor.write-via-stream func wasm_import_method_descriptor_write_via_stream(arg0 int32, arg1 int32, arg2 int64) int32 func (self *Descriptor) WriteViaStream(data *witTypes.StreamReader[uint8], offset uint64) *witTypes.FutureReader[witTypes.Result[witTypes.Unit, ErrorCode]] { @@ -1006,7 +1006,7 @@ func (self *Descriptor) WriteViaStream(data *witTypes.StreamReader[uint8], offse } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [method]descriptor.append-via-stream +//go:wasmimport wasi:filesystem/types@0.3.0 [method]descriptor.append-via-stream func wasm_import_method_descriptor_append_via_stream(arg0 int32, arg1 int32) int32 func (self *Descriptor) AppendViaStream(data *witTypes.StreamReader[uint8]) *witTypes.FutureReader[witTypes.Result[witTypes.Unit, ErrorCode]] { @@ -1016,7 +1016,7 @@ func (self *Descriptor) AppendViaStream(data *witTypes.StreamReader[uint8]) *wit } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.advise +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.advise func wasm_import_method_descriptor_advise(arg0 int32, arg1 int64, arg2 int64, arg3 int32, arg4 uintptr) int32 func (self *Descriptor) Advise(offset uint64, length uint64, advice Advice) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -1207,7 +1207,7 @@ func (self *Descriptor) Advise(offset uint64, length uint64, advice Advice) witT } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.sync-data +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.sync-data func wasm_import_method_descriptor_sync_data(arg0 int32, arg1 uintptr) int32 func (self *Descriptor) SyncData() witTypes.Result[witTypes.Unit, ErrorCode] { @@ -1398,7 +1398,7 @@ func (self *Descriptor) SyncData() witTypes.Result[witTypes.Unit, ErrorCode] { } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.get-flags +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.get-flags func wasm_import_method_descriptor_get_flags(arg0 int32, arg1 uintptr) int32 func (self *Descriptor) GetFlags() witTypes.Result[DescriptorFlags, ErrorCode] { @@ -1589,7 +1589,7 @@ func (self *Descriptor) GetFlags() witTypes.Result[DescriptorFlags, ErrorCode] { } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.get-type +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.get-type func wasm_import_method_descriptor_get_type(arg0 int32, arg1 uintptr) int32 func (self *Descriptor) GetType() witTypes.Result[DescriptorType, ErrorCode] { @@ -1829,7 +1829,7 @@ func (self *Descriptor) GetType() witTypes.Result[DescriptorType, ErrorCode] { } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.set-size +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.set-size func wasm_import_method_descriptor_set_size(arg0 int32, arg1 int64, arg2 uintptr) int32 func (self *Descriptor) SetSize(size uint64) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -2020,7 +2020,7 @@ func (self *Descriptor) SetSize(size uint64) witTypes.Result[witTypes.Unit, Erro } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.set-times +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.set-times func wasm_import_method_descriptor_set_times(arg0 uintptr, arg1 uintptr) int32 func (self *Descriptor) SetTimes(dataAccessTimestamp NewTimestamp, dataModificationTimestamp NewTimestamp) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -2251,7 +2251,7 @@ func (self *Descriptor) SetTimes(dataAccessTimestamp NewTimestamp, dataModificat } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [method]descriptor.read-directory +//go:wasmimport wasi:filesystem/types@0.3.0 [method]descriptor.read-directory func wasm_import_method_descriptor_read_directory(arg0 int32, arg1 uintptr) func (self *Descriptor) ReadDirectory() (*witTypes.StreamReader[DirectoryEntry], *witTypes.FutureReader[witTypes.Result[witTypes.Unit, ErrorCode]]) { @@ -2266,7 +2266,7 @@ func (self *Descriptor) ReadDirectory() (*witTypes.StreamReader[DirectoryEntry], } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.sync +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.sync func wasm_import_method_descriptor_sync(arg0 int32, arg1 uintptr) int32 func (self *Descriptor) Sync() witTypes.Result[witTypes.Unit, ErrorCode] { @@ -2457,7 +2457,7 @@ func (self *Descriptor) Sync() witTypes.Result[witTypes.Unit, ErrorCode] { } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.create-directory-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.create-directory-at func wasm_import_method_descriptor_create_directory_at(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr) int32 func (self *Descriptor) CreateDirectoryAt(path string) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -2650,7 +2650,7 @@ func (self *Descriptor) CreateDirectoryAt(path string) witTypes.Result[witTypes. } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.stat +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.stat func wasm_import_method_descriptor_stat(arg0 int32, arg1 uintptr) int32 func (self *Descriptor) Stat() witTypes.Result[DescriptorStat, ErrorCode] { @@ -2923,7 +2923,7 @@ func (self *Descriptor) Stat() witTypes.Result[DescriptorStat, ErrorCode] { } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.stat-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.stat-at func wasm_import_method_descriptor_stat_at(arg0 int32, arg1 int32, arg2 uintptr, arg3 uint32, arg4 uintptr) int32 func (self *Descriptor) StatAt(pathFlags PathFlags, path string) witTypes.Result[DescriptorStat, ErrorCode] { @@ -3198,7 +3198,7 @@ func (self *Descriptor) StatAt(pathFlags PathFlags, path string) witTypes.Result } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.set-times-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.set-times-at func wasm_import_method_descriptor_set_times_at(arg0 uintptr, arg1 uintptr) int32 func (self *Descriptor) SetTimesAt(pathFlags PathFlags, path string, dataAccessTimestamp NewTimestamp, dataModificationTimestamp NewTimestamp) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -3434,7 +3434,7 @@ func (self *Descriptor) SetTimesAt(pathFlags PathFlags, path string, dataAccessT } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.link-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.link-at func wasm_import_method_descriptor_link_at(arg0 uintptr, arg1 uintptr) int32 func (self *Descriptor) LinkAt(oldPathFlags PathFlags, oldPath string, newDescriptor *Descriptor, newPath string) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -3637,7 +3637,7 @@ func (self *Descriptor) LinkAt(oldPathFlags PathFlags, oldPath string, newDescri } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.open-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.open-at func wasm_import_method_descriptor_open_at(arg0 uintptr, arg1 uintptr) int32 func (self *Descriptor) OpenAt(pathFlags PathFlags, path string, openFlags OpenFlags, flags DescriptorFlags) witTypes.Result[*Descriptor, ErrorCode] { @@ -3837,7 +3837,7 @@ func (self *Descriptor) OpenAt(pathFlags PathFlags, path string, openFlags OpenF } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.readlink-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.readlink-at func wasm_import_method_descriptor_readlink_at(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr) int32 func (self *Descriptor) ReadlinkAt(path string) witTypes.Result[string, ErrorCode] { @@ -4031,7 +4031,7 @@ func (self *Descriptor) ReadlinkAt(path string) witTypes.Result[string, ErrorCod } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.remove-directory-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.remove-directory-at func wasm_import_method_descriptor_remove_directory_at(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr) int32 func (self *Descriptor) RemoveDirectoryAt(path string) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -4224,7 +4224,7 @@ func (self *Descriptor) RemoveDirectoryAt(path string) witTypes.Result[witTypes. } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.rename-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.rename-at func wasm_import_method_descriptor_rename_at(arg0 uintptr, arg1 uintptr) int32 func (self *Descriptor) RenameAt(oldPath string, newDescriptor *Descriptor, newPath string) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -4426,7 +4426,7 @@ func (self *Descriptor) RenameAt(oldPath string, newDescriptor *Descriptor, newP } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.symlink-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.symlink-at func wasm_import_method_descriptor_symlink_at(arg0 uintptr, arg1 uintptr) int32 func (self *Descriptor) SymlinkAt(oldPath string, newPath string) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -4627,7 +4627,7 @@ func (self *Descriptor) SymlinkAt(oldPath string, newPath string) witTypes.Resul } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.unlink-file-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.unlink-file-at func wasm_import_method_descriptor_unlink_file_at(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr) int32 func (self *Descriptor) UnlinkFileAt(path string) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -4820,7 +4820,7 @@ func (self *Descriptor) UnlinkFileAt(path string) witTypes.Result[witTypes.Unit, } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.is-same-object +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.is-same-object func wasm_import_method_descriptor_is_same_object(arg0 int32, arg1 int32, arg2 uintptr) int32 func (self *Descriptor) IsSameObject(other *Descriptor) bool { @@ -4835,7 +4835,7 @@ func (self *Descriptor) IsSameObject(other *Descriptor) bool { } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.metadata-hash +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.metadata-hash func wasm_import_method_descriptor_metadata_hash(arg0 int32, arg1 uintptr) int32 func (self *Descriptor) MetadataHash() witTypes.Result[MetadataHashValue, ErrorCode] { @@ -5026,7 +5026,7 @@ func (self *Descriptor) MetadataHash() witTypes.Result[MetadataHashValue, ErrorC } -//go:wasmimport wasi:filesystem/types@0.3.0-rc-2026-03-15 [async-lower][method]descriptor.metadata-hash-at +//go:wasmimport wasi:filesystem/types@0.3.0 [async-lower][method]descriptor.metadata-hash-at func wasm_import_method_descriptor_metadata_hash_at(arg0 int32, arg1 int32, arg2 uintptr, arg3 uint32, arg4 uintptr) int32 func (self *Descriptor) MetadataHashAt(pathFlags PathFlags, path string) witTypes.Result[MetadataHashValue, ErrorCode] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_random_insecure/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_random_insecure/wit_bindings.go index 903468b..da81f0b 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_random_insecure/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_random_insecure/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_random_insecure @@ -16,7 +16,7 @@ import ( "unsafe" ) -//go:wasmimport wasi:random/insecure@0.3.0-rc-2026-03-15 get-insecure-random-bytes +//go:wasmimport wasi:random/insecure@0.3.0 get-insecure-random-bytes func wasm_import_get_insecure_random_bytes(arg0 int64, arg1 uintptr) func GetInsecureRandomBytes(maxLen uint64) []uint8 { @@ -31,7 +31,7 @@ func GetInsecureRandomBytes(maxLen uint64) []uint8 { } -//go:wasmimport wasi:random/insecure@0.3.0-rc-2026-03-15 get-insecure-random-u64 +//go:wasmimport wasi:random/insecure@0.3.0 get-insecure-random-u64 func wasm_import_get_insecure_random_u64() int64 func GetInsecureRandomU64() uint64 { diff --git a/examples/sdk/pkg/bindings/imports/wasi_random_insecure_seed/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_random_insecure_seed/wit_bindings.go index 1135d10..a5e44cb 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_random_insecure_seed/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_random_insecure_seed/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_random_insecure_seed @@ -17,7 +17,7 @@ import ( "unsafe" ) -//go:wasmimport wasi:random/insecure-seed@0.3.0-rc-2026-03-15 get-insecure-seed +//go:wasmimport wasi:random/insecure-seed@0.3.0 get-insecure-seed func wasm_import_get_insecure_seed(arg0 uintptr) func GetInsecureSeed() (uint64, uint64) { diff --git a/examples/sdk/pkg/bindings/imports/wasi_random_random/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_random_random/wit_bindings.go index 269abaf..6903ee0 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_random_random/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_random_random/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_random_random @@ -16,7 +16,7 @@ import ( "unsafe" ) -//go:wasmimport wasi:random/random@0.3.0-rc-2026-03-15 get-random-bytes +//go:wasmimport wasi:random/random@0.3.0 get-random-bytes func wasm_import_get_random_bytes(arg0 int64, arg1 uintptr) func GetRandomBytes(maxLen uint64) []uint8 { @@ -31,7 +31,7 @@ func GetRandomBytes(maxLen uint64) []uint8 { } -//go:wasmimport wasi:random/random@0.3.0-rc-2026-03-15 get-random-u64 +//go:wasmimport wasi:random/random@0.3.0 get-random-u64 func wasm_import_get_random_u64() int64 func GetRandomU64() uint64 { diff --git a/examples/sdk/pkg/bindings/imports/wasi_sockets_ip_name_lookup/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_sockets_ip_name_lookup/wit_bindings.go index f974635..9eb9116 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_sockets_ip_name_lookup/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_sockets_ip_name_lookup/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_sockets_ip_name_lookup @@ -84,7 +84,7 @@ func MakeErrorCodeOther(value witTypes.Option[string]) ErrorCode { return ErrorCode{ErrorCodeOther, value} } -//go:wasmimport wasi:sockets/ip-name-lookup@0.3.0-rc-2026-03-15 [async-lower]resolve-addresses +//go:wasmimport wasi:sockets/ip-name-lookup@0.3.0 [async-lower]resolve-addresses func wasm_import_resolve_addresses(arg0 uintptr, arg1 uint32, arg2 uintptr) int32 func ResolveAddresses(name string) witTypes.Result[[]wasi_sockets_types.IpAddress, ErrorCode] { diff --git a/examples/sdk/pkg/bindings/imports/wasi_sockets_types/wit_bindings.go b/examples/sdk/pkg/bindings/imports/wasi_sockets_types/wit_bindings.go index 9b8c6e5..6d5e335 100644 --- a/examples/sdk/pkg/bindings/imports/wasi_sockets_types/wit_bindings.go +++ b/examples/sdk/pkg/bindings/imports/wasi_sockets_types/wit_bindings.go @@ -1,11 +1,11 @@ -// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.58.0. DO NOT EDIT! // // This code was generated from the following packages: -// wasi:clocks@0.3.0-rc-2026-03-15 -// wasi:filesystem@0.3.0-rc-2026-03-15 -// wasi:sockets@0.3.0-rc-2026-03-15 -// wasi:random@0.3.0-rc-2026-03-15 -// wasi:cli@0.3.0-rc-2026-03-15 +// wasi:clocks@0.3.0 +// wasi:filesystem@0.3.0 +// wasi:sockets@0.3.0 +// wasi:random@0.3.0 +// wasi:cli@0.3.0 // example:sdk package wasi_sockets_types @@ -18,19 +18,19 @@ import ( "unsafe" ) -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [stream-new-0][method]tcp-socket.listen +//go:wasmimport wasi:sockets/types@0.3.0 [stream-new-0][method]tcp-socket.listen func wasm_stream_new_tcp_socket() uint64 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][stream-read-0][method]tcp-socket.listen +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][stream-read-0][method]tcp-socket.listen func wasm_stream_read_tcp_socket(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][stream-write-0][method]tcp-socket.listen +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][stream-write-0][method]tcp-socket.listen func wasm_stream_write_tcp_socket(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [stream-drop-readable-0][method]tcp-socket.listen +//go:wasmimport wasi:sockets/types@0.3.0 [stream-drop-readable-0][method]tcp-socket.listen func wasm_stream_drop_readable_tcp_socket(handle int32) -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [stream-drop-writable-0][method]tcp-socket.listen +//go:wasmimport wasi:sockets/types@0.3.0 [stream-drop-writable-0][method]tcp-socket.listen func wasm_stream_drop_writable_tcp_socket(handle int32) func wasm_stream_lift_tcp_socket(src unsafe.Pointer) *TcpSocket { @@ -81,19 +81,19 @@ func LiftStreamTcpSocket(handle int32) *witTypes.StreamReader[*TcpSocket] { return witTypes.MakeStreamReader[*TcpSocket](&wasm_stream_vtable_tcp_socket, handle) } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [stream-new-0][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [stream-new-0][method]tcp-socket.send func wasm_stream_new_u8() uint64 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][stream-read-0][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][stream-read-0][method]tcp-socket.send func wasm_stream_read_u8(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][stream-write-0][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][stream-write-0][method]tcp-socket.send func wasm_stream_write_u8(handle int32, item unsafe.Pointer, count uint32) uint32 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [stream-drop-readable-0][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [stream-drop-readable-0][method]tcp-socket.send func wasm_stream_drop_readable_u8(handle int32) -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [stream-drop-writable-0][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [stream-drop-writable-0][method]tcp-socket.send func wasm_stream_drop_writable_u8(handle int32) var wasm_stream_vtable_u8 = witTypes.StreamVtable[uint8]{ @@ -119,19 +119,19 @@ func LiftStreamU8(handle int32) *witTypes.StreamReader[uint8] { return witTypes.MakeStreamReader[uint8](&wasm_stream_vtable_u8, handle) } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [future-new-1][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [future-new-1][method]tcp-socket.send func wasm_future_new_result_unit_error_code() uint64 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][future-read-1][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][future-read-1][method]tcp-socket.send func wasm_future_read_result_unit_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][future-write-1][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][future-write-1][method]tcp-socket.send func wasm_future_write_result_unit_error_code(handle int32, item unsafe.Pointer) uint32 -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [future-drop-readable-1][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [future-drop-readable-1][method]tcp-socket.send func wasm_future_drop_readable_result_unit_error_code(handle int32) -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [future-drop-writable-1][method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [future-drop-writable-1][method]tcp-socket.send func wasm_future_drop_writable_result_unit_error_code(handle int32) func wasm_future_lift_result_unit_error_code(src unsafe.Pointer) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -588,7 +588,7 @@ func MakeIpSocketAddressIpv6(value Ipv6SocketAddress) IpSocketAddress { return IpSocketAddress{IpSocketAddressIpv6, value} } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [resource-drop]tcp-socket +//go:wasmimport wasi:sockets/types@0.3.0 [resource-drop]tcp-socket func resourceDropTcpSocket(handle int32) // A TCP socket resource. @@ -600,7 +600,7 @@ func resourceDropTcpSocket(handle int32) // - `connecting` // - `connected` // - `closed` -// See +// See // for more information. // // Note: Except where explicitly mentioned, whenever this documentation uses @@ -663,7 +663,7 @@ func TcpSocketFromBorrowHandle(handleValue int32) *TcpSocket { return &TcpSocket{handle} } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [resource-drop]udp-socket +//go:wasmimport wasi:sockets/types@0.3.0 [resource-drop]udp-socket func resourceDropUdpSocket(handle int32) // A UDP socket handle. @@ -707,7 +707,7 @@ func UdpSocketFromBorrowHandle(handleValue int32) *UdpSocket { return &UdpSocket{handle} } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [static]tcp-socket.create +//go:wasmimport wasi:sockets/types@0.3.0 [static]tcp-socket.create func wasm_import_static_tcp_socket_create(arg0 int32, arg1 uintptr) func TcpSocketCreate(addressFamily IpAddressFamily) witTypes.Result[*TcpSocket, ErrorCode] { @@ -809,7 +809,7 @@ func TcpSocketCreate(addressFamily IpAddressFamily) witTypes.Result[*TcpSocket, } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.bind +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.bind func wasm_import_method_tcp_socket_bind(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 int32, arg5 int32, arg6 int32, arg7 int32, arg8 int32, arg9 int32, arg10 int32, arg11 int32, arg12 int32, arg13 uintptr) func (self *TcpSocket) Bind(localAddress IpSocketAddress) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -959,7 +959,7 @@ func (self *TcpSocket) Bind(localAddress IpSocketAddress) witTypes.Result[witTyp } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][method]tcp-socket.connect +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][method]tcp-socket.connect func wasm_import_method_tcp_socket_connect(arg0 uintptr, arg1 uintptr) int32 func (self *TcpSocket) Connect(remoteAddress IpSocketAddress) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -1093,7 +1093,7 @@ func (self *TcpSocket) Connect(remoteAddress IpSocketAddress) witTypes.Result[wi } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.listen +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.listen func wasm_import_method_tcp_socket_listen(arg0 int32, arg1 uintptr) func (self *TcpSocket) Listen() witTypes.Result[*witTypes.StreamReader[*TcpSocket], ErrorCode] { @@ -1195,7 +1195,7 @@ func (self *TcpSocket) Listen() witTypes.Result[*witTypes.StreamReader[*TcpSocke } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.send func wasm_import_method_tcp_socket_send(arg0 int32, arg1 int32) int32 func (self *TcpSocket) Send(data *witTypes.StreamReader[uint8]) *witTypes.FutureReader[witTypes.Result[witTypes.Unit, ErrorCode]] { @@ -1205,7 +1205,7 @@ func (self *TcpSocket) Send(data *witTypes.StreamReader[uint8]) *witTypes.Future } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.receive +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.receive func wasm_import_method_tcp_socket_receive(arg0 int32, arg1 uintptr) func (self *TcpSocket) Receive() (*witTypes.StreamReader[uint8], *witTypes.FutureReader[witTypes.Result[witTypes.Unit, ErrorCode]]) { @@ -1220,7 +1220,7 @@ func (self *TcpSocket) Receive() (*witTypes.StreamReader[uint8], *witTypes.Futur } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-local-address +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-local-address func wasm_import_method_tcp_socket_get_local_address(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetLocalAddress() witTypes.Result[IpSocketAddress, ErrorCode] { @@ -1335,7 +1335,7 @@ func (self *TcpSocket) GetLocalAddress() witTypes.Result[IpSocketAddress, ErrorC } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-remote-address +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-remote-address func wasm_import_method_tcp_socket_get_remote_address(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetRemoteAddress() witTypes.Result[IpSocketAddress, ErrorCode] { @@ -1450,7 +1450,7 @@ func (self *TcpSocket) GetRemoteAddress() witTypes.Result[IpSocketAddress, Error } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-is-listening +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-is-listening func wasm_import_method_tcp_socket_get_is_listening(arg0 int32) int32 func (self *TcpSocket) GetIsListening() bool { @@ -1460,7 +1460,7 @@ func (self *TcpSocket) GetIsListening() bool { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-address-family +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-address-family func wasm_import_method_tcp_socket_get_address_family(arg0 int32) int32 func (self *TcpSocket) GetAddressFamily() IpAddressFamily { @@ -1470,7 +1470,7 @@ func (self *TcpSocket) GetAddressFamily() IpAddressFamily { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.set-listen-backlog-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.set-listen-backlog-size func wasm_import_method_tcp_socket_set_listen_backlog_size(arg0 int32, arg1 int64, arg2 uintptr) func (self *TcpSocket) SetListenBacklogSize(value uint64) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -1572,7 +1572,7 @@ func (self *TcpSocket) SetListenBacklogSize(value uint64) witTypes.Result[witTyp } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-keep-alive-enabled +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-keep-alive-enabled func wasm_import_method_tcp_socket_get_keep_alive_enabled(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetKeepAliveEnabled() witTypes.Result[bool, ErrorCode] { @@ -1674,7 +1674,7 @@ func (self *TcpSocket) GetKeepAliveEnabled() witTypes.Result[bool, ErrorCode] { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.set-keep-alive-enabled +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.set-keep-alive-enabled func wasm_import_method_tcp_socket_set_keep_alive_enabled(arg0 int32, arg1 int32, arg2 uintptr) func (self *TcpSocket) SetKeepAliveEnabled(value bool) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -1782,7 +1782,7 @@ func (self *TcpSocket) SetKeepAliveEnabled(value bool) witTypes.Result[witTypes. } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-keep-alive-idle-time +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-keep-alive-idle-time func wasm_import_method_tcp_socket_get_keep_alive_idle_time(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetKeepAliveIdleTime() witTypes.Result[uint64, ErrorCode] { @@ -1884,7 +1884,7 @@ func (self *TcpSocket) GetKeepAliveIdleTime() witTypes.Result[uint64, ErrorCode] } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.set-keep-alive-idle-time +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.set-keep-alive-idle-time func wasm_import_method_tcp_socket_set_keep_alive_idle_time(arg0 int32, arg1 int64, arg2 uintptr) func (self *TcpSocket) SetKeepAliveIdleTime(value uint64) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -1986,7 +1986,7 @@ func (self *TcpSocket) SetKeepAliveIdleTime(value uint64) witTypes.Result[witTyp } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-keep-alive-interval +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-keep-alive-interval func wasm_import_method_tcp_socket_get_keep_alive_interval(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetKeepAliveInterval() witTypes.Result[uint64, ErrorCode] { @@ -2088,7 +2088,7 @@ func (self *TcpSocket) GetKeepAliveInterval() witTypes.Result[uint64, ErrorCode] } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.set-keep-alive-interval +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.set-keep-alive-interval func wasm_import_method_tcp_socket_set_keep_alive_interval(arg0 int32, arg1 int64, arg2 uintptr) func (self *TcpSocket) SetKeepAliveInterval(value uint64) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -2190,7 +2190,7 @@ func (self *TcpSocket) SetKeepAliveInterval(value uint64) witTypes.Result[witTyp } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-keep-alive-count +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-keep-alive-count func wasm_import_method_tcp_socket_get_keep_alive_count(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetKeepAliveCount() witTypes.Result[uint32, ErrorCode] { @@ -2292,7 +2292,7 @@ func (self *TcpSocket) GetKeepAliveCount() witTypes.Result[uint32, ErrorCode] { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.set-keep-alive-count +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.set-keep-alive-count func wasm_import_method_tcp_socket_set_keep_alive_count(arg0 int32, arg1 int32, arg2 uintptr) func (self *TcpSocket) SetKeepAliveCount(value uint32) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -2394,7 +2394,7 @@ func (self *TcpSocket) SetKeepAliveCount(value uint32) witTypes.Result[witTypes. } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-hop-limit +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-hop-limit func wasm_import_method_tcp_socket_get_hop_limit(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetHopLimit() witTypes.Result[uint8, ErrorCode] { @@ -2496,7 +2496,7 @@ func (self *TcpSocket) GetHopLimit() witTypes.Result[uint8, ErrorCode] { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.set-hop-limit +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.set-hop-limit func wasm_import_method_tcp_socket_set_hop_limit(arg0 int32, arg1 int32, arg2 uintptr) func (self *TcpSocket) SetHopLimit(value uint8) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -2598,7 +2598,7 @@ func (self *TcpSocket) SetHopLimit(value uint8) witTypes.Result[witTypes.Unit, E } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-receive-buffer-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-receive-buffer-size func wasm_import_method_tcp_socket_get_receive_buffer_size(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetReceiveBufferSize() witTypes.Result[uint64, ErrorCode] { @@ -2700,7 +2700,7 @@ func (self *TcpSocket) GetReceiveBufferSize() witTypes.Result[uint64, ErrorCode] } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.set-receive-buffer-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.set-receive-buffer-size func wasm_import_method_tcp_socket_set_receive_buffer_size(arg0 int32, arg1 int64, arg2 uintptr) func (self *TcpSocket) SetReceiveBufferSize(value uint64) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -2802,7 +2802,7 @@ func (self *TcpSocket) SetReceiveBufferSize(value uint64) witTypes.Result[witTyp } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.get-send-buffer-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.get-send-buffer-size func wasm_import_method_tcp_socket_get_send_buffer_size(arg0 int32, arg1 uintptr) func (self *TcpSocket) GetSendBufferSize() witTypes.Result[uint64, ErrorCode] { @@ -2904,7 +2904,7 @@ func (self *TcpSocket) GetSendBufferSize() witTypes.Result[uint64, ErrorCode] { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]tcp-socket.set-send-buffer-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]tcp-socket.set-send-buffer-size func wasm_import_method_tcp_socket_set_send_buffer_size(arg0 int32, arg1 int64, arg2 uintptr) func (self *TcpSocket) SetSendBufferSize(value uint64) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -3006,7 +3006,7 @@ func (self *TcpSocket) SetSendBufferSize(value uint64) witTypes.Result[witTypes. } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [static]udp-socket.create +//go:wasmimport wasi:sockets/types@0.3.0 [static]udp-socket.create func wasm_import_static_udp_socket_create(arg0 int32, arg1 uintptr) func UdpSocketCreate(addressFamily IpAddressFamily) witTypes.Result[*UdpSocket, ErrorCode] { @@ -3108,7 +3108,7 @@ func UdpSocketCreate(addressFamily IpAddressFamily) witTypes.Result[*UdpSocket, } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.bind +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.bind func wasm_import_method_udp_socket_bind(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 int32, arg5 int32, arg6 int32, arg7 int32, arg8 int32, arg9 int32, arg10 int32, arg11 int32, arg12 int32, arg13 uintptr) func (self *UdpSocket) Bind(localAddress IpSocketAddress) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -3258,7 +3258,7 @@ func (self *UdpSocket) Bind(localAddress IpSocketAddress) witTypes.Result[witTyp } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.connect +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.connect func wasm_import_method_udp_socket_connect(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 int32, arg5 int32, arg6 int32, arg7 int32, arg8 int32, arg9 int32, arg10 int32, arg11 int32, arg12 int32, arg13 uintptr) func (self *UdpSocket) Connect(remoteAddress IpSocketAddress) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -3408,7 +3408,7 @@ func (self *UdpSocket) Connect(remoteAddress IpSocketAddress) witTypes.Result[wi } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.disconnect +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.disconnect func wasm_import_method_udp_socket_disconnect(arg0 int32, arg1 uintptr) func (self *UdpSocket) Disconnect() witTypes.Result[witTypes.Unit, ErrorCode] { @@ -3510,7 +3510,7 @@ func (self *UdpSocket) Disconnect() witTypes.Result[witTypes.Unit, ErrorCode] { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][method]udp-socket.send +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][method]udp-socket.send func wasm_import_method_udp_socket_send(arg0 uintptr, arg1 uintptr) int32 func (self *UdpSocket) Send(data []uint8, remoteAddress witTypes.Option[IpSocketAddress]) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -3660,7 +3660,7 @@ func (self *UdpSocket) Send(data []uint8, remoteAddress witTypes.Option[IpSocket } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [async-lower][method]udp-socket.receive +//go:wasmimport wasi:sockets/types@0.3.0 [async-lower][method]udp-socket.receive func wasm_import_method_udp_socket_receive(arg0 int32, arg1 uintptr) int32 func (self *UdpSocket) Receive() witTypes.Result[witTypes.Tuple2[[]uint8, IpSocketAddress], ErrorCode] { @@ -3777,7 +3777,7 @@ func (self *UdpSocket) Receive() witTypes.Result[witTypes.Tuple2[[]uint8, IpSock } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.get-local-address +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.get-local-address func wasm_import_method_udp_socket_get_local_address(arg0 int32, arg1 uintptr) func (self *UdpSocket) GetLocalAddress() witTypes.Result[IpSocketAddress, ErrorCode] { @@ -3892,7 +3892,7 @@ func (self *UdpSocket) GetLocalAddress() witTypes.Result[IpSocketAddress, ErrorC } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.get-remote-address +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.get-remote-address func wasm_import_method_udp_socket_get_remote_address(arg0 int32, arg1 uintptr) func (self *UdpSocket) GetRemoteAddress() witTypes.Result[IpSocketAddress, ErrorCode] { @@ -4007,7 +4007,7 @@ func (self *UdpSocket) GetRemoteAddress() witTypes.Result[IpSocketAddress, Error } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.get-address-family +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.get-address-family func wasm_import_method_udp_socket_get_address_family(arg0 int32) int32 func (self *UdpSocket) GetAddressFamily() IpAddressFamily { @@ -4017,7 +4017,7 @@ func (self *UdpSocket) GetAddressFamily() IpAddressFamily { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.get-unicast-hop-limit +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.get-unicast-hop-limit func wasm_import_method_udp_socket_get_unicast_hop_limit(arg0 int32, arg1 uintptr) func (self *UdpSocket) GetUnicastHopLimit() witTypes.Result[uint8, ErrorCode] { @@ -4119,7 +4119,7 @@ func (self *UdpSocket) GetUnicastHopLimit() witTypes.Result[uint8, ErrorCode] { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.set-unicast-hop-limit +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.set-unicast-hop-limit func wasm_import_method_udp_socket_set_unicast_hop_limit(arg0 int32, arg1 int32, arg2 uintptr) func (self *UdpSocket) SetUnicastHopLimit(value uint8) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -4221,7 +4221,7 @@ func (self *UdpSocket) SetUnicastHopLimit(value uint8) witTypes.Result[witTypes. } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.get-receive-buffer-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.get-receive-buffer-size func wasm_import_method_udp_socket_get_receive_buffer_size(arg0 int32, arg1 uintptr) func (self *UdpSocket) GetReceiveBufferSize() witTypes.Result[uint64, ErrorCode] { @@ -4323,7 +4323,7 @@ func (self *UdpSocket) GetReceiveBufferSize() witTypes.Result[uint64, ErrorCode] } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.set-receive-buffer-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.set-receive-buffer-size func wasm_import_method_udp_socket_set_receive_buffer_size(arg0 int32, arg1 int64, arg2 uintptr) func (self *UdpSocket) SetReceiveBufferSize(value uint64) witTypes.Result[witTypes.Unit, ErrorCode] { @@ -4425,7 +4425,7 @@ func (self *UdpSocket) SetReceiveBufferSize(value uint64) witTypes.Result[witTyp } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.get-send-buffer-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.get-send-buffer-size func wasm_import_method_udp_socket_get_send_buffer_size(arg0 int32, arg1 uintptr) func (self *UdpSocket) GetSendBufferSize() witTypes.Result[uint64, ErrorCode] { @@ -4527,7 +4527,7 @@ func (self *UdpSocket) GetSendBufferSize() witTypes.Result[uint64, ErrorCode] { } -//go:wasmimport wasi:sockets/types@0.3.0-rc-2026-03-15 [method]udp-socket.set-send-buffer-size +//go:wasmimport wasi:sockets/types@0.3.0 [method]udp-socket.set-send-buffer-size func wasm_import_method_udp_socket_set_send_buffer_size(arg0 int32, arg1 int64, arg2 uintptr) func (self *UdpSocket) SetSendBufferSize(value uint64) witTypes.Result[witTypes.Unit, ErrorCode] { diff --git a/examples/sdk/pkg/go.mod b/examples/sdk/pkg/go.mod index bd70d07..1d9ce13 100644 --- a/examples/sdk/pkg/go.mod +++ b/examples/sdk/pkg/go.mod @@ -2,4 +2,4 @@ module pkg go 1.25.5 -require go.bytecodealliance.org/pkg v0.2.1 +require go.bytecodealliance.org/pkg v0.2.2 diff --git a/examples/sdk/pkg/go.sum b/examples/sdk/pkg/go.sum index a18d6dc..c2ef3ce 100644 --- a/examples/sdk/pkg/go.sum +++ b/examples/sdk/pkg/go.sum @@ -1,2 +1,2 @@ -go.bytecodealliance.org/pkg v0.2.1 h1:TdRagooIcCW3UmlKqVO4cDR3GNDyfDnbiBzGI6TOvyg= -go.bytecodealliance.org/pkg v0.2.1/go.mod h1:OjA+V8g3uUFixeCKFfamm6sYhTJdg8fvwEdJ2GO0GSk= +go.bytecodealliance.org/pkg v0.2.2 h1:O0wrZ3Mk/h9pN5747kuuIVsYlwf03kLFw+czFMV9hec= +go.bytecodealliance.org/pkg v0.2.2/go.mod h1:OjA+V8g3uUFixeCKFfamm6sYhTJdg8fvwEdJ2GO0GSk= diff --git a/examples/sdk/pkg/wit/deps/wasi-cli-0.3.0-rc-2026-03-15/package.wit b/examples/sdk/pkg/wit/deps/wasi-cli-0.3.0/package.wit similarity index 62% rename from examples/sdk/pkg/wit/deps/wasi-cli-0.3.0-rc-2026-03-15/package.wit rename to examples/sdk/pkg/wit/deps/wasi-cli-0.3.0/package.wit index 8ba52c5..7aae56c 100644 --- a/examples/sdk/pkg/wit/deps/wasi-cli-0.3.0-rc-2026-03-15/package.wit +++ b/examples/sdk/pkg/wit/deps/wasi-cli-0.3.0/package.wit @@ -1,6 +1,6 @@ -package wasi:cli@0.3.0-rc-2026-03-15; +package wasi:cli@0.3.0; -@since(version = 0.3.0-rc-2026-03-15) +@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-03-15) + @since(version = 0.3.0) get-environment: func() -> list>; /// Get the POSIX-style arguments to the program. - @since(version = 0.3.0-rc-2026-03-15) + @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-03-15) + @since(version = 0.3.0) get-initial-cwd: func() -> option; } -@since(version = 0.3.0-rc-2026-03-15) +@since(version = 0.3.0) interface exit { /// Exit the current instance and any linked instances. - @since(version = 0.3.0-rc-2026-03-15) + @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-03-15) +@since(version = 0.3.0) interface run { /// Run the program. - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) run: async func() -> result; } -@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) + @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-03-15) +@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-03-15) + @since(version = 0.3.0) read-via-stream: func() -> tuple, future>>; } -@since(version = 0.3.0-rc-2026-03-15) +@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-03-15) + @since(version = 0.3.0) write-via-stream: func(data: stream) -> future>; } -@since(version = 0.3.0-rc-2026-03-15) +@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-03-15) + @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-03-15) +@since(version = 0.3.0) interface terminal-input { /// The input side of a terminal. - @since(version = 0.3.0-rc-2026-03-15) + @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-03-15) +@since(version = 0.3.0) interface terminal-output { /// The output side of a terminal. - @since(version = 0.3.0-rc-2026-03-15) + @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-03-15) +@since(version = 0.3.0) interface terminal-stdin { - @since(version = 0.3.0-rc-2026-03-15) + @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-03-15) + @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-03-15) +@since(version = 0.3.0) interface terminal-stdout { - @since(version = 0.3.0-rc-2026-03-15) + @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-03-15) + @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-03-15) +@since(version = 0.3.0) interface terminal-stderr { - @since(version = 0.3.0-rc-2026-03-15) + @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-03-15) + @since(version = 0.3.0) get-terminal-stderr: func() -> option; } -@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 environment; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import exit; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import types; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import stdin; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import stdout; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import stderr; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import terminal-input; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import terminal-output; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import terminal-stdin; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import terminal-stdout; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) 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; + 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-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; + 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-03-15) +@since(version = 0.3.0) world command { - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import environment; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import exit; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import types; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import stdin; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import stdout; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import stderr; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import terminal-input; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import terminal-output; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import terminal-stdin; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) import terminal-stdout; - @since(version = 0.3.0-rc-2026-03-15) + @since(version = 0.3.0) 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; + 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-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; + 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-03-15) + @since(version = 0.3.0) export run; } diff --git a/examples/sdk/pkg/wit/deps/wasi-clocks-0.3.0-rc-2026-03-15/package.wit b/examples/sdk/pkg/wit/deps/wasi-clocks-0.3.0/package.wit similarity index 93% rename from examples/sdk/pkg/wit/deps/wasi-clocks-0.3.0-rc-2026-03-15/package.wit rename to examples/sdk/pkg/wit/deps/wasi-clocks-0.3.0/package.wit index 9e39e1d..871adf0 100644 --- a/examples/sdk/pkg/wit/deps/wasi-clocks-0.3.0-rc-2026-03-15/package.wit +++ b/examples/sdk/pkg/wit/deps/wasi-clocks-0.3.0/package.wit @@ -1,4 +1,4 @@ -package wasi:clocks@0.3.0-rc-2026-03-15; +package wasi:clocks@0.3.0; interface types { type duration = u64; diff --git a/examples/sdk/pkg/wit/deps/wasi-filesystem-0.3.0-rc-2026-03-15/package.wit b/examples/sdk/pkg/wit/deps/wasi-filesystem-0.3.0/package.wit similarity index 97% rename from examples/sdk/pkg/wit/deps/wasi-filesystem-0.3.0-rc-2026-03-15/package.wit rename to examples/sdk/pkg/wit/deps/wasi-filesystem-0.3.0/package.wit index 9692ed4..492d2ca 100644 --- a/examples/sdk/pkg/wit/deps/wasi-filesystem-0.3.0-rc-2026-03-15/package.wit +++ b/examples/sdk/pkg/wit/deps/wasi-filesystem-0.3.0/package.wit @@ -1,7 +1,7 @@ -package wasi:filesystem@0.3.0-rc-2026-03-15; +package wasi:filesystem@0.3.0; interface types { - use wasi:clocks/system-clock@0.3.0-rc-2026-03-15.{instant}; + use wasi:clocks/system-clock@0.3.0.{instant}; type filesize = u64; diff --git a/examples/sdk/pkg/wit/deps/wasi-random-0.3.0-rc-2026-03-15/package.wit b/examples/sdk/pkg/wit/deps/wasi-random-0.3.0/package.wit similarity index 88% rename from examples/sdk/pkg/wit/deps/wasi-random-0.3.0-rc-2026-03-15/package.wit rename to examples/sdk/pkg/wit/deps/wasi-random-0.3.0/package.wit index d5cb224..f6cfb81 100644 --- a/examples/sdk/pkg/wit/deps/wasi-random-0.3.0-rc-2026-03-15/package.wit +++ b/examples/sdk/pkg/wit/deps/wasi-random-0.3.0/package.wit @@ -1,4 +1,4 @@ -package wasi:random@0.3.0-rc-2026-03-15; +package wasi:random@0.3.0; interface random { get-random-bytes: func(max-len: u64) -> list; diff --git a/examples/sdk/pkg/wit/deps/wasi-sockets-0.3.0-rc-2026-03-15/package.wit b/examples/sdk/pkg/wit/deps/wasi-sockets-0.3.0/package.wit similarity index 93% rename from examples/sdk/pkg/wit/deps/wasi-sockets-0.3.0-rc-2026-03-15/package.wit rename to examples/sdk/pkg/wit/deps/wasi-sockets-0.3.0/package.wit index cde2e4d..0dd27a4 100644 --- a/examples/sdk/pkg/wit/deps/wasi-sockets-0.3.0-rc-2026-03-15/package.wit +++ b/examples/sdk/pkg/wit/deps/wasi-sockets-0.3.0/package.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; } diff --git a/examples/sdk/pkg/wit/world.wit b/examples/sdk/pkg/wit/world.wit index b3f6f5a..6f1a04a 100644 --- a/examples/sdk/pkg/wit/world.wit +++ b/examples/sdk/pkg/wit/world.wit @@ -1,6 +1,6 @@ package example:sdk; world test { - include wasi:cli/command@0.3.0-rc-2026-03-15; - include wasi:sockets/imports@0.3.0-rc-2026-03-15; + include wasi:cli/command@0.3.0; + include wasi:sockets/imports@0.3.0; } \ No newline at end of file diff --git a/examples/wasip1/README.md b/examples/wasip1/README.md index 40cbfd4..f28b9b6 100644 --- a/examples/wasip1/README.md +++ b/examples/wasip1/README.md @@ -6,7 +6,7 @@ - [**componentize-go**](https://github.com/bytecodealliance/componentize-go) - Latest version - [**go**](https://go.dev/dl/) - v1.25.9 -- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v44.0.1 +- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v46.0.1 ### Run diff --git a/examples/wasip2/README.md b/examples/wasip2/README.md index e42a665..1c4c90d 100644 --- a/examples/wasip2/README.md +++ b/examples/wasip2/README.md @@ -6,7 +6,7 @@ - [**componentize-go**](https://github.com/bytecodealliance/componentize-go) - Latest version - [**go**](https://go.dev/dl/) - v1.25.9 -- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v44.0.1 +- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v46.0.1 ### Run diff --git a/examples/wasip3/README.md b/examples/wasip3/README.md index 9e8ac7b..eb112fd 100644 --- a/examples/wasip3/README.md +++ b/examples/wasip3/README.md @@ -1,6 +1,6 @@ # `wasip3` Example -This demonstrates how to implement a `wasi:http@0.3.0-rc-2025-09-16` handler +This demonstrates how to implement a `wasi:http@0.3.0` handler using Go, based on a new `wit-bindgen-go` bindings generator which supports idiomatic, goroutine-based concurrency on top of the [Component Model concurrency @@ -19,12 +19,12 @@ switch to the upstream releases. ### Prerequisites - [**componentize-go**](https://github.com/bytecodealliance/componentize-go) - Latest version -- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v44.0.1 +- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v46.0.1 ### Build and Run This will build the dependencies, generate Go bindings from the -`wasi:http@0.3.0-rc-2025-09-16` WIT files, build the component, and run it using +`wasi:http@0.3.0` WIT files, build the component, and run it using `wasmtime serve`: ```shell diff --git a/examples/wasip3/wit/deps/cli.wit b/examples/wasip3/wit/deps/cli.wit deleted file mode 100644 index 8ba52c5..0000000 --- a/examples/wasip3/wit/deps/cli.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/examples/wasip3/wit/deps/clocks.wit b/examples/wasip3/wit/deps/clocks.wit deleted file mode 100644 index 19fc4bc..0000000 --- a/examples/wasip3/wit/deps/clocks.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/examples/wasip3/wit/deps/filesystem.wit b/examples/wasip3/wit/deps/filesystem.wit deleted file mode 100644 index 697681f..0000000 --- a/examples/wasip3/wit/deps/filesystem.wit +++ /dev/null @@ -1,575 +0,0 @@ -package wasi:filesystem@0.3.0-rc-2026-03-15; - -/// 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-03-15) -interface types { - @since(version = 0.3.0-rc-2026-03-15) - use wasi:clocks/system-clock@0.3.0-rc-2026-03-15.{instant}; - - /// File size or length of a region within a file. - @since(version = 0.3.0-rc-2026-03-15) - 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) - variant descriptor-type { - /// 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, - /// The type of the descriptor or file is different from any of the - /// other types specified. - other(option), - } - - /// Descriptor flags. - /// - /// Note: This was called `fdflags` in earlier versions of WASI. - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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-03-15) - 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-03-15) - 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-03-15) - variant 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, - /// A catch-all for errors not captured by the existing variants. - /// Implementations can use this to extend the error type without - /// breaking existing code. - other(option), - } - - /// File or memory access pattern advisory information. - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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) - 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-03-15) - 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-03-15) - 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) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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) - 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-03-15) - symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>; - /// Unlink a filesystem object that is not a directory. - /// - /// This is similar to `unlinkat(fd, path, 0)` in POSIX. - /// - /// Error returns are as specified by POSIX. - /// - /// 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) - 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-03-15) - 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-03-15) - 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) - metadata-hash-at: async func(path-flags: path-flags, path: string) -> result; - } -} - -@since(version = 0.3.0-rc-2026-03-15) -interface preopens { - @since(version = 0.3.0-rc-2026-03-15) - use types.{descriptor}; - - /// Return the set of preopened directories, and their paths. - @since(version = 0.3.0-rc-2026-03-15) - get-directories: func() -> list>; -} - -@since(version = 0.3.0-rc-2026-03-15) -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) - import types; - @since(version = 0.3.0-rc-2026-03-15) - import preopens; -} diff --git a/examples/wasip3/wit/deps/random.wit b/examples/wasip3/wit/deps/random.wit deleted file mode 100644 index 026f44a..0000000 --- a/examples/wasip3/wit/deps/random.wit +++ /dev/null @@ -1,107 +0,0 @@ -package wasi:random@0.3.0-rc-2026-03-15; - -/// 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) -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-03-15) - 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-03-15) -interface insecure { - /// Return up to `max-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. - /// - /// Implementations MAY return fewer bytes than requested (a short read). - /// Callers that require exactly `max-len` bytes MUST call this function in - /// a loop until the desired number of bytes has been accumulated. - /// 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) - 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) - 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-03-15) -interface random { - /// Return up to `max-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. - /// - /// Implementations MAY return fewer bytes than requested (a short read). - /// Callers that require exactly `max-len` bytes MUST call this function in - /// a loop until the desired number of bytes has been accumulated. - /// 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. - /// - /// 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) - 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) - get-random-u64: func() -> u64; -} - -@since(version = 0.3.0-rc-2026-03-15) -world imports { - @since(version = 0.3.0-rc-2026-03-15) - import random; - @since(version = 0.3.0-rc-2026-03-15) - import insecure; - @since(version = 0.3.0-rc-2026-03-15) - import insecure-seed; -} diff --git a/examples/wasip3/wit/deps/sockets.wit b/examples/wasip3/wit/deps/sockets.wit deleted file mode 100644 index cde2e4d..0000000 --- a/examples/wasip3/wit/deps/sockets.wit +++ /dev/null @@ -1,839 +0,0 @@ -package wasi:sockets@0.3.0-rc-2026-03-15; - -@since(version = 0.3.0-rc-2026-03-15) -interface types { - @since(version = 0.3.0-rc-2026-03-15) - use wasi:clocks/types@0.3.0-rc-2026-03-15.{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: - /// - `other` - /// - `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-03-15) - variant error-code { - /// Access denied. - /// - /// POSIX equivalent: EACCES, EPERM - access-denied, - /// The operation is not supported. - /// - /// POSIX equivalent: EOPNOTSUPP, ENOPROTOOPT, EPFNOSUPPORT, EPROTONOSUPPORT, ESOCKTNOSUPPORT - not-supported, - /// One of the arguments is invalid. - /// - /// POSIX equivalent: EINVAL, EDESTADDRREQ, EAFNOSUPPORT - invalid-argument, - /// Not enough memory to complete the operation. - /// - /// POSIX equivalent: ENOMEM, ENOBUFS - out-of-memory, - /// The operation timed out before it could finish completely. - /// - /// POSIX equivalent: ETIMEDOUT - timeout, - /// The operation is not valid in the socket's current state. - invalid-state, - /// The local address is not available. - /// - /// POSIX equivalent: EADDRNOTAVAIL - address-not-bindable, - /// A bind operation failed because the provided address is already in - /// use or because there are no ephemeral ports available. - /// - /// POSIX equivalent: EADDRINUSE - address-in-use, - /// The remote address is not reachable. - /// - /// POSIX equivalent: EHOSTUNREACH, EHOSTDOWN, ENETDOWN, ENETUNREACH, ENONET - remote-unreachable, - /// The connection was forcefully rejected. - /// - /// POSIX equivalent: ECONNREFUSED - connection-refused, - /// A write failed because the connection was broken. - /// - /// POSIX equivalent: EPIPE - connection-broken, - /// The connection was reset. - /// - /// POSIX equivalent: ECONNRESET - connection-reset, - /// The connection was aborted. - /// - /// POSIX equivalent: ECONNABORTED - connection-aborted, - /// The size of a datagram sent to a UDP socket exceeded the maximum - /// supported size. - /// - /// POSIX equivalent: EMSGSIZE - datagram-too-large, - /// A catch-all for errors not captured by the existing variants. - /// Implementations can use this to extend the error type without - /// breaking existing code. - other(option), - } - - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - type ipv4-address = tuple; - - @since(version = 0.3.0-rc-2026-03-15) - type ipv6-address = tuple; - - @since(version = 0.3.0-rc-2026-03-15) - variant ip-address { - ipv4(ipv4-address), - ipv6(ipv6-address), - } - - @since(version = 0.3.0-rc-2026-03-15) - record ipv4-socket-address { - /// sin_port - port: u16, - /// sin_addr - address: ipv4-address, - } - - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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`) - /// - /// WASI uses shared ownership semantics: the `tcp-socket` handle and all - /// derived `stream` and `future` values reference a single underlying OS - /// socket: - /// - Send/receive streams remain functional after the original `tcp-socket` - /// handle is dropped. - /// - The stream returned by `listen` behaves similarly. - /// - Client sockets returned by `tcp-socket::listen` are independent and do - /// not keep the listening socket alive. - /// - /// The OS socket is closed only after the last handle is dropped. This - /// model has observable effects; for example, it affects when the local - /// port binding is released. - /// - /// 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) - 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. - /// - /// # Typical errors - /// - `not-supported`: The `address-family` is not supported. (EAFNOSUPPORT) - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-03-15) - 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 - /// The 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. - /// - /// # References - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-03-15) - 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 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. - /// - /// 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-03-15) - 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-03-15) - 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) - /// - `invalid-state`: `send` has already been called on this socket. - /// - `connection-broken`: The connection is not writable anymore. (EPIPE, ECONNABORTED on Windows) - /// - `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-03-15) - send: func(data: stream) -> future>; - /// Read data from peer. - /// - /// Returns a `stream` of data sent by the peer. The implementation - /// drops the stream once no more data is available. At that point, the - /// returned `future` resolves to: - /// - `ok` after a graceful shutdown from the peer (i.e. a FIN packet), or - /// - `err` if the socket was closed abnormally. - /// - /// `receive` may be called only once per socket. Subsequent calls return - /// a closed stream and a future resolved to `err(invalid-state)`. - /// - /// If the caller is not expecting to receive any more data from the peer, - /// they should 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) - /// - `invalid-state`: `receive` has already been called on this socket. - /// - `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-03-15) - 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-03-15) - 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-03-15) - 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) - 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) - 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-03-15) - 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-03-15) - get-keep-alive-enabled: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// 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-03-15) - get-keep-alive-idle-time: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// Equivalent to the TCP_KEEPINTVL socket option. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) - get-keep-alive-interval: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// Equivalent to the TCP_KEEPCNT socket option. - /// - /// # Typical errors - /// - `invalid-argument`: (set) The provided value was 0. - @since(version = 0.3.0-rc-2026-03-15) - get-keep-alive-count: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - get-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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, - /// rather than allocating the full amount immediately. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// This is only a performance hint. The implementation may ignore it or - /// tweak it based on real traffic patterns. - /// Linux and macOS appear to behave differently depending on whether a - /// buffer size was explicitly set. When set, they tend to honor it; when - /// not set, they dynamically adjust the buffer size as the connection - /// progresses. This is especially noticeable when comparing the values - /// from before and after connection establishment. - /// - /// 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-03-15) - get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-03-15) - get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - } - - /// A UDP socket handle. - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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 remote 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-03-15) - 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`. - /// - /// If the socket has not been explicitly bound, it will be - /// implicitly bound to a random free port. - /// - /// 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) - /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) - /// - /// # Implementors note - /// WASI requires `send` to perform an implicit bind if the socket - /// has not been bound. Not all platforms (notably Windows) exhibit - /// this behavior natively. On such platforms, the WASI implementation - /// should emulate it by performing the bind if the guest has not - /// already done so. - /// - /// # References - /// - - /// - - /// - - /// - - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-03-15) - 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-03-15) - 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-03-15) - 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-03-15) - 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) - 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-03-15) - get-unicast-hop-limit: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - 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, - /// rather than allocating the full amount immediately. - /// - /// If the provided value is 0, an `invalid-argument` error is returned. - /// All other values are accepted without error, but may be - /// clamped or rounded. As a result, the value read back from - /// this setting may differ from the value that was set. - /// - /// 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-03-15) - get-receive-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - @since(version = 0.3.0-rc-2026-03-15) - get-send-buffer-size: func() -> result; - @since(version = 0.3.0-rc-2026-03-15) - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - } -} - -@since(version = 0.3.0-rc-2026-03-15) -interface ip-name-lookup { - @since(version = 0.3.0-rc-2026-03-15) - use types.{ip-address}; - - /// Lookup error codes. - @since(version = 0.3.0-rc-2026-03-15) - variant error-code { - /// 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, - /// A catch-all for errors not captured by the existing variants. - /// Implementations can use this to extend the error type without - /// breaking existing code. - other(option), - } - - /// 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. - /// - /// # References: - /// - - /// - - /// - - /// - - @since(version = 0.3.0-rc-2026-03-15) - resolve-addresses: async func(name: string) -> result, error-code>; -} - -@since(version = 0.3.0-rc-2026-03-15) -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 types; - @since(version = 0.3.0-rc-2026-03-15) - import ip-name-lookup; -} diff --git a/examples/wasip3/wit/deps/wasi-cli-0.3.0/package.wit b/examples/wasip3/wit/deps/wasi-cli-0.3.0/package.wit new file mode 100644 index 0000000..d0b02bb --- /dev/null +++ b/examples/wasip3/wit/deps/wasi-cli-0.3.0/package.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/examples/wasip3/wit/deps/wasi-clocks-0.3.0/package.wit b/examples/wasip3/wit/deps/wasi-clocks-0.3.0/package.wit new file mode 100644 index 0000000..871adf0 --- /dev/null +++ b/examples/wasip3/wit/deps/wasi-clocks-0.3.0/package.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/examples/wasip3/wit/deps/http.wit b/examples/wasip3/wit/deps/wasi-http-0.3.0/package.wit similarity index 91% rename from examples/wasip3/wit/deps/http.wit rename to examples/wasip3/wit/deps/wasi-http-0.3.0/package.wit index c1c1e68..08458f7 100644 --- a/examples/wasip3/wit/deps/http.wit +++ b/examples/wasip3/wit/deps/wasi-http-0.3.0/package.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/examples/wasip3/wit/deps/wasi-random-0.3.0/package.wit b/examples/wasip3/wit/deps/wasi-random-0.3.0/package.wit new file mode 100644 index 0000000..f6cfb81 --- /dev/null +++ b/examples/wasip3/wit/deps/wasi-random-0.3.0/package.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/examples/wasip3/wit/world.wit b/examples/wasip3/wit/world.wit index 13eb401..afa6974 100644 --- a/examples/wasip3/wit/world.wit +++ b/examples/wasip3/wit/world.wit @@ -2,5 +2,5 @@ package componentize-go:example; world wasip3-example { - include wasi:http/service@0.3.0-rc-2026-03-15; + include wasi:http/service@0.3.0; } diff --git a/src/wasi_snapshot_preview1.reactor.wasm b/src/wasi_snapshot_preview1.reactor.wasm old mode 100755 new mode 100644 index 51ea76b..0207d75 Binary files a/src/wasi_snapshot_preview1.reactor.wasm and b/src/wasi_snapshot_preview1.reactor.wasm differ diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 6340b4b..c0a1242 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -14,3 +14,5 @@ once_cell = "1.21.3" reqwest = { workspace = true } tar = { workspace = true } tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] } +wasmtime = { version = "46.0.1" } +wasmtime-wasi = { version = "46.0.1" } diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..62c193c --- /dev/null +++ b/tests/README.md @@ -0,0 +1,16 @@ +# Overview of componentize-go's Integration Tests + +The integration tests have been separated into 2 categories: +- Examples: Run the components in the /examples directory +- Fixtures: Run any non-example components in the /tests/fixtures directory + +## Running the Integration Tests + +Run: +```sh +cargo test --workspace +``` + +## How wasmtime is used in tests + +Most of the tests just use the Wasmtime CLI; however, there are some fixture tests that require a custom Wasmtime implementation. If you have a fixture or example test that needs a custom Wasmtime impl, feel free to use the [memory-pressure](/tests/src/fixtures.rs) test as a reference. diff --git a/tests/fixtures/memory-pressure/export_wit_world/empty.s b/tests/fixtures/memory-pressure/export_wit_world/empty.s new file mode 100644 index 0000000..308ab60 --- /dev/null +++ b/tests/fixtures/memory-pressure/export_wit_world/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. \ No newline at end of file diff --git a/tests/fixtures/memory-pressure/export_wit_world/wit_bindings.go b/tests/fixtures/memory-pressure/export_wit_world/wit_bindings.go new file mode 100644 index 0000000..075b168 --- /dev/null +++ b/tests/fixtures/memory-pressure/export_wit_world/wit_bindings.go @@ -0,0 +1,16 @@ +package export_wit_world + +import ( + "fmt" + "wit_component/wit_world" +) + +func Run() { + // Build heap pressure so GC fires during the next host call + for i := 0; i < 10_000; i++ { + _ = make([]byte, 1024) + } + + v := wit_world.GetStr() + fmt.Println(v) +} diff --git a/tests/fixtures/memory-pressure/wit/world.wit b/tests/fixtures/memory-pressure/wit/world.wit new file mode 100644 index 0000000..6dabd3a --- /dev/null +++ b/tests/fixtures/memory-pressure/wit/world.wit @@ -0,0 +1,6 @@ +package foo:bar@0.1.0; + +world memory-pressure { + import get-str: func() -> string; + export run: func(); +} diff --git a/examples/multiple-worlds/export_wasi_http_handler/handler.go b/tests/fixtures/multiple-worlds/export_wasi_http_handler/handler.go similarity index 100% rename from examples/multiple-worlds/export_wasi_http_handler/handler.go rename to tests/fixtures/multiple-worlds/export_wasi_http_handler/handler.go diff --git a/examples/multiple-worlds/export_wit_world/foo.go b/tests/fixtures/multiple-worlds/export_wit_world/foo.go similarity index 100% rename from examples/multiple-worlds/export_wit_world/foo.go rename to tests/fixtures/multiple-worlds/export_wit_world/foo.go diff --git a/tests/fixtures/multiple-worlds/wit1/deps/wasi-cli-0.3.0/package.wit b/tests/fixtures/multiple-worlds/wit1/deps/wasi-cli-0.3.0/package.wit new file mode 100644 index 0000000..d0b02bb --- /dev/null +++ b/tests/fixtures/multiple-worlds/wit1/deps/wasi-cli-0.3.0/package.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/tests/fixtures/multiple-worlds/wit1/deps/wasi-clocks-0.3.0/package.wit b/tests/fixtures/multiple-worlds/wit1/deps/wasi-clocks-0.3.0/package.wit new file mode 100644 index 0000000..871adf0 --- /dev/null +++ b/tests/fixtures/multiple-worlds/wit1/deps/wasi-clocks-0.3.0/package.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/examples/multiple-worlds/wit1/deps/http.wit b/tests/fixtures/multiple-worlds/wit1/deps/wasi-http-0.3.0/package.wit similarity index 91% rename from examples/multiple-worlds/wit1/deps/http.wit rename to tests/fixtures/multiple-worlds/wit1/deps/wasi-http-0.3.0/package.wit index c1c1e68..08458f7 100644 --- a/examples/multiple-worlds/wit1/deps/http.wit +++ b/tests/fixtures/multiple-worlds/wit1/deps/wasi-http-0.3.0/package.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/tests/fixtures/multiple-worlds/wit1/deps/wasi-random-0.3.0/package.wit b/tests/fixtures/multiple-worlds/wit1/deps/wasi-random-0.3.0/package.wit new file mode 100644 index 0000000..f6cfb81 --- /dev/null +++ b/tests/fixtures/multiple-worlds/wit1/deps/wasi-random-0.3.0/package.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/examples/multiple-worlds/wit1/world.wit b/tests/fixtures/multiple-worlds/wit1/world.wit similarity index 51% rename from examples/multiple-worlds/wit1/world.wit rename to tests/fixtures/multiple-worlds/wit1/world.wit index 8061b2d..a33caf3 100644 --- a/examples/multiple-worlds/wit1/world.wit +++ b/tests/fixtures/multiple-worlds/wit1/world.wit @@ -1,5 +1,5 @@ package componentize-go:example; world world1 { - include wasi:http/service@0.3.0-rc-2026-03-15; + include wasi:http/service@0.3.0; } diff --git a/examples/multiple-worlds/wit2/world.wit b/tests/fixtures/multiple-worlds/wit2/world.wit similarity index 100% rename from examples/multiple-worlds/wit2/world.wit rename to tests/fixtures/multiple-worlds/wit2/world.wit diff --git a/tests/src/examples.rs b/tests/src/examples.rs new file mode 100644 index 0000000..2c4e654 --- /dev/null +++ b/tests/src/examples.rs @@ -0,0 +1,118 @@ +use crate::harness::{App, COMPONENTIZE_GO_PATH, Test}; +use anyhow::{Result, anyhow}; +use std::{env, path::Path, process::Command, time::Duration}; + +#[test] +fn example_wasip1() { + let app = App::new(Path::new("../examples/wasip1"), &[], &[], None, false); + app.build_module().expect("failed to build app module"); + app.run_module().expect("failed to run app module"); +} + +#[tokio::test] +async fn example_wasip2() { + let unit_tests = vec![ + Test { + should_fail: false, + pkg_path: String::from("./unit_tests_should_pass"), + }, + Test { + should_fail: true, + pkg_path: String::from("./unit_tests_should_fail"), + }, + ]; + + let cwd = env::current_dir().unwrap(); + let app_dir = cwd.parent().unwrap().join("examples").join("wasip2"); + let mut app = App::new( + &app_dir, + &[&app_dir.join("wit")], + &["wasip2-example"], + Some(unit_tests), + true, + ); + + app.build_component().expect("failed to build app"); + + app.run_component("/", "Hello, world!") + .await + .expect("app failed to run"); + + app.build_test_modules() + .expect("failed to build app unit tests"); + + app.run_test_modules() + .expect("tests succeeded/failed when they should not have"); +} + +#[tokio::test] +async fn example_wasip3() { + let cwd = env::current_dir().unwrap(); + let app_dir = cwd.parent().unwrap().join("examples").join("wasip3"); + let mut app = App::new( + &app_dir, + &[&app_dir.join("wit")], + &["wasip3-example"], + None, + true, + ); + app.build_component().expect("failed to build app"); + app.run_component("/hello", "Hello, world!") + .await + .expect("app failed to run"); +} + +// This test is more verbose because it uses unique componentize-go and wasmtime +// options that didn't make sense to abstract. +#[tokio::test] +async fn example_sdk() -> Result<()> { + let cwd = env::current_dir()?; + let app_dir = cwd + .parent() + .unwrap() + .join("examples") + .join("sdk") + .join("component"); + + // Build component + let build_output = Command::new(COMPONENTIZE_GO_PATH.as_path()) + .arg("build") + .current_dir(&app_dir) + .output()?; + if !build_output.status.success() { + return Err(anyhow!( + "failed to build application \"{}\": {}", + app_dir.display(), + String::from_utf8_lossy(&build_output.stderr) + )); + } + + // Run component + let mut child = Command::new("wasmtime") + .arg("run") + .args(["-S", "p3,inherit-network"]) + .args(["-W", "component-model-async"]) + .arg(app_dir.join("main.wasm")) + .spawn()?; + + // Send HTTP request to component + let start = std::time::Instant::now(); + loop { + match reqwest::get(format!("http://localhost:6767")).await { + Ok(r) => { + let actual = r.text().await.expect("Failed to read response"); + assert_eq!(&actual, "Hello from Go + wasi:sockets!"); + break; + } + Err(e) => { + if start.elapsed() > Duration::from_secs(5) { + return Err(anyhow!("Unable to reach the app: {e}")); + } + } + } + } + + // Kill running component + child.kill()?; + Ok(()) +} diff --git a/tests/src/fixtures.rs b/tests/src/fixtures.rs new file mode 100644 index 0000000..5d6c90f --- /dev/null +++ b/tests/src/fixtures.rs @@ -0,0 +1,77 @@ +use crate::harness::App; +use crate::wasmtime::{State, engine}; +use anyhow::Result; +use std::{env, path::PathBuf}; +use wasmtime::{Store, component::*}; + +/// Retrieves the tests/fixtures directory +fn app_dir(name: &str) -> Result { + let cwd = env::current_dir()?; + let app_dir = cwd.parent().unwrap().join("tests/fixtures").join(name); + Ok(app_dir) +} + +#[tokio::test] +async fn fixture_multiple_worlds() -> Result<()> { + let app_dir = app_dir("multiple-worlds")?; + let mut app = App::new( + &app_dir, + &[&app_dir.join("wit1"), &app_dir.join("wit2")], + &["world1", "world2"], + None, + true, + ); + app.build_component().expect("failed to build app"); + app.run_component("/hello", "Hello, world!") + .await + .expect("app failed to run"); + Ok(()) +} + +#[test] +fn fixture_memory_pressure() -> Result<()> { + // Build the app with componentize-go + let app_dir = app_dir("memory-pressure")?; + let app = App::new( + &app_dir, + &[&app_dir.join("wit")], + &["memory-pressure"], + None, + true, + ); + app.build_component().expect("failed to build app"); + + // Setup and run with custom wasmtime impl + bindgen!({ + path: "fixtures/memory-pressure/wit", + world: "memory-pressure", + }); + + impl MemoryPressureImports for State { + fn get_str(&mut self) -> String { + String::from("Hello!") + } + } + + let engine = engine()?; + let component = Component::from_file(&engine, app_dir.join("main.wasm"))?; + + let mut linker = Linker::::new(&engine); + wasmtime_wasi::p2::add_to_linker_sync(&mut linker)?; + MemoryPressure::add_to_linker::>(&mut linker, |s| s)?; + + let mut store = Store::new(&engine, State::new()); + let tests = MemoryPressure::instantiate(&mut store, &component, &linker)?; + + // Run component a generous number of times to make sure nothing panics + let num_invocations = 10_000; + for _ in 0..num_invocations { + tests.call_run(&mut store)?; + } + assert_eq!( + store.data().stdout(), + b"Hello!\n".repeat(num_invocations).as_slice() + ); + + Ok(()) +} diff --git a/tests/src/harness.rs b/tests/src/harness.rs new file mode 100644 index 0000000..cda4e8c --- /dev/null +++ b/tests/src/harness.rs @@ -0,0 +1,332 @@ +use anyhow::{Result, anyhow}; +use once_cell::sync::Lazy; +use std::{ + net::TcpListener, + path::{Path, PathBuf}, + process::{Child, Command, Stdio}, + time::Duration, +}; + +pub(crate) static COMPONENTIZE_GO_PATH: once_cell::sync::Lazy = Lazy::new(|| { + let test_manifest = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let root_manifest = test_manifest.parent().unwrap(); + let build_output = Command::new("cargo") + .arg("build") + .args([ + "--manifest-path", + root_manifest.join("Cargo.toml").to_str().unwrap(), + ]) + .output() + .expect("failed to build componentize-go"); + + if !build_output.status.success() { + panic!("{}", String::from_utf8_lossy(&build_output.stderr)); + } + + root_manifest.join("target/debug/componentize-go") +}); + +pub(crate) struct App { + /// The path to the example application + pub path: PathBuf, + /// The WIT worlds to target + pub worlds: Vec, + /// The output path of the wasm file + pub wasm_path: String, + /// The paths to the directories containing the WIT files + pub wit_paths: Vec, + /// The child process ID of a running wasm app + pub process: Option, + /// Any tests that need to be compiled and run as such + pub tests: Option>, +} + +#[derive(Clone)] +pub(crate) struct Test { + pub should_fail: bool, + pub pkg_path: String, +} + +impl App { + /// Create a new app runner. + pub(crate) fn new( + path: &Path, + wit_paths: &[&Path], + worlds: &[&str], + tests: Option>, + is_component: bool, + ) -> Self { + let path = &componentize_go::utils::make_path_absolute(&PathBuf::from(path)) + .expect("failed to make app path absolute"); + + if is_component { + assert!(!wit_paths.is_empty()); + assert!(!worlds.is_empty()); + } + + App { + path: path.into(), + worlds: worlds.iter().map(|v| v.to_string()).collect(), + wasm_path: path + .join("main.wasm") + .to_str() + .expect("wasm_path is not valid unicode") + .to_string(), + wit_paths: wit_paths.iter().map(|v| v.into()).collect(), + process: None, + tests, + } + } + + pub(crate) fn build_test_modules(&self) -> Result<()> { + let test_pkgs = self.tests.as_ref().expect("missing test_pkg_paths"); + + self.generate_bindings()?; + + let mut test_cmd = Command::new(COMPONENTIZE_GO_PATH.as_path()); + for world in &self.worlds { + test_cmd.args(["-w", world]); + } + for path in &self.wit_paths { + test_cmd.arg("-d").arg(path); + } + test_cmd.arg("test").arg("--wasip1"); + + // Add all the paths to the packages that have unit tests to compile + for test in test_pkgs.iter() { + test_cmd.args(["--pkg", &test.pkg_path]); + } + + // `go test -c` needs to be in the same path as the go.mod file. + test_cmd.current_dir(&self.path); + + let test_output = test_cmd.output().expect(&format!( + "failed to execute componentize-go for \"{}\"", + self.path.display() + )); + + if !test_output.status.success() { + return Err(anyhow!( + "failed to build application \"{}\": {}", + self.path.display(), + String::from_utf8_lossy(&test_output.stderr) + )); + } + + Ok(()) + } + + pub(crate) fn run_module(&self) -> Result<()> { + let output = Command::new("wasmtime") + .arg("run") + .arg(&self.wasm_path) + .output()?; + + if !output.status.success() { + return Err(anyhow!( + "Failed to run wasm module for application at '{}':\n{} ", + &self.wasm_path, + String::from_utf8_lossy(&output.stdout) + )); + } + + Ok(()) + } + + pub(crate) fn run_test_modules(&self) -> Result<()> { + let example_dir = PathBuf::from(&self.path); + if let Some(tests) = &self.tests { + let mut test_errors: Vec = vec![]; + for test in tests.iter() { + let wasm_file = example_dir.join(componentize_go::cmd_test::get_test_filename( + &PathBuf::from(&test.pkg_path), + )); + match Command::new("wasmtime") + .args(["run", wasm_file.to_str().unwrap()]) + .output() + { + Ok(output) => { + let succeeded = output.status.success(); + if test.should_fail && succeeded { + test_errors + .push(format!("The '{}' tests should have failed", test.pkg_path)); + } else if !test.should_fail && !succeeded { + test_errors.push(format!("The '{}' tests should have passed, but failed with the following output:\n\n{}", test.pkg_path, String::from_utf8_lossy(&output.stdout))); + } + } + Err(e) => { + test_errors.push(format!( + "Failed to run wasmtime for '{}': {}", + test.pkg_path, e + )); + } + } + } + + if !test_errors.is_empty() { + let err_msg = format!( + "{}{}{}", + "\n====================\n", + &test_errors.join("\n\n====================\n"), + "\n\n====================\n" + ); + return Err(anyhow!(err_msg)); + } + } else { + return Err(anyhow!( + "Please include the test_pkg_paths when creating App::new()" + )); + } + + Ok(()) + } + + pub(crate) fn build_module(&self) -> Result<()> { + // Build component + let mut build_cmd = Command::new(COMPONENTIZE_GO_PATH.as_path()); + build_cmd + .arg("build") + .arg("--wasip1") + .args(["-o", &self.wasm_path]); + + // Run `go build` in the same directory as the go.mod file. + build_cmd.current_dir(&self.path); + + let build_output = build_cmd.output().expect(&format!( + "failed to execute componentize-go for \"{}\"", + self.path.display() + )); + + if !build_output.status.success() { + return Err(anyhow!( + "failed to build application \"{}\": {}", + self.path.display(), + String::from_utf8_lossy(&build_output.stderr) + )); + } + + Ok(()) + } + + pub(crate) fn build_component(&self) -> Result<()> { + self.generate_bindings()?; + + // Build component + let mut build_cmd = Command::new(COMPONENTIZE_GO_PATH.as_path()); + for world in &self.worlds { + build_cmd.args(["-w", world]); + } + for path in &self.wit_paths { + build_cmd.arg("-d").arg(path); + } + build_cmd.arg("build").args(["-o", &self.wasm_path]); + + // Run `go build` in the same directory as the go.mod file. + build_cmd.current_dir(&self.path); + + let build_output = build_cmd.output().expect(&format!( + "failed to execute componentize-go for \"{}\"", + self.path.display() + )); + + if !build_output.status.success() { + return Err(anyhow!( + "failed to build application \"{}\": {}", + self.path.display(), + String::from_utf8_lossy(&build_output.stderr) + )); + } + + Ok(()) + } + + fn generate_bindings(&self) -> Result<()> { + let mut cmd = Command::new(COMPONENTIZE_GO_PATH.as_path()); + for world in &self.worlds { + cmd.args(["-w", world]); + } + for path in &self.wit_paths { + cmd.arg("-d").arg(path); + } + + let bindings_output = cmd + .arg("bindings") + .arg("-o") + .arg(&self.path) + .current_dir(&self.path) + .output() + .expect(&format!( + "failed to generate bindings for application \"{}\"", + self.path.display() + )); + if !bindings_output.status.success() { + return Err(anyhow!( + "{}", + String::from_utf8_lossy(&bindings_output.stderr) + )); + } + + // Tidy Go mod + let tidy_output = Command::new("go") + .arg("mod") + .arg("tidy") + .current_dir(&self.path) + .output() + .expect("failed to tidy Go mod"); + if !tidy_output.status.success() { + return Err(anyhow!("{}", String::from_utf8_lossy(&tidy_output.stderr))); + } + + Ok(()) + } + + /// Run the app and check the output. + pub(crate) async fn run_component( + &mut self, + route: &str, + expected_response: &str, + ) -> Result<()> { + let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind to a free port"); + let addr = listener.local_addr().expect("Failed to get local address"); + let port = addr.port(); + drop(listener); + + let child = Command::new("wasmtime") + .arg("serve") + .args(["--addr", &format!("0.0.0.0:{port}")]) + .arg("-Sp3,cli") + .arg("-Wcomponent-model-async") + .arg(&self.wasm_path) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("Failed to start wasmtime serve"); + + // Storing for cleanup on drop. + self.process = Some(child); + + let start = std::time::Instant::now(); + loop { + match reqwest::get(format!("http://localhost:{port}{route}")).await { + Ok(r) => { + let actual = r.text().await.expect("Failed to read response"); + assert_eq!(&actual, expected_response); + return Ok(()); + } + Err(e) => { + if start.elapsed() > Duration::from_secs(5) { + return Err(anyhow!("Unable to reach the app: {e}")); + } + } + } + } + } +} + +impl Drop for App { + fn drop(&mut self) { + if let Some(child) = &mut self.process { + _ = child.kill() + } + } +} diff --git a/tests/src/lib.rs b/tests/src/lib.rs index 5873c95..fbd437c 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -1,472 +1,8 @@ #[cfg(test)] -mod tests { - use anyhow::{Result, anyhow}; - use core::panic; - use once_cell::sync::Lazy; - use std::{ - env, - net::TcpListener, - path::{Path, PathBuf}, - process::{Child, Command, Stdio}, - time::Duration, - }; - - static COMPONENTIZE_GO_PATH: once_cell::sync::Lazy = Lazy::new(|| { - let test_manifest = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let root_manifest = test_manifest.parent().unwrap(); - let build_output = Command::new("cargo") - .arg("build") - .args([ - "--manifest-path", - root_manifest.join("Cargo.toml").to_str().unwrap(), - ]) - .output() - .expect("failed to build componentize-go"); - - if !build_output.status.success() { - panic!("{}", String::from_utf8_lossy(&build_output.stderr)); - } - - root_manifest.join("target/debug/componentize-go") - }); - - struct App { - /// The path to the example application - path: PathBuf, - /// The WIT worlds to target - worlds: Vec, - /// The output path of the wasm file - wasm_path: String, - /// The paths to the directories containing the WIT files - wit_paths: Vec, - /// The child process ID of a running wasm app - process: Option, - /// Any tests that need to be compiled and run as such - tests: Option>, - } - - #[derive(Clone)] - struct Test { - should_fail: bool, - pkg_path: String, - } - - impl App { - /// Create a new app runner. - fn new( - path: &Path, - wit_paths: &[&Path], - worlds: &[&str], - tests: Option>, - is_component: bool, - ) -> Self { - let path = &componentize_go::utils::make_path_absolute(&PathBuf::from(path)) - .expect("failed to make app path absolute"); - - if is_component { - assert!(!wit_paths.is_empty()); - assert!(!worlds.is_empty()); - } - - App { - path: path.into(), - worlds: worlds.iter().map(|v| v.to_string()).collect(), - wasm_path: path - .join("main.wasm") - .to_str() - .expect("wasm_path is not valid unicode") - .to_string(), - wit_paths: wit_paths.iter().map(|v| v.into()).collect(), - process: None, - tests, - } - } - - fn build_test_modules(&self) -> Result<()> { - let test_pkgs = self.tests.as_ref().expect("missing test_pkg_paths"); - - self.generate_bindings()?; - - let mut test_cmd = Command::new(COMPONENTIZE_GO_PATH.as_path()); - for world in &self.worlds { - test_cmd.args(["-w", world]); - } - for path in &self.wit_paths { - test_cmd.arg("-d").arg(path); - } - test_cmd.arg("test").arg("--wasip1"); - - // Add all the paths to the packages that have unit tests to compile - for test in test_pkgs.iter() { - test_cmd.args(["--pkg", &test.pkg_path]); - } - - // `go test -c` needs to be in the same path as the go.mod file. - test_cmd.current_dir(&self.path); - - let test_output = test_cmd.output().expect(&format!( - "failed to execute componentize-go for \"{}\"", - self.path.display() - )); - - if !test_output.status.success() { - return Err(anyhow!( - "failed to build application \"{}\": {}", - self.path.display(), - String::from_utf8_lossy(&test_output.stderr) - )); - } - - Ok(()) - } - - fn run_module(&self) -> Result<()> { - let output = Command::new("wasmtime") - .arg("run") - .arg(&self.wasm_path) - .output()?; - - if !output.status.success() { - return Err(anyhow!( - "Failed to run wasm module for application at '{}':\n{} ", - &self.wasm_path, - String::from_utf8_lossy(&output.stdout) - )); - } - - Ok(()) - } - - fn run_test_modules(&self) -> Result<()> { - let example_dir = PathBuf::from(&self.path); - if let Some(tests) = &self.tests { - let mut test_errors: Vec = vec![]; - for test in tests.iter() { - let wasm_file = example_dir.join(componentize_go::cmd_test::get_test_filename( - &PathBuf::from(&test.pkg_path), - )); - match Command::new("wasmtime") - .args(["run", wasm_file.to_str().unwrap()]) - .output() - { - Ok(output) => { - let succeeded = output.status.success(); - if test.should_fail && succeeded { - test_errors.push(format!( - "The '{}' tests should have failed", - test.pkg_path - )); - } else if !test.should_fail && !succeeded { - test_errors.push(format!("The '{}' tests should have passed, but failed with the following output:\n\n{}", test.pkg_path, String::from_utf8_lossy(&output.stdout))); - } - } - Err(e) => { - test_errors.push(format!( - "Failed to run wasmtime for '{}': {}", - test.pkg_path, e - )); - } - } - } - - if !test_errors.is_empty() { - let err_msg = format!( - "{}{}{}", - "\n====================\n", - &test_errors.join("\n\n====================\n"), - "\n\n====================\n" - ); - return Err(anyhow!(err_msg)); - } - } else { - return Err(anyhow!( - "Please include the test_pkg_paths when creating App::new()" - )); - } - - Ok(()) - } - - fn build_module(&self) -> Result<()> { - // Build component - let mut build_cmd = Command::new(COMPONENTIZE_GO_PATH.as_path()); - build_cmd - .arg("build") - .arg("--wasip1") - .args(["-o", &self.wasm_path]); - - // Run `go build` in the same directory as the go.mod file. - build_cmd.current_dir(&self.path); - - let build_output = build_cmd.output().expect(&format!( - "failed to execute componentize-go for \"{}\"", - self.path.display() - )); - - if !build_output.status.success() { - return Err(anyhow!( - "failed to build application \"{}\": {}", - self.path.display(), - String::from_utf8_lossy(&build_output.stderr) - )); - } - - Ok(()) - } - - fn build_component(&self) -> Result<()> { - self.generate_bindings()?; - - // Build component - let mut build_cmd = Command::new(COMPONENTIZE_GO_PATH.as_path()); - for world in &self.worlds { - build_cmd.args(["-w", world]); - } - for path in &self.wit_paths { - build_cmd.arg("-d").arg(path); - } - build_cmd.arg("build").args(["-o", &self.wasm_path]); - - // Run `go build` in the same directory as the go.mod file. - build_cmd.current_dir(&self.path); - - let build_output = build_cmd.output().expect(&format!( - "failed to execute componentize-go for \"{}\"", - self.path.display() - )); - - if !build_output.status.success() { - return Err(anyhow!( - "failed to build application \"{}\": {}", - self.path.display(), - String::from_utf8_lossy(&build_output.stderr) - )); - } - - Ok(()) - } - - fn generate_bindings(&self) -> Result<()> { - let mut cmd = Command::new(COMPONENTIZE_GO_PATH.as_path()); - for world in &self.worlds { - cmd.args(["-w", world]); - } - for path in &self.wit_paths { - cmd.arg("-d").arg(path); - } - - let bindings_output = cmd - .arg("bindings") - .arg("-o") - .arg(&self.path) - .current_dir(&self.path) - .output() - .expect(&format!( - "failed to generate bindings for application \"{}\"", - self.path.display() - )); - if !bindings_output.status.success() { - return Err(anyhow!( - "{}", - String::from_utf8_lossy(&bindings_output.stderr) - )); - } - - // Tidy Go mod - let tidy_output = Command::new("go") - .arg("mod") - .arg("tidy") - .current_dir(&self.path) - .output() - .expect("failed to tidy Go mod"); - if !tidy_output.status.success() { - return Err(anyhow!("{}", String::from_utf8_lossy(&tidy_output.stderr))); - } - - Ok(()) - } - - /// Run the app and check the output. - async fn run_component(&mut self, route: &str, expected_response: &str) -> Result<()> { - let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind to a free port"); - let addr = listener.local_addr().expect("Failed to get local address"); - let port = addr.port(); - drop(listener); - - let child = Command::new("wasmtime") - .arg("serve") - .args(["--addr", &format!("0.0.0.0:{port}")]) - .arg("-Sp3,cli") - .arg("-Wcomponent-model-async") - .arg(&self.wasm_path) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .expect("Failed to start wasmtime serve"); - - // Storing for cleanup on drop. - self.process = Some(child); - - let start = std::time::Instant::now(); - loop { - match reqwest::get(format!("http://localhost:{port}{route}")).await { - Ok(r) => { - let actual = r.text().await.expect("Failed to read response"); - assert_eq!(&actual, expected_response); - return Ok(()); - } - Err(e) => { - if start.elapsed() > Duration::from_secs(5) { - return Err(anyhow!("Unable to reach the app: {e}")); - } - } - } - } - } - } - - impl Drop for App { - fn drop(&mut self) { - if let Some(child) = &mut self.process { - _ = child.kill() - } - } - } - - #[test] - fn example_wasip1() { - let app = App::new(Path::new("../examples/wasip1"), &[], &[], None, false); - app.build_module().expect("failed to build app module"); - app.run_module().expect("failed to run app module"); - } - - #[tokio::test] - async fn example_wasip2() { - let unit_tests = vec![ - Test { - should_fail: false, - pkg_path: String::from("./unit_tests_should_pass"), - }, - Test { - should_fail: true, - pkg_path: String::from("./unit_tests_should_fail"), - }, - ]; - - let cwd = env::current_dir().unwrap(); - let app_dir = cwd.parent().unwrap().join("examples").join("wasip2"); - let mut app = App::new( - &app_dir, - &[&app_dir.join("wit")], - &["wasip2-example"], - Some(unit_tests), - true, - ); - - app.build_component().expect("failed to build app"); - - app.run_component("/", "Hello, world!") - .await - .expect("app failed to run"); - - app.build_test_modules() - .expect("failed to build app unit tests"); - - app.run_test_modules() - .expect("tests succeeded/failed when they should not have"); - } - - #[tokio::test] - async fn example_wasip3() { - let cwd = env::current_dir().unwrap(); - let app_dir = cwd.parent().unwrap().join("examples").join("wasip3"); - let mut app = App::new( - &app_dir, - &[&app_dir.join("wit")], - &["wasip3-example"], - None, - true, - ); - app.build_component().expect("failed to build app"); - app.run_component("/hello", "Hello, world!") - .await - .expect("app failed to run"); - } - - #[tokio::test] - async fn example_multiple_worlds() -> Result<()> { - let cwd = env::current_dir()?; - let app_dir = cwd - .parent() - .unwrap() - .join("examples") - .join("multiple-worlds"); - let mut app = App::new( - &app_dir, - &[&app_dir.join("wit1"), &app_dir.join("wit2")], - &["world1", "world2"], - None, - true, - ); - app.build_component().expect("failed to build app"); - app.run_component("/hello", "Hello, world!") - .await - .expect("app failed to run"); - Ok(()) - } - - // This test is more verbose because it uses unique componentize-go and wasmtime - // options that didn't make sense to abstract. - #[tokio::test] - async fn example_sdk() -> Result<()> { - let cwd = env::current_dir()?; - let app_dir = cwd - .parent() - .unwrap() - .join("examples") - .join("sdk") - .join("component"); - - // Build component - let build_output = Command::new(COMPONENTIZE_GO_PATH.as_path()) - .arg("build") - .current_dir(&app_dir) - .output()?; - if !build_output.status.success() { - return Err(anyhow!( - "failed to build application \"{}\": {}", - app_dir.display(), - String::from_utf8_lossy(&build_output.stderr) - )); - } - - // Run component - let mut child = Command::new("wasmtime") - .arg("run") - .args(["-S", "p3,inherit-network"]) - .args(["-W", "component-model-async"]) - .arg(app_dir.join("main.wasm")) - .spawn()?; - - // Send HTTP request to component - let start = std::time::Instant::now(); - loop { - match reqwest::get(format!("http://localhost:6767")).await { - Ok(r) => { - let actual = r.text().await.expect("Failed to read response"); - assert_eq!(&actual, "Hello from Go + wasi:sockets!"); - break; - } - Err(e) => { - if start.elapsed() > Duration::from_secs(5) { - return Err(anyhow!("Unable to reach the app: {e}")); - } - } - } - } - - // Kill running component - child.kill()?; - Ok(()) - } -} +mod examples; +#[cfg(test)] +mod fixtures; +#[cfg(test)] +mod harness; +#[cfg(test)] +mod wasmtime; diff --git a/tests/src/wasmtime.rs b/tests/src/wasmtime.rs new file mode 100644 index 0000000..9801073 --- /dev/null +++ b/tests/src/wasmtime.rs @@ -0,0 +1,47 @@ +//! Embedded wasmtime setup helper functions for tests. + +use anyhow::anyhow; +use wasmtime::{Config, Engine}; +use wasmtime_wasi::p2::pipe::MemoryOutputPipe; +use wasmtime_wasi::{ResourceTable, WasiCtx, WasiCtxView, WasiView}; + +pub struct State { + ctx: WasiCtx, + table: ResourceTable, + stdout: MemoryOutputPipe, +} + +impl WasiView for State { + fn ctx(&mut self) -> WasiCtxView<'_> { + WasiCtxView { + ctx: &mut self.ctx, + table: &mut self.table, + } + } +} + +impl State { + pub fn new() -> Self { + let capacity = 1024 * 1024; // 1 MB + let stdout = MemoryOutputPipe::new(capacity); + let ctx = WasiCtx::builder().stdout(stdout.clone()).build(); + State { + ctx, + table: ResourceTable::new(), + stdout, + } + } + + /// Bytes the guest has written to stdout. + pub fn stdout(&self) -> Vec { + self.stdout.contents().to_vec() + } +} + +/// Wasmtime engine configured with component model and async support +pub fn engine() -> anyhow::Result { + let mut config = Config::new(); + config.wasm_component_model(true); + config.wasm_component_model_async(true); + Engine::new(&config).map_err(|e| anyhow!(e)) +}