Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Conversation

@rvolosatovs
Copy link
Member

With this I was able to run:

mod bindings {
    wit_bindgen::generate!({
        world: "wasi:cli/command",
        async: {
            exports: [
                "wasi:cli/run@0.3.0#run",
            ],
        },
        generate_all,
    });

    use super::Component;

    export!(Component);
}

use bindings::wit_stream;
use futures::SinkExt as _;

struct Component;

impl bindings::exports::wasi::cli::run::Guest for Component {
    async fn run() -> Result<(), ()> {
        let (mut tx, rx) = wit_stream::new();
        bindings::wasi::cli::stdout::set_stdout(rx);
        tx.send(b"hello".into())
            .await
            .expect("failed to write to STDOUT");
        Ok(())
    }
}

built via:

$ cargo build --target wasm32-unknown-unknown --release
$ wasm-tools component new --skip-validation  ./target/wasm32-unknown-unknown/release/p3_cli.wasm -o component.wasm

Using the wasmtime binary built from this commit

@rvolosatovs rvolosatovs force-pushed the chore/wasmtime-async-support branch from 7f5207d to 2ac3e5d Compare March 4, 2025 16:18
@rvolosatovs rvolosatovs changed the title feat(wasmtime-run): run components exporting wasi:cli@0.3 feat(wasmtime-cli): enable async CM feature Mar 4, 2025
@rvolosatovs
Copy link
Member Author

looks like it's mutually exclusive with module support :/

@rvolosatovs
Copy link
Member Author

It appears that the error originates here

Self::check_bool(
component_model_async,
other.contains(F::CM_ASYNC),
"WebAssembly component model support for async lifts/lowers, futures, streams, and errors",
)?;
. Interestingly, "just" enabling async for wasmtime serve works fine, as was done in #58

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@rvolosatovs rvolosatovs force-pushed the chore/wasmtime-async-support branch from 2ac3e5d to 523676e Compare April 17, 2025 15:33
@rvolosatovs rvolosatovs closed this Aug 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants