@alexeiled/claude-router 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +41 -0
- package/README.md +31 -15
- package/docs/architecture.md +4 -1
- package/docs/configuration.md +1 -1
- package/docs/native-router.md +1 -1
- package/docs/router-band.svg +42 -35
- package/docs/router-pane-classifier.svg +45 -29
- package/docs/router-pane-now.svg +162 -122
- package/docs/router-pane-policy.svg +79 -47
- package/docs/user-guide.md +86 -10
- package/hooks/native-router.mjs +88 -14
- package/lib/display.mjs +2 -0
- package/lib/failover.mjs +55 -0
- package/lib/route.mjs +30 -16
- package/lib/ui/graphical/frame.mjs +11 -7
- package/lib/ui/graphical/now.mjs +7 -3
- package/lib/ui/model/band.mjs +3 -1
- package/lib/ui/model/now.mjs +53 -22
- package/lib/ui/terminal/band.mjs +71 -38
- package/lib/ui/terminal/classifier.mjs +39 -31
- package/lib/ui/terminal/kit.mjs +29 -0
- package/lib/ui/terminal/now.mjs +39 -46
- package/lib/ui/terminal/policy.mjs +31 -28
- package/package.json +2 -1
- package/types/index.d.ts +2 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// The Policy tab as terminal rows: each control inside the sentence it completes, its unsaved mark and its default,
|
|
2
|
-
// its help under it in the same column, then Reset and the file. Drawn from the model in
|
|
2
|
+
// its help under it in the same column, then Reset, in a box from PANEL_COLUMNS, and the file. Drawn from the model in
|
|
3
|
+
// ui/model/policy.mjs.
|
|
3
4
|
|
|
4
5
|
// The label column.
|
|
5
6
|
const LABEL = 13;
|
|
@@ -7,41 +8,43 @@ const LABEL = 13;
|
|
|
7
8
|
/**
|
|
8
9
|
* @param {any} ui the terminal kit
|
|
9
10
|
* @param {import('../model/policy.mjs').PolicyModel} model
|
|
11
|
+
* @param {{ columns: number | null }} opts
|
|
10
12
|
*/
|
|
11
|
-
export function terminalPolicy(ui, model) {
|
|
13
|
+
export function terminalPolicy(ui, model, { columns }) {
|
|
12
14
|
const { mode, baseline, tune, unsaved, file } = model;
|
|
13
15
|
const label = (words) => ui.text(words, { weight: 'semibold' });
|
|
14
16
|
// The control's unsaved mark and its default where the value differs.
|
|
15
17
|
const note = (field) => [ui.marker(field.changed && unsaved), field.default ? ui.dim(ui.say(field.default)) : null];
|
|
16
18
|
const control = (key) => ui.select(tune[key].control);
|
|
17
19
|
return [
|
|
18
|
-
ui.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ui.
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
...ui.panel(columns, [
|
|
21
|
+
ui.line(ui.head('POLICY'), ui.dim(' · how readily the router changes models · edit, then Save')),
|
|
22
|
+
ui.text(' '),
|
|
23
|
+
ui.field(LABEL, label('Mode'), [
|
|
24
|
+
ui.line(ui.select(mode.control), ui.dim(` ${mode.note}`)),
|
|
25
|
+
ui.help(ui.say(mode.hint)),
|
|
26
|
+
mode.session ? ui.help(ui.say(mode.session), { color: ui.color('warning') }) : null,
|
|
27
|
+
]),
|
|
28
|
+
ui.field(LABEL, label('Start'), [
|
|
29
|
+
ui.line('at ', ui.select(baseline.control), ' ', ...note(baseline)),
|
|
30
|
+
ui.help(ui.say(baseline.hint)),
|
|
31
|
+
]),
|
|
32
|
+
ui.field(LABEL, label('Going down'), [
|
|
33
|
+
ui.line('after ', control('downgradeVotes'), ' agreeing turns ', ...note(tune.downgradeVotes)),
|
|
34
|
+
ui.line('if a cache write pays back within ', control('horizon'), ' ', ...note(tune.horizon)),
|
|
35
|
+
]),
|
|
36
|
+
ui.field(LABEL, label('Going up'), [ui.help(ui.say(model.up))]),
|
|
37
|
+
ui.field(LABEL, label('Activities'), [
|
|
38
|
+
ui.line('apply at ', control('activityMass'), ' certainty or more ', ...note(tune.activityMass)),
|
|
39
|
+
ui.help(model.activitiesHint),
|
|
40
|
+
]),
|
|
41
|
+
ui.field(LABEL, label('Credits'), [
|
|
42
|
+
ui.line('cap one cold cache write at ', control('cashCapUsd'), ' ', ...note(tune.cashCapUsd)),
|
|
43
|
+
ui.help(model.creditsHint),
|
|
44
|
+
]),
|
|
45
|
+
ui.text(' '),
|
|
46
|
+
ui.Button({ key: 'reset-policy', label: model.reset.label, onPress: model.reset.press }),
|
|
24
47
|
]),
|
|
25
|
-
ui.field(LABEL, label('Start'), [
|
|
26
|
-
ui.line('at ', ui.select(baseline.control), ' ', ...note(baseline)),
|
|
27
|
-
ui.help(ui.say(baseline.hint)),
|
|
28
|
-
]),
|
|
29
|
-
ui.field(LABEL, label('Going down'), [
|
|
30
|
-
ui.line('after ', control('downgradeVotes'), ' agreeing turns ', ...note(tune.downgradeVotes)),
|
|
31
|
-
ui.line('if a cache write pays back within ', control('horizon'), ' ', ...note(tune.horizon)),
|
|
32
|
-
]),
|
|
33
|
-
ui.field(LABEL, label('Going up'), [ui.help(ui.say(model.up))]),
|
|
34
|
-
ui.field(LABEL, label('Activities'), [
|
|
35
|
-
ui.line('apply at ', control('activityMass'), ' certainty or more ', ...note(tune.activityMass)),
|
|
36
|
-
ui.help(model.activitiesHint),
|
|
37
|
-
]),
|
|
38
|
-
ui.field(LABEL, label('Credits'), [
|
|
39
|
-
ui.line('cap one cold cache write at ', control('cashCapUsd'), ' ', ...note(tune.cashCapUsd)),
|
|
40
|
-
ui.help(model.creditsHint),
|
|
41
|
-
]),
|
|
42
|
-
ui.text(' '),
|
|
43
|
-
ui.Button({ key: 'reset-policy', label: model.reset.label, onPress: model.reset.press }),
|
|
44
|
-
ui.text(' '),
|
|
45
48
|
ui.line(
|
|
46
49
|
ui.head('FILE'),
|
|
47
50
|
` ${file.path} `,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexeiled/claude-router",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Native Claude Code model and effort routing with Anthropic, DeepSeek, z.ai, MiniMax, MiMo and Kimi defaults, custom provider profiles, and classifier advice.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alexei Ledenev",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"test:providers": "node experiments/mod-router/scripts/provider-acceptance.mjs",
|
|
39
39
|
"format": "tools/node_modules/.bin/biome format --write .",
|
|
40
40
|
"docs:images": "node scripts/render-doc-images.mjs",
|
|
41
|
+
"docs:desktop-images": "node scripts/render-desktop-images.mjs",
|
|
41
42
|
"prices:check": "node scripts/check-prices.mjs",
|
|
42
43
|
"docs:modes": "node scripts/mode-matrix.mjs",
|
|
43
44
|
"probe:results": "node scripts/probe-results.mjs",
|
package/types/index.d.ts
CHANGED
|
@@ -314,6 +314,8 @@ declare module 'claude-code' {
|
|
|
314
314
|
requestedPin: RouterTier | null;
|
|
315
315
|
} | null;
|
|
316
316
|
ineligible: string[];
|
|
317
|
+
// Models an API error held out of routing (lib/failover.mjs), by model id: the error and when the hold ends.
|
|
318
|
+
held?: Record<string, { error: string; until: number }>;
|
|
317
319
|
// Your model's simulated cache for routing vs your model: the last prompt's tokens, when, whether that reply ran
|
|
318
320
|
// on your route, and the model and effort it was kept for. Null at the start and after a compaction.
|
|
319
321
|
yours?: { total: number; at: number; onYours: boolean; model: string; effort: string | null } | null;
|