@receptron/laya: run Laya from Node.js and TypeScript via ONNX Runtime
npm package that runs Laya with ONNX Runtime, no Python or PyTorch at runtime. Same request shape as TypeSafe's system_one API; output matches Python to four decimals.
~1.7 GB fp32 ONNX weights, budget ~2 GB RAM.
# @receptron/laya
Run **[Laya](https://huggingface.co/convaiinnovations/laya)** — the open-source, Jev-compatible
_System 1 decision model_ by Convai Innovations — from Node.js / TypeScript.
Laya does not generate text. You hand it a state (a ticket, an email, a JSON object) and typed
questions, and it returns every answer with calibrated probabilities in **one forward pass**:
- `choice` — pick one option, with a probability per option
- `score` — an expected level on an ordered rubric, with the distribution
- `noul` — a calibrated P(true) for a yes/no statement
This package runs the model with [ONNX Runtime](https://onnxruntime.ai/); PyTorch and Python are
not needed at runtime. The request/response shape is the same as the Python reference
implementation (`RLAgent.system_one`) and as TypeSafe Jev's `system_one` API, and the output
matches the Python implementation to four decimal places.
## Install
```sh
npm install @receptron/laya
```
Node.js 20 or newer; CI runs on Node 20, 22 and 24 (Linux, macOS, Windows). The `@types/node` version
in `devDependencies` is only for type-checking this package and does not require Node 24.
The ONNX weights (about 1.7 GB, fp32) are downloaded from Hugging Face on first use and cached under
`~/.cache/receptron-laya` (override with `LAYA_CACHE`). Budget roughly 2 GB of RAM for the loaded model
plus a few hundred MB per batch of questions.
The first `Laya.load()` therefore includes that download, so time it after the cache is warm. To
fetch the weights ahead of time (in a build step or container image), call `ensureBundle()`:
```sh
node -e 'import("@receptron/laya").then((m) => m.ensureBundle())'
```
Later loads only send a cheap freshness check and read from the cache (about 4 s on an Apple M4, [measured in #13](https://githu