11// Opencode Go tests cover index plugin behavior.
2+ import { clampThinkingLevel } from "openclaw/plugin-sdk/llm" ;
23import type { ProviderRuntimeModel } from "openclaw/plugin-sdk/plugin-entry" ;
34import {
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+
4253describe ( "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" ,
0 commit comments