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:

  1. A static site under web/. GitHub Pages can host it. Nothing in that folder is allowed to hold TYPESAFE_API_KEY.
  2. A local Python server (server.py) for operators. It serves web/ and attaches the key from .env on same-origin /v1/systemone calls.
  3. A Cloudflare Worker (proxy/worker.js) for the public site. Pages JavaScript talks only to that worker. The worker holds the key, checks Origin and Sec-Fetch-Site, issues an HttpOnly session cookie, and rate-limits to 400 calls per IP per minute.
  4. One shared client (web/shared/jev-client.js, booth.js, chrome.js). Every booth uses the same POST /v1/systemone path, the same HUD (model, latency, token count), and the same answer painting (Choice bars, Score / Noul meters).
  5. 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.
  6. Smaller booths that reuse the same contract on tickets, safety, search, chat, emotion, debate, cheating cases, tool names, PGN snippets, and a tiny grid.
  7. 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:

TypeWhat Jev returnsWhat we do with it
ChoiceOne key from a closed criteria map, plus confidence and probabilitiesRoute, moderate, pick a move, name a fallacy
ScoreA number on a labeled scaleUrgency, intensity, quality
NoulA 0 to 1 massHate, 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 state on 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:

  1. Operator picks a preset or types into the rack.
  2. The module builds state and questions.
  3. runSystemOne goes to the local proxy, or to the Cloudflare worker when config.json has a proxy URL (Pages injects that at deploy time).
  4. paintAnswers draws 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

RoutePageWhat it does
/HomeLive strip, a probe that asks Jev what this page is, links to every booth
/arena/Chess matchHuman vs Jev or Jev vs Jev. See the section below
/lab/router/Ticket deskChoice 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 filterJailbreak and harm questions, then a code gate (pass / review / block plus a confidence floor). Jev does not enforce the policy
/lab/rank/Document findChoice over passage ids. Code truncates to 255 and highlights the hit line
/lab/mod/Chat modChoice of allow / warn / block. Hate and spam Nouls ride along and are unused by the gate
/lab/emotion/Chat emotionClosed 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 moveClosed 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 notThirty 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 callChoice of function name and enum args. Amounts are parsed in JavaScript with Number(). Jev never emits a JSON tool blob
/lab/pgn/PGN puzzlesOpening Choice over a few first-move LANs. A blunder Noul is compared to local chess.js facts, not treated as truth
/lab/loop/Grid turns8x8 toy. Each tick Jev chooses a move, whether to shoot, and a threat Score
/flags/FFlag catalogSeparate 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.

PageRole
WikiPer-flag notes, tags, dump misses
BrowseCleaned flags with pack counts
PickerRank intact source combinations. Jev may pick one unchanged pack
BuilderNew combinations with constrained beam search or sequential Jev decisions
TuneAdd or remove cleaned flags, copy JSON
PrimerPrefixes, 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

PieceRole
TypeSafe JevClosed-set judgment (jev-latest via POST /v1/systemone)
chess.js 1.4Legal moves, FEN, SAN, LAN
Stockfish.js 18 lite WASMOperator review only. Depth 10, 2s ceiling. White-pov CP
server.pyServes web/ locally and holds TYPESAFE_API_KEY
GitHub PagesStatic UI. No API key in the bundle
proxy/worker.jsPublic key holder, origin bind, cookie, rate limit
.github/workflows/pages.ymlSecret scan, inject JEV_PROXY_URL into published config.json, deploy web/
.github/workflows/proxy.ymlDeploy 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

Open http://127.0.0.1:8787/

.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:

  1. Create a free Cloudflare account.
  2. Add repo secrets CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID, and TYPESAFE_API_KEY.
  3. Run the proxy workflow. It deploys proxy/worker.js.
  4. Copy the worker URL (example: https://jev-broadcast-lab.<subdomain>.workers.dev) into repo secret JEV_PROXY_URL.
  5. Re-run the pages workflow. 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.