8000 feat: choose Jev, Laya or Kev as the System One router; Jev stays the default by dominicrico · Pull Request #12 · dominicrico/jev-router · GitHub
[go: up one dir, main page]

Skip to content
8000
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .claude-plugin/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 27 additions & 2 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
{
"name": "jev-router",
"version": "0.4.2",
"version": "0.5.0",
"description": "Asks TypeSafe Jev before each task which Claude model and effort fit best, then runs the turn on it",
"types": "./types/index.d.ts",
"author": { "name": "Dominic Rico Gómez", "url": "https://github.com/dominicrico" },
"icon": "./.claude-plugin/icon.png",
"userConfig": {
"router": {
"type": "string",
"title": "System One router",
"description": "jev: TypeSafe Jev (default, TYPESAFE_API_KEY). laya: self-hosted Laya on localhost:8000 (LAYA_API_KEY, optional). kev: self-hosted Kev on 127.0.0.1:8009 (KEV_API_KEY, optional)",
"options": [
"jev",
"laya",
"kev"
],
"default": "jev"
},
"routerModel": {
"type": "string",
"title": "Router model override",
"description": "Empty: the router's default (jev-latest, laya, kev-latest). Set to pin a version (jev-1.14) or match your host's model id",
"default": ""
},
"routerUrl": {
"type": "string",
"title": "Router endpoint override",
"description": "Empty: the router's default endpoint. Set for a hosted Laya or Kev, or another port. TypeSafe keys are only ever sent to api.typesafe.ai",
"default": ""
},
"apiKey": {
"type": "string",
"title": "TypeSafe API key",
Expand Down Expand Up @@ -72,7 +97,7 @@
"effortCap": {
"type": "string",
"title": "Effort cap",
"description": "Highest reasoning effort the router applies. medium is the default (the lean preset). Start a prompt with !full, or run /jev full, to lift it for one promptHighest reasoning effort the router applies. medium is the default (the lean preset). Start a prompt with !full, or run /jev full, to lift it for one prompt",
"description": "Highest reasoning effort the router applies. medium is the default (the lean preset). Start a prompt with !full, or run /jev full, to lift it for one prompt",
"options": [
"low",
"medium",
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
All notable changes to jev-router are documented here.
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project uses [Semantic Versioning](https://semver.org/).

## [0.5.0] - 2026-10-23

### Added
- `router` option: `jev` (TypeSafe, default), `laya` or `kev` (self-hosted), each with its own default endpoint, model id and key variable (`TYPESAFE_API_KEY`, `LAYA_API_KEY`, `KEV_API_KEY`). `routerModel` and `routerUrl` override them. `/jev status` shows the active router.
- Configurable `routerModel` and `routerUrl` options, to route with a pinned Jev version or a hosted Laya or Kev.

### Fixed
- An invalid `effortCap` or `ceiling` value now falls back to the `lean` values (`medium`, `sonnet`). Before, it fell back to `high` and no ceiling, so a typo quietly raised cost.
- The router timeout timer is cancelled as soon as the router answers, so no stray timer is left behind each step.
- `/jev` lists every command in its unknown-option reply (`preset`, `ceiling`, `floor`, `stats clear` were missing).
- The `effortCap` setting help text no longer repeats itself.

### Security
- A TypeSafe key from `/jev key` or `TYPESAFE_API_KEY` is only sent to `api.typesafe.ai`, never to a custom `routerUrl`.

## [0.4.2] - 2026-10-12: `jev` (TypeSafe, default), `laya` or `kev` (self-hosted), each with its own default endpoint, model id and key variable (`TYPESAFE_API_KEY`, `LAYA_API_KEY`, `KEV_API_KEY`). `routerModel` and `routerUrl` override them. `/jev status` shows the active router.

## [0.4.2] - 2026-10-12

### Fixed
Expand Down Expand Up @@ -70,6 +87,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
- Benchmarks: routing fit, cost, stability, overhead and cache stickiness over 30 tasks, plus real token usage and cost per mode against no plugin.
- Ponytail-style README with logo, hero art and benchmark charts.

[0.5.0]: https://github.com/dominicrico/jev-router/compare/v0.4.2...v0.5.0
[0.4.2]: https://github.com/dominicrico/jev-router/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/dominicrico/jev-router/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/dominicrico/jev-router/compare/v0.3.0...v0.4.0
Expand Down
5 changes: 4 additions & 1 deletion OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ When the cache wins, the band says so: `opus (kept 🔒 cache warm; wanted haiku

| Option | Default | Meaning |
| --- | --- | --- |
| `router` | `jev` | The System One model that picks: `jev` (TypeSafe), `laya` or `kev` (self-hosted). See the [README](README.md#use-another-system-one-model) |
| `routerModel` | empty | Override the router's model id (`jev-latest`, `laya`, `kev-latest`), e.g. `jev-1.14` |
| `routerUrl` | empty | Override the router's endpoint. TypeSafe keys are only sent to `api.typesafe.ai` |
| `mode` | `balanced` | Routing mode |
| `models` | all four | Aliases Jev may choose from |
| `preset` | `none` | `lean`, `balanced` or `max` overrides the three options below. `none`: the options apply as set (the shipped defaults are the `lean` values) |
Expand All @@ -86,5 +89,5 @@ When the cache wins, the band says so: `opus (kept 🔒 cache warm; wanted haiku

## Privacy

Sent to `api.typesafe.ai`: the prompt text (up to `maxTaskChars`), recent messages if `sendHistory` is on, and subagent descriptions. Before sending, `redact` replaces API keys, GitHub tokens, AWS keys, bearer tokens, private key blocks and `NAME_KEY=value` style lines with `[redacted]`. That is pattern matching, not a guarantee, so keep `sendHistory` off if your conversations carry things it would not catch. Your TypeSafe key is stored in the plugin store in plain text if you use `/jev key`, and the command line lands in the transcript; prefer the `TYPESAFE_API_KEY` environment variable.
Sent to `api.typesafe.ai` (or your `routerUrl`): the prompt text (up to `maxTaskChars`), recent messages if `sendHistory` is on, and subagent descriptions. Before sending, `redact` replaces API keys, GitHub tokens, AWS keys, bearer tokens, private key blocks and `NAME_KEY=value` style lines with `[redacted]`. That is pattern matching, not a guarantee, so keep `sendHistory` off if your conversations carry things it would not catch. Your TypeSafe key is stored in the plugin store in plain text if you use `/jev key`, and the command line lands in the transcript; prefer the `TYPESAFE_API_KEY` environment variable.

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ Long warm sessions are the honest weak spot: the cache guard cuts model switches
<img src="assets/commands.png" width="880" alt="Cheat sheet: /jev status, /jev preset, /jev ceiling, /jev cap, /jev full, /jev key, and the prompt markers !opus, !sonnet, !haiku, !full, !cheap.">
</p>

## Use another System One model

TypeSafe Jev is the default. Laya and Kev, two open System One models you run yourself, work too. All three speak the same `/v1/systemone` API, so switching is one option in `/plugin` → jev-router → configure (or the plugin's options in `settings.json`):

| `router` | Endpoint | Model | Key |
| --- | --- | --- | --- |
| `jev` (default) | `https://api.typesafe.ai/v1/systemone` | `jev-latest` | `TYPESAFE_API_KEY` or `/jev key` (required) |
| `laya` | `http://localhost:8000/v1/systemone` ([server](https://github.com/ZulfiFazhar/system-one)) | `laya` | `LAYA_API_KEY` (optional) |
| `kev` | `http://127.0.0.1:8009/v1/systemone` ([server](https://github.com/jaredpalmer/kev)) | `kev-latest` | `KEV_API_KEY` (optional) |

`routerUrl` and `routerModel` override the endpoint and model, for a hosted Laya or Kev, another port, or a pinned version like `jev-1.14`. Your TypeSafe key is never sent anywhere but `api.typesafe.ai`; the `apiKey` plugin option is sent to whichever endpoint you set. `/jev status` shows the active router. Set `router` back to `jev` and clear the overrides to return to Jev.

Laya's server rate-limits clients without a key to 10 calls a minute, and jev-router asks once per step. Set `LAYA_API_KEY`, or turn `routeSteps` off.

Every option, preset, command and the privacy details are in [OPTIONS.md](OPTIONS.md). Method, per-benchmark results and caveats are in [benchmarks/](benchmarks/README.md).

## FAQ
Expand Down
81 changes: 78 additions & 3 deletions hooks/register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const OPTS = { options: { apiKey: 'k-test', mode: 'balanced' } }

type World = { messages: any[]; bodies: any[]; steps: any[]; toasts: string[]; usage: any; clock: ReturnType<typeof mock.clock> }

function world(on: On, answer: () => { ok: boolean; status: number; text: string }): World {
type Answer = { ok: boolean; status: number; text: string }

function world(on: On, answer: () => Answer | Promise<Answer>): World {
const w: World = { messages: [], bodies: [], steps: [], toasts: [], usage: null, clock: mock.clock(on) }
on('http.fetch', async (_$, e) => {
w.bodies.push({ ...JSON.parse(e.init?.body ?? '{}'), auth: e.init?.headers?.authorization })
return { value: { headers: {}, ...answer() } }
w.bodies.push({ ...JSON.parse(e.init?.body ?? '{}'), auth: e.init?.headers?.authorization, url: e.url })
return { value: { headers: {}, ...(await answer()) } }
})
on('session.model', async () => ({ value: 'claude-sonnet-5-5' }))
on('session.messages', async () => ({ value: w.messages }))
Expand Down Expand Up @@ -61,6 +63,68 @@ test('routes the turn to the model and effort Jev picks', OPTS, async ($, on) =>
expect(w.steps[0].effort).toBe('medium') // the default cap
})

test('Jev on TypeSafe is the default System One model', OPTS, async ($, on) => {
const w = world(on, jev('haiku', 'low'))
await $.turn.start({ text: 'rename foo to bar', turnId: 't1' })

expect(w.bodies[0].model).toBe('jev-latest')
expect(w.bodies[0].url).toBe('https://api.typesafe.ai/v1/systemone')
expect(w.bodies[0].auth).toBe('Bearer k-test')
})

test('another System One model on a self-hosted endpoint needs no key', { options: { routerModel: 'laya', routerUrl: 'http://localhost:8080/v1/systemone' } }, async ($, on) => {
mock.store(on)
mock.env(on, {})
const w = world(on, jev('haiku', 'low'))
await $.turn.start({ text: 'rename foo to bar', turnId: 't1' })
await step($, 't1')

expect(w.bodies[0].model).toBe('laya')
expect(w.bodies[0].url).toBe('http://localhost:8080/v1/systemone')
expect(w.bodies[0].auth).toBe(undefined)
expect(w.steps[0].model).toBe('claude-haiku-5-5')
})

test('router laya uses its self-hosted defaults and LAYA_API_KEY', { options: { router: 'laya' } }, async ($, on) => {
mock.store(on)
mock.env(on, { LAYA_API_KEY: 'laya_k', TYPESAFE_API_KEY: 'ts_env' })
const w = world(on, jev('haiku', 'low'))
await $.turn.start({ text: 'task', turnId: 't1' })

expect(w.bodies[0].url).toBe('http://localhost:8000/v1/systemone')
expect(w.bodies[0].model).toBe('laya')
expect(w.bodies[0].auth).toBe('Bearer laya_k')
})

test('router kev uses its defaults, an override wins, and TYPESAFE_API_KEY stays home', { options: { router: 'kev', routerModel: 'kev-4b' } }, async ($, on) => {
mock.store(on)
mock.env(on, { TYPESAFE_API_KEY: 'ts_env' })
const w = world(on, jev('sonnet', 'low'))
await $.turn.start({ text: 'task', turnId: 't1' })
await step($, 't1')

expect(w.bodies[0].url).toBe('http://127.0.0.1:8009/v1/systemone')
expect(w.bodies[0].model).toBe('kev-4b')
expect(w.bodies[0].auth).toBe(undefined)
expect(w.steps[0].model).toBe('claude-sonnet-5-5')
})

test('a TypeSafe key is never sent to another endpoint', { options: { routerUrl: 'http://other.example/v1/systemone' } }, async ($, on) => {
mock.store(on)
mock.env(on, { TYPESAFE_API_KEY: 'ts_env' })
const w = world(on, jev('haiku', 'low'))
await $.turn.start({ text: 'task', turnId: 't1' })
expect(w.bodies[0].auth).toBe(undefined)
})

test('an invalid effortCap or ceiling falls back to the lean values', { options: { apiKey: 'k-test', effortCap: 'mediun', ceiling: 'sonet', ceilingBreak: 0.95 } }, async ($, on) => {
const w = world(on, jev('opus', 'xhigh'))
await $.turn.start({ text: 'task', turnId: 't1' })
await step($, 't1')
expect(w.steps[0].model).toBe('claude-sonnet-5-5')
expect(w.steps[0].effort).toBe('medium')
})

test('a continuation keeps the previous decision without calling Jev', OPTS, async ($, on) => {
const w = world(on, jev('haiku', 'low'))
await $.turn.start({ text: 'rename foo to bar', turnId: 't1' })
Expand Down Expand Up @@ -330,6 +394,17 @@ test('three failures pause Jev, then it recovers', OPTS, async ($, on) => {
expect(w.bodies.length).toBe(4)
})

test('a Jev call slower than timeoutMs keeps the session model', OPTS, async ($, on) => {
const w = world(on, () => new Promise<never>(() => {})) // never answers
const started = $.turn.start({ text: 'task', turnId: 't1' })
await w.clock.advance(4_001)
await started
await step($, 't1')

expect(w.toasts.some(t => t.includes('timed out after 4000 ms'))).toBe(true)
expect(w.steps[0].model).toBe('claude-sonnet-5-5')
})

test('strict plus a warm cache makes no step calls', { options: { apiKey: 'k-test', stickiness: 'strict' } }, async ($, on) => {
const w = world(on, jev('opus', 'high'))
await warmUp(w, $, 'claude-sonnet-5-5', 50_000)
Expand Down
Loading
Loading
0