python-codex 0.4.6__tar.gz → 0.4.7__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 (91) hide show
  1. {python_codex-0.4.6 → python_codex-0.4.7}/PKG-INFO +5 -3
  2. {python_codex-0.4.6 → python_codex-0.4.7}/README.md +4 -2
  3. {python_codex-0.4.6 → python_codex-0.4.7}/README_ZH.md +3 -1
  4. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/session_persist.py +11 -3
  5. {python_codex-0.4.6 → python_codex-0.4.7}/pyproject.toml +2 -2
  6. {python_codex-0.4.6 → python_codex-0.4.7}/.gitignore +0 -0
  7. {python_codex-0.4.6 → python_codex-0.4.7}/LICENSE +0 -0
  8. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/__init__.py +0 -0
  9. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/__main__.py +0 -0
  10. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/agent.py +0 -0
  11. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/bootstrap.py +0 -0
  12. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/cli.py +0 -0
  13. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/context.py +0 -0
  14. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/events.py +0 -0
  15. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/model.py +0 -0
  16. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/portable/__init__.py +0 -0
  17. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/portable/client.py +0 -0
  18. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/portable/server.py +0 -0
  19. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/default_base_instructions.md +0 -0
  20. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/models.json +0 -0
  21. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/permissions/approval_policy/never.md +0 -0
  22. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/permissions/approval_policy/on_failure.md +0 -0
  23. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/permissions/approval_policy/on_request.md +0 -0
  24. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/permissions/approval_policy/on_request_rule_request_permission.md +0 -0
  25. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/permissions/approval_policy/unless_trusted.md +0 -0
  26. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/permissions/sandbox_mode/danger_full_access.md +0 -0
  27. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/permissions/sandbox_mode/read_only.md +0 -0
  28. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/prompts/permissions/sandbox_mode/workspace_write.md +0 -0
  29. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/protocol.py +0 -0
  30. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/runtime.py +0 -0
  31. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/__init__.py +0 -0
  32. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/agent_tool_schemas.py +0 -0
  33. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/apply_patch_tool.py +0 -0
  34. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/base_tool.py +0 -0
  35. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/clock_tool.py +0 -0
  36. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/close_agent_tool.py +0 -0
  37. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/code_mode_manager.py +0 -0
  38. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/exec_command_tool.py +0 -0
  39. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/exec_runtime.js +0 -0
  40. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/exec_tool.py +0 -0
  41. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/grep_files_tool.py +0 -0
  42. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/list_dir_tool.py +0 -0
  43. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/read_file_tool.py +0 -0
  44. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/request_permissions_tool.py +0 -0
  45. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/request_user_input_tool.py +0 -0
  46. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/resume_agent_tool.py +0 -0
  47. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/runtime_services.py +0 -0
  48. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/send_input_tool.py +0 -0
  49. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/shell_command_tool.py +0 -0
  50. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/shell_tool.py +0 -0
  51. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/spawn_agent_tool.py +0 -0
  52. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/unified_exec_manager.py +0 -0
  53. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/update_plan_tool.py +0 -0
  54. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/view_image_tool.py +0 -0
  55. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/wait_agent_tool.py +0 -0
  56. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/wait_tool.py +0 -0
  57. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/web_search_tool.py +0 -0
  58. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/tools/write_stdin_tool.py +0 -0
  59. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/__init__.py +0 -0
  60. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/_aes_gcm/LICENSE +0 -0
  61. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/_aes_gcm/README.md +0 -0
  62. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/_aes_gcm/__init__.py +0 -0
  63. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/_aes_gcm/aes.py +0 -0
  64. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/_aes_gcm/gcm.py +0 -0
  65. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/_aes_gcm/source-sha256.json +0 -0
  66. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/async_bridge.py +0 -0
  67. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/compactor.py +0 -0
  68. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/compat.py +0 -0
  69. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/crypto.py +0 -0
  70. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/debug.py +0 -0
  71. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/doctor.py +0 -0
  72. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/dotenv.py +0 -0
  73. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/event_helpers.py +0 -0
  74. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/get_env.py +0 -0
  75. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/image_utils.py +0 -0
  76. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/model_metadata.py +0 -0
  77. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/random_ids.py +0 -0
  78. {python_codex-0.4.6 → python_codex-0.4.7}/pycodex/utils/truncation.py +0 -0
  79. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/__init__.py +0 -0
  80. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/__main__.py +0 -0
  81. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/app.py +0 -0
  82. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/config.py +0 -0
  83. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/messages_api.py +0 -0
  84. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/payload_processors.py +0 -0
  85. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/server.py +0 -0
  86. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/session_store.py +0 -0
  87. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/stream_router.py +0 -0
  88. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/tools/__init__.py +0 -0
  89. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/tools/custom_adapter.py +0 -0
  90. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/tools/web_search.py +0 -0
  91. {python_codex-0.4.6 → python_codex-0.4.7}/responses_server/trajectory_dump.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-codex
3
- Version: 0.4.6
3
+ Version: 0.4.7
4
4
  Summary: A minimal Python extraction of Codex's main agent loop
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.6.2
@@ -387,8 +387,10 @@ Current behavior:
387
387
  `model:effort`.
388
388
  - `/resume` with no argument lists the currently resumable sessions by their
389
389
  first user-message preview; `/resume 1` resumes the first listed session
390
- - `/resume <number>` replaces the in-memory history with the selected recorded
391
- Codex rollout from `CODEX_HOME/sessions`. Tool calls without recorded results
390
+ - `/resume <session_id>` accepts a full session UUID, including sessions older
391
+ than the displayed list. Both forms search `CODEX_HOME/sessions` and
392
+ `CODEX_HOME/archived_sessions` and replace the in-memory history with the
393
+ selected recorded Codex rollout. Tool calls without recorded results
392
394
  are omitted during restore; later saved messages and completed tools remain
393
395
  available, and the source file is left intact.
394
396
  - `/compact` synthesizes a local handoff summary, replaces the in-memory
@@ -367,8 +367,10 @@ Current behavior:
367
367
  `model:effort`.
368
368
  - `/resume` with no argument lists the currently resumable sessions by their
369
369
  first user-message preview; `/resume 1` resumes the first listed session
370
- - `/resume <number>` replaces the in-memory history with the selected recorded
371
- Codex rollout from `CODEX_HOME/sessions`. Tool calls without recorded results
370
+ - `/resume <session_id>` accepts a full session UUID, including sessions older
371
+ than the displayed list. Both forms search `CODEX_HOME/sessions` and
372
+ `CODEX_HOME/archived_sessions` and replace the in-memory history with the
373
+ selected recorded Codex rollout. Tool calls without recorded results
372
374
  are omitted during restore; later saved messages and completed tools remain
373
375
  available, and the source file is left intact.
374
376
  - `/compact` synthesizes a local handoff summary, replaces the in-memory
@@ -314,7 +314,9 @@ pycodex doctor
314
314
  - `/effort low` 在空闲时切换 effort,`/effort` 查看当前值,`/effort default` 恢复模型默认值;前端模型标签显示 `model:effort`。
315
315
  - `/resume` 不带参数时会按首条用户消息预览列出当前可恢复的 session;`/resume 1`
316
316
  会恢复列表里的第 1 个 session
317
- - `/resume <数字>` 会从 `CODEX_HOME/sessions` 读取选中的已记录 Codex rollout,
317
+ - `/resume <session_id>` 支持完整的会话 UUID,不受当前列表条数限制。
318
+ 编号和 UUID 两种方式都会查找 `CODEX_HOME/sessions` 与
319
+ `CODEX_HOME/archived_sessions`,读取选中的已记录 Codex rollout,
318
320
  并直接替换当前内存里的会话 history
319
321
  - 新 session 现在会自动保存到 `CODEX_HOME/sessions/.../rollout-*.jsonl`,
320
322
  使用稳定的 session/thread id,并按 item 级别 append + flush,和 `/resume`
@@ -163,6 +163,7 @@ class SessionRolloutRecorder:
163
163
  def list_resumable_sessions(
164
164
  codex_home: "Path",
165
165
  limit: "int" = 20,
166
+ session_id: "typing.Union[str, None]" = None,
166
167
  ) -> "typing.Tuple[typing.Dict[str, str], ...]":
167
168
  latest_rollouts_by_id: "typing.Dict[str, Path]" = {}
168
169
  for dirname in ROLLUP_SESSION_DIRNAMES:
@@ -173,6 +174,8 @@ def list_resumable_sessions(
173
174
  thread_id = _thread_id_from_rollout_path(path)
174
175
  if thread_id is None:
175
176
  continue
177
+ if session_id is not None and thread_id.lower() != session_id.lower():
178
+ continue
176
179
  previous = latest_rollouts_by_id.get(thread_id)
177
180
  if previous is None or path.stat().st_mtime > previous.stat().st_mtime:
178
181
  latest_rollouts_by_id[thread_id] = path
@@ -202,11 +205,16 @@ def list_resumable_sessions(
202
205
 
203
206
  def select_resumable_session(
204
207
  codex_home: "Path",
205
- resume_index_text: "str",
208
+ resume_target: "str",
206
209
  ) -> "typing.Dict[str, str]":
207
- normalized_target = resume_index_text.strip()
210
+ normalized_target = resume_target.strip()
211
+ if UUID_PATTERN.fullmatch(normalized_target):
212
+ sessions = list_resumable_sessions(codex_home, 1, normalized_target)
213
+ if not sessions:
214
+ raise ValueError(f"Session not found: {normalized_target}")
215
+ return sessions[0]
208
216
  if not normalized_target.isdigit():
209
- raise ValueError("Usage: /resume <number>")
217
+ raise ValueError("Usage: /resume <number|session_id>")
210
218
 
211
219
  sessions = list_resumable_sessions(codex_home)
212
220
  resume_index = int(normalized_target)
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "python-codex"
7
- version = "0.4.6"
7
+ version = "0.4.7"
8
8
  description = "A minimal Python extraction of Codex's main agent loop"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.6.2"
@@ -40,7 +40,7 @@ test = [
40
40
  ]
41
41
  dev = [
42
42
  { include-group = "test" },
43
- "pycodex-ws==0.4.6",
43
+ "pycodex-ws==0.4.7",
44
44
  "black>=22.8.0",
45
45
  "debugpy>=1.8.20; python_version >= '3.8'",
46
46
  "isort>=5.10.1",
File without changes
File without changes