conduit icon indicating copy to clipboard operation
conduit copied to clipboard

Feature: WASI Preview 2 Support

Open nickchomey opened this issue 1 year ago • 8 comments

Feature description

As best as I can tell, WASI Preview 2 is now the official version of WASI, while Preview 1 was moved to the legacy directory in their repo.

They marked the first official release (0.2.0) of WASI on April 24, 2024, which corresponds with Preview 2.

It has APIs defined for HTTP, filesystem and more - which would be very useful in general, and for a Benthos processor in particular (which we discussed here).

So, it would be great if Conduit Processor SDK could move to support the Preview 2 APIs.

nickchomey avatar May 31 '24 15:05 nickchomey

Thanks for the issue @nickchomey ! It seems to me that we need to wait for the support in Go first: https://github.com/golang/go/issues/65333.

hariso avatar May 31 '24 17:05 hariso

Ah, I wasn't aware. Well, at least this issue can serve as a reminder/tracker for progress there.

nickchomey avatar May 31 '24 17:05 nickchomey

Yup, definitely good to have a tracker issue!

hariso avatar May 31 '24 18:05 hariso

I moved this issue to the main Conduit repo, as the WASI Preview 2 support needs to be added on the host (i.e. Conduit).

lovromazgon avatar Jun 10 '24 16:06 lovromazgon

This seems to be very promising progress. Could it be used to make a tinygo wasm component out of, say, Benthos and then include as a processor in conduit somehow?

https://wasmcloud.com/blog/compile-go-directly-to-webassembly-components-with-tinygo-and-wasi-p2

nickchomey avatar Jul 11 '24 12:07 nickchomey

I looked a bit more into this and, of course, while this is progress you still need a wasm implementation that handles wasi preview 2. According to WASI, only wasmtime and jco do.

https://github.com/WebAssembly/WASI/blob/main/preview2/README.md#wasi-preview-2-implementations

I've created an issue at wazero to add support for wasip2 https://github.com/tetratelabs/wazero/issues/2289

An alternative would be using wasmtime-go, but i assume you're not interested as it isn't pure Go, like wazero https://github.com/bytecodealliance/wasmtime-go

nickchomey avatar Jul 16 '24 23:07 nickchomey

Well, Wazero made it extremely clear there that they have no intention to support any further WASI previews until it reaches 1.0 and is in W3C spec. Not sure if/how that affects Conduit's plans

nickchomey avatar Jul 17 '24 02:07 nickchomey

Well, some of the features that are introduced in Preview 2 are really handy, such as HTTP. We're currently focusing on schema support in Conduit, but the team will discuss this when we are done with it. Thanks for looking into this and brining this up @nickchomey !

hariso avatar Jul 17 '24 12:07 hariso