opencode-thinking-fix 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/proxy/proxy.js +17 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-thinking-fix",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Fix DeepSeek/Kimi/GLM/MiMo reasoning_content 400 errors in OpenCode. Plugin + proxy + watchdog.",
5
5
  "license": "MIT",
6
6
  "author": "tbosancheros39",
package/proxy/proxy.js CHANGED
@@ -257,16 +257,25 @@ const server = http.createServer((req, res) => {
257
257
  // Patch request body if this is a reasoning provider
258
258
  let bodyToSend = rawBody
259
259
  if (shouldPatch && rawBody.length > 0) {
260
- // Inject reasoning_split for MiniMax models (avoids <think> tags in content)
261
- const isMiniMax = modelName.toLowerCase().startsWith('minimax') || modelName.toLowerCase().startsWith('mimo')
262
260
  let bodyStr = rawBody.toString('utf8')
263
- if (isMiniMax) {
264
- try {
265
- const bj = JSON.parse(bodyStr)
261
+ try {
262
+ const bj = JSON.parse(bodyStr)
263
+
264
+ // Strip unsupported params for Kimi/Moonshot thinking mode
265
+ const isKimi = modelName.toLowerCase().startsWith('kimi') || modelName.toLowerCase().startsWith('moonshot')
266
+ if (isKimi) {
267
+ delete bj.top_p
268
+ delete bj.top_k
269
+ }
270
+
271
+ // Inject reasoning_split for MiniMax models (avoids <think> tags in content)
272
+ const isMiniMax = modelName.toLowerCase().startsWith('minimax') || modelName.toLowerCase().startsWith('mimo')
273
+ if (isMiniMax) {
266
274
  bj.reasoning_split = true
267
- bodyStr = JSON.stringify(bj)
268
- } catch { /* pass */ }
269
- }
275
+ }
276
+
277
+ bodyStr = JSON.stringify(bj)
278
+ } catch { /* pass */ }
270
279
  const patched = patchRequestBody(bodyStr, sessionId)
271
280
  bodyToSend = Buffer.from(patched, 'utf8')
272
281
  }