Jev Broadcast Lab
September 20, 2026 · View on GitHub
Public operator lab for TypeSafe Jev (System One). Live site: 4anti.github.io/jev-broadcast-lab.
Jev is a closed-schema judge. It returns Choice, Score, and Noul. It does not write commentary, invent legal chess moves, or emit free-form JSON. This repository is the playground we built after joining the TypeSafe waitlist: a chess match as the flagship page, a row of smaller judgment booths that reuse the same client, and a separate Fast Flag catalog that does not share the broadcast chrome.
This is not a chess engine, not a chatbot, and not an official TypeSafe product.
Acknowledgment
We applied to the TypeSafe Jev waitlist and were accepted. Thank you to the TypeSafe team for the access, the documentation, and the Choice / Score / Noul contract. The lab is independent work. It is meant to show what System One can do under a tight schema, not to speak for TypeSafe.
TypeSafe docs: docs.typesafe.ai
What we built
The job was to run Jev in public without putting the API key in the browser, and to keep a hard line between judgment (Jev) and facts (our code).
What that turned into:
- A static site under
web/. GitHub Pages can host it. Nothing in that folder is allowed to holdTYPESAFE_API_KEY. - A local Python server (
server.py) for operators. It servesweb/and attaches the key from.envon same-origin/v1/systemonecalls. - A Cloudflare Worker (
proxy/worker.js) for the public site. Pages JavaScript talks only to that worker. The worker holds the key, checks Origin andSec-Fetch-Site, issues an HttpOnly session cookie, and rate-limits to 400 calls per IP per minute. - One shared client (
web/shared/jev-client.js,booth.js,chrome.js). Every booth uses the samePOST /v1/systemonepath, the same HUD (model, latency, token count), and the same answer painting (Choice bars, Score / Noul meters). - Chess as the stress test. chess.js 1.4 owns legality. Jev only picks among a closed LAN list (cap 255). Stockfish.js 18 lite WASM runs in the browser for an operator HUD. Engine centipawns, best move, PV, accuracy, and captures never go into Jev's payload.
- Smaller booths that reuse the same contract on tickets, safety, search, chat, emotion, debate, cheating cases, tool names, PGN snippets, and a tiny grid.
- A Fast Flag catalog at
/flags/. That is a second product in the same repo: dump-gated Roblox ClientAppSettings packs, a Picker, and a Builder. Black and white pages, not the esports HUD.
GitHub Actions deploy Pages on every push to main and refuse a tree that looks like it contains a TypeSafe key or a personal email. A second workflow deploys the Worker when proxy/ changes.
How Jev is used here
System One is called as jev-latest on POST /v1/systemone. Each request sends state plus named questions. Each question is one of:
| Type | What Jev returns | What we do with it |
|---|---|---|
| Choice | One key from a closed criteria map, plus confidence and probabilities | Route, moderate, pick a move, name a fallacy |
| Score | A number on a labeled scale | Urgency, intensity, quality |
| Noul | A 0 to 1 mass | Hate, spam, refund, secrecy, threat. Often unused by the gate on purpose |
Rules we kept:
- Choice lists stop at 255 options. Longer lists are truncated in code, with a count shown to the operator.
- Independent questions in one request cannot see each other's answers. If a later pick needs an earlier pick, we put the earlier pick in
stateon the next call. - Calibration is not per-answer truth. The HUD paints what Jev returned. It does not relabel probabilities as engine eval or as win percentage.
- Gates live in page code. Safety filter is the clear example: Jev proposes pass / review / block, then this page applies a confidence floor.
Chess payload is compact on purpose: fen, stm, last, phase, ending, plus one-ply LAN tags. Rich mode adds tags. It does not add Stockfish.
How a page is wired
A booth is a small HTML file plus a module. Chrome injects the top strip, the left nav, and the ticker. The rack on the right holds the form. The stage on the left holds examples and answers.
Typical path:
- Operator picks a preset or types into the rack.
- The module builds
stateandquestions. runSystemOnegoes to the local proxy, or to the Cloudflare worker whenconfig.jsonhas aproxyURL (Pages injects that at deploy time).paintAnswersdraws the Choice / Score / Noul blocks. Bad labels (block, hate, ad hominem, affair) render in program red. Bars fill left to right.
The public worker only answers the lab origin (https://4anti.github.io by default). A script that fakes headers can still spend quota. Cloudflare Access is the next step if that is not enough. Paste-a-key in the rack remains for visitors who bring their own TypeSafe key. Direct browser calls to api.typesafe.ai may fail CORS.
What is on the site
| Route | Page | What it does |
|---|---|---|
/ | Home | Live strip, a probe that asks Jev what this page is, links to every booth |
/arena/ | Chess match | Human vs Jev or Jev vs Jev. See the section below |
/lab/router/ | Ticket desk | Choice of billing / support / sales / legal, a Score for how fast a human should look, a Noul for whether a refund is in play |
/lab/guard/ | Safety filter | Jailbreak and harm questions, then a code gate (pass / review / block plus a confidence floor). Jev does not enforce the policy |
/lab/rank/ | Document find | Choice over passage ids. Code truncates to 255 and highlights the hit line |
/lab/mod/ | Chat mod | Choice of allow / warn / block. Hate and spam Nouls ride along and are unused by the gate |
/lab/emotion/ | Chat emotion | Closed emotion list (on the order of ninety English labels), then mix, intensity, and whether the writer is hiding it. Not a diagnosis |
/lab/debate/ | Debate move | Closed list of fallacies and valid counters (ad hominem, straw man, tu quoque, whataboutism, Gish gallop, steelman, reductio, on-point rebuttal, and the rest of that map). Also: target, whether it answers the claim, quality |
/lab/cheat/ | Cheating or not | Thirty sourced scenarios: micro / gray, clearer sexual or emotional lines, couple-contract and community or religious frames. Verdict is a closed scale. Secrecy is a separate Noul. Lab toy, not counseling or religious law |
/lab/call/ | Tool call | Choice of function name and enum args. Amounts are parsed in JavaScript with Number(). Jev never emits a JSON tool blob |
/lab/pgn/ | PGN puzzles | Opening Choice over a few first-move LANs. A blunder Noul is compared to local chess.js facts, not treated as truth |
/lab/loop/ | Grid turns | 8x8 toy. Each tick Jev chooses a move, whether to shoot, and a threat Score |
/flags/ | FFlag catalog | Separate B&W site. See the catalog section |
Home, Ticket desk, Safety filter, and the other booths ship with at least five worked examples so the rack is not an empty textarea.
Chess match
Human vs Jev, or Jev vs Jev. The instruction box is a short Choice label. It does not teach chess. Filters do, in this order:
- keep mates only, if any exist
- drop stalemate, threefold, and fifty-move when a real LAN still exists
- drop quiet checks unless they mate, win material, or tighten a KQK / KRK box
That is a one-ply heuristic, not a forced-mate solver.
The board is gchessboard plus chess.js. Material strips are local: they show missing opposing pieces versus a standard start, queens first. Custom FENs and promotions can differ from capture history. Replay updates material and the eval graph together.
When a game ends, an overlay shows the local scorecard and offers Play again (same FEN, mode, and colors) or Close.
Operator review
On by default. Bundled Stockfish WASM, depth 10, two-second search ceiling. Play does not wait for analysis. Off stops the worker. On again backfills unrated positions. A new match clears ratings.
Move labels are local CP-loss buckets: Best is the engine's preferred move; otherwise Excellent ≤25, Good ≤50, Inaccuracy ≤100, Mistake ≤200, Blunder >200. Losses are capped at 1,000 centipawns. Estimated accuracy is max(0, 100 - 0.5 × ACPL), not Chess.com's formula. Unrated plies are omitted. Each plate shows how many plies are rated.
Engine provenance and GPL: web/vendor/stockfish/README.md.
Jev score
Stored in this browser. Finished games add White wins, Black wins, draws, and Jev W-D-L against a human. Jev vs Jev updates color wins only. Strength uses Jev plies only.
Elo is interpolated from community ACPL bands (100 ACPL ≈ 1000, 220 ACPL ≈ 200) after scaling depth-10 loss by sqrt(18/10). Stockfish UCI_Elo starts at 1320. Below that the plate says below Stockfish. Not FIDE. Abandoned matches do not count. Reset score clears local totals. None of this is sent to Jev.
Fast Flag catalog
A second site at /flags/, built from community ClientAppSettings packs plus a dump gate. Pack names are claims, not measured FPS. Chess chrome is not reused.
| Page | Role |
|---|---|
| Wiki | Per-flag notes, tags, dump misses |
| Browse | Cleaned flags with pack counts |
| Picker | Rank intact source combinations. Jev may pick one unchanged pack |
| Builder | New combinations with constrained beam search or sequential Jev decisions |
| Tune | Add or remove cleaned flags, copy JSON |
| Primer | Prefixes, Player allowlist, dump gate |
Builder hardware, FPS target, visual policy, locks, exclusions, and size limits are enforced before export. Local search runs in a cancellable worker. Jev's per-round scoring also runs in the worker, reusing corpus indexes and scoring caches while the page handles API requests. AI builds have a strict 12-call limit and never silently substitute a choice for an invalid model reply.
The local predictor is trained on deduplicated flag/value combinations with regularized logistic regression. Shared-source and near-duplicate groups stay together in its holdout evaluation. The shipped model uses 109 examples; held-out hidden-choice precision@5 is 77.96%, compared with 69.89% for a frequency baseline (88 training / 21 held-out examples). This measures reconstruction of pack contents, not FPS or latency improvement. Actual before/after trials saved in your browser influence rankings separately. No Jev weights are modified.
Pipeline notes: scripts/fflags/README.md. Drop new packs in FFlag Analysis HTML/ and rerun python scripts/fflags/build.py.
Stack
| Piece | Role |
|---|---|
| TypeSafe Jev | Closed-set judgment (jev-latest via POST /v1/systemone) |
| chess.js 1.4 | Legal moves, FEN, SAN, LAN |
| Stockfish.js 18 lite WASM | Operator review only. Depth 10, 2s ceiling. White-pov CP |
server.py | Serves web/ locally and holds TYPESAFE_API_KEY |
| GitHub Pages | Static UI. No API key in the bundle |
proxy/worker.js | Public key holder, origin bind, cookie, rate limit |
.github/workflows/pages.yml | Secret scan, inject JEV_PROXY_URL into published config.json, deploy web/ |
.github/workflows/proxy.yml | Deploy the Worker with TYPESAFE_API_KEY as a Worker secret |
Run locally
You need Python 3 and a TypeSafe API key.
copy .env.example .env # Windows
# cp .env.example .env # macOS / Linux
Set TYPESAFE_API_KEY in .env. Then:
python server.py
.env is gitignored. Do not commit it. Do not put the key in web/.
GitHub Pages and the API key
GitHub Pages is a static host. Anything in the published web/ folder is public. Putting TYPESAFE_API_KEY in the site, in a Pages build, or in a committed config.json would leak it. The key stays in .env on your machine and, for the public site, in GitHub Actions secrets. It never ships in JavaScript.
Local live Jev: python server.py with .env. That is the supported operator path.
There is no way to use the TypeSafe key on the public site without storing it somewhere you control. If it is in JavaScript, anyone can copy it. If the browser never sees it, a server (this proxy, or server.py) must hold it and attach it.
Public live Jev uses that proxy:
- Create a free Cloudflare account.
- Add repo secrets
CLOUDFLARE_API_TOKEN,CLOUDFLARE_ACCOUNT_ID, andTYPESAFE_API_KEY. - Run the
proxyworkflow. It deploysproxy/worker.js. - Copy the worker URL (example:
https://jev-broadcast-lab.<subdomain>.workers.dev) into repo secretJEV_PROXY_URL. - Re-run the
pagesworkflow. The published site then calls the proxy. The browser never sees the TypeSafe key.
If you host server.py yourself instead, set CORS_ORIGINS=https://4anti.github.io and use that host as JEV_PROXY_URL.
Checks
npm ci
npm test
npm run test:engine
npx playwright install chromium
# python server.py in another terminal:
npm run test:browser
Browser checks use real Stockfish and intercept Jev requests. They do not spend API credits.
FFlag catalog checks:
python scripts/fflags/parse.check.py
python scripts/fflags/learning.check.py
python scripts/fflags/train.check.py
python scripts/fflags/build.py --offline --skip-cdn
node web/flags/js/builder-engine.check.js
node scripts/fflags/payload.check.js
# python server.py in another terminal:
npm run test:flags
npm run test:flags:performance checks full-catalog Jev composition under 4× browser CPU throttling, including UI responsiveness, cancellation during search and network waits, late replies and server errors. API responses are mocked.
Docker
docker build -t jev-lab .
docker run --rm -p 8787:8787 -e TYPESAFE_API_KEY jev-lab
Pass the key from your environment. Do not bake it into the image.
License notes
Lab code in this repository is provided as-is for operators with TypeSafe access.
The Stockfish.js worker under web/vendor/stockfish/ is GPL-3.0. Keep the license, AUTHORS, and corresponding-source links when you copy those files.