@kentcdodds/jev
Call TypeSafe Jev evaluations via Cloudflare AI Gateway (same token/gateway as @kentcdodds/ai).
IntegrationsTopics: jev, typesafe, evaluation, cloudflare, ai-gateway, noul, choice, score, state-machine, transition, xstate
- Version
- 1.0.0
- License
- Published
- October 16, 2026
- Pinned commit
cfc20cb- Rating
- No ratings yet
- Forks
- 0
- Adaptation effort
- —
README
Agent docs@kentcdodds/jev
Intent
Call TypeSafe Jev (typesafe/jev) — a System One evaluation model — through
Cloudflare AI Gateway, so other Kody packages can ask typed noul / choice /
score questions and get calibrated answers. When agent logic is a state machine,
Jev can pick the next transition from enabled events as Choices. Reuses the same
cloudflareApiToken and account/gateway setup as @kentcdodds/ai when local
Jev storage is empty. Success means a tiny evaluate returns { ok, answers }
without anyone pasting tokens into chat.
What it does
- Evaluate shared state against named questions (
noul,choice,score) - Pick the next state-machine transition (
./choose-transition) from enabled events - Walk a declarative machine toward a goal (
./run-toward-goal) via repeated choices - Return parsed
answers,model, andusage - Escape-hatch raw
/ai/runfor progressive disclosure - Package storage for account/gateway ids, with fallback read from
@kentcdodds/ai/settings
Prerequisites / setup
Save user secret
cloudflareApiToken(do not paste the value in chat) with Workers AI access and hostapi.cloudflare.com(optional alsogateway.ai.cloudflare.comif you already use@kentcdodds/ai):Set Cloudflare account id (and optionally gateway id) via this package's
./settingsexport — stored in package storage, no republish. If you already configured@kentcdodds/ai/settings, leave Jev storage empty: reads fall back to those values. Gateway defaults tokody.AI Gateway Unified Billing —
typesafe/jevis a third-party model on Cloudflare. The account needs AI Gateway credits (or BYOK for TypeSafe) or/ai/runreturns HTTP 402Insufficient balance.Confirm readiness:
import overview from 'kody:@kentcdodds/jev'
export default async function main() {
return await overview()
}- Smoke (live, cheap):
import smokeTest from 'kody:@kentcdodds/jev/smoke-test'
export default async function main() {
return await smokeTest({ live: true })
}Evaluate example
import evaluate from 'kody:@kentcdodds/jev/evaluate'
export default async function main() {
return await evaluate({
state: 'Help! My payouts have been failing for 3 days.',
questions: {
is_urgent: {
type: 'noul',
instructions: 'Does this convey urgency?',
criteria: {
true: 'Explicitly time-sensitive',
false: 'No urgency expressed',
},
},
},
})
}Auth / settings vs @kentcdodds/ai
| Concern | Shared? | Where |
|---|---|---|
| Secret | Yes — same name | cloudflareApiToken (user scope) |
| Account id | Prefer one setup | Jev ./settings → else @kentcdodds/ai/settings |
| Gateway id | Prefer one setup | Same fallback chain; default kody |
| Model | Separate | Jev defaults to typesafe/jev |
Do not invent a second Cloudflare token secret for this package.
Alternate: Vercel AI Gateway
Vercel also exposes typesafe-ai/jev via AI SDK 7 experimental_evaluate.
This package implements the Cloudflare path first to match
@kentcdodds/ai. Prefer Cloudflare unless you already standardize on Vercel.
Docs: Cloudflare Jev · TypeSafe · Package
Done when
cloudflareApiTokenis saved withapi.cloudflare.comhost approval- Account (and optional gateway) resolve via
./settingsor@kentcdodds/ai - Account has AI Gateway Unified Billing balance (or TypeSafe BYOK)
./smoke-testwith{ live: true }returnsok: trueand a noul answer
Report this listing
Log in to report this listing.