The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(store): Jev harnesses reach Jev through OpenRouter, verified against the real model (#119)
Dee2243a9284ce1
diff --git a/store/agents/jev-archer/toolchain/README.md b/store/agents/jev-archer/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-archer/toolchain/README.md+++ b/store/agents/jev-archer/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-archer/toolchain/doctor.sh b/store/agents/jev-archer/toolchain/doctor.shindex 6fd357ad6..a3079792f 100755--- a/store/agents/jev-archer/toolchain/doctor.sh+++ b/store/agents/jev-archer/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-archer/toolchain/jev.mjs b/store/agents/jev-archer/toolchain/jev.mjsindex 727adc63d..22a320e56 100644--- a/store/agents/jev-archer/toolchain/jev.mjs+++ b/store/agents/jev-archer/toolchain/jev.mjs@@ -703,9 +703,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -736,6 +738,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -743,13 +748,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -758,7 +766,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-archer/viewer/jev-hud.js b/store/agents/jev-archer/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-archer/viewer/jev-hud.js+++ b/store/agents/jev-archer/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-arena/toolchain/README.md b/store/agents/jev-arena/toolchain/README.mdnew file mode 100644index 000000000..6c78b2586--- /dev/null+++ b/store/agents/jev-arena/toolchain/README.md@@ -0,0 +1,45 @@+# 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.diff --git a/store/agents/jev-arena/toolchain/jev.mjs b/store/agents/jev-arena/toolchain/jev.mjsindex 6f7bfb5c7..4e1c12db5 100644--- a/store/agents/jev-arena/toolchain/jev.mjs+++ b/store/agents/jev-arena/toolchain/jev.mjs@@ -312,9 +312,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -345,6 +347,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -352,13 +357,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -367,7 +375,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-arena/viewer/jev-hud.js b/store/agents/jev-arena/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-arena/viewer/jev-hud.js+++ b/store/agents/jev-arena/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-blocks/toolchain/README.md b/store/agents/jev-blocks/toolchain/README.mdindex e92012621..6c78b2586 100644--- a/store/agents/jev-blocks/toolchain/README.md+++ b/store/agents/jev-blocks/toolchain/README.md@@ -31,14 +31,15 @@ printf 'TYPESAFE_API_KEY=%s\n' 'paste-your-key-here' > ~/.config/typesafe/credenchmod 600 ~/.config/typesafe/credentials```-Two routes work, and both speak the same question format:+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 |-Environment variables of the same names win over the file. Restart the harness after changing the+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 thefile. `toolchain/doctor.sh` prints which route is active and never prints the key. One file servesevery Jev harness on the machine. Never paste a key into the chat, and never save one in theworkspace. Under `node --test`, or with `JEV_OFFLINE=1`, a key is ignored so tests stay deterministic.diff --git a/store/agents/jev-blocks/toolchain/jev.mjs b/store/agents/jev-blocks/toolchain/jev.mjsindex 190c7e9ac..ad49ee927 100644--- a/store/agents/jev-blocks/toolchain/jev.mjs+++ b/store/agents/jev-blocks/toolchain/jev.mjs@@ -250,9 +250,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -283,6 +285,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -290,13 +295,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -305,7 +313,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-blocks/viewer/jev-hud.js b/store/agents/jev-blocks/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-blocks/viewer/jev-hud.js+++ b/store/agents/jev-blocks/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-blocks/viewer/studio.js b/store/agents/jev-blocks/viewer/studio.jsindex 957ffe643..b845313b0 100644--- a/store/agents/jev-blocks/viewer/studio.js+++ b/store/agents/jev-blocks/viewer/studio.js@@ -321,7 +321,7 @@const best = Math.max(S.session.best, g.lines), sy = cSess.mid - 14text(`game ${g.n}`, bx, sy, 12, '#e9ecf5', 'left', 700); text(`${S.session.topOuts} top-out${S.session.topOuts === 1 ? '' : 's'}`, bx + bw, sy, 10.5, S.session.topOuts ? '#fb7185' : '#8b92aa', 'right')text('best', bx, sy + 20, 9.5, '#8b92aa'); text(`${fmt(best)} lines`, bx + bw, sy + 20, 12, '#c084fc', 'right', 700)- text('client', bx, sy + 40, 9.5, '#8b92aa'); text(S.client === 'typesafe' ? 'LIVE Jev' : 'offline MOCK', bx + bw, sy + 40, 10.5, S.client === 'typesafe' ? '#34d399' : '#fbbf24', 'right', 700)+ text('client', bx, sy + 40, 9.5, '#8b92aa'); text(S.client && S.client !== 'mock' ? 'LIVE Jev' : 'offline MOCK', bx + bw, sy + 40, 10.5, S.client && S.client !== 'mock' ? '#34d399' : '#fbbf24', 'right', 700)}// ------------------------------------------------------------------ the welldiff --git a/store/agents/jev-blocks/viewer/viewer.mjs b/store/agents/jev-blocks/viewer/viewer.mjsindex 30fb10cb0..6cf34d6f3 100644--- a/store/agents/jev-blocks/viewer/viewer.mjs+++ b/store/agents/jev-blocks/viewer/viewer.mjs@@ -217,7 +217,7 @@ export async function startBlocksViewer({ workspace, port = 0 } = {}) {if (stopped || piece !== p || game !== g) returnjevErr = nullp.answer = res- const cost = Math.max(val('decisionMs'), res.client === 'typesafe' ? res.latencyMs : 0)+ const cost = Math.max(val('decisionMs'), res.client !== 'mock' ? res.latencyMs : 0)p.answerAt = free ? g.now : Math.max(p.spawnAt + cost, g.now)} catch (e) {if (stopped || piece !== p) returndiff --git a/store/agents/jev-browser/README.md b/store/agents/jev-browser/README.mdindex 6bb0b7434..20a5d9e15 100644--- a/store/agents/jev-browser/README.md+++ b/store/agents/jev-browser/README.md@@ -81,6 +81,18 @@ plumbing. It is not Jev's judgement.The site, the flights, the prices and the people are made up. Nothing is booked anywhere and no realwebsite is touched. The times shown are this demo's pace, not a benchmark of any product.+## Measured with the real model++One short run on 2026-09-20 with live Jev (`typesafe/jev-1.13`) through OpenRouter, about 0.45 s a call once warm. Small samples on made-up data: a sanity check, not a benchmark.++| `distraction` | bookings | exactly right | steps each | clicks lost to layout shifts | cost |+|---|---|---|---|---|---|+| 0 | 6 | 6 of 6 | 9.8 | 0 | $0.0017 |+| 0.6 | 6 | 6 of 6 | 15.0 | 12 | $0.0032 |++At distraction 0.6 the real model lost 12 clicks to layout shifts and still got every booking right:+it noticed the wrong flight on the next page and went back. The offline stand-in scores about 92% there.+## Credit and stewardship- **Jev** is the work of **TypeSafe AI** (typesafe.ai). This harness is an OpenHarness wrapper thatdiff --git a/store/agents/jev-browser/toolchain/README.md b/store/agents/jev-browser/toolchain/README.mdindex e92012621..6c78b2586 100644--- a/store/agents/jev-browser/toolchain/README.md+++ b/store/agents/jev-browser/toolchain/README.md@@ -31,14 +31,15 @@ printf 'TYPESAFE_API_KEY=%s\n' 'paste-your-key-here' > ~/.config/typesafe/credenchmod 600 ~/.config/typesafe/credentials```-Two routes work, and both speak the same question format:+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 |-Environment variables of the same names win over the file. Restart the harness after changing the+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 thefile. `toolchain/doctor.sh` prints which route is active and never prints the key. One file servesevery Jev harness on the machine. Never paste a key into the chat, and never save one in theworkspace. Under `node --test`, or with `JEV_OFFLINE=1`, a key is ignored so tests stay deterministic.diff --git a/store/agents/jev-browser/toolchain/jev.mjs b/store/agents/jev-browser/toolchain/jev.mjsindex 190c7e9ac..ad49ee927 100644--- a/store/agents/jev-browser/toolchain/jev.mjs+++ b/store/agents/jev-browser/toolchain/jev.mjs@@ -250,9 +250,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -283,6 +285,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -290,13 +295,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -305,7 +313,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-browser/viewer/jev-hud.js b/store/agents/jev-browser/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-browser/viewer/jev-hud.js+++ b/store/agents/jev-browser/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-catcher/toolchain/README.md b/store/agents/jev-catcher/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-catcher/toolchain/README.md+++ b/store/agents/jev-catcher/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-catcher/toolchain/doctor.sh b/store/agents/jev-catcher/toolchain/doctor.shindex 42df4ed1c..3cafa27cd 100755--- a/store/agents/jev-catcher/toolchain/doctor.sh+++ b/store/agents/jev-catcher/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-catcher/toolchain/jev.mjs b/store/agents/jev-catcher/toolchain/jev.mjsindex 08eabb55b..fcaccb6e4 100644--- a/store/agents/jev-catcher/toolchain/jev.mjs+++ b/store/agents/jev-catcher/toolchain/jev.mjs@@ -673,9 +673,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -706,6 +708,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -713,13 +718,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -728,7 +736,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-catcher/viewer/jev-hud.js b/store/agents/jev-catcher/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-catcher/viewer/jev-hud.js+++ b/store/agents/jev-catcher/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-compactor/README.md b/store/agents/jev-compactor/README.mdindex ead846e4e..5f73fee55 100644--- a/store/agents/jev-compactor/README.md+++ b/store/agents/jev-compactor/README.md@@ -107,6 +107,14 @@ for the plumbing, not for Jev's judgement, and the pane badges it `MOCK`. Timesare the mock's times, not Jev's. Cost is what live Jev would charge for the same input tokens($0.042 per million input tokens).+## Measured with the real model++One short run on 2026-09-20 with live Jev (`typesafe/jev-1.13`) through OpenRouter, about 0.45 s a call once warm. Small samples on made-up data: a sanity check, not a benchmark.++14 compactions of the made-up session at distraction 0.12: needle recall 95.6%, average reduction+76.1%, 684 questions in 14 calls (about 49 questions a call, about 0.57 s a call), $0.0066. The toy+summarize baseline kept 48.8% of the needle tokens on the same session.+## Credit and stewardship- **Jev** is the work of **TypeSafe AI** (typesafe.ai). This harness is an OpenHarness wrapper thatdiff --git a/store/agents/jev-compactor/toolchain/README.md b/store/agents/jev-compactor/toolchain/README.mdindex e92012621..6c78b2586 100644--- a/store/agents/jev-compactor/toolchain/README.md+++ b/store/agents/jev-compactor/toolchain/README.md@@ -31,14 +31,15 @@ printf 'TYPESAFE_API_KEY=%s\n' 'paste-your-key-here' > ~/.config/typesafe/credenchmod 600 ~/.config/typesafe/credentials```-Two routes work, and both speak the same question format:+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 |-Environment variables of the same names win over the file. Restart the harness after changing the+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 thefile. `toolchain/doctor.sh` prints which route is active and never prints the key. One file servesevery Jev harness on the machine. Never paste a key into the chat, and never save one in theworkspace. Under `node --test`, or with `JEV_OFFLINE=1`, a key is ignored so tests stay deterministic.diff --git a/store/agents/jev-compactor/toolchain/jev.mjs b/store/agents/jev-compactor/toolchain/jev.mjsindex 190c7e9ac..ad49ee927 100644--- a/store/agents/jev-compactor/toolchain/jev.mjs+++ b/store/agents/jev-compactor/toolchain/jev.mjs@@ -250,9 +250,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -283,6 +285,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -290,13 +295,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -305,7 +313,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-compactor/viewer/jev-hud.js b/store/agents/jev-compactor/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-compactor/viewer/jev-hud.js+++ b/store/agents/jev-compactor/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-conductor/toolchain/README.md b/store/agents/jev-conductor/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-conductor/toolchain/README.md+++ b/store/agents/jev-conductor/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-conductor/toolchain/doctor.sh b/store/agents/jev-conductor/toolchain/doctor.shindex 2bdbec367..5f28e767e 100644--- a/store/agents/jev-conductor/toolchain/doctor.sh+++ b/store/agents/jev-conductor/toolchain/doctor.sh@@ -19,4 +19,6 @@ elseecho "warn jq not found (optional, used by some tooling)"fi+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-conductor/toolchain/jev.mjs b/store/agents/jev-conductor/toolchain/jev.mjsindex 6f7bfb5c7..4e1c12db5 100644--- a/store/agents/jev-conductor/toolchain/jev.mjs+++ b/store/agents/jev-conductor/toolchain/jev.mjs@@ -312,9 +312,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -345,6 +347,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -352,13 +357,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -367,7 +375,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-conductor/viewer/jev-hud.js b/store/agents/jev-conductor/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-conductor/viewer/jev-hud.js+++ b/store/agents/jev-conductor/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-duel/toolchain/README.md b/store/agents/jev-duel/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-duel/toolchain/README.md+++ b/store/agents/jev-duel/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-duel/toolchain/doctor.sh b/store/agents/jev-duel/toolchain/doctor.shindex 7a597edce..6960a1cdf 100644--- a/store/agents/jev-duel/toolchain/doctor.sh+++ b/store/agents/jev-duel/toolchain/doctor.sh@@ -12,4 +12,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0finode_v="$(node -v)"echo "ok node $node_v"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-duel/toolchain/jev.mjs b/store/agents/jev-duel/toolchain/jev.mjsindex d0931383f..7dfcea929 100644--- a/store/agents/jev-duel/toolchain/jev.mjs+++ b/store/agents/jev-duel/toolchain/jev.mjs@@ -376,9 +376,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -409,6 +411,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -416,13 +421,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -431,7 +439,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-duel/viewer/jev-hud.js b/store/agents/jev-duel/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-duel/viewer/jev-hud.js+++ b/store/agents/jev-duel/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-firehose/README.md b/store/agents/jev-firehose/README.mdindex fc5f59fd6..1bd552f98 100644--- a/store/agents/jev-firehose/README.md+++ b/store/agents/jev-firehose/README.md@@ -128,6 +128,13 @@ Jev would charge for the same tokens ($0.042 per million input tokens, output frThe "2s per message" comparison is an assumption drawn as a ghost bar, not a measurement of anymodel.+## Measured with the real model++One short run on 2026-09-20 with live Jev (`typesafe/jev-1.13`) through OpenRouter, about 0.45 s a call once warm. Small samples on made-up data: a sanity check, not a benchmark.++300 made-up messages at noise 0.2 and threshold 0.55: 25.4 s, $0.0107, 98.0% of auto-routed messages+right, 1.0% escalated. That is five questions a message, about 12 messages a second with a pool of 8.+## Credit and stewardship- **Jev** is the work of **TypeSafe AI** (typesafe.ai). This harness only calls the public API. Itdiff --git a/store/agents/jev-firehose/toolchain/README.md b/store/agents/jev-firehose/toolchain/README.mdindex efb0f9c39..10916d69e 100644--- a/store/agents/jev-firehose/toolchain/README.md+++ b/store/agents/jev-firehose/toolchain/README.md@@ -49,14 +49,15 @@ printf 'TYPESAFE_API_KEY=%s\n' 'paste-your-key-here' > ~/.config/typesafe/credenchmod 600 ~/.config/typesafe/credentials```-Two routes work, and both speak the same question format:+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 |-Environment variables of the same names win over the file. Restart the harness after changing the+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 thefile. `toolchain/doctor.sh` prints which route is active and never prints the key. One file servesevery Jev harness on the machine. Never paste a key into the chat, and never save one in theworkspace. Under `node --test`, or with `JEV_OFFLINE=1`, a key is ignored so tests stay deterministic.diff --git a/store/agents/jev-firehose/toolchain/jev.mjs b/store/agents/jev-firehose/toolchain/jev.mjsindex 190c7e9ac..ad49ee927 100644--- a/store/agents/jev-firehose/toolchain/jev.mjs+++ b/store/agents/jev-firehose/toolchain/jev.mjs@@ -250,9 +250,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -283,6 +285,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -290,13 +295,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -305,7 +313,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-firehose/viewer/jev-hud.js b/store/agents/jev-firehose/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-firehose/viewer/jev-hud.js+++ b/store/agents/jev-firehose/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-fps/README.md b/store/agents/jev-fps/README.mdindex aea838adf..b07db2d7c 100644--- a/store/agents/jev-fps/README.md+++ b/store/agents/jev-fps/README.md@@ -78,6 +78,14 @@ the plumbing. It is not Jev's judgement.The arena, the demons and the numbers are made up. This shows decision rate and calibration on asynthetic game. It is not a benchmark of any real game or product.+## Measured with the real model++One short run on 2026-09-20 with live Jev (`typesafe/jev-1.13`) through OpenRouter, about 0.45 s a call once warm. Small samples on made-up data: a sanity check, not a benchmark.++60 seconds at the default level: 130 decisions, 5 kills, no deaths, every shot on target, $0.0044.+Through OpenRouter the fight runs at about two decisions a second instead of nine, so it plays in+slow motion. The native API or Cloudflare route is the one for full speed.+## Credit and stewardship- **Jev** is the work of **TypeSafe AI** (typesafe.ai). This harness is an OpenHarness wrapper thatdiff --git a/store/agents/jev-fps/toolchain/README.md b/store/agents/jev-fps/toolchain/README.mdindex e92012621..6c78b2586 100644--- a/store/agents/jev-fps/toolchain/README.md+++ b/store/agents/jev-fps/toolchain/README.md@@ -31,14 +31,15 @@ printf 'TYPESAFE_API_KEY=%s\n' 'paste-your-key-here' > ~/.config/typesafe/credenchmod 600 ~/.config/typesafe/credentials```-Two routes work, and both speak the same question format:+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 |-Environment variables of the same names win over the file. Restart the harness after changing the+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 thefile. `toolchain/doctor.sh` prints which route is active and never prints the key. One file servesevery Jev harness on the machine. Never paste a key into the chat, and never save one in theworkspace. Under `node --test`, or with `JEV_OFFLINE=1`, a key is ignored so tests stay deterministic.diff --git a/store/agents/jev-fps/toolchain/jev.mjs b/store/agents/jev-fps/toolchain/jev.mjsindex 190c7e9ac..ad49ee927 100644--- a/store/agents/jev-fps/toolchain/jev.mjs+++ b/store/agents/jev-fps/toolchain/jev.mjs@@ -250,9 +250,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -283,6 +285,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -290,13 +295,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -305,7 +313,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-fps/viewer/jev-hud.js b/store/agents/jev-fps/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-fps/viewer/jev-hud.js+++ b/store/agents/jev-fps/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-guard/toolchain/README.md b/store/agents/jev-guard/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-guard/toolchain/README.md+++ b/store/agents/jev-guard/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-guard/toolchain/doctor.sh b/store/agents/jev-guard/toolchain/doctor.shindex 974f39427..dfa7749bb 100644--- a/store/agents/jev-guard/toolchain/doctor.sh+++ b/store/agents/jev-guard/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-guard/toolchain/jev.mjs b/store/agents/jev-guard/toolchain/jev.mjsindex 6f7bfb5c7..4e1c12db5 100644--- a/store/agents/jev-guard/toolchain/jev.mjs+++ b/store/agents/jev-guard/toolchain/jev.mjs@@ -312,9 +312,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -345,6 +347,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -352,13 +357,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -367,7 +375,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-guard/viewer/jev-hud.js b/store/agents/jev-guard/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-guard/viewer/jev-hud.js+++ b/store/agents/jev-guard/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-lander/toolchain/README.md b/store/agents/jev-lander/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-lander/toolchain/README.md+++ b/store/agents/jev-lander/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-lander/toolchain/doctor.sh b/store/agents/jev-lander/toolchain/doctor.shindex 5882c4ab2..038322ba7 100755--- a/store/agents/jev-lander/toolchain/doctor.sh+++ b/store/agents/jev-lander/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-lander/toolchain/jev.mjs b/store/agents/jev-lander/toolchain/jev.mjsindex 8a90d0e17..646cf96dd 100644--- a/store/agents/jev-lander/toolchain/jev.mjs+++ b/store/agents/jev-lander/toolchain/jev.mjs@@ -611,9 +611,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -644,6 +646,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -651,13 +656,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -666,7 +674,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-lander/viewer/jev-hud.js b/store/agents/jev-lander/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-lander/viewer/jev-hud.js+++ b/store/agents/jev-lander/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-launcher/toolchain/README.md b/store/agents/jev-launcher/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-launcher/toolchain/README.md+++ b/store/agents/jev-launcher/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-launcher/toolchain/doctor.sh b/store/agents/jev-launcher/toolchain/doctor.shindex 29af8ece1..9023c24fd 100644--- a/store/agents/jev-launcher/toolchain/doctor.sh+++ b/store/agents/jev-launcher/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-launcher/toolchain/jev.mjs b/store/agents/jev-launcher/toolchain/jev.mjsindex 29e0170ed..051d8e6e2 100644--- a/store/agents/jev-launcher/toolchain/jev.mjs+++ b/store/agents/jev-launcher/toolchain/jev.mjs@@ -401,9 +401,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -434,6 +436,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -441,13 +446,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -456,7 +464,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-launcher/viewer/jev-hud.js b/store/agents/jev-launcher/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-launcher/viewer/jev-hud.js+++ b/store/agents/jev-launcher/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-pendulum/toolchain/README.md b/store/agents/jev-pendulum/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-pendulum/toolchain/README.md+++ b/store/agents/jev-pendulum/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-pendulum/toolchain/doctor.sh b/store/agents/jev-pendulum/toolchain/doctor.shindex 8abb8c920..a9776666e 100644--- a/store/agents/jev-pendulum/toolchain/doctor.sh+++ b/store/agents/jev-pendulum/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-pendulum/toolchain/jev.mjs b/store/agents/jev-pendulum/toolchain/jev.mjsindex a3273ab4c..176280813 100644--- a/store/agents/jev-pendulum/toolchain/jev.mjs+++ b/store/agents/jev-pendulum/toolchain/jev.mjs@@ -476,9 +476,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -509,6 +511,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -516,13 +521,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -531,7 +539,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-pendulum/viewer/jev-hud.js b/store/agents/jev-pendulum/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-pendulum/viewer/jev-hud.js+++ b/store/agents/jev-pendulum/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-pong/toolchain/README.md b/store/agents/jev-pong/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-pong/toolchain/README.md+++ b/store/agents/jev-pong/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-pong/toolchain/doctor.sh b/store/agents/jev-pong/toolchain/doctor.shindex 5da145360..9f1cd8843 100755--- a/store/agents/jev-pong/toolchain/doctor.sh+++ b/store/agents/jev-pong/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-pong/toolchain/jev.mjs b/store/agents/jev-pong/toolchain/jev.mjsindex 1400e93de..6a842c739 100644--- a/store/agents/jev-pong/toolchain/jev.mjs+++ b/store/agents/jev-pong/toolchain/jev.mjs@@ -509,9 +509,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -542,6 +544,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -549,13 +554,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -564,7 +572,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-pong/viewer/jev-hud.js b/store/agents/jev-pong/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-pong/viewer/jev-hud.js+++ b/store/agents/jev-pong/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-sheets/README.md b/store/agents/jev-sheets/README.mdindex cbf859ad7..44fefd987 100644--- a/store/agents/jev-sheets/README.md+++ b/store/agents/jev-sheets/README.md@@ -112,6 +112,14 @@ about made-up messages, and the accuracy you see offline is the mock's, not Jev'demo of a pattern (typed questions over rows, with calibrated confidence and a review line), not asa measurement of any real support queue.+## Measured with the real model++One short run on 2026-09-20 with live Jev (`typesafe/jev-1.13`) through OpenRouter, about 0.45 s a call once warm. Small samples on made-up data: a sanity check, not a benchmark.++The 60-row template with its three starter columns filled in 5.4 s for $0.0013 (60 calls, three+questions each). Against the made-up truth labels: Team 98%, Anger 90%, Urgent 85%. Average+confidence was 0.90 on the clear rows and 0.79 on the mixed-signal rows, so the review line does its job.+## Credit and stewardship- **Jev** is the work of **TypeSafe AI** (typesafe.ai). This harness is an OpenHarness wrapper thatdiff --git a/store/agents/jev-sheets/toolchain/README.md b/store/agents/jev-sheets/toolchain/README.mdindex e92012621..6c78b2586 100644--- a/store/agents/jev-sheets/toolchain/README.md+++ b/store/agents/jev-sheets/toolchain/README.md@@ -31,14 +31,15 @@ printf 'TYPESAFE_API_KEY=%s\n' 'paste-your-key-here' > ~/.config/typesafe/credenchmod 600 ~/.config/typesafe/credentials```-Two routes work, and both speak the same question format:+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 |-Environment variables of the same names win over the file. Restart the harness after changing the+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 thefile. `toolchain/doctor.sh` prints which route is active and never prints the key. One file servesevery Jev harness on the machine. Never paste a key into the chat, and never save one in theworkspace. Under `node --test`, or with `JEV_OFFLINE=1`, a key is ignored so tests stay deterministic.diff --git a/store/agents/jev-sheets/toolchain/jev.mjs b/store/agents/jev-sheets/toolchain/jev.mjsindex 190c7e9ac..ad49ee927 100644--- a/store/agents/jev-sheets/toolchain/jev.mjs+++ b/store/agents/jev-sheets/toolchain/jev.mjs@@ -250,9 +250,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -283,6 +285,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -290,13 +295,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -305,7 +313,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-sheets/viewer/jev-hud.js b/store/agents/jev-sheets/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-sheets/viewer/jev-hud.js+++ b/store/agents/jev-sheets/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-sheets/viewer/viewer.mjs b/store/agents/jev-sheets/viewer/viewer.mjsindex 927d6bb2f..03348e9b7 100644--- a/store/agents/jev-sheets/viewer/viewer.mjs+++ b/store/agents/jev-sheets/viewer/viewer.mjs@@ -7,7 +7,7 @@// Answers are cached by row text plus column definition, so only missing cells are ever computed.import { join, dirname, resolve } from 'node:path'import { fileURLToPath } from 'node:url'-import { evaluate, jev, toWire, PRICE_PER_MTOK } from '../toolchain/jev.mjs'+import { evaluate, jev, toWire, PRICE_PER_MTOK, resolveCredentials } from '../toolchain/jev.mjs'import { serveViewer, writeVerdict, watchConfig, mulberry32, clean } from './kit.mjs'import { parseHeader, normalizeSheet, columnKey, judge, confidenceOf, levelOf, describeColumn, LIMITS } from './grammar.mjs'import { sheetMock } from './mock.mjs'@@ -38,7 +38,9 @@ export async function startSheetsViewer({ workspace, port = 0, autostart = true,let patches = [], patchTimer = null, verdictTimer = null, retryTimer = null, ghostTimer = nulllet ghost = { enabled: true, phase: 'idle', header: '', typeMs: 0, startedAt: 0, nextAt: 0, removeAt: 0, pausedUntil: 0, cursor: 0, watching: false }const rng = mulberry32(20260919)- const mockMode = !process.env.TYPESAFE_API_KEY+ // Which live route is active (typesafe, cloudflare, openrouter), or null for the offline stand-in.+ // Asked each time, because a key can arrive in the credentials file while the viewer runs.+ const liveRoute = () => resolveCredentials()?.provider ?? nullconst colById = (id) => columns.find((c) => c.id === id)const mock = sheetMock(colById)@@ -175,7 +177,7 @@ export async function startSheetsViewer({ workspace, port = 0, autostart = true,cellsOut[row.id] = o}return {- title: sheet.title, description: sheet.description, textLabel: sheet.textLabel, client: mockMode ? 'mock' : 'typesafe',+ title: sheet.title, description: sheet.description, textLabel: sheet.textLabel, client: liveRoute() ?? 'mock',source: sourceInfo, // set when the rows come from the person's own fileconcurrency: sheet.concurrency, limits: LIMITS,suggestions: sheet.suggestions.length ? sheet.suggestions : FALLBACK_SUGGESTIONS,@@ -231,7 +233,7 @@ export async function startSheetsViewer({ workspace, port = 0, autostart = true,{ id: 'fill', name: 'Cells filled', state: full ? 'done' : stats.cellsTotal ? 'active' : 'pending' },{ id: 'review', name: 'Review', state: !full ? 'pending' : stats.flagged ? 'active' : 'done' },],- sheet: { client: mockMode ? 'mock' : 'typesafe', reviewBelow, rows: stats.rows, cellsFilled: stats.cellsFilled, cellsTotal: stats.cellsTotal, flagged: stats.flagged, costUsd: stats.costUsd, groups, columns: report },+ sheet: { client: liveRoute() ?? 'mock', reviewBelow, rows: stats.rows, cellsFilled: stats.cellsFilled, cellsTotal: stats.cellsTotal, flagged: stats.flagged, costUsd: stats.costUsd, groups, columns: report },}}function shown(col, a) {@@ -298,7 +300,7 @@ export async function startSheetsViewer({ workspace, port = 0, autostart = true,try {// Offline, a call returns in under a millisecond. Pace it like the live model (about 100 ms)// so the wave is visible. `tick` and `drain` skip the pacing.- if (!fast && mockMode && paceMs > 0) await sleep(paceMs * (0.7 + 0.6 * rng()))+ if (!fast && !liveRoute() && paceMs > 0) await sleep(paceMs * (0.7 + 0.6 * rng()))const questions = Object.fromEntries(need.map((c) => [c.id, questionFor(c)]))const res = await evaluate({ state, questions, salt: 1, mock, model: process.env.JEV_MODEL || 'jev-latest' })if (stopped || myEpoch !== epoch || rowById.get(row.id) !== row || JSON.stringify(rowState(row)) !== key) returndiff --git a/store/agents/jev-shopper/toolchain/README.md b/store/agents/jev-shopper/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-shopper/toolchain/README.md+++ b/store/agents/jev-shopper/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-shopper/toolchain/doctor.sh b/store/agents/jev-shopper/toolchain/doctor.shindex ec9056c5c..b22fe15b3 100755--- a/store/agents/jev-shopper/toolchain/doctor.sh+++ b/store/agents/jev-shopper/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-shopper/toolchain/jev.mjs b/store/agents/jev-shopper/toolchain/jev.mjsindex 754b5732b..c069a5f4c 100644--- a/store/agents/jev-shopper/toolchain/jev.mjs+++ b/store/agents/jev-shopper/toolchain/jev.mjs@@ -543,9 +543,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -576,6 +578,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -583,13 +588,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -598,7 +606,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-shopper/viewer/jev-hud.js b/store/agents/jev-shopper/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-shopper/viewer/jev-hud.js+++ b/store/agents/jev-shopper/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-slalom/toolchain/README.md b/store/agents/jev-slalom/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-slalom/toolchain/README.md+++ b/store/agents/jev-slalom/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-slalom/toolchain/doctor.sh b/store/agents/jev-slalom/toolchain/doctor.shindex 922aa1b88..6c464171e 100755--- a/store/agents/jev-slalom/toolchain/doctor.sh+++ b/store/agents/jev-slalom/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-slalom/toolchain/jev.mjs b/store/agents/jev-slalom/toolchain/jev.mjsindex 764db85ed..f783370fb 100644--- a/store/agents/jev-slalom/toolchain/jev.mjs+++ b/store/agents/jev-slalom/toolchain/jev.mjs@@ -640,9 +640,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -673,6 +675,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -680,13 +685,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -695,7 +703,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-slalom/viewer/jev-hud.js b/store/agents/jev-slalom/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-slalom/viewer/jev-hud.js+++ b/store/agents/jev-slalom/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/agents/jev-trader/toolchain/README.md b/store/agents/jev-trader/toolchain/README.mdindex 50d91b604..6c78b2586 100644--- a/store/agents/jev-trader/toolchain/README.md+++ b/store/agents/jev-trader/toolchain/README.md@@ -18,3 +18,28 @@ Three question types (see `jev.mjs` builders):`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 youcommit 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.diff --git a/store/agents/jev-trader/toolchain/doctor.sh b/store/agents/jev-trader/toolchain/doctor.shindex f45c1636a..a81ee8999 100644--- a/store/agents/jev-trader/toolchain/doctor.sh+++ b/store/agents/jev-trader/toolchain/doctor.sh@@ -6,4 +6,6 @@ if ! node -e "process.exit(Number(process.versions.node.split('.')[0]) >= 18 ? 0echo "fail node >= 18 required (found $(node -v))"; exit 1fiecho "ok node $(node -v)"+cd "$(dirname "$0")/.."+node -e "import('./toolchain/jev.mjs').then((m) => console.log('ok Jev: ' + m.describeCredentials())).catch((e) => console.log('warn Jev client did not load: ' + e.message))"echo "done"diff --git a/store/agents/jev-trader/toolchain/jev.mjs b/store/agents/jev-trader/toolchain/jev.mjsindex da25f3576..86088361d 100644--- a/store/agents/jev-trader/toolchain/jev.mjs+++ b/store/agents/jev-trader/toolchain/jev.mjs@@ -346,9 +346,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -379,6 +381,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -386,13 +391,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -401,7 +409,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()diff --git a/store/agents/jev-trader/viewer/jev-hud.js b/store/agents/jev-trader/viewer/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/agents/jev-trader/viewer/jev-hud.js+++ b/store/agents/jev-trader/viewer/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/tools/jev-kit/contract.mjs b/store/tools/jev-kit/contract.mjsindex 32ad6971b..8d274b4d2 100644--- a/store/tools/jev-kit/contract.mjs+++ b/store/tools/jev-kit/contract.mjs@@ -25,6 +25,11 @@ const server = createServer(async (req, res) => {if (req.headers.authorization !== 'Bearer cf-token') { res.writeHead(401); return res.end('bad token') }if (j.model !== 'typesafe/jev' || !j.input) return fail('cloudflare wants { model: "typesafe/jev", input }')j = { model: 'jev-latest', ...j.input }+ } else if (req.url === '/api/alpha/decisions') {+ // OpenRouter: the native body, its own key, and its own model id (a TypeSafe model name is a 404 there).+ if (req.headers.authorization !== 'Bearer or-key') { res.writeHead(401); return res.end('bad key') }+ if (j.model !== 'typesafe/jev-1.13') { res.writeHead(404); return res.end('no such model') }+ j.model = 'jev-latest'} else if (req.headers.authorization !== 'Bearer test-key') { res.writeHead(401); return res.end('bad key') }if (j.model !== 'jev-latest') return fail('model')if (j.state == null) return fail('state required')@@ -96,11 +101,22 @@ for (const name of readdirSync(ROOT).filter((n) => n.startsWith('jev-')).sort())const forcedMock = await evaluate({ key: '', state: 'x', questions: { a: jev.noul('x?') } })const safeLine = m.describeCredentials()routes = c1?.provider === 'cloudflare' && viaCf?.client === 'cloudflare' && viaCf.answers.a.choice === 'keep' && forcedMock.client === 'mock' && !/cf-token/.test(safeLine)+ // OpenRouter, when the client knows it: key from the file, its own model id on the wire.+ if (routes && /OPENROUTER_API_KEY/.test(String(m.resolveCredentials))) {+ process.env.OPENROUTER_API_URL = `http://127.0.0.1:${server.address().port}/api/alpha/decisions`+ process.env.TYPESAFE_CREDENTIALS = join(dir, 'credentials-openrouter') // a new path, so the 5 s credential cache does not answer+ writeFileSync(process.env.TYPESAFE_CREDENTIALS, 'OPENROUTER_API_KEY=or-key\n')+ await new Promise((r) => setTimeout(r, 0))+ const c2 = m.resolveCredentials()+ const viaOr = c2?.provider === 'openrouter' ? await evaluate({ state: 'x', questions: { a: jev.choice({ keep: 'k', drop: 'd' }, 'Keep?') } }) : null+ routes = c2?.provider === 'openrouter' && viaOr?.client === 'openrouter' && viaOr.answers.a.choice === 'keep' && !/or-key/.test(m.describeCredentials())+ delete process.env.OPENROUTER_API_URL+ }delete process.env.TYPESAFE_CREDENTIALS; delete process.env.CLOUDFLARE_API_BASEif (!routes) bad++}if (!(ok && fastFail && mockOk)) bad++- console.log(`${ok && fastFail && mockOk && routes !== false ? 'OK ' : 'BAD '} ${name.padEnd(14)} live=${ok} fastFail401=${fastFail} mock=${mockOk} credentialsFile+cloudflare=${routes}`)+ console.log(`${ok && fastFail && mockOk && routes !== false ? 'OK ' : 'BAD '} ${name.padEnd(14)} live=${ok} fastFail401=${fastFail} mock=${mockOk} credentialsFile+cloudflare+openrouter=${routes}`)} catch (e) {bad++console.log(`BAD ${name.padEnd(14)} ${e.message}`)diff --git a/store/tools/jev-kit/jev-hud.js b/store/tools/jev-kit/jev-hud.jsindex 1509ba180..87b284fe1 100644--- a/store/tools/jev-kit/jev-hud.js+++ b/store/tools/jev-kit/jev-hud.js@@ -174,7 +174,7 @@let lastAt = 0function render(s) {const live = s.client && s.client !== 'mock'- const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : 'the TypeSafe API'+ const route = s.client === 'cloudflare' ? 'Cloudflare Workers AI' : s.client === 'openrouter' ? 'OpenRouter' : 'the TypeSafe API'badge.textContent = s.lastError ? 'ERROR' : live ? 'LIVE' : 'MOCK'badge.className = 'jh-badge ' + (s.lastError ? 'err' : live ? 'live' : 'mock')$k('rate').textContent = s.questionsPerSec >= 10 ? Math.round(s.questionsPerSec) : s.questionsPerSec.toFixed(1)diff --git a/store/tools/jev-kit/jev.mjs b/store/tools/jev-kit/jev.mjsindex 190c7e9ac..ad49ee927 100644--- a/store/tools/jev-kit/jev.mjs+++ b/store/tools/jev-kit/jev.mjs@@ -250,9 +250,11 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))// you happen to have open. Two live routes are supported, both speaking the same question format:// TypeSafe direct TYPESAFE_API_KEY (api.typesafe.ai)// Cloudflare Workers AI CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (no TypeSafe waitlist)+// OpenRouter OPENROUTER_API_KEY (no waitlist; alpha endpoint, ~0.45 s a call measured)+// When several are present the fastest wins: TypeSafe, then Cloudflare, then OpenRouter.// The file is ~/.config/typesafe/credentials (or $TYPESAFE_CREDENTIALS). Keep it chmod 600.// ----------------------------------------------------------------------------const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN']+const CRED_KEYS = ['TYPESAFE_API_KEY', 'TYPESAFE_API_URL', 'CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN', 'OPENROUTER_API_KEY', 'OPENROUTER_API_URL', 'OPENROUTER_JEV_MODEL']let credCache = nullexport const credentialsPath = () => process.env.TYPESAFE_CREDENTIALS || join(homedir(), '.config', 'typesafe', 'credentials')@@ -283,6 +285,9 @@ export function resolveCredentials(explicitKey) {if (key) return { provider: 'typesafe', secret: key, url: get('TYPESAFE_API_URL') || LIVE_ENDPOINT }const account = get('CLOUDFLARE_ACCOUNT_ID'), token = get('CLOUDFLARE_API_TOKEN')if (account && token) return { provider: 'cloudflare', secret: token, url: `${process.env.CLOUDFLARE_API_BASE || 'https://api.cloudflare.com'}/client/v4/accounts/${encodeURIComponent(account)}/ai/run` }+ // OpenRouter proxies the same API on an alpha path. It wants its own model id, not "jev-latest".+ const orKey = get('OPENROUTER_API_KEY')+ if (orKey) return { provider: 'openrouter', secret: orKey, url: get('OPENROUTER_API_URL') || 'https://openrouter.ai/api/alpha/decisions', model: get('OPENROUTER_JEV_MODEL') || 'typesafe/jev-1.13' }return null}@@ -290,13 +295,16 @@ export function resolveCredentials(explicitKey) {export function describeCredentials() {const c = resolveCredentials()if (!c) return `offline stand-in (no key found in the environment or in ${credentialsPath()})`+ if (c.provider === 'openrouter') return `live Jev through OpenRouter (${c.model}; alpha endpoint, about half a second a call: great for batch work, and the real-time games run at about two decisions a second)`return c.provider === 'cloudflare' ? 'live Jev through Cloudflare Workers AI' : 'live Jev through the TypeSafe API'}async function liveEvaluate(body, cred) {const endpoint = cred.urlconst key = cred.secret- const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } } : body+ const payload = cred.provider === 'cloudflare' ? { model: 'typesafe/jev', input: { state: body.state, questions: body.questions } }+ : cred.provider === 'openrouter' ? { ...body, model: cred.model }+ : bodylet lastErrfor (let attempt = 0; attempt < 3; attempt++) {if (attempt) { telemetry.retries++; await sleep(250 * 3 ** (attempt - 1)) }@@ -305,7 +313,7 @@ async function liveEvaluate(body, cred) {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },body: JSON.stringify(payload),- signal: AbortSignal.timeout(10000),+ signal: AbortSignal.timeout(cred.provider === 'openrouter' ? 30000 : 10000),})if (res.ok) {const data = await res.json()