python-codex 0.6.2__tar.gz → 0.7.0__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.
- {python_codex-0.6.2 → python_codex-0.7.0}/PKG-INFO +34 -8
- {python_codex-0.6.2 → python_codex-0.7.0}/README.md +32 -7
- {python_codex-0.6.2 → python_codex-0.7.0}/README_ZH.md +21 -3
- python_codex-0.7.0/pycodex/agent.py +657 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/bootstrap.py +8 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/config.py +4 -2
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/context.py +32 -11
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/events.py +116 -7
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/model.py +214 -99
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/multi_agents.py +11 -40
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/models.json +351 -6
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/protocol.py +1 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/runtime.py +173 -127
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/__init__.py +1 -3
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/clock_manager.py +0 -7
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/exec_command_tool.py +16 -5
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/exec_runtime.py +5 -1
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/goal_manager.py +25 -32
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/runtime_services.py +21 -11
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/unified_exec_manager.py +15 -3
- python_codex-0.7.0/pycodex/utils/compactor.py +108 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/compat.py +6 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/event_helpers.py +9 -0
- python_codex-0.7.0/pycodex/utils/http_headers.py +25 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/model_metadata.py +5 -4
- {python_codex-0.6.2 → python_codex-0.7.0}/pyproject.toml +3 -2
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/app.py +6 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/config.py +4 -1
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/gemini_api.py +40 -13
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/messages_api.py +12 -6
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/payload_processors.py +1 -1
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/request_translation.py +55 -13
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/stream_router.py +9 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/transport.py +24 -11
- python_codex-0.6.2/pycodex/agent.py +0 -646
- python_codex-0.6.2/pycodex/utils/compactor.py +0 -178
- {python_codex-0.6.2 → python_codex-0.7.0}/.gitignore +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/LICENSE +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/__init__.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/__main__.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/cli.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/portable/__init__.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/portable/client.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/portable/protocol.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/portable/server.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/default_base_instructions.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/developer_messages.json +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/goals/budget_limit.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/goals/continuation.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/permissions/approval_policy/never.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/permissions/approval_policy/on_failure.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/permissions/approval_policy/on_request.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/permissions/approval_policy/on_request_rule_request_permission.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/permissions/approval_policy/unless_trusted.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/permissions/sandbox_mode/danger_full_access.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/permissions/sandbox_mode/read_only.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/prompts/permissions/sandbox_mode/workspace_write.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/agent_tool_schemas.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/apply_patch_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/base_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/clock_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/code_mode_manager.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/exec_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/followup_task_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/goal_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/grep_files_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/interrupt_agent_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/list_agents_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/list_dir_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/python_tool_schema.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/read_file_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/request_permissions_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/send_message_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/shell_command_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/shell_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/spawn_agent_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/update_plan_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/view_image_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/wait_agent_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/wait_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/web_search_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/tools/write_stdin_tool.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/__init__.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/_aes_gcm/LICENSE +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/_aes_gcm/README.md +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/_aes_gcm/__init__.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/_aes_gcm/aes.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/_aes_gcm/gcm.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/_aes_gcm/source-sha256.json +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/async_bridge.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/codex_config.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/crypto.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/debug.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/doctor.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/dotenv.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/get_env.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/history.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/image_utils.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/random_ids.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/session_persist.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/skill_catalog.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/pycodex/utils/truncation.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/__init__.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/__main__.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/server.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/session_store.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/stream_events.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/tools/__init__.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/tools/custom_adapter.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/responses_server/tools/web_search.py +0 -0
- {python_codex-0.6.2 → python_codex-0.7.0}/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.
|
|
3
|
+
Version: 0.7.0
|
|
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.
|
|
@@ -85,8 +86,10 @@ The browser workspace picks up profile changes for new sessions without a restar
|
|
|
85
86
|
|
|
86
87
|
See [configuration](docs/CONTEXT.md#配置读取与-profile) and the
|
|
87
88
|
[Gemini setup example](docs/responses_server/README.md#gemini-api).
|
|
88
|
-
Gemini 4 Argon
|
|
89
|
+
Gemini 4 Argon and Carbon include prompts adapted from Antigravity's coding guidance.
|
|
89
90
|
Gemini tool arguments stream as they are generated; tools run after the complete call is received.
|
|
91
|
+
Gemini tool results use `response.output`; returned images stay in the matching
|
|
92
|
+
`functionResponse.parts`.
|
|
90
93
|
Gemini continuation omits unsigned empty text parts while preserving thought signatures,
|
|
91
94
|
including when resuming recorded sessions.
|
|
92
95
|
|
|
@@ -112,9 +115,19 @@ The agent can edit files and run commands with your user account's permissions.
|
|
|
112
115
|
| `/cd <directory>` | Change directory while idle |
|
|
113
116
|
| `/title`, `/history` | Manage the title and inspect conversation history |
|
|
114
117
|
| `/resume` | List or resume saved sessions |
|
|
118
|
+
| `/retry` | Retry the last failed model request |
|
|
115
119
|
| `/compact` | Summarize history to free context |
|
|
116
120
|
| `/queue <message>` | Submit a task after the current one finishes |
|
|
117
121
|
|
|
122
|
+
Use `/retry 429|502` to retry either error code indefinitely, or `/retry *` to
|
|
123
|
+
retry every model request error, including disconnects. `/retry off` disables infinite retries.
|
|
124
|
+
|
|
125
|
+
Manual and automatic compaction preserve the tool declarations, instruction
|
|
126
|
+
prefix and ordinary tool choice. The Agent can use its live tools while
|
|
127
|
+
preparing the summary in memory. Success writes one summary checkpoint.
|
|
128
|
+
On failure, completed tool exchanges are saved so the Agent can use their
|
|
129
|
+
results on retry.
|
|
130
|
+
|
|
118
131
|
Send a message while the agent is working to redirect it, or use `/queue` to
|
|
119
132
|
wait. Sessions are saved under `~/.codex/sessions` by default.
|
|
120
133
|
Ctrl+C or Ctrl+D closes the session after issued operations finish.
|
|
@@ -146,17 +159,25 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
|
|
|
146
159
|
|
|
147
160
|
Open `http://127.0.0.1:6007`. The workspace uses the same model configuration as
|
|
148
161
|
the CLI and provides conversations, a live HTML Canvas, and file/diff viewers.
|
|
162
|
+
Chat updates arrive through two-second polling; completed replies render as Markdown.
|
|
163
|
+
When opening or switching conversations, a loading indicator above the input
|
|
164
|
+
stays visible until the latest session snapshot arrives, including when cached
|
|
165
|
+
messages are shown immediately.
|
|
166
|
+
Click the × beside a session and confirm to remove it from the workspace.
|
|
167
|
+
Each entry shows the time since the session's last activity.
|
|
149
168
|
Click file links to inspect code, then select text and use **Insert into chat**
|
|
150
169
|
to include it in your next message.
|
|
170
|
+
Local HTML links such as `report.html#results` open the preview at the named section.
|
|
151
171
|
Each input displays its author and creation time, including separate messages
|
|
152
172
|
in a steer batch. Recorded messages keep that metadata when the session resumes.
|
|
153
173
|
Restoring a tab reads the rollout tail needed for its latest 80 display rows;
|
|
154
174
|
Agent resume still restores the complete active context after the last checkpoint.
|
|
155
175
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
176
|
+
**Settings → Customize Agent** opens the optional feature catalog. Browse the
|
|
177
|
+
descriptions and send a feature name, ID or custom request in chat to start the Agent.
|
|
178
|
+
Settings also provides password-protected sharing
|
|
179
|
+
and [External Call](packages/pycodex-ws/README.md#external-call)
|
|
180
|
+
sessions that connect an external client to a Web conversation. See the [workspace guide](packages/pycodex-ws/README.md) for
|
|
160
181
|
session controls, storage and Feishu setup. A separate
|
|
161
182
|
[VS Code extension](packages/pycodex-ws/extensions/vscode/README.md) connects to
|
|
162
183
|
the same backend, including over Remote SSH.
|
|
@@ -192,7 +213,12 @@ run_async(main())
|
|
|
192
213
|
```
|
|
193
214
|
|
|
194
215
|
`AgentsManager` creates the runtime; `submit_input` submits work.
|
|
195
|
-
Await `receipt.future` for the result.
|
|
216
|
+
Await `receipt.future` for the result. Models and tools import `EventScope` from
|
|
217
|
+
`pycodex.events` and call `EventScope.emit(event)` to notify the session’s observers.
|
|
218
|
+
Each observer receives its own copy. During a turn the event loop reports
|
|
219
|
+
observer errors and the Agent continues.
|
|
220
|
+
Custom model clients return token counts in `ModelResponse.usage` for goal accounting
|
|
221
|
+
and automatic compaction. The example closes the runtime and any
|
|
196
222
|
local compatibility server when finished. See [runtime contracts](docs/RUNTIME.md#ownership) for
|
|
197
223
|
custom models, tools and integrations.
|
|
198
224
|
|
|
@@ -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.
|
|
@@ -65,8 +65,10 @@ The browser workspace picks up profile changes for new sessions without a restar
|
|
|
65
65
|
|
|
66
66
|
See [configuration](docs/CONTEXT.md#配置读取与-profile) and the
|
|
67
67
|
[Gemini setup example](docs/responses_server/README.md#gemini-api).
|
|
68
|
-
Gemini 4 Argon
|
|
68
|
+
Gemini 4 Argon and Carbon include prompts adapted from Antigravity's coding guidance.
|
|
69
69
|
Gemini tool arguments stream as they are generated; tools run after the complete call is received.
|
|
70
|
+
Gemini tool results use `response.output`; returned images stay in the matching
|
|
71
|
+
`functionResponse.parts`.
|
|
70
72
|
Gemini continuation omits unsigned empty text parts while preserving thought signatures,
|
|
71
73
|
including when resuming recorded sessions.
|
|
72
74
|
|
|
@@ -92,9 +94,19 @@ The agent can edit files and run commands with your user account's permissions.
|
|
|
92
94
|
| `/cd <directory>` | Change directory while idle |
|
|
93
95
|
| `/title`, `/history` | Manage the title and inspect conversation history |
|
|
94
96
|
| `/resume` | List or resume saved sessions |
|
|
97
|
+
| `/retry` | Retry the last failed model request |
|
|
95
98
|
| `/compact` | Summarize history to free context |
|
|
96
99
|
| `/queue <message>` | Submit a task after the current one finishes |
|
|
97
100
|
|
|
101
|
+
Use `/retry 429|502` to retry either error code indefinitely, or `/retry *` to
|
|
102
|
+
retry every model request error, including disconnects. `/retry off` disables infinite retries.
|
|
103
|
+
|
|
104
|
+
Manual and automatic compaction preserve the tool declarations, instruction
|
|
105
|
+
prefix and ordinary tool choice. The Agent can use its live tools while
|
|
106
|
+
preparing the summary in memory. Success writes one summary checkpoint.
|
|
107
|
+
On failure, completed tool exchanges are saved so the Agent can use their
|
|
108
|
+
results on retry.
|
|
109
|
+
|
|
98
110
|
Send a message while the agent is working to redirect it, or use `/queue` to
|
|
99
111
|
wait. Sessions are saved under `~/.codex/sessions` by default.
|
|
100
112
|
Ctrl+C or Ctrl+D closes the session after issued operations finish.
|
|
@@ -126,17 +138,25 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
|
|
|
126
138
|
|
|
127
139
|
Open `http://127.0.0.1:6007`. The workspace uses the same model configuration as
|
|
128
140
|
the CLI and provides conversations, a live HTML Canvas, and file/diff viewers.
|
|
141
|
+
Chat updates arrive through two-second polling; completed replies render as Markdown.
|
|
142
|
+
When opening or switching conversations, a loading indicator above the input
|
|
143
|
+
stays visible until the latest session snapshot arrives, including when cached
|
|
144
|
+
messages are shown immediately.
|
|
145
|
+
Click the × beside a session and confirm to remove it from the workspace.
|
|
146
|
+
Each entry shows the time since the session's last activity.
|
|
129
147
|
Click file links to inspect code, then select text and use **Insert into chat**
|
|
130
148
|
to include it in your next message.
|
|
149
|
+
Local HTML links such as `report.html#results` open the preview at the named section.
|
|
131
150
|
Each input displays its author and creation time, including separate messages
|
|
132
151
|
in a steer batch. Recorded messages keep that metadata when the session resumes.
|
|
133
152
|
Restoring a tab reads the rollout tail needed for its latest 80 display rows;
|
|
134
153
|
Agent resume still restores the complete active context after the last checkpoint.
|
|
135
154
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
**Settings → Customize Agent** opens the optional feature catalog. Browse the
|
|
156
|
+
descriptions and send a feature name, ID or custom request in chat to start the Agent.
|
|
157
|
+
Settings also provides password-protected sharing
|
|
158
|
+
and [External Call](packages/pycodex-ws/README.md#external-call)
|
|
159
|
+
sessions that connect an external client to a Web conversation. See the [workspace guide](packages/pycodex-ws/README.md) for
|
|
140
160
|
session controls, storage and Feishu setup. A separate
|
|
141
161
|
[VS Code extension](packages/pycodex-ws/extensions/vscode/README.md) connects to
|
|
142
162
|
the same backend, including over Remote SSH.
|
|
@@ -172,7 +192,12 @@ run_async(main())
|
|
|
172
192
|
```
|
|
173
193
|
|
|
174
194
|
`AgentsManager` creates the runtime; `submit_input` submits work.
|
|
175
|
-
Await `receipt.future` for the result.
|
|
195
|
+
Await `receipt.future` for the result. Models and tools import `EventScope` from
|
|
196
|
+
`pycodex.events` and call `EventScope.emit(event)` to notify the session’s observers.
|
|
197
|
+
Each observer receives its own copy. During a turn the event loop reports
|
|
198
|
+
observer errors and the Agent continues.
|
|
199
|
+
Custom model clients return token counts in `ModelResponse.usage` for goal accounting
|
|
200
|
+
and automatic compaction. The example closes the runtime and any
|
|
176
201
|
local compatibility server when finished. See [runtime contracts](docs/RUNTIME.md#ownership) for
|
|
177
202
|
custom models, tools and integrations.
|
|
178
203
|
|
|
@@ -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 程序中使用,支持文件编辑、命令执行、
|
|
@@ -62,7 +62,7 @@ export OPENAI_API_KEY="your-api-key"
|
|
|
62
62
|
|
|
63
63
|
详见[配置文档](docs/CONTEXT.md#配置读取与-profile)和
|
|
64
64
|
[Gemini 配置示例](docs/responses_server/README.md#gemini-api)。
|
|
65
|
-
Gemini 4 Argon 内置基于 Antigravity
|
|
65
|
+
Gemini 4 Argon 和 Carbon 内置基于 Antigravity 编码指导适配的提示词。
|
|
66
66
|
Gemini 工具参数支持流式接收,完整调用收到后再执行工具。
|
|
67
67
|
|
|
68
68
|
## 使用 CLI
|
|
@@ -87,9 +87,17 @@ Agent 可以修改文件、执行命令,使用当前用户的系统权限。
|
|
|
87
87
|
| `/cd <directory>` | 空闲时切换目录 |
|
|
88
88
|
| `/title`、`/history` | 管理标题、查看历史 |
|
|
89
89
|
| `/resume` | 列出或恢复已保存会话 |
|
|
90
|
+
| `/retry` | 重试上一次失败的模型请求 |
|
|
90
91
|
| `/compact` | 压缩历史,释放上下文 |
|
|
91
92
|
| `/queue <message>` | 等当前任务完成后再执行 |
|
|
92
93
|
|
|
94
|
+
`/retry 429|502` 对这两个错误码中的任意一个无限重试。`/retry *` 对所有模型请求错误
|
|
95
|
+
无限重试,包括连接中断。用 `/retry off` 关闭无限重试。
|
|
96
|
+
|
|
97
|
+
手动与自动压缩共用摘要流程,保留工具声明、指令前缀和普通采样的 tool choice。
|
|
98
|
+
Agent 可以在内存中调用当前会话的工具并生成摘要。成功时写入一条摘要 checkpoint,
|
|
99
|
+
再替换活跃历史。压缩报错时保存已经执行的工具调用及结果,供重试使用。
|
|
100
|
+
|
|
93
101
|
Agent 工作时可直接发送消息调整方向,或用 `/queue` 排队。
|
|
94
102
|
会话默认保存在 `~/.codex/sessions`。
|
|
95
103
|
Ctrl+C 或 Ctrl+D 会在已发出的操作完成后退出。完整选项见 `pycodex --help`。
|
|
@@ -119,8 +127,14 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
|
|
|
119
127
|
```
|
|
120
128
|
|
|
121
129
|
访问 `http://127.0.0.1:6007`。工作区沿用 CLI 的模型配置,提供对话、
|
|
122
|
-
实时 HTML Canvas 和文件/diff
|
|
130
|
+
实时 HTML Canvas 和文件/diff 查看器。聊天每两秒轮询更新,完整回复按 Markdown 渲染。
|
|
131
|
+
打开或切换会话时,输入框上方显示加载提示,直到最新状态加载完成;
|
|
132
|
+
即使缓存中的旧消息已立即显示,也能看到页面仍在更新。
|
|
133
|
+
点击会话旁的 × 并确认后,才会将该会话从工作区移除。
|
|
134
|
+
每个会话标题下方按分钟显示距离最后活动的时间(如 `1h 12m ago`),并自动更新。
|
|
135
|
+
点击文件链接查看代码,选中文字后
|
|
123
136
|
用 **Insert into chat** 加入下一条消息。
|
|
137
|
+
`report.html#results` 这样的本地 HTML 链接会在预览中直接定位到对应章节。
|
|
124
138
|
|
|
125
139
|
设置菜单支持界面定制和带密码的工作区分享。会话操作、存储和飞书配置见
|
|
126
140
|
[工作区指南](packages/pycodex-ws/README.md)。
|
|
@@ -158,6 +172,10 @@ run_async(main())
|
|
|
158
172
|
```
|
|
159
173
|
|
|
160
174
|
`AgentsManager` 创建 runtime,`submit_input` 提交任务,等待 `receipt.future` 获取结果。
|
|
175
|
+
模型和工具从 `pycodex.events` 导入 `EventScope`,调用 `EventScope.emit(event)` 通知当前会话的订阅者。
|
|
176
|
+
每个订阅者收到独立副本。订阅者在 turn 中抛出异常时,事件循环报告错误,Agent 继续执行。
|
|
177
|
+
自定义模型客户端通过 `ModelResponse.usage` 返回用量,
|
|
178
|
+
供 goal 记账和自动压缩使用。
|
|
161
179
|
示例结束时会关闭 runtime 和本地兼容服务。
|
|
162
180
|
自定义模型、工具与集成方式见[运行时文档](docs/RUNTIME.md#ownership)。
|
|
163
181
|
|