Loading files
# Toolchain
`jev.mjs` is the shared Jev client: a tiny, dependency-free wrapper for TypeSafe AI's "System One"
decision model (`POST /v1/systemone`), with a deterministic mock fallback so everything runs offline
and in tests.
- Without `TYPESAFE_API_KEY`, `evaluate()` returns deterministic, stable answers from a local mock —
it exercises the plumbing (typed questions, probability shaping, confidence) exactly as live Jev
would, but is **not** a stand-in for Jev's judgement.
- With `TYPESAFE_API_KEY` set, the same call hits the real model.
Three question types (see `jev.mjs` builders):
- `jev.noul("...")` — a yes/no probability (0..1).
- `jev.choice(options, "...")` — 1 of up to 255 options, plus per-option probabilities + confidence.
- `jev.score(legend, "...")` — a position on a 2..10 level scale.
`evaluate({ state, questions, key, model, salt })` returns `{ answers, model, client, usage }`,
with `answers[questionId]` shaped by question type. Use it to audition your piece design before you
commit to it — the viewer and any direct calls share the same client.
## Going live
Without a key everything runs on the offline stand-in and the pane says `MOCK`. For the real model,
give the harness a key. The viewer is started by the Harness daemon, which does not see variables
you export in a shell, so the reliable place is a small file in your home folder:
```sh
mkdir -p ~/.config/typesafe && chmod 700 ~/.config/typesafe
printf 'TYPESAFE_API_KEY=%s\n' 'paste-your-key-here' > ~/.config/typesafe/credentials
chmod 600 ~/.config/typesafe/credentials
```
Three routes work, and all speak the same question format:
| route | what goes in the file | where to get it |
|---|---|---|
| TypeSafe direct | `TYPESAFE_API_KEY=...` | https://console.typesafe.ai/keys (there may be a waitlist) |
| Cloudflare Workers AI | `CLOUDFLARE_ACCOUNT_ID=...` and `CLOUDFLARE_API_TOKEN=...` | a Cloudflare API token with Workers AI permission, no TypeSafe waitlist |
| OpenRouter | `OPENROUTER_API_KEY=...` | https://openrouter.ai/keys, no waitlist. It is an alpha endpoint. Measured on 2026-09-20: about 0.45 s a call once warm (others have reported up to 2 s). Batch harnesses fly; the real-time games run at about two decisions a second instead of nine |
When more than one is present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter. Environment variables of the same names win over the file. Restart the harness after changing the
file. `toolchain/doctor.sh` prints which route is active and never prints the key. One file serves
every Jev harness on the machine. Never paste a key into the chat, and never save one in the
workspace. Under `node --test`, or with `JEV_OFFLINE=1`, a key is ignored so tests stay deterministic.
442335385This file is pinned to the selected release. Download the original to open it in your design tool.