@alexeiled/claude-router 1.23.1 → 1.25.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 +62 -1
- package/README.md +39 -7
- package/docs/architecture.md +27 -4
- package/docs/auto-engine.md +152 -0
- package/docs/configuration.md +47 -3
- package/docs/evaluation.md +222 -3
- package/docs/native-router.md +11 -3
- package/docs/providers.md +28 -0
- package/docs/router-band.svg +124 -133
- package/docs/router-pane-classifier.svg +24 -23
- package/docs/router-pane-now.svg +9 -7
- package/docs/router-pane-policy.svg +4 -4
- package/docs/router-pane-routes.svg +8 -8
- package/docs/router-pane-usage-whatif.svg +14 -14
- package/docs/router-pane-usage.svg +20 -20
- package/docs/routing-modes.md +13 -4
- package/docs/user-guide.md +79 -19
- package/hooks/native-router.mjs +1194 -215
- package/lib/activity-stats.mjs +23 -4
- package/lib/activity.mjs +7 -5
- package/lib/auto-engine.mjs +414 -0
- package/lib/auto-route.mjs +253 -0
- package/lib/band.mjs +35 -440
- package/lib/classifier-client.mjs +12 -8
- package/lib/config-file.mjs +7 -2
- package/lib/config.mjs +64 -15
- package/lib/cost.mjs +5 -1
- package/lib/costs.mjs +4 -2
- package/lib/decisions.mjs +80 -5
- package/lib/display.mjs +69 -20
- package/lib/facts.mjs +30 -0
- package/lib/modes.mjs +8 -4
- package/lib/panel.mjs +75 -2163
- package/lib/policy.mjs +7 -6
- package/lib/providers.mjs +7 -0
- package/lib/replay-trace.mjs +550 -0
- package/lib/replay.mjs +718 -0
- package/lib/route-line.mjs +46 -0
- package/lib/route.mjs +35 -21
- package/lib/savings.mjs +14 -3
- package/lib/subagents.mjs +41 -11
- package/lib/subcommands.mjs +60 -0
- package/lib/ui/fallback.mjs +22 -0
- package/lib/ui/graphical/band.mjs +256 -0
- package/lib/ui/graphical/charts.mjs +163 -0
- package/lib/ui/graphical/classifier.mjs +153 -0
- package/lib/ui/graphical/frame.mjs +227 -0
- package/lib/ui/graphical/kit.mjs +156 -0
- package/lib/ui/graphical/meter.mjs +25 -0
- package/lib/ui/graphical/now.mjs +353 -0
- package/lib/ui/graphical/policy.mjs +56 -0
- package/lib/ui/graphical/routes.mjs +264 -0
- package/lib/ui/graphical/squares.mjs +29 -0
- package/lib/ui/graphical/usage.mjs +376 -0
- package/lib/ui/model/band.mjs +439 -0
- package/lib/ui/model/classifier.mjs +308 -0
- package/lib/ui/model/draft.mjs +62 -0
- package/lib/ui/model/format.mjs +41 -0
- package/lib/ui/model/frame.mjs +359 -0
- package/lib/ui/model/now.mjs +390 -0
- package/lib/ui/model/policy.mjs +194 -0
- package/lib/ui/model/routes.mjs +392 -0
- package/lib/ui/model/usage-agents.mjs +311 -0
- package/lib/ui/model/usage-breakdown.mjs +237 -0
- package/lib/ui/model/usage-shared.mjs +58 -0
- package/lib/ui/model/usage.mjs +330 -0
- package/lib/ui/terminal/band.mjs +220 -0
- package/lib/ui/terminal/classifier.mjs +142 -0
- package/lib/ui/terminal/frame.mjs +169 -0
- package/lib/ui/terminal/kit.mjs +133 -0
- package/lib/ui/terminal/now.mjs +300 -0
- package/lib/ui/terminal/policy.mjs +52 -0
- package/lib/ui/terminal/routes.mjs +167 -0
- package/lib/ui/terminal/usage.mjs +363 -0
- package/lib/ui/terminal/wrap.mjs +37 -0
- package/lib/ui/tokens.mjs +106 -0
- package/lib/usage.mjs +5 -5
- package/lib/view.mjs +5 -2
- package/package.json +3 -2
- package/types/index.d.ts +15 -0
package/lib/modes.mjs
CHANGED
|
@@ -21,7 +21,7 @@ function steppedEffort(config, route, step) {
|
|
|
21
21
|
// tier's route without its activity override (never `micro`); else one effort level less. `high` keeps its model, so a turn that clears the upgrade bar runs on the
|
|
22
22
|
// strongest one. `quality` one effort level more, else the tier above. One lever per decision; quality keeps the
|
|
23
23
|
// model and its cache. `micro` and `balanced` keep the configured route.
|
|
24
|
-
export function modeRoute(config, mode, tier, activity = null) {
|
|
24
|
+
export function modeRoute(config, mode, tier, activity = /** @type {string | null} */ (null)) {
|
|
25
25
|
const routeAt = (t) => resolveRoute(config, t, activity);
|
|
26
26
|
const route = routeAt(tier);
|
|
27
27
|
if (mode === 'balanced' || tier === 'micro') return route;
|
|
@@ -65,9 +65,13 @@ export function applyMode(config, routingMode) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// The active mode and its source: a session override, then the project file, then the profile router.json.
|
|
68
|
-
export function resolveRoutingMode({
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
export function resolveRoutingMode({
|
|
69
|
+
session = /** @type {string | null} */ (null),
|
|
70
|
+
project = /** @type {string | null} */ (null),
|
|
71
|
+
profile = DEFAULTS.mode,
|
|
72
|
+
} = {}) {
|
|
73
|
+
if (session !== null && ROUTING_MODES.includes(session)) return { mode: session, source: 'session' };
|
|
74
|
+
if (project !== null && ROUTING_MODES.includes(project)) return { mode: project, source: 'project' };
|
|
71
75
|
if (profile !== DEFAULTS.mode) return { mode: profile, source: 'profile' };
|
|
72
76
|
return { mode: DEFAULTS.mode, source: 'default' };
|
|
73
77
|
}
|