@alexeiled/claude-router 1.14.0 → 1.15.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 +31 -0
- package/README.md +3 -0
- package/docs/architecture.md +10 -0
- package/docs/configuration.md +6 -2
- package/docs/native-router.md +1 -0
- package/docs/router-band.svg +30 -8
- package/docs/router-pane-now.svg +133 -131
- package/docs/router-pane-policy.svg +47 -43
- package/docs/routing-modes.md +139 -0
- package/docs/user-guide.md +4 -0
- package/hooks/native-router.mjs +144 -16
- package/lib/activity.mjs +8 -2
- package/lib/band.mjs +7 -1
- package/lib/config.mjs +69 -17
- package/lib/cost.mjs +3 -0
- package/lib/display.mjs +17 -2
- package/lib/modes.mjs +98 -0
- package/lib/panel.mjs +38 -3
- package/lib/route.mjs +80 -23
- package/lib/usage.mjs +31 -19
- package/package.json +2 -1
- package/types/index.d.ts +15 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 657
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 657 553" role="img" aria-labelledby="title desc">
|
|
2
2
|
<title id="title">Router pane, Policy tab</title>
|
|
3
3
|
<desc id="desc">Each policy control inside the sentence it completes: the start tier, votes and payback horizon for going down, the support needed to go up, the activity threshold and the credits cap, with the default shown beside a changed value, the router.json file, and the unsaved change with Save and Discard.</desc>
|
|
4
4
|
<style>
|
|
5
5
|
text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 13px; }
|
|
6
6
|
.cap { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 12px; fill: #9a988f; }
|
|
7
7
|
</style>
|
|
8
|
-
<rect width="657" height="
|
|
9
|
-
<rect x="10" y="10" width="637" height="
|
|
8
|
+
<rect width="657" height="553" rx="8" fill="#1c1c1c"/>
|
|
9
|
+
<rect x="10" y="10" width="637" height="533" rx="6" fill="none" stroke="#3f5f8f"/>
|
|
10
10
|
<text x="24.0" y="34" fill="#5fafd7" font-weight="700" xml:space="preserve">ROUTING</text>
|
|
11
11
|
<rect x="94.2" y="20" width="62.4" height="18" rx="4" fill="#87afff"/>
|
|
12
12
|
<text x="94.2" y="34" fill="#0d1016" font-weight="700" xml:space="preserve">[ ◉ on ]</text>
|
|
@@ -27,44 +27,48 @@
|
|
|
27
27
|
<text x="468.6" y="53" fill="#d0d0d0" xml:space="preserve">[ ? ]</text>
|
|
28
28
|
<text x="24.0" y="91" fill="#5fafd7" font-weight="700" xml:space="preserve">POLICY</text>
|
|
29
29
|
<text x="70.8" y="91" fill="#7c7c7c" xml:space="preserve"> · how readily the router changes models · edit, then Save</text>
|
|
30
|
-
<text x="24.0" y="129" fill="#d0d0d0" font-weight="700" xml:space="preserve">
|
|
31
|
-
<text x="125.4" y="129" fill="#d0d0d0" xml:space="preserve">
|
|
32
|
-
<text x="
|
|
33
|
-
<text x="24.0" y="148" fill="#7c7c7c" xml:space="preserve">
|
|
34
|
-
<text x="24.0" y="167" fill="#d0d0d0" font-weight="700" xml:space="preserve">
|
|
35
|
-
<text x="125.4" y="167" fill="#d0d0d0" xml:space="preserve">
|
|
36
|
-
<text x="
|
|
37
|
-
<text x="
|
|
38
|
-
<text x="
|
|
39
|
-
<text x="
|
|
40
|
-
<text x="
|
|
41
|
-
<text x="
|
|
42
|
-
<text x="
|
|
43
|
-
<text x="
|
|
44
|
-
<text x="
|
|
45
|
-
<text x="
|
|
46
|
-
<text x="
|
|
47
|
-
<text x="
|
|
48
|
-
<text x="24.0" y="
|
|
49
|
-
<text x="
|
|
50
|
-
<text x="
|
|
51
|
-
<text x="
|
|
52
|
-
<text x="24.0" y="281" fill="#7c7c7c" xml:space="preserve">
|
|
53
|
-
<
|
|
54
|
-
<text x="
|
|
55
|
-
<text x="
|
|
56
|
-
<text x="
|
|
57
|
-
<rect x="
|
|
58
|
-
<text x="
|
|
59
|
-
<text x="24.0" y="
|
|
60
|
-
<text x="
|
|
61
|
-
<
|
|
62
|
-
<text x="
|
|
63
|
-
<text x="24.0" y="
|
|
64
|
-
<
|
|
65
|
-
<text x="
|
|
66
|
-
<
|
|
67
|
-
<text x="
|
|
68
|
-
<rect x="
|
|
69
|
-
<text x="
|
|
30
|
+
<text x="24.0" y="129" fill="#d0d0d0" font-weight="700" xml:space="preserve">Mode</text>
|
|
31
|
+
<text x="125.4" y="129" fill="#d0d0d0" xml:space="preserve">balanced ▾</text>
|
|
32
|
+
<text x="203.4" y="129" fill="#7c7c7c" xml:space="preserve"> saved at once</text>
|
|
33
|
+
<text x="24.0" y="148" fill="#7c7c7c" xml:space="preserve"> each tier runs its route as configured</text>
|
|
34
|
+
<text x="24.0" y="167" fill="#d0d0d0" font-weight="700" xml:space="preserve">Start</text>
|
|
35
|
+
<text x="125.4" y="167" fill="#d0d0d0" xml:space="preserve">at </text>
|
|
36
|
+
<text x="148.8" y="167" fill="#d0d0d0" xml:space="preserve">low ▾</text>
|
|
37
|
+
<text x="24.0" y="186" fill="#7c7c7c" xml:space="preserve"> when the session’s model is no tier’s model</text>
|
|
38
|
+
<text x="24.0" y="205" fill="#d0d0d0" font-weight="700" xml:space="preserve">Going down</text>
|
|
39
|
+
<text x="125.4" y="205" fill="#d0d0d0" xml:space="preserve">after </text>
|
|
40
|
+
<text x="172.2" y="205" fill="#d0d0d0" xml:space="preserve">3 ▾</text>
|
|
41
|
+
<text x="195.6" y="205" fill="#d0d0d0" xml:space="preserve"> agreeing turns </text>
|
|
42
|
+
<text x="320.4" y="205" fill="#d7af5f" xml:space="preserve">●</text>
|
|
43
|
+
<text x="336.0" y="205" fill="#7c7c7c" xml:space="preserve">default 2</text>
|
|
44
|
+
<text x="125.4" y="224" fill="#d0d0d0" xml:space="preserve">if a cache write pays back within </text>
|
|
45
|
+
<text x="390.6" y="224" fill="#d0d0d0" xml:space="preserve">5 turns ▾</text>
|
|
46
|
+
<text x="24.0" y="243" fill="#d0d0d0" font-weight="700" xml:space="preserve">Going up</text>
|
|
47
|
+
<text x="125.4" y="243" fill="#7c7c7c" xml:space="preserve">needs Jev support of 75%, up to 90% as the switch costs more</text>
|
|
48
|
+
<text x="24.0" y="262" fill="#d0d0d0" font-weight="700" xml:space="preserve">Activities</text>
|
|
49
|
+
<text x="125.4" y="262" fill="#d0d0d0" xml:space="preserve">apply at </text>
|
|
50
|
+
<text x="195.6" y="262" fill="#d0d0d0" xml:space="preserve">60% ▾</text>
|
|
51
|
+
<text x="234.6" y="262" fill="#d0d0d0" xml:space="preserve"> certainty or more </text>
|
|
52
|
+
<text x="24.0" y="281" fill="#7c7c7c" xml:space="preserve"> else a new task runs its tier’s model; a continuation keeps it</text>
|
|
53
|
+
<text x="24.0" y="300" fill="#d0d0d0" font-weight="700" xml:space="preserve">Credits</text>
|
|
54
|
+
<text x="125.4" y="300" fill="#d0d0d0" xml:space="preserve">cap one cold cache write at </text>
|
|
55
|
+
<text x="343.8" y="300" fill="#d0d0d0" xml:space="preserve">$2.00 ▾</text>
|
|
56
|
+
<text x="24.0" y="319" fill="#7c7c7c" xml:space="preserve"> no model in router.json bills credits, so this has no effect</text>
|
|
57
|
+
<rect x="24.0" y="343" width="218.4" height="18" rx="4" fill="#2e3340"/>
|
|
58
|
+
<text x="24.0" y="357" fill="#d0d0d0" xml:space="preserve">[ Reset policy to defaults ]</text>
|
|
59
|
+
<text x="24.0" y="395" fill="#5fafd7" font-weight="700" xml:space="preserve">FILE</text>
|
|
60
|
+
<text x="55.2" y="395" fill="#d0d0d0" xml:space="preserve"> ~/.claude/router.json </text>
|
|
61
|
+
<rect x="250.2" y="381" width="62.4" height="18" rx="4" fill="#2e3340"/>
|
|
62
|
+
<text x="250.2" y="395" fill="#d0d0d0" xml:space="preserve">[ copy ]</text>
|
|
63
|
+
<text x="24.0" y="414" fill="#7c7c7c" xml:space="preserve">Subagents: on. Agents that pin no model get one at spawn, kept for every step.</text>
|
|
64
|
+
<text x="24.0" y="452" fill="#7c7c7c" xml:space="preserve">router.json changes:</text>
|
|
65
|
+
<text x="24.0" y="471" fill="#e06c6c" xml:space="preserve">- policy.downgradeVotes 2</text>
|
|
66
|
+
<text x="24.0" y="490" fill="#87d787" xml:space="preserve">+ policy.downgradeVotes 3</text>
|
|
67
|
+
<text x="24.0" y="509" fill="#d7af5f" xml:space="preserve">● 1 unsaved routing change </text>
|
|
68
|
+
<rect x="242.4" y="495" width="62.4" height="18" rx="4" fill="#87afff"/>
|
|
69
|
+
<text x="242.4" y="509" fill="#0d1016" font-weight="700" xml:space="preserve">[ Save ]</text>
|
|
70
|
+
<rect x="312.6" y="495" width="85.8" height="18" rx="4" fill="#2e3340"/>
|
|
71
|
+
<text x="312.6" y="509" fill="#d0d0d0" xml:space="preserve">[ Discard ]</text>
|
|
72
|
+
<rect x="24.0" y="514" width="70.2" height="18" rx="4" fill="#2e3340"/>
|
|
73
|
+
<text x="24.0" y="528" fill="#d0d0d0" xml:space="preserve">[ Close ]</text>
|
|
70
74
|
</svg>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Routing modes
|
|
2
|
+
|
|
3
|
+
One setting trades cost against answer quality: `cost`, `balanced` (the default) or `quality`. The classifier and
|
|
4
|
+
your routes stay as they are. The mode moves the route each tier runs by one fixed step.
|
|
5
|
+
|
|
6
|
+
| Mode | What changes |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| `cost` | A cheaper route where the turn allows it: the tier below when that tier runs a model with a lower input price, else one effort level less on the same model. Never below `low`. |
|
|
9
|
+
| `balanced` | Nothing: every tier runs its route as configured. |
|
|
10
|
+
| `quality` | One effort level more on the same model, else the route of the tier above. |
|
|
11
|
+
|
|
12
|
+
In every mode:
|
|
13
|
+
|
|
14
|
+
- `micro` turns keep the `micro` route. Only the classifier makes a turn `micro`; `cost` never does.
|
|
15
|
+
- A pin (`/router pin <tier>`) runs that tier's configured route. With routing off (`/router off`, `/model`),
|
|
16
|
+
Claude's model runs, as before.
|
|
17
|
+
- A route never loses its effort: an effort level moves only within what the model lists in `models.<alias>.efforts`,
|
|
18
|
+
and a route with a `null` effort (the session's) or a model without efforts has no effort step.
|
|
19
|
+
|
|
20
|
+
## Choose a mode
|
|
21
|
+
|
|
22
|
+
The mode comes from the first of these that sets one:
|
|
23
|
+
|
|
24
|
+
1. **This session:** `/router mode cost`, `/router mode balanced` or `/router mode quality`. `/router mode default`
|
|
25
|
+
clears it. A resume of the session keeps it; a new session does not.
|
|
26
|
+
2. **The project:** `.claude/router.json` in the directory Claude Code runs in. It may hold only the mode, for
|
|
27
|
+
example `{ "mode": "cost" }`. A file with any other key, a mode that is not one of the three, or JSON that does not
|
|
28
|
+
parse is ignored, and the pane and `/router` say why. Add it to `.gitignore` to keep the choice to yourself.
|
|
29
|
+
3. **The profile:** `"mode"` in `router.json`, or **Mode** on the pane's Policy tab, which saves at once with Undo.
|
|
30
|
+
4. `balanced`.
|
|
31
|
+
|
|
32
|
+
The band, the Now tab and `/router` show the mode and its source, for example `cost (session)`. The prompt footer
|
|
33
|
+
names a mode other than balanced.
|
|
34
|
+
|
|
35
|
+
## When a change applies
|
|
36
|
+
|
|
37
|
+
A change applies from the next turn. It changes the route the router prefers; the route in use moves through the
|
|
38
|
+
same checks as any other switch. On the same task a cheaper route waits until `minDwellRequests` requests have run on
|
|
39
|
+
the route in use and a check (tests, build, lint) has passed since. A move must also pay back its cache write. Until
|
|
40
|
+
then the band says why the route stays. Pin a tier to run its configured route now.
|
|
41
|
+
|
|
42
|
+
## Policy per mode
|
|
43
|
+
|
|
44
|
+
Each mode except `balanced` replaces some `policy` fields while it is active. The built-in values come from
|
|
45
|
+
codex-router and are **not tuned** on this router:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"modes": {
|
|
50
|
+
"cost": { "policy": { "upgradeVotes": 3, "upgradeBase": 0.85, "jumpConfidence": 0.98, "downgradeVotes": 1,
|
|
51
|
+
"downgradeMass": 0.8, "minDwellRequests": 4, "escalationHoldTurns": 1 } },
|
|
52
|
+
"quality": { "policy": { "upgradeVotes": 1, "upgradeBase": 0.6, "jumpConfidence": 0.9, "downgradeVotes": 3,
|
|
53
|
+
"downgradeMass": 0.95, "minDwellRequests": 16, "escalationHoldTurns": 4 } }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Your `modes` entries merge field by field over these. A mode's field beats the same field in `policy`. Only `policy`
|
|
59
|
+
keys are allowed, and the result must pass the same checks as `policy`.
|
|
60
|
+
|
|
61
|
+
## Every decision
|
|
62
|
+
|
|
63
|
+
The route each mode gives a session's first turn, for each classifier answer, through the router's real decision
|
|
64
|
+
path. Generated from the test data by `npm run docs:modes`; `test/mode-matrix.test.mjs` fails when it is stale.
|
|
65
|
+
|
|
66
|
+
<!-- mode-matrix:start -->
|
|
67
|
+
**Built-in routes**
|
|
68
|
+
|
|
69
|
+
| Classifier | Activities | cost | balanced | quality |
|
|
70
|
+
| --- | --- | --- | --- | --- |
|
|
71
|
+
| micro | code, debug, explore, plan, review, ops, docs, uncertain | Haiku · medium | Haiku · medium | Haiku · medium |
|
|
72
|
+
| low | code, debug, plan, review | Sonnet · medium | Sonnet · high | Sonnet · xhigh |
|
|
73
|
+
| low | explore, ops, docs, uncertain | Haiku · medium | Haiku · high | Haiku · xhigh |
|
|
74
|
+
| medium | code, debug, plan, review | Sonnet · high | Opus · medium | Opus · high |
|
|
75
|
+
| medium | explore, docs, uncertain | Haiku · high | Opus · medium | Opus · high |
|
|
76
|
+
| medium | ops | Haiku · medium | Haiku · high | Haiku · xhigh |
|
|
77
|
+
| high | code, debug, explore, plan, review, docs, uncertain | Opus · high | Opus · xhigh | Opus · max |
|
|
78
|
+
| high | ops | Haiku · high | Opus · xhigh | Opus · max |
|
|
79
|
+
| uncertain | code, debug, plan, review | Sonnet · medium | Sonnet · high | Sonnet · xhigh |
|
|
80
|
+
| uncertain | explore, ops, docs, uncertain | Haiku · medium | Haiku · high | Haiku · xhigh |
|
|
81
|
+
|
|
82
|
+
**`routes.high` = Opus · high**
|
|
83
|
+
|
|
84
|
+
| Classifier | Activities | cost | balanced | quality |
|
|
85
|
+
| --- | --- | --- | --- | --- |
|
|
86
|
+
| micro | code, debug, explore, plan, review, ops, docs, uncertain | Haiku · medium | Haiku · medium | Haiku · medium |
|
|
87
|
+
| low | code, debug, plan, review | Sonnet · medium | Sonnet · high | Sonnet · xhigh |
|
|
88
|
+
| low | explore, ops, docs, uncertain | Haiku · medium | Haiku · high | Haiku · xhigh |
|
|
89
|
+
| medium | code, debug, plan, review | Sonnet · high | Opus · medium | Opus · high |
|
|
90
|
+
| medium | explore, docs, uncertain | Haiku · high | Opus · medium | Opus · high |
|
|
91
|
+
| medium | ops | Haiku · medium | Haiku · high | Haiku · xhigh |
|
|
92
|
+
| high | code, debug, explore, plan, review, docs, uncertain | Opus · medium | Opus · high | Opus · xhigh |
|
|
93
|
+
| high | ops | Haiku · high | Opus · high | Opus · xhigh |
|
|
94
|
+
| uncertain | code, debug, plan, review | Sonnet · medium | Sonnet · high | Sonnet · xhigh |
|
|
95
|
+
| uncertain | explore, ops, docs, uncertain | Haiku · medium | Haiku · high | Haiku · xhigh |
|
|
96
|
+
<!-- mode-matrix:end -->
|
|
97
|
+
|
|
98
|
+
## Known trade-offs
|
|
99
|
+
|
|
100
|
+
The steps are fixed rules, with no per-activity exceptions. Two cells go against this router's own model notes
|
|
101
|
+
(`lib/config.mjs`), and replay data should decide them later:
|
|
102
|
+
|
|
103
|
+
- `cost` at `high` for **ops** runs Haiku 5.5 at high (the `medium` ops route), although Haiku trails Opus on
|
|
104
|
+
multi-step tool work. Repeated tool errors cannot escalate it: no tier is above `high`. For such a task, pin `high`
|
|
105
|
+
or switch to `balanced`.
|
|
106
|
+
- `cost` at `low` for **code, debug, plan and review** runs Sonnet 5.5 at medium, which scored below Haiku 5.5 at high
|
|
107
|
+
on FrontierCode and costs more per token.
|
|
108
|
+
|
|
109
|
+
With the built-in routes, `cost` at `low` runs Haiku 5.5 at medium, the same route as `micro`.
|
|
110
|
+
|
|
111
|
+
## Measured impact
|
|
112
|
+
|
|
113
|
+
One 5-turn coding task (read two files, add a function with tests, run the tests, review, add edge-case tests), the
|
|
114
|
+
same prompts in a new session per mode, Jev classifier, built-in routes. Cost is a list-price estimate of the measured
|
|
115
|
+
tokens ([raw results](../experiments/mod-router/results/mode-live-acceptance.json)).
|
|
116
|
+
|
|
117
|
+
| Mode | Replies by route | Switches | Output tokens | Estimated cost |
|
|
118
|
+
| -------- | ----------------------------------- | -------- | ------------- | -------------- |
|
|
119
|
+
| cost | Haiku · medium 2, Sonnet · medium 6 | 1 | 2,860 | $0.166 |
|
|
120
|
+
| balanced | Opus · medium 10 | 0 | 3,986 | $0.323 |
|
|
121
|
+
| quality | Opus · high 8 | 0 | 5,332 | $0.358 |
|
|
122
|
+
|
|
123
|
+
**These are single runs.** The classifier's answers vary from run to run: its confidence that the first turn was
|
|
124
|
+
`micro` was 92%, 74% and 79% in the three runs, so part of the first-turn difference is classifier noise, not the mode.
|
|
125
|
+
Read the numbers as the direction and rough size of the effect, not as a benchmark.
|
|
126
|
+
|
|
127
|
+
- `quality` ran the same model as `balanced`, at the same price per token. All of its extra cost is output: 34% more
|
|
128
|
+
tokens at the higher effort. A list-price estimate can't show this: priced as one nominal turn each, a fixed set of 20
|
|
129
|
+
prompts comes to $2.916 in both modes ([probe](../experiments/mod-router/results/mode-probe-jev.json)).
|
|
130
|
+
- `cost` spent $0.069 of its $0.166 on one cache write, for the move to Sonnet. A longer session spreads that write
|
|
131
|
+
over more turns.
|
|
132
|
+
- Every task ended with the tests passing; this run does not compare the quality of the answers.
|
|
133
|
+
|
|
134
|
+
## Records
|
|
135
|
+
|
|
136
|
+
The decision at the start of each turn writes one line to Claude Code's debug log (`claude --debug`): `router
|
|
137
|
+
decision` with the mode, its source, the classifier's tier, the tier and reason the router chose, and the route. A move
|
|
138
|
+
later in the turn (a review, the turn's tool calls, a context fit) writes none; the usage cells show it. Usage records keep each reply
|
|
139
|
+
under its mode (`mode|activity|tier|model@effort`).
|
package/docs/user-guide.md
CHANGED
|
@@ -225,11 +225,15 @@ On the **Classifier** tab, **ACROSS SESSIONS · since the last reset** shows the
|
|
|
225
225
|
| `/router off` | Turn routing off and keep Claude's selected model. |
|
|
226
226
|
| `/router pin <micro\|low\|medium\|high>` | Pin the next turn and its tool continuations. Routing on must already be enabled. |
|
|
227
227
|
| `/router activities <off\|on>` | Set the [activity routing](#route-by-activity) mode. Saved to `router.json` at once; **Undo** reverts it. |
|
|
228
|
+
| `/router mode <cost\|balanced\|quality>` | Set this session's [routing mode](routing-modes.md) from the next turn. A resume keeps it. |
|
|
229
|
+
| `/router mode default` | Clear the session's mode: the project's or the profile's applies again. |
|
|
228
230
|
| `/model <name>` | Select a model and turn routing off. Use `/router auto` to turn it back on. |
|
|
229
231
|
| **Turn on** / **Turn off** on the band | The same as `/router auto` and `/router off`. |
|
|
230
232
|
| **on** / **off** on the pane (`o` / `f`) | The same as `/router auto` and `/router off`. |
|
|
231
233
|
| **pin** on the Now tab | Pin that tier for the next turn. Routing on must already be enabled. |
|
|
232
234
|
|
|
235
|
+
A routing mode moves each tier's route one step toward cost or quality; pins and `micro` turns are not moved. The band and the Now tab show the mode and where it comes from, such as `cost (session)`. A change applies from the next turn, and the route in use moves only through the usual checks, so on a running task a cheaper route can wait a few requests and for a passed test. **Mode** on the Policy tab sets the profile's mode. See [Routing modes](routing-modes.md).
|
|
236
|
+
|
|
233
237
|
A pin does not change the next turn after the pinned turn finishes. A fresh session on a model that a tier routes to, or with activity routing `on` a model an activity override uses (Sonnet 5.5 on the defaults), starts with routing on. A fresh session on any other model starts with routing off. `/clear` starts the new session with routing on. Resuming a saved session restores its saved routing on or off.
|
|
234
238
|
|
|
235
239
|
## Edit routes and policy
|
package/hooks/native-router.mjs
CHANGED
|
@@ -31,12 +31,14 @@ import {
|
|
|
31
31
|
effectiveRoutes,
|
|
32
32
|
loadConfig,
|
|
33
33
|
MIGRATION_HINT,
|
|
34
|
+
ROUTING_MODES,
|
|
34
35
|
supportedVersion,
|
|
35
36
|
TIERS,
|
|
36
37
|
tuningOf,
|
|
37
38
|
withActivities,
|
|
38
39
|
withClassifier,
|
|
39
40
|
withClassifierTimeout,
|
|
41
|
+
withMode,
|
|
40
42
|
withRoutes,
|
|
41
43
|
withTuning,
|
|
42
44
|
} from '../lib/config.mjs';
|
|
@@ -54,6 +56,7 @@ import {
|
|
|
54
56
|
unavailableReason,
|
|
55
57
|
} from '../lib/display.mjs';
|
|
56
58
|
import { clip, observedActivity, promptIndex } from '../lib/facts.mjs';
|
|
59
|
+
import { applyMode, modeLabel, readProjectMode, resolveRoutingMode } from '../lib/modes.mjs';
|
|
57
60
|
import { renderPanel, routeDraftOf, routingChanges } from '../lib/panel.mjs';
|
|
58
61
|
import {
|
|
59
62
|
canMoveUp,
|
|
@@ -135,6 +138,8 @@ const PANE = 'jev-router';
|
|
|
135
138
|
const PANE_TITLE = 'Router';
|
|
136
139
|
const BAND_DETAIL = 'band:detail';
|
|
137
140
|
const MODE_PREFIX = 'mode:';
|
|
141
|
+
// The session's routing mode override (lib/modes.mjs), apart from its auto|manual MODE_PREFIX.
|
|
142
|
+
const ROUTING_MODE_PREFIX = 'routing-mode:';
|
|
138
143
|
const isSet = (value) => /^(1|true|yes|on)$/i.test(String(value ?? '').trim());
|
|
139
144
|
|
|
140
145
|
// The counts kept across sessions: each session writes only its own record of a kind, `prefix` and its session id,
|
|
@@ -208,6 +213,10 @@ function createRouter(options) {
|
|
|
208
213
|
turnControllers: new Map(),
|
|
209
214
|
view: null,
|
|
210
215
|
modes: new Map(),
|
|
216
|
+
// Each session's routing mode override (null: none), as read from or written to the store.
|
|
217
|
+
routingModes: new Map(),
|
|
218
|
+
// The project's `.claude/router.json` mode, read at session.start: { mode, error }.
|
|
219
|
+
project: { mode: null, error: null },
|
|
211
220
|
// Each routed turn's activity record until turn.complete adds it to the stats, and the session's open run of
|
|
212
221
|
// one activity, flushed to the store when it ends.
|
|
213
222
|
turnActivities: new Map(),
|
|
@@ -297,6 +306,84 @@ async function rememberMode($, mode) {
|
|
|
297
306
|
}
|
|
298
307
|
}
|
|
299
308
|
|
|
309
|
+
// The routing mode a turn starts with and where it comes from. A store that cannot be read counts as no override.
|
|
310
|
+
async function routingModeOf($, router) {
|
|
311
|
+
const sessionId = await $.session.id();
|
|
312
|
+
if (!router.routingModes.has(sessionId)) {
|
|
313
|
+
const saved = await $.store.get(`${ROUTING_MODE_PREFIX}${sessionId}`).catch(() => null);
|
|
314
|
+
router.routingModes.set(sessionId, ROUTING_MODES.includes(saved) ? saved : null);
|
|
315
|
+
}
|
|
316
|
+
return resolveRoutingMode({
|
|
317
|
+
session: router.routingModes.get(sessionId),
|
|
318
|
+
project: router.project.mode,
|
|
319
|
+
profile: router.config.mode,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// The prompt footer's word for the router: paused or broken routing, or a routing mode other than balanced, which
|
|
324
|
+
// changes what every routed turn costs. Null for none.
|
|
325
|
+
async function footerLabel($, router, view) {
|
|
326
|
+
if (view.phase === 'unavailable') return 'routing unavailable';
|
|
327
|
+
if ((await modeOf($, router, view.mode)) === 'manual') return 'routing off';
|
|
328
|
+
const routingMode = view.routingMode;
|
|
329
|
+
return routingMode && routingMode.mode !== 'balanced' ? `${routingMode.mode} mode (${routingMode.source})` : null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const sameMode = (a, b) => a?.mode === b?.mode && a?.source === b?.source;
|
|
333
|
+
|
|
334
|
+
// A turn's configs when turn.start did not record them, as after a reload of the Mod mid-turn.
|
|
335
|
+
async function turnConfigOf($, router) {
|
|
336
|
+
return { config: applyMode(router.config, await routingModeOf($, router)), configured: router.config };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// The turn routes on the configured routes as its routing mode moves them, fixed now so a change mid-turn waits for
|
|
340
|
+
// the next turn; a pin uses `configured` (decideTurn).
|
|
341
|
+
async function fixTurnConfig($, router, turnId) {
|
|
342
|
+
const turn = await turnConfigOf($, router);
|
|
343
|
+
router.turnConfigs.set(turnId, turn);
|
|
344
|
+
const { routingMode } = turn.config;
|
|
345
|
+
if (router.view && !sameMode(router.view.routingMode, routingMode)) await updateView($, router, { routingMode });
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// `/router mode <mode|default>`: the session's override, kept for a resume of this session only. It changes the
|
|
349
|
+
// preferred route from the next turn; the route in use moves through the gates. No turn is aborted.
|
|
350
|
+
async function setRoutingMode($, router, value) {
|
|
351
|
+
const sessionId = await $.session.id();
|
|
352
|
+
const key = `${ROUTING_MODE_PREFIX}${sessionId}`;
|
|
353
|
+
let saved = true;
|
|
354
|
+
try {
|
|
355
|
+
if (value === 'default') await $.store.delete(key);
|
|
356
|
+
else await $.store.set(key, value);
|
|
357
|
+
} catch {
|
|
358
|
+
saved = false;
|
|
359
|
+
}
|
|
360
|
+
router.routingModes.set(sessionId, value === 'default' ? null : value);
|
|
361
|
+
const routingMode = await routingModeOf($, router);
|
|
362
|
+
await updateView($, router, { routingMode });
|
|
363
|
+
const unsaved =
|
|
364
|
+
value === 'default'
|
|
365
|
+
? 'A resume of this session may bring the cleared mode back: the store could not be written.'
|
|
366
|
+
: 'A resume of this session will not keep it: the store could not be written.';
|
|
367
|
+
return [`Routing mode: ${modeLabel(routingMode)}, from the next turn.`, ...(saved ? [] : [unsaved])].join(' ');
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// A project's `.claude/router.json`, which may set only `mode`. Never a profile's own file: not the active profile's,
|
|
371
|
+
// and not in the home directory, whose `.claude` is the default profile. A repo controls this file, so a symlink, which
|
|
372
|
+
// could reach a file outside it, is refused as the profile's is. A file that does not read is ignored, with the reason
|
|
373
|
+
// for the pane.
|
|
374
|
+
async function readProject($, profilePath) {
|
|
375
|
+
try {
|
|
376
|
+
const cwd = await $.session.cwd();
|
|
377
|
+
const path = `${cwd}/.claude/router.json`;
|
|
378
|
+
const home = await $.env.get('HOME');
|
|
379
|
+
if (path === profilePath || cwd === home || !(await $.fs.exists(path))) return { mode: null, error: null };
|
|
380
|
+
if ((await $.fs.stat(path)).isLink) return { mode: null, error: 'project .claude/router.json is a symlink' };
|
|
381
|
+
return readProjectMode(await $.fs.read(path));
|
|
382
|
+
} catch {
|
|
383
|
+
return { mode: null, error: 'project .claude/router.json could not be read' };
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
300
387
|
async function updateView($, router, patch) {
|
|
301
388
|
const value = router.view ?? (await readView($, router));
|
|
302
389
|
router.view = { ...value, ...patch };
|
|
@@ -447,7 +534,8 @@ async function setPin($, router, tier) {
|
|
|
447
534
|
return `${tier} pinned for the next turn and its tool continuations.`;
|
|
448
535
|
}
|
|
449
536
|
|
|
450
|
-
// `/router [auto|off|pin <tier>|activities <mode>]`; with no action, the pane, or the status text without
|
|
537
|
+
// `/router [auto|off|pin <tier>|activities <mode>|mode <mode>]`; with no action, the pane, or the status text without
|
|
538
|
+
// a surface.
|
|
451
539
|
async function routerCommand($, router, args) {
|
|
452
540
|
const [action, value] = args.trim().split(/\s+/);
|
|
453
541
|
if (action === 'auto' || action === 'off') {
|
|
@@ -458,6 +546,12 @@ async function routerCommand($, router, args) {
|
|
|
458
546
|
}
|
|
459
547
|
if (action === 'pin')
|
|
460
548
|
return { text: TIERS.includes(value) ? await setPin($, router, value) : `Choose ${TIERS.join(', ')}.` };
|
|
549
|
+
if (action === 'mode')
|
|
550
|
+
return {
|
|
551
|
+
text: [...ROUTING_MODES, 'default'].includes(value)
|
|
552
|
+
? await setRoutingMode($, router, value)
|
|
553
|
+
: `Choose mode ${[...ROUTING_MODES, 'default'].join(', ')}.`,
|
|
554
|
+
};
|
|
461
555
|
if (action === 'activities')
|
|
462
556
|
return {
|
|
463
557
|
text: ACTIVITY_MODES.includes(value)
|
|
@@ -578,6 +672,8 @@ function detailText(config, view) {
|
|
|
578
672
|
const missing = missingCredentials(config, view, config.classifier);
|
|
579
673
|
return [
|
|
580
674
|
`Router — routing ${view.mode === 'auto' ? 'on' : 'off'}`,
|
|
675
|
+
...(view.routingMode ? [`Mode: ${modeLabel(view.routingMode)}`] : []),
|
|
676
|
+
...(view.projectError ? [`Ignored: ${view.projectError}`] : []),
|
|
581
677
|
`Native model: ${view.nativeModel}`,
|
|
582
678
|
`Selected: ${view.selectedModel ?? 'not selected'}`,
|
|
583
679
|
`Observed: ${view.actualModel ?? 'no response yet'}`,
|
|
@@ -645,7 +741,9 @@ async function* passMain($, e, next, loop, version, nativeModel, reason, router)
|
|
|
645
741
|
// the classifier call. The pin is the one in `view`, the view as the step read it; it is used up only once the route
|
|
646
742
|
// is written, so a turn interrupted before then leaves it for the next.
|
|
647
743
|
async function decideTurn($, router, e, signal, step) {
|
|
648
|
-
const { sessionId, view,
|
|
744
|
+
const { sessionId, view, loop, loopVersion, context, nativeModel, availableModels } = step;
|
|
745
|
+
// A pin runs its tier's configured route: the routing mode moves only routes the router chooses.
|
|
746
|
+
const cfg = view.pendingPin ? step.configured : step.cfg;
|
|
649
747
|
const ref = { ...LOOP, id: 'main' };
|
|
650
748
|
const controller = new AbortController();
|
|
651
749
|
const cancel = () => controller.abort();
|
|
@@ -692,6 +790,8 @@ async function decideTurn($, router, e, signal, step) {
|
|
|
692
790
|
if (controller.signal.aborted || (await $.session.id()) !== sessionId || (await modeOf($, router)) !== 'auto')
|
|
693
791
|
return null;
|
|
694
792
|
const previous = loop.decision;
|
|
793
|
+
if (pin)
|
|
794
|
+
router.turnConfigs.set(e.turnId, { config: { ...cfg, routingMode: step.cfg.routingMode }, configured: cfg });
|
|
695
795
|
const selected = chooseRoute(cfg, loop, {
|
|
696
796
|
facts,
|
|
697
797
|
advice: result.advice,
|
|
@@ -710,12 +810,29 @@ async function decideTurn($, router, e, signal, step) {
|
|
|
710
810
|
if (previous?.model && previous.model !== selected.decision.model && !selected.decision.pinned)
|
|
711
811
|
$.ui.toast(switchToast(cfg, previous, selected.decision, selected.decision.estimate));
|
|
712
812
|
const activity = turnActivity(cfg, result.advice, previous, selected.decision);
|
|
813
|
+
const routingMode = step.cfg.routingMode;
|
|
814
|
+
// One line per decision in Claude Code's debug log, so a later replay can compare modes. No prompt text.
|
|
815
|
+
$.ui.log(
|
|
816
|
+
`router decision ${JSON.stringify({
|
|
817
|
+
mode: routingMode.mode,
|
|
818
|
+
modeSource: routingMode.source,
|
|
819
|
+
classified: result.advice?.choice ?? null,
|
|
820
|
+
tier: selected.decision.tier,
|
|
821
|
+
reason: selected.decision.reason,
|
|
822
|
+
route: `${selected.decision.model}@${selected.decision.effort ?? 'session'}`,
|
|
823
|
+
pinned: selected.decision.pinned,
|
|
824
|
+
})}`,
|
|
825
|
+
{ to: 'debug' },
|
|
826
|
+
);
|
|
713
827
|
router.turnActivities.set(e.turnId, {
|
|
714
828
|
...activity,
|
|
715
829
|
reason: selected.decision.reason,
|
|
716
830
|
escalated: Boolean(selected.decision.escalated),
|
|
717
831
|
pinned: selected.decision.pinned,
|
|
718
832
|
route: `${selected.decision.model}@${selected.decision.effort ?? 'session'}`,
|
|
833
|
+
// A pinned turn ran the configured routes, which balanced runs: its replies count there.
|
|
834
|
+
routingMode: pin ? DEFAULTS.mode : routingMode.mode,
|
|
835
|
+
modeSource: pin ? 'pin' : routingMode.source,
|
|
719
836
|
classifier: cfg.classifier,
|
|
720
837
|
offSwitches: router.offSwitches,
|
|
721
838
|
adviceMs,
|
|
@@ -730,6 +847,8 @@ async function decideTurn($, router, e, signal, step) {
|
|
|
730
847
|
await updateView($, router, {
|
|
731
848
|
...(activity.switched ? switchView(previous, selected.decision, activity.label, Date.now()) : {}),
|
|
732
849
|
phase: 'routed',
|
|
850
|
+
// The session's mode, not this turn's: a `/router mode` sent while the classifier answered names the next turn.
|
|
851
|
+
routingMode: await routingModeOf($, router),
|
|
733
852
|
selectedModel: selected.decision.model,
|
|
734
853
|
actualModel: null,
|
|
735
854
|
tier: selected.decision.tier,
|
|
@@ -996,6 +1115,7 @@ async function addSavings($, router, { turnId, compared, tier, route, yours, byI
|
|
|
996
1115
|
const turn = router.turnActivities.get(turnId);
|
|
997
1116
|
const entry = replyEntry({
|
|
998
1117
|
at,
|
|
1118
|
+
mode: turn?.routingMode ?? view.routingMode?.mode ?? DEFAULTS.mode,
|
|
999
1119
|
activity: tier ? (turn?.label ?? null) : null,
|
|
1000
1120
|
tier,
|
|
1001
1121
|
route,
|
|
@@ -1325,7 +1445,9 @@ function paneActions($, router, view) {
|
|
|
1325
1445
|
if (result.error) return updateView($, router, { notice: result.error });
|
|
1326
1446
|
const drafts = router.view ?? view;
|
|
1327
1447
|
const reset = await adopt(result.config);
|
|
1328
|
-
|
|
1448
|
+
// A saved or undone profile mode changes the mode shown, unless a session or project mode wins.
|
|
1449
|
+
const routingMode = await routingModeOf($, router);
|
|
1450
|
+
return updateView($, router, { ...reset, ...rebased(drafts), ...saved(router.config), routingMode });
|
|
1329
1451
|
};
|
|
1330
1452
|
// Defaults go into the routing draft like any edit; the notice says whether Save has anything of that section left
|
|
1331
1453
|
// to write.
|
|
@@ -1425,6 +1547,12 @@ function paneActions($, router, view) {
|
|
|
1425
1547
|
// An insight's link: the Routes tab with the grid cell it names open.
|
|
1426
1548
|
openRoute: (cell) => updateView($, router, { tab: 'routes', routeCell: cell, notice: null }),
|
|
1427
1549
|
confirmDelete: (asked) => updateView($, router, { confirmDelete: asked }),
|
|
1550
|
+
// The profile's routing mode, saved at once with Undo. A session or project mode still wins over it.
|
|
1551
|
+
routingMode: async (mode) => {
|
|
1552
|
+
const from = router.config.mode;
|
|
1553
|
+
if (mode === from || !ROUTING_MODES.includes(mode)) return undefined;
|
|
1554
|
+
return write(`routing mode ${from} → ${mode}`, (file) => withMode(file, mode));
|
|
1555
|
+
},
|
|
1428
1556
|
// `/router activities <mode>`: the mode alone, saved at once like a classifier press, with Undo.
|
|
1429
1557
|
activityRouting: (mode) => {
|
|
1430
1558
|
const from = router.config.activityRouting;
|
|
@@ -1572,13 +1700,14 @@ export function register(on, options) {
|
|
|
1572
1700
|
router.definitions.clear();
|
|
1573
1701
|
await $.command.register({
|
|
1574
1702
|
name: 'router',
|
|
1575
|
-
description: 'Open the Router pane, or switch routing: auto, off, pin <tier>, activities <mode>.',
|
|
1576
|
-
argumentHint: '[auto|off|pin <tier>|activities off|on]',
|
|
1703
|
+
description: 'Open the Router pane, or switch routing: auto, off, pin <tier>, activities <mode>, mode <mode>.',
|
|
1704
|
+
argumentHint: '[auto|off|pin <tier>|activities off|on|mode cost|balanced|quality|default]',
|
|
1577
1705
|
immediate: true,
|
|
1578
1706
|
});
|
|
1579
1707
|
const model = await $.session.model();
|
|
1580
1708
|
try {
|
|
1581
1709
|
router.config = await loadNativeConfig($);
|
|
1710
|
+
router.project = await readProject($, router.config.nativePath);
|
|
1582
1711
|
const existing = await readView($, router);
|
|
1583
1712
|
router.view = existing;
|
|
1584
1713
|
const sameClassifier = existing.health?.classifier === router.config.classifier;
|
|
@@ -1599,6 +1728,8 @@ export function register(on, options) {
|
|
|
1599
1728
|
credentials: await credentialsOf($, options, router.config),
|
|
1600
1729
|
health: healthOf(clientOf(router, router.config.classifier), router.config.classifier),
|
|
1601
1730
|
configPath: router.config.nativePath,
|
|
1731
|
+
routingMode: await routingModeOf($, router),
|
|
1732
|
+
projectError: router.project.error,
|
|
1602
1733
|
tuning: null,
|
|
1603
1734
|
tuningBase: null,
|
|
1604
1735
|
routeDraft: null,
|
|
@@ -1638,8 +1769,8 @@ export function register(on, options) {
|
|
|
1638
1769
|
|
|
1639
1770
|
on('command.run', { command: 'router' }, ($, e) => routerCommand($, router, e.args));
|
|
1640
1771
|
|
|
1641
|
-
on('turn.start', (
|
|
1642
|
-
router
|
|
1772
|
+
on('turn.start', async ($, e, next) => {
|
|
1773
|
+
await fixTurnConfig($, router, e.turnId);
|
|
1643
1774
|
router.prompts.set(e.turnId, clip(e.text, router.config.context.maxTextChars));
|
|
1644
1775
|
return next(e);
|
|
1645
1776
|
});
|
|
@@ -1652,7 +1783,8 @@ export function register(on, options) {
|
|
|
1652
1783
|
|
|
1653
1784
|
on('turn.step', async function* ($, e, next) {
|
|
1654
1785
|
if (e.agentId) return yield* stepAgent($, router, e, next);
|
|
1655
|
-
const
|
|
1786
|
+
const turn = router.turnConfigs.get(e.turnId) ?? (await turnConfigOf($, router));
|
|
1787
|
+
const cfg = turn.config;
|
|
1656
1788
|
const [sessionId, nativeModel, view] = await Promise.all([$.session.id(), $.session.model(), readView($, router)]);
|
|
1657
1789
|
const mode = await modeOf($, router, view.mode);
|
|
1658
1790
|
if (e.index === 0) {
|
|
@@ -1666,7 +1798,8 @@ export function register(on, options) {
|
|
|
1666
1798
|
const ref = { ...LOOP, id: 'main' };
|
|
1667
1799
|
const loaded = await $.state.get(ref);
|
|
1668
1800
|
let loopVersion = loaded.version;
|
|
1669
|
-
|
|
1801
|
+
// The session's model names its tier in the configured routes: a mode's table can run it at another tier.
|
|
1802
|
+
let loop = prepareLoop(loaded.value ?? emptyLoop(turn.configured, e.model), e.messageCount);
|
|
1670
1803
|
if (view.phase === 'unavailable' || mode === 'manual') {
|
|
1671
1804
|
return yield* passMain($, e, next, loop, loopVersion, nativeModel, 'manual', router);
|
|
1672
1805
|
}
|
|
@@ -1683,6 +1816,7 @@ export function register(on, options) {
|
|
|
1683
1816
|
sessionId,
|
|
1684
1817
|
view,
|
|
1685
1818
|
cfg,
|
|
1819
|
+
configured: turn.configured,
|
|
1686
1820
|
loop,
|
|
1687
1821
|
loopVersion,
|
|
1688
1822
|
context,
|
|
@@ -1784,13 +1918,7 @@ export function register(on, options) {
|
|
|
1784
1918
|
|
|
1785
1919
|
// Paused or broken routing stays visible in the prompt footer even when the band is collapsed.
|
|
1786
1920
|
on('ui.render', { component: 'SessionMode' }, async ($, e, next) => {
|
|
1787
|
-
const
|
|
1788
|
-
const label =
|
|
1789
|
-
view.phase === 'unavailable'
|
|
1790
|
-
? 'routing unavailable'
|
|
1791
|
-
: (await modeOf($, router, view.mode)) === 'manual'
|
|
1792
|
-
? 'routing off'
|
|
1793
|
-
: null;
|
|
1921
|
+
const label = await footerLabel($, router, await readView($, router));
|
|
1794
1922
|
return label ? next({ ...e, props: { ...e.props, modes: [...e.props.modes, label] } }) : next(e);
|
|
1795
1923
|
});
|
|
1796
1924
|
|
package/lib/activity.mjs
CHANGED
|
@@ -54,15 +54,21 @@ export function chooseActivity(config, advice, incumbent, sentEffort, facts = {}
|
|
|
54
54
|
// the base route), must clear the tier upgrade bar for this switching tax. Down on economics: the move must pay back
|
|
55
55
|
// its cache write within the downgrade horizon. A pair that does not order (an unpriced model, a numeric effort, two
|
|
56
56
|
// models at one price) counts as up: it needs evidence, and the base route is always reachable. Labels alone never
|
|
57
|
-
// switch, so one vote is enough. During an escalation hold only a stronger route may be taken.
|
|
57
|
+
// switch, so one vote is enough. During an escalation hold only a stronger route may be taken. A cheaper route on the
|
|
58
|
+
// same task (`sameTask`) waits for facts.downAllowed, as a tier downgrade does: a routing mode changes the route
|
|
59
|
+
// without a new label, and a free switch must still wait out the dwell. A model with a lower input price also counts
|
|
60
|
+
// as cheaper there, whatever its output price: that is the order the cost mode picks by. Returns
|
|
58
61
|
// { move, reason, estimate }.
|
|
59
|
-
export function lateralMove({ config, from, to, mass, hold, facts, now, costs }) {
|
|
62
|
+
export function lateralMove({ config, from, to, mass, hold, sameTask = false, facts, now, costs }) {
|
|
60
63
|
const order = compareRoutes(config, to, from, facts.effort);
|
|
61
64
|
if (hold && !(order > 0)) return { move: false, reason: 'hold', estimate: null };
|
|
62
65
|
const p = config.policy;
|
|
63
66
|
let estimate;
|
|
67
|
+
if (order !== -1 && sameTask && !facts.downAllowed && routeSpec(config, to).input < routeSpec(config, from).input)
|
|
68
|
+
return { move: false, reason: 'downgrade-held', estimate: null };
|
|
64
69
|
if (order === -1) {
|
|
65
70
|
estimate = { taxUsd: costs.downgradeTaxUsd(config, to, from, facts, now, p.downgradeHorizonTurns) };
|
|
71
|
+
if (sameTask && !facts.downAllowed) return { move: false, reason: 'downgrade-held', estimate };
|
|
66
72
|
// Before the first measured reply no cache of this history exists, though the tax prices an unknown one as warm:
|
|
67
73
|
// staying protects nothing.
|
|
68
74
|
const fresh = facts.historyMeasured === false;
|