mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:50:43 +00:00
fix(opencode): expose Claude thinking policy (#76760)
Summary: - Adds an OpenCode provider-policy public artifact that delegates Claude thinking profiles, plus regression tests and a changelog entry for preserving `xhigh` on `opencode/claude-opus-4-7`. - Reproducibility: yes. Source inspection on current main shows the model-switch path remaps unsupported store ... vider-policy-api` artifact for the fallback resolver; the proposed test exercises that stored-`xhigh` path. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for headefa152cca5. - Required merge gates passed before the squash merge. Prepared head SHA:efa152cca5Review: https://github.com/openclaw/openclaw/pull/76760#issuecomment-4366483080 Co-authored-by: mkdev11 <MkDev11@users.noreply.github.com>
This commit is contained in:
29
extensions/opencode/provider-policy-api.test.ts
Normal file
29
extensions/opencode/provider-policy-api.test.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveThinkingProfile } from "./provider-policy-api.js";
|
||||
|
||||
describe("opencode provider policy public artifact", () => {
|
||||
it("exposes Claude Opus 4.7 thinking levels without loading the full provider plugin", () => {
|
||||
expect(
|
||||
resolveThinkingProfile({
|
||||
provider: "opencode",
|
||||
modelId: "claude-opus-4-7",
|
||||
}),
|
||||
).toMatchObject({
|
||||
levels: expect.arrayContaining([{ id: "xhigh" }, { id: "adaptive" }, { id: "max" }]),
|
||||
defaultLevel: "off",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps adaptive-only Claude profiles aligned with Anthropic", () => {
|
||||
const profile = resolveThinkingProfile({
|
||||
provider: "opencode",
|
||||
modelId: "claude-opus-4-6",
|
||||
});
|
||||
|
||||
expect(profile).toMatchObject({
|
||||
levels: expect.arrayContaining([{ id: "adaptive" }]),
|
||||
defaultLevel: "adaptive",
|
||||
});
|
||||
expect(profile.levels.some((level) => level.id === "xhigh" || level.id === "max")).toBe(false);
|
||||
});
|
||||
});
|
||||
5
extensions/opencode/provider-policy-api.ts
Normal file
5
extensions/opencode/provider-policy-api.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { resolveClaudeThinkingProfile } from "openclaw/plugin-sdk/provider-model-shared";
|
||||
|
||||
export function resolveThinkingProfile(params: { provider?: string; modelId: string }) {
|
||||
return resolveClaudeThinkingProfile(params.modelId);
|
||||
}
|
||||
Reference in New Issue
Block a user