wazero

package
v0.2.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: MPL-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wazero is the reference in-process compute engine: it runs a content-addressed WASI module on the pure-Go wazero runtime (no CGO). The ABI is WASI command style — input JSON arrives on stdin, output JSON is read from stdout, log lines go to stderr. Any language that compiles to a conforming WASI module (Rust, TinyGo, JS via Javy/QuickJS, …) runs here unchanged; the language is a build-time concern.

Two module shapes run here, detected automatically:

  • Self-contained: the whole runtime is in the module (Rust/TinyGo native wasm, or a static `javy build`). Compiled once, instantiated per call.
  • Dynamically linked Javy: a tiny (~1 KB) module carrying only the op's JS bytecode, importing `invoke`/`cabi_realloc`/`memory` from the shared QuickJS plugin (chassis/compute/javyplugin). The engine links it against that plugin so thousands of ops share one ~1.25 MB engine instead of embedding it per op. See the dynamic-link section below.

Sandbox posture ("restricted WASI"): no filesystem, no network, no env, no args. Wall clock is frozen and randomness is a fixed-seed PRNG — deterministic rather than denied, since real guest runtimes call clock/random at startup (denying breaks them) but exposing the host's would be ambient nondeterminism. Monotonic time is the one exception: guest runtimes require it to advance, so the host monotonic clock is used (a minor timing channel, no other authority). Memory is capped (runtime config) and a per-invocation wall-clock deadline kills a runaway guest (CloseOnContextDone inserts interrupt checks at loop back-edges and calls).

CAVEAT — guest-language RNGs are NOT made deterministic by the fixed-seed random_get above. QuickJS's Math.random() seeds from the monotonic clock, not random_get, so it varies across runs (non-reproducible; monotonic-seeded ⇒ not crypto-grade). This is harmless: computes run exactly once (no replay). Don't assume reproducible randomness from a guest unless you control its seed.

Activate with a blank import:

import _ "github.com/loremlabs/thanks-computer/chassis/compute/wazero"

Index

Constants

View Source
const Name = "wazero"

Name is the registered engine identifier.

Variables

This section is empty.

Functions

func New

New builds the engine. The runtime enables context-deadline interruption (for the wall-clock limit) and an optional memory cap.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL