"""One decision-model question from the command line (14 Oct 2026). Used by the Codex dynamic-workflow acceptance step (verifierCheck): before a reviewer's "kabul" is accepted, the decision model is asked whether the approval cites concrete evidence. Reads the IDE's own Kademeli Geçiş settings and key; nothing is written. python karar_sor.py dogrulayici < {"user_request": "...", "assistant_reply": "..."} Prints JSON {"enabled": bool, "kanitsiz": bool|null, "puan": float|null, "neden": str}. Exit 0 also when the stage is off or the model cannot be reached; the caller decides what an unanswered check means. """ import json import os import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent)) import jev_denetim # noqa: E402 import jev_settings # noqa: E402 SINIR = 20000 def dogrulayici(veri, anahtar=None, gonder=None): s = jev_settings.read()[0] v = s['verifierCheck'] if not (s['enabled'] and v['enabled']): return {'enabled': False, 'kanitsiz': None, 'puan': None, 'neden': 'kapali'} durum = {'user_request': str(veri.get('user_request') or '')[:SINIR], 'assistant_reply': str(veri.get('assistant_reply') or '')[:SINIR]} ek = {'gonder': gonder} if gonder else {} puan = jev_denetim.sorular(durum, {'kanitsiz': v['question']}, jev_denetim.anahtar() if anahtar is None else anahtar, 15, **ek) if puan is None: return {'enabled': True, 'kanitsiz': None, 'puan': None, 'neden': 'karar modeline sorulamadi'} return {'enabled': True, 'kanitsiz': puan['kanitsiz'] >= v['threshold'], 'puan': round(puan['kanitsiz'], 3), 'neden': ''} def main(argv=None, stdin=None, out=None): argv = sys.argv[1:] if argv is None else argv stdin, out = stdin or sys.stdin, out or sys.stdout soru = [a for i, a in enumerate(argv) if a != '--home' and (i == 0 or argv[i - 1] != '--home')] if soru != ['dogrulayici']: print('kullanim: python karar_sor.py dogrulayici < {"user_request": ..., "assistant_reply": ...}', file=sys.stderr) return 2 try: veri = json.load(stdin) sonuc = dogrulayici(veri if isinstance(veri, dict) else {}) except Exception as e: sonuc = {'enabled': None, 'kanitsiz': None, 'puan': None, 'neden': f'{type(e).__name__}: {e}'[:300]} out.write(json.dumps(sonuc, ensure_ascii=False)) return 0 if __name__ == '__main__': # Installed copy: the settings live in the user's bridge home, not next to this file. if '--home' not in sys.argv and not os.environ.get('AITURK_CODEX_BRIDGE_HOME'): os.environ['AITURK_CODEX_BRIDGE_HOME'] = str(Path(os.environ.get('LOCALAPPDATA', '')) / 'TurkServis' / 'AITURK-IDE' / 'codex-bridge') sys.exit(main())