feat(codex-bridge): ship the local Codex bridge with the IDE

Adds the IDE's models and combos to Codex's model list and keeps conversation
summaries readable across providers, so switching models in Codex no longer
drops the conversation. Standard-library Python, run on the agent venv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HRDGW1LiKcDUZYUdKBoWYW
This commit is contained in:
yilsemandClaude Opus 5.5 committed 2026-10-09 15:46:10 +03:00
1 parent df63432c92
commit 1ce5ab82cf
13 files changed
+2071

No files matched your search

@@ -0,0 +1,33 @@
"""Compatibility for Gemini translators that retain only the last system turn.
Only instruction-bearing text messages are folded; user/tool content is never
promoted. Caller must scope this to the affected Gemini route. No network or IO.
"""
def coalesce_context(request):
items = request.get('input')
base = request.get('instructions', '')
if not isinstance(items, list) or not isinstance(base, str):
return 0
chunks = ['[BASE SYSTEM INSTRUCTIONS]\n' + base] if base else []
remaining = []
count = 0
for item in items:
if not isinstance(item, dict) or item.get('type', 'message') != 'message' or item.get('role') not in ('system', 'developer'):
remaining.append(item)
continue
content = item.get('content', '')
if isinstance(content, str):
text = content
elif isinstance(content, list) and all(isinstance(p, dict) and p.get('type') in ('input_text','text') and isinstance(p.get('text'), str) for p in content):
text = '\n'.join(p['text'] for p in content)
else:
# Unknown multimodal instruction block: do not discard or rewrite.
return 0
chunks.append('[' + item['role'].upper() + ' CONTEXT ' + str(count+1) + ']\n' + text)
count += 1
if count:
request['instructions'] = '\n\n'.join(chunks)
request['input'] = remaining
return count