Skip to content

jev-msw

MSW handlers that mock the Jev API for the official TypeSafe SDK, making Jev-driven tests deterministic without keys or credits.

ServicebetaMIT

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

TypeQuestionAnswers
OtherMocked Jev answers (choice, noul, score) for tests—

How it works

  1. Install jev-msw and msw as dev dependencies
  2. Set up an MSW server in the test runner
  3. Register handlers such as jev.choice or jev.rateLimited
  4. 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 msw

At 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

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 serverproductionTypeScript
  • Ax, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.

    PluginproductionTypeScript
  • Effect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.

    ProjectproductionTypeScript
  • PHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.

    ProjectproductionPHP