Skip to content

Commit eb99642

Browse files
committed
fix: preserve OpenCode Go DeepSeek V4 max thinking
1 parent cab8147 commit eb99642

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

‎extensions/opencode-go/index.test.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Opencode Go tests cover index plugin behavior.
2+
import { clampThinkingLevel } from "openclaw/plugin-sdk/llm";
23
import type { ProviderRuntimeModel } from "openclaw/plugin-sdk/plugin-entry";
34
import {
45
registerProviderPlugin,
@@ -39,6 +40,16 @@ function requireCatalogEntry(entries: readonly unknown[] | null | undefined, id:
3940
return requireRecord(entry, `supplemental catalog entry ${id}`);
4041
}
4142

43+
const EXPECTED_DEEPSEEK_V4_THINKING_LEVEL_MAP = {
44+
off: null,
45+
minimal: "low",
46+
low: "low",
47+
medium: "medium",
48+
high: "high",
49+
xhigh: "max",
50+
max: "max",
51+
} as const;
52+
4253
describe("opencode-go provider plugin", () => {
4354
beforeEach(() => {
4455
clearLiveCatalogCacheForTests();
@@ -127,6 +138,14 @@ describe("opencode-go provider plugin", () => {
127138
expect(deepSeekFlash.provider).toBe("opencode-go");
128139
expect(deepSeekFlash.name).toBe("DeepSeek V4 Flash");
129140

141+
const deepSeekProModel = requireMapEntry(models, "deepseek-v4-pro");
142+
expect(deepSeekProModel.thinkingLevelMap).toEqual(EXPECTED_DEEPSEEK_V4_THINKING_LEVEL_MAP);
143+
expect(clampThinkingLevel(deepSeekProModel as never, "max")).toBe("max");
144+
145+
const deepSeekFlashModel = requireMapEntry(models, "deepseek-v4-flash");
146+
expect(deepSeekFlashModel.thinkingLevelMap).toEqual(EXPECTED_DEEPSEEK_V4_THINKING_LEVEL_MAP);
147+
expect(clampThinkingLevel(deepSeekFlashModel as never, "xhigh")).toBe("xhigh");
148+
130149
const glm52 = requireMapEntry(models, "glm-5.2");
131150
expect(glm52.api).toBe("openai-completions");
132151
expect(glm52.baseUrl).toBe("https://opencode.ai/zen/go/v1");
@@ -241,6 +260,13 @@ describe("opencode-go provider plugin", () => {
241260
it("loads OpenCode Go model discovery through the provider runtime", () => {
242261
expect(manifest.providerCatalogEntry).toBe("./provider-discovery.ts");
243262
expect(manifest.modelCatalog.discovery["opencode-go"]).toBe("runtime");
263+
const manifestModels = manifest.modelCatalog.providers["opencode-go"].models;
264+
expect(
265+
manifestModels.find((model) => model.id === "deepseek-v4-pro")?.thinkingLevelMap,
266+
).toEqual(EXPECTED_DEEPSEEK_V4_THINKING_LEVEL_MAP);
267+
expect(
268+
manifestModels.find((model) => model.id === "deepseek-v4-flash")?.thinkingLevelMap,
269+
).toEqual(EXPECTED_DEEPSEEK_V4_THINKING_LEVEL_MAP);
244270
});
245271

246272
it("exposes the complete offline catalog through provider discovery", async () => {
@@ -249,13 +275,21 @@ describe("opencode-go provider plugin", () => {
249275
throw new Error("expected OpenCode Go static provider");
250276
}
251277
const deepSeekPro = result.provider.models.find((model) => model.id === "deepseek-v4-pro");
278+
const deepSeekFlash = result.provider.models.find((model) => model.id === "deepseek-v4-flash");
252279
const glm52 = result.provider.models.find((model) => model.id === "glm-5.2");
253280

254281
expect(result.provider.models).toHaveLength(20);
255282
expect(deepSeekPro).toMatchObject({
256283
provider: "opencode-go",
257284
contextWindow: 1_000_000,
258285
maxTokens: 384_000,
286+
thinkingLevelMap: EXPECTED_DEEPSEEK_V4_THINKING_LEVEL_MAP,
287+
});
288+
expect(deepSeekFlash).toMatchObject({
289+
provider: "opencode-go",
290+
contextWindow: 1_000_000,
291+
maxTokens: 384_000,
292+
thinkingLevelMap: EXPECTED_DEEPSEEK_V4_THINKING_LEVEL_MAP,
259293
});
260294
expect(glm52).toMatchObject({
261295
provider: "opencode-go",

‎extensions/opencode-go/openclaw.plugin.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030
"id": "deepseek-v4-pro",
3131
"name": "DeepSeek V4 Pro",
3232
"reasoning": true,
33+
"thinkingLevelMap": {
34+
"off": null,
35+
"minimal": "low",
36+
"low": "low",
37+
"medium": "medium",
38+
"high": "high",
39+
"xhigh": "max",
40+
"max": "max"
41+
},
3342
"input": ["text"],
3443
"contextWindow": 1000000,
3544
"maxTokens": 384000,
@@ -49,6 +58,15 @@
4958
"id": "deepseek-v4-flash",
5059
"name": "DeepSeek V4 Flash",
5160
"reasoning": true,
61+
"thinkingLevelMap": {
62+
"off": null,
63+
"minimal": "low",
64+
"low": "low",
65+
"medium": "medium",
66+
"high": "high",
67+
"xhigh": "max",
68+
"max": "max"
69+
},
5270
"input": ["text"],
5371
"contextWindow": 1000000,
5472
"maxTokens": 384000,

‎extensions/opencode-go/provider-catalog.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ type OpencodeGoModelDefinition = ModelDefinitionConfig & {
3131
input: Array<"text" | "image">;
3232
};
3333

34+
const OPENCODE_GO_DEEPSEEK_V4_THINKING_LEVEL_MAP = {
35+
off: null,
36+
minimal: "low",
37+
low: "low",
38+
medium: "medium",
39+
high: "high",
40+
xhigh: "max",
41+
max: "max",
42+
} satisfies NonNullable<ModelDefinitionConfig["thinkingLevelMap"]>;
43+
3444
const OPENCODE_GO_MODELS = (
3545
[
3646
{
@@ -40,6 +50,7 @@ const OPENCODE_GO_MODELS = (
4050
provider: PROVIDER_ID,
4151
baseUrl: OPENCODE_GO_OPENAI_BASE_URL,
4252
reasoning: true,
53+
thinkingLevelMap: OPENCODE_GO_DEEPSEEK_V4_THINKING_LEVEL_MAP,
4354
input: ["text"],
4455
cost: {
4556
input: 1.74,
@@ -62,6 +73,7 @@ const OPENCODE_GO_MODELS = (
6273
provider: PROVIDER_ID,
6374
baseUrl: OPENCODE_GO_OPENAI_BASE_URL,
6475
reasoning: true,
76+
thinkingLevelMap: OPENCODE_GO_DEEPSEEK_V4_THINKING_LEVEL_MAP,
6577
input: ["text"],
6678
cost: {
6779
input: 0.14,

0 commit comments

Comments
 (0)