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>
36 lines
1.6 KiB
Python
36 lines
1.6 KiB
Python
"""The "send larger work to AITURK" instruction reaches only Codex Desktop, and only when a send command exists."""
|
|
import unittest
|
|
|
|
import is_hatti as h
|
|
|
|
|
|
class Hat(unittest.TestCase):
|
|
def test_only_the_desktop_app_is_recognised(self):
|
|
self.assertTrue(h.masaustu_mu("Codex Desktop"))
|
|
for other in ("codex-tui", "codex_exec", "codex_cli_rs", "", None, "Codex Desktop Helper"):
|
|
self.assertFalse(h.masaustu_mu(other), other)
|
|
|
|
def test_no_instruction_without_the_switch_or_without_a_send_command(self):
|
|
self.assertIsNone(h.talimat(None))
|
|
self.assertIsNone(h.talimat({"enabled": False, "komut": "aiturk gonder"}))
|
|
self.assertIsNone(h.talimat({"enabled": True}))
|
|
self.assertIsNone(h.talimat({"enabled": True, "komut": " "}))
|
|
text = h.talimat({"enabled": True, "komut": "aiturk gonder --dosya is.md"})
|
|
self.assertIn("aiturk gonder --dosya is.md", text)
|
|
self.assertIn("sen yap", text)
|
|
self.assertEqual(h.talimat({"enabled": True, "komut": "x", "talimat": "ozel {komut}"}), "ozel x")
|
|
|
|
def test_instruction_is_put_first_once_and_never_repeated(self):
|
|
req = {"input": [{"type": "message", "role": "user", "content": "selam"}]}
|
|
text = h.talimat({"enabled": True, "komut": "aiturk gonder"})
|
|
self.assertTrue(h.ekle(req, text))
|
|
self.assertEqual((req["input"][0]["role"], len(req["input"])), ("developer", 2))
|
|
self.assertFalse(h.ekle(req, text))
|
|
self.assertEqual(len(req["input"]), 2)
|
|
self.assertFalse(h.ekle({"input": "duz metin"}, text))
|
|
self.assertFalse(h.ekle(req, None))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|