§ 5.4 · TypeScript · this lab
TypeScript
the same engine you are reading, imported as a library.
The whole lab is plain TypeScript with zero dependencies beyond the site itself: the parser, both evaluators, the checker, and the fuzzer are importable functions — this page runs them in your browser.
The property you write in a test can be the same string you hand the MCP server, which is the same formula the UI highlights. One engine, many faces — nothing to translate, nothing to drift.
modelCheck(parseLtl('G (coin -> F dispense)'), model)
G (coin -> F dispense)import { parseLtl } from "@/lib/formal/ltl";
import { modelCheck, parseKripke } from "@/lib/formal/model";
const vending = {
atoms: ["ready", "coin", "dispense"],
initial: ["idle"],
states: [
{ id: "idle", atoms: ["ready"], next: ["paid"] },
{ id: "paid", atoms: ["coin"], next: ["vend"] },
{ id: "vend", atoms: ["dispense"], next: ["idle"] },
],
};
test("every coin is eventually dispensed", () => {
const { model } = parseKripke(vending);
const r = modelCheck(parseLtl("G (coin -> F dispense)"), model);
expect(r.verdict).toBe("holds"); // exhaustive: depth = all states
});model_checkview the JSON-RPC body · POST to /api/mcp
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "model_check",
"arguments": {
"formula": "G (coin -> F dispense)",
"model": {
"atoms": [
"ready",
"coin",
"dispense"
],
"initial": [
"idle"
],
"states": [
{
"id": "idle",
"atoms": [
"ready"
],
"next": [
"paid"
]
},
{
"id": "paid",
"atoms": [
"coin"
],
"next": [
"vend"
]
},
{
"id": "vend",
"atoms": [
"dispense"
],
"next": [
"idle"
]
}
]
}
}
}
}read_skills_guideZero translation here: the guide's grammar is this engine's parser. An agent writing a TypeScript property reads Step 1 and is already writing valid input — the strings are interchangeable.
check_ltlCI runs are traces: agents feed a request/response log straight into check_ltl — runtime verification with the same formula the model checker proves and the fuzzer attacks.
model_checkThe property that passes CI on today's runs gets its exhaustive answer here: hand the same artifact JSON to model_check and holds means every behaviour, not every logged one.
Seeds and verdicts are the CI contract: falsify returns the seed it used, so a failing campaign is one number in a bug report.
The MCP server is the same functions behind a route — agents and tests share one oracle.
field guide · Runtime verification · Specification as the test oracle