@alexeiled/claude-router 1.10.1 → 1.10.2

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "router",
3
3
  "displayName": "Router",
4
- "version": "1.10.1",
4
+ "version": "1.10.2",
5
5
  "description": "Model and effort routing for the main conversation by task difficulty and activity, advised by a prompt classifier (Jev, Clef, Clef Flash, OpenAI or local Ollama). Subagents get one model at spawn: every agent that does not pin one.",
6
6
  "author": {
7
7
  "name": "Alexei Ledenev",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.2 (2026-10-11)
4
+
5
+ ### Fixed
6
+
7
+ - Different npm test failures that share a runner header no longer trigger a false model escalation. Repeated-failure matching fingerprints the full normalized error output instead of its first 120 characters. Test names, case, whitespace, and numeric error values stay distinct; empty errors are ignored. Known source positions and runner timings remain comparable across retries.
8
+
3
9
  ## 1.10.1 (2026-10-11)
4
10
 
5
11
  ### Removed
@@ -74,6 +74,8 @@ Node.js is not part of routing. It is used for development, the optional configu
74
74
 
75
75
  One logical turn gets one classification. Tool continuations reuse the decision and add no votes. Before each step, the controller checks whether the selected model still fits after new tool output.
76
76
 
77
+ Repeated tool-error escalation needs matching non-empty error output and an intervening edit attempt within a 40-message lookback. A bounded fingerprint covers the full output, not only the runner header. It removes ANSI colors, normalizes line endings, and normalizes source positions in stack frames and TAP `location` fields. TAP durations and Jest `✕ ... (N ms)` timings are also normalized. Other test names, case, whitespace, and numeric error values are kept. Unrecognized runner noise remains part of the signature: changed output can miss a repeat rather than trigger a false escalation.
78
+
77
79
  An upgrade or downgrade needs a streak of supporting votes (`upgradeVotes`, `downgradeVotes`), because staying keeps a warm cache. Before the first measured reply of a history (session start, clear, rewind, committed compaction), no cache from it exists yet, so one vote is enough. The mass bars, the cash gate, escalation, holds and continuations apply as usual.
78
80
 
79
81
  A move to a smaller context window needs a main-response measurement from the current history and Claude's local context estimate. The router uses the larger available reading and reserves 20% of the model window. If it cannot establish fit, it keeps the current model with `context-unknown`. It does not infer token count from character count.
package/lib/facts.mjs CHANGED
@@ -5,6 +5,7 @@ const EDIT_TOOLS = new Set(['Edit', 'Write', 'MultiEdit', 'NotebookEdit', 'Bash'
5
5
  const FAILURE_WINDOW = 40;
6
6
  const REMINDER = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
7
7
  const CLIP_MARKER = ' […] ';
8
+ const ANSI_ESCAPE = new RegExp(`${String.fromCharCode(0x1b)}\\[[0-?]*[ -/]*[@-~]`, 'g');
8
9
 
9
10
  export function extractFacts(body, memory, { recentTurns, maxTextChars }) {
10
11
  const messages = Array.isArray(body.messages) ? body.messages : [];
@@ -20,9 +21,12 @@ export function extractFacts(body, memory, { recentTurns, maxTextChars }) {
20
21
  const edits = [];
21
22
  messages.forEach((message, index) => {
22
23
  const content = blocks(message.content);
23
- if (message.role === 'user') {
24
+ if (message.role === 'user' && messages.length - 1 - index <= FAILURE_WINDOW) {
24
25
  for (const block of content)
25
- if (block.type === 'tool_result' && block.is_error) errors.push({ index, signature: signatureOf(block) });
26
+ if (block.type === 'tool_result' && block.is_error) {
27
+ const signature = signatureOf(block);
28
+ if (signature) errors.push({ index, signature });
29
+ }
26
30
  } else if (message.role === 'assistant') {
27
31
  for (const block of content) if (block.type === 'tool_use' && EDIT_TOOLS.has(block.name)) edits.push(index);
28
32
  }
@@ -66,7 +70,21 @@ export function clip(text, max) {
66
70
  }
67
71
 
68
72
  function signatureOf(block) {
69
- return textOf(blocks(block.content)).toLowerCase().replace(/\d+/g, '#').replace(/\s+/g, ' ').slice(0, 120);
73
+ const text = textOf(blocks(block.content))
74
+ .replace(ANSI_ESCAPE, '')
75
+ .replace(/\r\n?/g, '\n')
76
+ .replace(/^([ \t]*at[ \t]+[^\n]+\.[a-z]+):\d+(?::\d+)?(\)?)[ \t]*$/gim, '$1:#$2')
77
+ .replace(/^([ \t]*location:[ \t]*['"]?[^\n'"]+\.[a-z]+):\d+(?::\d+)?(['"]?)[ \t]*$/gim, '$1:#$2')
78
+ .replace(/^([ \t]*(?:#[ \t]*)?duration_ms:?[ \t]+)\d+(?:\.\d+)?[ \t]*$/gm, '$1#')
79
+ .replace(/^([ \t]*✕[ \t]+.+) \(\d+(?:\.\d+)? ms\)$/gm, '$1 (# ms)')
80
+ .trim();
81
+ if (!text) return '';
82
+ // FNV-1a keeps the full diagnostic in a bounded key without Node APIs in the Mod sandbox.
83
+ // Unknown runner noise is kept: changed output conservatively counts as a new failure.
84
+ let hash = 0xcbf29ce484222325n;
85
+ for (let i = 0; i < text.length; i += 1)
86
+ hash = BigInt.asUintN(64, (hash ^ BigInt(text.charCodeAt(i))) * 0x100000001b3n);
87
+ return hash.toString(16);
70
88
  }
71
89
 
72
90
  function blocks(content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexeiled/claude-router",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Native Claude Code Mod: model and effort routing for the main conversation, advised by Jev, Clef, Clef Flash, OpenAI or Ollama.",
5
5
  "license": "MIT",
6
6
  "author": "Alexei Ledenev",