npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jev-starter

v0.1.1

Published

Typed, policy-driven decision workflows on top of the TypeSafe AI Jev SDK

Downloads

36

Readme

jev-starter

Production-ready patterns for building probabilistic decision workflows with TypeSafe AI Jev.

Status: [email protected] is published on npm with provenance, and v0.1.0 is available as a GitHub Release. This repository is also enabled as a GitHub template. The main branch may contain unreleased changes intended for a later version.

jev-starter is not another Jev SDK wrapper. The official @typesafe-ai/sdk already provides a typed client. This project focuses on the layer applications still need around the model: decision contracts, policy thresholds, fallbacks, evaluation, and production examples.

What this project is for

Jev returns structured answers that software can act on. A production application usually needs more than a model call:

application state
      |
      v
  Jev decision
      |
      v
 typed probabilities
      |
      v
 decision policy
   /      |       \
  /       |        \
auto   fallback   human review

The goal of this repository is to make that pattern reusable and measurable.

Install

The published package requires Node.js 20 or newer:

pnpm add jev-starter

This repository pins pnpm 9.15.4 for contributor and CI commands. Consumers may use another compatible package manager; the runtime package is ESM and exposes its public API from jev-starter.

Design principles

  • Official SDK underneath. Use @typesafe-ai/sdk rather than duplicating TypeSafe transport or response types.
  • Separate inference from policy. Jev estimates; application code decides what confidence is sufficient for an action.
  • Side effects stay with the host application. The starter returns an action recommendation; it does not silently execute business operations.
  • Uncertainty is a first-class path. Low-confidence decisions must have an explicit fallback or review route.
  • Confident negatives are not uncertainty. Binary judgments should support two-sided thresholds so a low P(true) can be treated differently from an ambiguous result.
  • Evaluate before automating. Thresholds should be selected from task-specific data, not copied from examples.
  • Observable by default. Model, latency, confidence/probabilities, selected policy path, and outcome should be measurable.

Repository layout

src/
  core/           decision contracts and engine
  policies/       reusable threshold / routing policies
  providers/      Jev and deterministic mock providers
  observability/  decision events and metrics hooks

evals/
  fixtures/       labeled JSONL datasets
  metrics/        accuracy, calibration, risk/coverage, latency, cost
  runners/        Jev, baseline, comparison, and cascade runners

examples/
  support-routing/
  agent-decision-gate/
  llm-judge/
  rag-evaluator/  showcase: RAG diagnosis + Jev/LLM cascade evaluation

docs/
  architecture.md
  decision-contract.md
  evaluation.md
  rag-evaluator.md
  roadmap.md

Core flow

import { choice } from "@typesafe-ai/sdk";
import { DecisionEngine, JevProvider, defineDecision } from "jev-starter";

const questions = {
  category: choice("What is this ticket about?", {
    billing: null,
    technical: null,
    other: null,
  }),
};

const ticketRouting = defineDecision({
  id: "support.ticket-routing",
  version: "1",
  questions,
  policy: {
    kind: "confidence",
    question: "category",
    autoThreshold: 0.9,
    fallbackThreshold: 0.65,
  },
});

const state = { ticket: { subject: "Duplicate charge", body: "I was charged twice." } };
const signal = new AbortController().signal;
const engine = new DecisionEngine(new JevProvider());
const result = await engine.decide(ticketRouting, state, {
  signal,
  timeout: 10_000,
});

switch (result.route) {
  case "auto":
    // host application performs the approved side effect
    break;
  case "fallback":
    // optional LLM / secondary classifier path
    break;
  case "review":
    // human review or queue
    break;
}

The example above uses the published package import. For a source checkout, run pnpm build before resolving that package entry; repository examples may instead import from ./src/index.js. The clean-install package check exercises the same exports entry. result.answers contains the complete typed answer map, including choice/score confidence and probabilities or a noul probability. The engine only returns the route; the host application owns every side effect. Provider/API failures and malformed SDK responses reject and do not produce a DecisionOutcome.

Reference examples

Evaluation target

The starter should make it easy to answer a practical migration question:

For this classification or decision task, how much traffic can Jev automate at an acceptable error rate compared with the current baseline?

The offline harness implements accuracy, confusion matrices, per-label precision/recall/F1, Brier score, weighted ECE, coverage/risk threshold sweeps, binary-band sweeps, risk-coverage/AURC, latency, failures, usage, comparison, and cascade reports. Reports distinguish successful-only accuracy from all-row accuracy and retain combined cascade legs for latency, usage, and model-specific cost. Cost is calculated only from an explicitly supplied versioned pricing snapshot; otherwise it is reported as unavailable.

pnpm eval:offline
pnpm eval:live      # requires TYPESAFE_API_KEY; opt-in only

Showcase: RAG evaluator

RAG evaluation is the repository's first full showcase rather than a minimal classification demo. The basic answer-level mode is runnable offline and keeps retrieval and generation judgments separate.

Question --------------------+
Retrieved contexts ----------+----> Jev atomic judgments
Generated answer ------------+              |
Reference answer (optional) -+              v
                                    typed probabilities
                                             |
                                             v
                                    deterministic diagnosis

The evaluator keeps retrieval and generation failures separate and reports accuracy, Brier score, and weighted ECE for each available Jev component:

  • chunk relevance;
  • context sufficiency;
  • evidence conflict;
  • answer relevance;
  • groundedness;
  • contradiction;
  • reference-based correctness when available.

The final diagnosis is composed in TypeScript instead of asking Jev one large opaque question. The comparison modes are Jev-only, baseline judge, and Jev -> fallback judge cascade on the same labeled dataset. The fixture baseline currently exposes only its final diagnosis/confidence, so its component metrics are omitted rather than copied from Jev. Claim extraction remains a host/LLM extension point and is not implemented in basic mode.

See RAG evaluator showcase for the detailed design.

Documentation

Upstream

The official JavaScript/TypeScript SDK is @typesafe-ai/sdk. It currently exposes typed systemOne() requests and noul, choice, and score question/response shapes.

Future npm versions, tags, and GitHub Releases remain explicit approval-gated operations performed through the documented release workflow. That policy applies to future releases; v0.1.0 is already public.

License

MIT © 2026 hamakyo.