@alexeiled/claude-router 1.20.1 → 1.21.1
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 +3 -3
- package/docs/activity-routing.md +1 -1
- package/docs/architecture.md +6 -4
- package/docs/configuration.md +9 -8
- package/docs/evaluation.md +4 -4
- package/docs/native-router.md +11 -11
- package/docs/providers.md +5 -6
- package/docs/router-band.svg +158 -137
- package/docs/router-pane-classifier.svg +21 -23
- package/docs/router-pane-now.svg +138 -173
- package/docs/router-pane-policy.svg +21 -23
- package/docs/router-pane-routes.svg +32 -34
- package/docs/router-pane-usage-whatif.svg +139 -157
- package/docs/router-pane-usage.svg +165 -165
- package/docs/routing-modes.md +22 -20
- package/docs/user-guide.md +130 -71
- package/hooks/native-router.mjs +9 -5
- package/lib/band.mjs +254 -171
- package/lib/config.mjs +33 -18
- package/lib/cost.mjs +26 -10
- package/lib/costs.mjs +156 -0
- package/lib/display.mjs +115 -92
- package/lib/modes.mjs +8 -7
- package/lib/panel.mjs +487 -445
- package/lib/policy.mjs +1 -1
- package/lib/prices.mjs +113 -0
- package/lib/providers.mjs +9 -21
- package/lib/route.mjs +1 -1
- package/lib/savings.mjs +14 -8
- package/lib/subagents.mjs +3 -3
- package/package.json +2 -1
package/lib/modes.mjs
CHANGED
|
@@ -15,18 +15,19 @@ function steppedEffort(config, route, step) {
|
|
|
15
15
|
return choices.find((effort) => supported.includes(effort)) ?? null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
// The route `mode` runs for tier and activity, always from the configured routes. `cost` takes
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
18
|
+
// The route `mode` runs for tier and activity, always from the configured routes. `cost` takes a model with a lower
|
|
19
|
+
// input price where one is below: the tier below, or at `low` the tier's route without its activity override (never
|
|
20
|
+
// `micro`); else one effort level less. `high` keeps its model, so a turn that clears the upgrade bar runs on the
|
|
21
|
+
// strongest one. `quality` one effort level more, else the tier above. One lever per decision; quality keeps the
|
|
22
|
+
// model and its cache. `micro` and `balanced` keep the configured route.
|
|
22
23
|
export function modeRoute(config, mode, tier, activity = null) {
|
|
23
24
|
const routeAt = (t) => resolveRoute(config, t, activity);
|
|
24
25
|
const route = routeAt(tier);
|
|
25
26
|
if (mode === 'balanced' || tier === 'micro') return route;
|
|
26
27
|
if (mode === 'cost') {
|
|
27
|
-
const below =
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const below = tier === 'low' ? resolveRoute(config, 'low') : routeAt(TIERS[rank(tier) - 1]);
|
|
29
|
+
const cheaper = config.models[below.model].input < config.models[route.model].input;
|
|
30
|
+
if (tier !== 'high' && below.model !== route.model && cheaper) return below;
|
|
30
31
|
const effort = steppedEffort(config, route, -1);
|
|
31
32
|
return effort ? { model: route.model, effort } : route;
|
|
32
33
|
}
|