Skip to content

feat(plugin-wasm): migrate plugin system to WASI 0.3 / component-model async#588

Open
staging-devin-ai-integration[bot] wants to merge 6 commits into
mainfrom
devin/1781273412-wasi-0-3-plugins
Open

feat(plugin-wasm): migrate plugin system to WASI 0.3 / component-model async#588
staging-devin-ai-integration[bot] wants to merge 6 commits into
mainfrom
devin/1781273412-wasi-0-3-plugins

Conversation

@staging-devin-ai-integration

@staging-devin-ai-integration staging-devin-ai-integration Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Migrates the WASM plugin system to WASI 0.3 / Component Model native async in a single lane (no 0.2 compatibility world, per discussion): process, update-params, and the send-output host import are now async func in wit/plugin.wit@0.2.0.
  • Host moves to wasmtime 45 with component_model_async: guest calls run inside store.run_concurrent, and async imports are implemented via the generated HostWithStore trait. This unblocks future concurrent/cancellable guest calls and stream<T> pins.
  • The WIT deps are vendored from the exact wasi:cli@0.3.0-rc-2026-03-15 snapshot wasmtime 45's p3 host links against (final 0.3.0 WITs aren't in wasmtime yet). The linker registers both p2 and p3 WASI because Rust's wasm32-wasip2 std still imports wasi@0.2 interfaces.
  • Rust SDK regenerated with wit-bindgen 0.58 (async guest bindings; runtime now lives in wit_bindgen::rt, replacing the dead wit-bindgen-rt crate); guests build with plain cargo build --target wasm32-wasip2cargo-component and wkg are no longer needed.
  • C SDK + gain example migrated to the async callback ABI (subtask parked in a waitable set when send-output doesn't complete synchronously). Go is left behind for now: wit-bindgen-go cannot parse async WIT yet, so the Go example/bindings stay on the old world with a README notice and the just recipe disabled.

Review & Validation

  • cargo test -p streamkit-plugin-wasm --test gain_plugin_smoke -- --ignored passes after building the Rust (just build-plugin-wasm-rust) and C (just build-plugin-wasm-c, needs wasi-sdk) examples — drives a real component through the full async host path (construct → process → routed output → shutdown).
  • Sanity-check the dual p2+p3 linker setup in crates/plugin-wasm/src/lib.rs and the run_concurrent loop in wrapper.rs for cancellation/shutdown behavior.
  • Existing oneshot sample samples/pipelines/oneshot/gain_filter_rust.yml still exercises the plugin end-to-end via tests/pipeline-validation.

Notes

  • wasmtime's p3 host is still documented as experimental; we accepted that risk explicitly given v0.x status and no real-world WASM plugins yet.
  • Follow-ups: re-enable Go bindings once wit-bindgen-go gains component-model async support; consider stream<packet>-shaped pins as a next step.

Link to Devin session: https://staging.itsdev.in/sessions/8a4721b3ccbb4a4d9ea85422ade86fdf
Requested by: @streamer45


Devin Review

Status Commit
🟢 Reviewed 9a6cd73
Open in Devin Review (Staging)

…sync

Bumps wasmtime to 45 with the experimental WASIp3 host, vendors the
wasi@0.3.0-rc-2026-03-15 WITs that wasmtime 45 links against, and makes
process/update-params/send-output native async funcs driven through
store.run_concurrent.

Signed-off-by: streamkit-devin <devin@streamkit.dev>
Regenerates the SDK with wit-bindgen 0.58 (async guest support), makes the
example's process/update-params async, and builds it as a component via
plain cargo + wasm32-wasip2 (no cargo-component). The host links both
wasi p2 and p3 since Rust's wasip2 std still imports wasi@0.2.

Signed-off-by: streamkit-devin <devin@streamkit.dev>
Signed-off-by: streamkit-devin <devin@streamkit.dev>
Regenerates the C bindings with wit-bindgen 0.58 and rewrites the example's
process/update-params for the component-model-async callback ABI, parking
the send-output subtask in a waitable set when the host doesn't complete
synchronously. Verified end-to-end (Rust + C) by an ignored smoke test that
drives prebuilt example components through the new host.

Signed-off-by: streamkit-devin <devin@streamkit.dev>
Signed-off-by: streamkit-devin <devin@streamkit.dev>
Signed-off-by: streamkit-devin <devin@streamkit.dev>
@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review (Staging)
Debug

Playground

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 38.70968% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.27%. Comparing base (1b95ca2) to head (9a6cd73).

Files with missing lines Patch % Lines
crates/plugin-wasm/src/lib.rs 48.00% 13 Missing ⚠️
crates/plugin-wasm/src/wrapper.rs 0.00% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (38.70%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #588      +/-   ##
==========================================
- Coverage   82.43%   82.27%   -0.17%     
==========================================
  Files         240      240              
  Lines       71297    71416     +119     
  Branches     2249     2249              
==========================================
- Hits        58773    58755      -18     
- Misses      12520    12657     +137     
  Partials        4        4              
Flag Coverage Δ
backend 82.23% <38.70%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 85.67% <ø> (ø)
engine 83.33% <ø> (-0.09%) ⬇️
api 91.14% <ø> (ø)
nodes 82.78% <ø> (-0.05%) ⬇️
server 80.52% <ø> (ø)
plugin-native 83.89% <ø> (ø)
plugin-wasm 82.49% <38.70%> (-9.72%) ⬇️
ui-services 85.04% <ø> (ø)
ui-components 64.05% <ø> (ø)
Files with missing lines Coverage Δ
crates/plugin-wasm/src/wrapper.rs 66.02% <0.00%> (-30.35%) ⬇️
crates/plugin-wasm/src/lib.rs 86.35% <48.00%> (-2.09%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant