python-codex 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl
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.
- pycodex/__init__.py +4 -4
- pycodex/agent.py +28 -9
- pycodex/bootstrap.py +10 -12
- pycodex/cli.py +0 -14
- pycodex/context.py +43 -32
- pycodex/events.py +20 -11
- pycodex/model.py +16 -7
- pycodex/prompts/models.json +14 -0
- pycodex/protocol.py +18 -0
- pycodex/runtime.py +49 -54
- pycodex/tools/__init__.py +9 -10
- pycodex/tools/clock_tool.py +57 -7
- pycodex/tools/exec_runtime.py +29 -78
- pycodex/tools/exec_tool.py +2 -6
- pycodex/utils/compat.py +41 -0
- pycodex/utils/dotenv.py +0 -7
- pycodex/utils/event_helpers.py +5 -9
- pycodex/utils/history.py +79 -20
- pycodex/utils/session_persist.py +133 -36
- pycodex/utils/skill_catalog.py +18 -0
- python_codex-0.6.2.dist-info/METADATA +216 -0
- {python_codex-0.6.0.dist-info → python_codex-0.6.2.dist-info}/RECORD +33 -32
- responses_server/app.py +3 -1
- responses_server/config.py +6 -1
- responses_server/gemini_api.py +336 -0
- responses_server/messages_api.py +9 -1
- responses_server/request_translation.py +6 -0
- responses_server/stream_router.py +15 -0
- responses_server/tools/web_search.py +3 -0
- responses_server/transport.py +75 -19
- pycodex/tools/request_user_input_tool.py +0 -82
- python_codex-0.6.0.dist-info/METADATA +0 -352
- {python_codex-0.6.0.dist-info → python_codex-0.6.2.dist-info}/WHEEL +0 -0
- {python_codex-0.6.0.dist-info → python_codex-0.6.2.dist-info}/entry_points.txt +0 -0
- {python_codex-0.6.0.dist-info → python_codex-0.6.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"""`request_user_input` tool for the Python Codex prototype.
|
|
2
|
-
|
|
3
|
-
Original Codex mapping:
|
|
4
|
-
- Corresponds to the original Codex `request_user_input` collaboration tool.
|
|
5
|
-
|
|
6
|
-
Expected behavior:
|
|
7
|
-
- Keep the tool declaration available for upstream request compatibility.
|
|
8
|
-
- Return the upstream Default-mode unavailable message without requesting input.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
from ..protocol import JSONDict, JSONValue
|
|
12
|
-
from .base_tool import BaseTool, ToolContext
|
|
13
|
-
|
|
14
|
-
REQUEST_USER_INPUT_QUESTION_SCHEMA = {
|
|
15
|
-
"type": "object",
|
|
16
|
-
"properties": {
|
|
17
|
-
"id": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"description": "Stable identifier for mapping answers (snake_case).",
|
|
20
|
-
},
|
|
21
|
-
"header": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "Short header label shown in the UI (12 or fewer chars).",
|
|
24
|
-
},
|
|
25
|
-
"question": {
|
|
26
|
-
"type": "string",
|
|
27
|
-
"description": "Single-sentence prompt shown to the user.",
|
|
28
|
-
},
|
|
29
|
-
"options": {
|
|
30
|
-
"type": "array",
|
|
31
|
-
"description": (
|
|
32
|
-
"Provide 2-3 mutually exclusive choices. Put the recommended option "
|
|
33
|
-
'first and suffix its label with "(Recommended)". Do not include '
|
|
34
|
-
'an "Other" option in this list; the client will add a free-form '
|
|
35
|
-
'"Other" option automatically.'
|
|
36
|
-
),
|
|
37
|
-
"items": {
|
|
38
|
-
"type": "object",
|
|
39
|
-
"properties": {
|
|
40
|
-
"label": {
|
|
41
|
-
"type": "string",
|
|
42
|
-
"description": "User-facing label (1-5 words).",
|
|
43
|
-
},
|
|
44
|
-
"description": {
|
|
45
|
-
"type": "string",
|
|
46
|
-
"description": "One short sentence explaining impact/tradeoff if selected.",
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
"required": ["label", "description"],
|
|
50
|
-
"additionalProperties": False,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
"required": ["id", "header", "question", "options"],
|
|
55
|
-
"additionalProperties": False,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class RequestUserInputTool(BaseTool):
|
|
60
|
-
exec_only = False
|
|
61
|
-
name = "request_user_input"
|
|
62
|
-
description = (
|
|
63
|
-
"Request user input for one to three short questions and wait for the "
|
|
64
|
-
"response. This tool is only available in Plan mode."
|
|
65
|
-
)
|
|
66
|
-
input_schema = {
|
|
67
|
-
"type": "object",
|
|
68
|
-
"properties": {
|
|
69
|
-
"questions": {
|
|
70
|
-
"type": "array",
|
|
71
|
-
"description": "Questions to show the user. Prefer 1 and do not exceed 3",
|
|
72
|
-
"items": REQUEST_USER_INPUT_QUESTION_SCHEMA,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
"required": ["questions"],
|
|
76
|
-
"additionalProperties": False,
|
|
77
|
-
}
|
|
78
|
-
supports_parallel = False
|
|
79
|
-
|
|
80
|
-
async def run(self, context: "ToolContext", args: "JSONDict") -> "JSONValue":
|
|
81
|
-
del context, args
|
|
82
|
-
return "request_user_input is unavailable in Default mode"
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: python-codex
|
|
3
|
-
Version: 0.6.0
|
|
4
|
-
Summary: A minimal Python extraction of Codex's main agent loop
|
|
5
|
-
License-File: LICENSE
|
|
6
|
-
Requires-Python: >=3.6.2
|
|
7
|
-
Requires-Dist: dataclasses>=0.8; python_version < '3.7'
|
|
8
|
-
Requires-Dist: importlib-metadata>=4.8.3; python_version < '3.8'
|
|
9
|
-
Requires-Dist: loguru>=0.7.3
|
|
10
|
-
Requires-Dist: prompt-toolkit>=3.0.36
|
|
11
|
-
Requires-Dist: pyyaml>=6.0
|
|
12
|
-
Requires-Dist: requests>=2.27.1
|
|
13
|
-
Requires-Dist: starlette<0.20,>=0.19.1; python_version < '3.7'
|
|
14
|
-
Requires-Dist: starlette>=0.19.1; python_version >= '3.7'
|
|
15
|
-
Requires-Dist: tomli<2,>=1.2.3; python_version < '3.11'
|
|
16
|
-
Requires-Dist: typing-extensions>=4.1.1; python_version < '3.8'
|
|
17
|
-
Requires-Dist: uvicorn<0.17,>=0.16.0; python_version < '3.7'
|
|
18
|
-
Requires-Dist: uvicorn>=0.16.0; python_version >= '3.7'
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
|
|
21
|
-
# pycodex
|
|
22
|
-
|
|
23
|
-
[中文](README_ZH.md)
|
|
24
|
-
|
|
25
|
-
pycodex brings the [Codex](https://github.com/openai/codex) agent loop to Python,
|
|
26
|
-
with a CLI, reusable Agent API and browser workspace. It targets upstream default
|
|
27
|
-
behavior for the selected features, model and protocol; supported features and
|
|
28
|
-
deliberate differences are documented in
|
|
29
|
-
[Alignment](docs/ALIGNMENT.md).
|
|
30
|
-
|
|
31
|
-
Intentional boundaries include no sandbox enforcement or collaboration-mode
|
|
32
|
-
switching, no OpenAI-specific model/effort allowlists for sub-agents, and no
|
|
33
|
-
requirement to mirror every OpenAI model-catalog entry.
|
|
34
|
-
|
|
35
|
-
| Package | Provides | Python |
|
|
36
|
-
| --- | --- | --- |
|
|
37
|
-
| `python-codex` | Agent, runtime, CLI, tools, Responses compatibility server and portable storage | 3.6.2+ |
|
|
38
|
-
| `pycodex-ws` | Browser workspace, Canvas, file/diff viewers and optional Feishu integration | 3.7+ |
|
|
39
|
-
|
|
40
|
-
The workspace package installs the matching core version. Python imports use
|
|
41
|
-
`pycodex`; the commands are `pycodex` and `pycodex-ws`.
|
|
42
|
-
|
|
43
|
-
The `exec` tool runs Python with top-level `await` in the host process. Each cell
|
|
44
|
-
has its own namespace, output and tracked asyncio tasks; imports and process
|
|
45
|
-
state are shared. Stopping is cooperative, so run blocking work through
|
|
46
|
-
`tools.exec_command`. Direct file access can use the cell's `cwd` Path.
|
|
47
|
-
See [exec lifecycle and limits](docs/RUNTIME.md#python-exec-cells).
|
|
48
|
-
|
|
49
|
-
## Install and run
|
|
50
|
-
|
|
51
|
-
Install the core CLI:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
python3 -m pip install python-codex
|
|
55
|
-
pycodex
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Or install the browser workspace, which includes core:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
python3 -m pip install pycodex-ws
|
|
62
|
-
pycodex-ws --help
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Use `python3 -m pip install --upgrade pycodex-ws` to upgrade both packages
|
|
66
|
-
together. If a command is missing from `PATH`, use `python3 -m pycodex` or
|
|
67
|
-
`python3 -m workspace_server` with the interpreter used for installation.
|
|
68
|
-
|
|
69
|
-
## Model configuration
|
|
70
|
-
|
|
71
|
-
pycodex reads `~/.codex/config.toml` and the adjacent `.env`. Configure `model`,
|
|
72
|
-
`model_provider`, and the provider's `base_url` and `env_key` as needed.
|
|
73
|
-
The built-in `openai` provider uses `OPENAI_API_KEY`. Authentication uses API
|
|
74
|
-
keys; ChatGPT sign-in credentials from `auth.json` or the OS keychain are not
|
|
75
|
-
loaded.
|
|
76
|
-
|
|
77
|
-
`--profile NAME` selects an adjacent `NAME.config.toml` or an embedded
|
|
78
|
-
`[profiles.NAME]` table. Both recursively merge over the base config, including
|
|
79
|
-
provider and feature tables. A top-level `profile = "NAME"` sets the default;
|
|
80
|
-
`--profile` overrides it. Duplicate names across both formats and missing selected
|
|
81
|
-
profiles are errors. Existing embedded profiles can be used without migration.
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
pycodex --profile my_profile "Summarize this repository."
|
|
85
|
-
pycodex --config /path/to/config.toml
|
|
86
|
-
pycodex doctor
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Models use the streaming Responses API; OpenAI models use native Responses
|
|
90
|
-
directly. For a vLLM Chat Completions backend, set `use_chat_completion = true`
|
|
91
|
-
in its provider table. Other backend options include:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
pycodex --vllm-endpoint http://127.0.0.1:18000
|
|
95
|
-
pycodex --profile my_profile --use-messages
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
See [context and configuration](docs/CONTEXT.md) and the
|
|
99
|
-
[Responses compatibility server](docs/responses_server/README.md).
|
|
100
|
-
The compatibility server supports namespaced function/custom tools, including
|
|
101
|
-
upstream Codex subagent tools, with namespace restoration on returned calls.
|
|
102
|
-
Text and reasoning streams include item lifecycle events for Codex's live display.
|
|
103
|
-
|
|
104
|
-
For `step-5-preview` on Step's `step_plan/v1` endpoint, enable
|
|
105
|
-
`use_chat_completion = true` in the Step provider or profile: its native Responses
|
|
106
|
-
endpoint does not expose namespaced collaboration tools correctly. The adapter
|
|
107
|
-
presents names such as `collaboration__spawn_agent` as ordinary functions.
|
|
108
|
-
Prompts follow the declared direct-call names and describe Python `exec`
|
|
109
|
-
collaboration only when both `exec` and collaboration tools are visible.
|
|
110
|
-
|
|
111
|
-
## CLI
|
|
112
|
-
|
|
113
|
-
Run `pycodex` without a prompt for an interactive session, or supply a prompt
|
|
114
|
-
for a single turn:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
pycodex "Summarize this repository in one sentence."
|
|
118
|
-
printf 'Reply with exactly OK.' | pycodex
|
|
119
|
-
pycodex --json "Reply with exactly OK."
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
| Command | Purpose |
|
|
123
|
-
| --- | --- |
|
|
124
|
-
| `/model`, `/effort` | Show or change the model and reasoning effort |
|
|
125
|
-
| `/cd <directory>` | Change the session's working directory while idle |
|
|
126
|
-
| `/title`, `/history` | Manage the title and inspect conversation history |
|
|
127
|
-
| `/resume` | List saved sessions; pass an index or session UUID to resume |
|
|
128
|
-
| `/compact` | Summarize history to free context |
|
|
129
|
-
| `/queue <message>` | Wait for the active turn to finish before submitting |
|
|
130
|
-
|
|
131
|
-
Ordinary input during a turn steers at the next safe sampling boundary.
|
|
132
|
-
Slash input uses Codex's command rules: `/data/project` and `/tmp/` are
|
|
133
|
-
ordinary messages, while an unknown single-component name such as `/modle`
|
|
134
|
-
or `/tmp` reports a command error. Start the input with a space to send any
|
|
135
|
-
slash-prefixed text literally, including known commands such as ` /model`.
|
|
136
|
-
These rules also apply to the browser workspace and Feishu.
|
|
137
|
-
Sessions are saved under `CODEX_HOME/sessions`. Set
|
|
138
|
-
`model_auto_compact_token_limit` in the configuration to compact automatically.
|
|
139
|
-
|
|
140
|
-
Ctrl+D or Ctrl+C stops the session and its child agents: pending turns are
|
|
141
|
-
discarded, and active turns stop after issued model/tool operations finish.
|
|
142
|
-
Session close uses the same behavior. A second Ctrl+C during closing exits
|
|
143
|
-
immediately. Use `pycodex --help` for startup options.
|
|
144
|
-
|
|
145
|
-
## Browser workspace
|
|
146
|
-
|
|
147
|
-
Create `workspaces.json`:
|
|
148
|
-
|
|
149
|
-
```json
|
|
150
|
-
{
|
|
151
|
-
"workspaces": [
|
|
152
|
-
{"id": "demo", "work_dir": ".", "state_path": "demo", "enable_board": true}
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Open `http://127.0.0.1:6007`. The workspace combines conversations with a live
|
|
162
|
-
HTML Canvas and read-only file/diff viewers. Click file links in replies to open
|
|
163
|
-
them, and use **Insert into chat** to add selected code to an editable draft.
|
|
164
|
-
Text and image views support files up to 10 MiB each.
|
|
165
|
-
The context ring opens the built-in Agent tree with `n running · m failed` counts
|
|
166
|
-
(including the root), each Agent's turn duration, and error details for failures.
|
|
167
|
-
Click a root or child Agent in the popover to open its live transcript tab.
|
|
168
|
-
Compare local files with `diff:left..right`; either path can be absolute or relative.
|
|
169
|
-
Use `[TODO](TODO.md)` for a local file link; bare filenames stay as text.
|
|
170
|
-
Local PDF links open in the browser's built-in reader, with **Open in new tab**
|
|
171
|
-
and **Download** links. PDF files are streamed separately from text snapshots.
|
|
172
|
-
Keep the server's stdin open: EOF initiates shutdown.
|
|
173
|
-
**New session** uses the launch `--profile`, then the config's default `profile`,
|
|
174
|
-
then the base config. The **+** button on its right (**Custom profile**) lets
|
|
175
|
-
you choose from adjacent `*.config.toml` files and embedded `[profiles.NAME]`
|
|
176
|
-
tables; **Default** uses the same default selection.
|
|
177
|
-
Each session saves its profile name and uses it again on restart; existing sessions
|
|
178
|
-
keep their configuration. Restart the server after adding or removing profiles.
|
|
179
|
-
The page loads the last selected session directly on reopening. Switching back
|
|
180
|
-
to a visited session immediately restores its rendered messages and scroll
|
|
181
|
-
position, then refreshes its content from the server.
|
|
182
|
-
While the selected Agent is working, the empty composer cycles through usage
|
|
183
|
-
hints about commands, frontend customization, workspace sharing, Agent status,
|
|
184
|
-
live transcripts and optional features, including clock tick dividers, about every
|
|
185
|
-
six seconds, starting at a random hint. Edit the short
|
|
186
|
-
strings in the `hints` list in `workspace.html`'s `updatePromptPlaceholder` to change the tips.
|
|
187
|
-
The gear button opens **Customize Agent** and **Share**, with a short description of each.
|
|
188
|
-
Customize Agent starts an Agent conversation for editing files in
|
|
189
|
-
`~/.pycodex/frontend/`. Its setup context includes an API quick
|
|
190
|
-
reference and the path to the full API documentation shipped with the package.
|
|
191
|
-
Browse the [feature catalog](packages/pycodex-ws/workspace_server/optional_features/README.md)
|
|
192
|
-
in the view area and tell the Agent which features to adapt. You can also ask it
|
|
193
|
-
to publish a local customization as a GitHub feature PR using the
|
|
194
|
-
[contribution format](packages/pycodex-ws/workspace_server/optional_features/CONTRIBUTING.md).
|
|
195
|
-
The [custom frontend API](docs/WORKSPACE_API.md) provides structured state,
|
|
196
|
-
command results, history pagination, event replay and Agent/background-task
|
|
197
|
-
inventories. Optional `custom.js` extensions can export `mount(host)` to use
|
|
198
|
-
the built-in page's session, draft and viewer controls.
|
|
199
|
-
With a workspace server administrator password configured, **Share** sets a
|
|
200
|
-
separate password for this workspace using the existing login page. Sharing
|
|
201
|
-
passwords and visitor logins live only in memory; changing the password, stopping
|
|
202
|
-
sharing or restarting the process invalidates them. Router login is unchanged.
|
|
203
|
-
|
|
204
|
-
See the [workspace guide](packages/pycodex-ws/README.md) for session controls,
|
|
205
|
-
storage and Feishu setup. The separately distributed
|
|
206
|
-
[VS Code extension](packages/pycodex-ws/extensions/vscode/README.md) uses the same
|
|
207
|
-
workspace backend, including on Remote SSH hosts.
|
|
208
|
-
|
|
209
|
-
## Python API
|
|
210
|
-
|
|
211
|
-
Use the standard model and tool setup from Python:
|
|
212
|
-
|
|
213
|
-
```python
|
|
214
|
-
import atexit
|
|
215
|
-
|
|
216
|
-
from pycodex import AgentsManager, CodexConfig
|
|
217
|
-
from pycodex.bootstrap import build_model
|
|
218
|
-
from pycodex.utils.async_bridge import run_async
|
|
219
|
-
|
|
220
|
-
async def main():
|
|
221
|
-
config = CodexConfig.from_env()
|
|
222
|
-
bootstrap = build_model(config.provider)
|
|
223
|
-
if bootstrap.owned_server is not None:
|
|
224
|
-
atexit.register(bootstrap.owned_server.stop)
|
|
225
|
-
runtime = AgentsManager(
|
|
226
|
-
bootstrap.client, config.context,
|
|
227
|
-
).create_root_runtime()
|
|
228
|
-
await runtime.start()
|
|
229
|
-
try:
|
|
230
|
-
receipt = await runtime.submit_input("Summarize this repository in one sentence.")
|
|
231
|
-
print((await receipt.future).output_text)
|
|
232
|
-
finally:
|
|
233
|
-
await runtime.close()
|
|
234
|
-
|
|
235
|
-
run_async(main())
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
`CodexConfig.from_env(path, profile)` loads the selected TOML and adjacent `.env`
|
|
239
|
-
once for startup. Pass `config.provider` to `build_model` and `config.context` to
|
|
240
|
-
`AgentsManager`; use `dataclasses.replace` for explicit overrides, including `None`.
|
|
241
|
-
API keys are still read from the environment when requests are sent.
|
|
242
|
-
`build_model` returns `ModelBootstrapResult(client, owned_server)`. The caller owns
|
|
243
|
-
any locally started compatibility server; `close()` stops only that server.
|
|
244
|
-
CLI and workspace entry points retain process-exit cleanup for these services.
|
|
245
|
-
|
|
246
|
-
For custom integrations, `Agent` requires a model client, `ToolRegistry`,
|
|
247
|
-
`ContextConfig` and `session_id`. `await agent.run_turn([...])` runs an asynchronous
|
|
248
|
-
turn; `AgentRuntime(agent, agents_manager)` adds input queues, commands and frontend
|
|
249
|
-
subscriptions. `AgentsManager` owns the tree of named tasks and supplies the
|
|
250
|
-
standard construction path.
|
|
251
|
-
|
|
252
|
-
The current prototype uses MultiAgentV2 tools: `spawn_agent`, `send_message`,
|
|
253
|
-
`followup_task`, `wait_agent`, `interrupt_agent` and `list_agents`. Child context
|
|
254
|
-
inheritance uses `fork_turns`; the session `/fork` command has been removed.
|
|
255
|
-
`features.multi_agent_v2.max_concurrent_threads_per_session` sets the total
|
|
256
|
-
capacity, defaulting to 16 including the root. When full, spawn closes the least
|
|
257
|
-
recently used idle leaf with no pending or background work, or reports a capacity
|
|
258
|
-
error. Closed children are removed from the Agent tree and Workspace views;
|
|
259
|
-
their task names can be reused. The Manager retains closing child references
|
|
260
|
-
until their cleanup finishes, even after they leave the live tree.
|
|
261
|
-
Recorded sessions retain the clock period in a small environment snapshot beside
|
|
262
|
-
the rollout. Resuming starts a fresh countdown and restores `idle: sleeping`
|
|
263
|
-
in attached frontends; child Agents remain in memory.
|
|
264
|
-
Runtime reads execution facts through `Agent.execution_snapshot()`; session
|
|
265
|
-
history and live-state snapshots retain their separate frontend formats.
|
|
266
|
-
Tool factories register shared resource managers with the environment, which
|
|
267
|
-
owns their callbacks, restart, background state and cleanup. Tools provide their
|
|
268
|
-
model-callable behavior. Pass `tools_factory(manager, environment, toolset)` to
|
|
269
|
-
`AgentsManager` to construct custom tools for both root and child Agents; see the
|
|
270
|
-
[resource contract](docs/RUNTIME.md#tools).
|
|
271
|
-
Model clients expose explicit recording metadata; Agent supplies each request's
|
|
272
|
-
session identity through `Prompt`, including compaction and resumed sessions.
|
|
273
|
-
Tool summaries and conversation-history projections are pure helpers shared by
|
|
274
|
-
event and session views.
|
|
275
|
-
See [runtime contracts](docs/RUNTIME.md), [context assembly](docs/CONTEXT.md) and
|
|
276
|
-
the [versioned alignment baseline and remaining differences](docs/ALIGNMENT.md).
|
|
277
|
-
|
|
278
|
-
## Portable configuration
|
|
279
|
-
|
|
280
|
-
Portable mode transfers an encrypted bundle of your configuration, instructions
|
|
281
|
-
and skills to another machine. Start a storage service in a separate terminal:
|
|
282
|
-
|
|
283
|
-
```bash
|
|
284
|
-
python3 -m pycodex.portable.server --root .tmp/pycodex_storage --host 127.0.0.1 --port 5577
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
Upload the default Codex home, or specify another directory:
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
pycodex --put @127.0.0.1:5577
|
|
291
|
-
pycodex --put /path/to/.codex/@127.0.0.1:5577
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
After verifying a download round trip, the command prints a reusable
|
|
295
|
-
`pycodex --call ...` command. Run it on the target machine using a storage
|
|
296
|
-
address reachable from that machine.
|
|
297
|
-
|
|
298
|
-
## Development and reference
|
|
299
|
-
|
|
300
|
-
```bash
|
|
301
|
-
uv sync --dev
|
|
302
|
-
uv run pycodex
|
|
303
|
-
uv run --dev pytest
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
- [Test environments and coverage](tests/TESTS.md)
|
|
307
|
-
- [Repository development rules and reading guide](AGENTS.md)
|
|
308
|
-
- [Architecture, package layout and runtime contracts](docs/RUNTIME.md)
|
|
309
|
-
- [Prompts, configuration and context](docs/CONTEXT.md)
|
|
310
|
-
- [Upstream alignment](docs/ALIGNMENT.md)
|
|
311
|
-
- [Responses compatibility server](docs/responses_server/README.md)
|
|
312
|
-
- [Portable configuration contracts](docs/PORTABLE.md)
|
|
313
|
-
|
|
314
|
-
See the [0.6.0 release notes](https://github.com/Randomizez/pycodex/blob/v0.6.0/docs/RELEASE_0.6.0.md) for the major changes and
|
|
315
|
-
Python integration migration from 0.5.0. Implementation details live in `docs/`.
|
|
316
|
-
|
|
317
|
-
## Markdown view modes
|
|
318
|
-
|
|
319
|
-
Markdown file views include a Show source / Show preview button. Switching
|
|
320
|
-
modes preserves each mode's reading position without replaying a previous line
|
|
321
|
-
target.
|
|
322
|
-
|
|
323
|
-
## Responses reliability
|
|
324
|
-
|
|
325
|
-
Providers can opt into ordered failover with `fallback_models = ["backup-one",
|
|
326
|
-
"backup-two"]` in their `[model_providers.<name>]` table. Each target uses the
|
|
327
|
-
same endpoint, credentials, history and tools; request settings are rebuilt for
|
|
328
|
-
that model, while the session's selected model stays unchanged. Transient errors
|
|
329
|
-
exhaust `stream_max_retries` before advancing. Unavailable-model errors and
|
|
330
|
-
first-data timeouts advance immediately. Existing retry notices name both models
|
|
331
|
-
and include the underlying error.
|
|
332
|
-
|
|
333
|
-
Failed models cool down for 900 seconds within that client. Subsequent requests
|
|
334
|
-
skip them, retry them after expiry, and restart the full chain when every target
|
|
335
|
-
is cooling. `fallback_cooldown_seconds = 0` disables cooldown; explicit model
|
|
336
|
-
selection clears it. New sessions and subagents have independent cooldowns.
|
|
337
|
-
An absent or empty list disables failover. Invalid input, context-length and
|
|
338
|
-
terminal incomplete errors retain their existing handling. Backups must support
|
|
339
|
-
the active tools and context size; compaction keeps the selected model's policy.
|
|
340
|
-
|
|
341
|
-
Responses HTTP 408/429 and server errors use the provider retry budget.
|
|
342
|
-
Rate-limit messages containing `try again in` or `retry after` supply the retry
|
|
343
|
-
delay. CLI and workspace retry notices include the underlying error details;
|
|
344
|
-
workspace notices survive browser refresh and active-turn reattachment, and
|
|
345
|
-
remain separate from the assistant reply. They are not persisted in rollouts.
|
|
346
|
-
|
|
347
|
-
## Workspace input history
|
|
348
|
-
|
|
349
|
-
The workspace message box supports Up/Down input history. Up recalls earlier
|
|
350
|
-
human inputs in the current conversation; Down returns to the unsent draft.
|
|
351
|
-
Automatic wake-up messages are excluded, and arrows retain normal cursor
|
|
352
|
-
movement inside multiline drafts.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|