python-codex 0.5.0__tar.gz → 0.5.2__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.5.0 → python_codex-0.5.2}/PKG-INFO +72 -3
  2. {python_codex-0.5.0 → python_codex-0.5.2}/README.md +71 -2
  3. {python_codex-0.5.0 → python_codex-0.5.2}/README_ZH.md +18 -3
  4. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/agent.py +2 -1
  5. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/events.py +32 -1
  6. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/model.py +187 -21
  7. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/runtime.py +146 -19
  8. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/base_tool.py +6 -0
  9. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/clock_tool.py +44 -2
  10. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/exec_command_tool.py +6 -0
  11. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/runtime_services.py +44 -0
  12. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/unified_exec_manager.py +27 -0
  13. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/session_persist.py +31 -0
  14. {python_codex-0.5.0 → python_codex-0.5.2}/pyproject.toml +2 -2
  15. {python_codex-0.5.0 → python_codex-0.5.2}/.gitignore +0 -0
  16. {python_codex-0.5.0 → python_codex-0.5.2}/LICENSE +0 -0
  17. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/__init__.py +0 -0
  18. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/__main__.py +0 -0
  19. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/bootstrap.py +0 -0
  20. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/cli.py +0 -0
  21. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/context.py +0 -0
  22. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/portable/__init__.py +0 -0
  23. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/portable/client.py +0 -0
  24. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/portable/server.py +0 -0
  25. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/default_base_instructions.md +0 -0
  26. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/models.json +0 -0
  27. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/permissions/approval_policy/never.md +0 -0
  28. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/permissions/approval_policy/on_failure.md +0 -0
  29. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/permissions/approval_policy/on_request.md +0 -0
  30. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/permissions/approval_policy/on_request_rule_request_permission.md +0 -0
  31. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/permissions/approval_policy/unless_trusted.md +0 -0
  32. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/permissions/sandbox_mode/danger_full_access.md +0 -0
  33. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/permissions/sandbox_mode/read_only.md +0 -0
  34. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/prompts/permissions/sandbox_mode/workspace_write.md +0 -0
  35. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/protocol.py +0 -0
  36. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/__init__.py +0 -0
  37. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/agent_tool_schemas.py +0 -0
  38. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/apply_patch_tool.py +0 -0
  39. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/close_agent_tool.py +0 -0
  40. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/code_mode_manager.py +0 -0
  41. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/exec_runtime.js +0 -0
  42. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/exec_tool.py +0 -0
  43. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/grep_files_tool.py +0 -0
  44. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/list_dir_tool.py +0 -0
  45. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/read_file_tool.py +0 -0
  46. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/request_permissions_tool.py +0 -0
  47. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/request_user_input_tool.py +0 -0
  48. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/resume_agent_tool.py +0 -0
  49. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/send_input_tool.py +0 -0
  50. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/shell_command_tool.py +0 -0
  51. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/shell_tool.py +0 -0
  52. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/spawn_agent_tool.py +0 -0
  53. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/update_plan_tool.py +0 -0
  54. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/view_image_tool.py +0 -0
  55. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/wait_agent_tool.py +0 -0
  56. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/wait_tool.py +0 -0
  57. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/web_search_tool.py +0 -0
  58. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/tools/write_stdin_tool.py +0 -0
  59. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/__init__.py +0 -0
  60. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/_aes_gcm/LICENSE +0 -0
  61. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/_aes_gcm/README.md +0 -0
  62. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/_aes_gcm/__init__.py +0 -0
  63. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/_aes_gcm/aes.py +0 -0
  64. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/_aes_gcm/gcm.py +0 -0
  65. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/_aes_gcm/source-sha256.json +0 -0
  66. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/async_bridge.py +0 -0
  67. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/compactor.py +0 -0
  68. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/compat.py +0 -0
  69. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/crypto.py +0 -0
  70. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/debug.py +0 -0
  71. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/doctor.py +0 -0
  72. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/dotenv.py +0 -0
  73. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/event_helpers.py +0 -0
  74. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/get_env.py +0 -0
  75. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/image_utils.py +0 -0
  76. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/model_metadata.py +0 -0
  77. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/random_ids.py +0 -0
  78. {python_codex-0.5.0 → python_codex-0.5.2}/pycodex/utils/truncation.py +0 -0
  79. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/__init__.py +0 -0
  80. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/__main__.py +0 -0
  81. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/app.py +0 -0
  82. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/config.py +0 -0
  83. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/messages_api.py +0 -0
  84. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/payload_processors.py +0 -0
  85. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/server.py +0 -0
  86. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/session_store.py +0 -0
  87. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/stream_router.py +0 -0
  88. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/tools/__init__.py +0 -0
  89. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/tools/custom_adapter.py +0 -0
  90. {python_codex-0.5.0 → python_codex-0.5.2}/responses_server/tools/web_search.py +0 -0
  91. {python_codex-0.5.0 → python_codex-0.5.2}/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.5.0
3
+ Version: 0.5.2
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
@@ -102,6 +102,11 @@ pycodex --json "Reply with exactly OK."
102
102
  | `/queue <message>` | Wait for the active turn to finish before submitting |
103
103
 
104
104
  Ordinary input during a turn steers at the next safe sampling boundary.
105
+ Slash input uses Codex's command rules: `/data/project` and `/tmp/` are
106
+ ordinary messages, while an unknown single-component name such as `/modle`
107
+ or `/tmp` reports a command error. Start the input with a space to send any
108
+ slash-prefixed text literally, including known commands such as ` /model`.
109
+ These rules also apply to the browser workspace and Feishu.
105
110
  Sessions are saved under `CODEX_HOME/sessions`. Set
106
111
  `model_auto_compact_token_limit` in the configuration to compact automatically.
107
112
 
@@ -127,9 +132,34 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
127
132
  Open `http://127.0.0.1:6007`. The workspace combines conversations with a live
128
133
  HTML Canvas and read-only file/diff viewers. Click file links in replies to open
129
134
  them, and use **Insert into chat** to add selected code to an editable draft.
135
+ Local PDF links open in the browser's built-in reader, with **Open in new tab**
136
+ and **Download** links. PDF files are streamed separately from text snapshots.
130
137
  Keep the server's stdin open: EOF initiates shutdown.
131
- The gear button starts an Agent conversation for customizing the interface
132
- through files in `~/.pycodex/frontend/`.
138
+ **New session** directly creates a session using the launch `--profile`, or the
139
+ base config when unset. The **+** button on its right (**Custom profile**) lets
140
+ you choose a named profile from the server's Codex config; **Default** uses the
141
+ launch setting. Each session saves its profile name and uses it again on restart; existing sessions
142
+ keep their configuration. Restart the server after adding or removing profiles.
143
+ While the selected Agent is working, the empty composer cycles through usage
144
+ hints about commands, frontend customization, workspace sharing, session collaboration and optional
145
+ features about every six seconds, starting at a random hint. Edit the short
146
+ strings in the `hints` list in `workspace.html`'s `updatePromptPlaceholder` to change the tips.
147
+ The gear button opens **Customize Agent** and **Share**, with a short description of each.
148
+ Customize Agent starts an Agent conversation for editing files in
149
+ `~/.pycodex/frontend/`. Its setup context includes an API quick
150
+ reference and the path to the full API documentation shipped with the package.
151
+ Browse the [feature catalog](packages/pycodex-ws/workspace_server/optional_features/README.md)
152
+ in the view area and tell the Agent which features to adapt. You can also ask it
153
+ to publish a local customization as a GitHub feature PR using the
154
+ [contribution format](packages/pycodex-ws/workspace_server/optional_features/CONTRIBUTING.md).
155
+ The [custom frontend API](docs/WORKSPACE_API.md) provides structured state,
156
+ command results, history pagination, event replay and Agent/background-task
157
+ inventories. Optional `custom.js` extensions can export `mount(host)` to use
158
+ the built-in page's session, draft and viewer controls.
159
+ With a workspace server administrator password configured, **Share** sets a
160
+ separate password for this workspace using the existing login page. Sharing
161
+ passwords and visitor logins live only in memory; changing the password, stopping
162
+ sharing or restarting the process invalidates them. Router login is unchanged.
133
163
 
134
164
  See the [workspace guide](packages/pycodex-ws/README.md) for session controls,
135
165
  storage and Feishu setup. The separately distributed
@@ -185,9 +215,48 @@ uv run --dev pytest
185
215
  ```
186
216
 
187
217
  - [Test environments and coverage](tests/TESTS.md)
218
+ - [Repository development rules and reading guide](AGENTS.md)
188
219
  - [Architecture, package layout and runtime contracts](docs/RUNTIME.md)
189
220
  - [Prompts, configuration and context](docs/CONTEXT.md)
190
221
  - [Upstream alignment](docs/ALIGNMENT.md)
191
222
  - [Responses compatibility server](docs/responses_server/README.md)
223
+ - [Portable configuration contracts](docs/PORTABLE.md)
192
224
 
193
225
  Release notes and implementation details live in `docs/`.
226
+
227
+ ## Markdown view modes
228
+
229
+ Markdown file views include a Show source / Show preview button. Switching
230
+ modes preserves each mode's reading position without replaying a previous line
231
+ target.
232
+
233
+ ## Responses reliability
234
+
235
+ Providers can opt into ordered failover with `fallback_models = ["backup-one",
236
+ "backup-two"]` in their `[model_providers.<name>]` table. Each target uses the
237
+ same endpoint, credentials, history and tools; request settings are rebuilt for
238
+ that model, while the session's selected model stays unchanged. Transient errors
239
+ exhaust `stream_max_retries` before advancing. Unavailable-model errors and
240
+ first-data timeouts advance immediately. Existing retry notices name both models
241
+ and include the underlying error.
242
+
243
+ Failed models cool down for 900 seconds within that client. Subsequent requests
244
+ skip them, retry them after expiry, and restart the full chain when every target
245
+ is cooling. `fallback_cooldown_seconds = 0` disables cooldown; explicit model
246
+ selection clears it. New sessions and subagents have independent cooldowns.
247
+ An absent or empty list disables failover. Invalid input, context-length and
248
+ terminal incomplete errors retain their existing handling. Backups must support
249
+ the active tools and context size; compaction keeps the selected model's policy.
250
+
251
+ Responses HTTP 408/429 and server errors use the provider retry budget.
252
+ Rate-limit messages containing `try again in` or `retry after` supply the retry
253
+ delay. CLI and workspace retry notices include the underlying error details;
254
+ workspace notices survive browser refresh and active-turn reattachment, and
255
+ remain separate from the assistant reply. They are not persisted in rollouts.
256
+
257
+ ## Workspace input history
258
+
259
+ The workspace message box supports Up/Down input history. Up recalls earlier
260
+ human inputs in the current conversation; Down returns to the unsent draft.
261
+ Automatic wake-up messages are excluded, and arrows retain normal cursor
262
+ movement inside multiline drafts.
@@ -82,6 +82,11 @@ pycodex --json "Reply with exactly OK."
82
82
  | `/queue <message>` | Wait for the active turn to finish before submitting |
83
83
 
84
84
  Ordinary input during a turn steers at the next safe sampling boundary.
85
+ Slash input uses Codex's command rules: `/data/project` and `/tmp/` are
86
+ ordinary messages, while an unknown single-component name such as `/modle`
87
+ or `/tmp` reports a command error. Start the input with a space to send any
88
+ slash-prefixed text literally, including known commands such as ` /model`.
89
+ These rules also apply to the browser workspace and Feishu.
85
90
  Sessions are saved under `CODEX_HOME/sessions`. Set
86
91
  `model_auto_compact_token_limit` in the configuration to compact automatically.
87
92
 
@@ -107,9 +112,34 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
107
112
  Open `http://127.0.0.1:6007`. The workspace combines conversations with a live
108
113
  HTML Canvas and read-only file/diff viewers. Click file links in replies to open
109
114
  them, and use **Insert into chat** to add selected code to an editable draft.
115
+ Local PDF links open in the browser's built-in reader, with **Open in new tab**
116
+ and **Download** links. PDF files are streamed separately from text snapshots.
110
117
  Keep the server's stdin open: EOF initiates shutdown.
111
- The gear button starts an Agent conversation for customizing the interface
112
- through files in `~/.pycodex/frontend/`.
118
+ **New session** directly creates a session using the launch `--profile`, or the
119
+ base config when unset. The **+** button on its right (**Custom profile**) lets
120
+ you choose a named profile from the server's Codex config; **Default** uses the
121
+ launch setting. Each session saves its profile name and uses it again on restart; existing sessions
122
+ keep their configuration. Restart the server after adding or removing profiles.
123
+ While the selected Agent is working, the empty composer cycles through usage
124
+ hints about commands, frontend customization, workspace sharing, session collaboration and optional
125
+ features about every six seconds, starting at a random hint. Edit the short
126
+ strings in the `hints` list in `workspace.html`'s `updatePromptPlaceholder` to change the tips.
127
+ The gear button opens **Customize Agent** and **Share**, with a short description of each.
128
+ Customize Agent starts an Agent conversation for editing files in
129
+ `~/.pycodex/frontend/`. Its setup context includes an API quick
130
+ reference and the path to the full API documentation shipped with the package.
131
+ Browse the [feature catalog](packages/pycodex-ws/workspace_server/optional_features/README.md)
132
+ in the view area and tell the Agent which features to adapt. You can also ask it
133
+ to publish a local customization as a GitHub feature PR using the
134
+ [contribution format](packages/pycodex-ws/workspace_server/optional_features/CONTRIBUTING.md).
135
+ The [custom frontend API](docs/WORKSPACE_API.md) provides structured state,
136
+ command results, history pagination, event replay and Agent/background-task
137
+ inventories. Optional `custom.js` extensions can export `mount(host)` to use
138
+ the built-in page's session, draft and viewer controls.
139
+ With a workspace server administrator password configured, **Share** sets a
140
+ separate password for this workspace using the existing login page. Sharing
141
+ passwords and visitor logins live only in memory; changing the password, stopping
142
+ sharing or restarting the process invalidates them. Router login is unchanged.
113
143
 
114
144
  See the [workspace guide](packages/pycodex-ws/README.md) for session controls,
115
145
  storage and Feishu setup. The separately distributed
@@ -165,9 +195,48 @@ uv run --dev pytest
165
195
  ```
166
196
 
167
197
  - [Test environments and coverage](tests/TESTS.md)
198
+ - [Repository development rules and reading guide](AGENTS.md)
168
199
  - [Architecture, package layout and runtime contracts](docs/RUNTIME.md)
169
200
  - [Prompts, configuration and context](docs/CONTEXT.md)
170
201
  - [Upstream alignment](docs/ALIGNMENT.md)
171
202
  - [Responses compatibility server](docs/responses_server/README.md)
203
+ - [Portable configuration contracts](docs/PORTABLE.md)
172
204
 
173
205
  Release notes and implementation details live in `docs/`.
206
+
207
+ ## Markdown view modes
208
+
209
+ Markdown file views include a Show source / Show preview button. Switching
210
+ modes preserves each mode's reading position without replaying a previous line
211
+ target.
212
+
213
+ ## Responses reliability
214
+
215
+ Providers can opt into ordered failover with `fallback_models = ["backup-one",
216
+ "backup-two"]` in their `[model_providers.<name>]` table. Each target uses the
217
+ same endpoint, credentials, history and tools; request settings are rebuilt for
218
+ that model, while the session's selected model stays unchanged. Transient errors
219
+ exhaust `stream_max_retries` before advancing. Unavailable-model errors and
220
+ first-data timeouts advance immediately. Existing retry notices name both models
221
+ and include the underlying error.
222
+
223
+ Failed models cool down for 900 seconds within that client. Subsequent requests
224
+ skip them, retry them after expiry, and restart the full chain when every target
225
+ is cooling. `fallback_cooldown_seconds = 0` disables cooldown; explicit model
226
+ selection clears it. New sessions and subagents have independent cooldowns.
227
+ An absent or empty list disables failover. Invalid input, context-length and
228
+ terminal incomplete errors retain their existing handling. Backups must support
229
+ the active tools and context size; compaction keeps the selected model's policy.
230
+
231
+ Responses HTTP 408/429 and server errors use the provider retry budget.
232
+ Rate-limit messages containing `try again in` or `retry after` supply the retry
233
+ delay. CLI and workspace retry notices include the underlying error details;
234
+ workspace notices survive browser refresh and active-turn reattachment, and
235
+ remain separate from the assistant reply. They are not persisted in rollouts.
236
+
237
+ ## Workspace input history
238
+
239
+ The workspace message box supports Up/Down input history. Up recalls earlier
240
+ human inputs in the current conversation; Down returns to the unsent draft.
241
+ Automatic wake-up messages are excluded, and arrows retain normal cursor
242
+ movement inside multiline drafts.
@@ -78,7 +78,11 @@ pycodex --json "Reply with exactly OK."
78
78
  | `/fork` | 保留当前历史,以新会话 ID 继续 |
79
79
  | `/queue <message>` | 等当前 turn 完成后再执行 |
80
80
 
81
- 运行中提交普通输入,会在下一个安全采样边界插入。会话保存在
81
+ 运行中提交普通输入,会在下一个安全采样边界插入。
82
+ 斜杠输入遵循 Codex 的命令规则:`/data/project` 和 `/tmp/` 是普通消息;
83
+ `/modle` 或 `/tmp` 这样的未知单层名称会提示命令错误。
84
+ 在输入开头加一个空格即可按文本发送,包括已知命令,例如 ` /model`。
85
+ 这些规则同样适用于浏览器工作区和飞书。会话保存在
82
86
  `CODEX_HOME/sessions`;配置 `model_auto_compact_token_limit` 可启用自动压缩。
83
87
 
84
88
  Ctrl+D 或 Ctrl+C 发起退出,等待已接收任务完成;关闭等待期间再次 Ctrl+C
@@ -102,8 +106,17 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
102
106
 
103
107
  访问 `http://127.0.0.1:6007`。工作区同时提供对话、实时 HTML Canvas 和只读
104
108
  文件/diff 查看器。点击回复中的文件链接打开视图,通过 **Insert into chat**
105
- 把选中的代码插入可编辑草稿。运行期间保持服务器 stdin 打开,EOF 会触发关闭。
106
- 点击齿轮按钮可开启界面定制会话,让 Agent 修改 `~/.pycodex/frontend/` 中的文件。
109
+ 把选中的代码插入可编辑草稿。本地 PDF 链接使用浏览器内置阅读器预览,
110
+ 并提供新标签页打开和下载入口。运行期间保持服务器 stdin 打开,EOF 会触发关闭。
111
+ 点击 **New session** 直接按启动时的 `--profile` 创建会话,未指定时使用基础配置。
112
+ 右侧 **+** 按钮(Custom profile)可从服务器的 Codex 配置中选择 profile;
113
+ 选择框中的 **Default** 沿用启动配置。会话保存 profile 名称,
114
+ 重启后按同一名称恢复;已有会话的配置保持不变。增删 profile 后需重启服务器。
115
+ 当前 Agent 工作时,空输入框从随机位置开始,每约 6 秒顺序轮换一条简短提示,
116
+ 涵盖命令、界面定制、工作区分享、会话间协作和可选功能。可在 `workspace.html` 的 `updatePromptPlaceholder`
117
+ 中编辑 `hints` 字符串列表。已有草稿不受影响。
118
+ 点击齿轮按钮,在 **Customize Agent** 中开启界面定制会话,让 Agent 修改
119
+ `~/.pycodex/frontend/` 中的文件;**Share** 可通过链接和密码共享当前工作区。
107
120
 
108
121
  会话操作、存储和飞书配置见[工作区说明](packages/pycodex-ws/README.md)。
109
122
  独立分发的 [VS Code 扩展](packages/pycodex-ws/extensions/vscode/README.md)
@@ -156,9 +169,11 @@ uv run --dev pytest
156
169
  ```
157
170
 
158
171
  - [测试环境与覆盖范围](tests/TESTS.md)
172
+ - [仓库开发约定与阅读导航](AGENTS.md)
159
173
  - [架构、包布局与运行时契约](docs/RUNTIME.md)
160
174
  - [提示、配置与上下文](docs/CONTEXT.md)
161
175
  - [上游对齐](docs/ALIGNMENT.md)
162
176
  - [Responses 兼容服务](docs/responses_server/README.md)
177
+ - [Portable 配置契约](docs/PORTABLE.md)
163
178
 
164
179
  发布记录和实现细节放在 `docs/`。
@@ -17,6 +17,7 @@ from .events import (
17
17
  ModelCalledEvent,
18
18
  ModelCompletedEvent,
19
19
  ModelEvent,
20
+ ModelRequestTimingEvent,
20
21
  StreamErrorEvent,
21
22
  TerminalEvent,
22
23
  TokenCountEvent,
@@ -558,7 +559,7 @@ class Agent:
558
559
  self._emit(started_type(*details))
559
560
 
560
561
  def handle_compact_stream_event(event: "ModelEvent") -> "None":
561
- if isinstance(event, StreamErrorEvent) or (
562
+ if isinstance(event, (StreamErrorEvent, ModelRequestTimingEvent)) or (
562
563
  phase == "manual" and isinstance(event, TokenCountEvent)
563
564
  ):
564
565
  self._emit(replace(event, turn_id=turn_id))
@@ -271,6 +271,17 @@ class TokenCountEvent(ModelEvent):
271
271
  display.set_prompt(display.main_prompt())
272
272
 
273
273
 
274
+ @dataclass(frozen=True)
275
+ class ModelRequestTimingEvent(ModelEvent):
276
+ model: "str"
277
+ elapsed_seconds: "float"
278
+ first_data_seconds: "typing.Union[float, None]"
279
+ outcome: "str"
280
+ turn_id: "str" = ""
281
+ submission_id: "typing.Union[str, None]" = None
282
+ kind: ClassVar[str] = "model_request_timing"
283
+
284
+
274
285
  @dataclass(frozen=True)
275
286
  class StreamErrorEvent(ModelEvent):
276
287
  message: "str"
@@ -285,9 +296,14 @@ class StreamErrorEvent(ModelEvent):
285
296
  def visualize(self) -> "str":
286
297
  return self.message
287
298
 
299
+ def detail(self) -> "str":
300
+ if not self.error:
301
+ return self.message
302
+ return "{0}\n{1}".format(self.message, self.error)
303
+
288
304
  def render(self, display: "EventDisplay") -> "None":
289
305
  display.stream_buffer = ""
290
- display.write("[status] " + self.visualize(), "status")
306
+ display.write("[status] " + self.detail(), "status")
291
307
  display.set_status("reconnecting")
292
308
 
293
309
 
@@ -735,6 +751,12 @@ class SessionStateEvent(Event):
735
751
  state["input_request"].render(display)
736
752
 
737
753
 
754
+ @dataclass(frozen=True)
755
+ class RuntimeUpdatedEvent(Event):
756
+ reason: "str"
757
+ kind: ClassVar[str] = "runtime_updated"
758
+
759
+
738
760
  @dataclass(frozen=True)
739
761
  class SessionClosedEvent(Event):
740
762
  kind: ClassVar[str] = "session_closed"
@@ -744,6 +766,14 @@ class SessionClosedEvent(Event):
744
766
  display.finish_stream()
745
767
 
746
768
 
769
+ @dataclass(frozen=True)
770
+ class CommandStartedEvent(Event):
771
+ submission_id: "str"
772
+ command: "str"
773
+ sender: "str" = "user"
774
+ kind: ClassVar[str] = "command_started"
775
+
776
+
747
777
  @dataclass(frozen=True)
748
778
  class CommandCompletedEvent(Event):
749
779
  submission_id: "str"
@@ -766,6 +796,7 @@ class CommandFailedEvent(Event):
766
796
  command: "str"
767
797
  error: "str"
768
798
  sender: "str"
799
+ error_type: "str" = "CommandError"
769
800
  kind: ClassVar[str] = "command_failed"
770
801
 
771
802
  def visualize(self) -> "str":