grok 0.1.4: grok-4.7 keeps its low/medium/high/xhigh reasoning levels when Grok's model list can't be read, as the built-in offered them — the default list carries the variants. models.test.mjs fails against 0.1.3.

This commit is contained in:
yetone
2026-10-01 07:04:58 +08:00
parent 083251d778
commit e44077a705
3 changed files with 29 additions and 2 deletions
+13 -1
View File
@@ -225,8 +225,20 @@ function rewrite(body) {
// ---- models -------------------------------------------------------------------
// the levels the built-in offered for grok-4.7 before Grok listed any (its
// maker's, as models.dev has them): kept when the list can't be read, so
// a move leaves an agent's reasoning level where it was
const DEFAULT_EFFORTS = ["low", "medium", "high", "xhigh"]
const DEFAULT_MODELS = {
"grok-4.7": { name: "Grok 4.7", attachment: true, reasoning: true, tool_call: true, modalities: { input: ["text", "image"], output: ["text"] } },
"grok-4.7": {
name: "Grok 4.7",
attachment: true,
reasoning: true,
tool_call: true,
modalities: { input: ["text", "image"], output: ["text"] },
variants: Object.fromEntries(DEFAULT_EFFORTS.map((e) => [e, { reasoningEffort: e }])),
},
}
// listModels is what the account can use, as the CLI's backend lists it:
+15
View File
@@ -0,0 +1,15 @@
// grok-4.7 offers the built-in's reasoning levels before Grok lists any:
// magpie keeps the configured model when the models hook fails, and a
// model with no variants lost the levels the built-in had (low…xhigh).
import { expect, test } from "bun:test"
import { GrokAuthPlugin } from "./index.mjs"
test("the configured grok-4.7 carries the built-in's levels", async () => {
const hooks = await GrokAuthPlugin({ client: { auth: { set: async () => {} } } })
const cfg = {}
await hooks.config(cfg)
const m = cfg.provider.grok.models["grok-4.7"]
expect(m.reasoning).toBe(true)
expect(Object.keys(m.variants)).toEqual(["low", "medium", "high", "xhigh"])
expect(m.variants.xhigh).toEqual({ reasoningEffort: "xhigh" })
})
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-grok-auth",
"version": "0.1.3",
"version": "0.1.4",
"description": "OpenCode provider plugin: Grok (SuperGrok / X Premium+) through the Grok Build CLI's sign-in",
"type": "module",
"main": "./index.mjs",