pi-jev-typesafe

TypeSafe Jev (System One judgments) for Pi: zero-dependency jev_ask tool with question linting, model discovery, probability-bar rendering, and daily budget caps.

Packages

Package details

extension

Install pi-jev-typesafe from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-jev-typesafe
Package
pi-jev-typesafe
Version
0.1.1
Published
Sep 18, 2026
Downloads
316/mo · 316/wk
Author
nardinmarcus
License
MIT
Types
extension
Size
45.1 KB
Dependencies
0 dependencies · 4 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/index.js"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-jev-typesafe

TypeSafe Jev inside Pi. Jev is TypeSafe's System One judgment model: send it some state and typed questions, get calibrated probabilities back in about a second, for a fraction of a cent. This package gives Pi one thing done carefully:

  • jev_ask tool — batched Choice / Score / Noul evaluation with question linting that catches the failure modes the TypeSafe docs warn about before your tokens are spent, model discovery (/jev models), per-request model pinning, and probability-bar rendering in the terminal.
  • /jev command — enable · disable · status · test · models.
  • Budget rails — per-session attempt cap, optional daily caps (requests / input tokens / USD), persisted across restarts, checked before a request is submitted.

Independent project. Not affiliated with TypeSafe AI or the Pi authors.

Install

pi install npm:pi-jev-typesafe
# or from git:
pi install git:github.com/nardinmarcus/pi-jev-typesafe@v0.1.0
# or from a local checkout:
pi install /path/to/pi-jev-typesafe

Requires Pi 0.85+ and Node.js 22+. Zero runtime dependencies — pi bundles everything the extension imports (typebox, pi-ai, pi-tui).

Setup

  1. Get a key at console.typesafe.ai.
  2. export TYPESAFE_API_KEY=... in your environment (~/.zshrc works; the extension also reads it as a fallback if the env var is absent from the pi process).
  3. Inside Pi, run /jev enable and confirm the data notice — or set PI_TYPESAFE_JEV_ENABLED=1 for headless runs.

/jev status shows the key source, opt-in state, session attempt count, today's persisted usage, estimated spend, and active caps.

The three question types

Type Asks Criteria Returns
choice Which of these options fits? options map { label: description | null } — include a no-match option chosen option, probability per option, confidence
score Where on this ordered rubric? array of ≥ 2 concrete level descriptions position (may be fractional), probabilities, confidence
noul Is this true? optional { true, false } descriptions P(yes)

Questions run in parallel and cannot see each other. Put each item in a named state field (reports.r1) and ask one narrow judgment per question per dimension.

Question linting

Before submitting, jev_ask checks your questions and appends non-blocking warnings to the result:

  • a choice with no no-match option (other, unclear, 其他…) — the model cannot pick an option you omitted;
  • score levels that are bare degree words (low / medium / high / 中等 / 一般) instead of concrete situations;
  • instructions so short they cannot carry the full judgment.

Question text is the whole program: Jev answers exactly what is asked, and ambiguity shows up as a middling probability rather than an error.

Budget and safety

  • Per session: 20 attempts by default (PI_TYPESAFE_JEV_MAX_REQUESTS), reset on session start/reload.
  • Per day (persisted in ~/.pi/agent/pi-jev-typesafe/usage.json, rolls over at local midnight):
    • PI_TYPESAFE_JEV_MAX_REQUESTS_PER_DAY
    • PI_TYPESAFE_JEV_MAX_INPUT_TOKENS_PER_DAY
    • PI_TYPESAFE_JEV_MAX_USD_PER_DAY (input tokens only — output is free)
  • 20s timeout, one retry on transient faults (429 / 5xx / network), response shape validated before you see it.
  • Only the submitted state and questions go to api.typesafe.ai. Nothing else is collected. Error messages never contain upstream response bodies, headers, keys, or your submitted content. The API key is never logged.

Model selection

model defaults to jev-latest. /jev models lists what your account can use.

  • jev-latest — most recent stable release (currently jev-1.13.0)
  • jev-preview — may move ahead of stable
  • pinned ids (jev-1.13.0) — use when confidence thresholds were tuned against a specific version

Library use

Internal helpers are exported for reuse and testing:

import { validateRequest, lintRequest, prepareArguments, formatResult } from "pi-jev-typesafe";

How it differs from pi-typesafe

pi-typesafe is an excellent, more feature-complete package (login/key store, playground, calibrate toolkit, chunked fan-out). This package takes a leaner cut with different emphases:

pi-typesafe pi-jev-typesafe
Dependencies 2 + 2 peers 0 (pi-bundled peers only)
Model discovery — /jev models, alias guidance
Question linting — no-match options, vague score levels, short instructions
Result rendering text list probability bars (expanded distributions)
Transient retries none one backoff retry on 429/5xx/network
Ownership npm-published open source, PRs welcome

If you want the key store, playground, and calibration tooling, use pi-typesafe — the two packages' tools can coexist (disable one via pi config).

Development

npm install
npm run check        # typecheck + tests
npm run build        # emit extensions/index.js (committed: git installs do not build)

License

MIT