A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Update WASI to 0.3.0, enable component-model-async (#13612)
Alex Crichton546c294525e1
diff --git a/ci/vendor-wit.sh b/ci/vendor-wit.shindex 44b7df5e2c..c912cfbe9f 100755--- a/ci/vendor-wit.sh+++ b/ci/vendor-wit.sh@@ -36,7 +36,7 @@ get_github() {}p2=0.2.12-p3=0.3.0-rc-2026-03-15+p3=0.3.0rm -rf crates/wasi-io/wit/depsmkdir -p crates/wasi-io/wit/depsdiff --git a/crates/test-programs/src/bin/p3_cli_many_tasks.rs b/crates/test-programs/src/bin/p3_cli_many_tasks.rsindex f7b161ac6b..ceafa7ce2c 100644--- a/crates/test-programs/src/bin/p3_cli_many_tasks.rs+++ b/crates/test-programs/src/bin/p3_cli_many_tasks.rs@@ -1,6 +1,6 @@use test_programs::p3::wasi as wasip3;-#[link(wasm_import_module = "wasi:clocks/[email protected]")]+#[link(wasm_import_module = "wasi:clocks/[email protected]")]unsafe extern "C" {#[link_name = "[async-lower]wait-for"]fn wait_for(dur: u64) -> u32;diff --git a/crates/test-programs/src/bin/p3_http_middleware.rs b/crates/test-programs/src/bin/p3_http_middleware.rsindex 400ba6bce3..c83bcf90f5 100644--- a/crates/test-programs/src/bin/p3_http_middleware.rs+++ b/crates/test-programs/src/bin/p3_http_middleware.rs@@ -18,19 +18,19 @@ wit_bindgen::generate!({path: "../wasi-http/src/p3/wit",world: "wasi:http/middleware",with: {- "wasi:http/[email protected]": test_programs::p3::wasi::http::handler,- "wasi:http/[email protected]": test_programs::p3::wasi::http::types,- "wasi:http/[email protected]": test_programs::p3::wasi::http::client,- "wasi:random/[email protected]": test_programs::p3::wasi::random::random,- "wasi:random/[email protected]": test_programs::p3::wasi::random::insecure,- "wasi:random/[email protected]": test_programs::p3::wasi::random::insecure_seed,- "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stdout,- "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stderr,- "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stdin,- "wasi:cli/[email protected]": test_programs::p3::wasi::cli::types,- "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::monotonic_clock,- "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::system_clock,- "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::types,+ "wasi:http/[email protected]": test_programs::p3::wasi::http::handler,+ "wasi:http/[email protected]": test_programs::p3::wasi::http::types,+ "wasi:http/[email protected]": test_programs::p3::wasi::http::client,+ "wasi:random/[email protected]": test_programs::p3::wasi::random::random,+ "wasi:random/[email protected]": test_programs::p3::wasi::random::insecure,+ "wasi:random/[email protected]": test_programs::p3::wasi::random::insecure_seed,+ "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stdout,+ "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stderr,+ "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stdin,+ "wasi:cli/[email protected]": test_programs::p3::wasi::cli::types,+ "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::monotonic_clock,+ "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::system_clock,+ "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::types,},});diff --git a/crates/test-programs/src/bin/p3_http_middleware_with_chain.rs b/crates/test-programs/src/bin/p3_http_middleware_with_chain.rsindex cf14e3532b..fbc71a5820 100644--- a/crates/test-programs/src/bin/p3_http_middleware_with_chain.rs+++ b/crates/test-programs/src/bin/p3_http_middleware_with_chain.rs@@ -6,13 +6,13 @@ mod bindings {package local:local;world middleware-with-chain {- include wasi:http/[email protected];+ include wasi:http/[email protected];import chain-http;}interface chain-http {- use wasi:http/[email protected].{request, response, error-code};+ use wasi:http/[email protected].{request, response, error-code};handle: async func(request: request) -> result<response, error-code>;}@@ -20,18 +20,18 @@ interface chain-http {// workaround https://github.com/bytecodealliance/wit-bindgen/issues/1544// generate_allwith: {- "wasi:http/[email protected]": test_programs::p3::wasi::http::types,- "wasi:http/[email protected]": test_programs::p3::wasi::http::client,- "wasi:random/[email protected]": test_programs::p3::wasi::random::random,- "wasi:random/[email protected]": test_programs::p3::wasi::random::insecure,- "wasi:random/[email protected]": test_programs::p3::wasi::random::insecure_seed,- "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stdout,- "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stderr,- "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stdin,- "wasi:cli/[email protected]": test_programs::p3::wasi::cli::types,- "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::monotonic_clock,- "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::system_clock,- "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::types,+ "wasi:http/[email protected]": test_programs::p3::wasi::http::types,+ "wasi:http/[email protected]": test_programs::p3::wasi::http::client,+ "wasi:random/[email protected]": test_programs::p3::wasi::random::random,+ "wasi:random/[email protected]": test_programs::p3::wasi::random::insecure,+ "wasi:random/[email protected]": test_programs::p3::wasi::random::insecure_seed,+ "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stdout,+ "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stderr,+ "wasi:cli/[email protected]": test_programs::p3::wasi::cli::stdin,+ "wasi:cli/[email protected]": test_programs::p3::wasi::cli::types,+ "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::monotonic_clock,+ "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::system_clock,+ "wasi:clocks/[email protected]": test_programs::p3::wasi::clocks::types,},});diff --git a/crates/test-programs/src/bin/p3_sockets_tcp_busy_poll.rs b/crates/test-programs/src/bin/p3_sockets_tcp_busy_poll.rsindex 6583eed0df..e23370edc6 100644--- a/crates/test-programs/src/bin/p3_sockets_tcp_busy_poll.rs+++ b/crates/test-programs/src/bin/p3_sockets_tcp_busy_poll.rs@@ -11,7 +11,7 @@ use test_programs::p3::wit_stream;use test_programs::sockets::supports_ipv6;use wit_bindgen::StreamResult;-#[link(wasm_import_module = "wasi:http/[email protected]")]+#[link(wasm_import_module = "wasi:http/[email protected]")]unsafe extern "C" {#[link_name = "[async-lower][stream-read-0][static]request.new"]fn stream_read(_: u32, _: *mut u8, _: usize) -> u32;diff --git a/crates/test-programs/src/p3/mod.rs b/crates/test-programs/src/p3/mod.rsindex 9e49bb1c19..abe3ebd048 100644--- a/crates/test-programs/src/p3/mod.rs+++ b/crates/test-programs/src/p3/mod.rs@@ -6,13 +6,13 @@ wit_bindgen::generate!({package wasmtime:test;world testp3 {- include wasi:cli/[email protected];+ include wasi:cli/[email protected];include wasi:tls/[email protected];- import wasi:http/[email protected];- import wasi:http/[email protected];- import wasi:http/[email protected];+ import wasi:http/[email protected];+ import wasi:http/[email protected];+ import wasi:http/[email protected];- export wasi:cli/[email protected];+ export wasi:cli/[email protected];}",path: [@@ -32,19 +32,19 @@ pub mod service {default_bindings_module: "test_programs::p3::service",pub_export_macro: true,with: {- "wasi:http/[email protected]": crate::p3::wasi::http::handler,- "wasi:http/[email protected]": crate::p3::wasi::http::types,- "wasi:http/[email protected]": crate::p3::wasi::http::client,- "wasi:random/[email protected]": crate::p3::wasi::random::random,- "wasi:random/[email protected]": crate::p3::wasi::random::insecure,- "wasi:random/[email protected]": crate::p3::wasi::random::insecure_seed,- "wasi:cli/[email protected]": crate::p3::wasi::cli::stdout,- "wasi:cli/[email protected]": crate::p3::wasi::cli::stderr,- "wasi:cli/[email protected]": crate::p3::wasi::cli::stdin,- "wasi:cli/[email protected]": crate::p3::wasi::cli::types,- "wasi:clocks/[email protected]": crate::p3::wasi::clocks::monotonic_clock,- "wasi:clocks/[email protected]": crate::p3::wasi::clocks::system_clock,- "wasi:clocks/[email protected]": crate::p3::wasi::clocks::types,+ "wasi:http/[email protected]": crate::p3::wasi::http::handler,+ "wasi:http/[email protected]": crate::p3::wasi::http::types,+ "wasi:http/[email protected]": crate::p3::wasi::http::client,+ "wasi:random/[email protected]": crate::p3::wasi::random::random,+ "wasi:random/[email protected]": crate::p3::wasi::random::insecure,+ "wasi:random/[email protected]": crate::p3::wasi::random::insecure_seed,+ "wasi:cli/[email protected]": crate::p3::wasi::cli::stdout,+ "wasi:cli/[email protected]": crate::p3::wasi::cli::stderr,+ "wasi:cli/[email protected]": crate::p3::wasi::cli::stdin,+ "wasi:cli/[email protected]": crate::p3::wasi::cli::types,+ "wasi:clocks/[email protected]": crate::p3::wasi::clocks::monotonic_clock,+ "wasi:clocks/[email protected]": crate::p3::wasi::clocks::system_clock,+ "wasi:clocks/[email protected]": crate::p3::wasi::clocks::types,},});}diff --git a/crates/wasi-http/src/p3/wit/deps/cli.wit b/crates/wasi-http/src/p3/wit/deps/cli.witindex 8ba52c5cd5..7aae56c17e 100644--- a/crates/wasi-http/src/p3/wit/deps/cli.wit+++ b/crates/wasi-http/src/p3/wit/deps/cli.wit@@ -1,6 +1,6 @@-package wasi:[email protected];+package wasi:[email protected];-@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<tuple<string, string>>;/// 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<string>;/// 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<string>;}-@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 errorio,@@ -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<stream<u8>, future<result<_, error-code>>>;}-@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<u8>) -> future<result<_, error-code>>;}-@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<u8>) -> future<result<_, error-code>>;}@@ -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<terminal-input>;}/// 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<terminal-output>;}/// 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<terminal-output>;}-@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/[email protected];- import wasi:clocks/[email protected];- import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];@unstable(feature = clocks-timezone)- import wasi:clocks/[email protected];- import wasi:filesystem/[email protected];- import wasi:filesystem/[email protected];- import wasi:sockets/[email protected];- import wasi:sockets/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];+ import wasi:clocks/[email protected];+ import wasi:filesystem/[email protected];+ import wasi:filesystem/[email protected];+ import wasi:sockets/[email protected];+ import wasi:sockets/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];}-@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/[email protected];- import wasi:clocks/[email protected];- import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];@unstable(feature = clocks-timezone)- import wasi:clocks/[email protected];- import wasi:filesystem/[email protected];- import wasi:filesystem/[email protected];- import wasi:sockets/[email protected];- import wasi:sockets/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];+ import wasi:clocks/[email protected];+ import wasi:filesystem/[email protected];+ import wasi:filesystem/[email protected];+ import wasi:sockets/[email protected];+ import wasi:sockets/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)export run;}diff --git a/crates/wasi-http/src/p3/wit/deps/clocks.wit b/crates/wasi-http/src/p3/wit/deps/clocks.witindex 19fc4bcd59..d8b8cfe4e3 100644--- a/crates/wasi-http/src/p3/wit/deps/clocks.wit+++ b/crates/wasi-http/src/p3/wit/deps/clocks.wit@@ -1,10 +1,10 @@-package wasi:[email protected];+package wasi:[email protected];/// This interface common types used throughout wasi:clocks.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface types {/// A duration of time, in nanoseconds.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type duration = u64;}@@ -16,14 +16,14 @@ interface types {////// A monotonic clock is a clock which has an unspecified initial value, and/// successive reads of the clock will produce non-decreasing values.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface monotonic-clock {use types.{duration};/// A mark on a monotonic clock is a number of nanoseconds since an/// unspecified initial value, and can only be compared to instances from/// the same monotonic-clock.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type mark = u64;/// Read the current value of the clock.@@ -35,20 +35,20 @@ interface monotonic-clock {/// the value of the clock in a `mark`. Consequently, implementations/// should ensure that the starting time is low enough to avoid the/// possibility of overflow in practice.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)now: func() -> mark;/// Query the resolution of the clock. Returns the duration of time/// corresponding to a clock tick.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-resolution: func() -> duration;/// Wait until the specified mark has occurred.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)wait-until: async func(when: mark);/// Wait for the specified duration to elapse.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)wait-for: async func(how-long: duration);}@@ -62,7 +62,7 @@ interface monotonic-clock {/// monotonic, making it unsuitable for measuring elapsed time.////// It is intended for reporting the current date and time for humans.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface system-clock {use types.{duration};@@ -82,7 +82,7 @@ interface system-clock {////// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)record instant {seconds: s64,nanoseconds: u32,@@ -94,12 +94,12 @@ interface system-clock {/// will not necessarily produce a sequence of non-decreasing values.////// The nanoseconds field of the output is always less than 1000000000.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)now: func() -> instant;/// Query the resolution of the clock. Returns the smallest duration of time/// that the implementation permits distinguishing.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-resolution: func() -> duration;}@@ -148,13 +148,13 @@ interface timezone {to-debug-string: func() -> string;}-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)world imports {- @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 monotonic-clock;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import system-clock;@unstable(feature = clocks-timezone)import timezone;diff --git a/crates/wasi-http/src/p3/wit/deps/filesystem.wit b/crates/wasi-http/src/p3/wit/deps/filesystem.witindex 697681f30c..e4a778f3d2 100644--- a/crates/wasi-http/src/p3/wit/deps/filesystem.wit+++ b/crates/wasi-http/src/p3/wit/deps/filesystem.wit@@ -1,4 +1,4 @@-package wasi:[email protected];+package wasi:[email protected];/// WASI filesystem is a filesystem API primarily intended to let users run WASI/// programs that access their files on their existing filesystems, without@@ -35,19 +35,19 @@ package wasi:[email protected];/// store or a database instead.////// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface types {- @since(version = 0.3.0-rc-2026-03-15)- use wasi:clocks/[email protected].{instant};+ @since(version = 0.3.0)+ use wasi:clocks/[email protected].{instant};/// File size or length of a region within a file.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type filesize = u64;/// The type of a filesystem object referenced by a descriptor.////// Note: This was called `filetype` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)variant descriptor-type {/// The descriptor refers to a block device inode.block-device,@@ -71,7 +71,7 @@ interface types {/// Descriptor flags.////// Note: This was called `fdflags` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)flags descriptor-flags {/// Read mode: Data can be read.read,@@ -113,7 +113,7 @@ interface types {}/// Flags determining the method of how paths are resolved.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)flags path-flags {/// As long as the resolved path corresponds to a symbolic link, it is/// expanded.@@ -121,7 +121,7 @@ interface types {}/// Open flags used by `open-at`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)flags open-flags {/// Create file if it does not exist, similar to `O_CREAT` in POSIX.create,@@ -134,13 +134,13 @@ interface types {}/// Number of hard links to an inode.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type link-count = u64;/// File attributes.////// Note: This was called `filestat` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)record descriptor-stat {/// File type.%type: descriptor-type,@@ -167,7 +167,7 @@ interface types {}/// When setting a timestamp, this gives the value to set it to.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)variant new-timestamp {/// Leave the timestamp set to its previous value.no-change,@@ -179,7 +179,7 @@ interface types {}/// A directory entry.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)record directory-entry {/// The type of the file referred to by this directory entry.%type: descriptor-type,@@ -191,7 +191,7 @@ interface types {/// Not all of these error codes are returned by the functions provided by this/// API; some are used in higher-level library layers, and others are provided/// merely for alignment with POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)variant error-code {/// Permission denied, similar to `EACCES` in POSIX.access,@@ -272,7 +272,7 @@ interface types {}/// File or memory access pattern advisory information.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)enum advice {/// The application has no advice to give on its behavior with respect/// to the specified data.@@ -296,7 +296,7 @@ interface types {/// A 128-bit hash value, split into parts because wasm doesn't have a/// 128-bit integer type.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)record metadata-hash-value {/// 64 bits of a 128-bit hash value.lower: u64,@@ -307,7 +307,7 @@ interface types {/// A descriptor is a reference to a filesystem object, which may be a file,/// directory, named pipe, special file, or other object on which filesystem/// calls may be made.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)resource descriptor {/// Return a stream for reading from a file.///@@ -325,7 +325,7 @@ interface types {/// resolves to `err` with an `error-code`.////// Note: This is similar to `pread` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)read-via-stream: func(offset: filesize) -> tuple<stream<u8>, future<result<_, error-code>>>;/// Return a stream for writing to a file, if available.///@@ -339,7 +339,7 @@ interface types {/// written or an error is encountered.////// Note: This is similar to `pwrite` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)write-via-stream: func(data: stream<u8>, offset: filesize) -> future<result<_, error-code>>;/// Return a stream for appending to a file, if available.///@@ -349,12 +349,12 @@ interface types {/// written or an error is encountered.////// Note: This is similar to `write` with `O_APPEND` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)append-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;/// Provide file advisory information on a descriptor.////// This is similar to `posix_fadvise` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)advise: async func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>;/// Synchronize the data of a file to disk.///@@ -362,7 +362,7 @@ interface types {/// opened for writing.////// Note: This is similar to `fdatasync` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)sync-data: async func() -> result<_, error-code>;/// Get flags associated with a descriptor.///@@ -370,7 +370,7 @@ interface types {////// Note: This returns the value that was the `fs_flags` value returned/// from `fdstat_get` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-flags: async func() -> result<descriptor-flags, error-code>;/// Get the dynamic type of a descriptor.///@@ -382,20 +382,20 @@ interface types {////// Note: This returns the value that was the `fs_filetype` value returned/// from `fdstat_get` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-type: async func() -> result<descriptor-type, error-code>;/// Adjust the size of an open file. If this increases the file's size, the/// extra bytes are filled with zeros.////// Note: This was called `fd_filestat_set_size` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)set-size: async func(size: filesize) -> result<_, error-code>;/// Adjust the timestamps of an open file or directory.////// Note: This is similar to `futimens` in POSIX.////// Note: This was called `fd_filestat_set_times` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)set-times: async func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;/// Read directory entries from a directory.///@@ -409,7 +409,7 @@ interface types {////// This function returns a future, which will resolve to an error code if/// reading full contents of the directory fails.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)read-directory: func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;/// Synchronize the data and metadata of a file to disk.///@@ -417,12 +417,12 @@ interface types {/// opened for writing.////// Note: This is similar to `fsync` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)sync: async func() -> result<_, error-code>;/// Create a directory.////// Note: This is similar to `mkdirat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)create-directory-at: async func(path: string) -> result<_, error-code>;/// Return the attributes of an open file or directory.///@@ -433,7 +433,7 @@ interface types {/// modified, use `metadata-hash`.////// Note: This was called `fd_filestat_get` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)stat: async func() -> result<descriptor-stat, error-code>;/// Return the attributes of a file or directory.///@@ -442,7 +442,7 @@ interface types {/// discussion of alternatives.////// Note: This was called `path_filestat_get` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)stat-at: async func(path-flags: path-flags, path: string) -> result<descriptor-stat, error-code>;/// Adjust the timestamps of a file or directory.///@@ -450,7 +450,7 @@ interface types {////// Note: This was called `path_filestat_set_times` in earlier versions of/// WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)set-times-at: async func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;/// Create a hard link.///@@ -459,7 +459,7 @@ interface types {/// `error-code::not-permitted` if the old path is not a file.////// Note: This is similar to `linkat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)link-at: async func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow<descriptor>, new-path: string) -> result<_, error-code>;/// Open a file or directory.///@@ -473,7 +473,7 @@ interface types {/// `error-code::read-only`.////// Note: This is similar to `openat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)open-at: async func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result<descriptor, error-code>;/// Read the contents of a symbolic link.///@@ -481,19 +481,19 @@ interface types {/// filesystem, this function fails with `error-code::not-permitted`.////// Note: This is similar to `readlinkat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)readlink-at: async func(path: string) -> result<string, error-code>;/// Remove a directory.////// Return `error-code::not-empty` if the directory is not empty.////// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)remove-directory-at: async func(path: string) -> result<_, error-code>;/// Rename a filesystem object.////// Note: This is similar to `renameat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)rename-at: async func(old-path: string, new-descriptor: borrow<descriptor>, new-path: string) -> result<_, error-code>;/// Create a symbolic link (also known as a "symlink").///@@ -501,7 +501,7 @@ interface types {/// `error-code::not-permitted`.////// Note: This is similar to `symlinkat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>;/// Unlink a filesystem object that is not a directory.///@@ -512,7 +512,7 @@ interface types {/// If the filesystem object is a directory, `error-code::access` or/// `error-code::is-directory` may be returned instead of the/// POSIX-specified `error-code::not-permitted`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)unlink-file-at: async func(path: string) -> result<_, error-code>;/// Test whether two descriptors refer to the same filesystem object.///@@ -520,7 +520,7 @@ interface types {/// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers./// wasi-filesystem does not expose device and inode numbers, so this function/// may be used instead.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)is-same-object: async func(other: borrow<descriptor>) -> bool;/// Return a hash of the metadata associated with a filesystem object referred/// to by a descriptor.@@ -541,35 +541,35 @@ interface types {/// computed hash.////// However, none of these is required.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)metadata-hash: async func() -> result<metadata-hash-value, error-code>;/// Return a hash of the metadata associated with a filesystem object referred/// to by a directory descriptor and a relative path.////// This performs the same hash computation as `metadata-hash`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)metadata-hash-at: async func(path-flags: path-flags, path: string) -> result<metadata-hash-value, error-code>;}}-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface preopens {- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)use types.{descriptor};/// Return the set of preopened directories, and their paths.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-directories: func() -> list<tuple<descriptor, string>>;}-@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/[email protected];- @since(version = 0.3.0-rc-2026-03-15)- import wasi:clocks/[email protected];- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0)import types;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import preopens;}diff --git a/crates/wasi-http/src/p3/wit/deps/http.wit b/crates/wasi-http/src/p3/wit/deps/http.witindex c1c1e68e75..08458f7c68 100644--- a/crates/wasi-http/src/p3/wit/deps/http.wit+++ b/crates/wasi-http/src/p3/wit/deps/http.wit@@ -1,13 +1,13 @@-package wasi:[email protected];+package wasi:[email protected];/// 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/[email protected].{duration};+ use wasi:clocks/[email protected].{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<string>,info-code: option<u16>,}/// 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<u8>,alert-message: option<string>,}/// 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<string>,field-size: option<u32>,@@ -52,7 +52,7 @@ interface types {/// These cases are inspired by the IANA HTTP Proxy Error Types:/// <https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-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<u8>;/// 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/[email protected];- import wasi:cli/[email protected];- import wasi:cli/[email protected];- import wasi:cli/[email protected];- import wasi:clocks/[email protected];+ import wasi:cli/[email protected];+ import wasi:cli/[email protected];+ import wasi:cli/[email protected];+ import wasi:cli/[email protected];+ import wasi:clocks/[email protected];import types;import client;- import wasi:clocks/[email protected];- import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];@unstable(feature = clocks-timezone)- import wasi:clocks/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];+ import wasi:clocks/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];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/[email protected];+ import wasi:clocks/[email protected];import types;import handler;- import wasi:cli/[email protected];- import wasi:cli/[email protected];- import wasi:cli/[email protected];- import wasi:cli/[email protected];+ import wasi:cli/[email protected];+ import wasi:cli/[email protected];+ import wasi:cli/[email protected];+ import wasi:cli/[email protected];import client;- import wasi:clocks/[email protected];- import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];@unstable(feature = clocks-timezone)- import wasi:clocks/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];+ import wasi:clocks/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];export handler;}diff --git a/crates/wasi-http/src/p3/wit/deps/random.wit b/crates/wasi-http/src/p3/wit/deps/random.witindex 026f44a109..0b9a55fc09 100644--- a/crates/wasi-http/src/p3/wit/deps/random.wit+++ b/crates/wasi-http/src/p3/wit/deps/random.wit@@ -1,10 +1,10 @@-package wasi:[email protected];+package wasi:[email protected];/// The insecure-seed interface for seeding hash-map DoS resistance.////// It is intended to be portable at least between Unix-family platforms and/// Windows.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface insecure-seed {/// Return a 128-bit value that may contain a pseudo-random value.///@@ -23,7 +23,7 @@ interface insecure-seed {/// This will likely be changed to a value import, to prevent it from being/// called multiple times and potentially used for purposes other than DoS/// protection.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-insecure-seed: func() -> tuple<u64, u64>;}@@ -31,7 +31,7 @@ interface insecure-seed {////// It is intended to be portable at least between Unix-family platforms and/// Windows.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface insecure {/// Return up to `max-len` insecure pseudo-random bytes.///@@ -48,14 +48,14 @@ interface insecure {/// Implementations MUST return at least 1 byte when `max-len` is greater/// than zero. When `max-len` is zero, implementations MUST return an empty/// list without trapping.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-insecure-random-bytes: func(max-len: u64) -> list<u8>;/// Return an insecure pseudo-random `u64` value.////// This function returns the same type of pseudo-random data as/// `get-insecure-random-bytes`, represented as a `u64`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-insecure-random-u64: func() -> u64;}@@ -63,7 +63,7 @@ interface insecure {////// It is intended to be portable at least between Unix-family platforms and/// Windows.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface random {/// Return up to `max-len` cryptographically-secure random or pseudo-random/// bytes.@@ -85,23 +85,23 @@ interface random {/// This function must always return fresh data. Deterministic environments/// must omit this function, rather than implementing it with deterministic/// data.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-random-bytes: func(max-len: u64) -> list<u8>;/// Return a cryptographically-secure random or pseudo-random `u64` value.////// This function returns the same type of data as `get-random-bytes`,/// represented as a `u64`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-random-u64: func() -> u64;}-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)world imports {- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import random;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import insecure;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import insecure-seed;}diff --git a/crates/wasi-http/src/p3/wit/deps/sockets.wit b/crates/wasi-http/src/p3/wit/deps/sockets.witindex cde2e4d6eb..0dd27a4fc4 100644--- a/crates/wasi-http/src/p3/wit/deps/sockets.wit+++ b/crates/wasi-http/src/p3/wit/deps/sockets.wit@@ -1,9 +1,9 @@-package wasi:[email protected];+package wasi:[email protected];-@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/[email protected].{duration};+ @since(version = 0.3.0)+ use wasi:clocks/[email protected].{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<string>),}- @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<u8, u8, u8, u8>;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;- @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_portport: 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_portport: 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 <https://github.com/WebAssembly/WASI/blob/main/proposals/sockets/TcpSocketOperationalSemantics-0.3.0-draft.md>+ /// See <https://github.com/WebAssembly/WASI/blob/main/proposals/sockets/TcpSocketOperationalSemantics-0.3.0.md>/// 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 {/// - <https://man7.org/linux/man-pages/man2/socket.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>/// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)create: static func(address-family: ip-address-family) -> result<tcp-socket, error-code>;/// Bind the socket to the provided IP address and port.///@@ -213,7 +213,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/bind.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>/// - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>- @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 {/// - <https://man7.org/linux/man-pages/man2/connect.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>/// - <https://man.freebsd.org/cgi/man.cgi?connect>- @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 {/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>/// - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>/// - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)listen: func() -> result<stream<tcp-socket>, error-code>;/// Transmit data to peer.///@@ -345,7 +345,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/send.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>/// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)send: func(data: stream<u8>) -> future<result<_, error-code>>;/// Read data from peer.///@@ -374,7 +374,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/recv.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>/// - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)receive: func() -> tuple<stream<u8>, future<result<_, error-code>>>;/// Get the bound local address.///@@ -393,7 +393,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>/// - <https://man.freebsd.org/cgi/man.cgi?getsockname>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-local-address: func() -> result<ip-socket-address, error-code>;/// Get the remote address.///@@ -405,19 +405,19 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>/// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-remote-address: func() -> result<ip-socket-address, error-code>;/// 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<bool, error-code>;- @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<duration, error-code>;- @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<duration, error-code>;- @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<u32, error-code>;- @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<u8, error-code>;- @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<u64, error-code>;- @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<u64, error-code>;- @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 {/// - <https://man7.org/linux/man-pages/man2/socket.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>/// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)create: static func(address-family: ip-address-family) -> result<udp-socket, error-code>;/// Bind the socket to the provided IP address and port.///@@ -573,7 +573,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/bind.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>/// - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>- @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 {/// - <https://man7.org/linux/man-pages/man2/connect.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>/// - <https://man.freebsd.org/cgi/man.cgi?connect>- @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 {/// - <https://man7.org/linux/man-pages/man2/connect.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>/// - <https://man.freebsd.org/cgi/man.cgi?connect>- @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 {/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>/// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)send: async func(data: list<u8>, remote-address: option<ip-socket-address>) -> result<_, error-code>;/// Receive a message on the socket.///@@ -697,7 +697,7 @@ interface types {/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>/// - <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_wsarecvmsg>/// - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)receive: async func() -> result<tuple<list<u8>, ip-socket-address>, error-code>;/// Get the current bound address.///@@ -716,7 +716,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>/// - <https://man.freebsd.org/cgi/man.cgi?getsockname>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-local-address: func() -> result<ip-socket-address, error-code>;/// Get the address the socket is currently "connected" to.///@@ -728,14 +728,14 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>/// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-remote-address: func() -> result<ip-socket-address, error-code>;/// 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<u8, error-code>;- @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<u64, error-code>;- @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<u64, error-code>;- @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 {/// - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>/// - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)resolve-addresses: async func(name: string) -> result<list<ip-address>, 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/[email protected];- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)+ import wasi:clocks/[email protected];+ @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/crates/wasi-http/src/p3/wit/world.wit b/crates/wasi-http/src/p3/wit/world.witindex 8e7c324245..8f50093969 100644--- a/crates/wasi-http/src/p3/wit/world.wit+++ b/crates/wasi-http/src/p3/wit/world.wit@@ -2,5 +2,5 @@package wasmtime:wasi-http;world bindings {- include wasi:http/[email protected];+ include wasi:http/[email protected];}diff --git a/crates/wasi-http/tests/all/p3/mod.rs b/crates/wasi-http/tests/all/p3/mod.rsindex af3fdb0b9f..532cbfd80d 100644--- a/crates/wasi-http/tests/all/p3/mod.rs+++ b/crates/wasi-http/tests/all/p3/mod.rs@@ -405,7 +405,7 @@ async fn test_http_middleware_with_chain(host_to_host: bool) -> Result<()> {"local:local/chain-http".to_owned(),InstantiationArg {instance: "local:local/chain-http".into(),- export: Some("wasi:http/[email protected]".into()),+ export: Some("wasi:http/[email protected]".into()),},)].into_iter()diff --git a/crates/wasi/src/p3/bindings.rs b/crates/wasi/src/p3/bindings.rsindex d6c11da770..ab774e909f 100644--- a/crates/wasi/src/p3/bindings.rs+++ b/crates/wasi/src/p3/bindings.rs@@ -23,7 +23,7 @@//! // An example of extending the `wasi:cli/command` world with a//! // custom host interface.//! world my-world {-//! include wasi:cli/[email protected];+//! include wasi:cli/[email protected];//!//! import custom-host;//! }diff --git a/crates/wasi/src/p3/cli/mod.rs b/crates/wasi/src/p3/cli/mod.rsindex 5e96b919dd..630bc748ea 100644--- a/crates/wasi/src/p3/cli/mod.rs+++ b/crates/wasi/src/p3/cli/mod.rs@@ -62,19 +62,7 @@ pub fn add_to_linker<T>(linker: &mut Linker<T>) -> wasmtime::Result<()>whereT: WasiCliView + 'static,{- let exit_options = exit::LinkOptions::default();- add_to_linker_with_options(linker, &exit_options)-}--/// Similar to [`add_to_linker`], but with the ability to enable unstable features.-pub fn add_to_linker_with_options<T>(- linker: &mut Linker<T>,- exit_options: &exit::LinkOptions,-) -> wasmtime::Result<()>-where- T: WasiCliView + 'static,-{- exit::add_to_linker::<_, WasiCli>(linker, exit_options, T::cli)?;+ exit::add_to_linker::<_, WasiCli>(linker, T::cli)?;environment::add_to_linker::<_, WasiCli>(linker, T::cli)?;stdin::add_to_linker::<_, WasiCli>(linker, T::cli)?;stdout::add_to_linker::<_, WasiCli>(linker, T::cli)?;diff --git a/crates/wasi/src/p3/mod.rs b/crates/wasi/src/p3/mod.rsindex ecbb31a6e0..96df64a067 100644--- a/crates/wasi/src/p3/mod.rs+++ b/crates/wasi/src/p3/mod.rs@@ -178,12 +178,12 @@ where/// Similar to [`add_to_linker`], but with the ability to enable unstable features.pub fn add_to_linker_with_options<T>(linker: &mut Linker<T>,- options: &LinkOptions,+ _options: &LinkOptions,) -> wasmtime::Result<()>whereT: WasiView + 'static,{- cli::add_to_linker_with_options(linker, &options.into())?;+ cli::add_to_linker(linker)?;clocks::add_to_linker(linker)?;filesystem::add_to_linker(linker)?;random::add_to_linker(linker)?;diff --git a/crates/wasi/src/p3/wit/deps/cli.wit b/crates/wasi/src/p3/wit/deps/cli.witindex 8ba52c5cd5..7aae56c17e 100644--- a/crates/wasi/src/p3/wit/deps/cli.wit+++ b/crates/wasi/src/p3/wit/deps/cli.wit@@ -1,6 +1,6 @@-package wasi:[email protected];+package wasi:[email protected];-@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<tuple<string, string>>;/// 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<string>;/// 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<string>;}-@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 errorio,@@ -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<stream<u8>, future<result<_, error-code>>>;}-@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<u8>) -> future<result<_, error-code>>;}-@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<u8>) -> future<result<_, error-code>>;}@@ -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<terminal-input>;}/// 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<terminal-output>;}/// 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<terminal-output>;}-@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/[email protected];- import wasi:clocks/[email protected];- import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];@unstable(feature = clocks-timezone)- import wasi:clocks/[email protected];- import wasi:filesystem/[email protected];- import wasi:filesystem/[email protected];- import wasi:sockets/[email protected];- import wasi:sockets/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];+ import wasi:clocks/[email protected];+ import wasi:filesystem/[email protected];+ import wasi:filesystem/[email protected];+ import wasi:sockets/[email protected];+ import wasi:sockets/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];}-@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/[email protected];- import wasi:clocks/[email protected];- import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];+ import wasi:clocks/[email protected];@unstable(feature = clocks-timezone)- import wasi:clocks/[email protected];- import wasi:filesystem/[email protected];- import wasi:filesystem/[email protected];- import wasi:sockets/[email protected];- import wasi:sockets/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];- import wasi:random/[email protected];+ import wasi:clocks/[email protected];+ import wasi:filesystem/[email protected];+ import wasi:filesystem/[email protected];+ import wasi:sockets/[email protected];+ import wasi:sockets/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];+ import wasi:random/[email protected];- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)export run;}diff --git a/crates/wasi/src/p3/wit/deps/clocks.wit b/crates/wasi/src/p3/wit/deps/clocks.witindex 19fc4bcd59..d8b8cfe4e3 100644--- a/crates/wasi/src/p3/wit/deps/clocks.wit+++ b/crates/wasi/src/p3/wit/deps/clocks.wit@@ -1,10 +1,10 @@-package wasi:[email protected];+package wasi:[email protected];/// This interface common types used throughout wasi:clocks.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface types {/// A duration of time, in nanoseconds.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type duration = u64;}@@ -16,14 +16,14 @@ interface types {////// A monotonic clock is a clock which has an unspecified initial value, and/// successive reads of the clock will produce non-decreasing values.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface monotonic-clock {use types.{duration};/// A mark on a monotonic clock is a number of nanoseconds since an/// unspecified initial value, and can only be compared to instances from/// the same monotonic-clock.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type mark = u64;/// Read the current value of the clock.@@ -35,20 +35,20 @@ interface monotonic-clock {/// the value of the clock in a `mark`. Consequently, implementations/// should ensure that the starting time is low enough to avoid the/// possibility of overflow in practice.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)now: func() -> mark;/// Query the resolution of the clock. Returns the duration of time/// corresponding to a clock tick.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-resolution: func() -> duration;/// Wait until the specified mark has occurred.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)wait-until: async func(when: mark);/// Wait for the specified duration to elapse.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)wait-for: async func(how-long: duration);}@@ -62,7 +62,7 @@ interface monotonic-clock {/// monotonic, making it unsuitable for measuring elapsed time.////// It is intended for reporting the current date and time for humans.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface system-clock {use types.{duration};@@ -82,7 +82,7 @@ interface system-clock {////// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)record instant {seconds: s64,nanoseconds: u32,@@ -94,12 +94,12 @@ interface system-clock {/// will not necessarily produce a sequence of non-decreasing values.////// The nanoseconds field of the output is always less than 1000000000.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)now: func() -> instant;/// Query the resolution of the clock. Returns the smallest duration of time/// that the implementation permits distinguishing.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-resolution: func() -> duration;}@@ -148,13 +148,13 @@ interface timezone {to-debug-string: func() -> string;}-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)world imports {- @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 monotonic-clock;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import system-clock;@unstable(feature = clocks-timezone)import timezone;diff --git a/crates/wasi/src/p3/wit/deps/filesystem.wit b/crates/wasi/src/p3/wit/deps/filesystem.witindex 697681f30c..e4a778f3d2 100644--- a/crates/wasi/src/p3/wit/deps/filesystem.wit+++ b/crates/wasi/src/p3/wit/deps/filesystem.wit@@ -1,4 +1,4 @@-package wasi:[email protected];+package wasi:[email protected];/// WASI filesystem is a filesystem API primarily intended to let users run WASI/// programs that access their files on their existing filesystems, without@@ -35,19 +35,19 @@ package wasi:[email protected];/// store or a database instead.////// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface types {- @since(version = 0.3.0-rc-2026-03-15)- use wasi:clocks/[email protected].{instant};+ @since(version = 0.3.0)+ use wasi:clocks/[email protected].{instant};/// File size or length of a region within a file.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type filesize = u64;/// The type of a filesystem object referenced by a descriptor.////// Note: This was called `filetype` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)variant descriptor-type {/// The descriptor refers to a block device inode.block-device,@@ -71,7 +71,7 @@ interface types {/// Descriptor flags.////// Note: This was called `fdflags` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)flags descriptor-flags {/// Read mode: Data can be read.read,@@ -113,7 +113,7 @@ interface types {}/// Flags determining the method of how paths are resolved.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)flags path-flags {/// As long as the resolved path corresponds to a symbolic link, it is/// expanded.@@ -121,7 +121,7 @@ interface types {}/// Open flags used by `open-at`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)flags open-flags {/// Create file if it does not exist, similar to `O_CREAT` in POSIX.create,@@ -134,13 +134,13 @@ interface types {}/// Number of hard links to an inode.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type link-count = u64;/// File attributes.////// Note: This was called `filestat` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)record descriptor-stat {/// File type.%type: descriptor-type,@@ -167,7 +167,7 @@ interface types {}/// When setting a timestamp, this gives the value to set it to.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)variant new-timestamp {/// Leave the timestamp set to its previous value.no-change,@@ -179,7 +179,7 @@ interface types {}/// A directory entry.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)record directory-entry {/// The type of the file referred to by this directory entry.%type: descriptor-type,@@ -191,7 +191,7 @@ interface types {/// Not all of these error codes are returned by the functions provided by this/// API; some are used in higher-level library layers, and others are provided/// merely for alignment with POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)variant error-code {/// Permission denied, similar to `EACCES` in POSIX.access,@@ -272,7 +272,7 @@ interface types {}/// File or memory access pattern advisory information.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)enum advice {/// The application has no advice to give on its behavior with respect/// to the specified data.@@ -296,7 +296,7 @@ interface types {/// A 128-bit hash value, split into parts because wasm doesn't have a/// 128-bit integer type.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)record metadata-hash-value {/// 64 bits of a 128-bit hash value.lower: u64,@@ -307,7 +307,7 @@ interface types {/// A descriptor is a reference to a filesystem object, which may be a file,/// directory, named pipe, special file, or other object on which filesystem/// calls may be made.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)resource descriptor {/// Return a stream for reading from a file.///@@ -325,7 +325,7 @@ interface types {/// resolves to `err` with an `error-code`.////// Note: This is similar to `pread` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)read-via-stream: func(offset: filesize) -> tuple<stream<u8>, future<result<_, error-code>>>;/// Return a stream for writing to a file, if available.///@@ -339,7 +339,7 @@ interface types {/// written or an error is encountered.////// Note: This is similar to `pwrite` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)write-via-stream: func(data: stream<u8>, offset: filesize) -> future<result<_, error-code>>;/// Return a stream for appending to a file, if available.///@@ -349,12 +349,12 @@ interface types {/// written or an error is encountered.////// Note: This is similar to `write` with `O_APPEND` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)append-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;/// Provide file advisory information on a descriptor.////// This is similar to `posix_fadvise` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)advise: async func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>;/// Synchronize the data of a file to disk.///@@ -362,7 +362,7 @@ interface types {/// opened for writing.////// Note: This is similar to `fdatasync` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)sync-data: async func() -> result<_, error-code>;/// Get flags associated with a descriptor.///@@ -370,7 +370,7 @@ interface types {////// Note: This returns the value that was the `fs_flags` value returned/// from `fdstat_get` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-flags: async func() -> result<descriptor-flags, error-code>;/// Get the dynamic type of a descriptor.///@@ -382,20 +382,20 @@ interface types {////// Note: This returns the value that was the `fs_filetype` value returned/// from `fdstat_get` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-type: async func() -> result<descriptor-type, error-code>;/// Adjust the size of an open file. If this increases the file's size, the/// extra bytes are filled with zeros.////// Note: This was called `fd_filestat_set_size` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)set-size: async func(size: filesize) -> result<_, error-code>;/// Adjust the timestamps of an open file or directory.////// Note: This is similar to `futimens` in POSIX.////// Note: This was called `fd_filestat_set_times` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)set-times: async func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;/// Read directory entries from a directory.///@@ -409,7 +409,7 @@ interface types {////// This function returns a future, which will resolve to an error code if/// reading full contents of the directory fails.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)read-directory: func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;/// Synchronize the data and metadata of a file to disk.///@@ -417,12 +417,12 @@ interface types {/// opened for writing.////// Note: This is similar to `fsync` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)sync: async func() -> result<_, error-code>;/// Create a directory.////// Note: This is similar to `mkdirat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)create-directory-at: async func(path: string) -> result<_, error-code>;/// Return the attributes of an open file or directory.///@@ -433,7 +433,7 @@ interface types {/// modified, use `metadata-hash`.////// Note: This was called `fd_filestat_get` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)stat: async func() -> result<descriptor-stat, error-code>;/// Return the attributes of a file or directory.///@@ -442,7 +442,7 @@ interface types {/// discussion of alternatives.////// Note: This was called `path_filestat_get` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)stat-at: async func(path-flags: path-flags, path: string) -> result<descriptor-stat, error-code>;/// Adjust the timestamps of a file or directory.///@@ -450,7 +450,7 @@ interface types {////// Note: This was called `path_filestat_set_times` in earlier versions of/// WASI.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)set-times-at: async func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;/// Create a hard link.///@@ -459,7 +459,7 @@ interface types {/// `error-code::not-permitted` if the old path is not a file.////// Note: This is similar to `linkat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)link-at: async func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow<descriptor>, new-path: string) -> result<_, error-code>;/// Open a file or directory.///@@ -473,7 +473,7 @@ interface types {/// `error-code::read-only`.////// Note: This is similar to `openat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)open-at: async func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result<descriptor, error-code>;/// Read the contents of a symbolic link.///@@ -481,19 +481,19 @@ interface types {/// filesystem, this function fails with `error-code::not-permitted`.////// Note: This is similar to `readlinkat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)readlink-at: async func(path: string) -> result<string, error-code>;/// Remove a directory.////// Return `error-code::not-empty` if the directory is not empty.////// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)remove-directory-at: async func(path: string) -> result<_, error-code>;/// Rename a filesystem object.////// Note: This is similar to `renameat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)rename-at: async func(old-path: string, new-descriptor: borrow<descriptor>, new-path: string) -> result<_, error-code>;/// Create a symbolic link (also known as a "symlink").///@@ -501,7 +501,7 @@ interface types {/// `error-code::not-permitted`.////// Note: This is similar to `symlinkat` in POSIX.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>;/// Unlink a filesystem object that is not a directory.///@@ -512,7 +512,7 @@ interface types {/// If the filesystem object is a directory, `error-code::access` or/// `error-code::is-directory` may be returned instead of the/// POSIX-specified `error-code::not-permitted`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)unlink-file-at: async func(path: string) -> result<_, error-code>;/// Test whether two descriptors refer to the same filesystem object.///@@ -520,7 +520,7 @@ interface types {/// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers./// wasi-filesystem does not expose device and inode numbers, so this function/// may be used instead.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)is-same-object: async func(other: borrow<descriptor>) -> bool;/// Return a hash of the metadata associated with a filesystem object referred/// to by a descriptor.@@ -541,35 +541,35 @@ interface types {/// computed hash.////// However, none of these is required.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)metadata-hash: async func() -> result<metadata-hash-value, error-code>;/// Return a hash of the metadata associated with a filesystem object referred/// to by a directory descriptor and a relative path.////// This performs the same hash computation as `metadata-hash`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)metadata-hash-at: async func(path-flags: path-flags, path: string) -> result<metadata-hash-value, error-code>;}}-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface preopens {- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)use types.{descriptor};/// Return the set of preopened directories, and their paths.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-directories: func() -> list<tuple<descriptor, string>>;}-@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/[email protected];- @since(version = 0.3.0-rc-2026-03-15)- import wasi:clocks/[email protected];- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0)import types;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import preopens;}diff --git a/crates/wasi/src/p3/wit/deps/random.wit b/crates/wasi/src/p3/wit/deps/random.witindex 026f44a109..0b9a55fc09 100644--- a/crates/wasi/src/p3/wit/deps/random.wit+++ b/crates/wasi/src/p3/wit/deps/random.wit@@ -1,10 +1,10 @@-package wasi:[email protected];+package wasi:[email protected];/// The insecure-seed interface for seeding hash-map DoS resistance.////// It is intended to be portable at least between Unix-family platforms and/// Windows.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface insecure-seed {/// Return a 128-bit value that may contain a pseudo-random value.///@@ -23,7 +23,7 @@ interface insecure-seed {/// This will likely be changed to a value import, to prevent it from being/// called multiple times and potentially used for purposes other than DoS/// protection.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-insecure-seed: func() -> tuple<u64, u64>;}@@ -31,7 +31,7 @@ interface insecure-seed {////// It is intended to be portable at least between Unix-family platforms and/// Windows.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface insecure {/// Return up to `max-len` insecure pseudo-random bytes.///@@ -48,14 +48,14 @@ interface insecure {/// Implementations MUST return at least 1 byte when `max-len` is greater/// than zero. When `max-len` is zero, implementations MUST return an empty/// list without trapping.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-insecure-random-bytes: func(max-len: u64) -> list<u8>;/// Return an insecure pseudo-random `u64` value.////// This function returns the same type of pseudo-random data as/// `get-insecure-random-bytes`, represented as a `u64`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-insecure-random-u64: func() -> u64;}@@ -63,7 +63,7 @@ interface insecure {////// It is intended to be portable at least between Unix-family platforms and/// Windows.-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)interface random {/// Return up to `max-len` cryptographically-secure random or pseudo-random/// bytes.@@ -85,23 +85,23 @@ interface random {/// This function must always return fresh data. Deterministic environments/// must omit this function, rather than implementing it with deterministic/// data.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-random-bytes: func(max-len: u64) -> list<u8>;/// Return a cryptographically-secure random or pseudo-random `u64` value.////// This function returns the same type of data as `get-random-bytes`,/// represented as a `u64`.- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-random-u64: func() -> u64;}-@since(version = 0.3.0-rc-2026-03-15)+@since(version = 0.3.0)world imports {- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import random;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import insecure;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)import insecure-seed;}diff --git a/crates/wasi/src/p3/wit/deps/sockets.wit b/crates/wasi/src/p3/wit/deps/sockets.witindex cde2e4d6eb..0dd27a4fc4 100644--- a/crates/wasi/src/p3/wit/deps/sockets.wit+++ b/crates/wasi/src/p3/wit/deps/sockets.wit@@ -1,9 +1,9 @@-package wasi:[email protected];+package wasi:[email protected];-@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/[email protected].{duration};+ @since(version = 0.3.0)+ use wasi:clocks/[email protected].{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<string>),}- @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<u8, u8, u8, u8>;- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;- @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_portport: 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_portport: 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 <https://github.com/WebAssembly/WASI/blob/main/proposals/sockets/TcpSocketOperationalSemantics-0.3.0-draft.md>+ /// See <https://github.com/WebAssembly/WASI/blob/main/proposals/sockets/TcpSocketOperationalSemantics-0.3.0.md>/// 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 {/// - <https://man7.org/linux/man-pages/man2/socket.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>/// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)create: static func(address-family: ip-address-family) -> result<tcp-socket, error-code>;/// Bind the socket to the provided IP address and port.///@@ -213,7 +213,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/bind.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>/// - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>- @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 {/// - <https://man7.org/linux/man-pages/man2/connect.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>/// - <https://man.freebsd.org/cgi/man.cgi?connect>- @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 {/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>/// - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>/// - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)listen: func() -> result<stream<tcp-socket>, error-code>;/// Transmit data to peer.///@@ -345,7 +345,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/send.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>/// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)send: func(data: stream<u8>) -> future<result<_, error-code>>;/// Read data from peer.///@@ -374,7 +374,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/recv.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>/// - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)receive: func() -> tuple<stream<u8>, future<result<_, error-code>>>;/// Get the bound local address.///@@ -393,7 +393,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>/// - <https://man.freebsd.org/cgi/man.cgi?getsockname>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-local-address: func() -> result<ip-socket-address, error-code>;/// Get the remote address.///@@ -405,19 +405,19 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>/// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-remote-address: func() -> result<ip-socket-address, error-code>;/// 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<bool, error-code>;- @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<duration, error-code>;- @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<duration, error-code>;- @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<u32, error-code>;- @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<u8, error-code>;- @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<u64, error-code>;- @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<u64, error-code>;- @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 {/// - <https://man7.org/linux/man-pages/man2/socket.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>/// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)create: static func(address-family: ip-address-family) -> result<udp-socket, error-code>;/// Bind the socket to the provided IP address and port.///@@ -573,7 +573,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/bind.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>/// - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>- @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 {/// - <https://man7.org/linux/man-pages/man2/connect.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>/// - <https://man.freebsd.org/cgi/man.cgi?connect>- @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 {/// - <https://man7.org/linux/man-pages/man2/connect.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>/// - <https://man.freebsd.org/cgi/man.cgi?connect>- @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 {/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>/// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)send: async func(data: list<u8>, remote-address: option<ip-socket-address>) -> result<_, error-code>;/// Receive a message on the socket.///@@ -697,7 +697,7 @@ interface types {/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>/// - <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_wsarecvmsg>/// - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)receive: async func() -> result<tuple<list<u8>, ip-socket-address>, error-code>;/// Get the current bound address.///@@ -716,7 +716,7 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>/// - <https://man.freebsd.org/cgi/man.cgi?getsockname>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-local-address: func() -> result<ip-socket-address, error-code>;/// Get the address the socket is currently "connected" to.///@@ -728,14 +728,14 @@ interface types {/// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>/// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)get-remote-address: func() -> result<ip-socket-address, error-code>;/// 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<u8, error-code>;- @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<u64, error-code>;- @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<u64, error-code>;- @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 {/// - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>/// - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>/// - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)resolve-addresses: async func(name: string) -> result<list<ip-address>, 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/[email protected];- @since(version = 0.3.0-rc-2026-03-15)+ @since(version = 0.3.0)+ import wasi:clocks/[email protected];+ @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/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rsindex 7b7e3511e6..0eb4d2e16a 100644--- a/crates/wasmtime/src/config.rs+++ b/crates/wasmtime/src/config.rs@@ -2455,6 +2455,12 @@ impl Config {WasmFeatures::COMPONENT_MODEL,cfg!(feature = "component-model"),);+ features.set(+ WasmFeatures::CM_ASYNC,+ self.tunables+ .concurrency_support+ .unwrap_or(cfg!(feature = "component-model-async")),+ );// Next disable any features which the current compiler/target do not// support. This handles cases where Winch, for example, doesn'tdiff --git a/src/common.rs b/src/common.rsindex 204c7cd44d..15c0bcea6b 100644--- a/src/common.rs+++ b/src/common.rs@@ -14,10 +14,7 @@ use wasmtime_wasi::WasiCtxBuilder;use wasmtime::component::Component;/// Whether or not WASIp3 is enabled by default.-///-/// Currently this is disabled (the `&& false`), but that'll get removed in the-/// future.-pub const P3_DEFAULT: bool = cfg!(feature = "component-model-async") && false;+pub const P3_DEFAULT: bool = cfg!(feature = "component-model-async");#[derive(Clone)]pub enum RunTarget {@@ -472,8 +469,7 @@ impl RunCommon {#[cfg(feature = "component-model-async")]if self.common.wasi.p3.unwrap_or(P3_DEFAULT) {- let mut p3_options = wasmtime_wasi::p3::bindings::LinkOptions::default();- p3_options.cli_exit_with_code(self.common.wasi.cli_exit_with_code.unwrap_or(false));+ let p3_options = wasmtime_wasi::p3::bindings::LinkOptions::default();wasmtime_wasi::p3::add_to_linker_with_options(linker, &p3_options).context("failed to link `wasi:[email protected]`")?;}diff --git a/tests/wasi.rs b/tests/wasi.rsindex 0f12c74b2f..148d3fde9e 100644--- a/tests/wasi.rs+++ b/tests/wasi.rs@@ -15,14 +15,53 @@ use std::path::Path;use std::process::{Child, Stdio};use tempfile::TempDir;use wasmtime::error::Context;-use wasmtime::{Result, ToWasmtimeResult as _, format_err};-use wit_component::ComponentEncoder;+use wasmtime::{Result, format_err};const KNOWN_FAILURES: &[&str] = &[#[cfg(windows)]"renumber",#[cfg(windows)]"stdio",+ // Waiting for the upstream tests to update to use the 0.3.0 official WITs.+ "multi-clock-wait",+ "filesystem-unlink-errors",+ "monotonic-clock",+ "filesystem-open-errors",+ "cli-terminal",+ "sockets-udp-bind",+ "wall-clock",+ "sockets-tcp-bind",+ "cli-env",+ "cli-stdio-roundtrip",+ "cli-stdio",+ "filesystem-flags-and-type",+ "sockets-tcp-send",+ "filesystem-set-size",+ "sockets-udp-connect",+ "sockets-echo",+ "random",+ "sockets-udp-properties",+ "filesystem-metadata-hash",+ "sockets-tcp-listen",+ "sockets-udp-send",+ "filesystem-read-directory",+ "sockets-tcp-receive",+ "sockets-tcp-properties",+ "filesystem-dotdot",+ "filesystem-io",+ "sockets-tcp-connect",+ "sockets-udp-receive",+ "run-with-err",+ "filesystem-advise",+ "http-fields",+ "http-response",+ "filesystem-is-same-object",+ "filesystem-rename",+ "filesystem-hard-links",+ "filesystem-stat",+ "http-request",+ "filesystem-mkdir-rmdir",+ "http-service",];fn main() -> Result<()> {@@ -53,16 +92,37 @@ fn find_tests(path: &Path, trials: &mut Vec<Trial>) -> Result<()> {format!("wasmtime-wasi - {}", path.display()),{let path = path.clone();- move || run_test(&path, false).map_err(|e| format!("{e:?}").into())+ move || run_test(&path).map_err(|e| format!("{e:?}").into())},));}Ok(())}-fn run_test(path: &Path, componentize: bool) -> Result<()> {- let wasmtime = Path::new(env!("CARGO_BIN_EXE_wasmtime"));+fn run_test(path: &Path) -> Result<()> {let test_name = path.file_stem().unwrap().to_str().unwrap();+ let mut should_fail = KNOWN_FAILURES.contains(&test_name);+ if path.iter().any(|p| p == "wasm32-wasip3") && !cfg!(feature = "component-model-async") {+ should_fail = true;+ }+ match (execute(path), should_fail) {+ // If this test passed and is not a known failure, or if it failed and+ // it's a known failure, then flag this test as "ok".+ (Ok(_), false) | (Err(_), true) => Ok(()),++ // If this test failed and it's not known to fail, explain why.+ (Err(e), false) => Err(e),++ // If this test passed but it's flagged as should be failed, then fail+ // this test for someone to update `KNOWN_FAILURES`.+ (Ok(()), true) => {+ wasmtime::bail!("test passed but it's listed in `KNOWN_FAILURES`")+ }+ }+}++fn execute(path: &Path) -> Result<()> {+ let wasmtime = Path::new(env!("CARGO_BIN_EXE_wasmtime"));let target_dir = wasmtime.parent().unwrap().parent().unwrap();let parent_dir = path.parent().ok_or(format_err!("module has no parent?"))?;let spec = if let Ok(contents) = fs::read_to_string(&path.with_extension("json")) {@@ -73,26 +133,6 @@ fn run_test(path: &Path, componentize: bool) -> Result<()> {let mut td = TempDir::new_in(&target_dir)?;td.disable_cleanup(true);- let path = if componentize {- let module = fs::read(path).expect("read wasm module");- let component = ComponentEncoder::default()- .module(module.as_slice())- .to_wasmtime_result()?- .validate(true)- .adapter(- "wasi_snapshot_preview1",- &fs::read(test_programs_artifacts::ADAPTER_COMMAND)?,- )- .to_wasmtime_result()?- .encode()- .to_wasmtime_result()?;- let stem = path.file_stem().unwrap().to_str().unwrap();- let component_path = td.path().join(format!("{stem}.component.wasm"));- fs::write(&component_path, component)?;- component_path- } else {- path.to_path_buf()- };let spec_debug = format!("{spec:#?}");let spec_world = spec.world.clone();@@ -213,21 +253,23 @@ fn run_test(path: &Path, componentize: bool) -> Result<()> {let mut i = 0;loop {let n = child.stderr.as_mut().unwrap().read(&mut buf[i..])?;- assert!(n > 0);+ if n == 0 {+ break;+ }i += n;if buf[i - 1] == b'\n' {break;}}let addr = String::from_utf8_lossy(&buf[..i]);- let addr = addr+ let Some(addr) = addr.trim().strip_prefix("Serving HTTP on http://")- .unwrap()- .strip_suffix("/")- .unwrap()- .parse::<SocketAddr>()- .unwrap();+ .and_then(|s| s.strip_suffix("/"))+ .and_then(|s| s.parse::<SocketAddr>().ok())+ else {+ wasmtime::bail!("unexpected output from server: {addr:?}");+ };http_addr = Some(addr);addr}@@ -256,49 +298,28 @@ fn run_test(path: &Path, componentize: bool) -> Result<()> {let ok = (Some(exit_code.unwrap_or(0)) == result.status.code() || killed)&& matches_or_missing(&stdout, &result.stdout)&& matches_or_missing(&stderr, &result.stderr);- let mut should_fail = KNOWN_FAILURES.contains(&test_name);- if path.iter().any(|p| p == "wasm32-wasip3")- && !cfg!(feature = "component-model-async")- {- should_fail = true;- }- match (ok, should_fail) {- // If this test passed and is not a known failure, or if it failed and- // it's a known failure, then flag this test as "ok".- (true, false) | (false, true) => {}-- // If this test failed and it's not known to fail, explain why.- (false, false) => {- td.disable_cleanup(false);- let mut msg = String::new();- writeln!(msg, " command: {cmd_debug}")?;- writeln!(msg, " spec: {spec_debug}")?;- writeln!(msg, " result.status: {}", result.status)?;- if !result.stdout.is_empty() {- write!(- msg,- " result.stdout:\n {}",- String::from_utf8_lossy(&result.stdout).replace("\n", "\n ")- )?;- }- if !result.stderr.is_empty() {- writeln!(- msg,- " result.stderr:\n {}",- String::from_utf8_lossy(&result.stderr).replace("\n", "\n ")- )?;- }- wasmtime::bail!(- "{msg}\nFAILED! The result does not match the specification"- );+ if !ok {+ td.disable_cleanup(false);+ let mut msg = String::new();+ writeln!(msg, " command: {cmd_debug}")?;+ writeln!(msg, " spec: {spec_debug}")?;+ writeln!(msg, " result.status: {}", result.status)?;+ if !result.stdout.is_empty() {+ write!(+ msg,+ " result.stdout:\n {}",+ String::from_utf8_lossy(&result.stdout).replace("\n", "\n ")+ )?;}-- // If this test passed but it's flagged as should be failed, then fail- // this test for someone to update `KNOWN_FAILURES`.- (true, true) => {- wasmtime::bail!("test passed but it's listed in `KNOWN_FAILURES`")+ if !result.stderr.is_empty() {+ writeln!(+ msg,+ " result.stderr:\n {}",+ String::from_utf8_lossy(&result.stderr).replace("\n", "\n ")+ )?;}+ wasmtime::bail!("{msg}\nFAILED! The result does not match the specification");}}}