Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions wit-0.3.0-draft/deps.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[cli]
url = "https://github.com/WebAssembly/wasi-cli/archive/main.tar.gz"
subdir = "wit-0.3.0-draft"
sha256 = "7f9cf181100ca1cadcb49a1efa3e80828d375df2d5ddf10a8f66e848d423aea5"
sha512 = "569f6b4ed2a3bec913e5e06fd35caab564048cf31632795c2fbdd8c40ddb5f5eea7b1cc59d33c80e5d7b642ed246ba4a3e40d3edeaaa2c6a5c4bcd02e0b67212"
sha256 = "5ff03c236a6fed89d2968c3fd5d9e2b3f4fcd7a606dc94ead51df5357bdabe76"
sha512 = "d0277a9b3692de917ef8b1bbe6be9247157d548962dde181b159788064a06513c6f6d775fcca94a3170fe2149ca75d609664938716f4dc877ef65cd7db07eb76"
deps = ["clocks", "filesystem", "random", "sockets"]

[clocks]
Expand Down
2 changes: 1 addition & 1 deletion wit-0.3.0-draft/deps/cli/run.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
interface run {
/// Run the program.
@since(version = 0.3.0-rc-2025-08-15)
run: func() -> result;
run: async func() -> result;
}
48 changes: 45 additions & 3 deletions wit-0.3.0-draft/deps/cli/stdio.wit
Original file line number Diff line number Diff line change
@@ -1,17 +1,59 @@
@since(version = 0.3.0-rc-2025-08-15)
interface stdio {
@since(version = 0.3.0-rc-2025-08-15)
enum error-code {
/// Input/output error
io,
/// Invalid or incomplete multibyte or wide character
illegal-byte-sequence,
/// Broken pipe
pipe,
}
}

@since(version = 0.3.0-rc-2025-08-15)
interface stdin {
/// 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-08-15)
get-stdin: func() -> stream<u8>;
read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
}

@since(version = 0.3.0-rc-2025-08-15)
interface stdout {
/// 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-08-15)
set-stdout: func(data: stream<u8>);
write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
}

@since(version = 0.3.0-rc-2025-08-15)
interface stderr {
/// 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-08-15)
set-stderr: func(data: stream<u8>);
write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
}
12 changes: 6 additions & 6 deletions wit-0.3.0-draft/proxy.wit
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package wasi:http@0.3.0-rc-2025-08-15;
package wasi:http@0.3.0-rc-2025-09-16;

/// 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/imports@0.3.0-rc-2025-08-15;
import wasi:random/random@0.3.0-rc-2025-08-15;
include wasi:clocks/imports@0.3.0-rc-2025-09-16;
import wasi:random/random@0.3.0-rc-2025-09-16;

/// Proxies have standard output and error streams which are expected to
/// terminate in a developer-facing console provided by the host.
import wasi:cli/stdout@0.3.0-rc-2025-08-15;
import wasi:cli/stderr@0.3.0-rc-2025-08-15;
import wasi:cli/stdout@0.3.0-rc-2025-09-16;
import wasi:cli/stderr@0.3.0-rc-2025-09-16;

/// 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/stdin@0.3.0-rc-2025-08-15;
import wasi:cli/stdin@0.3.0-rc-2025-09-16;

/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
Expand Down
2 changes: 1 addition & 1 deletion wit-0.3.0-draft/types.wit
Original file line number Diff line number Diff line change
@@ -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/monotonic-clock@0.3.0-rc-2025-08-15.{duration};
use wasi:clocks/monotonic-clock@0.3.0-rc-2025-09-16.{duration};

/// This type corresponds to HTTP standard Methods.
variant method {
Expand Down