antigravity 0.1.18: a variant at xhigh is asked at xhigh (#1169)
feikeer27 asked gemini-4-hydrogen at xhigh. sentID picked the gemini-4-hydrogen-xhigh variant, but shape() set the inner thinkingConfig.thinkingLevel to "high": its level chain had no xhigh case and fell through to high, a rule from Gemini 3, which took nothing above high. Google lists LOW, MEDIUM, HIGH and XHIGH for Gemini 4 Hydrogen (magpie 15500d437). A variant whose own level is xhigh is now asked at "xhigh", lowercase like every other level this plugin sends. A model with no xhigh variant stays at high, so an xhigh asked of gemini-3.7-flash or gemini-4-hydrogen-high still goes at high. complete() also read a thinkingLevel from the body only in lowercase. Gemini's own clients write "XHIGH"/"LOW", so with no X-Magpie-Effort header the level was dropped. It is lowercased first now. Run: bun test packages/antigravity on mote (temp HOME): 133 pass, 0 fail; bun scripts/check.mjs antigravity ok. Broken by hand: both changes reverted, 3 of the new tests red (the two hydrogen-xhigh shape cases and the capitals request test). Not tried: a real gemini-4-hydrogen-xhigh request. No account here is served Gemini 4, so Code Assist taking "xhigh" is from Google's model page, not a reply; the reporter is asked to confirm.
This commit is contained in:
@@ -1226,6 +1226,10 @@ function shape(req, sent, at, effort) {
|
|||||||
else if (e === "minimal" && at) level = "minimal"
|
else if (e === "minimal" && at) level = "minimal"
|
||||||
else if ((e === "none" || e === "minimal") && !draws(m)) level = "low"
|
else if ((e === "none" || e === "minimal") && !draws(m)) level = "low"
|
||||||
else if (e === "medium" && (m.includes("flash") || g > 3)) level = "medium"
|
else if (e === "medium" && (m.includes("flash") || g > 3)) level = "medium"
|
||||||
|
// a variant at xhigh (Gemini 4 Hydrogen) is asked at xhigh, which
|
||||||
|
// Google lists for it (LOW, MEDIUM, HIGH, XHIGH); a model with no
|
||||||
|
// such variant stays at high (#1169)
|
||||||
|
if (at === "xhigh") level = "xhigh"
|
||||||
tc.thinkingLevel = level
|
tc.thinkingLevel = level
|
||||||
} else delete tc.thinkingLevel
|
} else delete tc.thinkingLevel
|
||||||
} else if (typeof tc.thinkingLevel === "string") {
|
} else if (typeof tc.thinkingLevel === "string") {
|
||||||
@@ -1539,7 +1543,8 @@ async function complete(s, url, init, magpie) {
|
|||||||
let effort = headerOf(init?.headers, EFFORT).toLowerCase()
|
let effort = headerOf(init?.headers, EFFORT).toLowerCase()
|
||||||
// a variant's level, where OpenCode asked for one
|
// a variant's level, where OpenCode asked for one
|
||||||
const tl = raw.generationConfig?.thinkingConfig?.thinkingLevel
|
const tl = raw.generationConfig?.thinkingConfig?.thinkingLevel
|
||||||
if (!effort && typeof tl === "string" && LEVELS.includes(tl)) effort = tl
|
// Gemini's own clients write it in capitals ("XHIGH")
|
||||||
|
if (!effort && typeof tl === "string" && LEVELS.includes(tl.toLowerCase())) effort = tl.toLowerCase()
|
||||||
let l
|
let l
|
||||||
try {
|
try {
|
||||||
l = await modelInfo(s)
|
l = await modelInfo(s)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@magpie-community/opencode-antigravity-auth",
|
"name": "@magpie-community/opencode-antigravity-auth",
|
||||||
"version": "0.1.17",
|
"version": "0.1.18",
|
||||||
"description": "Sign in to Antigravity with a Google account from OpenCode or magpie: Gemini, and the Claude and GPT-OSS models Google hosts for it",
|
"description": "Sign in to Antigravity with a Google account from OpenCode or magpie: Gemini, and the Claude and GPT-OSS models Google hosts for it",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./opencode.mjs",
|
"main": "./opencode.mjs",
|
||||||
|
|||||||
@@ -58,6 +58,15 @@ test("OpenCode's variant names the level", async () => {
|
|||||||
expect(seen.find((s) => s.name === "streamGenerateContent").json.model).toBe("gemini-3.7-flash-low")
|
expect(seen.find((s) => s.name === "streamGenerateContent").json.model).toBe("gemini-3.7-flash-low")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("a level in capitals, as Gemini's own clients write it, names the level too (#1169)", async () => {
|
||||||
|
const seen = fake({ fetchAvailableModels: models, streamGenerateContent: () => sse({ candidates: [] }) })
|
||||||
|
const f = await loaderFetch(auth())
|
||||||
|
await f(URL_("gemini-3.7-flash"), { method: "POST", body: ask("hi", { generationConfig: { thinkingConfig: { includeThoughts: true, thinkingLevel: "LOW" } } }) })
|
||||||
|
const sent = seen.find((s) => s.name === "streamGenerateContent").json
|
||||||
|
expect(sent.model).toBe("gemini-3.7-flash-low")
|
||||||
|
expect(sent.request.generationConfig.thinkingConfig).toEqual({ includeThoughts: true, thinkingLevel: "low" })
|
||||||
|
})
|
||||||
|
|
||||||
test("a Request input is read", async () => {
|
test("a Request input is read", async () => {
|
||||||
const seen = fake({ fetchAvailableModels: models, streamGenerateContent: () => sse({ candidates: [] }) })
|
const seen = fake({ fetchAvailableModels: models, streamGenerateContent: () => sse({ candidates: [] }) })
|
||||||
const f = await loaderFetch(auth())
|
const f = await loaderFetch(auth())
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ test.each([
|
|||||||
["gemini-3.7-flash-low", "low", "low", "low"],
|
["gemini-3.7-flash-low", "low", "low", "low"],
|
||||||
["gemini-3.7-flash-medium", "medium", "medium", "medium"],
|
["gemini-3.7-flash-medium", "medium", "medium", "medium"],
|
||||||
["gemini-3.7-flash-high", "high", "xhigh", "high"],
|
["gemini-3.7-flash-high", "high", "xhigh", "high"],
|
||||||
|
// a variant at xhigh thinks at xhigh, asked or by default (#1169)
|
||||||
|
["gemini-4-hydrogen-xhigh", "xhigh", "xhigh", "xhigh"],
|
||||||
|
["gemini-4-hydrogen-xhigh", "xhigh", "", "xhigh"],
|
||||||
|
["gemini-4-hydrogen-high", "high", "xhigh", "high"],
|
||||||
["gemini-3.1-pro-high", "high", "medium", "high"],
|
["gemini-3.1-pro-high", "high", "medium", "high"],
|
||||||
["gemini-3-flash", "", "medium", "medium"],
|
["gemini-3-flash", "", "medium", "medium"],
|
||||||
["gemini-pro-agent", "", "medium", "high"],
|
["gemini-pro-agent", "", "medium", "high"],
|
||||||
|
|||||||
Reference in New Issue
Block a user