Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

feat(p3-http): implement `consume-body` changes (#11653)

Roman Volosatovs530599953aaf
diff --git a/ci/vendor-wit.sh b/ci/vendor-wit.sh
index cd41fd2a64..d6d7e3ce04 100755
--- a/ci/vendor-wit.sh
+++ b/ci/vendor-wit.sh
@@ -70,20 +70,20 @@ make_vendor "wasi-config" "config@f4d699b"
make_vendor "wasi-keyvalue" "keyvalue@219ea36"
make_vendor "wasi/src/p3" "
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
"
make_vendor "wasi-http/src/p3" "
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
- [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
+ [email protected]@wit-0.3.0-draft
"
rm -rf $cache_dir
diff --git a/crates/test-programs/src/bin/cli_p3_hello_stdout.rs b/crates/test-programs/src/bin/cli_p3_hello_stdout.rs
index 9db7c7efbb..d8e79cfbc3 100644
--- a/crates/test-programs/src/bin/cli_p3_hello_stdout.rs
+++ b/crates/test-programs/src/bin/cli_p3_hello_stdout.rs
@@ -7,8 +7,15 @@ export!(Component);
impl exports::wasi::cli::run::Guest for Component {
async fn run() -> Result<(), ()> {
let (mut tx, rx) = wit_stream::new();
- wasi::cli::stdout::set_stdout(rx);
- tx.write(b"hello, world\n".to_vec()).await;
+ futures::join!(
+ async {
+ wasi::cli::stdout::write_via_stream(rx).await.unwrap();
+ },
+ async {
+ tx.write(b"hello, world\n".to_vec()).await;
+ drop(tx);
+ },
+ );
Ok(())
}
}
diff --git a/crates/test-programs/src/bin/cli_p3_much_stdout.rs b/crates/test-programs/src/bin/cli_p3_much_stdout.rs
index d13a98cf09..c490cc3afa 100644
--- a/crates/test-programs/src/bin/cli_p3_much_stdout.rs
+++ b/crates/test-programs/src/bin/cli_p3_much_stdout.rs
@@ -12,11 +12,16 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
let bytes = string_to_write.as_bytes();
let (mut tx, rx) = wit_stream::new();
- wasi::cli::stdout::set_stdout(rx);
- for _ in 0..times_to_write {
- let result = tx.write_all(bytes.to_vec()).await;
- assert!(result.is_empty());
- }
+ futures::join!(
+ async { wasi::cli::stdout::write_via_stream(rx).await.unwrap() },
+ async {
+ for _ in 0..times_to_write {
+ let result = tx.write_all(bytes.to_vec()).await;
+ assert!(result.is_empty());
+ }
+ drop(tx);
+ }
+ );
Ok(())
}
}
diff --git a/crates/test-programs/src/bin/p3_cli.rs b/crates/test-programs/src/bin/p3_cli.rs
index 2373d51218..276a7146ef 100644
--- a/crates/test-programs/src/bin/p3_cli.rs
+++ b/crates/test-programs/src/bin/p3_cli.rs
@@ -18,20 +18,37 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
assert!(terminal_stdout::get_terminal_stdout().is_none());
assert!(terminal_stderr::get_terminal_stderr().is_none());
- let mut stdin = stdin::get_stdin();
+ let (mut stdin, result) = stdin::read_via_stream();
assert!(stdin.next().await.is_none());
let (mut stdout_tx, stdout_rx) = wit_stream::new();
- stdout::set_stdout(stdout_rx);
- let (res, buf) = stdout_tx.write(b"hello stdout\n".into()).await;
- assert_eq!(res, StreamResult::Complete(13));
- assert_eq!(buf.into_vec(), []);
+ futures::join!(
+ async {
+ stdout::write_via_stream(stdout_rx).await.unwrap();
+ },
+ async {
+ let (res, buf) = stdout_tx.write(b"hello stdout\n".into()).await;
+ assert_eq!(res, StreamResult::Complete(13));
+ assert_eq!(buf.into_vec(), []);
+ drop(stdout_tx);
+ }
+ );
let (mut stderr_tx, stderr_rx) = wit_stream::new();
- stderr::set_stderr(stderr_rx);
- let (res, buf) = stderr_tx.write(b"hello stderr\n".into()).await;
- assert_eq!(res, StreamResult::Complete(13));
- assert_eq!(buf.into_vec(), []);
+ futures::join!(
+ async {
+ stderr::write_via_stream(stderr_rx).await.unwrap();
+ },
+ async {
+ let (res, buf) = stderr_tx.write(b"hello stderr\n".into()).await;
+ assert_eq!(res, StreamResult::Complete(13));
+ assert_eq!(buf.into_vec(), []);
+ drop(stderr_tx);
+ }
+ );
+
+ drop(stdin);
+ result.await.unwrap();
Ok(())
}
diff --git a/crates/test-programs/src/bin/p3_http_echo.rs b/crates/test-programs/src/bin/p3_http_echo.rs
index 77ec189f5d..a502d546fe 100644
--- a/crates/test-programs/src/bin/p3_http_echo.rs
+++ b/crates/test-programs/src/bin/p3_http_echo.rs
@@ -15,9 +15,8 @@ impl Handler for Component {
/// Return a response which echoes the request headers, body, and trailers.
async fn handle(request: Request) -> Result<Response, ErrorCode> {
let headers = request.get_headers();
- let (body, trailers) = request.consume_body().unwrap();
-
- // let (headers, body) = Request::into_parts(request);
+ let (_, result_rx) = wit_future::new(|| Ok(()));
+ let (body, trailers) = Request::consume_body(request, result_rx);
let (response, _result) = if false {
// This is the easy and efficient way to do it...
@@ -47,7 +46,6 @@ impl Handler for Component {
drop(pipe_tx);
trailers_tx.write(trailers.await).await.unwrap();
- drop(request);
});
Response::new(headers, Some(pipe_rx), trailers_rx)
diff --git a/crates/test-programs/src/bin/p3_http_middleware.rs b/crates/test-programs/src/bin/p3_http_middleware.rs
index 2384e05ef9..566b8bc4ba 100644
--- a/crates/test-programs/src/bin/p3_http_middleware.rs
+++ b/crates/test-programs/src/bin/p3_http_middleware.rs
@@ -48,7 +48,8 @@ impl Handler for Component {
}
_ => true,
});
- let (mut body, trailers) = request.consume_body().unwrap();
+ let (_, result_rx) = wit_future::new(|| Ok(()));
+ let (mut body, trailers) = Request::consume_body(request, result_rx);
let (body, trailers) = if content_deflated {
// Next, spawn a task to pipe and decode the original request body and trailers into a new request
@@ -77,8 +78,6 @@ impl Handler for Component {
}
trailers_tx.write(trailers.await).await.unwrap();
-
- drop(request);
});
(pipe_rx, trailers_rx)
@@ -110,7 +109,8 @@ impl Handler for Component {
headers.push(("content-encoding".into(), b"deflate".into()));
}
- let (mut body, trailers) = response.consume_body().unwrap();
+ let (_, result_rx) = wit_future::new(|| Ok(()));
+ let (mut body, trailers) = Response::consume_body(response, result_rx);
let (body, trailers) = if accept_deflated {
headers.retain(|(name, _value)| name != "content-length");
@@ -141,7 +141,6 @@ impl Handler for Component {
}
trailers_tx.write(trailers.await).await.unwrap();
- drop(response);
});
(pipe_rx, trailers_rx)
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.rs
index 7b4acf3b89..aed9f70b54 100644
--- a/crates/test-programs/src/bin/p3_http_middleware_with_chain.rs
+++ b/crates/test-programs/src/bin/p3_http_middleware_with_chain.rs
@@ -6,13 +6,13 @@ mod bindings {
package local:local;
world middleware-with-chain {
- include wasi:http/[email protected];
+ include wasi:http/[email protected];
import chain-http;
}
interface chain-http {
- use wasi:http/[email protected].{request, response, error-code};
+ use wasi:http/[email protected].{request, response, error-code};
handle: async func(request: request) -> result<response, error-code>;
}
diff --git a/crates/test-programs/src/p3/http.rs b/crates/test-programs/src/p3/http.rs
index c65fa9a998..c51f1221f2 100644
--- a/crates/test-programs/src/p3/http.rs
+++ b/crates/test-programs/src/p3/http.rs
@@ -94,9 +94,8 @@ pub async fn request(
let response = handler::handle(request).await?;
let status = response.get_status_code();
let headers = response.get_headers().copy_all();
- let (body_rx, trailers_rx) = response
- .consume_body()
- .expect("failed to get response body");
+ let (_, result_rx) = wit_future::new(|| Ok(()));
+ let (body_rx, trailers_rx) = types::Response::consume_body(response, result_rx);
let ((), rx) = join!(
async {
if let Some(buf) = body {
diff --git a/crates/test-programs/src/p3/mod.rs b/crates/test-programs/src/p3/mod.rs
index adeb45d220..87ddddb2d7 100644
--- a/crates/test-programs/src/p3/mod.rs
+++ b/crates/test-programs/src/p3/mod.rs
@@ -6,19 +6,16 @@ wit_bindgen::generate!({
package wasmtime:test;
world testp3 {
- include wasi:cli/[email protected];
- include wasi:http/[email protected];
+ include wasi:cli/[email protected];
+ include wasi:http/[email protected];
- export wasi:cli/[email protected];
+ export wasi:cli/[email protected];
}
",
path: "../wasi-http/src/p3/wit",
world: "wasmtime:test/testp3",
default_bindings_module: "test_programs::p3",
pub_export_macro: true,
- async: [
- "wasi:cli/[email protected]#run",
- ],
generate_all,
});
@@ -28,7 +25,7 @@ pub mod proxy {
package wasmtime:test;
world proxyp3 {
- include wasi:http/[email protected];
+ include wasi:http/[email protected];
}
",
path: "../wasi-http/src/p3/wit",
@@ -36,14 +33,16 @@ pub mod proxy {
default_bindings_module: "test_programs::p3::proxy",
pub_export_macro: true,
with: {
- "wasi:http/[email protected]": generate,
- "wasi:http/[email protected]": crate::p3::wasi::http::types,
- "wasi:random/[email protected]": crate::p3::wasi::random::random,
- "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:clocks/[email protected]": crate::p3::wasi::clocks::monotonic_clock,
- "wasi:clocks/[email protected]": crate::p3::wasi::clocks::wall_clock,
+ "wasi:http/[email protected]": generate,
+ "wasi:http/[email protected]": crate::p3::wasi::http::types,
+ "wasi:random/[email protected]": crate::p3::wasi::random::random,
+ "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::wall_clock,
+ "wasi:clocks/[email protected]": crate::p3::wasi::clocks::types,
},
});
}
diff --git a/crates/wasi-http/src/p3/bindings.rs b/crates/wasi-http/src/p3/bindings.rs
index f467df417b..ba9c497a8e 100644
--- a/crates/wasi-http/src/p3/bindings.rs
+++ b/crates/wasi-http/src/p3/bindings.rs
@@ -9,9 +9,9 @@ mod generated {
"wasi:http/handler/[async]handle": async | store | trappable | tracing,
"wasi:http/types/[drop]request": store | trappable | tracing,
"wasi:http/types/[drop]response": store | trappable | tracing,
- "wasi:http/types/[method]request.consume-body": async | store | trappable | tracing,
- "wasi:http/types/[method]response.consume-body": async | store | trappable | tracing,
+ "wasi:http/types/[static]request.consume-body": async | store | trappable | tracing,
"wasi:http/types/[static]request.new": async | store | trappable | tracing,
+ "wasi:http/types/[static]response.consume-body": async | store | trappable | tracing,
"wasi:http/types/[static]response.new": async | store | trappable | tracing,
default: trappable | tracing,
},
diff --git a/crates/wasi-http/src/p3/body.rs b/crates/wasi-http/src/p3/body.rs
index d9b40e4212..ff4e60b651 100644
--- a/crates/wasi-http/src/p3/body.rs
+++ b/crates/wasi-http/src/p3/body.rs
@@ -37,8 +37,33 @@ pub(crate) enum Body {
/// Channel, on which transmission result will be written
result_tx: oneshot::Sender<Box<dyn Future<Output = Result<(), ErrorCode>> + Send>>,
},
- /// Body is consumed.
- Consumed,
+}
+
+/// [FutureConsumer] implementation for future passed to `consume-body`.
+struct BodyResultConsumer(
+ Option<oneshot::Sender<Box<dyn Future<Output = Result<(), ErrorCode>> + Send>>>,
+);
+
+impl<D> FutureConsumer<D> for BodyResultConsumer
+where
+ D: 'static,
+{
+ type Item = Result<(), ErrorCode>;
+
+ fn poll_consume(
+ mut self: Pin<&mut Self>,
+ _: &mut Context<'_>,
+ store: StoreContextMut<D>,
+ mut src: Source<'_, Self::Item>,
+ _: bool,
+ ) -> Poll<wasmtime::Result<()>> {
+ let mut res = None;
+ src.read(store, &mut res).context("failed to read result")?;
+ let res = res.context("result value missing")?;
+ let tx = self.0.take().context("polled after returning `Ready`")?;
+ _ = tx.send(Box::new(async { res }));
+ Poll::Ready(Ok(()))
+ }
}
impl Body {
@@ -46,46 +71,38 @@ impl Body {
pub(crate) fn consume<T>(
self,
mut store: Access<'_, T, WasiHttp>,
+ fut: FutureReader<Result<(), ErrorCode>>,
getter: fn(&mut T) -> WasiHttpCtxView<'_>,
- ) -> Result<
- (
- StreamReader<u8>,
- FutureReader<Result<Option<Resource<Trailers>>, ErrorCode>>,
- ),
- (),
- > {
+ ) -> (
+ StreamReader<u8>,
+ FutureReader<Result<Option<Resource<Trailers>>, ErrorCode>>,
+ ) {
match self {
Body::Guest {
contents_rx: Some(contents_rx),
trailers_rx,
result_tx,
} => {
- // TODO: Use a result specified by the caller
- // https://github.com/WebAssembly/wasi-http/issues/176
- _ = result_tx.send(Box::new(async { Ok(()) }));
- Ok((contents_rx, trailers_rx))
+ fut.pipe(&mut store, BodyResultConsumer(Some(result_tx)));
+ (contents_rx, trailers_rx)
}
Body::Guest {
contents_rx: None,
trailers_rx,
result_tx,
} => {
+ fut.pipe(&mut store, BodyResultConsumer(Some(result_tx)));
let instance = store.instance();
- // TODO: Use a result specified by the caller
- // https://github.com/WebAssembly/wasi-http/issues/176
- _ = result_tx.send(Box::new(async { Ok(()) }));
- Ok((
+ (
StreamReader::new(instance, &mut store, iter::empty()),
trailers_rx,
- ))
+ )
}
Body::Host { body, result_tx } => {
+ fut.pipe(&mut store, BodyResultConsumer(Some(result_tx)));
let instance = store.instance();
- // TODO: Use a result specified by the caller
- // https://github.com/WebAssembly/wasi-http/issues/176
- _ = result_tx.send(Box::new(async { Ok(()) }));
let (trailers_tx, trailers_rx) = oneshot::channel();
- Ok((
+ (
StreamReader::new(
instance,
&mut store,
@@ -96,9 +113,8 @@ impl Body {
},
),
FutureReader::new(instance, &mut store, trailers_rx),
- ))
+ )
}
- Body::Consumed => Err(()),
}
}
@@ -390,31 +406,6 @@ impl http_body::Body for GuestBody {
}
}
-/// [http_body::Body] that has been consumed.
-pub(crate) struct ConsumedBody;
-
-impl http_body::Body for ConsumedBody {
- type Data = Bytes;
- type Error = ErrorCode;
-
- fn poll_frame(
- self: Pin<&mut Self>,
- _cx: &mut Context<'_>,
- ) -> Poll<Option<Result<http_body::Frame<Self::Data>, Self::Error>>> {
- Poll::Ready(Some(Err(ErrorCode::InternalError(Some(
- "body consumed".into(),
- )))))
- }
-
- fn is_end_stream(&self) -> bool {
- true
- }
-
- fn size_hint(&self) -> http_body::SizeHint {
- http_body::SizeHint::with_exact(0)
- }
-}
-
/// [FutureConsumer] implementation for trailers originating in the guest.
struct GuestTrailerConsumer<T> {
tx: Option<oneshot::Sender<Result<Option<Arc<HeaderMap>>, ErrorCode>>>,
@@ -434,10 +425,10 @@ where
mut src: Source<'_, Self::Item>,
_: bool,
) -> Poll<wasmtime::Result<()>> {
- let mut result = None;
- src.read(store.as_context_mut(), &mut result)
+ let mut res = None;
+ src.read(&mut store, &mut res)
.context("failed to read result")?;
- let res = match result.context("result value missing")? {
+ let res = match res.context("result value missing")? {
Ok(Some(trailers)) => {
let WasiHttpCtxView { table, .. } = (self.getter)(store.data_mut());
let trailers = table
diff --git a/crates/wasi-http/src/p3/host/handler.rs b/crates/wasi-http/src/p3/host/handler.rs
index 60affada21..4f3da56deb 100644
--- a/crates/wasi-http/src/p3/host/handler.rs
+++ b/crates/wasi-http/src/p3/host/handler.rs
@@ -1,7 +1,7 @@
use crate::get_content_length;
use crate::p3::bindings::http::handler::{Host, HostWithStore};
use crate::p3::bindings::http::types::{ErrorCode, Request, Response};
-use crate::p3::body::{Body, ConsumedBody, GuestBody};
+use crate::p3::body::{Body, GuestBody};
use crate::p3::{HttpError, HttpResult, WasiHttp, WasiHttpCtxView};
use anyhow::Context as _;
use bytes::Bytes;
@@ -275,7 +275,6 @@ impl HostWithStore for WasiHttp {
body.with_state(io_task_rx).boxed()
}
}
- Body::Consumed => ConsumedBody.boxed(),
};
let WasiHttpCtxView { ctx, .. } = store.get();
diff --git a/crates/wasi-http/src/p3/host/types.rs b/crates/wasi-http/src/p3/host/types.rs
index 840702546b..8f78117dcb 100644
--- a/crates/wasi-http/src/p3/host/types.rs
+++ b/crates/wasi-http/src/p3/host/types.rs
@@ -7,7 +7,6 @@ use crate::p3::bindings::http::types::{
use crate::p3::body::Body;
use crate::p3::{HeaderResult, HttpError, RequestOptionsResult, WasiHttp, WasiHttpCtxView};
use anyhow::Context as _;
-use core::mem;
use core::pin::Pin;
use core::task::{Context, Poll, ready};
use http::header::CONTENT_LENGTH;
@@ -356,20 +355,19 @@ impl HostRequestWithStore for WasiHttp {
async fn consume_body<T>(
store: &Accessor<T, Self>,
req: Resource<Request>,
- ) -> wasmtime::Result<
- Result<
- (
- StreamReader<u8>,
- FutureReader<Result<Option<Resource<Trailers>>, ErrorCode>>,
- ),
- (),
- >,
- > {
+ fut: FutureReader<Result<(), ErrorCode>>,
+ ) -> wasmtime::Result<(
+ StreamReader<u8>,
+ FutureReader<Result<Option<Resource<Trailers>>, ErrorCode>>,
+ )> {
let getter = store.getter();
store.with(|mut store| {
- let Request { body, .. } = get_request_mut(store.get().table, &req)?;
- let body = mem::replace(body, Body::Consumed);
- Ok(body.consume(store, getter))
+ let Request { body, .. } = store
+ .get()
+ .table
+ .delete(req)
+ .context("failed to delete request from table")?;
+ Ok(body.consume(store, fut, getter))
})
}
@@ -633,20 +631,19 @@ impl HostResponseWithStore for WasiHttp {
async fn consume_body<T>(
store: &Accessor<T, Self>,
res: Resource<Response>,
- ) -> wasmtime::Result<
- Result<
- (
- StreamReader<u8>,
- FutureReader<Result<Option<Resource<Trailers>>, ErrorCode>>,
- ),
- (),
- >,
- > {
+ fut: FutureReader<Result<(), ErrorCode>>,
+ ) -> wasmtime::Result<(
+ StreamReader<u8>,
+ FutureReader<Result<Option<Resource<Trailers>>, ErrorCode>>,
+ )> {
let getter = store.getter();
store.with(|mut store| {
- let Response { body, .. } = get_response_mut(store.get().table, &res)?;
- let body = mem::replace(body, Body::Consumed);
- Ok(body.consume(store, getter))
+ let Response { body, .. } = store
+ .get()
+ .table
+ .delete(res)
+ .context("failed to delete response from table")?;
+ Ok(body.consume(store, fut, getter))
})
}
diff --git a/crates/wasi-http/src/p3/response.rs b/crates/wasi-http/src/p3/response.rs
index c7248c984e..4f3ec7953d 100644
--- a/crates/wasi-http/src/p3/response.rs
+++ b/crates/wasi-http/src/p3/response.rs
@@ -1,6 +1,6 @@
use crate::get_content_length;
use crate::p3::bindings::http::types::ErrorCode;
-use crate::p3::body::{Body, ConsumedBody, GuestBody};
+use crate::p3::body::{Body, GuestBody};
use crate::p3::{WasiHttpCtxView, WasiHttpView};
use anyhow::Context as _;
use bytes::Bytes;
@@ -86,7 +86,6 @@ impl Response {
_ = result_tx.send(Box::new(fut));
body
}
- Body::Consumed => ConsumedBody.boxed(),
};
Ok(http::Response::from_parts(res, body))
}
diff --git a/crates/wasi-http/src/p3/wit/deps/cli/command.wit b/crates/wasi-http/src/p3/wit/deps/cli/command.wit
index 13e92bdec2..f2f613e552 100644
--- a/crates/wasi-http/src/p3/wit/deps/cli/command.wit
+++ b/crates/wasi-http/src/p3/wit/deps/cli/command.wit
@@ -1,10 +1,10 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world command {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
include imports;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
export run;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/cli/environment.wit b/crates/wasi-http/src/p3/wit/deps/cli/environment.wit
index 769858af1a..3763f2f6ce 100644
--- a/crates/wasi-http/src/p3/wit/deps/cli/environment.wit
+++ b/crates/wasi-http/src/p3/wit/deps/cli/environment.wit
@@ -1,4 +1,4 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface environment {
/// Get the POSIX-style environment variables.
///
@@ -8,15 +8,15 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-environment: func() -> list<tuple<string, string>>;
/// Get the POSIX-style arguments to the program.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-initial-cwd: func() -> option<string>;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/cli/exit.wit b/crates/wasi-http/src/p3/wit/deps/cli/exit.wit
index dcf791a201..1efba7d683 100644
--- a/crates/wasi-http/src/p3/wit/deps/cli/exit.wit
+++ b/crates/wasi-http/src/p3/wit/deps/cli/exit.wit
@@ -1,7 +1,7 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface exit {
/// Exit the current instance and any linked instances.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
exit: func(status: result);
/// Exit the current instance and any linked instances, reporting the
diff --git a/crates/wasi-http/src/p3/wit/deps/cli/imports.wit b/crates/wasi-http/src/p3/wit/deps/cli/imports.wit
index 2d513ead9e..660a2dd95a 100644
--- a/crates/wasi-http/src/p3/wit/deps/cli/imports.wit
+++ b/crates/wasi-http/src/p3/wit/deps/cli/imports.wit
@@ -1,34 +1,34 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
- include wasi:clocks/[email protected];
- @since(version = 0.3.0-rc-2025-08-15)
- include wasi:filesystem/[email protected];
- @since(version = 0.3.0-rc-2025-08-15)
- include wasi:sockets/[email protected];
- @since(version = 0.3.0-rc-2025-08-15)
- include wasi:random/[email protected];
+ @since(version = 0.3.0-rc-2025-09-16)
+ include wasi:clocks/[email protected];
+ @since(version = 0.3.0-rc-2025-09-16)
+ include wasi:filesystem/[email protected];
+ @since(version = 0.3.0-rc-2025-09-16)
+ include wasi:sockets/[email protected];
+ @since(version = 0.3.0-rc-2025-09-16)
+ include wasi:random/[email protected];
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import environment;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import exit;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import stdin;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import stdout;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import stderr;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-input;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-output;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-stdin;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-stdout;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-stderr;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/cli/run.wit b/crates/wasi-http/src/p3/wit/deps/cli/run.wit
index 6149db760e..631441a3f2 100644
--- a/crates/wasi-http/src/p3/wit/deps/cli/run.wit
+++ b/crates/wasi-http/src/p3/wit/deps/cli/run.wit
@@ -1,6 +1,6 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface run {
/// Run the program.
- @since(version = 0.3.0-rc-2025-08-15)
- run: func() -> result;
+ @since(version = 0.3.0-rc-2025-09-16)
+ run: async func() -> result;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/cli/stdio.wit b/crates/wasi-http/src/p3/wit/deps/cli/stdio.wit
index 6c99a56f16..51e5ae4b40 100644
--- a/crates/wasi-http/src/p3/wit/deps/cli/stdio.wit
+++ b/crates/wasi-http/src/p3/wit/deps/cli/stdio.wit
@@ -1,17 +1,65 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
+interface types {
+ @since(version = 0.3.0-rc-2025-09-16)
+ enum error-code {
+ /// Input/output error
+ io,
+ /// Invalid or incomplete multibyte or wide character
+ illegal-byte-sequence,
+ /// Broken pipe
+ pipe,
+ }
+}
+
+@since(version = 0.3.0-rc-2025-09-16)
interface stdin {
- @since(version = 0.3.0-rc-2025-08-15)
- get-stdin: func() -> stream<u8>;
+ use types.{error-code};
+
+ /// Return a stream for reading from stdin.
+ ///
+ /// This function returns a stream which provides data read from stdin,
+ /// and a future to signal read results.
+ ///
+ /// If the stream's readable end is dropped the future will resolve to success.
+ ///
+ /// If the stream's writable end is dropped the future will either resolve to
+ /// success if stdin was closed by the writer or to an error-code if reading
+ /// failed for some other reason.
+ ///
+ /// Multiple streams may be active at the same time. The behavior of concurrent
+ /// reads is implementation-specific.
+ @since(version = 0.3.0-rc-2025-09-16)
+ read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
}
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface stdout {
- @since(version = 0.3.0-rc-2025-08-15)
- set-stdout: func(data: stream<u8>);
+ use types.{error-code};
+
+ /// Write the given stream to stdout.
+ ///
+ /// If the stream's writable end is dropped this function will either return
+ /// success once the entire contents of the stream have been written or an
+ /// error-code representing a failure.
+ ///
+ /// Otherwise if there is an error the readable end of the stream will be
+ /// dropped and this function will return an error-code.
+ @since(version = 0.3.0-rc-2025-09-16)
+ write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
}
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface stderr {
- @since(version = 0.3.0-rc-2025-08-15)
- set-stderr: func(data: stream<u8>);
+ use types.{error-code};
+
+ /// Write the given stream to stderr.
+ ///
+ /// If the stream's writable end is dropped this function will either return
+ /// success once the entire contents of the stream have been written or an
+ /// error-code representing a failure.
+ ///
+ /// Otherwise if there is an error the readable end of the stream will be
+ /// dropped and this function will return an error-code.
+ @since(version = 0.3.0-rc-2025-09-16)
+ write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/cli/terminal.wit b/crates/wasi-http/src/p3/wit/deps/cli/terminal.wit
index 3b2b72bbaa..74c17694a4 100644
--- a/crates/wasi-http/src/p3/wit/deps/cli/terminal.wit
+++ b/crates/wasi-http/src/p3/wit/deps/cli/terminal.wit
@@ -3,10 +3,10 @@
/// 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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-input {
/// The input side of a terminal.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource terminal-input;
}
@@ -15,48 +15,48 @@ 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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-output {
/// The output side of a terminal.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource terminal-output;
}
/// An interface providing an optional `terminal-input` for stdin as a
/// link-time authority.
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-stdin {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-stdout {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-stderr {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-terminal-stderr: func() -> option<terminal-output>;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/clocks/monotonic-clock.wit b/crates/wasi-http/src/p3/wit/deps/clocks/monotonic-clock.wit
index 0c58241fff..a91d495c6c 100644
--- a/crates/wasi-http/src/p3/wit/deps/clocks/monotonic-clock.wit
+++ b/crates/wasi-http/src/p3/wit/deps/clocks/monotonic-clock.wit
@@ -1,4 +1,4 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
/// time.
///
@@ -7,38 +7,41 @@ package wasi:[email protected];
///
/// 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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface monotonic-clock {
+ use types.{duration};
+
/// An instant in time, in nanoseconds. An instant is relative to an
/// unspecified initial value, and can only be compared to instances from
/// the same monotonic-clock.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
type instant = u64;
- /// A duration of time, in nanoseconds.
- @since(version = 0.3.0-rc-2025-08-15)
- type duration = u64;
-
/// Read the current value of the clock.
///
/// The clock is monotonic, therefore calling this function repeatedly will
/// produce a sequence of non-decreasing values.
- @since(version = 0.3.0-rc-2025-08-15)
+ ///
+ /// For completeness, this function traps if it's not possible to represent
+ /// the value of the clock in an `instant`. 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-2025-09-16)
now: func() -> instant;
/// Query the resolution of the clock. Returns the duration of time
/// corresponding to a clock tick.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-resolution: func() -> duration;
/// Wait until the specified instant has occurred.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
wait-until: async func(
when: instant,
);
- /// Wait for the specified duration has elapsed.
- @since(version = 0.3.0-rc-2025-08-15)
+ /// Wait for the specified duration to elapse.
+ @since(version = 0.3.0-rc-2025-09-16)
wait-for: async func(
how-long: duration,
);
diff --git a/crates/wasi-http/src/p3/wit/deps/clocks/timezone.wit b/crates/wasi-http/src/p3/wit/deps/clocks/timezone.wit
index 2ee16ab200..ab8f5c0801 100644
--- a/crates/wasi-http/src/p3/wit/deps/clocks/timezone.wit
+++ b/crates/wasi-http/src/p3/wit/deps/clocks/timezone.wit
@@ -1,4 +1,4 @@
-package wasi:[email protected];
+package wasi:[email protected];
@unstable(feature = clocks-timezone)
interface timezone {
diff --git a/crates/wasi-http/src/p3/wit/deps/clocks/types.wit b/crates/wasi-http/src/p3/wit/deps/clocks/types.wit
new file mode 100644
index 0000000000..aff7c2a22a
--- /dev/null
+++ b/crates/wasi-http/src/p3/wit/deps/clocks/types.wit
@@ -0,0 +1,8 @@
+package wasi:[email protected];
+/// This interface common types used throughout wasi:clocks.
+@since(version = 0.3.0-rc-2025-09-16)
+interface types {
+ /// A duration of time, in nanoseconds.
+ @since(version = 0.3.0-rc-2025-09-16)
+ type duration = u64;
+}
diff --git a/crates/wasi-http/src/p3/wit/deps/clocks/wall-clock.wit b/crates/wasi-http/src/p3/wit/deps/clocks/wall-clock.wit
index 2e3b2d441a..ea940500fa 100644
--- a/crates/wasi-http/src/p3/wit/deps/clocks/wall-clock.wit
+++ b/crates/wasi-http/src/p3/wit/deps/clocks/wall-clock.wit
@@ -1,4 +1,4 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// WASI Wall Clock is a clock API intended to let users query the current
/// time. The name "wall" makes an analogy to a "clock on the wall", which
/// is not necessarily monotonic as it may be reset.
@@ -13,10 +13,10 @@ package wasi:[email protected];
/// 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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface wall-clock {
/// A time and date in seconds plus nanoseconds.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record datetime {
seconds: u64,
nanoseconds: u32,
@@ -35,12 +35,12 @@ interface wall-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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
now: func() -> datetime;
/// Query the resolution of the clock.
///
/// The nanoseconds field of the output is always less than 1000000000.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-resolution: func() -> datetime;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/clocks/world.wit b/crates/wasi-http/src/p3/wit/deps/clocks/world.wit
index 94068c75ce..a6b885f070 100644
--- a/crates/wasi-http/src/p3/wit/deps/clocks/world.wit
+++ b/crates/wasi-http/src/p3/wit/deps/clocks/world.wit
@@ -1,10 +1,10 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import monotonic-clock;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import wall-clock;
@unstable(feature = clocks-timezone)
import timezone;
diff --git a/crates/wasi-http/src/p3/wit/deps/filesystem/preopens.wit b/crates/wasi-http/src/p3/wit/deps/filesystem/preopens.wit
index b0f609aa98..9036e90e88 100644
--- a/crates/wasi-http/src/p3/wit/deps/filesystem/preopens.wit
+++ b/crates/wasi-http/src/p3/wit/deps/filesystem/preopens.wit
@@ -1,11 +1,11 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface preopens {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
use types.{descriptor};
/// Return the set of preopened directories, and their paths.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-directories: func() -> list<tuple<descriptor, string>>;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/filesystem/types.wit b/crates/wasi-http/src/p3/wit/deps/filesystem/types.wit
index 07d770a83b..41d91beee5 100644
--- a/crates/wasi-http/src/p3/wit/deps/filesystem/types.wit
+++ b/crates/wasi-http/src/p3/wit/deps/filesystem/types.wit
@@ -1,4 +1,4 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// WASI filesystem is a filesystem API primarily intended to let users run WASI
/// programs that access their files on their existing filesystems, without
/// significant overhead.
@@ -23,19 +23,19 @@ package wasi:[email protected];
/// [WASI filesystem path resolution].
///
/// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface types {
- @since(version = 0.3.0-rc-2025-08-15)
- use wasi:clocks/[email protected].{datetime};
+ @since(version = 0.3.0-rc-2025-09-16)
+ use wasi:clocks/[email protected].{datetime};
/// File size or length of a region within a file.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum descriptor-type {
/// The type of the descriptor or file is unknown or is different from
/// any of the other types specified.
@@ -59,7 +59,7 @@ interface types {
/// Descriptor flags.
///
/// Note: This was called `fdflags` in earlier versions of WASI.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
flags descriptor-flags {
/// Read mode: Data can be read.
read,
@@ -103,7 +103,7 @@ interface types {
/// File attributes.
///
/// Note: This was called `filestat` in earlier versions of WASI.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record descriptor-stat {
/// File type.
%type: descriptor-type,
@@ -130,7 +130,7 @@ interface types {
}
/// Flags determining the method of how paths are resolved.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
flags path-flags {
/// As long as the resolved path corresponds to a symbolic link, it is
/// expanded.
@@ -138,7 +138,7 @@ interface types {
}
/// Open flags used by `open-at`.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
flags open-flags {
/// Create file if it does not exist, similar to `O_CREAT` in POSIX.
create,
@@ -151,11 +151,11 @@ interface types {
}
/// Number of hard links to an inode.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
type link-count = u64;
/// When setting a timestamp, this gives the value to set it to.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
variant new-timestamp {
/// Leave the timestamp set to its previous value.
no-change,
@@ -255,7 +255,7 @@ interface types {
}
/// File or memory access pattern advisory information.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum advice {
/// The application has no advice to give on its behavior with respect
/// to the specified data.
@@ -279,7 +279,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record metadata-hash-value {
/// 64 bits of a 128-bit hash value.
lower: u64,
@@ -290,7 +290,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource descriptor {
/// Return a stream for reading from a file.
///
@@ -308,7 +308,7 @@ interface types {
/// resolves to `err` with an `error-code`.
///
/// Note: This is similar to `pread` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
read-via-stream: func(
/// The offset within the file at which to start reading.
offset: filesize,
@@ -326,7 +326,7 @@ interface types {
/// written or an error is encountered.
///
/// Note: This is similar to `pwrite` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
write-via-stream: async func(
/// Data to write
data: stream<u8>,
@@ -342,13 +342,13 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
append-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
/// Provide file advisory information on a descriptor.
///
/// This is similar to `posix_fadvise` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
advise: async func(
/// The offset within the file to which the advisory applies.
offset: filesize,
@@ -364,7 +364,7 @@ interface types {
/// opened for writing.
///
/// Note: This is similar to `fdatasync` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
sync-data: async func() -> result<_, error-code>;
/// Get flags associated with a descriptor.
@@ -373,7 +373,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-flags: async func() -> result<descriptor-flags, error-code>;
/// Get the dynamic type of a descriptor.
@@ -386,14 +386,14 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-size: async func(size: filesize) -> result<_, error-code>;
/// Adjust the timestamps of an open file or directory.
@@ -401,7 +401,7 @@ interface types {
/// 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-times: async func(
/// The desired values of the data access timestamp.
data-access-timestamp: new-timestamp,
@@ -421,7 +421,7 @@ interface types {
///
/// This function returns a future, which will resolve to an error code if
/// reading full contents of the directory fails.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
read-directory: async func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;
/// Synchronize the data and metadata of a file to disk.
@@ -430,13 +430,13 @@ interface types {
/// opened for writing.
///
/// Note: This is similar to `fsync` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
sync: async func() -> result<_, error-code>;
/// Create a directory.
///
/// Note: This is similar to `mkdirat` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
create-directory-at: async func(
/// The relative path at which to create the directory.
path: string,
@@ -451,7 +451,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
stat: async func() -> result<descriptor-stat, error-code>;
/// Return the attributes of a file or directory.
@@ -461,7 +461,7 @@ interface types {
/// discussion of alternatives.
///
/// Note: This was called `path_filestat_get` in earlier versions of WASI.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
stat-at: async func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -475,7 +475,7 @@ interface types {
///
/// Note: This was called `path_filestat_set_times` in earlier versions of
/// WASI.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-times-at: async func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -494,7 +494,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
link-at: async func(
/// Flags determining the method of how the path is resolved.
old-path-flags: path-flags,
@@ -518,7 +518,7 @@ interface types {
/// `error-code::read-only`.
///
/// Note: This is similar to `openat` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
open-at: async func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -536,7 +536,7 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
readlink-at: async func(
/// The relative path of the symbolic link from which to read.
path: string,
@@ -547,7 +547,7 @@ interface types {
/// 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
remove-directory-at: async func(
/// The relative path to a directory to remove.
path: string,
@@ -556,7 +556,7 @@ interface types {
/// Rename a filesystem object.
///
/// Note: This is similar to `renameat` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
rename-at: async func(
/// The relative source path of the file or directory to rename.
old-path: string,
@@ -572,7 +572,7 @@ interface types {
/// `error-code::not-permitted`.
///
/// Note: This is similar to `symlinkat` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
symlink-at: async func(
/// The contents of the symbolic link.
old-path: string,
@@ -584,7 +584,7 @@ interface types {
///
/// 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
unlink-file-at: async func(
/// The relative path to a file to unlink.
path: string,
@@ -596,7 +596,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
is-same-object: async func(other: borrow<descriptor>) -> bool;
/// Return a hash of the metadata associated with a filesystem object referred
@@ -618,14 +618,14 @@ interface types {
/// computed hash.
///
/// However, none of these is required.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
metadata-hash-at: async func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
diff --git a/crates/wasi-http/src/p3/wit/deps/filesystem/world.wit b/crates/wasi-http/src/p3/wit/deps/filesystem/world.wit
index b9dcfd562a..87fc727165 100644
--- a/crates/wasi-http/src/p3/wit/deps/filesystem/world.wit
+++ b/crates/wasi-http/src/p3/wit/deps/filesystem/world.wit
@@ -1,9 +1,9 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import types;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import preopens;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/http/proxy.wit b/crates/wasi-http/src/p3/wit/deps/http/proxy.wit
index 31e5facd03..223083ea28 100644
--- a/crates/wasi-http/src/p3/wit/deps/http/proxy.wit
+++ b/crates/wasi-http/src/p3/wit/deps/http/proxy.wit
@@ -1,22 +1,22 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// The `wasi:http/imports` world imports all the APIs for HTTP proxies.
/// It is intended to be `include`d in other worlds.
world imports {
/// HTTP proxies have access to time and randomness.
- include wasi:clocks/[email protected];
- import wasi:random/[email protected];
+ include wasi:clocks/[email protected];
+ import wasi:random/[email protected];
/// Proxies have standard output and error streams which are expected to
/// terminate in a developer-facing console provided by the host.
- import wasi:cli/[email protected];
- import wasi:cli/[email protected];
+ import wasi:cli/[email protected];
+ import wasi:cli/[email protected];
/// TODO: this is a temporary workaround until component tooling is able to
/// gracefully handle the absence of stdin. Hosts must return an eof stream
/// for this import, which is what wasi-libc + tooling will do automatically
/// when this import is properly removed.
- import wasi:cli/[email protected];
+ import wasi:cli/[email protected];
/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
diff --git a/crates/wasi-http/src/p3/wit/deps/http/types.wit b/crates/wasi-http/src/p3/wit/deps/http/types.wit
index 3d1d0ac788..8269eea202 100644
--- a/crates/wasi-http/src/p3/wit/deps/http/types.wit
+++ b/crates/wasi-http/src/p3/wit/deps/http/types.wit
@@ -1,7 +1,7 @@
/// This interface defines all of the types and methods for implementing HTTP
/// Requests and Responses, as well as their headers, trailers, and bodies.
interface types {
- use wasi:clocks/[email protected].{duration};
+ use wasi:clocks/[email protected].{duration};
/// This type corresponds to HTTP standard Methods.
variant method {
@@ -316,20 +316,12 @@ interface types {
/// future to determine whether the body was received successfully.
/// The future will only resolve after the stream is reported as closed.
///
- /// The stream and future returned by this method are children:
- /// they should be closed or consumed before the parent `response`
- /// is dropped, or its ownership is transferred to another component
- /// by e.g. `handler.handle`.
+ /// This function takes a `res` future as a parameter, which can be used to
+ /// communicate an error in handling of the request.
///
- /// This method may be called multiple times.
- ///
- /// This method will return an error if it is called while either:
- /// - a stream or future returned by a previous call to this method is still open
- /// - a stream returned by a previous call to this method has reported itself as closed
- /// Thus there will always be at most one readable stream open for a given body.
- /// Each subsequent stream picks up where the previous one left off,
- /// continuing until the entire body has been consumed.
- consume-body: func() -> result<tuple<stream<u8>, future<result<option<trailers>, error-code>>>>;
+ /// Note that function will move the `request`, but references to headers or
+ /// request options acquired from it previously will remain valid.
+ consume-body: static func(this: request, res: future<result<_, error-code>>) -> tuple<stream<u8>, future<result<option<trailers>, error-code>>>;
}
/// Parameters for making an HTTP Request. Each of these parameters is
@@ -417,19 +409,11 @@ interface types {
/// future to determine whether the body was received successfully.
/// The future will only resolve after the stream is reported as closed.
///
- /// The stream and future returned by this method are children:
- /// they should be closed or consumed before the parent `response`
- /// is dropped, or its ownership is transferred to another component
- /// by e.g. `handler.handle`.
- ///
- /// This method may be called multiple times.
+ /// This function takes a `res` future as a parameter, which can be used to
+ /// communicate an error in handling of the response.
///
- /// This method will return an error if it is called while either:
- /// - a stream or future returned by a previous call to this method is still open
- /// - a stream returned by a previous call to this method has reported itself as closed
- /// Thus there will always be at most one readable stream open for a given body.
- /// Each subsequent stream picks up where the previous one left off,
- /// continuing until the entire body has been consumed.
- consume-body: func() -> result<tuple<stream<u8>, future<result<option<trailers>, error-code>>>>;
+ /// Note that function will move the `response`, but references to headers
+ /// acquired from it previously will remain valid.
+ consume-body: static func(this: response, res: future<result<_, error-code>>) -> tuple<stream<u8>, future<result<option<trailers>, error-code>>>;
}
}
diff --git a/crates/wasi-http/src/p3/wit/deps/random/insecure-seed.wit b/crates/wasi-http/src/p3/wit/deps/random/insecure-seed.wit
index ecd5043182..302151ba65 100644
--- a/crates/wasi-http/src/p3/wit/deps/random/insecure-seed.wit
+++ b/crates/wasi-http/src/p3/wit/deps/random/insecure-seed.wit
@@ -1,9 +1,9 @@
-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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface insecure-seed {
/// Return a 128-bit value that may contain a pseudo-random value.
///
@@ -22,6 +22,6 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-insecure-seed: func() -> tuple<u64, u64>;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/random/insecure.wit b/crates/wasi-http/src/p3/wit/deps/random/insecure.wit
index d08d85e0b1..39146e3910 100644
--- a/crates/wasi-http/src/p3/wit/deps/random/insecure.wit
+++ b/crates/wasi-http/src/p3/wit/deps/random/insecure.wit
@@ -1,9 +1,9 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// The insecure interface for insecure pseudo-random numbers.
///
/// It is intended to be portable at least between Unix-family platforms and
/// Windows.
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface insecure {
/// Return `len` insecure pseudo-random bytes.
///
@@ -13,13 +13,13 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-insecure-random-u64: func() -> u64;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/random/random.wit b/crates/wasi-http/src/p3/wit/deps/random/random.wit
index 3808c3095b..fa1f111dc7 100644
--- a/crates/wasi-http/src/p3/wit/deps/random/random.wit
+++ b/crates/wasi-http/src/p3/wit/deps/random/random.wit
@@ -1,9 +1,9 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// WASI Random is a random data API.
///
/// It is intended to be portable at least between Unix-family platforms and
/// Windows.
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface random {
/// Return `len` cryptographically-secure random or pseudo-random bytes.
///
@@ -17,13 +17,13 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-random-u64: func() -> u64;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/random/world.wit b/crates/wasi-http/src/p3/wit/deps/random/world.wit
index e8f05cc438..08c5ed88b7 100644
--- a/crates/wasi-http/src/p3/wit/deps/random/world.wit
+++ b/crates/wasi-http/src/p3/wit/deps/random/world.wit
@@ -1,13 +1,13 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import random;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import insecure;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import insecure-seed;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/sockets/ip-name-lookup.wit b/crates/wasi-http/src/p3/wit/deps/sockets/ip-name-lookup.wit
index ab4156e25d..6a652ff232 100644
--- a/crates/wasi-http/src/p3/wit/deps/sockets/ip-name-lookup.wit
+++ b/crates/wasi-http/src/p3/wit/deps/sockets/ip-name-lookup.wit
@@ -1,10 +1,10 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface ip-name-lookup {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
use types.{ip-address};
/// Lookup error codes.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum error-code {
/// Unknown error
unknown,
@@ -57,6 +57,6 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resolve-addresses: async func(name: string) -> result<list<ip-address>, error-code>;
}
diff --git a/crates/wasi-http/src/p3/wit/deps/sockets/types.wit b/crates/wasi-http/src/p3/wit/deps/sockets/types.wit
index 3a7915ce98..2ed1912e48 100644
--- a/crates/wasi-http/src/p3/wit/deps/sockets/types.wit
+++ b/crates/wasi-http/src/p3/wit/deps/sockets/types.wit
@@ -1,7 +1,7 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface types {
- @since(version = 0.3.0-rc-2025-08-15)
- use wasi:clocks/[email protected].{duration};
+ @since(version = 0.3.0-rc-2025-09-16)
+ use wasi:clocks/[email protected].{duration};
/// Error codes.
///
@@ -14,7 +14,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum error-code {
/// Unknown error
unknown,
@@ -70,7 +70,7 @@ interface types {
datagram-too-large,
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum ip-address-family {
/// Similar to `AF_INET` in POSIX.
ipv4,
@@ -79,18 +79,18 @@ interface types {
ipv6,
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
type ipv4-address = tuple<u8, u8, u8, u8>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
variant ip-address {
ipv4(ipv4-address),
ipv6(ipv6-address),
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record ipv4-socket-address {
/// sin_port
port: u16,
@@ -98,7 +98,7 @@ interface types {
address: ipv4-address,
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record ipv6-socket-address {
/// sin6_port
port: u16,
@@ -110,7 +110,7 @@ interface types {
scope-id: u32,
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
variant ip-socket-address {
ipv4(ipv4-socket-address),
ipv6(ipv6-socket-address),
@@ -135,7 +135,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource tcp-socket {
/// Create a new TCP socket.
@@ -152,7 +152,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
create: static func(address-family: ip-address-family) -> result<tcp-socket, error-code>;
/// Bind the socket to the provided IP address and port.
@@ -186,7 +186,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
bind: func(local-address: ip-socket-address) -> result<_, error-code>;
/// Connect to a remote endpoint.
@@ -218,7 +218,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
connect: async func(remote-address: ip-socket-address) -> result<_, error-code>;
/// Start listening and return a stream of new inbound connections.
@@ -285,7 +285,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
listen: func() -> result<stream<tcp-socket>, error-code>;
/// Transmit data to peer.
@@ -308,7 +308,7 @@ interface types {
/// - <https://man7.org/linux/man-pages/man2/send.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
/// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
send: async func(data: stream<u8>) -> result<_, error-code>;
/// Read data from peer.
@@ -342,7 +342,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
receive: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
/// Get the bound local address.
@@ -361,7 +361,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-local-address: func() -> result<ip-socket-address, error-code>;
/// Get the remote address.
@@ -374,13 +374,13 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-is-listening: func() -> bool;
/// Whether this is a IPv4 or IPv6 socket.
@@ -388,7 +388,7 @@ interface types {
/// This is the value passed to the constructor.
///
/// Equivalent to the SO_DOMAIN socket option.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-address-family: func() -> ip-address-family;
/// Hints the desired listen queue size. Implementations are free to ignore this.
@@ -400,7 +400,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-listen-backlog-size: func(value: u64) -> result<_, error-code>;
/// Enables or disables keepalive.
@@ -412,9 +412,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-keep-alive-enabled: func() -> result<bool, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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.
@@ -427,9 +427,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-keep-alive-idle-time: func() -> result<duration, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;
/// The time between keepalive packets.
@@ -442,9 +442,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-keep-alive-interval: func() -> result<duration, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-keep-alive-interval: func(value: duration) -> result<_, error-code>;
/// The maximum amount of keepalive packets TCP should send before aborting the connection.
@@ -457,9 +457,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-keep-alive-count: func() -> result<u32, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-keep-alive-count: func(value: u32) -> result<_, error-code>;
/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
@@ -468,9 +468,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The TTL value must be 1 or higher.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-hop-limit: func() -> result<u8, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-hop-limit: func(value: u8) -> result<_, error-code>;
/// The kernel buffer space reserved for sends/receives on this socket.
@@ -483,18 +483,18 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-receive-buffer-size: func() -> result<u64, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-send-buffer-size: func() -> result<u64, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
}
/// A UDP socket handle.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource udp-socket {
/// Create a new UDP socket.
@@ -511,7 +511,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
create: static func(address-family: ip-address-family) -> result<udp-socket, error-code>;
/// Bind the socket to the provided IP address and port.
@@ -532,7 +532,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
bind: func(local-address: ip-socket-address) -> result<_, error-code>;
/// Associate this socket with a specific peer address.
@@ -571,7 +571,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
connect: func(remote-address: ip-socket-address) -> result<_, error-code>;
/// Dissociate this socket from its peer address.
@@ -589,7 +589,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
disconnect: func() -> result<_, error-code>;
/// Send a message on the socket to a particular peer.
@@ -623,7 +623,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
send: async func(data: list<u8>, remote-address: option<ip-socket-address>) -> result<_, error-code>;
/// Receive a message on the socket.
@@ -649,7 +649,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
receive: async func() -> result<tuple<list<u8>, ip-socket-address>, error-code>;
/// Get the current bound address.
@@ -668,7 +668,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-local-address: func() -> result<ip-socket-address, error-code>;
/// Get the address the socket is currently "connected" to.
@@ -681,7 +681,7 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-remote-address: func() -> result<ip-socket-address, error-code>;
/// Whether this is a IPv4 or IPv6 socket.
@@ -689,7 +689,7 @@ interface types {
/// This is the value passed to the constructor.
///
/// Equivalent to the SO_DOMAIN socket option.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-address-family: func() -> ip-address-family;
/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
@@ -698,9 +698,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The TTL value must be 1 or higher.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-unicast-hop-limit: func() -> result<u8, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-unicast-hop-limit: func(value: u8) -> result<_, error-code>;
/// The kernel buffer space reserved for sends/receives on this socket.
@@ -713,13 +713,13 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-receive-buffer-size: func() -> result<u64, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-send-buffer-size: func() -> result<u64, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
}
}
diff --git a/crates/wasi-http/src/p3/wit/deps/sockets/world.wit b/crates/wasi-http/src/p3/wit/deps/sockets/world.wit
index dfafac2aea..44cc427ed1 100644
--- a/crates/wasi-http/src/p3/wit/deps/sockets/world.wit
+++ b/crates/wasi-http/src/p3/wit/deps/sockets/world.wit
@@ -1,9 +1,9 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import types;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import ip-name-lookup;
}
diff --git a/crates/wasi-http/src/p3/wit/world.wit b/crates/wasi-http/src/p3/wit/world.wit
index 0f8a5b0464..17d3ee0e57 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.rs
index 10171b17b3..8701cb3f6a 100644
--- a/crates/wasi-http/tests/all/p3/mod.rs
+++ b/crates/wasi-http/tests/all/p3/mod.rs
@@ -320,7 +320,7 @@ async fn p3_http_middleware_with_chain() -> 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.rs
index f2894d5198..f0237ad08f 100644
--- a/crates/wasi/src/p3/bindings.rs
+++ b/crates/wasi/src/p3/bindings.rs
@@ -23,7 +23,7 @@
//! // An example of extending the `wasi:cli/command` world with a
//! // custom host interface.
//! world my-world {
-//! include wasi:cli/[email protected];
+//! include wasi:cli/[email protected];
//!
//! import custom-host;
//! }
diff --git a/crates/wasi/src/p3/cli/host.rs b/crates/wasi/src/p3/cli/host.rs
index 0b3d5b177c..f18e3c1444 100644
--- a/crates/wasi/src/p3/cli/host.rs
+++ b/crates/wasi/src/p3/cli/host.rs
@@ -1,6 +1,7 @@
use crate::I32Exit;
use crate::cli::{IsTerminal, WasiCli, WasiCliCtxView};
use crate::p3::DEFAULT_BUFFER_CAPACITY;
+use crate::p3::bindings::cli::types::ErrorCode;
use crate::p3::bindings::cli::{
environment, exit, stderr, stdin, stdout, terminal_input, terminal_output, terminal_stderr,
terminal_stdin, terminal_stdout,
@@ -10,16 +11,28 @@ use anyhow::{Context as _, anyhow};
use bytes::BytesMut;
use core::pin::Pin;
use core::task::{Context, Poll};
-use std::io::Cursor;
+use std::io::{self, Cursor};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
+use tokio::sync::oneshot;
use wasmtime::component::{
- Accessor, Destination, Resource, Source, StreamConsumer, StreamProducer, StreamReader,
- StreamResult,
+ Accessor, Destination, FutureReader, Resource, Source, StreamConsumer, StreamProducer,
+ StreamReader, StreamResult,
};
use wasmtime::{AsContextMut as _, StoreContextMut};
struct InputStreamProducer {
rx: Pin<Box<dyn AsyncRead + Send + Sync>>,
+ result_tx: Option<oneshot::Sender<ErrorCode>>,
+}
+
+fn io_error_to_error_code(err: io::Error) -> ErrorCode {
+ match err.kind() {
+ io::ErrorKind::BrokenPipe => ErrorCode::Pipe,
+ other => {
+ tracing::warn!("stdio error: {other}");
+ ErrorCode::Io
+ }
+ }
}
impl<D> StreamProducer<D> for InputStreamProducer {
@@ -55,8 +68,12 @@ impl<D> StreamProducer<D> for InputStreamProducer {
dst.mark_written(n);
Poll::Ready(Ok(StreamResult::Completed))
}
- Poll::Ready(Err(..)) => {
- // TODO: Report the error to the guest
+ Poll::Ready(Err(e)) => {
+ let _ = self
+ .result_tx
+ .take()
+ .unwrap()
+ .send(io_error_to_error_code(e));
Poll::Ready(Ok(StreamResult::Dropped))
}
Poll::Pending if finish => Poll::Ready(Ok(StreamResult::Cancelled)),
@@ -67,6 +84,7 @@ impl<D> StreamProducer<D> for InputStreamProducer {
struct OutputStreamConsumer {
tx: Pin<Box<dyn AsyncWrite + Send + Sync>>,
+ result_tx: Option<oneshot::Sender<ErrorCode>>,
}
impl<D> StreamConsumer<D> for OutputStreamConsumer {
@@ -98,9 +116,11 @@ impl<D> StreamConsumer<D> for OutputStreamConsumer {
Poll::Ready(Ok(StreamResult::Completed))
}
Poll::Ready(Err(e)) => {
- // FIXME(WebAssembly/wasi-cli#81) should communicate this
- // error to the guest somehow.
- tracing::warn!("dropping stdin error: {e}");
+ let _ = self
+ .result_tx
+ .take()
+ .unwrap()
+ .send(io_error_to_error_code(e));
Poll::Ready(Ok(StreamResult::Dropped))
}
Poll::Pending if finish => Poll::Ready(Ok(StreamResult::Cancelled)),
@@ -173,17 +193,28 @@ impl terminal_stderr::Host for WasiCliCtxView<'_> {
}
impl stdin::HostWithStore for WasiCli {
- async fn get_stdin<U>(store: &Accessor<U, Self>) -> wasmtime::Result<StreamReader<u8>> {
+ async fn read_via_stream<U>(
+ store: &Accessor<U, Self>,
+ ) -> wasmtime::Result<(StreamReader<u8>, FutureReader<Result<(), ErrorCode>>)> {
let instance = store.instance();
store.with(|mut store| {
let rx = store.get().ctx.stdin.async_stream();
- Ok(StreamReader::new(
+ let (result_tx, result_rx) = oneshot::channel();
+ let stream = StreamReader::new(
instance,
&mut store,
InputStreamProducer {
rx: Box::into_pin(rx),
+ result_tx: Some(result_tx),
},
- ))
+ );
+ let future = FutureReader::new(instance, &mut store, async {
+ anyhow::Ok(match result_rx.await {
+ Ok(err) => Err(err),
+ Err(_) => Ok(()),
+ })
+ });
+ Ok((stream, future))
})
}
}
@@ -191,19 +222,24 @@ impl stdin::HostWithStore for WasiCli {
impl stdin::Host for WasiCliCtxView<'_> {}
impl stdout::HostWithStore for WasiCli {
- async fn set_stdout<U>(
+ async fn write_via_stream<U>(
store: &Accessor<U, Self>,
data: StreamReader<u8>,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<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(())
+ });
+ Ok(match result_rx.await {
+ Ok(err) => Err(err),
+ Err(_) => Ok(()),
})
}
}
@@ -211,19 +247,24 @@ impl stdout::HostWithStore for WasiCli {
impl stdout::Host for WasiCliCtxView<'_> {}
impl stderr::HostWithStore for WasiCli {
- async fn set_stderr<U>(
+ async fn write_via_stream<U>(
store: &Accessor<U, Self>,
data: StreamReader<u8>,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<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(())
+ });
+ Ok(match result_rx.await {
+ Ok(err) => Err(err),
+ Err(_) => Ok(()),
})
}
}
diff --git a/crates/wasi/src/p3/wit/deps/cli/command.wit b/crates/wasi/src/p3/wit/deps/cli/command.wit
index 13e92bdec2..f2f613e552 100644
--- a/crates/wasi/src/p3/wit/deps/cli/command.wit
+++ b/crates/wasi/src/p3/wit/deps/cli/command.wit
@@ -1,10 +1,10 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world command {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
include imports;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
export run;
}
diff --git a/crates/wasi/src/p3/wit/deps/cli/environment.wit b/crates/wasi/src/p3/wit/deps/cli/environment.wit
index 769858af1a..3763f2f6ce 100644
--- a/crates/wasi/src/p3/wit/deps/cli/environment.wit
+++ b/crates/wasi/src/p3/wit/deps/cli/environment.wit
@@ -1,4 +1,4 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface environment {
/// Get the POSIX-style environment variables.
///
@@ -8,15 +8,15 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-environment: func() -> list<tuple<string, string>>;
/// Get the POSIX-style arguments to the program.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-initial-cwd: func() -> option<string>;
}
diff --git a/crates/wasi/src/p3/wit/deps/cli/exit.wit b/crates/wasi/src/p3/wit/deps/cli/exit.wit
index dcf791a201..1efba7d683 100644
--- a/crates/wasi/src/p3/wit/deps/cli/exit.wit
+++ b/crates/wasi/src/p3/wit/deps/cli/exit.wit
@@ -1,7 +1,7 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface exit {
/// Exit the current instance and any linked instances.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
exit: func(status: result);
/// Exit the current instance and any linked instances, reporting the
diff --git a/crates/wasi/src/p3/wit/deps/cli/imports.wit b/crates/wasi/src/p3/wit/deps/cli/imports.wit
index 2d513ead9e..660a2dd95a 100644
--- a/crates/wasi/src/p3/wit/deps/cli/imports.wit
+++ b/crates/wasi/src/p3/wit/deps/cli/imports.wit
@@ -1,34 +1,34 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
- include wasi:clocks/[email protected];
- @since(version = 0.3.0-rc-2025-08-15)
- include wasi:filesystem/[email protected];
- @since(version = 0.3.0-rc-2025-08-15)
- include wasi:sockets/[email protected];
- @since(version = 0.3.0-rc-2025-08-15)
- include wasi:random/[email protected];
+ @since(version = 0.3.0-rc-2025-09-16)
+ include wasi:clocks/[email protected];
+ @since(version = 0.3.0-rc-2025-09-16)
+ include wasi:filesystem/[email protected];
+ @since(version = 0.3.0-rc-2025-09-16)
+ include wasi:sockets/[email protected];
+ @since(version = 0.3.0-rc-2025-09-16)
+ include wasi:random/[email protected];
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import environment;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import exit;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import stdin;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import stdout;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import stderr;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-input;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-output;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-stdin;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-stdout;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import terminal-stderr;
}
diff --git a/crates/wasi/src/p3/wit/deps/cli/run.wit b/crates/wasi/src/p3/wit/deps/cli/run.wit
index 6149db760e..631441a3f2 100644
--- a/crates/wasi/src/p3/wit/deps/cli/run.wit
+++ b/crates/wasi/src/p3/wit/deps/cli/run.wit
@@ -1,6 +1,6 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface run {
/// Run the program.
- @since(version = 0.3.0-rc-2025-08-15)
- run: func() -> result;
+ @since(version = 0.3.0-rc-2025-09-16)
+ run: async func() -> result;
}
diff --git a/crates/wasi/src/p3/wit/deps/cli/stdio.wit b/crates/wasi/src/p3/wit/deps/cli/stdio.wit
index 6c99a56f16..51e5ae4b40 100644
--- a/crates/wasi/src/p3/wit/deps/cli/stdio.wit
+++ b/crates/wasi/src/p3/wit/deps/cli/stdio.wit
@@ -1,17 +1,65 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
+interface types {
+ @since(version = 0.3.0-rc-2025-09-16)
+ enum error-code {
+ /// Input/output error
+ io,
+ /// Invalid or incomplete multibyte or wide character
+ illegal-byte-sequence,
+ /// Broken pipe
+ pipe,
+ }
+}
+
+@since(version = 0.3.0-rc-2025-09-16)
interface stdin {
- @since(version = 0.3.0-rc-2025-08-15)
- get-stdin: func() -> stream<u8>;
+ use types.{error-code};
+
+ /// Return a stream for reading from stdin.
+ ///
+ /// This function returns a stream which provides data read from stdin,
+ /// and a future to signal read results.
+ ///
+ /// If the stream's readable end is dropped the future will resolve to success.
+ ///
+ /// If the stream's writable end is dropped the future will either resolve to
+ /// success if stdin was closed by the writer or to an error-code if reading
+ /// failed for some other reason.
+ ///
+ /// Multiple streams may be active at the same time. The behavior of concurrent
+ /// reads is implementation-specific.
+ @since(version = 0.3.0-rc-2025-09-16)
+ read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
}
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface stdout {
- @since(version = 0.3.0-rc-2025-08-15)
- set-stdout: func(data: stream<u8>);
+ use types.{error-code};
+
+ /// Write the given stream to stdout.
+ ///
+ /// If the stream's writable end is dropped this function will either return
+ /// success once the entire contents of the stream have been written or an
+ /// error-code representing a failure.
+ ///
+ /// Otherwise if there is an error the readable end of the stream will be
+ /// dropped and this function will return an error-code.
+ @since(version = 0.3.0-rc-2025-09-16)
+ write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
}
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface stderr {
- @since(version = 0.3.0-rc-2025-08-15)
- set-stderr: func(data: stream<u8>);
+ use types.{error-code};
+
+ /// Write the given stream to stderr.
+ ///
+ /// If the stream's writable end is dropped this function will either return
+ /// success once the entire contents of the stream have been written or an
+ /// error-code representing a failure.
+ ///
+ /// Otherwise if there is an error the readable end of the stream will be
+ /// dropped and this function will return an error-code.
+ @since(version = 0.3.0-rc-2025-09-16)
+ write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
}
diff --git a/crates/wasi/src/p3/wit/deps/cli/terminal.wit b/crates/wasi/src/p3/wit/deps/cli/terminal.wit
index 3b2b72bbaa..74c17694a4 100644
--- a/crates/wasi/src/p3/wit/deps/cli/terminal.wit
+++ b/crates/wasi/src/p3/wit/deps/cli/terminal.wit
@@ -3,10 +3,10 @@
/// 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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-input {
/// The input side of a terminal.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource terminal-input;
}
@@ -15,48 +15,48 @@ 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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-output {
/// The output side of a terminal.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource terminal-output;
}
/// An interface providing an optional `terminal-input` for stdin as a
/// link-time authority.
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-stdin {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-stdout {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface terminal-stderr {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-terminal-stderr: func() -> option<terminal-output>;
}
diff --git a/crates/wasi/src/p3/wit/deps/clocks/monotonic-clock.wit b/crates/wasi/src/p3/wit/deps/clocks/monotonic-clock.wit
index 0c58241fff..a91d495c6c 100644
--- a/crates/wasi/src/p3/wit/deps/clocks/monotonic-clock.wit
+++ b/crates/wasi/src/p3/wit/deps/clocks/monotonic-clock.wit
@@ -1,4 +1,4 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
/// time.
///
@@ -7,38 +7,41 @@ package wasi:[email protected];
///
/// 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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface monotonic-clock {
+ use types.{duration};
+
/// An instant in time, in nanoseconds. An instant is relative to an
/// unspecified initial value, and can only be compared to instances from
/// the same monotonic-clock.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
type instant = u64;
- /// A duration of time, in nanoseconds.
- @since(version = 0.3.0-rc-2025-08-15)
- type duration = u64;
-
/// Read the current value of the clock.
///
/// The clock is monotonic, therefore calling this function repeatedly will
/// produce a sequence of non-decreasing values.
- @since(version = 0.3.0-rc-2025-08-15)
+ ///
+ /// For completeness, this function traps if it's not possible to represent
+ /// the value of the clock in an `instant`. 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-2025-09-16)
now: func() -> instant;
/// Query the resolution of the clock. Returns the duration of time
/// corresponding to a clock tick.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-resolution: func() -> duration;
/// Wait until the specified instant has occurred.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
wait-until: async func(
when: instant,
);
- /// Wait for the specified duration has elapsed.
- @since(version = 0.3.0-rc-2025-08-15)
+ /// Wait for the specified duration to elapse.
+ @since(version = 0.3.0-rc-2025-09-16)
wait-for: async func(
how-long: duration,
);
diff --git a/crates/wasi/src/p3/wit/deps/clocks/timezone.wit b/crates/wasi/src/p3/wit/deps/clocks/timezone.wit
index 2ee16ab200..ab8f5c0801 100644
--- a/crates/wasi/src/p3/wit/deps/clocks/timezone.wit
+++ b/crates/wasi/src/p3/wit/deps/clocks/timezone.wit
@@ -1,4 +1,4 @@
-package wasi:[email protected];
+package wasi:[email protected];
@unstable(feature = clocks-timezone)
interface timezone {
diff --git a/crates/wasi/src/p3/wit/deps/clocks/types.wit b/crates/wasi/src/p3/wit/deps/clocks/types.wit
new file mode 100644
index 0000000000..aff7c2a22a
--- /dev/null
+++ b/crates/wasi/src/p3/wit/deps/clocks/types.wit
@@ -0,0 +1,8 @@
+package wasi:[email protected];
+/// This interface common types used throughout wasi:clocks.
+@since(version = 0.3.0-rc-2025-09-16)
+interface types {
+ /// A duration of time, in nanoseconds.
+ @since(version = 0.3.0-rc-2025-09-16)
+ type duration = u64;
+}
diff --git a/crates/wasi/src/p3/wit/deps/clocks/wall-clock.wit b/crates/wasi/src/p3/wit/deps/clocks/wall-clock.wit
index 2e3b2d441a..ea940500fa 100644
--- a/crates/wasi/src/p3/wit/deps/clocks/wall-clock.wit
+++ b/crates/wasi/src/p3/wit/deps/clocks/wall-clock.wit
@@ -1,4 +1,4 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// WASI Wall Clock is a clock API intended to let users query the current
/// time. The name "wall" makes an analogy to a "clock on the wall", which
/// is not necessarily monotonic as it may be reset.
@@ -13,10 +13,10 @@ package wasi:[email protected];
/// 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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface wall-clock {
/// A time and date in seconds plus nanoseconds.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record datetime {
seconds: u64,
nanoseconds: u32,
@@ -35,12 +35,12 @@ interface wall-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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
now: func() -> datetime;
/// Query the resolution of the clock.
///
/// The nanoseconds field of the output is always less than 1000000000.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-resolution: func() -> datetime;
}
diff --git a/crates/wasi/src/p3/wit/deps/clocks/world.wit b/crates/wasi/src/p3/wit/deps/clocks/world.wit
index 94068c75ce..a6b885f070 100644
--- a/crates/wasi/src/p3/wit/deps/clocks/world.wit
+++ b/crates/wasi/src/p3/wit/deps/clocks/world.wit
@@ -1,10 +1,10 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import monotonic-clock;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import wall-clock;
@unstable(feature = clocks-timezone)
import timezone;
diff --git a/crates/wasi/src/p3/wit/deps/filesystem/preopens.wit b/crates/wasi/src/p3/wit/deps/filesystem/preopens.wit
index b0f609aa98..9036e90e88 100644
--- a/crates/wasi/src/p3/wit/deps/filesystem/preopens.wit
+++ b/crates/wasi/src/p3/wit/deps/filesystem/preopens.wit
@@ -1,11 +1,11 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface preopens {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
use types.{descriptor};
/// Return the set of preopened directories, and their paths.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-directories: func() -> list<tuple<descriptor, string>>;
}
diff --git a/crates/wasi/src/p3/wit/deps/filesystem/types.wit b/crates/wasi/src/p3/wit/deps/filesystem/types.wit
index 07d770a83b..41d91beee5 100644
--- a/crates/wasi/src/p3/wit/deps/filesystem/types.wit
+++ b/crates/wasi/src/p3/wit/deps/filesystem/types.wit
@@ -1,4 +1,4 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// WASI filesystem is a filesystem API primarily intended to let users run WASI
/// programs that access their files on their existing filesystems, without
/// significant overhead.
@@ -23,19 +23,19 @@ package wasi:[email protected];
/// [WASI filesystem path resolution].
///
/// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface types {
- @since(version = 0.3.0-rc-2025-08-15)
- use wasi:clocks/[email protected].{datetime};
+ @since(version = 0.3.0-rc-2025-09-16)
+ use wasi:clocks/[email protected].{datetime};
/// File size or length of a region within a file.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum descriptor-type {
/// The type of the descriptor or file is unknown or is different from
/// any of the other types specified.
@@ -59,7 +59,7 @@ interface types {
/// Descriptor flags.
///
/// Note: This was called `fdflags` in earlier versions of WASI.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
flags descriptor-flags {
/// Read mode: Data can be read.
read,
@@ -103,7 +103,7 @@ interface types {
/// File attributes.
///
/// Note: This was called `filestat` in earlier versions of WASI.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record descriptor-stat {
/// File type.
%type: descriptor-type,
@@ -130,7 +130,7 @@ interface types {
}
/// Flags determining the method of how paths are resolved.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
flags path-flags {
/// As long as the resolved path corresponds to a symbolic link, it is
/// expanded.
@@ -138,7 +138,7 @@ interface types {
}
/// Open flags used by `open-at`.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
flags open-flags {
/// Create file if it does not exist, similar to `O_CREAT` in POSIX.
create,
@@ -151,11 +151,11 @@ interface types {
}
/// Number of hard links to an inode.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
type link-count = u64;
/// When setting a timestamp, this gives the value to set it to.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
variant new-timestamp {
/// Leave the timestamp set to its previous value.
no-change,
@@ -255,7 +255,7 @@ interface types {
}
/// File or memory access pattern advisory information.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum advice {
/// The application has no advice to give on its behavior with respect
/// to the specified data.
@@ -279,7 +279,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record metadata-hash-value {
/// 64 bits of a 128-bit hash value.
lower: u64,
@@ -290,7 +290,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource descriptor {
/// Return a stream for reading from a file.
///
@@ -308,7 +308,7 @@ interface types {
/// resolves to `err` with an `error-code`.
///
/// Note: This is similar to `pread` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
read-via-stream: func(
/// The offset within the file at which to start reading.
offset: filesize,
@@ -326,7 +326,7 @@ interface types {
/// written or an error is encountered.
///
/// Note: This is similar to `pwrite` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
write-via-stream: async func(
/// Data to write
data: stream<u8>,
@@ -342,13 +342,13 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
append-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
/// Provide file advisory information on a descriptor.
///
/// This is similar to `posix_fadvise` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
advise: async func(
/// The offset within the file to which the advisory applies.
offset: filesize,
@@ -364,7 +364,7 @@ interface types {
/// opened for writing.
///
/// Note: This is similar to `fdatasync` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
sync-data: async func() -> result<_, error-code>;
/// Get flags associated with a descriptor.
@@ -373,7 +373,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-flags: async func() -> result<descriptor-flags, error-code>;
/// Get the dynamic type of a descriptor.
@@ -386,14 +386,14 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-size: async func(size: filesize) -> result<_, error-code>;
/// Adjust the timestamps of an open file or directory.
@@ -401,7 +401,7 @@ interface types {
/// 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-times: async func(
/// The desired values of the data access timestamp.
data-access-timestamp: new-timestamp,
@@ -421,7 +421,7 @@ interface types {
///
/// This function returns a future, which will resolve to an error code if
/// reading full contents of the directory fails.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
read-directory: async func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;
/// Synchronize the data and metadata of a file to disk.
@@ -430,13 +430,13 @@ interface types {
/// opened for writing.
///
/// Note: This is similar to `fsync` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
sync: async func() -> result<_, error-code>;
/// Create a directory.
///
/// Note: This is similar to `mkdirat` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
create-directory-at: async func(
/// The relative path at which to create the directory.
path: string,
@@ -451,7 +451,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
stat: async func() -> result<descriptor-stat, error-code>;
/// Return the attributes of a file or directory.
@@ -461,7 +461,7 @@ interface types {
/// discussion of alternatives.
///
/// Note: This was called `path_filestat_get` in earlier versions of WASI.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
stat-at: async func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -475,7 +475,7 @@ interface types {
///
/// Note: This was called `path_filestat_set_times` in earlier versions of
/// WASI.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-times-at: async func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -494,7 +494,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
link-at: async func(
/// Flags determining the method of how the path is resolved.
old-path-flags: path-flags,
@@ -518,7 +518,7 @@ interface types {
/// `error-code::read-only`.
///
/// Note: This is similar to `openat` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
open-at: async func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -536,7 +536,7 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
readlink-at: async func(
/// The relative path of the symbolic link from which to read.
path: string,
@@ -547,7 +547,7 @@ interface types {
/// 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
remove-directory-at: async func(
/// The relative path to a directory to remove.
path: string,
@@ -556,7 +556,7 @@ interface types {
/// Rename a filesystem object.
///
/// Note: This is similar to `renameat` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
rename-at: async func(
/// The relative source path of the file or directory to rename.
old-path: string,
@@ -572,7 +572,7 @@ interface types {
/// `error-code::not-permitted`.
///
/// Note: This is similar to `symlinkat` in POSIX.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
symlink-at: async func(
/// The contents of the symbolic link.
old-path: string,
@@ -584,7 +584,7 @@ interface types {
///
/// 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
unlink-file-at: async func(
/// The relative path to a file to unlink.
path: string,
@@ -596,7 +596,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
is-same-object: async func(other: borrow<descriptor>) -> bool;
/// Return a hash of the metadata associated with a filesystem object referred
@@ -618,14 +618,14 @@ interface types {
/// computed hash.
///
/// However, none of these is required.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
metadata-hash-at: async func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
diff --git a/crates/wasi/src/p3/wit/deps/filesystem/world.wit b/crates/wasi/src/p3/wit/deps/filesystem/world.wit
index b9dcfd562a..87fc727165 100644
--- a/crates/wasi/src/p3/wit/deps/filesystem/world.wit
+++ b/crates/wasi/src/p3/wit/deps/filesystem/world.wit
@@ -1,9 +1,9 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import types;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import preopens;
}
diff --git a/crates/wasi/src/p3/wit/deps/random/insecure-seed.wit b/crates/wasi/src/p3/wit/deps/random/insecure-seed.wit
index ecd5043182..302151ba65 100644
--- a/crates/wasi/src/p3/wit/deps/random/insecure-seed.wit
+++ b/crates/wasi/src/p3/wit/deps/random/insecure-seed.wit
@@ -1,9 +1,9 @@
-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-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface insecure-seed {
/// Return a 128-bit value that may contain a pseudo-random value.
///
@@ -22,6 +22,6 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-insecure-seed: func() -> tuple<u64, u64>;
}
diff --git a/crates/wasi/src/p3/wit/deps/random/insecure.wit b/crates/wasi/src/p3/wit/deps/random/insecure.wit
index d08d85e0b1..39146e3910 100644
--- a/crates/wasi/src/p3/wit/deps/random/insecure.wit
+++ b/crates/wasi/src/p3/wit/deps/random/insecure.wit
@@ -1,9 +1,9 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// The insecure interface for insecure pseudo-random numbers.
///
/// It is intended to be portable at least between Unix-family platforms and
/// Windows.
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface insecure {
/// Return `len` insecure pseudo-random bytes.
///
@@ -13,13 +13,13 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-insecure-random-u64: func() -> u64;
}
diff --git a/crates/wasi/src/p3/wit/deps/random/random.wit b/crates/wasi/src/p3/wit/deps/random/random.wit
index 3808c3095b..fa1f111dc7 100644
--- a/crates/wasi/src/p3/wit/deps/random/random.wit
+++ b/crates/wasi/src/p3/wit/deps/random/random.wit
@@ -1,9 +1,9 @@
-package wasi:[email protected];
+package wasi:[email protected];
/// WASI Random is a random data API.
///
/// It is intended to be portable at least between Unix-family platforms and
/// Windows.
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface random {
/// Return `len` cryptographically-secure random or pseudo-random bytes.
///
@@ -17,13 +17,13 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-random-u64: func() -> u64;
}
diff --git a/crates/wasi/src/p3/wit/deps/random/world.wit b/crates/wasi/src/p3/wit/deps/random/world.wit
index e8f05cc438..08c5ed88b7 100644
--- a/crates/wasi/src/p3/wit/deps/random/world.wit
+++ b/crates/wasi/src/p3/wit/deps/random/world.wit
@@ -1,13 +1,13 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import random;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import insecure;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import insecure-seed;
}
diff --git a/crates/wasi/src/p3/wit/deps/sockets/ip-name-lookup.wit b/crates/wasi/src/p3/wit/deps/sockets/ip-name-lookup.wit
index ab4156e25d..6a652ff232 100644
--- a/crates/wasi/src/p3/wit/deps/sockets/ip-name-lookup.wit
+++ b/crates/wasi/src/p3/wit/deps/sockets/ip-name-lookup.wit
@@ -1,10 +1,10 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface ip-name-lookup {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
use types.{ip-address};
/// Lookup error codes.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum error-code {
/// Unknown error
unknown,
@@ -57,6 +57,6 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resolve-addresses: async func(name: string) -> result<list<ip-address>, error-code>;
}
diff --git a/crates/wasi/src/p3/wit/deps/sockets/types.wit b/crates/wasi/src/p3/wit/deps/sockets/types.wit
index 3a7915ce98..2ed1912e48 100644
--- a/crates/wasi/src/p3/wit/deps/sockets/types.wit
+++ b/crates/wasi/src/p3/wit/deps/sockets/types.wit
@@ -1,7 +1,7 @@
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
interface types {
- @since(version = 0.3.0-rc-2025-08-15)
- use wasi:clocks/[email protected].{duration};
+ @since(version = 0.3.0-rc-2025-09-16)
+ use wasi:clocks/[email protected].{duration};
/// Error codes.
///
@@ -14,7 +14,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum error-code {
/// Unknown error
unknown,
@@ -70,7 +70,7 @@ interface types {
datagram-too-large,
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
enum ip-address-family {
/// Similar to `AF_INET` in POSIX.
ipv4,
@@ -79,18 +79,18 @@ interface types {
ipv6,
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
type ipv4-address = tuple<u8, u8, u8, u8>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
variant ip-address {
ipv4(ipv4-address),
ipv6(ipv6-address),
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record ipv4-socket-address {
/// sin_port
port: u16,
@@ -98,7 +98,7 @@ interface types {
address: ipv4-address,
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
record ipv6-socket-address {
/// sin6_port
port: u16,
@@ -110,7 +110,7 @@ interface types {
scope-id: u32,
}
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
variant ip-socket-address {
ipv4(ipv4-socket-address),
ipv6(ipv6-socket-address),
@@ -135,7 +135,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource tcp-socket {
/// Create a new TCP socket.
@@ -152,7 +152,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
create: static func(address-family: ip-address-family) -> result<tcp-socket, error-code>;
/// Bind the socket to the provided IP address and port.
@@ -186,7 +186,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
bind: func(local-address: ip-socket-address) -> result<_, error-code>;
/// Connect to a remote endpoint.
@@ -218,7 +218,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
connect: async func(remote-address: ip-socket-address) -> result<_, error-code>;
/// Start listening and return a stream of new inbound connections.
@@ -285,7 +285,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
listen: func() -> result<stream<tcp-socket>, error-code>;
/// Transmit data to peer.
@@ -308,7 +308,7 @@ interface types {
/// - <https://man7.org/linux/man-pages/man2/send.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
/// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
send: async func(data: stream<u8>) -> result<_, error-code>;
/// Read data from peer.
@@ -342,7 +342,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
receive: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
/// Get the bound local address.
@@ -361,7 +361,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-local-address: func() -> result<ip-socket-address, error-code>;
/// Get the remote address.
@@ -374,13 +374,13 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-is-listening: func() -> bool;
/// Whether this is a IPv4 or IPv6 socket.
@@ -388,7 +388,7 @@ interface types {
/// This is the value passed to the constructor.
///
/// Equivalent to the SO_DOMAIN socket option.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-address-family: func() -> ip-address-family;
/// Hints the desired listen queue size. Implementations are free to ignore this.
@@ -400,7 +400,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-listen-backlog-size: func(value: u64) -> result<_, error-code>;
/// Enables or disables keepalive.
@@ -412,9 +412,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-keep-alive-enabled: func() -> result<bool, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
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.
@@ -427,9 +427,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-keep-alive-idle-time: func() -> result<duration, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;
/// The time between keepalive packets.
@@ -442,9 +442,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-keep-alive-interval: func() -> result<duration, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-keep-alive-interval: func(value: duration) -> result<_, error-code>;
/// The maximum amount of keepalive packets TCP should send before aborting the connection.
@@ -457,9 +457,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-keep-alive-count: func() -> result<u32, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-keep-alive-count: func(value: u32) -> result<_, error-code>;
/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
@@ -468,9 +468,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The TTL value must be 1 or higher.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-hop-limit: func() -> result<u8, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-hop-limit: func(value: u8) -> result<_, error-code>;
/// The kernel buffer space reserved for sends/receives on this socket.
@@ -483,18 +483,18 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-receive-buffer-size: func() -> result<u64, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-send-buffer-size: func() -> result<u64, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
}
/// A UDP socket handle.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
resource udp-socket {
/// Create a new UDP socket.
@@ -511,7 +511,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
create: static func(address-family: ip-address-family) -> result<udp-socket, error-code>;
/// Bind the socket to the provided IP address and port.
@@ -532,7 +532,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
bind: func(local-address: ip-socket-address) -> result<_, error-code>;
/// Associate this socket with a specific peer address.
@@ -571,7 +571,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
connect: func(remote-address: ip-socket-address) -> result<_, error-code>;
/// Dissociate this socket from its peer address.
@@ -589,7 +589,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
disconnect: func() -> result<_, error-code>;
/// Send a message on the socket to a particular peer.
@@ -623,7 +623,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
send: async func(data: list<u8>, remote-address: option<ip-socket-address>) -> result<_, error-code>;
/// Receive a message on the socket.
@@ -649,7 +649,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
receive: async func() -> result<tuple<list<u8>, ip-socket-address>, error-code>;
/// Get the current bound address.
@@ -668,7 +668,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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-local-address: func() -> result<ip-socket-address, error-code>;
/// Get the address the socket is currently "connected" to.
@@ -681,7 +681,7 @@ 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-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-remote-address: func() -> result<ip-socket-address, error-code>;
/// Whether this is a IPv4 or IPv6 socket.
@@ -689,7 +689,7 @@ interface types {
/// This is the value passed to the constructor.
///
/// Equivalent to the SO_DOMAIN socket option.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-address-family: func() -> ip-address-family;
/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
@@ -698,9 +698,9 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The TTL value must be 1 or higher.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-unicast-hop-limit: func() -> result<u8, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-unicast-hop-limit: func(value: u8) -> result<_, error-code>;
/// The kernel buffer space reserved for sends/receives on this socket.
@@ -713,13 +713,13 @@ interface types {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-receive-buffer-size: func() -> result<u64, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
get-send-buffer-size: func() -> result<u64, error-code>;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
}
}
diff --git a/crates/wasi/src/p3/wit/deps/sockets/world.wit b/crates/wasi/src/p3/wit/deps/sockets/world.wit
index dfafac2aea..44cc427ed1 100644
--- a/crates/wasi/src/p3/wit/deps/sockets/world.wit
+++ b/crates/wasi/src/p3/wit/deps/sockets/world.wit
@@ -1,9 +1,9 @@
-package wasi:[email protected];
+package wasi:[email protected];
-@since(version = 0.3.0-rc-2025-08-15)
+@since(version = 0.3.0-rc-2025-09-16)
world imports {
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import types;
- @since(version = 0.3.0-rc-2025-08-15)
+ @since(version = 0.3.0-rc-2025-09-16)
import ip-name-lookup;
}