Stream: general

Topic: ✔ Preinitialization of components


view this post on Zulip Notification Bot (Jun 27 2025 at 17:24):

Jeff Charles has marked this topic as resolved.

view this post on Zulip Pat Hickey (Jun 30 2025 at 20:48):

My minimum viable working (cli for) component-init is in a branch here https://github.com/dicej/component-init/pull/7

This is a pretty big PR towards making component-init usable standalone: Introduce a new crate component-init-wasmtime that provides a wasmtime-based Invoker. Right now this Invoker only supports ...

view this post on Zulip Pat Hickey (Jun 30 2025 at 20:49):

and here is an example of using it: https://github.com/pchickey/jaq-http/blob/main/src/main.rs#L76

Contribute to pchickey/jaq-http development by creating an account on GitHub.

view this post on Zulip Pat Hickey (Jun 30 2025 at 20:49):

i benchmarked using that version of that (very basic) component vs the prior commit which doesnt use component-init, and got 5x the RPS with the init version

view this post on Zulip Pat Hickey (Jun 30 2025 at 20:51):

when Joel gets time to review it, we can merge and publish to crates.io. I'm going to look into folding it into wizer next, because wizer has already designed and implemented (for preview 1 at least) a handful of things that component-init hasnt wrt allowing use of WASI

view this post on Zulip Pat Hickey (Jun 30 2025 at 20:51):

componentize-py has its own way of stubbing out wasi while in component-init that i havent fully understood yet

view this post on Zulip Joel Dice (Jun 30 2025 at 21:19):

The callback you pass to component_init::initialize is allowed to add whatever host functions it wants to the wasmtime::component::Linker (assuming you're using Wasmtime), including WASI or even custom host functions, which makes them available during pre-init. Note that if the guest does use WASI, it is also responsible for resetting the adapter and wasi-libc state with regards to stdio handles.

Contribute to bytecodealliance/componentize-py development by creating an account on GitHub.

view this post on Zulip Joel Dice (Jun 30 2025 at 21:20):

componentize-py also supports stubbing WASI so that the resulting component has no WASI imports, but that's somewhat orthogonal to how it uses component-init.

view this post on Zulip Joel Dice (Jun 30 2025 at 21:20):

(BTW, I'm reviewing the PR now)

view this post on Zulip Pat Hickey (Jun 30 2025 at 21:51):

thanks Joel!

view this post on Zulip Pat Hickey (Jun 30 2025 at 21:52):

I should make a crate, kinda like wasi, that provides the component-init wat glue as a library, and hooks it up to those wasi-libc and adapter bits

view this post on Zulip Pat Hickey (Jun 30 2025 at 21:52):

what should i call it

view this post on Zulip Joel Dice (Jun 30 2025 at 22:04):

Maybe component-init-rt or something? I can't think of anything else.

view this post on Zulip Pat Hickey (Jun 30 2025 at 22:14):

id like to make a proc-macro crate, itll need an -rt helper crate in the background i think

view this post on Zulip Pat Hickey (Jun 30 2025 at 22:15):

also i should probably make it work like ctor: https://crates.io/crates/ctor so that you can make any number of annotations and they all happen

view this post on Zulip Pat Hickey (Jun 30 2025 at 22:16):

so maybe component-init can search for all exports named component-init:run:<unique name, generated from FILE and LINE> and then finally do component-init:final, which would be the libc cleanup

view this post on Zulip Pat Hickey (Jun 30 2025 at 23:07):

i wonder if, instead of doing name-mangling at the top level, these functions should all be deposited into a component-init interface, in which case we get to use a namespace and package name. bytecodealliance:experimental/component-init ?

view this post on Zulip Pat Hickey (Jun 30 2025 at 23:07):

and then consider making it a wasi standard once we are satisfied with how it works?

view this post on Zulip Ralph (Jul 01 2025 at 07:18):

componinit

view this post on Zulip Ralph (Jul 01 2025 at 07:19):

just throwing that out there

view this post on Zulip Lann Martin (Jul 01 2025 at 12:46):

Not to be confused with the linting tool componit

view this post on Zulip Ralph (Jul 01 2025 at 13:04):

WUT

view this post on Zulip Lann Martin (Jul 01 2025 at 13:52):

compo-nit...
I'm just trying to make very good jokes like you Ralph.

view this post on Zulip Chris Fallin (Jul 01 2025 at 15:22):

Not to be confused with the linting tool componit

nor the tool that determines if a file is a component, componinnit?

view this post on Zulip Ralph (Jul 01 2025 at 15:39):

you people

view this post on Zulip Joel Dice (Jul 01 2025 at 15:53):

should we rename WAC to compoknit?

view this post on Zulip fitzgen (he/him) (Jul 01 2025 at 16:29):

I read "componit" as rhyming with "jump on it"

YouTube - - YouTube

view this post on Zulip Pat Hickey (Jul 01 2025 at 16:32):

i talked it through with joel and nick in DM, and the existing component-init crate has been renamed component-init-transform, so the guest crate can be named component-init

view this post on Zulip Pat Hickey (Jul 01 2025 at 16:32):

@Joel Dice want to publish component-init-{transform, wasmtime, cli} at 0.1.0? then ill update the componentize-py PR

view this post on Zulip Pat Hickey (Jul 01 2025 at 16:33):

I guess since theyre unpublished i could technically do so, if youd prefer me to, but its your repo.

view this post on Zulip Joel Dice (Jul 01 2025 at 16:34):

Yup, I'll do that shortly.

view this post on Zulip Pat Hickey (Jul 01 2025 at 16:40):

my current rough plan is that component-init-cli and -wasmtime will become part of wizer and go away completely, and then component-init-transform will become a dependency of wizer, and itll all probably move over into the wizer repo for ease of maintenance. but i want to prove out a few more ideas before im ready to do those steps

view this post on Zulip Joel Dice (Jul 01 2025 at 16:47):

Ok, they're all published

view this post on Zulip Pat Hickey (Jul 01 2025 at 16:50):

thanks!


Last updated: Dec 06 2025 at 05:03 UTC