codex-python 0.2.10__tar.gz → 0.2.12__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.
- {codex_python-0.2.10 → codex_python-0.2.12}/PKG-INFO +2 -2
- {codex_python-0.2.10 → codex_python-0.2.12}/README.md +1 -1
- {codex_python-0.2.10 → codex_python-0.2.12}/codex/__init__.py +1 -1
- codex_python-0.2.12/codex/config.py +242 -0
- codex_python-0.2.12/codex/protocol/_base_model.py +8 -0
- codex_python-0.2.12/codex/protocol/types.py +1553 -0
- {codex_python-0.2.10 → codex_python-0.2.12}/crates/codex_native/Cargo.lock +218 -20
- {codex_python-0.2.10 → codex_python-0.2.12}/crates/codex_native/Cargo.toml +8 -1
- codex_python-0.2.12/crates/codex_native/src/bin/protocol_schema.rs +163 -0
- {codex_python-0.2.10 → codex_python-0.2.12}/crates/codex_native/src/lib.rs +121 -7
- {codex_python-0.2.10 → codex_python-0.2.12}/pyproject.toml +1 -0
- codex_python-0.2.10/codex/config.py +0 -82
- codex_python-0.2.10/codex/protocol/types.py +0 -1539
- {codex_python-0.2.10 → codex_python-0.2.12}/LICENSE +0 -0
- {codex_python-0.2.10 → codex_python-0.2.12}/codex/api.py +0 -0
- {codex_python-0.2.10 → codex_python-0.2.12}/codex/event.py +0 -0
- {codex_python-0.2.10 → codex_python-0.2.12}/codex/native.py +0 -0
- {codex_python-0.2.10 → codex_python-0.2.12}/codex/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codex-python
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
|
5
5
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.13
|
|
@@ -104,7 +104,7 @@ Common tasks
|
|
|
104
104
|
- Generate protocol types from upstream: `make gen-protocol`
|
|
105
105
|
|
|
106
106
|
Protocol types
|
|
107
|
-
- `make gen-protocol` generates TS types
|
|
107
|
+
- `make gen-protocol` generates TS types and a JSON Schema, then writes Pydantic v2 models to `codex/protocol/types.py`. The process runs entirely from the native helper in this repo; no manual scripts needed.
|
|
108
108
|
- Generated models use `model_config = ConfigDict(extra='allow')` and place it at the end of each class.
|
|
109
109
|
|
|
110
110
|
Releasing
|
|
@@ -85,7 +85,7 @@ Common tasks
|
|
|
85
85
|
- Generate protocol types from upstream: `make gen-protocol`
|
|
86
86
|
|
|
87
87
|
Protocol types
|
|
88
|
-
- `make gen-protocol` generates TS types
|
|
88
|
+
- `make gen-protocol` generates TS types and a JSON Schema, then writes Pydantic v2 models to `codex/protocol/types.py`. The process runs entirely from the native helper in this repo; no manual scripts needed.
|
|
89
89
|
- Generated models use `model_config = ConfigDict(extra='allow')` and place it at the end of each class.
|
|
90
90
|
|
|
91
91
|
Releasing
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from typing import Any, cast
|
|
5
|
+
|
|
6
|
+
from pydantic import AliasChoices, BaseModel, ConfigDict, Field
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ApprovalPolicy(str, Enum):
|
|
10
|
+
"""Approval policy for executing shell commands.
|
|
11
|
+
|
|
12
|
+
Matches Rust enum `AskForApproval` (serde kebab-case):
|
|
13
|
+
- "untrusted": auto-approve safe read-only commands, ask otherwise
|
|
14
|
+
- "on-failure": sandbox by default; ask only if the sandboxed run fails
|
|
15
|
+
- "on-request": model decides (default)
|
|
16
|
+
- "never": never ask the user
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
UNTRUSTED = "untrusted"
|
|
20
|
+
ON_FAILURE = "on-failure"
|
|
21
|
+
ON_REQUEST = "on-request"
|
|
22
|
+
NEVER = "never"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class SandboxMode(str, Enum):
|
|
26
|
+
"""High-level sandbox mode override.
|
|
27
|
+
|
|
28
|
+
Matches Rust enum `SandboxMode` (serde kebab-case):
|
|
29
|
+
- "read-only"
|
|
30
|
+
- "workspace-write"
|
|
31
|
+
- "danger-full-access"
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
READ_ONLY = "read-only"
|
|
35
|
+
WORKSPACE_WRITE = "workspace-write"
|
|
36
|
+
DANGER_FULL_ACCESS = "danger-full-access"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class HistoryPersistence(str, Enum):
|
|
40
|
+
SAVE_ALL = "save-all"
|
|
41
|
+
NONE = "none"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class HistoryConfig(BaseModel):
|
|
45
|
+
persistence: HistoryPersistence | None = None
|
|
46
|
+
max_bytes: int | None = None
|
|
47
|
+
|
|
48
|
+
model_config = ConfigDict(extra="allow")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class SandboxWorkspaceWrite(BaseModel):
|
|
52
|
+
writable_roots: list[str] | None = None
|
|
53
|
+
network_access: bool | None = None
|
|
54
|
+
exclude_tmpdir_env_var: bool | None = None
|
|
55
|
+
exclude_slash_tmp: bool | None = None
|
|
56
|
+
|
|
57
|
+
model_config = ConfigDict(extra="allow")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class McpServerConfig(BaseModel):
|
|
61
|
+
command: str
|
|
62
|
+
args: list[str] | None = None
|
|
63
|
+
env: dict[str, str] | None = None
|
|
64
|
+
startup_timeout_ms: int | None = None
|
|
65
|
+
|
|
66
|
+
model_config = ConfigDict(extra="allow")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class WireApi(str, Enum):
|
|
70
|
+
CHAT = "chat"
|
|
71
|
+
RESPONSES = "responses"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class ModelProviderConfig(BaseModel):
|
|
75
|
+
name: str | None = None
|
|
76
|
+
base_url: str | None = None
|
|
77
|
+
env_key: str | None = None
|
|
78
|
+
wire_api: WireApi | None = None
|
|
79
|
+
query_params: dict[str, str] | None = None
|
|
80
|
+
http_headers: dict[str, str] | None = None
|
|
81
|
+
env_http_headers: dict[str, str] | None = None
|
|
82
|
+
request_max_retries: int | None = None
|
|
83
|
+
stream_max_retries: int | None = None
|
|
84
|
+
stream_idle_timeout_ms: int | None = None
|
|
85
|
+
|
|
86
|
+
model_config = ConfigDict(extra="allow")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class FileOpener(str, Enum):
|
|
90
|
+
VSCODE = "vscode"
|
|
91
|
+
VSCODE_INSIDERS = "vscode-insiders"
|
|
92
|
+
WINDSURF = "windsurf"
|
|
93
|
+
CURSOR = "cursor"
|
|
94
|
+
NONE = "none"
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class ReasoningEffort(str, Enum):
|
|
98
|
+
MINIMAL = "minimal"
|
|
99
|
+
LOW = "low"
|
|
100
|
+
MEDIUM = "medium"
|
|
101
|
+
HIGH = "high"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class ReasoningSummary(str, Enum):
|
|
105
|
+
AUTO = "auto"
|
|
106
|
+
CONCISE = "concise"
|
|
107
|
+
DETAILED = "detailed"
|
|
108
|
+
NONE = "none"
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class ReasoningSummaryFormat(str, Enum):
|
|
112
|
+
NONE = "none"
|
|
113
|
+
EXPERIMENTAL = "experimental"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class Verbosity(str, Enum):
|
|
117
|
+
LOW = "low"
|
|
118
|
+
MEDIUM = "medium"
|
|
119
|
+
HIGH = "high"
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class ToolsConfig(BaseModel):
|
|
123
|
+
# Accept either "web_search" or legacy alias "web_search_request" on input
|
|
124
|
+
web_search: bool | None = Field(
|
|
125
|
+
default=None, validation_alias=AliasChoices("web_search", "web_search_request")
|
|
126
|
+
)
|
|
127
|
+
# Also expose view_image knob (defaults handled in Rust)
|
|
128
|
+
view_image: bool | None = None
|
|
129
|
+
|
|
130
|
+
model_config = ConfigDict(extra="allow")
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class ProfileConfig(BaseModel):
|
|
134
|
+
model: str | None = None
|
|
135
|
+
model_provider: str | None = None
|
|
136
|
+
approval_policy: ApprovalPolicy | None = None
|
|
137
|
+
model_reasoning_effort: ReasoningEffort | None = None
|
|
138
|
+
model_reasoning_summary: ReasoningSummary | None = None
|
|
139
|
+
model_verbosity: Verbosity | None = None
|
|
140
|
+
chatgpt_base_url: str | None = None
|
|
141
|
+
experimental_instructions_file: str | None = None
|
|
142
|
+
|
|
143
|
+
model_config = ConfigDict(extra="allow")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class ProjectConfig(BaseModel):
|
|
147
|
+
trust_level: str | None = Field(
|
|
148
|
+
default=None, description='Only "trusted" is recognized by the core.'
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
model_config = ConfigDict(extra="allow")
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class PreferredAuthMethod(str, Enum):
|
|
155
|
+
CHATGPT = "chatgpt"
|
|
156
|
+
APIKEY = "apikey"
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class CodexConfig(BaseModel):
|
|
160
|
+
"""Configuration overrides for Codex.
|
|
161
|
+
|
|
162
|
+
This mirrors `codex_core::config::ConfigOverrides` and is intentionally
|
|
163
|
+
conservative: only values present (not None) are passed to the native core.
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
# Model selection
|
|
167
|
+
model: str | None = Field(default=None, description="Model slug, e.g. 'gpt-5' or 'o3'.")
|
|
168
|
+
model_provider: str | None = Field(
|
|
169
|
+
default=None, description="Provider key from config, e.g. 'openai'."
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
# Safety/Execution
|
|
173
|
+
approval_policy: ApprovalPolicy | None = Field(default=None)
|
|
174
|
+
sandbox_mode: SandboxMode | None = Field(default=None)
|
|
175
|
+
sandbox_workspace_write: SandboxWorkspaceWrite | None = None
|
|
176
|
+
|
|
177
|
+
# Environment
|
|
178
|
+
cwd: str | None = Field(default=None, description="Working directory for the session.")
|
|
179
|
+
config_profile: str | None = Field(
|
|
180
|
+
default=None, description="Config profile key to use (from profiles.*)."
|
|
181
|
+
)
|
|
182
|
+
codex_linux_sandbox_exe: str | None = Field(
|
|
183
|
+
default=None, description="Absolute path to codex-linux-sandbox (Linux only)."
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
# UX / features
|
|
187
|
+
base_instructions: str | None = Field(default=None, description="Override base instructions.")
|
|
188
|
+
include_plan_tool: bool | None = Field(default=None)
|
|
189
|
+
include_apply_patch_tool: bool | None = Field(default=None)
|
|
190
|
+
include_view_image_tool: bool | None = Field(default=None)
|
|
191
|
+
show_raw_agent_reasoning: bool | None = Field(default=None)
|
|
192
|
+
|
|
193
|
+
# Model/runtime tuning
|
|
194
|
+
model_context_window: int | None = None
|
|
195
|
+
model_max_output_tokens: int | None = None
|
|
196
|
+
model_reasoning_effort: ReasoningEffort | None = None
|
|
197
|
+
model_reasoning_summary: ReasoningSummary | None = None
|
|
198
|
+
model_verbosity: Verbosity | None = None
|
|
199
|
+
model_supports_reasoning_summaries: bool | None = None
|
|
200
|
+
model_reasoning_summary_format: ReasoningSummaryFormat | None = None
|
|
201
|
+
|
|
202
|
+
# Auth/UI options
|
|
203
|
+
hide_agent_reasoning: bool | None = None
|
|
204
|
+
chatgpt_base_url: str | None = None
|
|
205
|
+
preferred_auth_method: PreferredAuthMethod | None = None
|
|
206
|
+
file_opener: FileOpener | None = None
|
|
207
|
+
|
|
208
|
+
# Config file composed sections
|
|
209
|
+
history: HistoryConfig | None = None
|
|
210
|
+
tui: dict[str, Any] | None = None
|
|
211
|
+
notify: list[str] | None = None
|
|
212
|
+
instructions: str | None = Field(
|
|
213
|
+
default=None,
|
|
214
|
+
description="Ignored by core; prefer AGENTS.md or experimental_instructions_file.",
|
|
215
|
+
)
|
|
216
|
+
mcp_servers: dict[str, McpServerConfig] | None = None
|
|
217
|
+
model_providers: dict[str, ModelProviderConfig] | None = None
|
|
218
|
+
project_doc_max_bytes: int | None = None
|
|
219
|
+
profile: str | None = None
|
|
220
|
+
profiles: dict[str, ProfileConfig] | None = None
|
|
221
|
+
tools: ToolsConfig | None = None
|
|
222
|
+
projects: dict[str, ProjectConfig] | None = None
|
|
223
|
+
|
|
224
|
+
# Experimental / internal
|
|
225
|
+
experimental_resume: str | None = None
|
|
226
|
+
experimental_instructions_file: str | None = None
|
|
227
|
+
experimental_use_exec_command_tool: bool | None = None
|
|
228
|
+
responses_originator_header_internal_override: str | None = None
|
|
229
|
+
disable_response_storage: bool | None = Field(
|
|
230
|
+
default=None, description="Accepted in some clients; ignored by core."
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
def to_dict(self) -> dict[str, Any]:
|
|
234
|
+
"""Return overrides as a plain dict with None values removed.
|
|
235
|
+
|
|
236
|
+
Enum fields are emitted as their string values.
|
|
237
|
+
"""
|
|
238
|
+
return cast(dict[str, Any], self.model_dump(exclude_none=True))
|
|
239
|
+
|
|
240
|
+
# Pydantic v2 config. `use_enum_values=True` ensures enums dump as strings.
|
|
241
|
+
# Place at end of class, extra='allow' per style.
|
|
242
|
+
model_config = ConfigDict(extra="allow", validate_assignment=True, use_enum_values=True)
|