fix provider thinking compatibility

- claude: handle DeepSeek thinking blocks defensively, unsigned placeholder; fix kept-vs-seen thinking detection
- gemini: clamp unsupported max/xhigh thinking levels to high
- testUtils: probe Cloud Code Assist for gemini-cli/antigravity with 401 refresh retry
- tests: add translator regression coverage

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Mink Nguyen
2026-06-26 10:12:48 +07:00
committed by decolua
co-authored by Cursor
parent cb65a45e1f
commit c4f80d30d8
5 changed files with 140 additions and 17 deletions
@@ -4,7 +4,7 @@
import { getCapabilitiesForModel } from "../../providers/capabilities.js";
import { PROVIDERS } from "../../providers/index.js";
import { LEVEL_TO_BUDGET, budgetToLevel, effortToBudget } from "./thinking.js";
import { LEVEL_TO_BUDGET, budgetToLevel, effortToBudget, effortToThinkingLevel } from "./thinking.js";
// Map a target wire-format to its native thinking format (when capability has none).
const FORMAT_TO_NATIVE = {
@@ -127,6 +127,11 @@ function toLevel(cfg) {
return null;
}
function toGeminiThinkingLevel(cfg) {
const raw = cfg.mode === "auto" ? "high" : (toLevel(cfg) || "high");
return effortToThinkingLevel(raw);
}
// Gemini nests thinkingConfig under generationConfig. gemini-cli / antigravity wrap
// the whole request in a { request: { generationConfig } } envelope — target the
// envelope's generationConfig when present, else the top-level one.
@@ -179,7 +184,7 @@ function applyFormat(fmt, body, cfg, caps) {
break;
}
case "gemini-level": {
const level = none ? "minimal" : (toLevel(eff) || "high");
const level = none ? "minimal" : toGeminiThinkingLevel(eff);
setGeminiThinking(body, { thinkingLevel: level, includeThoughts: level !== "minimal" });
break;
}