codex-agent-framework 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/CHANGELOG.md +16 -0
  2. {codex_agent_framework-0.1.1/codex_agent_framework.egg-info → codex_agent_framework-0.1.3}/PKG-INFO +3 -1
  3. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/README.md +2 -0
  4. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/agent.py +1 -0
  5. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/ai.py +1 -0
  6. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/chat.py +8 -1
  7. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3/codex_agent_framework.egg-info}/PKG-INFO +3 -1
  8. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/pyproject.toml +1 -1
  9. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_agent.py +10 -2
  10. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_chat.py +16 -0
  11. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/LICENSE +0 -0
  12. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/MANIFEST.in +0 -0
  13. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/__init__.py +0 -0
  14. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/__main__.py +0 -0
  15. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/builtin_commands.py +0 -0
  16. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/builtin_providers.py +0 -0
  17. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/builtin_tools.py +0 -0
  18. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/command.py +0 -0
  19. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/event.py +0 -0
  20. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/get_text/__init__.py +0 -0
  21. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/get_text/default_gitignore +0 -0
  22. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/get_text/get_text.py +0 -0
  23. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/get_text/simpler_get_text.py +0 -0
  24. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/get_webdriver.py +0 -0
  25. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/image.py +0 -0
  26. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/latex.py +0 -0
  27. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/memory.py +0 -0
  28. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/message.py +0 -0
  29. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/prompts/image_generation_system_prompt.txt +0 -0
  30. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/prompts/system_prompt.txt +0 -0
  31. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/provider.py +0 -0
  32. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/stream_utils.py +0 -0
  33. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/tool.py +0 -0
  34. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/utils.py +0 -0
  35. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/voice.py +0 -0
  36. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent/worker.py +0 -0
  37. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent_framework.egg-info/SOURCES.txt +0 -0
  38. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent_framework.egg-info/dependency_links.txt +0 -0
  39. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent_framework.egg-info/entry_points.txt +0 -0
  40. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent_framework.egg-info/requires.txt +0 -0
  41. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/codex_agent_framework.egg-info/top_level.txt +0 -0
  42. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/setup.cfg +0 -0
  43. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_ai.py +0 -0
  44. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_events.py +0 -0
  45. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_image_message.py +0 -0
  46. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_memory.py +0 -0
  47. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_messages.py +0 -0
  48. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_utils.py +0 -0
  49. {codex_agent_framework-0.1.1 → codex_agent_framework-0.1.3}/tests/test_worker.py +0 -0
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
5
  This project loosely follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and uses semantic versioning where practical.
6
+ ## [0.1.3] - 2026-05-03
7
+ ### Added
8
+ - Send the current session id as `prompt_cache_key` to the Codex backend, enabling server-side prompt cache reuse across calls from the same session.
9
+
10
+ ### Tests
11
+ - Add regression coverage for prompt cache key propagation through agent response calls and Codex stream parameters.
12
+
13
+
14
+ ## [0.1.2] - 2026-05-03
15
+ ### Added
16
+ - Add a `/clear` terminal chat command that clears the screen without touching session history.
17
+
18
+ ### Tests
19
+ - Add regression coverage ensuring terminal screen clearing does not append session messages.
20
+
21
+
6
22
  ## [0.1.1] - 2026-05-03
7
23
  ### Fixed
8
24
  - Validate `ImageMessage` content before adding it to session state.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codex-agent-framework
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A lightweight event-driven Codex agent runtime.
5
5
  Author: Baptiste
6
6
  License-Expression: MIT
@@ -342,6 +342,8 @@ python -m build
342
342
  The distribution includes prompt text files and `codex_agent/get_text/default_gitignore` through package data and `MANIFEST.in`.
343
343
 
344
344
  ## Recent changes
345
+ - `0.1.3`: pass the current session id as `prompt_cache_key` to the Codex backend for prompt cache reuse.
346
+ - `0.1.2`: add `/clear` in the terminal chat to clear the screen without changing session history.
345
347
  - `0.1.1`: image observations are now validated before session persistence, preventing broken `ImageMessage` entries from poisoning later turns.
346
348
 
347
349
  ## Safety notes
@@ -295,6 +295,8 @@ python -m build
295
295
  The distribution includes prompt text files and `codex_agent/get_text/default_gitignore` through package data and `MANIFEST.in`.
296
296
 
297
297
  ## Recent changes
298
+ - `0.1.3`: pass the current session id as `prompt_cache_key` to the Codex backend for prompt cache reuse.
299
+ - `0.1.2`: add `/clear` in the terminal chat to clear the screen without changing session history.
298
300
  - `0.1.1`: image observations are now validated before session persistence, preventing broken `ImageMessage` entries from poisoning later turns.
299
301
 
300
302
  ## Safety notes
@@ -906,6 +906,7 @@ class Agent:
906
906
  message=self.ai.run(
907
907
  messages=messages,
908
908
  tools=self.get_response_tools(),
909
+ prompt_cache_key=self.current_session_id,
909
910
  **self.config.extract('model','reasoning_effort','verbosity')
910
911
  )
911
912
  self.add_message(message)
@@ -289,6 +289,7 @@ class AIClient:
289
289
  "reasoning": reasoning,
290
290
  "reasoning_summary": "auto" if reasoning else None,
291
291
  "include_reasoning": bool(reasoning),
292
+ "prompt_cache_key": params.get("prompt_cache_key"),
292
293
  }
293
294
 
294
295
  def _codex_event_to_message_chunk(self, event, tool_call_index=0):
@@ -38,9 +38,13 @@ class TerminalChat:
38
38
  [("class:prompt", "You > ")],
39
39
  prompt_continuation="... ",
40
40
  )
41
- if prompt.strip().lower() in ["exit", "quit", "/exit", "/quit"]:
41
+ command = prompt.strip().lower()
42
+ if command in ["exit", "quit", "/exit", "/quit"]:
42
43
  self.console.print("[dim]Bye.[/dim]")
43
44
  break
45
+ if command == "/clear":
46
+ self.clear_screen()
47
+ continue
44
48
  if not prompt.strip():
45
49
  continue
46
50
  try:
@@ -93,6 +97,9 @@ class TerminalChat:
93
97
  )
94
98
  )
95
99
 
100
+ def clear_screen(self):
101
+ self.console.clear()
102
+
96
103
  @staticmethod
97
104
  def _format_int(value):
98
105
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codex-agent-framework
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A lightweight event-driven Codex agent runtime.
5
5
  Author: Baptiste
6
6
  License-Expression: MIT
@@ -342,6 +342,8 @@ python -m build
342
342
  The distribution includes prompt text files and `codex_agent/get_text/default_gitignore` through package data and `MANIFEST.in`.
343
343
 
344
344
  ## Recent changes
345
+ - `0.1.3`: pass the current session id as `prompt_cache_key` to the Codex backend for prompt cache reuse.
346
+ - `0.1.2`: add `/clear` in the terminal chat to clear the screen without changing session history.
345
347
  - `0.1.1`: image observations are now validated before session persistence, preventing broken `ImageMessage` entries from poisoning later turns.
346
348
 
347
349
  ## Safety notes
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "codex-agent-framework"
7
- version = "0.1.1"
7
+ version = "0.1.3"
8
8
  description = "A lightweight event-driven Codex agent runtime."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -60,8 +60,12 @@ class FakeImageAI:
60
60
  class FakeCodexClient:
61
61
  def __init__(self, events):
62
62
  self.events = events
63
+ self.args = None
64
+ self.kwargs = None
63
65
 
64
- def stream(self, *_args, **_kwargs):
66
+ def stream(self, *args, **kwargs):
67
+ self.args = args
68
+ self.kwargs = kwargs
65
69
  return iter(self.events)
66
70
 
67
71
 
@@ -290,6 +294,7 @@ def test_agent_get_response_emits_events_and_persists_assistant_message():
290
294
  assert agent.session.messages[-1] is message
291
295
  assert json.loads(json.dumps(message))["type"] == "assistant_message"
292
296
  assert agent.ai.params["verbosity"] == agent.config.verbosity
297
+ assert agent.ai.params["prompt_cache_key"] == agent.current_session_id
293
298
  assert any(tool["type"] == "custom" and tool["name"] == "python" for tool in agent.ai.params["tools"])
294
299
  assert any(tool["type"] == "custom" and tool["name"] == "bash" for tool in agent.ai.params["tools"])
295
300
  assert any(tool["type"] == "function" and tool["name"] == "read" for tool in agent.ai.params["tools"])
@@ -525,6 +530,7 @@ def test_agent_emits_server_tool_call_event_from_output_items():
525
530
  )
526
531
 
527
532
  assert seen == [("web_search", "ws_123", "completed")]
533
+ assert agent.ai._codex_client.kwargs["prompt_cache_key"] is None
528
534
 
529
535
 
530
536
  def test_agent_persists_server_tool_output_items_as_messages():
@@ -1059,15 +1065,17 @@ def test_agent_can_enable_builtin_server_tools_from_config():
1059
1065
  assert set(agent.server_tools) == {"web_search", "image_generation"}
1060
1066
 
1061
1067
 
1062
- def test_codex_stream_params_forward_verbosity():
1068
+ def test_codex_stream_params_forward_verbosity_and_prompt_cache_key():
1063
1069
  agent = Agent(session="new", voice_enabled=False, verbosity="low")
1064
1070
 
1065
1071
  params = agent.ai._to_codex_stream_params({
1066
1072
  "messages": agent.get_context(),
1067
1073
  "verbosity": agent.config.verbosity,
1074
+ "prompt_cache_key": agent.current_session_id,
1068
1075
  })
1069
1076
 
1070
1077
  assert params["verbosity"] == "low"
1078
+ assert params["prompt_cache_key"] == agent.current_session_id
1071
1079
 
1072
1080
 
1073
1081
  def test_agent_provider_messages_are_ephemeral():
@@ -8,6 +8,11 @@ from codex_agent.message import DeveloperMessage
8
8
  class RecordingConsole(Console):
9
9
  def __init__(self):
10
10
  super().__init__(record=True, width=160)
11
+ self.clear_count = 0
12
+
13
+ def clear(self, *args, **kwargs):
14
+ self.clear_count += 1
15
+ return super().clear(*args, **kwargs)
11
16
 
12
17
 
13
18
  def test_agent_context_status_is_lightweight_and_does_not_call_providers():
@@ -45,3 +50,14 @@ def test_terminal_chat_status_bar_renders_context_summary():
45
50
  assert "hist" in output
46
51
  assert "msgs" in output
47
52
  assert "mem" in output
53
+
54
+ def test_terminal_chat_clear_screen_does_not_touch_agent_session():
55
+ agent = Agent(session="new", voice_enabled=False)
56
+ initial_count = len(agent.session.messages)
57
+ console = RecordingConsole()
58
+ chat = TerminalChat(agent, console=console)
59
+
60
+ chat.clear_screen()
61
+
62
+ assert console.clear_count == 1
63
+ assert len(agent.session.messages) == initial_count