fix(opencode): support MiniMax M3 thinking toggle (#31426)

This commit is contained in:
Aiden Cline 2026-06-08 17:03:31 -05:00 committed by GitHub
commit 6e84142b59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 81 additions and 1 deletions

View file

@ -175,6 +175,39 @@ describe("ProviderTransform.options - zai/zhipuai thinking", () => {
}
})
describe("ProviderTransform.options - minimax m3 thinking", () => {
const createModel = (npm: string) =>
({
id: "minimax/minimax-m3",
providerID: "minimax",
api: {
id: "minimax-m3",
url: "https://api.minimax.com",
npm,
},
capabilities: { reasoning: true },
limit: { output: 64_000 },
}) as any
test("explicitly enables adaptive thinking with the anthropic SDK", () => {
expect(
ProviderTransform.options({
model: createModel("@ai-sdk/anthropic"),
sessionID: "test-session-123",
}).thinking,
).toEqual({ type: "adaptive" })
})
test("uses the native default with the openai-compatible SDK", () => {
expect(
ProviderTransform.options({
model: createModel("@ai-sdk/openai-compatible"),
sessionID: "test-session-123",
}).thinking,
).toBeUndefined()
})
})
describe("ProviderTransform.options - google thinkingConfig gating", () => {
const sessionID = "test-session-123"
@ -2452,6 +2485,39 @@ describe("ProviderTransform.variants", () => {
expect(result).toEqual({})
})
test("minimax m3 using anthropic returns thinking toggles", () => {
const model = createMockModel({
id: "minimax/minimax-m3",
providerID: "minimax",
api: {
id: "MiniMax-M3",
url: "https://api.minimax.com/anthropic/v1",
npm: "@ai-sdk/anthropic",
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({
none: { thinking: { type: "disabled" } },
thinking: { thinking: { type: "adaptive" } },
})
})
test("minimax m3 using openai-compatible returns thinking toggles", () => {
const model = createMockModel({
id: "minimax/minimax-m3",
providerID: "minimax",
api: {
id: "minimax-m3",
url: "https://api.minimax.com/v1",
npm: "@ai-sdk/openai-compatible",
},
})
expect(ProviderTransform.variants(model)).toEqual({
none: { thinking: { type: "disabled" } },
thinking: { thinking: { type: "adaptive" } },
})
})
test("glm returns empty object", () => {
const model = createMockModel({
id: "glm/glm-4",