feat(website/sandbox): add Run panel#142
Open
rvolosatovs wants to merge 1 commit into
Open
Conversation
af65e43 to
ec766af
Compare
ecioppettini
reviewed
Jun 8, 2026
| //! Wasmtime "custom platform" implementation for a browser-like wasm32 host. | ||
| //! | ||
| //! Wasmtime doesn't recognize wasm32 as a supported OS, so with the | ||
| //! `custom-virtual-memory` feature it calls out to a small C-ABI for its |
Contributor
There was a problem hiding this comment.
cool, I did miss this feature before somehow
Contributor
Author
|
I'll rework this to integrate #150 and the updated UI |
4a82b2c to
d49410d
Compare
rvolosatovs
commented
Jun 17, 2026
rvolosatovs
commented
Jun 17, 2026
rvolosatovs
commented
Jun 17, 2026
rvolosatovs
commented
Jun 17, 2026
c5f347f to
8497d2b
Compare
There was a problem hiding this comment.
Pull request overview
Adds an initial “Run” panel to the website sandbox by introducing a long-lived run worker and extending the starstream-sandbox-web Wasm module to host a minimal contract runtime (deploy → construct UTXOs → call methods, plus storage + events).
Changes:
- Add
website/src/run.worker.tsand a new Run tab UI inwebsite/src/pages/sandbox.tsxfor deploy/construct/call/storage/events. - Extend
starstream-sandbox-webwith a Wasmtime-on-wasm32 “custom platform” + runtime entrypoints (deploy,construct,call, etc.). - Introduce
starstream-runtime-nextand atest-contractshelper crate +examples/score.star+ runtime tests.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| website/src/sandbox.worker.ts | Add no-op import hooks required by the expanded Wasm ABI (run tab handled elsewhere). |
| website/src/run.worker.ts | New WebWorker that keeps one Wasm instance alive to persist runtime state across messages. |
| website/src/pages/sandbox.tsx | New Run tab UI: deploy component, construct UTXOs, call methods, view storage/events/logs. |
| website/src/editor.tsx | Update default example program to the “score” contract used by the Run panel/tests. |
| website/src/css/custom.css | Styling for the Run tab (deploy selector, cards, logs, forms). |
| test-contracts/src/lib.rs | Expose compiled example contract bytes via include_bytes!. |
| test-contracts/Cargo.toml | New crate manifest for building/embedding example contracts. |
| test-contracts/build.rs | Build script compiling examples/*.star to core Wasm into OUT_DIR. |
| starstream-to-wasm/Cargo.toml | Align wasmtime dev-dep usage with workspace configuration. |
| starstream-sandbox-web/src/platform.rs | Add wasm32-friendly Wasmtime “custom virtual memory” platform ABI implementation. |
| starstream-sandbox-web/src/lib.rs | Add runtime entrypoints + JSON/Val plumbing + deploy/construct/call/storage/events. |
| starstream-sandbox-web/Cargo.toml | Add runtime + wasmtime/cranelift deps required for in-browser execution. |
| starstream-sandbox-web/build.rs | Add wasm stack-size linker arg for deploy-time compilation recursion. |
| starstream-runtime-next/tests/score.rs | New integration tests validating UTXO construction, calls, storage and events. |
| starstream-runtime-next/src/lib.rs | New runtime crate wrapping Wasmtime component model for UTXO construction/calls/storage. |
| starstream-runtime-next/Cargo.toml | New crate manifest (features + deps) for runtime-next. |
| starstream-cli/Cargo.toml | Use workspace serde_json dependency. |
| rust-toolchain.toml | Bump pinned Rust toolchain version. |
| interleaving/starstream-runtime/Cargo.toml | Switch wasmtime dep to workspace version. |
| interleaving/starstream-component-runtime/Cargo.toml | Switch wasmtime dep to workspace version. |
| examples/score.star | Add score example contract source used by sandbox/tests. |
| Cargo.toml | Add new workspace members and workspace deps. |
| Cargo.lock | Lockfile updates for new crates/deps (including Wasmtime 46 line for sandbox/runtime-next). |
| .cargo/config.toml | Add wasm32 linker flag for importing undefined symbols on newer toolchains. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8497d2b to
238dc12
Compare
238dc12 to
186fbfa
Compare
|
|
||
| /// Flush and report the ABI events buffered during an operation. | ||
| fn flush_events(events: &Rc<RefCell<Vec<Value>>>) { | ||
| let drained: Vec<Value> = std::mem::take(&mut events.borrow_mut()); |
Comment on lines
+271
to
+274
| self.onmessage = async function ({ data }: { data: RunWorkerRequest }) { | ||
| request_id = data.request_id; | ||
| const wasm = await getWasmInstance(); | ||
| try { |
rvolosatovs
added a commit
that referenced
this pull request
Jun 23, 2026
Migrate the runtime crate from https://github.com/rvolosatovs/starstream-run/ This requires a git rev of Wasmtime and will continue to do so until Wasmtime 47 release, i.e. ~1 month, so for now introduce a custom Wasmtime version (and related tooling) only for this crate This will be used by the website sandbox (#142 ) as well as the mock-ledger. This PR also adds an `examples` dir with the score example I've been using for testing. That example is now compiled to Wasm and available via `test-contracts` crate. ~Blocked on #149~ --------- Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Add a Run tab to the website sandbox: a long-lived run worker drives the compiled contract through deploy → construct UTXOs → call methods, with storage and event views. Built on `starstream-runtime-next` (LFDT-Nightstream#150); the sandbox is pinned to the exact Wasmtime rev that crate uses so their `Utxo`/`bindings`/`Val` types unify into one `wasmtime` instance. Assisted-by: anthropic:claude-opus-4-8 Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
186fbfa to
f0b146c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a basic "Run" panel to the sandbox, which allows "deploying" the contract and then "creating" multiple instances of UTXOs out of them for calling individual exports. This is just the first sketch, which will likely change significantly going forward.
Recording of the UI available here: https://www.youtube.com/watch?v=CcCSNLWJmnY
Blocked on #150