User decision: the "larger work goes to AITURK" instruction lives only in what Codex IDE sees; the CLI must not know it exists. The bridge adds it in flight by the originator header (measured: Codex Desktop, codex-tui, codex_exec) and only when a send command is configured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
2.5 KiB
Python
53 lines
2.5 KiB
Python
"""Codex IDE'ye "is kucuk degilse AITURK yapacak" talimati (11 Ekim 2026).
|
||
|
||
Kullanici karari: talimat yalniz Codex IDE'nin (masaustu uygulamasi) gordugu sistem talimatinda durur; Codex CLI
|
||
talimati hic gormez, varligindan haberi olmaz. Karari secili model verir; kucuk modellerin yanilmasi kabul edilir,
|
||
ayri bir yazilimla onune gecilmez.
|
||
|
||
Bu yuzden talimat hicbir dosyaya yazilmaz (AGENTS.md'yi CLI da okur): kopru, yalniz masaustu uygulamasindan gelen
|
||
isteklere, istek gecerken ekler. Istemci `originator` basligindan ayirt edilir (olcum 11 Ekim 2026: masaustu
|
||
"Codex Desktop", etkilesimli CLI "codex-tui", `codex exec` "codex_exec").
|
||
|
||
Ayar (bridge.json): "aiturk_hat": {"enabled": true, "komut": "<isi AITURK'e gonderen komut>", "talimat": "<istege bagli>"}.
|
||
Komut tanimli degilse talimat eklenmez: gonderme yolu olmayan bir "AITURK'e gonder" talimati modeli yaniltir.
|
||
"""
|
||
|
||
MASAUSTU = {"codex desktop"}
|
||
ISARET = "[AITURK iş hattı]"
|
||
VARSAYILAN = (
|
||
ISARET + " Bu Codex, AITURK'e bağlı. Şu kurala göre çalış:\n"
|
||
"1. Basit soruyu, bilgi isteğini ya da tek küçük düzeltmeyi kendin yap.\n"
|
||
"2. Kullanıcı \"sen yap\" derse işi kendin yap.\n"
|
||
"3. İş küçük değilse (birden çok dosya, birkaç adım, yeni özellik, araştırma gerektiren iş) kendin yapma; "
|
||
"işi şu komutla AITURK'e gönder, bitmesini bekle ve sonucu kullanıcıya kısaca aktar:\n{komut}\n"
|
||
"Emin değilsen işi küçük say ve kendin yap."
|
||
)
|
||
|
||
|
||
def masaustu_mu(originator):
|
||
return str(originator or "").strip().lower() in MASAUSTU
|
||
|
||
|
||
def talimat(ayar):
|
||
"""Eklenecek metin; hat kapaliysa ya da komut yoksa None."""
|
||
if not isinstance(ayar, dict) or not ayar.get("enabled"):
|
||
return None
|
||
komut = str(ayar.get("komut") or "").strip()
|
||
if not komut:
|
||
return None
|
||
return str(ayar.get("talimat") or VARSAYILAN).replace("{komut}", komut)
|
||
|
||
|
||
def ekle(req, metin):
|
||
"""Talimati istegin basina developer mesaji olarak koyar. True: eklendi (zaten varsa eklenmez)."""
|
||
girdi = req.get("input")
|
||
if not metin or not isinstance(girdi, list):
|
||
return False
|
||
for oge in girdi[:3]:
|
||
icerik = oge.get("content") if isinstance(oge, dict) else None
|
||
yazi = icerik if isinstance(icerik, str) else " ".join(str(p.get("text") or "") for p in icerik or [] if isinstance(p, dict))
|
||
if ISARET in yazi:
|
||
return False
|
||
girdi.insert(0, {"type": "message", "role": "developer", "content": [{"type": "input_text", "text": metin}]})
|
||
return True
|