chore: merge windows/ into src/ and remove duplicate folder

Cross-platform support lives in src/ via _IS_WINDOWS checks.
Merges latest upstream additions from windows/ (OAuth secrets,
ANTIGRAVITY_MODELS, changelog v3.10.5) into src/ files, then
removes the redundant windows/ folder.
This commit is contained in:
cobra91
2026-05-25 15:09:07 +02:00
Unverified
parent c203cabb01
commit 17126bc111
4 changed files with 206 additions and 4878 deletions

View File

@@ -66,6 +66,7 @@ CONFIG_TXN = CONFIG_DIR / "config.toml.launcher-txn.json"
ENDPOINTS_FILE = CONFIG_DIR / "endpoints.json"
BGP_POOLS_FILE = CONFIG_DIR / "bgp-pools.json"
LAUNCH_LOG = LOG_DIR / "launcher.log"
OAUTH_SECRETS_PATH = HOME / ".config" / "codex-launcher" / "oauth-secrets.json"
if IS_WINDOWS:
PROXY = BIN_DIR / "translate-proxy.py"
@@ -82,6 +83,69 @@ model_catalog_json = ""
"""
CHANGELOG = [
("3.10.5", "2026-05-25", [
"Context compaction for Antigravity/Gemini OAuth — prevents token limit errors",
"Aggressive compaction policies at 60% of model context limit",
"Compaction for cloudcode-pa and googleapis provider policies",
"REST model IDs added to context size map (gemini-3-flash, etc.)",
"OAuth Secrets editor in GUI — update client ID/secret without editing files",
"Secrets stored in ~/.config/codex-launcher/oauth-secrets.json (not in repo)",
"Import JSON button — import client_secret_*.json from Google Cloud Console",
"All hardcoded OAuth secrets removed from source code",
"Antigravity model IDs fixed: display names → slug model IDs for REST API",
"Git history scrubbed of leaked credentials; pre-push hook installed",
"Antigravity REST API model IDs verified with live API testing",
"Gemini 3.5 Flash, 3.1 Pro, Claude 4.6, GPT-OSS 120B all working",
]),
("3.9.9", "2026-05-25", [
"Refresh Antigravity preset: Gemini 3.5 Flash, Gemini 3.1 Pro, Claude 4.6, GPT-OSS",
"Fix Antigravity alias map for tiered model IDs (high/medium/low/thinking)",
"Model context sizes for Gemini 3.5 Flash, 3.1 Pro, Claude 4.6, GPT-OSS 120B",
]),
("3.9.8", "2026-05-25", [
"Fix Desktop model leak — remap gpt-5.4-mini to user-selected model",
"send_json() catches BrokenPipeError globally — no crashes on disconnect",
"Proxy remaps Desktop forced models via CODEX_LAUNCHER_MODEL env",
]),
("3.9.7", "2026-05-25", [
"Forward real Codebuff error messages instead of generic 429",
"Return HTTP 200 with Responses API format for rate limits",
"Extract retryAfterMs from Codebuff 429 responses for cooldown",
"RateLimitError carries upstream message through all paths",
"BrokenPipeError fix on 'all accounts exhausted' response",
"Fix 3 SyntaxWarnings for invalid escape sequences",
"_codebuff_start_run returns actual error body",
]),
("3.9.6", "2026-05-25", [
"Fix Gemini follow-up turns: enforce latest user instruction as final turn",
"Edit-intent detection with tool-use nudge for file modifications",
"Thought signature preservation for Gemini 3 tool-call continuity",
"Smart tool output compaction: old=3000, recent=20000 chars",
"Multi-account rotation for codebuff, Google OAuth, API keys",
"/v1/accounts endpoint for account pool status",
]),
("3.9.0", "2026-05-24", [
"Multi-account rotation for OAuth providers (codebuff, Google, API keys)",
"Automatic failover on rate limit — next account used",
"Codebuff: accounts[] array in credentials.json",
"Google OAuth: multiple token files (google-*-oauth-token-N.json)",
"API keys: comma-separated keys rotate on 429 errors",
"/v1/accounts endpoint shows account pool status",
"x-codebuff-model and x-codebuff-instance-id headers",
]),
("3.8.4", "2026-05-24", [
"Codebuff streaming — SSE events reach Codex client",
"stream_buffered_events now called for codebuff",
"Codebuff OAuth built-in login flow (no external CLI)",
"Codebuff API: reverse-engineered www.codebuff.com endpoints",
"Codebuff session management with instance ID",
"Codebuff agent run lifecycle (start/finish) with model routing",
"Free DeepSeek V4 Pro, V4 Flash, Kimi K2.6, MiniMax M2.7",
"Reasoning mode works with codebuff (thinking tokens supported)",
"GUI: Sandbox mode selector (Read-only / Workspace / Full Access)",
"GUI: Approval mode selector (Untrusted / On Request / Full Auto)",
"GUI: Codebuff Login button in endpoint editor",
]),
("3.8.1", "2026-05-24", [
"Freebuff integration — free DeepSeek V4 Pro, V4 Flash, Kimi K2.6, MiniMax M2.7",
"Freebuff backend: auto agent-run lifecycle, credential detection, model routing",
@@ -974,6 +1038,9 @@ def endpoint_model_headers(endpoint):
def fetch_models_for_endpoint(endpoint, timeout=10):
bt = endpoint.get("backend_type", "")
if bt == "gemini-oauth-antigravity":
return list(ANTIGRAVITY_MODELS), None
url = endpoint_models_url(endpoint)
if not url:
return None, "Base URL is empty"
@@ -1006,6 +1073,40 @@ def refresh_endpoint_models(endpoint):
updated["default_model"] = ids[0]
return updated, None
# ═══════════════════════════════════════════════════════════════════════
# Antigravity model list (static — no /v1/models REST endpoint)
# ═══════════════════════════════════════════════════════════════════════
ANTIGRAVITY_MODELS = [
"Gemini 3.5 Flash (High)", "Gemini 3.5 Flash (Medium)", "Gemini 3.5 Flash (Low)",
"Gemini 3.1 Pro (High)", "Gemini 3.1 Pro (Low)",
"Claude Sonnet 4.6 (Thinking)",
"Claude Opus 4.6 (Thinking)",
"GPT-OSS 120B (Medium)",
]
# ═══════════════════════════════════════════════════════════════════════
# OAuth secrets (local, never in repo)
# ═══════════════════════════════════════════════════════════════════════
def load_oauth_secrets():
try:
with open(OAUTH_SECRETS_PATH, encoding="utf-8") as f:
return json.load(f)
except Exception:
return {}
def save_oauth_secrets(data):
os.makedirs(os.path.dirname(OAUTH_SECRETS_PATH), exist_ok=True)
tmp = str(OAUTH_SECRETS_PATH) + ".tmp"
with open(tmp, "w", encoding="utf-8") as f:
json.dump(data, f, indent=2)
os.replace(tmp, OAUTH_SECRETS_PATH)
# ═══════════════════════════════════════════════════════════════════════
# Doctor checks
# ═══════════════════════════════════════════════════════════════════════