jev-msw
MSW handlers that mock the Jev API for the official TypeSafe SDK, making Jev-driven tests deterministic without keys or credits.
Overview
jev-msw provides contract-aware Mock Service Worker handlers for the official @typesafe-ai/sdk. Tests can return chosen Choice, Score and Noul answers so code that branches on Jev decisions runs deterministically without API calls, credentials, latency or credits. The application still runs the real SDK with its parsing, error, timeout and retry logic.
Missing fields such as the probability map, score legends, model and zero-token usage are filled in from the incoming request's labels. Handlers can be dynamic, computing answers from the request state and attempt number, and can match on deep-partial state, question types and model patterns. Failure helpers simulate server errors, rate limits with retry-after, validation errors, connection errors, timeouts, malformed responses and sequences of these, which makes retry paths testable.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Other | Mocked Jev answers (choice, noul, score) for tests | — |
How it works
- Install jev-msw and msw as dev dependencies
- Set up an MSW server in the test runner
- Register handlers such as jev.choice or jev.rateLimited
- Run code that uses the real SDK and assert on its behaviour
Strengths
- Deterministic tests with no network or credits
- Exercises real SDK parsing and retry logic
- Simulates many failure modes
- Published on npm with CI
Caveats
- Mocks do not test real model quality
- Tied to the official TypeScript SDK
Getting started
npm install -D jev-msw mswAt a glance
- Type
- Service
- Status
- beta
- Language
- TypeScript
- Runtime
- Node test tooling (MSW)
- Has code
- yes
- Has tests
- yes
- License
- MIT
Use cases and integrations
How curated lists describe it
Mock Jev API decisions with MSW for deterministic tests without real API calls or credits.
logicrw/awesome-jev-projectsMock Jev API decisions with MSW for deterministic tests without real API calls or credits.
hellogumbo/awesome-jev
Frequently asked questions
What does jev-msw do?
It mocks the Jev API at the network level so tests using the official SDK return chosen answers.
Does it need a TypeSafe key?
No. Tests can use any placeholder key.
Can it simulate failures?
Yes, including rate limits, server errors, timeouts, malformed responses and sequences of them.
Related projects
Python tap SDK for Android, iOS and HarmonyOS where multimodal Jev picks a numbered on-screen candidate and the SDK taps it.
LibrarybetaPython- OpenJev★ 5
Jev-inspired decision API with a local mock server and Python and TypeScript SDKs for prototyping; real inference is planned.
LibraryprototypePython Hack Club's lightweight LLM proxy, listed for adding a Jev forwarding endpoint behind its auth, limits and usage logging.
MCP serverproductionTypeScriptAx, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.
PluginproductionTypeScriptEffect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.
ProjectproductionTypeScriptPHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.
ProjectproductionPHP