Skip to content

wizer: support init func as a wave function call (components only)#13582

Merged
pchickey merged 8 commits into
bytecodealliance:mainfrom
pchickey:pch/wizer_component_wave_exprs
Jun 8, 2026
Merged

wizer: support init func as a wave function call (components only)#13582
pchickey merged 8 commits into
bytecodealliance:mainfrom
pchickey:pch/wizer_component_wave_exprs

Conversation

@pchickey

@pchickey pchickey commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Wizer now supports wave function call expressions being used as an init func for components, e.g. local:local/init.add-string@0.1.0("hello, world")

This works from both the crate interface and the wasmtime-cli interface.

When wasmtime wizer --init-func (func expr) is used with a component, it will print the function results in wave to stdout. This opens up a clever mode where you can use a component on disk as a stateful rpc server with wave encoding for the request and response.

The diff for the change is straightforward. New test-program to exercise, and a test exercising this functionality has been added to the wizer crate and wasmtime-cli.

Docs for the wasmtime-cli options were updated, including a case I missed from run --invoke in #13564

@github-actions github-actions Bot added the wizer Issues related to Wizer snapshotting, pre-initialization, and the `wasmtime wizer` subcommand label Jun 6, 2026
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Subscribe to Label Action

cc @fitzgen

Details This issue or pull request has been labeled: "wizer"

Thus the following users have been cc'd because of the following labels:

  • fitzgen: wizer

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@pchickey pchickey force-pushed the pch/wizer_component_wave_exprs branch from 73ce7f0 to 0f52f6e Compare June 8, 2026 19:48
@pchickey pchickey marked this pull request as ready for review June 8, 2026 20:12
@pchickey pchickey requested a review from a team as a code owner June 8, 2026 20:12
@pchickey pchickey requested review from dicej and fitzgen and removed request for a team June 8, 2026 20:12
Comment thread crates/test-programs/src/bin/wizer_component_interfaces.rs
Comment thread crates/wizer/src/component/wasmtime.rs Outdated
.await
.with_context(|| format!("the initialization function trapped"))?;

// TODO: do we want some way to report the values of `rets` back up?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker for this PR, but it would be nice to return them from Wizer::run_component and, in the case of the CLI, print them to stdout.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and already done :) They actually already print to stdout in the cli because its using the run --invoke code under the hood in there -- command/wizer.rs is integrated so nicely with command/run.rs! great work @alexcrichton it was a joy to realize how little I had to do to benefit from that.

@pchickey pchickey enabled auto-merge June 8, 2026 22:50
@pchickey pchickey force-pushed the pch/wizer_component_wave_exprs branch from 766dc52 to cf7ba32 Compare June 8, 2026 23:10
@pchickey pchickey added this pull request to the merge queue Jun 8, 2026
Merged via the queue into bytecodealliance:main with commit 11bf6cc Jun 8, 2026
51 checks passed
@pchickey pchickey deleted the pch/wizer_component_wave_exprs branch June 8, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wizer Issues related to Wizer snapshotting, pre-initialization, and the `wasmtime wizer` subcommand

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants