Getting started
Introduction
jevascript is a semantic runtime for TypeScript. It adds is, score and choose next to string, number and boolean, so judgements that do not come from a property can still be ordinary values in ordinary control flow.
import { semantic } from "jevascript"
const urgency = await semantic(ticket)
.score("A human needs to act on this urgently.")
if (urgency > 80) {
pageOnCall()
}The model supplies the judgement. Your code decides the consequence.
What it is#
Ordinary code can test what a value contains: ticket.plan === "enterprise", amount > 1000. It cannot test what a value means: whether a ticket is urgent, whether a comment is passive-aggressive, whether two bug reports describe the same bug.
jevascript makes those judgements values too. Three primitives cover every shape a judgement can take:
| Primitive | Returns | Ask it for |
|---|---|---|
is(proposition) | boolean | Whether a claim holds |
score(criterion) | number | How strongly a claim holds, on a range you choose |
choose(options) | one of the options | Which of a fixed set fits best |
They are backed by a decision model: a model that scores propositions and returns calibrated probabilities. It generates no text, so there is no prompt to hijack and nothing to parse. Every question created in the same synchronous turn travels in one request, so seven questions cost about as much as one.
Where to start#
Requirements, package managers, the API key.
Quick startFrom an empty file to a decision in five steps.
PrimitivesEverything is, score and choose can do.
Why one request is the default and how to keep it that way.
TestingRun your logic without a model or a key.
API referenceEvery export, with its signature.
What it is not#
- Not an LLM SDK. There is no completion, no chat, no streaming. The provider returns probabilities, not prose.
- Not an agent framework. Nothing plans or loops. You write the
if. - Not a security boundary. Authentication, authorisation and exact validation stay deterministic. See Not a security boundary.
- Not a calculator. Counting, arithmetic and date comparison stay in code. A decision model reads numbers as text.
Status#
Version 0.1.x. The public API may change before 1.0; every change is listed in the changelog. The package has no runtime dependencies and needs Node 22.6 or newer.