@lute-lang/runtime
v0.47.1
Published
The Lute runtime for TypeScript hosts, in Effect: load a compiled Lute bundle, drive the resumable step function, replay input logs (Bun and browsers).
Downloads
537
Readme
@lute-lang/runtime
The Lute runtime for TypeScript hosts, in Effect 4:
load a bundle compiled by lute compile --all, drive the resumable step
function, query the state (view, evaluate, def, gate, candidates, …),
and replay input logs, on Bun and in browsers.
bun add @lute-lang/runtime [email protected] @effect/[email protected] @effect/[email protected]
# For a local pack, use the runtime tarball path printed by scripts/pack-local.sh:
# bun add @lute-lang/runtime@file:/path/to/lute-lang-runtime-<version>.tgz [email protected] @effect/[email protected] @effect/[email protected]
# or use the dependencies and overrides printed by scripts/pack-local.sh.
# or, for a browser application:
bun add @lute-lang/runtime [email protected] @effect/[email protected]The host guide — sessions, the Program API, errors, state interchangeability,
replay, and local dogfooding with packed tarballs — is
docs/runtime/typescript-runtime.md.
Building from the repository
The package wraps the wasm binding of crates/lute-runtime-wasm. In
packages/runtime:
bun install
bun run wasm:build # debug binding -> src/wasm/
bun run build # dist/: ESM entry points, declarations, the binding
bun run typecheck
bun run test # builds the binding first (incremental)bun run wasm:build:release builds the release binding and optimizes it with
wasm-opt -O; a published package ships that one.
Tools
wasm:build needs Rust with the wasm32-unknown-unknown target and
wasm-bindgen 0.2.126 — exactly the binding crate's wasm-bindgen
version. The script resolves it in this order:
$WASM_BINDGEN, a path to the binary;wasm-bindgenonPATH;- the wasm-pack cache entry of the pinned version,
<cache>/.wasm-pack/wasm-bindgen-cargo-install-0.2.126/wasm-bindgen(wasm-bindgen.exeon Windows), where<cache>is~/Library/Cacheson macOS,$XDG_CACHE_HOMEor~/.cacheon Linux, and%LOCALAPPDATA%on Windows — wasm-pack leaves it there after any build of a crate pinned to that version.
When none resolves, or the binary cannot be run or reports another version, the script prints
wasm-build: need wasm-bindgen 0.2.126 (set WASM_BINDGEN, put it on PATH, or cargo install --locked wasm-bindgen-cli --version 0.2.126)and exits 1. Install it with
cargo install --locked wasm-bindgen-cli --version 0.2.126.
wasm:build:release also needs binaryen's wasm-opt, from $WASM_OPT or
PATH.
The contract schemas under src/generated/ are generated from the Rust types:
bun run contract:gen regenerates them and bun run contract:check fails on
drift. Never edit them by hand.
