Skip to content

Commit 5e87052

Browse files
committed
Merge Claude adaptive thinking fix
2 parents 0358e5d + 853088c commit 5e87052

4 files changed

Lines changed: 26 additions & 5 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rerouted",
3-
"version": "0.4.17",
3+
"version": "0.4.18",
44
"description": "A macOS menu-bar router for accounts, models, and automatic fallback.",
55
"author": "gitcommit90",
66
"license": "MIT",

src/lib/providers/effort.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function applyClaudeEffort(target, source, model) {
131131
}
132132

133133
if (!/haiku/i.test(String(model))) {
134+
target.thinking = { type: "adaptive" };
134135
target.output_config = { effort: claudeAdaptiveEffort(intent.level) };
135136
return target;
136137
}

tests/gateway.test.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,11 @@ describe("format translation", () => {
10431043
"claude-sonnet-5",
10441044
false
10451045
);
1046+
assert.deepEqual(claudeBody.thinking, { type: "adaptive" });
10461047
assert.deepEqual(claudeBody.output_config, { effort: "auto" });
10471048
});
10481049

1049-
it("Claude adaptive models receive output_config.effort", () => {
1050+
it("Claude adaptive models receive explicit thinking with output_config.effort", () => {
10501051
const body = claude.toAnthropicBody(
10511052
{
10521053
messages: [{ role: "user", content: "hi" }],
@@ -1055,8 +1056,27 @@ describe("format translation", () => {
10551056
"claude-sonnet-5",
10561057
false
10571058
);
1059+
assert.deepEqual(body.thinking, { type: "adaptive" });
10581060
assert.deepEqual(body.output_config, { effort: "high" });
1059-
assert.equal(body.thinking, undefined);
1061+
});
1062+
1063+
it("Claude context-management clear thinking receives adaptive thinking", () => {
1064+
const body = claude.toAnthropicBody(
1065+
{
1066+
messages: [{ role: "user", content: "hi" }],
1067+
output_config: { effort: "high" },
1068+
context_management: {
1069+
edits: [{ type: "clear_thinking_20251015", keep: "all" }],
1070+
},
1071+
},
1072+
"claude-opus-4-8",
1073+
false
1074+
);
1075+
assert.deepEqual(body.thinking, { type: "adaptive" });
1076+
assert.deepEqual(body.output_config, { effort: "high" });
1077+
assert.deepEqual(body.context_management, {
1078+
edits: [{ type: "clear_thinking_20251015", keep: "all" }],
1079+
});
10601080
});
10611081

10621082
it("Claude Haiku falls back to token-budget thinking", () => {

0 commit comments

Comments
 (0)