Slice 1 — WASIX skeleton + hello-world smoke test#367
Merged
Conversation
Adds lib/wasix/wasix-32v1.ts: the ABI module for the wasix_32v1 import namespace, mirroring the structure of lib/wasi/snapshot-preview1.ts. Every syscall in wasix_32v1 returns ENOSYS this slice; later slices wire providers as they implement each group. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WASIXContext is the execution context passed to WASIX.start(). It has the same fs/args/env/stdin/stdout/stderr/isTTY/debug surface as WASIContext and adds optional provider slots (clock, random, tty, threads, futex, signals, sockets, proc). All provider methods are synchronous; async-capable variants live in providers/async.ts for WASIXWorkerHost (future slice). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…reads, Futex, Signals, Sockets, Proc Raw synchronous provider interfaces consumed by the WASIX class. No Promise return types — every method is called synchronously from inside the WebAssembly guest. AsyncCapable<T> lifts any provider to optionally return Promises; those variants are accepted by WASIXWorkerHost (Slice 4) via the syscall bridge. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…iew1/unstable to internal WASI WASIX is a sibling of WASI (not a subclass). It composes a WASI instance internally to service wasi_snapshot_preview1 and wasi_unstable imports. Memory is owned by WASIX and shared with the internal WASI instance via direct field assignment after instantiation. getImportObject() returns all three namespaces: wasix_32v1 (all stubs), wasi_snapshot_preview1, and wasi_unstable (both delegated). proc_exit in preview1/unstable is intercepted to throw WASIXExit so WASIX.start() can catch it without depending on WASI's private WASIExit class. Also adds WASIXExecutionResult to lib/types.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ses WASIX + WASIXContext on window Adds WASIX, WASIXContext, WASIX32v1 namespace, all provider interfaces, and AsyncCapable types to the package root export. Attaches WASIX and WASIXContext to window alongside the existing WASI surface so Playwright injected tests can reach them via page.evaluate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… wat2wasm in build:tests Slice 1 proves preview1 delegation only; wasix_32v1 imports are ENOSYS-stubbed. A cargo-wasix "hello, world" would exercise wasix_32v1 for stdout and hit ENOSYS, so the smoke binary is hand-rolled in WAT (fd_write + proc_exit from wasi_snapshot_preview1). The Rust/cargo-wasix version will land in a later slice once wasix_32v1 providers are wired up.
…o, world\n" across chromium/firefox/webkit
…se headers when threads land
…hain is available The Rust source is the intended build target for cargo wasix; the committed wasix-hello.wasm is built from the equivalent wasix-hello.wat until the cargo-wasix toolchain is set up (test:cargo-wasix in test:prepare). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… that wires the toolchain end-to-end
…ttern so fresh checkouts get a clear hint instead of silent failure
Ben asked us to skip the hand-rolled WAT smoke binary and reuse an existing WASI preview1 test (hello-world.wasi.wasm, already built from packages/wasi/programs/src/bin/hello-world.rs by build:tests). This removes the wasix-hello/ WAT source, the committed wasix-hello.wasm artefact, the .gitignore exception, and the wat2wasm/test:wabt wiring in package.json. The smoke test is rewired in the next commit.
Use the existing WASI preview1 Rust hello-world (built from packages/wasi/programs/src/bin/hello-world.rs) instead of the now-removed wasix-hello.wasm. WASIX delegates preview1 fd_write / proc_exit to its internal WASI, so running a plain preview1 binary under WASIX is exactly the smoke test we want for slice 1. Renamed the spec file from wasix-hello.spec.ts → wasix-smoke.spec.ts since "wasix-hello" no longer has a referent.
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.
Summary
Stands up the
WASIXclass skeleton perWASIX-PLAN.md:WASIX(sibling ofWASI, not subclass) — composes an internalWASIand delegateswasi_snapshot_preview1/wasi_unstableto it; owns memory and shares it with the internal WASI;start()returnsWASIXExecutionResult.WASIXContext— mirrorsWASIContext, with optional synchronous provider slots (stored, not wired this slice).wasix-32v1ABI module —Resulterrno enum (parallels preview1's),ClockId,Signal. Everywasix_32v1import is stubbed toENOSYS. No speculative ABI.providers.ts) —ClockProvider,RandomProvider,TTYProvider,ThreadsProvider,FutexProvider,SignalsProvider,SocketsProvider,ProcProvider. NoPromisereturn types.AsyncCapable<T>generic + derivedAsyncClockProvider, … (providers/async.ts) — worker-only, consumed byWASIXWorkerHostin a later slice.lib/main.tsre-exportsWASIX,WASIXContext, all provider types;src/main.tsputsWASIX+WASIXContextonwindowfor Playwright.hello-world.wasi.wasm(built frompackages/wasi/programs/src/bin/hello-world.rs); Playwright assertsexitCode === 0andstdout === "hello, world\n"across chromium / firefox / webkit.vite.config.jscarries a comment noting COOP/COEP will be needed in Slice 4; headers stay off for now.Deviation note — preview1 smoke binary, not
cargo wasixThe plan originally mentioned a Rust program compiled via
cargo wasix. A cargo-wasixprintln!("hello, world")routes stdout through thewasix_32v1namespace, which this slice stubs toENOSYS— the binary would never print. Since WASIX delegateswasi_snapshot_preview1back to its internal WASI, running the existing preview1hello-world.wasi.wasmunder WASIX is exactly the smoke test we want for Slice 1. Acargo wasixvariant will land in a later slice oncewasix_32v1providers are wired up.Test plan
Follow-ups (separate PRs, stacked on this one)