mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:50:43 +00:00
fix(opencode): expose Claude thinking levels (#72778)
* fix(opencode): expose claude thinking levels * test(opencode): cover adaptive claude thinking bounds * docs(changelog): credit opencode thinking contributor --------- Co-authored-by: haishmg <4529977+haishmg@users.noreply.github.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
committed by
GitHub
parent
1b1916053f
commit
f75d8827f2
@@ -1,5 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { registerProviderPlugin } from "../../test/helpers/plugins/provider-registration.js";
|
||||
import {
|
||||
registerProviderPlugin,
|
||||
requireRegisteredProvider,
|
||||
} from "../../test/helpers/plugins/provider-registration.js";
|
||||
import { expectPassthroughReplayPolicy } from "../../test/helpers/provider-replay-policy.ts";
|
||||
import plugin from "./index.js";
|
||||
|
||||
@@ -40,4 +43,46 @@ describe("opencode provider plugin", () => {
|
||||
modelId: "claude-opus-4.6",
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes Anthropic thinking levels for proxied Claude models", async () => {
|
||||
const { providers } = await registerProviderPlugin({
|
||||
plugin,
|
||||
id: "opencode",
|
||||
name: "OpenCode Zen Provider",
|
||||
});
|
||||
const provider = requireRegisteredProvider(providers, "opencode");
|
||||
const resolveThinkingProfile = provider.resolveThinkingProfile!;
|
||||
|
||||
expect(
|
||||
resolveThinkingProfile({
|
||||
provider: "opencode",
|
||||
modelId: "claude-opus-4-7",
|
||||
}),
|
||||
).toMatchObject({
|
||||
levels: expect.arrayContaining([{ id: "xhigh" }, { id: "adaptive" }, { id: "max" }]),
|
||||
defaultLevel: "off",
|
||||
});
|
||||
const opus46Profile = resolveThinkingProfile({
|
||||
provider: "opencode",
|
||||
modelId: "claude-opus-4.6",
|
||||
});
|
||||
expect(opus46Profile).toMatchObject({
|
||||
levels: expect.arrayContaining([{ id: "adaptive" }]),
|
||||
defaultLevel: "adaptive",
|
||||
});
|
||||
expect(opus46Profile?.levels.some((level) => level.id === "xhigh" || level.id === "max")).toBe(
|
||||
false,
|
||||
);
|
||||
const sonnet46Profile = resolveThinkingProfile({
|
||||
provider: "opencode",
|
||||
modelId: "claude-sonnet-4-6",
|
||||
});
|
||||
expect(sonnet46Profile).toMatchObject({
|
||||
levels: expect.arrayContaining([{ id: "adaptive" }]),
|
||||
defaultLevel: "adaptive",
|
||||
});
|
||||
expect(
|
||||
sonnet46Profile?.levels.some((level) => level.id === "xhigh" || level.id === "max"),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user