release: Gemini CLI v0.35.3 (6 patches)
This commit is contained in:
@@ -843,6 +843,11 @@ def patch_default_models(gemini_root, config):
|
||||
if old in content:
|
||||
content = content.replace(old, new, 1)
|
||||
changes += 1
|
||||
elif re.search(r"export const DEFAULT_GEMINI_MODEL = 'gemini-\d+\.\d+[^']*';", content):
|
||||
content, n = re.subn(
|
||||
r"(export const DEFAULT_GEMINI_MODEL = ')gemini-\d+\.\d+[^']*(')",
|
||||
rf"\g<1>{default_model}\g<2>", content, count=1)
|
||||
changes += n
|
||||
|
||||
# 10b: DEFAULT_GEMINI_FLASH_MODEL
|
||||
if flash_model:
|
||||
@@ -851,6 +856,11 @@ def patch_default_models(gemini_root, config):
|
||||
if old in content:
|
||||
content = content.replace(old, new, 1)
|
||||
changes += 1
|
||||
elif re.search(r"export const DEFAULT_GEMINI_FLASH_MODEL = 'gemini-\d+\.\d+[^']*';", content):
|
||||
content, n = re.subn(
|
||||
r"(export const DEFAULT_GEMINI_FLASH_MODEL = ')gemini-\d+\.\d+[^']*(')",
|
||||
rf"\g<1>{flash_model}\g<2>", content, count=1)
|
||||
changes += n
|
||||
|
||||
# 10c: DEFAULT_GEMINI_FLASH_LITE_MODEL → same as flash (no 3.x lite)
|
||||
if flash_model:
|
||||
@@ -859,6 +869,11 @@ def patch_default_models(gemini_root, config):
|
||||
if old in content:
|
||||
content = content.replace(old, new, 1)
|
||||
changes += 1
|
||||
elif re.search(r"export const DEFAULT_GEMINI_FLASH_LITE_MODEL = 'gemini-\d+\.\d+[^']*';", content):
|
||||
content, n = re.subn(
|
||||
r"(export const DEFAULT_GEMINI_FLASH_LITE_MODEL = ')gemini-\d+\.\d+[^']*(')",
|
||||
rf"\g<1>{flash_model}\g<2>", content, count=1)
|
||||
changes += n
|
||||
|
||||
# 10d: DEFAULT_GEMINI_MODEL_AUTO
|
||||
old_auto = "export const DEFAULT_GEMINI_MODEL_AUTO = 'auto-gemini-2.5';"
|
||||
@@ -866,6 +881,11 @@ def patch_default_models(gemini_root, config):
|
||||
if old_auto in content:
|
||||
content = content.replace(old_auto, new_auto, 1)
|
||||
changes += 1
|
||||
elif re.search(r"export const DEFAULT_GEMINI_MODEL_AUTO = 'auto-gemini-\d[^']*';", content):
|
||||
content, n = re.subn(
|
||||
r"(export const DEFAULT_GEMINI_MODEL_AUTO = ')auto-gemini-\d[^']*(')",
|
||||
rf"\g<1>auto-gemini-3\g<2>", content, count=1)
|
||||
changes += n
|
||||
|
||||
# 10e: getDisplayString() — fix auto display label
|
||||
old_display = "return 'Auto (Gemini 2.5)';"
|
||||
@@ -873,6 +893,11 @@ def patch_default_models(gemini_root, config):
|
||||
if old_display in content:
|
||||
content = content.replace(old_display, new_display, 1)
|
||||
changes += 1
|
||||
elif re.search(r"return 'Auto \(Gemini \d[^']*\)';", content):
|
||||
content, n = re.subn(
|
||||
r"(return 'Auto \(Gemini )\d[^']*(')",
|
||||
r"\g<1>3\g<2>", content, count=1)
|
||||
changes += n
|
||||
|
||||
if changes == 0:
|
||||
# Check if already patched
|
||||
@@ -915,9 +940,20 @@ def patch_model_dialog(gemini_root, config):
|
||||
old_desc = "gemini-2.5-pro, gemini-2.5-flash"
|
||||
new_desc = f"{default_model}, {flash_model}"
|
||||
|
||||
if old_desc not in content:
|
||||
if new_desc in content:
|
||||
return True, "Already patched (ModelDialog.js)"
|
||||
if old_desc in content:
|
||||
pass # exact match — will replace below
|
||||
elif new_desc in content:
|
||||
return True, "Already patched (ModelDialog.js)"
|
||||
elif re.search(r"gemini-\d+\.\d+-pro, gemini-\d+\.\d+-flash", content):
|
||||
# Fallback: match any X.Y version pair
|
||||
backup_path = dialog_path + ".backup"
|
||||
if not os.path.exists(backup_path):
|
||||
shutil.copy2(dialog_path, backup_path)
|
||||
content = re.sub(r"gemini-\d+\.\d+-pro, gemini-\d+\.\d+-flash", new_desc, content, count=1)
|
||||
with open(dialog_path, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
return True, "Patched model description in ModelDialog.js (regex fallback)"
|
||||
else:
|
||||
return False, "No ModelDialog.js pattern matched"
|
||||
|
||||
backup_path = dialog_path + ".backup"
|
||||
@@ -947,8 +983,8 @@ def patch_compression_aliases(gemini_root, config):
|
||||
content = f.read()
|
||||
|
||||
changes = 0
|
||||
# Exact replacements: (old, new)
|
||||
replacements = [
|
||||
# (old_return_value, new_return_value)
|
||||
("case DEFAULT_GEMINI_MODEL:\n return 'chat-compression-2.5-pro';",
|
||||
"case DEFAULT_GEMINI_MODEL:\n return 'chat-compression-3-pro';"),
|
||||
("case DEFAULT_GEMINI_FLASH_MODEL:\n return 'chat-compression-2.5-flash';",
|
||||
@@ -957,11 +993,27 @@ def patch_compression_aliases(gemini_root, config):
|
||||
"case DEFAULT_GEMINI_FLASH_LITE_MODEL:\n return 'chat-compression-3-flash';"),
|
||||
]
|
||||
|
||||
# Regex fallbacks when exact version (2.5) has changed to another 2.x
|
||||
regex_replacements = [
|
||||
(r"(case DEFAULT_GEMINI_MODEL:\n )return 'chat-compression-\d+\.\d+-pro';",
|
||||
r"\g<1>return 'chat-compression-3-pro';"),
|
||||
(r"(case DEFAULT_GEMINI_FLASH_MODEL:\n )return 'chat-compression-\d+\.\d+-flash';",
|
||||
r"\g<1>return 'chat-compression-3-flash';"),
|
||||
(r"(case DEFAULT_GEMINI_FLASH_LITE_MODEL:\n )return 'chat-compression-\d+\.\d+-flash[^']*';",
|
||||
r"\g<1>return 'chat-compression-3-flash';"),
|
||||
]
|
||||
|
||||
for old, new in replacements:
|
||||
if old in content:
|
||||
content = content.replace(old, new, 1)
|
||||
changes += 1
|
||||
|
||||
if changes == 0:
|
||||
# Try regex fallback for each alias (handles version bumps like 2.5 → 2.6)
|
||||
for pat, repl in regex_replacements:
|
||||
content, n = re.subn(pat, repl, content, count=1)
|
||||
changes += n
|
||||
|
||||
if changes == 0:
|
||||
if "DEFAULT_GEMINI_MODEL:\n return 'chat-compression-3-pro'" in content:
|
||||
return True, "Already patched (chatCompressionService.js)"
|
||||
|
||||
Reference in New Issue
Block a user