A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
chore: bump to wasi 0.3.0-rc-2026-02-09 (#12557)
Bailey Hayesbda02c19ef1f
diff --git a/.github/workflows/main.yml b/.github/workflows/main.ymlindex 3b6c0e5c4c..82e1804bf2 100644--- a/.github/workflows/main.yml+++ b/.github/workflows/main.yml@@ -510,7 +510,7 @@ jobs:- name: Install wkgrun: |curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash- cargo binstall --no-confirm [email protected]+ cargo binstall --no-confirm [email protected]- name: Re-vendor WITrun: ./ci/vendor-wit.sh- run: git diff --exit-codediff --git a/ci/vendor-wit.sh b/ci/vendor-wit.shindex 315e4cbefd..150b4ee149 100755--- a/ci/vendor-wit.sh+++ b/ci/vendor-wit.sh@@ -34,7 +34,7 @@ get_github() {}p2=0.2.6-p3=0.3.0-rc-2026-01-06+p3=0.3.0-rc-2026-02-09rm -rf crates/wasi-io/wit/depsmkdir -p crates/wasi-io/wit/depsdiff --git a/crates/test-programs/src/bin/p3_http_middleware.rs b/crates/test-programs/src/bin/p3_http_middleware.rsindex 0c78a18d4b..1381bc9a83 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 c2fa1c78c3..7b66ac714d 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,31 +6,43 @@ 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>;}",- generate_all,+ // workaround https://github.com/bytecodealliance/wit-bindgen/issues/1544+ // generate_all+ with: {+ "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,+ },});use super::Component;export!(Component);}-use bindings::{- exports::wasi::http::handler::Guest as Handler,- local::local::chain_http,- wasi::clocks::monotonic_clock,- wasi::http::types::{ErrorCode, Request, Response},-};+use bindings::{exports::wasi::http::handler::Guest as Handler, local::local::chain_http};use std::time::Duration;+use test_programs::p3::wasi::clocks::monotonic_clock;+use test_programs::p3::wasi::http::types::{ErrorCode, Request, Response};struct Component;diff --git a/crates/test-programs/src/bin/p3_readdir.rs b/crates/test-programs/src/bin/p3_readdir.rsindex aaeb414f82..dcb9e759a8 100644--- a/crates/test-programs/src/bin/p3_readdir.rs+++ b/crates/test-programs/src/bin/p3_readdir.rs@@ -23,7 +23,7 @@ fn main() {}async fn read_dir(dir: &Descriptor) -> Vec<DirectoryEntry> {- let (dirs, result) = dir.read_directory().await;+ let (dirs, result) = dir.read_directory();let mut dirs = dirs.collect().await;result.await.unwrap();dirs.sort_by_key(|d| d.name.clone());diff --git a/crates/test-programs/src/p3/mod.rs b/crates/test-programs/src/p3/mod.rsindex eeabb4d6c1..d5dea4f184 100644--- a/crates/test-programs/src/p3/mod.rs+++ b/crates/test-programs/src/p3/mod.rs@@ -6,12 +6,12 @@ wit_bindgen::generate!({package wasmtime:test;world testp3 {- include wasi:cli/[email protected];- import wasi:http/[email protected];- import wasi:http/[email protected];- import wasi:http/[email protected];+ include wasi:cli/[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: "../wasi-http/src/p3/wit",@@ -28,19 +28,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 0f987bf38b..4f8bbf8a24 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-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-environment: func() -> list<tuple<string, string>>;/// Get the POSIX-style arguments to the program.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-initial-cwd: func() -> option<string>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface exit {/// Exit the current instance and any linked instances.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)exit: func(status: result);/// Exit the current instance and any linked instances, reporting the@@ -41,16 +41,16 @@ interface exit {exit-with-code: func(status-code: u8);}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface run {/// Run the program.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)run: async func() -> result;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface types {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum error-code {/// Input/output errorio,@@ -61,7 +61,7 @@ interface types {}}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)- write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface stderr {use types.{error-code};@@ -110,8 +110,8 @@ 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-01-06)- write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;}/// Terminal input.@@ -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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-input {/// The input side of a terminal.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-output {/// The output side of a terminal.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resource terminal-output;}/// An interface providing an optional `terminal-input` for stdin as a/// link-time authority.-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-stdin {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use terminal-input.{terminal-input};/// If stdin is connected to a terminal, return a `terminal-input` handle/// allowing further interaction with it.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-stdout {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use terminal-output.{terminal-output};/// If stdout is connected to a terminal, return a `terminal-output` handle/// allowing further interaction with it.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-stderr {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use terminal-output.{terminal-output};/// If stderr is connected to a terminal, return a `terminal-output` handle/// allowing further interaction with it.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-terminal-stderr: func() -> option<terminal-output>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import environment;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import exit;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stdin;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stdout;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stderr;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-input;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-output;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-stdin;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-stdout;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)world command {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import environment;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import exit;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stdin;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stdout;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stderr;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-input;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-output;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-stdin;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-stdout;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)export run;}diff --git a/crates/wasi-http/src/p3/wit/deps/clocks.wit b/crates/wasi-http/src/p3/wit/deps/clocks.witindex fc59f5a21e..71986bab2b 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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface types {/// A duration of time, in nanoseconds.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface monotonic-clock {use types.{duration};/// A mark on a monotonic clock is a number of nanoseconds since an/// unspecified initial value, and can only be compared to instances from/// the same monotonic-clock.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)now: func() -> mark;/// Query the resolution of the clock. Returns the duration of time/// corresponding to a clock tick.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-resolution: func() -> duration;/// Wait until the specified mark has occurred.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)wait-until: async func(when: mark);/// Wait for the specified duration to elapse.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)now: func() -> instant;/// Query the resolution of the clock. Returns the smallest duration of time/// that the implementation permits distinguishing.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-resolution: func() -> duration;}@@ -148,13 +148,13 @@ interface timezone {to-debug-string: func() -> string;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import monotonic-clock;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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 0ac149cb7c..8fb83041a1 100644--- a/crates/wasi-http/src/p3/wit/deps/filesystem.wit+++ b/crates/wasi-http/src/p3/wit/deps/filesystem.wit@@ -1,12 +1,9 @@-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/// significant overhead.///-/// It is intended to be roughly portable between Unix-family platforms and-/// Windows, though it does not hide many of the major differences.-////// Paths are passed as interface-type `string`s, meaning they must consist of/// a sequence of Unicode Scalar Values (USVs). Some filesystems may contain/// paths which are not accessible by this API.@@ -23,20 +20,34 @@ package wasi:[email protected];/// For more information about WASI path resolution and sandboxing, see/// [WASI filesystem path resolution].///+/// Though this package presents a portable interface modelled on POSIX, it+/// prioritizes compatibility over portability: allowing users to access their+/// files on their machine is more important than exposing a single semantics+/// across all platforms. Notably, depending on the underlying operating system+/// and file system:+/// * Paths may be case-folded or not.+/// * Deleting (unlinking) a file may fail if there are other file descriptors+/// open.+/// * Durability and atomicity of changes to underlying files when there are+/// concurrent writers.+///+/// Users that need well-defined, portable semantics should use a key-value+/// store or a database instead.+////// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface types {- @since(version = 0.3.0-rc-2026-01-06)- use wasi:clocks/[email protected].{instant};+ @since(version = 0.3.0-rc-2026-02-09)+ use wasi:clocks/[email protected].{instant};/// File size or length of a region within a file.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)type filesize = u64;/// The type of a filesystem object referenced by a descriptor.////// Note: This was called `filetype` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum descriptor-type {/// The type of the descriptor or file is unknown or is different from/// any of the other types specified.@@ -60,7 +71,7 @@ interface types {/// Descriptor flags.////// Note: This was called `fdflags` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)flags descriptor-flags {/// Read mode: Data can be read.read,@@ -102,7 +113,7 @@ interface types {}/// Flags determining the method of how paths are resolved.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)flags path-flags {/// As long as the resolved path corresponds to a symbolic link, it is/// expanded.@@ -110,7 +121,7 @@ interface types {}/// Open flags used by `open-at`.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)flags open-flags {/// Create file if it does not exist, similar to `O_CREAT` in POSIX.create,@@ -123,13 +134,13 @@ interface types {}/// Number of hard links to an inode.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)type link-count = u64;/// File attributes.////// Note: This was called `filestat` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)record descriptor-stat {/// File type.%type: descriptor-type,@@ -156,7 +167,7 @@ interface types {}/// When setting a timestamp, this gives the value to set it to.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)variant new-timestamp {/// Leave the timestamp set to its previous value.no-change,@@ -168,6 +179,7 @@ interface types {}/// A directory entry.+ @since(version = 0.3.0-rc-2026-02-09)record directory-entry {/// The type of the file referred to by this directory entry.%type: descriptor-type,@@ -179,6 +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-02-09)enum error-code {/// Permission denied, similar to `EACCES` in POSIX.access,@@ -255,7 +268,7 @@ interface types {}/// File or memory access pattern advisory information.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum advice {/// The application has no advice to give on its behavior with respect/// to the specified data.@@ -279,7 +292,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)record metadata-hash-value {/// 64 bits of a 128-bit hash value.lower: u64,@@ -290,7 +303,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resource descriptor {/// Return a stream for reading from a file.///@@ -308,7 +321,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)read-via-stream: func(offset: filesize) -> tuple<stream<u8>, future<result<_, error-code>>>;/// Return a stream for writing to a file, if available.///@@ -322,8 +335,8 @@ interface types {/// written or an error is encountered.////// Note: This is similar to `pwrite` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)- write-via-stream: async func(data: stream<u8>, offset: filesize) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ write-via-stream: func(data: stream<u8>, offset: filesize) -> future<result<_, error-code>>;/// Return a stream for appending to a file, if available.////// May fail with an error-code describing why the file cannot be appended.@@ -332,12 +345,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-01-06)- append-via-stream: async func(data: stream<u8>) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ 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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)advise: async func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>;/// Synchronize the data of a file to disk.///@@ -345,7 +358,7 @@ interface types {/// opened for writing.////// Note: This is similar to `fdatasync` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)sync-data: async func() -> result<_, error-code>;/// Get flags associated with a descriptor.///@@ -353,7 +366,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-flags: async func() -> result<descriptor-flags, error-code>;/// Get the dynamic type of a descriptor.///@@ -365,20 +378,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-size: async func(size: filesize) -> result<_, error-code>;/// Adjust the timestamps of an open file or directory.////// Note: This is similar to `futimens` in POSIX.////// Note: This was called `fd_filestat_set_times` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-times: async func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;/// Read directory entries from a directory.///@@ -392,20 +405,20 @@ 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-01-06)- read-directory: async func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;+ @since(version = 0.3.0-rc-2026-02-09)+ read-directory: func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;/// Synchronize the data and metadata of a file to disk.////// This function succeeds with no effect if the file descriptor is not/// opened for writing.////// Note: This is similar to `fsync` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)sync: async func() -> result<_, error-code>;/// Create a directory.////// Note: This is similar to `mkdirat` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)create-directory-at: async func(path: string) -> result<_, error-code>;/// Return the attributes of an open file or directory.///@@ -416,7 +429,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)stat: async func() -> result<descriptor-stat, error-code>;/// Return the attributes of a file or directory.///@@ -425,7 +438,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)stat-at: async func(path-flags: path-flags, path: string) -> result<descriptor-stat, error-code>;/// Adjust the timestamps of a file or directory.///@@ -433,7 +446,7 @@ interface types {////// Note: This was called `path_filestat_set_times` in earlier versions of/// WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-times-at: async func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;/// Create a hard link.///@@ -442,7 +455,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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.///@@ -456,7 +469,7 @@ interface types {/// `error-code::read-only`.////// Note: This is similar to `openat` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)open-at: async func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result<descriptor, error-code>;/// Read the contents of a symbolic link.///@@ -464,19 +477,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)remove-directory-at: async func(path: string) -> result<_, error-code>;/// Rename a filesystem object.////// Note: This is similar to `renameat` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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").///@@ -484,13 +497,13 @@ interface types {/// `error-code::not-permitted`.////// Note: This is similar to `symlinkat` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>;/// Unlink a filesystem object that is not a directory.////// Return `error-code::is-directory` if the path refers to a directory./// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)unlink-file-at: async func(path: string) -> result<_, error-code>;/// Test whether two descriptors refer to the same filesystem object.///@@ -498,7 +511,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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.@@ -519,35 +532,35 @@ interface types {/// computed hash.////// However, none of these is required.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)metadata-hash-at: async func(path-flags: path-flags, path: string) -> result<metadata-hash-value, error-code>;}}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface preopens {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use types.{descriptor};/// Return the set of preopened directories, and their paths.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-directories: func() -> list<tuple<descriptor, string>>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)- import wasi:clocks/[email protected];- @since(version = 0.3.0-rc-2026-01-06)- import wasi:clocks/[email protected];- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0-rc-2026-02-09)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import preopens;}diff --git a/crates/wasi-http/src/p3/wit/deps/http.wit b/crates/wasi-http/src/p3/wit/deps/http.witindex 3860af7678..442b18ea12 100644--- a/crates/wasi-http/src/p3/wit/deps/http.wit+++ b/crates/wasi-http/src/p3/wit/deps/http.wit@@ -1,11 +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-02-09)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-02-09)variant method {get,head,@@ -20,6 +22,7 @@ interface types {}/// This type corresponds to HTTP standard Related Schemes.+ @since(version = 0.3.0-rc-2026-02-09)variant scheme {HTTP,HTTPS,@@ -27,18 +30,21 @@ interface types {}/// Defines the case payload type for `DNS-error` above:+ @since(version = 0.3.0-rc-2026-02-09)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-02-09)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-02-09)record field-size-payload {field-name: option<string>,field-size: option<u32>,@@ -46,6 +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-02-09)variant error-code {DNS-timeout,DNS-error(DNS-error-payload),@@ -95,6 +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-02-09)variant header-error {/// This error indicates that a `field-name` or `field-value` was/// syntactically invalid when used with an operation that sets headers in a@@ -110,6 +118,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-02-09)variant request-options-error {/// Indicates the specified field is not supported by this implementation.not-supported,@@ -122,11 +131,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-02-09)type field-name = string;/// Field values should always be ASCII strings. However, in/// reality, HTTP implementations often have to interpret malformed values,/// so they are provided as a list of bytes.+ @since(version = 0.3.0-rc-2026-02-09)type field-value = list<u8>;/// This following block defines the `fields` resource which corresponds to@@ -144,6 +155,7 @@ interface types {/// original casing used to construct or mutate the `fields` resource. The `fields`/// resource should use that original casing when serializing the fields for/// transport or when returning them from a method.+ @since(version = 0.3.0-rc-2026-02-09)resource fields {/// Construct an empty HTTP Fields.///@@ -212,12 +224,15 @@ interface types {}/// Headers is an alias for Fields.+ @since(version = 0.3.0-rc-2026-02-09)type headers = fields;/// Trailers is an alias for Fields.+ @since(version = 0.3.0-rc-2026-02-09)type trailers = fields;/// Represents an HTTP Request.+ @since(version = 0.3.0-rc-2026-02-09)resource request {/// Construct a new `request` with a default `method` of `GET`, and/// `none` values for `path-with-query`, `scheme`, and `authority`.@@ -304,6 +319,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-02-09)resource request-options {/// Construct a default `request-options` value.constructor();@@ -332,9 +348,11 @@ interface types {}/// This type corresponds to the HTTP standard Status Code.+ @since(version = 0.3.0-rc-2026-02-09)type status-code = u16;/// Represents an HTTP Response.+ @since(version = 0.3.0-rc-2026-02-09)resource response {/// Construct a new `response`, with a default `status-code` of `200`./// If a different `status-code` is needed, it must be set via the@@ -383,6 +401,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-02-09)interface handler {use types.{request, response, error-code};@@ -401,6 +420,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-02-09)interface client {use types.{request, response, error-code};@@ -412,21 +432,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-02-09)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;}@@ -436,22 +457,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-02-09)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 8bb8731451..521df6e50f 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-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface insecure {/// Return `len` insecure pseudo-random bytes.///@@ -41,14 +41,14 @@ interface insecure {/// There are no requirements on the values of the returned bytes, however/// implementations are encouraged to return evenly distributed values with/// a long period.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-insecure-random-bytes: func(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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-insecure-random-u64: func() -> u64;}@@ -56,7 +56,7 @@ interface insecure {////// It is intended to be portable at least between Unix-family platforms and/// Windows.-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface random {/// Return `len` cryptographically-secure random or pseudo-random bytes.///@@ -70,23 +70,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-random-bytes: func(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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-random-u64: func() -> u64;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import random;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import insecure;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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 d7ebe150b4..aa9d4d7f07 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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface types {- @since(version = 0.3.0-rc-2026-01-06)- use wasi:clocks/[email protected].{duration};+ @since(version = 0.3.0-rc-2026-02-09)+ 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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum error-code {/// Unknown errorunknown,@@ -57,7 +57,7 @@ interface types {datagram-too-large,}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum ip-address-family {/// Similar to `AF_INET` in POSIX.ipv4,@@ -65,19 +65,19 @@ interface types {ipv6,}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)type ipv4-address = tuple<u8, u8, u8, u8>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)variant ip-address {ipv4(ipv4-address),ipv6(ipv6-address),}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)record ipv4-socket-address {/// sin_portport: u16,@@ -85,7 +85,7 @@ interface types {address: ipv4-address,}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)record ipv6-socket-address {/// sin6_portport: u16,@@ -97,7 +97,7 @@ interface types {scope-id: u32,}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)variant ip-socket-address {ipv4(ipv4-socket-address),ipv6(ipv6-socket-address),@@ -122,7 +122,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resource tcp-socket {/// Create a new TCP socket.///@@ -138,7 +138,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)create: static func(address-family: ip-address-family) -> result<tcp-socket, error-code>;/// Bind the socket to the provided IP address and port.///@@ -171,7 +171,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)bind: func(local-address: ip-socket-address) -> result<_, error-code>;/// Connect to a remote endpoint.///@@ -202,7 +202,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)connect: async func(remote-address: ip-socket-address) -> result<_, error-code>;/// Start listening and return a stream of new inbound connections.///@@ -259,6 +259,12 @@ interface types {/// In either case, the stream returned by this `listen` method remains/// operational.///+ /// WASI requires `listen` to perform an implicit bind if the socket+ /// has not already been bound. Not all platforms (notably Windows)+ /// exhibit this behavior out of the box. On platforms that require it,+ /// the WASI implementation can emulate this behavior by performing+ /// the bind itself if the guest hasn't already done so.+ ////// # References/// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>/// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>@@ -268,7 +274,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)listen: func() -> result<stream<tcp-socket>, error-code>;/// Transmit data to peer.///@@ -290,8 +296,8 @@ 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-01-06)- send: async func(data: stream<u8>) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ send: func(data: stream<u8>) -> future<result<_, error-code>>;/// Read data from peer.////// This function returns a `stream` which provides the data received from the@@ -323,7 +329,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)receive: func() -> tuple<stream<u8>, future<result<_, error-code>>>;/// Get the bound local address.///@@ -341,7 +347,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-local-address: func() -> result<ip-socket-address, error-code>;/// Get the remote address.///@@ -353,19 +359,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-is-listening: func() -> bool;/// Whether this is a IPv4 or IPv6 socket.////// This is the value passed to the constructor.////// Equivalent to the SO_DOMAIN socket option.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-address-family: func() -> ip-address-family;/// Hints the desired listen queue size. Implementations are free to ignore this.///@@ -376,7 +382,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-listen-backlog-size: func(value: u64) -> result<_, error-code>;/// Enables or disables keepalive.///@@ -387,9 +393,9 @@ interface types {/// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true.////// Equivalent to the SO_KEEPALIVE socket option.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-keep-alive-enabled: func() -> result<bool, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-keep-alive-enabled: func(value: bool) -> result<_, error-code>;/// Amount of time the connection has to be idle before TCP starts sending keepalive packets.///@@ -401,9 +407,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-keep-alive-idle-time: func() -> result<duration, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;/// The time between keepalive packets.///@@ -415,9 +421,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-keep-alive-interval: func() -> result<duration, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-keep-alive-interval: func(value: duration) -> result<_, error-code>;/// The maximum amount of keepalive packets TCP should send before aborting the connection.///@@ -429,9 +435,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-keep-alive-count: func() -> result<u32, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-keep-alive-count: func(value: u32) -> result<_, error-code>;/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.///@@ -439,9 +445,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The TTL value must be 1 or higher.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-hop-limit: func() -> result<u8, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-hop-limit: func(value: u8) -> result<_, error-code>;/// The kernel buffer space reserved for sends/receives on this socket.///@@ -453,18 +459,18 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-receive-buffer-size: func() -> result<u64, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-receive-buffer-size: func(value: u64) -> result<_, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-send-buffer-size: func() -> result<u64, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-send-buffer-size: func(value: u64) -> result<_, error-code>;}/// A UDP socket handle.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resource udp-socket {/// Create a new UDP socket.///@@ -480,7 +486,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)create: static func(address-family: ip-address-family) -> result<udp-socket, error-code>;/// Bind the socket to the provided IP address and port.///@@ -500,7 +506,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)bind: func(local-address: ip-socket-address) -> result<_, error-code>;/// Associate this socket with a specific peer address.///@@ -538,7 +544,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)connect: func(remote-address: ip-socket-address) -> result<_, error-code>;/// Dissociate this socket from its peer address.///@@ -555,7 +561,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)disconnect: func() -> result<_, error-code>;/// Send a message on the socket to a particular peer.///@@ -588,7 +594,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)send: async func(data: list<u8>, remote-address: option<ip-socket-address>) -> result<_, error-code>;/// Receive a message on the socket.///@@ -613,7 +619,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)receive: async func() -> result<tuple<list<u8>, ip-socket-address>, error-code>;/// Get the current bound address.///@@ -631,7 +637,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-local-address: func() -> result<ip-socket-address, error-code>;/// Get the address the socket is currently "connected" to.///@@ -643,14 +649,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-address-family: func() -> ip-address-family;/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.///@@ -658,9 +664,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The TTL value must be 1 or higher.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-unicast-hop-limit: func() -> result<u8, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-unicast-hop-limit: func(value: u8) -> result<_, error-code>;/// The kernel buffer space reserved for sends/receives on this socket.///@@ -672,24 +678,24 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-receive-buffer-size: func() -> result<u64, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-receive-buffer-size: func(value: u64) -> result<_, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-send-buffer-size: func() -> result<u64, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-send-buffer-size: func(value: u64) -> result<_, error-code>;}}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface ip-name-lookup {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use types.{ip-address};/// Lookup error codes.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum error-code {/// Unknown errorunknown,@@ -737,16 +743,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resolve-addresses: async func(name: string) -> result<list<ip-address>, error-code>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)- import wasi:clocks/[email protected];- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import ip-name-lookup;}diff --git a/crates/wasi-http/src/p3/wit/world.wit b/crates/wasi-http/src/p3/wit/world.witindex 2c47442e8c..f95ca2ba76 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 31a017739a..99f915823f 100644--- a/crates/wasi-http/tests/all/p3/mod.rs+++ b/crates/wasi-http/tests/all/p3/mod.rs@@ -414,7 +414,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 f847af9fda..cc589e2f3c 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;//! }@@ -82,8 +82,12 @@ mod generated {"wasi:cli/stdout": store | tracing | trappable,"wasi:cli/stderr": store | tracing | trappable,"wasi:filesystem/types.[method]descriptor.read-via-stream": store | tracing | trappable,+ "wasi:filesystem/types.[method]descriptor.write-via-stream": store | tracing,+ "wasi:filesystem/types.[method]descriptor.append-via-stream": store | tracing,+ "wasi:filesystem/types.[method]descriptor.read-directory": store | tracing,"wasi:sockets/types.[method]tcp-socket.bind": async | tracing | trappable,"wasi:sockets/types.[method]tcp-socket.listen": store | tracing | trappable,+ "wasi:sockets/types.[method]tcp-socket.send": store | tracing,"wasi:sockets/types.[method]tcp-socket.receive": store | tracing | trappable,"wasi:sockets/types.[method]udp-socket.bind": async | tracing | trappable,"wasi:sockets/types.[method]udp-socket.connect": async | tracing | trappable,diff --git a/crates/wasi/src/p3/cli/host.rs b/crates/wasi/src/p3/cli/host.rsindex 29b4fbc56e..9e975317e6 100644--- a/crates/wasi/src/p3/cli/host.rs+++ b/crates/wasi/src/p3/cli/host.rs@@ -14,7 +14,7 @@ use std::io::{self, Cursor};use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};use tokio::sync::oneshot;use wasmtime::component::{- Access, Accessor, Destination, FutureReader, Resource, Source, StreamConsumer, StreamProducer,+ Access, Destination, FutureReader, Resource, Source, StreamConsumer, StreamProducer,StreamReader, StreamResult,};use wasmtime::{AsContextMut as _, StoreContextMut, error::Context as _, format_err};@@ -217,50 +217,50 @@ impl stdin::HostWithStore for WasiCli {impl stdin::Host for WasiCliCtxView<'_> {}impl stdout::HostWithStore for WasiCli {- async fn write_via_stream<U>(- store: &Accessor<U, Self>,+ fn write_via_stream<U>(+ mut store: Access<'_, U, Self>,data: StreamReader<u8>,- ) -> wasmtime::Result<Result<(), ErrorCode>> {+ ) -> wasmtime::Result<FutureReader<Result<(), ErrorCode>>> {let (result_tx, result_rx) = oneshot::channel();- store.with(|mut store| {- let tx = store.get().ctx.stdout.async_stream();- data.pipe(- store,- OutputStreamConsumer {- tx: Box::into_pin(tx),- result_tx: Some(result_tx),- },- );- });- Ok(match result_rx.await {- Ok(err) => Err(err),- Err(_) => Ok(()),- })+ let tx = store.get().ctx.stdout.async_stream();+ data.pipe(+ &mut store,+ OutputStreamConsumer {+ tx: Box::into_pin(tx),+ result_tx: Some(result_tx),+ },+ );+ Ok(FutureReader::new(&mut store, async {+ wasmtime::error::Ok(match result_rx.await {+ Ok(err) => Err(err),+ Err(_) => Ok(()),+ })+ }))}}impl stdout::Host for WasiCliCtxView<'_> {}impl stderr::HostWithStore for WasiCli {- async fn write_via_stream<U>(- store: &Accessor<U, Self>,+ fn write_via_stream<U>(+ mut store: Access<'_, U, Self>,data: StreamReader<u8>,- ) -> wasmtime::Result<Result<(), ErrorCode>> {+ ) -> wasmtime::Result<FutureReader<Result<(), ErrorCode>>> {let (result_tx, result_rx) = oneshot::channel();- store.with(|mut store| {- let tx = store.get().ctx.stderr.async_stream();- data.pipe(- store,- OutputStreamConsumer {- tx: Box::into_pin(tx),- result_tx: Some(result_tx),- },- );- });- Ok(match result_rx.await {- Ok(err) => Err(err),- Err(_) => Ok(()),- })+ let tx = store.get().ctx.stderr.async_stream();+ data.pipe(+ &mut store,+ OutputStreamConsumer {+ tx: Box::into_pin(tx),+ result_tx: Some(result_tx),+ },+ );+ Ok(FutureReader::new(&mut store, async {+ wasmtime::error::Ok(match result_rx.await {+ Ok(err) => Err(err),+ Err(_) => Ok(()),+ })+ }))}}diff --git a/crates/wasi/src/p3/filesystem/host.rs b/crates/wasi/src/p3/filesystem/host.rsindex 3da6f5c108..68229e00cd 100644--- a/crates/wasi/src/p3/filesystem/host.rs+++ b/crates/wasi/src/p3/filesystem/host.rs@@ -525,49 +525,56 @@ impl types::HostDescriptorWithStore for WasiFilesystem {))}- async fn write_via_stream<U>(- store: &Accessor<U, Self>,+ fn write_via_stream<U>(+ mut store: Access<'_, U, Self>,fd: Resource<Descriptor>,- data: StreamReader<u8>,+ mut data: StreamReader<u8>,offset: Filesize,- ) -> FilesystemResult<()> {+ ) -> FutureReader<Result<(), ErrorCode>> {let (result_tx, result_rx) = oneshot::channel();- store.with(|mut store| {- let file = get_file(store.get().table, &fd)?;+ match get_file(store.get().table, &fd).and_then(|file| {if !file.perms.contains(FilePerms::WRITE) {- return Err(ErrorCode::NotPermitted.into());+ Err(ErrorCode::NotPermitted.into())+ } else {+ Ok(file.clone())}- let file = file.clone();- data.pipe(store, WriteStreamConsumer::new_at(file, offset, result_tx));- FilesystemResult::Ok(())- })?;- result_rx- .await- .context("oneshot sender dropped")- .map_err(FilesystemError::trap)??;- Ok(())+ }) {+ Ok(file) => {+ data.pipe(+ &mut store,+ WriteStreamConsumer::new_at(file, offset, result_tx),+ );+ }+ Err(err) => {+ data.close(&mut store);+ let _ = result_tx.send(Err(err.downcast().unwrap_or(ErrorCode::Io)));+ }+ }+ FutureReader::new(&mut store, result_rx)}- async fn append_via_stream<U>(- store: &Accessor<U, Self>,+ fn append_via_stream<U>(+ mut store: Access<'_, U, Self>,fd: Resource<Descriptor>,- data: StreamReader<u8>,- ) -> FilesystemResult<()> {+ mut data: StreamReader<u8>,+ ) -> FutureReader<Result<(), ErrorCode>> {let (result_tx, result_rx) = oneshot::channel();- store.with(|mut store| {- let file = get_file(store.get().table, &fd)?;+ match get_file(store.get().table, &fd).and_then(|file| {if !file.perms.contains(FilePerms::WRITE) {- return Err(ErrorCode::NotPermitted.into());+ Err(ErrorCode::NotPermitted.into())+ } else {+ Ok(file.clone())}- let file = file.clone();- data.pipe(store, WriteStreamConsumer::new_append(file, result_tx));- FilesystemResult::Ok(())- })?;- result_rx- .await- .context("oneshot sender dropped")- .map_err(FilesystemError::trap)??;- Ok(())+ }) {+ Ok(file) => {+ data.pipe(&mut store, WriteStreamConsumer::new_append(file, result_tx));+ }+ Err(err) => {+ data.close(&mut store);+ let _ = result_tx.send(Err(err.downcast().unwrap_or(ErrorCode::Io)));+ }+ }+ FutureReader::new(&mut store, result_rx)}async fn advise<U>(@@ -632,45 +639,48 @@ impl types::HostDescriptorWithStore for WasiFilesystem {Ok(())}- async fn read_directory<U>(- store: &Accessor<U, Self>,+ fn read_directory<U>(+ mut store: Access<'_, U, Self>,fd: Resource<Descriptor>,- ) -> wasmtime::Result<(+ ) -> (StreamReader<DirectoryEntry>,FutureReader<Result<(), ErrorCode>>,- )> {- store.with(|mut store| {- let dir = get_dir(store.get().table, &fd)?;+ ) {+ let (result_tx, result_rx) = oneshot::channel();+ let stream = match get_dir(store.get().table, &fd).and_then(|dir| {if !dir.perms.contains(DirPerms::READ) {- return Ok((- StreamReader::new(&mut store, iter::empty()),- FutureReader::new(&mut store, async {- wasmtime::error::Ok(Err(ErrorCode::NotPermitted))- }),- ));+ Err(ErrorCode::NotPermitted.into())+ } else {+ Ok(dir)}- let allow_blocking_current_thread = dir.allow_blocking_current_thread;- let dir = Arc::clone(dir.as_dir());- let (result_tx, result_rx) = oneshot::channel();- let stream = if allow_blocking_current_thread {- match dir.entries() {- Ok(readdir) => StreamReader::new(- &mut store,- FallibleIteratorProducer::new(- readdir.filter_map(|e| map_dir_entry(e).transpose()),- result_tx,+ }) {+ Ok(dir) => {+ let allow_blocking_current_thread = dir.allow_blocking_current_thread;+ let dir = Arc::clone(dir.as_dir());+ if allow_blocking_current_thread {+ match dir.entries() {+ Ok(readdir) => StreamReader::new(+ &mut store,+ FallibleIteratorProducer::new(+ readdir.filter_map(|e| map_dir_entry(e).transpose()),+ result_tx,+ ),),- ),- Err(e) => {- result_tx.send(Err(e.into())).unwrap();- StreamReader::new(&mut store, iter::empty())+ Err(e) => {+ let _ = result_tx.send(Err(e.into()));+ StreamReader::new(&mut store, iter::empty())+ }}+ } else {+ StreamReader::new(&mut store, ReadDirStream::new(dir, result_tx))}- } else {- StreamReader::new(&mut store, ReadDirStream::new(dir, result_tx))- };- Ok((stream, FutureReader::new(&mut store, result_rx)))- })+ }+ Err(err) => {+ let _ = result_tx.send(Err(err.downcast().unwrap_or(ErrorCode::Io)));+ StreamReader::new(&mut store, iter::empty())+ }+ };+ (stream, FutureReader::new(&mut store, result_rx))}async fn sync<U>(store: &Accessor<U, Self>, fd: Resource<Descriptor>) -> FilesystemResult<()> {diff --git a/crates/wasi/src/p3/sockets/host/types/tcp.rs b/crates/wasi/src/p3/sockets/host/types/tcp.rsindex 2125b62ea5..a8815fd55b 100644--- a/crates/wasi/src/p3/sockets/host/types/tcp.rs+++ b/crates/wasi/src/p3/sockets/host/types/tcp.rs@@ -282,30 +282,30 @@ impl HostTcpSocketWithStore for WasiSockets {))}- async fn send<T: 'static>(- store: &Accessor<T, Self>,+ fn send<T: 'static>(+ mut store: Access<'_, T, Self>,socket: Resource<TcpSocket>,- data: StreamReader<u8>,- ) -> SocketResult<()> {+ mut data: StreamReader<u8>,+ ) -> FutureReader<Result<(), ErrorCode>> {let (result_tx, result_rx) = oneshot::channel();- store.with(|mut store| {- let sock = get_socket(store.get().table, &socket)?;- let stream = sock.tcp_stream_arc()?;- let stream = Arc::clone(stream);- data.pipe(- store,- SendStreamConsumer {- stream,- result: Some(result_tx),- },- );- SocketResult::Ok(())- })?;- result_rx- .await- .context("oneshot sender dropped")- .map_err(SocketError::trap)??;- Ok(())+ match get_socket(store.get().table, &socket)+ .and_then(|sock| sock.tcp_stream_arc().map(Arc::clone).map_err(Into::into))+ {+ Ok(stream) => {+ data.pipe(+ &mut store,+ SendStreamConsumer {+ stream,+ result: Some(result_tx),+ },+ );+ }+ Err(err) => {+ data.close(&mut store);+ let _ = result_tx.send(Err(err.downcast().unwrap_or(ErrorCode::Unknown)));+ }+ }+ FutureReader::new(&mut store, result_rx)}fn receive<T: 'static>(diff --git a/crates/wasi/src/p3/wit/deps/cli.wit b/crates/wasi/src/p3/wit/deps/cli.witindex 0f987bf38b..4f8bbf8a24 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-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-environment: func() -> list<tuple<string, string>>;/// Get the POSIX-style arguments to the program.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-initial-cwd: func() -> option<string>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface exit {/// Exit the current instance and any linked instances.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)exit: func(status: result);/// Exit the current instance and any linked instances, reporting the@@ -41,16 +41,16 @@ interface exit {exit-with-code: func(status-code: u8);}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface run {/// Run the program.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)run: async func() -> result;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface types {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum error-code {/// Input/output errorio,@@ -61,7 +61,7 @@ interface types {}}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)- write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface stderr {use types.{error-code};@@ -110,8 +110,8 @@ 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-01-06)- write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;}/// Terminal input.@@ -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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-input {/// The input side of a terminal.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-output {/// The output side of a terminal.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resource terminal-output;}/// An interface providing an optional `terminal-input` for stdin as a/// link-time authority.-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-stdin {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use terminal-input.{terminal-input};/// If stdin is connected to a terminal, return a `terminal-input` handle/// allowing further interaction with it.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-stdout {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use terminal-output.{terminal-output};/// If stdout is connected to a terminal, return a `terminal-output` handle/// allowing further interaction with it.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface terminal-stderr {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use terminal-output.{terminal-output};/// If stderr is connected to a terminal, return a `terminal-output` handle/// allowing further interaction with it.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-terminal-stderr: func() -> option<terminal-output>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import environment;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import exit;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stdin;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stdout;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stderr;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-input;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-output;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-stdin;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-stdout;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)world command {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import environment;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import exit;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stdin;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stdout;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import stderr;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-input;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-output;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-stdin;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import terminal-stdout;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)export run;}diff --git a/crates/wasi/src/p3/wit/deps/clocks.wit b/crates/wasi/src/p3/wit/deps/clocks.witindex fc59f5a21e..71986bab2b 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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface types {/// A duration of time, in nanoseconds.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface monotonic-clock {use types.{duration};/// A mark on a monotonic clock is a number of nanoseconds since an/// unspecified initial value, and can only be compared to instances from/// the same monotonic-clock.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)now: func() -> mark;/// Query the resolution of the clock. Returns the duration of time/// corresponding to a clock tick.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-resolution: func() -> duration;/// Wait until the specified mark has occurred.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)wait-until: async func(when: mark);/// Wait for the specified duration to elapse.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)now: func() -> instant;/// Query the resolution of the clock. Returns the smallest duration of time/// that the implementation permits distinguishing.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-resolution: func() -> duration;}@@ -148,13 +148,13 @@ interface timezone {to-debug-string: func() -> string;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import monotonic-clock;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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 0ac149cb7c..8fb83041a1 100644--- a/crates/wasi/src/p3/wit/deps/filesystem.wit+++ b/crates/wasi/src/p3/wit/deps/filesystem.wit@@ -1,12 +1,9 @@-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/// significant overhead.///-/// It is intended to be roughly portable between Unix-family platforms and-/// Windows, though it does not hide many of the major differences.-////// Paths are passed as interface-type `string`s, meaning they must consist of/// a sequence of Unicode Scalar Values (USVs). Some filesystems may contain/// paths which are not accessible by this API.@@ -23,20 +20,34 @@ package wasi:[email protected];/// For more information about WASI path resolution and sandboxing, see/// [WASI filesystem path resolution].///+/// Though this package presents a portable interface modelled on POSIX, it+/// prioritizes compatibility over portability: allowing users to access their+/// files on their machine is more important than exposing a single semantics+/// across all platforms. Notably, depending on the underlying operating system+/// and file system:+/// * Paths may be case-folded or not.+/// * Deleting (unlinking) a file may fail if there are other file descriptors+/// open.+/// * Durability and atomicity of changes to underlying files when there are+/// concurrent writers.+///+/// Users that need well-defined, portable semantics should use a key-value+/// store or a database instead.+////// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface types {- @since(version = 0.3.0-rc-2026-01-06)- use wasi:clocks/[email protected].{instant};+ @since(version = 0.3.0-rc-2026-02-09)+ use wasi:clocks/[email protected].{instant};/// File size or length of a region within a file.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)type filesize = u64;/// The type of a filesystem object referenced by a descriptor.////// Note: This was called `filetype` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum descriptor-type {/// The type of the descriptor or file is unknown or is different from/// any of the other types specified.@@ -60,7 +71,7 @@ interface types {/// Descriptor flags.////// Note: This was called `fdflags` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)flags descriptor-flags {/// Read mode: Data can be read.read,@@ -102,7 +113,7 @@ interface types {}/// Flags determining the method of how paths are resolved.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)flags path-flags {/// As long as the resolved path corresponds to a symbolic link, it is/// expanded.@@ -110,7 +121,7 @@ interface types {}/// Open flags used by `open-at`.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)flags open-flags {/// Create file if it does not exist, similar to `O_CREAT` in POSIX.create,@@ -123,13 +134,13 @@ interface types {}/// Number of hard links to an inode.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)type link-count = u64;/// File attributes.////// Note: This was called `filestat` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)record descriptor-stat {/// File type.%type: descriptor-type,@@ -156,7 +167,7 @@ interface types {}/// When setting a timestamp, this gives the value to set it to.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)variant new-timestamp {/// Leave the timestamp set to its previous value.no-change,@@ -168,6 +179,7 @@ interface types {}/// A directory entry.+ @since(version = 0.3.0-rc-2026-02-09)record directory-entry {/// The type of the file referred to by this directory entry.%type: descriptor-type,@@ -179,6 +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-02-09)enum error-code {/// Permission denied, similar to `EACCES` in POSIX.access,@@ -255,7 +268,7 @@ interface types {}/// File or memory access pattern advisory information.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum advice {/// The application has no advice to give on its behavior with respect/// to the specified data.@@ -279,7 +292,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)record metadata-hash-value {/// 64 bits of a 128-bit hash value.lower: u64,@@ -290,7 +303,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resource descriptor {/// Return a stream for reading from a file.///@@ -308,7 +321,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)read-via-stream: func(offset: filesize) -> tuple<stream<u8>, future<result<_, error-code>>>;/// Return a stream for writing to a file, if available.///@@ -322,8 +335,8 @@ interface types {/// written or an error is encountered.////// Note: This is similar to `pwrite` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)- write-via-stream: async func(data: stream<u8>, offset: filesize) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ write-via-stream: func(data: stream<u8>, offset: filesize) -> future<result<_, error-code>>;/// Return a stream for appending to a file, if available.////// May fail with an error-code describing why the file cannot be appended.@@ -332,12 +345,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-01-06)- append-via-stream: async func(data: stream<u8>) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ 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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)advise: async func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>;/// Synchronize the data of a file to disk.///@@ -345,7 +358,7 @@ interface types {/// opened for writing.////// Note: This is similar to `fdatasync` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)sync-data: async func() -> result<_, error-code>;/// Get flags associated with a descriptor.///@@ -353,7 +366,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-flags: async func() -> result<descriptor-flags, error-code>;/// Get the dynamic type of a descriptor.///@@ -365,20 +378,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-size: async func(size: filesize) -> result<_, error-code>;/// Adjust the timestamps of an open file or directory.////// Note: This is similar to `futimens` in POSIX.////// Note: This was called `fd_filestat_set_times` in earlier versions of WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-times: async func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;/// Read directory entries from a directory.///@@ -392,20 +405,20 @@ 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-01-06)- read-directory: async func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;+ @since(version = 0.3.0-rc-2026-02-09)+ read-directory: func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;/// Synchronize the data and metadata of a file to disk.////// This function succeeds with no effect if the file descriptor is not/// opened for writing.////// Note: This is similar to `fsync` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)sync: async func() -> result<_, error-code>;/// Create a directory.////// Note: This is similar to `mkdirat` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)create-directory-at: async func(path: string) -> result<_, error-code>;/// Return the attributes of an open file or directory.///@@ -416,7 +429,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)stat: async func() -> result<descriptor-stat, error-code>;/// Return the attributes of a file or directory.///@@ -425,7 +438,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)stat-at: async func(path-flags: path-flags, path: string) -> result<descriptor-stat, error-code>;/// Adjust the timestamps of a file or directory.///@@ -433,7 +446,7 @@ interface types {////// Note: This was called `path_filestat_set_times` in earlier versions of/// WASI.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-times-at: async func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;/// Create a hard link.///@@ -442,7 +455,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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.///@@ -456,7 +469,7 @@ interface types {/// `error-code::read-only`.////// Note: This is similar to `openat` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)open-at: async func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result<descriptor, error-code>;/// Read the contents of a symbolic link.///@@ -464,19 +477,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)remove-directory-at: async func(path: string) -> result<_, error-code>;/// Rename a filesystem object.////// Note: This is similar to `renameat` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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").///@@ -484,13 +497,13 @@ interface types {/// `error-code::not-permitted`.////// Note: This is similar to `symlinkat` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>;/// Unlink a filesystem object that is not a directory.////// Return `error-code::is-directory` if the path refers to a directory./// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)unlink-file-at: async func(path: string) -> result<_, error-code>;/// Test whether two descriptors refer to the same filesystem object.///@@ -498,7 +511,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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.@@ -519,35 +532,35 @@ interface types {/// computed hash.////// However, none of these is required.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)metadata-hash-at: async func(path-flags: path-flags, path: string) -> result<metadata-hash-value, error-code>;}}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface preopens {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use types.{descriptor};/// Return the set of preopened directories, and their paths.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-directories: func() -> list<tuple<descriptor, string>>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)- import wasi:clocks/[email protected];- @since(version = 0.3.0-rc-2026-01-06)- import wasi:clocks/[email protected];- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0-rc-2026-02-09)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import preopens;}diff --git a/crates/wasi/src/p3/wit/deps/random.wit b/crates/wasi/src/p3/wit/deps/random.witindex 8bb8731451..521df6e50f 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-01-06)+@since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface insecure {/// Return `len` insecure pseudo-random bytes.///@@ -41,14 +41,14 @@ interface insecure {/// There are no requirements on the values of the returned bytes, however/// implementations are encouraged to return evenly distributed values with/// a long period.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-insecure-random-bytes: func(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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-insecure-random-u64: func() -> u64;}@@ -56,7 +56,7 @@ interface insecure {////// It is intended to be portable at least between Unix-family platforms and/// Windows.-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface random {/// Return `len` cryptographically-secure random or pseudo-random bytes.///@@ -70,23 +70,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-random-bytes: func(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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-random-u64: func() -> u64;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import random;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import insecure;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import insecure-seed;}diff --git a/crates/wasi/src/p3/wit/deps/sockets.wit b/crates/wasi/src/p3/wit/deps/sockets.witindex d7ebe150b4..aa9d4d7f07 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-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface types {- @since(version = 0.3.0-rc-2026-01-06)- use wasi:clocks/[email protected].{duration};+ @since(version = 0.3.0-rc-2026-02-09)+ 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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum error-code {/// Unknown errorunknown,@@ -57,7 +57,7 @@ interface types {datagram-too-large,}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum ip-address-family {/// Similar to `AF_INET` in POSIX.ipv4,@@ -65,19 +65,19 @@ interface types {ipv6,}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)type ipv4-address = tuple<u8, u8, u8, u8>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)variant ip-address {ipv4(ipv4-address),ipv6(ipv6-address),}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)record ipv4-socket-address {/// sin_portport: u16,@@ -85,7 +85,7 @@ interface types {address: ipv4-address,}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)record ipv6-socket-address {/// sin6_portport: u16,@@ -97,7 +97,7 @@ interface types {scope-id: u32,}- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)variant ip-socket-address {ipv4(ipv4-socket-address),ipv6(ipv6-socket-address),@@ -122,7 +122,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resource tcp-socket {/// Create a new TCP socket.///@@ -138,7 +138,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)create: static func(address-family: ip-address-family) -> result<tcp-socket, error-code>;/// Bind the socket to the provided IP address and port.///@@ -171,7 +171,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)bind: func(local-address: ip-socket-address) -> result<_, error-code>;/// Connect to a remote endpoint.///@@ -202,7 +202,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)connect: async func(remote-address: ip-socket-address) -> result<_, error-code>;/// Start listening and return a stream of new inbound connections.///@@ -259,6 +259,12 @@ interface types {/// In either case, the stream returned by this `listen` method remains/// operational.///+ /// WASI requires `listen` to perform an implicit bind if the socket+ /// has not already been bound. Not all platforms (notably Windows)+ /// exhibit this behavior out of the box. On platforms that require it,+ /// the WASI implementation can emulate this behavior by performing+ /// the bind itself if the guest hasn't already done so.+ ////// # References/// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>/// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>@@ -268,7 +274,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)listen: func() -> result<stream<tcp-socket>, error-code>;/// Transmit data to peer.///@@ -290,8 +296,8 @@ 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-01-06)- send: async func(data: stream<u8>) -> result<_, error-code>;+ @since(version = 0.3.0-rc-2026-02-09)+ send: func(data: stream<u8>) -> future<result<_, error-code>>;/// Read data from peer.////// This function returns a `stream` which provides the data received from the@@ -323,7 +329,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)receive: func() -> tuple<stream<u8>, future<result<_, error-code>>>;/// Get the bound local address.///@@ -341,7 +347,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-local-address: func() -> result<ip-socket-address, error-code>;/// Get the remote address.///@@ -353,19 +359,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-is-listening: func() -> bool;/// Whether this is a IPv4 or IPv6 socket.////// This is the value passed to the constructor.////// Equivalent to the SO_DOMAIN socket option.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-address-family: func() -> ip-address-family;/// Hints the desired listen queue size. Implementations are free to ignore this.///@@ -376,7 +382,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-listen-backlog-size: func(value: u64) -> result<_, error-code>;/// Enables or disables keepalive.///@@ -387,9 +393,9 @@ interface types {/// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true.////// Equivalent to the SO_KEEPALIVE socket option.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-keep-alive-enabled: func() -> result<bool, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-keep-alive-enabled: func(value: bool) -> result<_, error-code>;/// Amount of time the connection has to be idle before TCP starts sending keepalive packets.///@@ -401,9 +407,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-keep-alive-idle-time: func() -> result<duration, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;/// The time between keepalive packets.///@@ -415,9 +421,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-keep-alive-interval: func() -> result<duration, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-keep-alive-interval: func(value: duration) -> result<_, error-code>;/// The maximum amount of keepalive packets TCP should send before aborting the connection.///@@ -429,9 +435,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-keep-alive-count: func() -> result<u32, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-keep-alive-count: func(value: u32) -> result<_, error-code>;/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.///@@ -439,9 +445,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The TTL value must be 1 or higher.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-hop-limit: func() -> result<u8, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-hop-limit: func(value: u8) -> result<_, error-code>;/// The kernel buffer space reserved for sends/receives on this socket.///@@ -453,18 +459,18 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-receive-buffer-size: func() -> result<u64, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-receive-buffer-size: func(value: u64) -> result<_, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-send-buffer-size: func() -> result<u64, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-send-buffer-size: func(value: u64) -> result<_, error-code>;}/// A UDP socket handle.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resource udp-socket {/// Create a new UDP socket.///@@ -480,7 +486,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)create: static func(address-family: ip-address-family) -> result<udp-socket, error-code>;/// Bind the socket to the provided IP address and port.///@@ -500,7 +506,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)bind: func(local-address: ip-socket-address) -> result<_, error-code>;/// Associate this socket with a specific peer address.///@@ -538,7 +544,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)connect: func(remote-address: ip-socket-address) -> result<_, error-code>;/// Dissociate this socket from its peer address.///@@ -555,7 +561,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)disconnect: func() -> result<_, error-code>;/// Send a message on the socket to a particular peer.///@@ -588,7 +594,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)send: async func(data: list<u8>, remote-address: option<ip-socket-address>) -> result<_, error-code>;/// Receive a message on the socket.///@@ -613,7 +619,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)receive: async func() -> result<tuple<list<u8>, ip-socket-address>, error-code>;/// Get the current bound address.///@@ -631,7 +637,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-local-address: func() -> result<ip-socket-address, error-code>;/// Get the address the socket is currently "connected" to.///@@ -643,14 +649,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-address-family: func() -> ip-address-family;/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.///@@ -658,9 +664,9 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The TTL value must be 1 or higher.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-unicast-hop-limit: func() -> result<u8, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-unicast-hop-limit: func(value: u8) -> result<_, error-code>;/// The kernel buffer space reserved for sends/receives on this socket.///@@ -672,24 +678,24 @@ interface types {////// # Typical errors/// - `invalid-argument`: (set) The provided value was 0.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-receive-buffer-size: func() -> result<u64, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-receive-buffer-size: func(value: u64) -> result<_, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)get-send-buffer-size: func() -> result<u64, error-code>;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)set-send-buffer-size: func(value: u64) -> result<_, error-code>;}}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)interface ip-name-lookup {- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)use types.{ip-address};/// Lookup error codes.- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)enum error-code {/// Unknown errorunknown,@@ -737,16 +743,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-01-06)+ @since(version = 0.3.0-rc-2026-02-09)resolve-addresses: async func(name: string) -> result<list<ip-address>, error-code>;}-@since(version = 0.3.0-rc-2026-01-06)+@since(version = 0.3.0-rc-2026-02-09)world imports {- @since(version = 0.3.0-rc-2026-01-06)- import wasi:clocks/[email protected];- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)+ import wasi:clocks/[email protected];+ @since(version = 0.3.0-rc-2026-02-09)import types;- @since(version = 0.3.0-rc-2026-01-06)+ @since(version = 0.3.0-rc-2026-02-09)import ip-name-lookup;}