python-codex 0.6.3__tar.gz → 0.7.1__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 (111) hide show
  1. {python_codex-0.6.3 → python_codex-0.7.1}/PKG-INFO +40 -13
  2. {python_codex-0.6.3 → python_codex-0.7.1}/README.md +38 -12
  3. {python_codex-0.6.3 → python_codex-0.7.1}/README_ZH.md +26 -6
  4. python_codex-0.7.1/pycodex/agent.py +657 -0
  5. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/config.py +19 -2
  6. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/context.py +24 -9
  7. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/events.py +127 -7
  8. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/model.py +269 -95
  9. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/multi_agents.py +13 -42
  10. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/models.json +8 -8
  11. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/protocol.py +4 -2
  12. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/runtime.py +227 -131
  13. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/__init__.py +3 -3
  14. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/clock_manager.py +0 -7
  15. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/exec_command_tool.py +16 -5
  16. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/exec_runtime.py +5 -1
  17. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/goal_manager.py +25 -32
  18. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/runtime_services.py +21 -11
  19. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/unified_exec_manager.py +46 -3
  20. python_codex-0.7.1/pycodex/utils/compactor.py +108 -0
  21. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/compat.py +6 -0
  22. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/event_helpers.py +47 -0
  23. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/history.py +22 -7
  24. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/model_metadata.py +5 -4
  25. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/session_persist.py +6 -2
  26. {python_codex-0.6.3 → python_codex-0.7.1}/pyproject.toml +7 -4
  27. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/app.py +4 -0
  28. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/gemini_api.py +26 -7
  29. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/transport.py +12 -5
  30. python_codex-0.6.3/pycodex/agent.py +0 -653
  31. python_codex-0.6.3/pycodex/utils/compactor.py +0 -181
  32. {python_codex-0.6.3 → python_codex-0.7.1}/.gitignore +0 -0
  33. {python_codex-0.6.3 → python_codex-0.7.1}/LICENSE +0 -0
  34. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/__init__.py +0 -0
  35. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/__main__.py +0 -0
  36. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/bootstrap.py +0 -0
  37. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/cli.py +0 -0
  38. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/portable/__init__.py +0 -0
  39. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/portable/client.py +0 -0
  40. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/portable/protocol.py +0 -0
  41. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/portable/server.py +0 -0
  42. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/default_base_instructions.md +0 -0
  43. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/developer_messages.json +0 -0
  44. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/goals/budget_limit.md +0 -0
  45. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/goals/continuation.md +0 -0
  46. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/permissions/approval_policy/never.md +0 -0
  47. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/permissions/approval_policy/on_failure.md +0 -0
  48. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/permissions/approval_policy/on_request.md +0 -0
  49. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/permissions/approval_policy/on_request_rule_request_permission.md +0 -0
  50. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/permissions/approval_policy/unless_trusted.md +0 -0
  51. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/permissions/sandbox_mode/danger_full_access.md +0 -0
  52. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/permissions/sandbox_mode/read_only.md +0 -0
  53. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/prompts/permissions/sandbox_mode/workspace_write.md +0 -0
  54. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/agent_tool_schemas.py +0 -0
  55. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/apply_patch_tool.py +0 -0
  56. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/base_tool.py +0 -0
  57. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/clock_tool.py +0 -0
  58. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/code_mode_manager.py +0 -0
  59. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/exec_tool.py +0 -0
  60. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/followup_task_tool.py +0 -0
  61. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/goal_tool.py +0 -0
  62. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/grep_files_tool.py +0 -0
  63. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/interrupt_agent_tool.py +0 -0
  64. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/list_agents_tool.py +0 -0
  65. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/list_dir_tool.py +0 -0
  66. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/python_tool_schema.py +0 -0
  67. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/read_file_tool.py +0 -0
  68. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/request_permissions_tool.py +0 -0
  69. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/send_message_tool.py +0 -0
  70. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/shell_command_tool.py +0 -0
  71. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/shell_tool.py +0 -0
  72. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/spawn_agent_tool.py +0 -0
  73. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/update_plan_tool.py +0 -0
  74. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/view_image_tool.py +0 -0
  75. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/wait_agent_tool.py +0 -0
  76. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/wait_tool.py +0 -0
  77. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/web_search_tool.py +0 -0
  78. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/tools/write_stdin_tool.py +0 -0
  79. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/__init__.py +0 -0
  80. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/_aes_gcm/LICENSE +0 -0
  81. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/_aes_gcm/README.md +0 -0
  82. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/_aes_gcm/__init__.py +0 -0
  83. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/_aes_gcm/aes.py +0 -0
  84. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/_aes_gcm/gcm.py +0 -0
  85. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/_aes_gcm/source-sha256.json +0 -0
  86. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/async_bridge.py +0 -0
  87. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/codex_config.py +0 -0
  88. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/crypto.py +0 -0
  89. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/debug.py +0 -0
  90. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/doctor.py +0 -0
  91. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/dotenv.py +0 -0
  92. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/get_env.py +0 -0
  93. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/http_headers.py +0 -0
  94. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/image_utils.py +0 -0
  95. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/random_ids.py +0 -0
  96. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/skill_catalog.py +0 -0
  97. {python_codex-0.6.3 → python_codex-0.7.1}/pycodex/utils/truncation.py +0 -0
  98. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/__init__.py +0 -0
  99. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/__main__.py +0 -0
  100. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/config.py +0 -0
  101. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/messages_api.py +0 -0
  102. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/payload_processors.py +0 -0
  103. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/request_translation.py +0 -0
  104. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/server.py +0 -0
  105. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/session_store.py +0 -0
  106. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/stream_events.py +0 -0
  107. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/stream_router.py +0 -0
  108. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/tools/__init__.py +0 -0
  109. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/tools/custom_adapter.py +0 -0
  110. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/tools/web_search.py +0 -0
  111. {python_codex-0.6.3 → python_codex-0.7.1}/responses_server/trajectory_dump.py +0 -0
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-codex
3
- Version: 0.6.3
3
+ Version: 0.7.1
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
7
+ Requires-Dist: aiocontextvars>=0.2.2; python_version < '3.7'
7
8
  Requires-Dist: dataclasses>=0.8; python_version < '3.7'
8
9
  Requires-Dist: importlib-metadata>=4.8.3; python_version < '3.8'
9
10
  Requires-Dist: loguru>=0.7.3
@@ -20,7 +21,7 @@ Description-Content-Type: text/markdown
20
21
 
21
22
  # pycodex
22
23
 
23
- [中文](README_ZH.md)
24
+ [中文](README_ZH.md) · [0.7.0 release notes](https://github.com/Randomizez/pycodex/blob/v0.7.0/docs/RELEASE_0.7.0.md)
24
25
 
25
26
  pycodex is a Python implementation of the [Codex](https://github.com/openai/codex)
26
27
  coding agent. Use it in a terminal, in a browser, or from your own Python code.
@@ -32,7 +33,8 @@ See [upstream alignment](docs/ALIGNMENT.md) for the supported scope and differen
32
33
  | Package | Includes | Python |
33
34
  | --- | --- | --- |
34
35
  | `python-codex` | CLI and Python API | 3.6.2+ |
35
- | `pycodex-ws` | Core plus browser workspace and optional Feishu integration | 3.7+ |
36
+ | `pyagy` | Core plus Antigravity CLI (`agy`) wire-compatible harness | 3.7+ |
37
+ | `pycodex-ws` | Core, `pyagy`, browser workspace and optional Feishu integration | 3.7+ |
36
38
 
37
39
  For the CLI and Python API:
38
40
 
@@ -40,7 +42,7 @@ For the CLI and Python API:
40
42
  python3 -m pip install --upgrade python-codex
41
43
  ```
42
44
 
43
- For the browser workspace, install `pycodex-ws`; it includes the matching core version:
45
+ For the browser workspace, install `pycodex-ws`; it includes matching `python-codex` and `pyagy` versions:
44
46
 
45
47
  ```bash
46
48
  python3 -m pip install --upgrade pycodex-ws
@@ -82,10 +84,15 @@ Use `--profile NAME` to select `NAME.config.toml` beside the base config or an
82
84
  embedded `[profiles.NAME]` table. Use `--config PATH` for a different config file,
83
85
  and `pycodex doctor` to check configuration and connectivity.
84
86
  The browser workspace picks up profile changes for new sessions without a restart.
87
+ With `harness = "pyagy"`, Web and Feishu preview the current reasoning text or
88
+ summary until assistant text streams in and takes its place. The browser limits
89
+ the Markdown preview to four lines, lets you scroll longer text, and expands
90
+ the same block for the final reply. Native pycodex exposes reasoning through
91
+ its own event and uses assistant text for the preview.
85
92
 
86
93
  See [configuration](docs/CONTEXT.md#配置读取与-profile) and the
87
94
  [Gemini setup example](docs/responses_server/README.md#gemini-api).
88
- Gemini 4 Argon includes a prompt adapted from Antigravity.
95
+ Gemini 4 Argon and Carbon include prompts adapted from Antigravity's coding guidance.
89
96
  Gemini tool arguments stream as they are generated; tools run after the complete call is received.
90
97
  Gemini tool results use `response.output`; returned images stay in the matching
91
98
  `functionResponse.parts`.
@@ -114,9 +121,19 @@ The agent can edit files and run commands with your user account's permissions.
114
121
  | `/cd <directory>` | Change directory while idle |
115
122
  | `/title`, `/history` | Manage the title and inspect conversation history |
116
123
  | `/resume` | List or resume saved sessions |
124
+ | `/retry` | Retry the last failed model request |
117
125
  | `/compact` | Summarize history to free context |
118
126
  | `/queue <message>` | Submit a task after the current one finishes |
119
127
 
128
+ Use `/retry 429|502` to retry either error code indefinitely, or `/retry *` to
129
+ retry every model request error, including disconnects. `/retry off` disables infinite retries.
130
+
131
+ Manual and automatic compaction preserve the tool declarations, instruction
132
+ prefix and ordinary tool choice. The Agent can use its live tools while
133
+ preparing the summary in memory. Success writes one summary checkpoint.
134
+ On failure, completed tool exchanges are saved so the Agent can use their
135
+ results on retry.
136
+
120
137
  Send a message while the agent is working to redirect it, or use `/queue` to
121
138
  wait. Sessions are saved under `~/.codex/sessions` by default.
122
139
  Ctrl+C or Ctrl+D closes the session after issued operations finish.
@@ -149,20 +166,25 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
149
166
  Open `http://127.0.0.1:6007`. The workspace uses the same model configuration as
150
167
  the CLI and provides conversations, a live HTML Canvas, and file/diff viewers.
151
168
  Chat updates arrive through two-second polling; completed replies render as Markdown.
169
+ When opening or switching conversations, a loading indicator above the input
170
+ stays visible until the latest session snapshot arrives, including when cached
171
+ messages are shown immediately.
172
+ Click the × beside a session and confirm to remove it from the workspace.
173
+ Each entry shows the time since the session's last activity.
152
174
  Click file links to inspect code, then select text and use **Insert into chat**
153
175
  to include it in your next message.
176
+ Local HTML links such as `report.html#results` open the preview at the named section.
154
177
  Each input displays its author and creation time, including separate messages
155
178
  in a steer batch. Recorded messages keep that metadata when the session resumes.
156
179
  Restoring a tab reads the rollout tail needed for its latest 80 display rows;
157
180
  Agent resume still restores the complete active context after the last checkpoint.
158
181
 
159
- The settings menu provides interface customization, password-protected
160
- workspace sharing, and [One-line Agent](packages/pycodex-ws/README.md#one-line-agent):
161
- an Agent that runs directly in most shells without installation, for bootstrapping
162
- an Agent environment or simple debugging. See the [workspace guide](packages/pycodex-ws/README.md) for
163
- session controls, storage and Feishu setup. A separate
164
- [VS Code extension](packages/pycodex-ws/extensions/vscode/README.md) connects to
165
- the same backend, including over Remote SSH.
182
+ **Settings → Customize Agent** opens the optional feature catalog. Browse the
183
+ descriptions and send a feature name, ID or custom request in chat to start the Agent.
184
+ Settings also provides password-protected sharing
185
+ and [External Call](packages/pycodex-ws/README.md#external-call)
186
+ sessions that connect an external client to a Web conversation. See the [workspace guide](packages/pycodex-ws/README.md) for
187
+ session controls, storage and Feishu setup.
166
188
 
167
189
  ## Use the Python API
168
190
 
@@ -195,7 +217,12 @@ run_async(main())
195
217
  ```
196
218
 
197
219
  `AgentsManager` creates the runtime; `submit_input` submits work.
198
- Await `receipt.future` for the result. The example closes the runtime and any
220
+ Await `receipt.future` for the result. Models and tools import `EventScope` from
221
+ `pycodex.events` and call `EventScope.emit(event)` to notify the session’s observers.
222
+ Each observer receives its own copy. During a turn the event loop reports
223
+ observer errors and the Agent continues.
224
+ Custom model clients return token counts in `ModelResponse.usage` for goal accounting
225
+ and automatic compaction. The example closes the runtime and any
199
226
  local compatibility server when finished. See [runtime contracts](docs/RUNTIME.md#ownership) for
200
227
  custom models, tools and integrations.
201
228
 
@@ -1,6 +1,6 @@
1
1
  # pycodex
2
2
 
3
- [中文](README_ZH.md)
3
+ [中文](README_ZH.md) · [0.7.0 release notes](https://github.com/Randomizez/pycodex/blob/v0.7.0/docs/RELEASE_0.7.0.md)
4
4
 
5
5
  pycodex is a Python implementation of the [Codex](https://github.com/openai/codex)
6
6
  coding agent. Use it in a terminal, in a browser, or from your own Python code.
@@ -12,7 +12,8 @@ See [upstream alignment](docs/ALIGNMENT.md) for the supported scope and differen
12
12
  | Package | Includes | Python |
13
13
  | --- | --- | --- |
14
14
  | `python-codex` | CLI and Python API | 3.6.2+ |
15
- | `pycodex-ws` | Core plus browser workspace and optional Feishu integration | 3.7+ |
15
+ | `pyagy` | Core plus Antigravity CLI (`agy`) wire-compatible harness | 3.7+ |
16
+ | `pycodex-ws` | Core, `pyagy`, browser workspace and optional Feishu integration | 3.7+ |
16
17
 
17
18
  For the CLI and Python API:
18
19
 
@@ -20,7 +21,7 @@ For the CLI and Python API:
20
21
  python3 -m pip install --upgrade python-codex
21
22
  ```
22
23
 
23
- For the browser workspace, install `pycodex-ws`; it includes the matching core version:
24
+ For the browser workspace, install `pycodex-ws`; it includes matching `python-codex` and `pyagy` versions:
24
25
 
25
26
  ```bash
26
27
  python3 -m pip install --upgrade pycodex-ws
@@ -62,10 +63,15 @@ Use `--profile NAME` to select `NAME.config.toml` beside the base config or an
62
63
  embedded `[profiles.NAME]` table. Use `--config PATH` for a different config file,
63
64
  and `pycodex doctor` to check configuration and connectivity.
64
65
  The browser workspace picks up profile changes for new sessions without a restart.
66
+ With `harness = "pyagy"`, Web and Feishu preview the current reasoning text or
67
+ summary until assistant text streams in and takes its place. The browser limits
68
+ the Markdown preview to four lines, lets you scroll longer text, and expands
69
+ the same block for the final reply. Native pycodex exposes reasoning through
70
+ its own event and uses assistant text for the preview.
65
71
 
66
72
  See [configuration](docs/CONTEXT.md#配置读取与-profile) and the
67
73
  [Gemini setup example](docs/responses_server/README.md#gemini-api).
68
- Gemini 4 Argon includes a prompt adapted from Antigravity.
74
+ Gemini 4 Argon and Carbon include prompts adapted from Antigravity's coding guidance.
69
75
  Gemini tool arguments stream as they are generated; tools run after the complete call is received.
70
76
  Gemini tool results use `response.output`; returned images stay in the matching
71
77
  `functionResponse.parts`.
@@ -94,9 +100,19 @@ The agent can edit files and run commands with your user account's permissions.
94
100
  | `/cd <directory>` | Change directory while idle |
95
101
  | `/title`, `/history` | Manage the title and inspect conversation history |
96
102
  | `/resume` | List or resume saved sessions |
103
+ | `/retry` | Retry the last failed model request |
97
104
  | `/compact` | Summarize history to free context |
98
105
  | `/queue <message>` | Submit a task after the current one finishes |
99
106
 
107
+ Use `/retry 429|502` to retry either error code indefinitely, or `/retry *` to
108
+ retry every model request error, including disconnects. `/retry off` disables infinite retries.
109
+
110
+ Manual and automatic compaction preserve the tool declarations, instruction
111
+ prefix and ordinary tool choice. The Agent can use its live tools while
112
+ preparing the summary in memory. Success writes one summary checkpoint.
113
+ On failure, completed tool exchanges are saved so the Agent can use their
114
+ results on retry.
115
+
100
116
  Send a message while the agent is working to redirect it, or use `/queue` to
101
117
  wait. Sessions are saved under `~/.codex/sessions` by default.
102
118
  Ctrl+C or Ctrl+D closes the session after issued operations finish.
@@ -129,20 +145,25 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
129
145
  Open `http://127.0.0.1:6007`. The workspace uses the same model configuration as
130
146
  the CLI and provides conversations, a live HTML Canvas, and file/diff viewers.
131
147
  Chat updates arrive through two-second polling; completed replies render as Markdown.
148
+ When opening or switching conversations, a loading indicator above the input
149
+ stays visible until the latest session snapshot arrives, including when cached
150
+ messages are shown immediately.
151
+ Click the × beside a session and confirm to remove it from the workspace.
152
+ Each entry shows the time since the session's last activity.
132
153
  Click file links to inspect code, then select text and use **Insert into chat**
133
154
  to include it in your next message.
155
+ Local HTML links such as `report.html#results` open the preview at the named section.
134
156
  Each input displays its author and creation time, including separate messages
135
157
  in a steer batch. Recorded messages keep that metadata when the session resumes.
136
158
  Restoring a tab reads the rollout tail needed for its latest 80 display rows;
137
159
  Agent resume still restores the complete active context after the last checkpoint.
138
160
 
139
- The settings menu provides interface customization, password-protected
140
- workspace sharing, and [One-line Agent](packages/pycodex-ws/README.md#one-line-agent):
141
- an Agent that runs directly in most shells without installation, for bootstrapping
142
- an Agent environment or simple debugging. See the [workspace guide](packages/pycodex-ws/README.md) for
143
- session controls, storage and Feishu setup. A separate
144
- [VS Code extension](packages/pycodex-ws/extensions/vscode/README.md) connects to
145
- the same backend, including over Remote SSH.
161
+ **Settings → Customize Agent** opens the optional feature catalog. Browse the
162
+ descriptions and send a feature name, ID or custom request in chat to start the Agent.
163
+ Settings also provides password-protected sharing
164
+ and [External Call](packages/pycodex-ws/README.md#external-call)
165
+ sessions that connect an external client to a Web conversation. See the [workspace guide](packages/pycodex-ws/README.md) for
166
+ session controls, storage and Feishu setup.
146
167
 
147
168
  ## Use the Python API
148
169
 
@@ -175,7 +196,12 @@ run_async(main())
175
196
  ```
176
197
 
177
198
  `AgentsManager` creates the runtime; `submit_input` submits work.
178
- Await `receipt.future` for the result. The example closes the runtime and any
199
+ Await `receipt.future` for the result. Models and tools import `EventScope` from
200
+ `pycodex.events` and call `EventScope.emit(event)` to notify the session’s observers.
201
+ Each observer receives its own copy. During a turn the event loop reports
202
+ observer errors and the Agent continues.
203
+ Custom model clients return token counts in `ModelResponse.usage` for goal accounting
204
+ and automatic compaction. The example closes the runtime and any
179
205
  local compatibility server when finished. See [runtime contracts](docs/RUNTIME.md#ownership) for
180
206
  custom models, tools and integrations.
181
207
 
@@ -1,6 +1,6 @@
1
1
  # pycodex
2
2
 
3
- [English](README.md)
3
+ [English](README.md) · [0.7.0 发布说明(英文)](https://github.com/Randomizez/pycodex/blob/v0.7.0/docs/RELEASE_0.7.0.md)
4
4
 
5
5
  pycodex 用 Python 实现 [Codex](https://github.com/openai/codex) 编程 Agent,
6
6
  可在终端、浏览器或自己的 Python 程序中使用,支持文件编辑、命令执行、
@@ -11,7 +11,8 @@ pycodex 用 Python 实现 [Codex](https://github.com/openai/codex) 编程 Agent
11
11
  | 包 | 内容 | Python |
12
12
  | --- | --- | --- |
13
13
  | `python-codex` | CLI 和 Python API | 3.6.2+ |
14
- | `pycodex-ws` | Core、浏览器工作区和可选飞书集成 | 3.7+ |
14
+ | `pyagy` | Core 与 Antigravity CLI(`agy`)协议兼容 harness | 3.7+ |
15
+ | `pycodex-ws` | Core、`pyagy`、浏览器工作区和可选飞书集成 | 3.7+ |
15
16
 
16
17
  使用 CLI 或 Python API:
17
18
 
@@ -19,7 +20,7 @@ pycodex 用 Python 实现 [Codex](https://github.com/openai/codex) 编程 Agent
19
20
  python3 -m pip install --upgrade python-codex
20
21
  ```
21
22
 
22
- 使用浏览器工作区则安装 `pycodex-ws`,它会同时安装匹配版本的 core:
23
+ 使用浏览器工作区则安装 `pycodex-ws`,它会同时安装匹配版本的 `python-codex` 和 `pyagy`:
23
24
 
24
25
  ```bash
25
26
  python3 -m pip install --upgrade pycodex-ws
@@ -59,10 +60,14 @@ export OPENAI_API_KEY="your-api-key"
59
60
  用 `--profile NAME` 选择同目录的 `NAME.config.toml` 或内嵌的 `[profiles.NAME]`;
60
61
  用 `--config PATH` 指定其他配置文件。`pycodex doctor` 可检查配置和连接。
61
62
  浏览器工作区会为新会话动态读取 profile,修改配置后无需重启。
63
+ 使用 `harness = "pyagy"` 时,Web 和飞书用当前的完整思考文本或摘要作临时预览,
64
+ 收到下一段正文后显示累计的回复正文。浏览器在同一个 Markdown 块中显示预览和回复,
65
+ 长预览可在约四行高的区域内滚动,定稿后显示全文。
66
+ 原生 pycodex 通过独立事件传递推理,预览显示正文。
62
67
 
63
68
  详见[配置文档](docs/CONTEXT.md#配置读取与-profile)和
64
69
  [Gemini 配置示例](docs/responses_server/README.md#gemini-api)。
65
- Gemini 4 Argon 内置基于 Antigravity 适配的提示词。
70
+ Gemini 4 Argon 和 Carbon 内置基于 Antigravity 编码指导适配的提示词。
66
71
  Gemini 工具参数支持流式接收,完整调用收到后再执行工具。
67
72
 
68
73
  ## 使用 CLI
@@ -87,9 +92,17 @@ Agent 可以修改文件、执行命令,使用当前用户的系统权限。
87
92
  | `/cd <directory>` | 空闲时切换目录 |
88
93
  | `/title`、`/history` | 管理标题、查看历史 |
89
94
  | `/resume` | 列出或恢复已保存会话 |
95
+ | `/retry` | 重试上一次失败的模型请求 |
90
96
  | `/compact` | 压缩历史,释放上下文 |
91
97
  | `/queue <message>` | 等当前任务完成后再执行 |
92
98
 
99
+ `/retry 429|502` 对这两个错误码中的任意一个无限重试。`/retry *` 对所有模型请求错误
100
+ 无限重试,包括连接中断。用 `/retry off` 关闭无限重试。
101
+
102
+ 手动与自动压缩共用摘要流程,保留工具声明、指令前缀和普通采样的 tool choice。
103
+ Agent 可以在内存中调用当前会话的工具并生成摘要。成功时写入一条摘要 checkpoint,
104
+ 再替换活跃历史。压缩报错时保存已经执行的工具调用及结果,供重试使用。
105
+
93
106
  Agent 工作时可直接发送消息调整方向,或用 `/queue` 排队。
94
107
  会话默认保存在 `~/.codex/sessions`。
95
108
  Ctrl+C 或 Ctrl+D 会在已发出的操作完成后退出。完整选项见 `pycodex --help`。
@@ -120,13 +133,16 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
120
133
 
121
134
  访问 `http://127.0.0.1:6007`。工作区沿用 CLI 的模型配置,提供对话、
122
135
  实时 HTML Canvas 和文件/diff 查看器。聊天每两秒轮询更新,完整回复按 Markdown 渲染。
136
+ 打开或切换会话时,输入框上方显示加载提示,直到最新状态加载完成;
137
+ 即使缓存中的旧消息已立即显示,也能看到页面仍在更新。
138
+ 点击会话旁的 × 并确认后,才会将该会话从工作区移除。
139
+ 每个会话标题下方按分钟显示距离最后活动的时间(如 `1h 12m ago`),并自动更新。
123
140
  点击文件链接查看代码,选中文字后
124
141
  用 **Insert into chat** 加入下一条消息。
142
+ `report.html#results` 这样的本地 HTML 链接会在预览中直接定位到对应章节。
125
143
 
126
144
  设置菜单支持界面定制和带密码的工作区分享。会话操作、存储和飞书配置见
127
145
  [工作区指南](packages/pycodex-ws/README.md)。
128
- 独立安装的 [VS Code 扩展](packages/pycodex-ws/extensions/vscode/README.md)
129
- 可连接同一后端,也支持 Remote SSH。
130
146
 
131
147
  ## 使用 Python API
132
148
 
@@ -159,6 +175,10 @@ run_async(main())
159
175
  ```
160
176
 
161
177
  `AgentsManager` 创建 runtime,`submit_input` 提交任务,等待 `receipt.future` 获取结果。
178
+ 模型和工具从 `pycodex.events` 导入 `EventScope`,调用 `EventScope.emit(event)` 通知当前会话的订阅者。
179
+ 每个订阅者收到独立副本。订阅者在 turn 中抛出异常时,事件循环报告错误,Agent 继续执行。
180
+ 自定义模型客户端通过 `ModelResponse.usage` 返回用量,
181
+ 供 goal 记账和自动压缩使用。
162
182
  示例结束时会关闭 runtime 和本地兼容服务。
163
183
  自定义模型、工具与集成方式见[运行时文档](docs/RUNTIME.md#ownership)。
164
184