@alexeiled/claude-router 1.8.1 → 1.10.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 +2 -2
- package/CHANGELOG.md +25 -0
- package/README.md +7 -3
- package/docs/activity-routing.md +22 -20
- package/docs/architecture.md +13 -3
- package/docs/configuration.md +68 -8
- package/docs/evaluation.md +39 -3
- package/docs/native-router.md +14 -14
- package/docs/router-pane-classifier.svg +82 -63
- package/docs/router-pane-now.svg +95 -109
- package/docs/router-pane-policy.svg +70 -0
- package/docs/router-pane-routes.svg +103 -0
- package/docs/router-pane-usage.svg +100 -124
- package/docs/user-guide.md +58 -43
- package/hooks/native-router.mjs +343 -34
- package/lib/band.mjs +10 -1
- package/lib/classifier-client.mjs +6 -3
- package/lib/config.mjs +37 -1
- package/lib/cost.mjs +14 -3
- package/lib/display.mjs +10 -25
- package/lib/panel.mjs +707 -425
- package/lib/route.mjs +2 -2
- package/lib/savings.mjs +11 -3
- package/lib/subagents.mjs +280 -0
- package/lib/view.mjs +2 -0
- package/package.json +1 -1
- package/types/index.d.ts +34 -1
- package/docs/router-pane-routing.svg +0 -151
package/lib/display.mjs
CHANGED
|
@@ -37,9 +37,6 @@ export function routeName(config, route) {
|
|
|
37
37
|
return `${modelName(model.id)}${model.efforts.length ? ` · ${route.effort ?? 'session'}` : ''}`;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
// One letter per activity for the REPLIES strip: `docs` is `w` (writing), since `debug` has `d`.
|
|
41
|
-
export const ACTIVITY_LETTER = { code: 'c', debug: 'd', explore: 'e', plan: 'p', review: 'r', ops: 'o', docs: 'w' };
|
|
42
|
-
|
|
43
40
|
// Changes of route between consecutive replies, from the (model, effort) each request went out with, so a move inside
|
|
44
41
|
// a tier counts and a later change of settings does not rewrite the count. A reply routing did not choose breaks no run.
|
|
45
42
|
export const switchCount = (routes) =>
|
|
@@ -96,24 +93,6 @@ export function missingText(config, id, missing) {
|
|
|
96
93
|
return `no ${CLASSIFIER_OPTIONS[option] ?? 'setting'}`;
|
|
97
94
|
}
|
|
98
95
|
|
|
99
|
-
// Every setting the configured classifiers read, grouped by classifier: "Jev: API key · Clef, Clef Flash: API token,
|
|
100
|
-
// account ID · Ollama: no key needed".
|
|
101
|
-
export function credentialsNeeded(config) {
|
|
102
|
-
// Grouped by option name, not by its words: Jev's "API key" and OpenAI's "API key" are different settings.
|
|
103
|
-
const groups = new Map();
|
|
104
|
-
for (const entry of Object.values(config.classifiers)) {
|
|
105
|
-
const options = [entry.keyOption, ...endpointSettings(entry.endpoint)].filter((option) => option !== null);
|
|
106
|
-
const key = options.join(', ');
|
|
107
|
-
const group = groups.get(key) ?? {
|
|
108
|
-
needs: options.map((option) => CLASSIFIER_OPTIONS[option]).join(', ') || 'no key needed',
|
|
109
|
-
labels: [],
|
|
110
|
-
};
|
|
111
|
-
group.labels.push(entry.label);
|
|
112
|
-
groups.set(key, group);
|
|
113
|
-
}
|
|
114
|
-
return [...groups.values()].map(({ needs, labels }) => `${labels.join(', ')}: ${needs}`).join(' · ');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
96
|
// The active classifier with what went wrong: "Jev: no API key", "Clef timed out". Short: the band keeps it whole.
|
|
118
97
|
export function classifierStatus(config, error) {
|
|
119
98
|
const label = activeClassifier(config).label;
|
|
@@ -233,7 +212,7 @@ export function activityRouteText(config, view) {
|
|
|
233
212
|
// Reasons that only say the route stayed: on an override cell they leave out why it is not the tier's base route.
|
|
234
213
|
const STAYED = ['ready', 'same-tier', 'no-advice', 'continuation', 'uncertain'];
|
|
235
214
|
|
|
236
|
-
// The Now tab's Why. In `on`, an activity move, or a stay on an override cell, says the cell plainly: "
|
|
215
|
+
// The Now tab's Why. In `on`, an activity move, or a stay on an override cell, says the cell plainly: "coding at low
|
|
237
216
|
// runs on Sonnet 5.5 · high", or for a move to no activity "low runs on its base route, Haiku 5.5 · high".
|
|
238
217
|
// Every other decision keeps its reason: a refusal, a hold or a tier move says more than the cell.
|
|
239
218
|
export function whyText(config, view) {
|
|
@@ -245,7 +224,7 @@ export function whyText(config, view) {
|
|
|
245
224
|
const moved = view.reason === 'activity-up' || view.reason === 'activity-down';
|
|
246
225
|
if (!moved && !(override && STAYED.includes(view.reason ?? 'ready'))) return reason;
|
|
247
226
|
return activity
|
|
248
|
-
? `${activity} at ${view.tier} runs on ${routeName(config, route)}`
|
|
227
|
+
? `${activityVerb(activity)} at ${view.tier} runs on ${routeName(config, route)}`
|
|
249
228
|
: `${view.tier} runs on its base route, ${routeName(config, route)}`;
|
|
250
229
|
}
|
|
251
230
|
|
|
@@ -270,11 +249,17 @@ export function storeAgreementLine(view) {
|
|
|
270
249
|
return `Agreement across sessions: ${all}${code}`;
|
|
271
250
|
}
|
|
272
251
|
|
|
252
|
+
// The classifier's last checked-in activity probe, or null when none was run on the model it is configured with.
|
|
253
|
+
export const probeOf = (config, id) => {
|
|
254
|
+
const probe = PROBE_RESULTS[id];
|
|
255
|
+
return probe && probe.model === config.classifiers[id]?.model ? probe : null;
|
|
256
|
+
};
|
|
257
|
+
|
|
273
258
|
// The classifier's last checked-in activity probe, "activity probe 70/70 · p95 299 ms · Oct 10", or null when none
|
|
274
259
|
// was run on the model it is configured with.
|
|
275
260
|
export function probeText(config, id) {
|
|
276
|
-
const probe =
|
|
277
|
-
if (!probe
|
|
261
|
+
const probe = probeOf(config, id);
|
|
262
|
+
if (!probe) return null;
|
|
278
263
|
const day = new Date(`${probe.date}T00:00:00Z`).toLocaleDateString('en-US', {
|
|
279
264
|
month: 'short',
|
|
280
265
|
day: 'numeric',
|