@openexam/runtime-wasi
v0.1.0
Published
WASM-sandboxed runtimes for student-code execution (per ADR-005). v1 ships JavaScript via QuickJS-WASM; Pyodide for Python is a v2 follow-on.
Readme
@openexam/runtime-wasi
WASM-sandboxed runtimes for student-code execution (per
ADR-005).
The host instantiates a Runtime for the desired language and
calls runtime.run({ source, stdin, fuelMs }); output is
captured per RuntimeResult.
v1 ships JavaScript via QuickJS-WASM. Pyodide for Python is a
follow-on against the same Runtime interface.
import { javascriptRuntime } from '@openexam/runtime-wasi';
const js = javascriptRuntime();
const result = await js.run({
source: `console.log(1 + 2)`,
fuelMs: 1000,
});
// result.stdout === '3\n'
// result.exitCode === 0The runtime injects a small student-facing API:
console.log(...args)— comma-joined output to stdout.print(...args)— alias forconsole.log.readline()— returns the next line of stdin, or null at EOF.
Determinism guarantees per ADR-005: no clock, no RNG (the host's
seeded RNG isn't exposed in the student runtime), no network, no
filesystem. The fuel limit (fuelMs, default 2000 ms) is
enforced via QuickJS's interrupt handler.
License
Apache-2.0. See LICENSE and the canonical ../../LICENSE at the repository root.
