Repository: bytecodealliance/wasmtime
Pull request #7299 (2023-10-19 21:50:53)

[14.0.0] Put versions in all WASI WIT files 
This is a backport of #7272 to the 14.0.0 release branch to get version numbers into WASI interfaces that Wasmtime supports sooner rather than later. This uses the exact same date as main, 2023-10-18, so I'll have a follow-up PR to `main` which updates those dates further to have `main` be difference since WITs have changed.


Patch:
diff --git a/crates/wasi-http/src/lib.rs b/crates/wasi-http/src/lib.rs
index a45b45477..cb0e45a42 100644
--- a/crates/wasi-http/src/lib.rs
+++ b/crates/wasi-http/src/lib.rs
@@ -10,9 +10,9 @@ pub mod bindings {
     wasmtime::component::bindgen!({
         path: "wit",
         interfaces: "
-            import wasi:http/incoming-handler;
-            import wasi:http/outgoing-handler;
-            import wasi:http/types;
+            import wasi:http/incoming-handler@0.2.0-rc-2023-10-18;
+            import wasi:http/outgoing-handler@0.2.0-rc-2023-10-18;
+            import wasi:http/types@0.2.0-rc-2023-10-18;
         ",
         tracing: true,
         async: false,
diff --git a/crates/wasi-http/src/proxy.rs b/crates/wasi-http/src/proxy.rs
index 155a55fd1..0f8d55221 100644
--- a/crates/wasi-http/src/proxy.rs
+++ b/crates/wasi-http/src/proxy.rs
@@ -2,7 +2,7 @@ use crate::{bindings, WasiHttpView};
 use wasmtime_wasi::preview2;
 
 wasmtime::component::bindgen!({
-    world: "wasi:http/proxy",
+    world: "wasi:http/proxy@0.2.0-rc-2023-10-18",
     tracing: true,
     async: true,
     with: {
@@ -40,7 +40,7 @@ pub mod sync {
     use wasmtime_wasi::preview2;
 
     wasmtime::component::bindgen!({
-        world: "wasi:http/proxy",
+        world: "wasi:http/proxy@0.2.0-rc-2023-10-18",
         tracing: true,
         async: false,
         with: {
diff --git a/crates/wasi-http/wit/command-extended.wit b/crates/wasi-http/wit/command-extended.wit
index b4d08aed3..066177944 100644
--- a/crates/wasi-http/wit/command-extended.wit
+++ b/crates/wasi-http/wit/command-extended.wit
@@ -1,37 +1,37 @@
 // All of the same imports and exports available in the wasi:cli/command world
 // with addition of HTTP proxy related imports:
 world command-extended {
-  import wasi:clocks/wall-clock;
-  import wasi:clocks/monotonic-clock;
-  import wasi:clocks/timezone;
-  import wasi:filesystem/types;
-  import wasi:filesystem/preopens;
-  import wasi:sockets/instance-network;
-  import wasi:sockets/ip-name-lookup;
-  import wasi:sockets/network;
-  import wasi:sockets/tcp-create-socket;
-  import wasi:sockets/tcp;
-  import wasi:sockets/udp-create-socket;
-  import wasi:sockets/udp;
-  import wasi:random/random;
-  import wasi:random/insecure;
-  import wasi:random/insecure-seed;
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:cli/environment;
-  import wasi:cli/exit;
-  import wasi:cli/stdin;
-  import wasi:cli/stdout;
-  import wasi:cli/stderr;
-  import wasi:cli/terminal-input;
-  import wasi:cli/terminal-output;
-  import wasi:cli/terminal-stdin;
-  import wasi:cli/terminal-stdout;
-  import wasi:cli/terminal-stderr;
+  import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/types@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
+  import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
+  import wasi:sockets/network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp@0.2.0-rc-2023-10-18;
+  import wasi:random/random@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure-seed@0.2.0-rc-2023-10-18;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:cli/exit@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-input@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-output@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stderr@0.2.0-rc-2023-10-18;
 
   // We should replace all others with `include self.command`
   // as soon as the unioning of worlds is available:
   // https://github.com/WebAssembly/component-model/issues/169
-  import wasi:logging/logging;
-  import wasi:http/outgoing-handler;
+  import wasi:logging/logging@0.2.0-rc-2023-10-18;
+  import wasi:http/outgoing-handler@0.2.0-rc-2023-10-18;
 }
diff --git a/crates/wasi-http/wit/deps/cli/command.wit b/crates/wasi-http/wit/deps/cli/command.wit
index 86c9c73b7..d7ea2d91f 100644
--- a/crates/wasi-http/wit/deps/cli/command.wit
+++ b/crates/wasi-http/wit/deps/cli/command.wit
@@ -1,4 +1,4 @@
-package wasi:cli;
+package wasi:cli@0.2.0-rc-2023-10-18;
 
 world command {
   include reactor;
diff --git a/crates/wasi-http/wit/deps/cli/reactor.wit b/crates/wasi-http/wit/deps/cli/reactor.wit
index 6bd780e76..904b99467 100644
--- a/crates/wasi-http/wit/deps/cli/reactor.wit
+++ b/crates/wasi-http/wit/deps/cli/reactor.wit
@@ -1,23 +1,23 @@
-package wasi:cli;
+package wasi:cli@0.2.0-rc-2023-10-18;
 
 world reactor {
-  import wasi:clocks/wall-clock;
-  import wasi:clocks/monotonic-clock;
-  import wasi:clocks/timezone;
-  import wasi:filesystem/types;
-  import wasi:filesystem/preopens;
-  import wasi:sockets/instance-network;
-  import wasi:sockets/ip-name-lookup;
-  import wasi:sockets/network;
-  import wasi:sockets/tcp-create-socket;
-  import wasi:sockets/tcp;
-  import wasi:sockets/udp-create-socket;
-  import wasi:sockets/udp;
-  import wasi:random/random;
-  import wasi:random/insecure;
-  import wasi:random/insecure-seed;
-  import wasi:io/poll;
-  import wasi:io/streams;
+  import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/types@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
+  import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
+  import wasi:sockets/network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp@0.2.0-rc-2023-10-18;
+  import wasi:random/random@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure-seed@0.2.0-rc-2023-10-18;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
 
   import environment;
   import exit;
diff --git a/crates/wasi-http/wit/deps/cli/stdio.wit b/crates/wasi-http/wit/deps/cli/stdio.wit
index 1bb6c5583..513ca92de 100644
--- a/crates/wasi-http/wit/deps/cli/stdio.wit
+++ b/crates/wasi-http/wit/deps/cli/stdio.wit
@@ -1,17 +1,17 @@
 interface stdin {
-  use wasi:io/streams.{input-stream};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream};
 
   get-stdin: func() -> input-stream;
 }
 
 interface stdout {
-  use wasi:io/streams.{output-stream};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};
 
   get-stdout: func() -> output-stream;
 }
 
 interface stderr {
-  use wasi:io/streams.{output-stream};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};
 
   get-stderr: func() -> output-stream;
 }
diff --git a/crates/wasi-http/wit/deps/clocks/monotonic-clock.wit b/crates/wasi-http/wit/deps/clocks/monotonic-clock.wit
index d9ac7cb3f..c0ecb529b 100644
--- a/crates/wasi-http/wit/deps/clocks/monotonic-clock.wit
+++ b/crates/wasi-http/wit/deps/clocks/monotonic-clock.wit
@@ -9,7 +9,7 @@
 ///
 /// It is intended for measuring elapsed time.
 interface monotonic-clock {
-    use wasi:io/poll.{pollable};
+    use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 
     /// A timestamp in nanoseconds.
     type instant = u64;
diff --git a/crates/wasi-http/wit/deps/clocks/world.wit b/crates/wasi-http/wit/deps/clocks/world.wit
index 3295ba8d9..cdfb51d9a 100644
--- a/crates/wasi-http/wit/deps/clocks/world.wit
+++ b/crates/wasi-http/wit/deps/clocks/world.wit
@@ -1,4 +1,4 @@
-package wasi:clocks;
+package wasi:clocks@0.2.0-rc-2023-10-18;
 
 world imports {
     import monotonic-clock;
diff --git a/crates/wasi-http/wit/deps/filesystem/types.wit b/crates/wasi-http/wit/deps/filesystem/types.wit
index 73b93c0b0..af3613543 100644
--- a/crates/wasi-http/wit/deps/filesystem/types.wit
+++ b/crates/wasi-http/wit/deps/filesystem/types.wit
@@ -23,8 +23,8 @@
 ///
 /// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md
 interface types {
-    use wasi:io/streams.{input-stream, output-stream, error};
-    use wasi:clocks/wall-clock.{datetime};
+    use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream, output-stream, error};
+    use wasi:clocks/wall-clock@0.2.0-rc-2023-10-18.{datetime};
 
     /// File size or length of a region within a file.
     type filesize = u64;
diff --git a/crates/wasi-http/wit/deps/filesystem/world.wit b/crates/wasi-http/wit/deps/filesystem/world.wit
index bd472942d..3f953f893 100644
--- a/crates/wasi-http/wit/deps/filesystem/world.wit
+++ b/crates/wasi-http/wit/deps/filesystem/world.wit
@@ -1,4 +1,4 @@
-package wasi:filesystem;
+package wasi:filesystem@0.2.0-rc-2023-10-18;
 
 world imports {
     import types;
diff --git a/crates/wasi-http/wit/deps/http/proxy.wit b/crates/wasi-http/wit/deps/http/proxy.wit
index 8ee589207..dde0659d6 100644
--- a/crates/wasi-http/wit/deps/http/proxy.wit
+++ b/crates/wasi-http/wit/deps/http/proxy.wit
@@ -1,4 +1,4 @@
-package wasi:http;
+package wasi:http@0.2.0-rc-2023-10-18;
 
 // The `wasi:http/proxy` world captures a widely-implementable intersection of
 // hosts that includes HTTP forward and reverse proxies. Components targeting
@@ -6,21 +6,21 @@ package wasi:http;
 // outgoing HTTP requests.
 world proxy {
   // HTTP proxies have access to time and randomness.
-  import wasi:clocks/wall-clock;
-  import wasi:clocks/monotonic-clock;
-  import wasi:clocks/timezone;
-  import wasi:random/random;
+  import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
+  import wasi:random/random@0.2.0-rc-2023-10-18;
 
   // 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;
-  import wasi:cli/stderr;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
 
   // 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;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
 
   // 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/wit/deps/http/types.wit b/crates/wasi-http/wit/deps/http/types.wit
index f42d195af..2cd2fe219 100644
--- a/crates/wasi-http/wit/deps/http/types.wit
+++ b/crates/wasi-http/wit/deps/http/types.wit
@@ -2,8 +2,8 @@
 // define the HTTP resource types and operations used by the component's
 // imported and exported interfaces.
 interface types {
-  use wasi:io/streams.{input-stream, output-stream};
-  use wasi:io/poll.{pollable};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream, output-stream};
+  use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 
   // This type corresponds to HTTP standard Methods.
   variant method {
diff --git a/crates/wasi-http/wit/deps/io/poll.wit b/crates/wasi-http/wit/deps/io/poll.wit
index 254f53418..047389d21 100644
--- a/crates/wasi-http/wit/deps/io/poll.wit
+++ b/crates/wasi-http/wit/deps/io/poll.wit
@@ -1,4 +1,4 @@
-package wasi:io;
+package wasi:io@0.2.0-rc-2023-10-18;
 
 /// A poll API intended to let users wait for I/O events on multiple handles
 /// at once.
diff --git a/crates/wasi-http/wit/deps/io/streams.wit b/crates/wasi-http/wit/deps/io/streams.wit
index 60ad1c33d..d0e8f5c31 100644
--- a/crates/wasi-http/wit/deps/io/streams.wit
+++ b/crates/wasi-http/wit/deps/io/streams.wit
@@ -1,4 +1,4 @@
-package wasi:io;
+package wasi:io@0.2.0-rc-2023-10-18;
 
 /// WASI I/O is an I/O abstraction API which is currently focused on providing
 /// stream types.
diff --git a/crates/wasi-http/wit/deps/io/world.wit b/crates/wasi-http/wit/deps/io/world.wit
index 05244a965..3627c9d68 100644
--- a/crates/wasi-http/wit/deps/io/world.wit
+++ b/crates/wasi-http/wit/deps/io/world.wit
@@ -1,4 +1,4 @@
-package wasi:io;
+package wasi:io@0.2.0-rc-2023-10-18;
 
 world imports {
     import streams;
diff --git a/crates/wasi-http/wit/deps/logging/logging.wit b/crates/wasi-http/wit/deps/logging/logging.wit
index da537e479..b897a5aec 100644
--- a/crates/wasi-http/wit/deps/logging/logging.wit
+++ b/crates/wasi-http/wit/deps/logging/logging.wit
@@ -1,4 +1,4 @@
-package wasi:logging;
+package wasi:logging@0.2.0-rc-2023-10-18;
 
 /// WASI Logging is a logging API intended to let users emit log messages with
 /// simple priority levels and context values.
diff --git a/crates/wasi-http/wit/deps/logging/world.wit b/crates/wasi-http/wit/deps/logging/world.wit
index ede628643..a0fb255c1 100644
--- a/crates/wasi-http/wit/deps/logging/world.wit
+++ b/crates/wasi-http/wit/deps/logging/world.wit
@@ -1,4 +1,4 @@
-package wasi:logging;
+package wasi:logging@0.2.0-rc-2023-10-18;
 
 world imports {
     import logging;
diff --git a/crates/wasi-http/wit/deps/random/world.wit b/crates/wasi-http/wit/deps/random/world.wit
index bb1dd7b59..dcbff9384 100644
--- a/crates/wasi-http/wit/deps/random/world.wit
+++ b/crates/wasi-http/wit/deps/random/world.wit
@@ -1,4 +1,4 @@
-package wasi:random;
+package wasi:random@0.2.0-rc-2023-10-18;
 
 world imports {
     import random;
diff --git a/crates/wasi-http/wit/deps/sockets/ip-name-lookup.wit b/crates/wasi-http/wit/deps/sockets/ip-name-lookup.wit
index 8fc3074af..f2dab32ff 100644
--- a/crates/wasi-http/wit/deps/sockets/ip-name-lookup.wit
+++ b/crates/wasi-http/wit/deps/sockets/ip-name-lookup.wit
@@ -1,6 +1,6 @@
 
 interface ip-name-lookup {
-	use wasi:io/poll.{pollable};
+	use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 	use network.{network, error-code, ip-address, ip-address-family};
 
 
diff --git a/crates/wasi-http/wit/deps/sockets/tcp.wit b/crates/wasi-http/wit/deps/sockets/tcp.wit
index 6f549d337..448f629e5 100644
--- a/crates/wasi-http/wit/deps/sockets/tcp.wit
+++ b/crates/wasi-http/wit/deps/sockets/tcp.wit
@@ -1,7 +1,7 @@
 
 interface tcp {
-	use wasi:io/streams.{input-stream, output-stream};
-	use wasi:io/poll.{pollable};
+	use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream, output-stream};
+	use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 	use network.{network, error-code, ip-socket-address, ip-address-family};
 
 	enum shutdown-type {
diff --git a/crates/wasi-http/wit/deps/sockets/udp.wit b/crates/wasi-http/wit/deps/sockets/udp.wit
index a275b4de7..91a8c6c4a 100644
--- a/crates/wasi-http/wit/deps/sockets/udp.wit
+++ b/crates/wasi-http/wit/deps/sockets/udp.wit
@@ -1,6 +1,6 @@
 
 interface udp {
-	use wasi:io/poll.{pollable};
+	use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 	use network.{network, error-code, ip-socket-address, ip-address-family};
 
 
diff --git a/crates/wasi-http/wit/deps/sockets/world.wit b/crates/wasi-http/wit/deps/sockets/world.wit
index 432b0dc99..d16530c38 100644
--- a/crates/wasi-http/wit/deps/sockets/world.wit
+++ b/crates/wasi-http/wit/deps/sockets/world.wit
@@ -1,4 +1,4 @@
-package wasi:sockets;
+package wasi:sockets@0.2.0-rc-2023-10-18;
 
 world imports {
     import instance-network;
diff --git a/crates/wasi-http/wit/main.wit b/crates/wasi-http/wit/main.wit
index e843cefce..f3a4e60cc 100644
--- a/crates/wasi-http/wit/main.wit
+++ b/crates/wasi-http/wit/main.wit
@@ -3,31 +3,31 @@ package wasmtime:wasi;
 // All of the same imports available in the wasi:cli/command world, but no
 // export required:
 world preview1-adapter-reactor {
-  import wasi:clocks/wall-clock;
-  import wasi:clocks/monotonic-clock;
-  import wasi:clocks/timezone;
-  import wasi:filesystem/types;
-  import wasi:filesystem/preopens;
-  import wasi:sockets/instance-network;
-  import wasi:sockets/ip-name-lookup;
-  import wasi:sockets/network;
-  import wasi:sockets/tcp-create-socket;
-  import wasi:sockets/tcp;
-  import wasi:sockets/udp-create-socket;
-  import wasi:sockets/udp;
-  import wasi:random/random;
-  import wasi:random/insecure;
-  import wasi:random/insecure-seed;
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:cli/environment;
-  import wasi:cli/exit;
-  import wasi:cli/stdin;
-  import wasi:cli/stdout;
-  import wasi:cli/stderr;
-  import wasi:cli/terminal-input;
-  import wasi:cli/terminal-output;
-  import wasi:cli/terminal-stdin;
-  import wasi:cli/terminal-stdout;
-  import wasi:cli/terminal-stderr;
+  import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/types@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
+  import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
+  import wasi:sockets/network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp@0.2.0-rc-2023-10-18;
+  import wasi:random/random@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure-seed@0.2.0-rc-2023-10-18;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:cli/exit@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-input@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-output@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stderr@0.2.0-rc-2023-10-18;
 }
diff --git a/crates/wasi-preview1-component-adapter/src/descriptors.rs b/crates/wasi-preview1-component-adapter/src/descriptors.rs
index 997d8856b..1c0ba4609 100644
--- a/crates/wasi-preview1-component-adapter/src/descriptors.rs
+++ b/crates/wasi-preview1-component-adapter/src/descriptors.rs
@@ -181,7 +181,7 @@ impl Descriptors {
         }))
         .trapping_unwrap();
 
-        #[link(wasm_import_module = "wasi:filesystem/preopens")]
+        #[link(wasm_import_module = "wasi:filesystem/preopens@0.2.0-rc-2023-10-18")]
         #[allow(improper_ctypes)] // FIXME(bytecodealliance/wit-bindgen#684)
         extern "C" {
             #[link_name = "get-directories"]
diff --git a/crates/wasi-preview1-component-adapter/src/lib.rs b/crates/wasi-preview1-component-adapter/src/lib.rs
index 56ae3294f..f83dfd2ed 100644
--- a/crates/wasi-preview1-component-adapter/src/lib.rs
+++ b/crates/wasi-preview1-component-adapter/src/lib.rs
@@ -30,7 +30,7 @@ pub mod bindings {
     #[cfg(feature = "command")]
     wit_bindgen::generate!({
         path: "../wasi/wit",
-        world: "wasi:cli/command",
+        world: "wasi:cli/command@0.2.0-rc-2023-10-18",
         std_feature,
         raw_strings,
         // Automatically generated bindings for these functions will allocate
@@ -58,7 +58,7 @@ pub mod bindings {
     });
 }
 
-#[export_name = "wasi:cli/run#run"]
+#[export_name = "wasi:cli/run@0.2.0-rc-2023-10-18#run"]
 #[cfg(feature = "command")]
 pub unsafe extern "C" fn run() -> u32 {
     #[link(wasm_import_module = "__main_module__")]
@@ -1774,7 +1774,7 @@ pub unsafe extern "C" fn poll_oneoff(
             });
         }
 
-        #[link(wasm_import_module = "wasi:io/poll")]
+        #[link(wasm_import_module = "wasi:io/poll@0.2.0-rc-2023-10-18")]
         #[allow(improper_ctypes)] // FIXME(bytecodealliance/wit-bindgen#684)
         extern "C" {
             #[link_name = "poll-list"]
@@ -2495,7 +2495,7 @@ impl State {
 
     fn get_environment(&self) -> &[StrTuple] {
         if self.env_vars.get().is_none() {
-            #[link(wasm_import_module = "wasi:cli/environment")]
+            #[link(wasm_import_module = "wasi:cli/environment@0.2.0-rc-2023-10-18")]
             extern "C" {
                 #[link_name = "get-environment"]
                 fn get_environment_import(rval: *mut StrTupleList);
@@ -2519,7 +2519,7 @@ impl State {
 
     fn get_args(&self) -> &[WasmStr] {
         if self.args.get().is_none() {
-            #[link(wasm_import_module = "wasi:cli/environment")]
+            #[link(wasm_import_module = "wasi:cli/environment@0.2.0-rc-2023-10-18")]
             extern "C" {
                 #[link_name = "get-arguments"]
                 fn get_args_import(rval: *mut WasmStrList);
diff --git a/crates/wasi/src/preview2/command.rs b/crates/wasi/src/preview2/command.rs
index 898311157..299b31c67 100644
--- a/crates/wasi/src/preview2/command.rs
+++ b/crates/wasi/src/preview2/command.rs
@@ -1,7 +1,7 @@
 use crate::preview2::WasiView;
 
 wasmtime::component::bindgen!({
-    world: "wasi:cli/command",
+    world: "wasi:cli/command@0.2.0-rc-2023-10-18",
     tracing: true,
     async: true,
     with: {
@@ -60,7 +60,7 @@ pub mod sync {
     use crate::preview2::WasiView;
 
     wasmtime::component::bindgen!({
-        world: "wasi:cli/command",
+        world: "wasi:cli/command@0.2.0-rc-2023-10-18",
         tracing: true,
         async: false,
         with: {
diff --git a/crates/wasi/src/preview2/mod.rs b/crates/wasi/src/preview2/mod.rs
index ea9bc31d4..1dacb8a91 100644
--- a/crates/wasi/src/preview2/mod.rs
+++ b/crates/wasi/src/preview2/mod.rs
@@ -68,9 +68,9 @@ pub mod bindings {
             wasmtime::component::bindgen!({
                 path: "wit",
                 interfaces: "
-                    import wasi:io/poll;
-                    import wasi:io/streams;
-                    import wasi:filesystem/types;
+                    import wasi:io/poll@0.2.0-rc-2023-10-18;
+                    import wasi:io/streams@0.2.0-rc-2023-10-18;
+                    import wasi:filesystem/types@0.2.0-rc-2023-10-18;
                 ",
                 tracing: true,
                 trappable_error_type: {
@@ -93,7 +93,7 @@ pub mod bindings {
 
     wasmtime::component::bindgen!({
         path: "wit",
-        interfaces: "include wasi:cli/reactor;",
+        interfaces: "include wasi:cli/reactor@0.2.0-rc-2023-10-18;",
         tracing: true,
         async: {
             // Only these functions are `async` and everything else is sync
diff --git a/crates/wasi/wit/command-extended.wit b/crates/wasi/wit/command-extended.wit
index b4d08aed3..066177944 100644
--- a/crates/wasi/wit/command-extended.wit
+++ b/crates/wasi/wit/command-extended.wit
@@ -1,37 +1,37 @@
 // All of the same imports and exports available in the wasi:cli/command world
 // with addition of HTTP proxy related imports:
 world command-extended {
-  import wasi:clocks/wall-clock;
-  import wasi:clocks/monotonic-clock;
-  import wasi:clocks/timezone;
-  import wasi:filesystem/types;
-  import wasi:filesystem/preopens;
-  import wasi:sockets/instance-network;
-  import wasi:sockets/ip-name-lookup;
-  import wasi:sockets/network;
-  import wasi:sockets/tcp-create-socket;
-  import wasi:sockets/tcp;
-  import wasi:sockets/udp-create-socket;
-  import wasi:sockets/udp;
-  import wasi:random/random;
-  import wasi:random/insecure;
-  import wasi:random/insecure-seed;
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:cli/environment;
-  import wasi:cli/exit;
-  import wasi:cli/stdin;
-  import wasi:cli/stdout;
-  import wasi:cli/stderr;
-  import wasi:cli/terminal-input;
-  import wasi:cli/terminal-output;
-  import wasi:cli/terminal-stdin;
-  import wasi:cli/terminal-stdout;
-  import wasi:cli/terminal-stderr;
+  import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/types@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
+  import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
+  import wasi:sockets/network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp@0.2.0-rc-2023-10-18;
+  import wasi:random/random@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure-seed@0.2.0-rc-2023-10-18;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:cli/exit@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-input@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-output@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stderr@0.2.0-rc-2023-10-18;
 
   // We should replace all others with `include self.command`
   // as soon as the unioning of worlds is available:
   // https://github.com/WebAssembly/component-model/issues/169
-  import wasi:logging/logging;
-  import wasi:http/outgoing-handler;
+  import wasi:logging/logging@0.2.0-rc-2023-10-18;
+  import wasi:http/outgoing-handler@0.2.0-rc-2023-10-18;
 }
diff --git a/crates/wasi/wit/deps/cli/command.wit b/crates/wasi/wit/deps/cli/command.wit
index 86c9c73b7..d7ea2d91f 100644
--- a/crates/wasi/wit/deps/cli/command.wit
+++ b/crates/wasi/wit/deps/cli/command.wit
@@ -1,4 +1,4 @@
-package wasi:cli;
+package wasi:cli@0.2.0-rc-2023-10-18;
 
 world command {
   include reactor;
diff --git a/crates/wasi/wit/deps/cli/reactor.wit b/crates/wasi/wit/deps/cli/reactor.wit
index 6bd780e76..904b99467 100644
--- a/crates/wasi/wit/deps/cli/reactor.wit
+++ b/crates/wasi/wit/deps/cli/reactor.wit
@@ -1,23 +1,23 @@
-package wasi:cli;
+package wasi:cli@0.2.0-rc-2023-10-18;
 
 world reactor {
-  import wasi:clocks/wall-clock;
-  import wasi:clocks/monotonic-clock;
-  import wasi:clocks/timezone;
-  import wasi:filesystem/types;
-  import wasi:filesystem/preopens;
-  import wasi:sockets/instance-network;
-  import wasi:sockets/ip-name-lookup;
-  import wasi:sockets/network;
-  import wasi:sockets/tcp-create-socket;
-  import wasi:sockets/tcp;
-  import wasi:sockets/udp-create-socket;
-  import wasi:sockets/udp;
-  import wasi:random/random;
-  import wasi:random/insecure;
-  import wasi:random/insecure-seed;
-  import wasi:io/poll;
-  import wasi:io/streams;
+  import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/types@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
+  import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
+  import wasi:sockets/network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp@0.2.0-rc-2023-10-18;
+  import wasi:random/random@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure-seed@0.2.0-rc-2023-10-18;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
 
   import environment;
   import exit;
diff --git a/crates/wasi/wit/deps/cli/stdio.wit b/crates/wasi/wit/deps/cli/stdio.wit
index 1bb6c5583..513ca92de 100644
--- a/crates/wasi/wit/deps/cli/stdio.wit
+++ b/crates/wasi/wit/deps/cli/stdio.wit
@@ -1,17 +1,17 @@
 interface stdin {
-  use wasi:io/streams.{input-stream};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream};
 
   get-stdin: func() -> input-stream;
 }
 
 interface stdout {
-  use wasi:io/streams.{output-stream};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};
 
   get-stdout: func() -> output-stream;
 }
 
 interface stderr {
-  use wasi:io/streams.{output-stream};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};
 
   get-stderr: func() -> output-stream;
 }
diff --git a/crates/wasi/wit/deps/clocks/monotonic-clock.wit b/crates/wasi/wit/deps/clocks/monotonic-clock.wit
index d9ac7cb3f..c0ecb529b 100644
--- a/crates/wasi/wit/deps/clocks/monotonic-clock.wit
+++ b/crates/wasi/wit/deps/clocks/monotonic-clock.wit
@@ -9,7 +9,7 @@
 ///
 /// It is intended for measuring elapsed time.
 interface monotonic-clock {
-    use wasi:io/poll.{pollable};
+    use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 
     /// A timestamp in nanoseconds.
     type instant = u64;
diff --git a/crates/wasi/wit/deps/clocks/world.wit b/crates/wasi/wit/deps/clocks/world.wit
index 3295ba8d9..cdfb51d9a 100644
--- a/crates/wasi/wit/deps/clocks/world.wit
+++ b/crates/wasi/wit/deps/clocks/world.wit
@@ -1,4 +1,4 @@
-package wasi:clocks;
+package wasi:clocks@0.2.0-rc-2023-10-18;
 
 world imports {
     import monotonic-clock;
diff --git a/crates/wasi/wit/deps/filesystem/types.wit b/crates/wasi/wit/deps/filesystem/types.wit
index 73b93c0b0..af3613543 100644
--- a/crates/wasi/wit/deps/filesystem/types.wit
+++ b/crates/wasi/wit/deps/filesystem/types.wit
@@ -23,8 +23,8 @@
 ///
 /// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md
 interface types {
-    use wasi:io/streams.{input-stream, output-stream, error};
-    use wasi:clocks/wall-clock.{datetime};
+    use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream, output-stream, error};
+    use wasi:clocks/wall-clock@0.2.0-rc-2023-10-18.{datetime};
 
     /// File size or length of a region within a file.
     type filesize = u64;
diff --git a/crates/wasi/wit/deps/filesystem/world.wit b/crates/wasi/wit/deps/filesystem/world.wit
index bd472942d..3f953f893 100644
--- a/crates/wasi/wit/deps/filesystem/world.wit
+++ b/crates/wasi/wit/deps/filesystem/world.wit
@@ -1,4 +1,4 @@
-package wasi:filesystem;
+package wasi:filesystem@0.2.0-rc-2023-10-18;
 
 world imports {
     import types;
diff --git a/crates/wasi/wit/deps/http/proxy.wit b/crates/wasi/wit/deps/http/proxy.wit
index 8ee589207..dde0659d6 100644
--- a/crates/wasi/wit/deps/http/proxy.wit
+++ b/crates/wasi/wit/deps/http/proxy.wit
@@ -1,4 +1,4 @@
-package wasi:http;
+package wasi:http@0.2.0-rc-2023-10-18;
 
 // The `wasi:http/proxy` world captures a widely-implementable intersection of
 // hosts that includes HTTP forward and reverse proxies. Components targeting
@@ -6,21 +6,21 @@ package wasi:http;
 // outgoing HTTP requests.
 world proxy {
   // HTTP proxies have access to time and randomness.
-  import wasi:clocks/wall-clock;
-  import wasi:clocks/monotonic-clock;
-  import wasi:clocks/timezone;
-  import wasi:random/random;
+  import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
+  import wasi:random/random@0.2.0-rc-2023-10-18;
 
   // 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;
-  import wasi:cli/stderr;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
 
   // 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;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
 
   // 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/wit/deps/http/types.wit b/crates/wasi/wit/deps/http/types.wit
index f42d195af..2cd2fe219 100644
--- a/crates/wasi/wit/deps/http/types.wit
+++ b/crates/wasi/wit/deps/http/types.wit
@@ -2,8 +2,8 @@
 // define the HTTP resource types and operations used by the component's
 // imported and exported interfaces.
 interface types {
-  use wasi:io/streams.{input-stream, output-stream};
-  use wasi:io/poll.{pollable};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream, output-stream};
+  use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 
   // This type corresponds to HTTP standard Methods.
   variant method {
diff --git a/crates/wasi/wit/deps/io/poll.wit b/crates/wasi/wit/deps/io/poll.wit
index 254f53418..047389d21 100644
--- a/crates/wasi/wit/deps/io/poll.wit
+++ b/crates/wasi/wit/deps/io/poll.wit
@@ -1,4 +1,4 @@
-package wasi:io;
+package wasi:io@0.2.0-rc-2023-10-18;
 
 /// A poll API intended to let users wait for I/O events on multiple handles
 /// at once.
diff --git a/crates/wasi/wit/deps/io/streams.wit b/crates/wasi/wit/deps/io/streams.wit
index 60ad1c33d..d0e8f5c31 100644
--- a/crates/wasi/wit/deps/io/streams.wit
+++ b/crates/wasi/wit/deps/io/streams.wit
@@ -1,4 +1,4 @@
-package wasi:io;
+package wasi:io@0.2.0-rc-2023-10-18;
 
 /// WASI I/O is an I/O abstraction API which is currently focused on providing
 /// stream types.
diff --git a/crates/wasi/wit/deps/io/world.wit b/crates/wasi/wit/deps/io/world.wit
index 05244a965..3627c9d68 100644
--- a/crates/wasi/wit/deps/io/world.wit
+++ b/crates/wasi/wit/deps/io/world.wit
@@ -1,4 +1,4 @@
-package wasi:io;
+package wasi:io@0.2.0-rc-2023-10-18;
 
 world imports {
     import streams;
diff --git a/crates/wasi/wit/deps/logging/logging.wit b/crates/wasi/wit/deps/logging/logging.wit
index da537e479..b897a5aec 100644
--- a/crates/wasi/wit/deps/logging/logging.wit
+++ b/crates/wasi/wit/deps/logging/logging.wit
@@ -1,4 +1,4 @@
-package wasi:logging;
+package wasi:logging@0.2.0-rc-2023-10-18;
 
 /// WASI Logging is a logging API intended to let users emit log messages with
 /// simple priority levels and context values.
diff --git a/crates/wasi/wit/deps/logging/world.wit b/crates/wasi/wit/deps/logging/world.wit
index ede628643..a0fb255c1 100644
--- a/crates/wasi/wit/deps/logging/world.wit
+++ b/crates/wasi/wit/deps/logging/world.wit
@@ -1,4 +1,4 @@
-package wasi:logging;
+package wasi:logging@0.2.0-rc-2023-10-18;
 
 world imports {
     import logging;
diff --git a/crates/wasi/wit/deps/random/world.wit b/crates/wasi/wit/deps/random/world.wit
index bb1dd7b59..dcbff9384 100644
--- a/crates/wasi/wit/deps/random/world.wit
+++ b/crates/wasi/wit/deps/random/world.wit
@@ -1,4 +1,4 @@
-package wasi:random;
+package wasi:random@0.2.0-rc-2023-10-18;
 
 world imports {
     import random;
diff --git a/crates/wasi/wit/deps/sockets/ip-name-lookup.wit b/crates/wasi/wit/deps/sockets/ip-name-lookup.wit
index 8fc3074af..f2dab32ff 100644
--- a/crates/wasi/wit/deps/sockets/ip-name-lookup.wit
+++ b/crates/wasi/wit/deps/sockets/ip-name-lookup.wit
@@ -1,6 +1,6 @@
 
 interface ip-name-lookup {
-	use wasi:io/poll.{pollable};
+	use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 	use network.{network, error-code, ip-address, ip-address-family};
 
 
diff --git a/crates/wasi/wit/deps/sockets/tcp.wit b/crates/wasi/wit/deps/sockets/tcp.wit
index 6f549d337..448f629e5 100644
--- a/crates/wasi/wit/deps/sockets/tcp.wit
+++ b/crates/wasi/wit/deps/sockets/tcp.wit
@@ -1,7 +1,7 @@
 
 interface tcp {
-	use wasi:io/streams.{input-stream, output-stream};
-	use wasi:io/poll.{pollable};
+	use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream, output-stream};
+	use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 	use network.{network, error-code, ip-socket-address, ip-address-family};
 
 	enum shutdown-type {
diff --git a/crates/wasi/wit/deps/sockets/udp.wit b/crates/wasi/wit/deps/sockets/udp.wit
index a275b4de7..91a8c6c4a 100644
--- a/crates/wasi/wit/deps/sockets/udp.wit
+++ b/crates/wasi/wit/deps/sockets/udp.wit
@@ -1,6 +1,6 @@
 
 interface udp {
-	use wasi:io/poll.{pollable};
+	use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
 	use network.{network, error-code, ip-socket-address, ip-address-family};
 
 
diff --git a/crates/wasi/wit/deps/sockets/world.wit b/crates/wasi/wit/deps/sockets/world.wit
index 432b0dc99..d16530c38 100644
--- a/crates/wasi/wit/deps/sockets/world.wit
+++ b/crates/wasi/wit/deps/sockets/world.wit
@@ -1,4 +1,4 @@
-package wasi:sockets;
+package wasi:sockets@0.2.0-rc-2023-10-18;
 
 world imports {
     import instance-network;
diff --git a/crates/wasi/wit/main.wit b/crates/wasi/wit/main.wit
index e843cefce..f3a4e60cc 100644
--- a/crates/wasi/wit/main.wit
+++ b/crates/wasi/wit/main.wit
@@ -3,31 +3,31 @@ package wasmtime:wasi;
 // All of the same imports available in the wasi:cli/command world, but no
 // export required:
 world preview1-adapter-reactor {
-  import wasi:clocks/wall-clock;
-  import wasi:clocks/monotonic-clock;
-  import wasi:clocks/timezone;
-  import wasi:filesystem/types;
-  import wasi:filesystem/preopens;
-  import wasi:sockets/instance-network;
-  import wasi:sockets/ip-name-lookup;
-  import wasi:sockets/network;
-  import wasi:sockets/tcp-create-socket;
-  import wasi:sockets/tcp;
-  import wasi:sockets/udp-create-socket;
-  import wasi:sockets/udp;
-  import wasi:random/random;
-  import wasi:random/insecure;
-  import wasi:random/insecure-seed;
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:cli/environment;
-  import wasi:cli/exit;
-  import wasi:cli/stdin;
-  import wasi:cli/stdout;
-  import wasi:cli/stderr;
-  import wasi:cli/terminal-input;
-  import wasi:cli/terminal-output;
-  import wasi:cli/terminal-stdin;
-  import wasi:cli/terminal-stdout;
-  import wasi:cli/terminal-stderr;
+  import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
+  import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/types@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
+  import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
+  import wasi:sockets/network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp@0.2.0-rc-2023-10-18;
+  import wasi:random/random@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure@0.2.0-rc-2023-10-18;
+  import wasi:random/insecure-seed@0.2.0-rc-2023-10-18;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:cli/exit@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-input@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-output@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/terminal-stderr@0.2.0-rc-2023-10-18;
 }
diff --git a/crates/wit-bindgen/src/lib.rs b/crates/wit-bindgen/src/lib.rs
index 37b493da9..88c86eb2a 100644
--- a/crates/wit-bindgen/src/lib.rs
+++ b/crates/wit-bindgen/src/lib.rs
@@ -175,8 +175,6 @@ impl Wasmtime {
         name: &WorldKey,
         is_export: bool,
     ) -> bool {
-        let with_name = resolve.name_world_key(name);
-
         let mut path = Vec::new();
         if is_export {
             path.push("exports".to_string());
@@ -193,7 +191,8 @@ impl Wasmtime {
                 path.push(iface.name.as_ref().unwrap().to_snake_case());
             }
         }
-        let entry = if let Some(remapped_path) = self.opts.with.get(&with_name) {
+        let entry = if let Some(remapped_path) = self.lookup_replacement(resolve, name, None) {
+            let remapped_path = remapped_path.to_string();
             let name = format!("__with_name{}", self.with_name_counter);
             self.with_name_counter += 1;
             uwriteln!(self.src, "use {remapped_path} as {name};");
@@ -663,6 +662,44 @@ impl Wasmtime {
             }
         }
     }
+
+    fn lookup_replacement(
+        &self,
+        resolve: &Resolve,
+        key: &WorldKey,
+        item: Option<&str>,
+    ) -> Option<&str> {
+        // First try to lookup the exact name of the interface as specified
+        // via `name_world_key`.
+        let name = resolve.name_world_key(key);
+        let candidate1 = match item {
+            Some(item) => format!("{name}/{item}"),
+            None => name.clone(),
+        };
+        if let Some(ret) = self.opts.with.get(&candidate1) {
+            return Some(ret);
+        }
+
+        // .. if the above failed allow omitting the `@...` version information
+        // and see if there's a `with` key for that.
+        //
+        // NB: this means that in a scenario where there's packages with the
+        // same name/namespace where one has a version and one doesn't there's
+        // no way to use `with` to specify just one and not the other. That
+        // should be ok for now, but this should ideally detect a situation like
+        // that and omit this fallback in such a situation.
+        let version_start = name.find('@')?;
+        let name = &name[..version_start];
+        let candidate2 = match item {
+            Some(item) => format!("{name}/{item}"),
+            None => name.to_string(),
+        };
+        if let Some(ret) = self.opts.with.get(&candidate2) {
+            return Some(ret);
+        }
+
+        None
+    }
 }
 
 impl Wasmtime {
@@ -928,11 +965,11 @@ impl<'a> InterfaceGenerator<'a> {
         if self.types_imported() {
             self.rustdoc(docs);
 
-            let with_key = match self.current_interface {
-                Some((_, key, _)) => format!("{}/{name}", self.resolve.name_world_key(key)),
-                None => name.to_string(),
+            let replacement = match self.current_interface {
+                Some((_, key, _)) => self.gen.lookup_replacement(self.resolve, key, Some(name)),
+                None => self.gen.opts.with.get(name).map(|s| s.as_str()),
             };
-            match self.gen.opts.with.get(&with_key) {
+            match replacement {
                 Some(path) => {
                     uwriteln!(
                         self.src,


Test patch:
diff --git a/crates/test-programs/wasi-http-proxy-tests/src/lib.rs b/crates/test-programs/wasi-http-proxy-tests/src/lib.rs
index 5c25f34dd..7a914ca31 100644
--- a/crates/test-programs/wasi-http-proxy-tests/src/lib.rs
+++ b/crates/test-programs/wasi-http-proxy-tests/src/lib.rs
@@ -3,7 +3,7 @@ pub mod bindings {
 
     wit_bindgen::generate!({
         path: "../../wasi-http/wit",
-        world: "wasi:http/proxy",
+        world: "wasi:http/proxy@0.2.0-rc-2023-10-18",
         exports: {
             "wasi:http/incoming-handler": T,
         },
diff --git a/crates/wasi-http/wit/test.wit b/crates/wasi-http/wit/test.wit
index a0d1d07a6..3db5e0824 100644
--- a/crates/wasi-http/wit/test.wit
+++ b/crates/wasi-http/wit/test.wit
@@ -1,46 +1,46 @@
 // only used as part of `test-programs`
 world test-reactor {
 
-  import wasi:cli/environment;
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:filesystem/types;
-  import wasi:filesystem/preopens;
-  import wasi:cli/exit;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/types@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
+  import wasi:cli/exit@0.2.0-rc-2023-10-18;
 
   export add-strings: func(s: list<string>) -> u32;
   export get-strings: func() -> list<string>;
 
-  use wasi:io/streams.{output-stream};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};
 
   export write-strings-to: func(o: output-stream) -> result;
 
-  use wasi:filesystem/types.{descriptor-stat};
+  use wasi:filesystem/types@0.2.0-rc-2023-10-18.{descriptor-stat};
   export pass-an-imported-record: func(d: descriptor-stat) -> string;
 }
 
 world test-command {
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:cli/environment;
-  import wasi:cli/stdin;
-  import wasi:cli/stdout;
-  import wasi:cli/stderr;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
 }
 
 world test-command-with-sockets {
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:cli/environment;
-  import wasi:cli/stdin;
-  import wasi:cli/stdout;
-  import wasi:cli/stderr;
-  import wasi:sockets/tcp;
-  import wasi:sockets/tcp-create-socket;
-  import wasi:sockets/udp;
-  import wasi:sockets/udp-create-socket;
-  import wasi:sockets/network;
-  import wasi:sockets/instance-network;
-  import wasi:sockets/ip-name-lookup;
-  import wasi:clocks/monotonic-clock;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
 }
diff --git a/crates/wasi/wit/test.wit b/crates/wasi/wit/test.wit
index a0d1d07a6..3db5e0824 100644
--- a/crates/wasi/wit/test.wit
+++ b/crates/wasi/wit/test.wit
@@ -1,46 +1,46 @@
 // only used as part of `test-programs`
 world test-reactor {
 
-  import wasi:cli/environment;
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:filesystem/types;
-  import wasi:filesystem/preopens;
-  import wasi:cli/exit;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/types@0.2.0-rc-2023-10-18;
+  import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
+  import wasi:cli/exit@0.2.0-rc-2023-10-18;
 
   export add-strings: func(s: list<string>) -> u32;
   export get-strings: func() -> list<string>;
 
-  use wasi:io/streams.{output-stream};
+  use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};
 
   export write-strings-to: func(o: output-stream) -> result;
 
-  use wasi:filesystem/types.{descriptor-stat};
+  use wasi:filesystem/types@0.2.0-rc-2023-10-18.{descriptor-stat};
   export pass-an-imported-record: func(d: descriptor-stat) -> string;
 }
 
 world test-command {
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:cli/environment;
-  import wasi:cli/stdin;
-  import wasi:cli/stdout;
-  import wasi:cli/stderr;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
 }
 
 world test-command-with-sockets {
-  import wasi:io/poll;
-  import wasi:io/streams;
-  import wasi:cli/environment;
-  import wasi:cli/stdin;
-  import wasi:cli/stdout;
-  import wasi:cli/stderr;
-  import wasi:sockets/tcp;
-  import wasi:sockets/tcp-create-socket;
-  import wasi:sockets/udp;
-  import wasi:sockets/udp-create-socket;
-  import wasi:sockets/network;
-  import wasi:sockets/instance-network;
-  import wasi:sockets/ip-name-lookup;
-  import wasi:clocks/monotonic-clock;
+  import wasi:io/poll@0.2.0-rc-2023-10-18;
+  import wasi:io/streams@0.2.0-rc-2023-10-18;
+  import wasi:cli/environment@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdin@0.2.0-rc-2023-10-18;
+  import wasi:cli/stdout@0.2.0-rc-2023-10-18;
+  import wasi:cli/stderr@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp@0.2.0-rc-2023-10-18;
+  import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
+  import wasi:sockets/network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
+  import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
+  import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
 }
diff --git a/tests/all/cli_tests/component-basic.wat b/tests/all/cli_tests/component-basic.wat
index 19a5fb2c6..55ce9ed26 100644
--- a/tests/all/cli_tests/component-basic.wat
+++ b/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"))
+  (instance (export (interface "wasi:cli/run@0.2.0-rc-2023-10-18"))
     (export "run" (func $run)))
 )