Browse Source

use wasi-http and wasi-cli 0.2.0-rc-2023-12-05 (#7640)

* wasi-cli: update to version 0.2.0-rc-2023-12-05

* wasi-http: update to 0.2.0-rc-2023-12-05

* fix versions in extra (non-wasi) wits

* component adapter: fixes to use cli/imports world, correct versions

* wasmtime-wasi: cli/reactor is now cli/imports

* sync wasi-http/wit with wasi/wit

* fix cli-test component-basic.wat version
pull/7654/head
Pat Hickey 11 months ago
committed by GitHub
parent
commit
08d101becb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      crates/wasi-http/src/lib.rs
  2. 4
      crates/wasi-http/wit/command-extended.wit
  3. 4
      crates/wasi-http/wit/deps/cli/command.wit
  4. 20
      crates/wasi-http/wit/deps/cli/imports.wit
  5. 31
      crates/wasi-http/wit/deps/cli/reactor.wit
  6. 11
      crates/wasi-http/wit/deps/http/proxy.wit
  7. 8
      crates/wasi-http/wit/test.wit
  8. 14
      crates/wasi-preview1-component-adapter/src/lib.rs
  9. 2
      crates/wasi/src/preview2/mod.rs
  10. 4
      crates/wasi/wit/command-extended.wit
  11. 4
      crates/wasi/wit/deps/cli/command.wit
  12. 20
      crates/wasi/wit/deps/cli/imports.wit
  13. 31
      crates/wasi/wit/deps/cli/reactor.wit
  14. 11
      crates/wasi/wit/deps/http/proxy.wit
  15. 8
      crates/wasi/wit/test.wit
  16. 2
      tests/all/cli_tests/component-basic.wat

6
crates/wasi-http/src/lib.rs

@ -11,9 +11,9 @@ pub mod bindings {
wasmtime::component::bindgen!({
path: "wit",
interfaces: "
import wasi:http/incoming-handler@0.2.0-rc-2023-11-10;
import wasi:http/outgoing-handler@0.2.0-rc-2023-11-10;
import wasi:http/types@0.2.0-rc-2023-11-10;
import wasi:http/incoming-handler@0.2.0-rc-2023-12-05;
import wasi:http/outgoing-handler@0.2.0-rc-2023-12-05;
import wasi:http/types@0.2.0-rc-2023-12-05;
",
tracing: true,
async: false,

4
crates/wasi-http/wit/command-extended.wit

@ -1,6 +1,6 @@
// All of the same imports and exports available in the wasi:cli/command world
// with addition of HTTP proxy related imports:
world command-extended {
include wasi:cli/command@0.2.0-rc-2023-11-10;
import wasi:http/outgoing-handler@0.2.0-rc-2023-11-10;
include wasi:cli/command@0.2.0-rc-2023-12-05;
import wasi:http/outgoing-handler@0.2.0-rc-2023-12-05;
}

4
crates/wasi-http/wit/deps/cli/command.wit

@ -1,7 +1,7 @@
package wasi:cli@0.2.0-rc-2023-11-10;
package wasi:cli@0.2.0-rc-2023-12-05;
world command {
include reactor;
include imports;
export run;
}

20
crates/wasi-http/wit/deps/cli/imports.wit

@ -0,0 +1,20 @@
package wasi:cli@0.2.0-rc-2023-12-05;
world imports {
include wasi:clocks/imports@0.2.0-rc-2023-11-10;
include wasi:filesystem/imports@0.2.0-rc-2023-11-10;
include wasi:sockets/imports@0.2.0-rc-2023-11-10;
include wasi:random/imports@0.2.0-rc-2023-11-10;
include wasi:io/imports@0.2.0-rc-2023-11-10;
import environment;
import exit;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
}

31
crates/wasi-http/wit/deps/cli/reactor.wit

@ -1,31 +0,0 @@
package wasi:cli@0.2.0-rc-2023-11-10;
world reactor {
import wasi:clocks/wall-clock@0.2.0-rc-2023-11-10;
import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10;
import wasi:filesystem/types@0.2.0-rc-2023-11-10;
import wasi:filesystem/preopens@0.2.0-rc-2023-11-10;
import wasi:sockets/instance-network@0.2.0-rc-2023-11-10;
import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-11-10;
import wasi:sockets/network@0.2.0-rc-2023-11-10;
import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-11-10;
import wasi:sockets/tcp@0.2.0-rc-2023-11-10;
import wasi:sockets/udp-create-socket@0.2.0-rc-2023-11-10;
import wasi:sockets/udp@0.2.0-rc-2023-11-10;
import wasi:random/random@0.2.0-rc-2023-11-10;
import wasi:random/insecure@0.2.0-rc-2023-11-10;
import wasi:random/insecure-seed@0.2.0-rc-2023-11-10;
import wasi:io/poll@0.2.0-rc-2023-11-10;
import wasi:io/streams@0.2.0-rc-2023-11-10;
import environment;
import exit;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
}

11
crates/wasi-http/wit/deps/http/proxy.wit

@ -1,4 +1,4 @@
package wasi:http@0.2.0-rc-2023-11-10;
package wasi:http@0.2.0-rc-2023-12-05;
/// The `wasi:http/proxy` world captures a widely-implementable intersection of
/// hosts that includes HTTP forward and reverse proxies. Components targeting
@ -6,20 +6,19 @@ package wasi:http@0.2.0-rc-2023-11-10;
/// outgoing HTTP requests.
world proxy {
/// HTTP proxies have access to time and randomness.
import wasi:clocks/wall-clock@0.2.0-rc-2023-11-10;
import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10;
include wasi:clocks/imports@0.2.0-rc-2023-11-10;
import wasi:random/random@0.2.0-rc-2023-11-10;
/// 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.2.0-rc-2023-11-10;
import wasi:cli/stderr@0.2.0-rc-2023-11-10;
import wasi:cli/stdout@0.2.0-rc-2023-12-05;
import wasi:cli/stderr@0.2.0-rc-2023-12-05;
/// 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.2.0-rc-2023-11-10;
import wasi:cli/stdin@0.2.0-rc-2023-12-05;
/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).

8
crates/wasi-http/wit/test.wit

@ -2,7 +2,7 @@ package wasmtime:wasi;
// only used as part of `test-programs`
world test-reactor {
include wasi:cli/reactor@0.2.0-rc-2023-11-10;
include wasi:cli/imports@0.2.0-rc-2023-12-05;
export add-strings: func(s: list<string>) -> u32;
export get-strings: func() -> list<string>;
@ -16,7 +16,7 @@ world test-reactor {
}
world test-command {
include wasi:cli/reactor@0.2.0-rc-2023-11-10;
import wasi:http/types@0.2.0-rc-2023-11-10;
import wasi:http/outgoing-handler@0.2.0-rc-2023-11-10;
include wasi:cli/imports@0.2.0-rc-2023-12-05;
import wasi:http/types@0.2.0-rc-2023-12-05;
import wasi:http/outgoing-handler@0.2.0-rc-2023-12-05;
}

14
crates/wasi-preview1-component-adapter/src/lib.rs

@ -65,7 +65,7 @@ pub mod bindings {
#[cfg(feature = "reactor")]
wit_bindgen::generate!({
path: "../wasi/wit",
world: "wasi:cli/reactor",
world: "wasi:cli/imports",
std_feature,
raw_strings,
// Automatically generated bindings for these functions will allocate
@ -87,9 +87,9 @@ pub mod bindings {
import wasi:clocks/wall-clock@0.2.0-rc-2023-11-10;
import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10;
import wasi:random/random@0.2.0-rc-2023-11-10;
import wasi:cli/stdout@0.2.0-rc-2023-11-10;
import wasi:cli/stderr@0.2.0-rc-2023-11-10;
import wasi:cli/stdin@0.2.0-rc-2023-11-10;
import wasi:cli/stdout@0.2.0-rc-2023-12-05;
import wasi:cli/stderr@0.2.0-rc-2023-12-05;
import wasi:cli/stdin@0.2.0-rc-2023-12-05;
}
"#,
std_feature,
@ -98,7 +98,7 @@ pub mod bindings {
});
}
#[export_name = "wasi:cli/run@0.2.0-rc-2023-11-10#run"]
#[export_name = "wasi:cli/run@0.2.0-rc-2023-12-05#run"]
#[cfg(feature = "command")]
pub unsafe extern "C" fn run() -> u32 {
#[link(wasm_import_module = "__main_module__")]
@ -2641,7 +2641,7 @@ impl State {
#[cfg(not(feature = "proxy"))]
fn get_environment(&self) -> &[StrTuple] {
if self.env_vars.get().is_none() {
#[link(wasm_import_module = "wasi:cli/environment@0.2.0-rc-2023-11-10")]
#[link(wasm_import_module = "wasi:cli/environment@0.2.0-rc-2023-12-05")]
extern "C" {
#[link_name = "get-environment"]
fn get_environment_import(rval: *mut StrTupleList);
@ -2666,7 +2666,7 @@ impl State {
#[cfg(not(feature = "proxy"))]
fn get_args(&self) -> &[WasmStr] {
if self.args.get().is_none() {
#[link(wasm_import_module = "wasi:cli/environment@0.2.0-rc-2023-11-10")]
#[link(wasm_import_module = "wasi:cli/environment@0.2.0-rc-2023-12-05")]
extern "C" {
#[link_name = "get-arguments"]
fn get_args_import(rval: *mut WasmStrList);

2
crates/wasi/src/preview2/mod.rs

@ -95,7 +95,7 @@ pub mod bindings {
wasmtime::component::bindgen!({
path: "wit",
world: "wasi:cli/reactor",
world: "wasi:cli/imports",
tracing: true,
async: {
// Only these functions are `async` and everything else is sync

4
crates/wasi/wit/command-extended.wit

@ -1,6 +1,6 @@
// All of the same imports and exports available in the wasi:cli/command world
// with addition of HTTP proxy related imports:
world command-extended {
include wasi:cli/command@0.2.0-rc-2023-11-10;
import wasi:http/outgoing-handler@0.2.0-rc-2023-11-10;
include wasi:cli/command@0.2.0-rc-2023-12-05;
import wasi:http/outgoing-handler@0.2.0-rc-2023-12-05;
}

4
crates/wasi/wit/deps/cli/command.wit

@ -1,7 +1,7 @@
package wasi:cli@0.2.0-rc-2023-11-10;
package wasi:cli@0.2.0-rc-2023-12-05;
world command {
include reactor;
include imports;
export run;
}

20
crates/wasi/wit/deps/cli/imports.wit

@ -0,0 +1,20 @@
package wasi:cli@0.2.0-rc-2023-12-05;
world imports {
include wasi:clocks/imports@0.2.0-rc-2023-11-10;
include wasi:filesystem/imports@0.2.0-rc-2023-11-10;
include wasi:sockets/imports@0.2.0-rc-2023-11-10;
include wasi:random/imports@0.2.0-rc-2023-11-10;
include wasi:io/imports@0.2.0-rc-2023-11-10;
import environment;
import exit;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
}

31
crates/wasi/wit/deps/cli/reactor.wit

@ -1,31 +0,0 @@
package wasi:cli@0.2.0-rc-2023-11-10;
world reactor {
import wasi:clocks/wall-clock@0.2.0-rc-2023-11-10;
import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10;
import wasi:filesystem/types@0.2.0-rc-2023-11-10;
import wasi:filesystem/preopens@0.2.0-rc-2023-11-10;
import wasi:sockets/instance-network@0.2.0-rc-2023-11-10;
import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-11-10;
import wasi:sockets/network@0.2.0-rc-2023-11-10;
import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-11-10;
import wasi:sockets/tcp@0.2.0-rc-2023-11-10;
import wasi:sockets/udp-create-socket@0.2.0-rc-2023-11-10;
import wasi:sockets/udp@0.2.0-rc-2023-11-10;
import wasi:random/random@0.2.0-rc-2023-11-10;
import wasi:random/insecure@0.2.0-rc-2023-11-10;
import wasi:random/insecure-seed@0.2.0-rc-2023-11-10;
import wasi:io/poll@0.2.0-rc-2023-11-10;
import wasi:io/streams@0.2.0-rc-2023-11-10;
import environment;
import exit;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
}

11
crates/wasi/wit/deps/http/proxy.wit

@ -1,4 +1,4 @@
package wasi:http@0.2.0-rc-2023-11-10;
package wasi:http@0.2.0-rc-2023-12-05;
/// The `wasi:http/proxy` world captures a widely-implementable intersection of
/// hosts that includes HTTP forward and reverse proxies. Components targeting
@ -6,20 +6,19 @@ package wasi:http@0.2.0-rc-2023-11-10;
/// outgoing HTTP requests.
world proxy {
/// HTTP proxies have access to time and randomness.
import wasi:clocks/wall-clock@0.2.0-rc-2023-11-10;
import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10;
include wasi:clocks/imports@0.2.0-rc-2023-11-10;
import wasi:random/random@0.2.0-rc-2023-11-10;
/// 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.2.0-rc-2023-11-10;
import wasi:cli/stderr@0.2.0-rc-2023-11-10;
import wasi:cli/stdout@0.2.0-rc-2023-12-05;
import wasi:cli/stderr@0.2.0-rc-2023-12-05;
/// 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.2.0-rc-2023-11-10;
import wasi:cli/stdin@0.2.0-rc-2023-12-05;
/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).

8
crates/wasi/wit/test.wit

@ -2,7 +2,7 @@ package wasmtime:wasi;
// only used as part of `test-programs`
world test-reactor {
include wasi:cli/reactor@0.2.0-rc-2023-11-10;
include wasi:cli/imports@0.2.0-rc-2023-12-05;
export add-strings: func(s: list<string>) -> u32;
export get-strings: func() -> list<string>;
@ -16,7 +16,7 @@ world test-reactor {
}
world test-command {
include wasi:cli/reactor@0.2.0-rc-2023-11-10;
import wasi:http/types@0.2.0-rc-2023-11-10;
import wasi:http/outgoing-handler@0.2.0-rc-2023-11-10;
include wasi:cli/imports@0.2.0-rc-2023-12-05;
import wasi:http/types@0.2.0-rc-2023-12-05;
import wasi:http/outgoing-handler@0.2.0-rc-2023-12-05;
}

2
tests/all/cli_tests/component-basic.wat

@ -7,6 +7,6 @@
(func $run (result (result))
(canon lift (core func $i "run")))
(instance (export (interface "wasi:cli/run@0.2.0-rc-2023-11-10"))
(instance (export (interface "wasi:cli/run@0.2.0-rc-2023-12-05"))
(export "run" (func $run)))
)

Loading…
Cancel
Save