codexed 1.2.2__tar.gz → 1.2.6__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.
- {codexed-1.2.2 → codexed-1.2.6}/PKG-INFO +1 -1
- codexed-1.2.6/pyproject.toml +293 -0
- codexed-1.2.2/pyproject.toml → codexed-1.2.6/pyproject.toml.orig +3 -1
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/README.md +9 -3
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/realtime.py +1 -1
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/__init__.py +0 -6
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/misc.py +116 -1
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/request_params.py +25 -9
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/responses.py +24 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/thread_item.py +2 -0
- {codexed-1.2.2 → codexed-1.2.6}/LICENSE +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/README.md +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/__init__.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/__init__.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/account.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/client.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/device.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/dispatch.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/fs.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/marketplace.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/plugin.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/session.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/client/skills.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/exceptions.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/helpers.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/log.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/base.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/codex_types.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/event_data.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/events.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/mcp_server.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/tool_config.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/models/v2_protocol.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/py.typed +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/request_handlers.py +0 -0
- {codexed-1.2.2 → codexed-1.2.6}/src/codexed/transport.py +0 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "codexed"
|
|
3
|
+
version = "1.2.6"
|
|
4
|
+
description = "Alternative codex app-server client"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
keywords = []
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Framework :: Pydantic",
|
|
13
|
+
"Framework :: Pydantic :: 2",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Topic :: Documentation",
|
|
22
|
+
"Topic :: Software Development",
|
|
23
|
+
"Topic :: Utilities",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"anyenv>=2.0.15",
|
|
28
|
+
"mcp>=1.27.0",
|
|
29
|
+
"pydantic",
|
|
30
|
+
"schemez",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[[project.authors]]
|
|
34
|
+
name = "Philipp Temminghoff"
|
|
35
|
+
email = "philipptemminghoff@googlemail.com"
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
"Code coverage" = "https://app.codecov.io/gh/phil65/codexed"
|
|
39
|
+
Discussions = "https://github.com/phil65/codexed/discussions"
|
|
40
|
+
Documentation = "https://phil65.github.io/codexed/"
|
|
41
|
+
Issues = "https://github.com/phil65/codexed/issues"
|
|
42
|
+
Source = "https://github.com/phil65/codexed"
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
websocket = ["websockets>=13.0"]
|
|
46
|
+
|
|
47
|
+
[dependency-groups]
|
|
48
|
+
dev = [
|
|
49
|
+
"devtools",
|
|
50
|
+
"pyreadline3",
|
|
51
|
+
"pytest",
|
|
52
|
+
"pytest-cov",
|
|
53
|
+
"pytest-asyncio>=1.5.0",
|
|
54
|
+
]
|
|
55
|
+
benchmark = ["pyinstrument"]
|
|
56
|
+
docs = [
|
|
57
|
+
"mkdocs-material",
|
|
58
|
+
"mkdocs-mknodes",
|
|
59
|
+
]
|
|
60
|
+
lint = [
|
|
61
|
+
"mypy; python_version >= '3.14'",
|
|
62
|
+
"mypy[faster-cache]; python_version < '3.14'",
|
|
63
|
+
"ruff",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[build-system]
|
|
67
|
+
requires = ["uv_build>=0.8.22"]
|
|
68
|
+
build-backend = "uv_build"
|
|
69
|
+
|
|
70
|
+
[tool.coverage.report]
|
|
71
|
+
exclude_lines = [
|
|
72
|
+
"pragma: no cover",
|
|
73
|
+
"if TYPE_CHECKING:",
|
|
74
|
+
"@overload",
|
|
75
|
+
"except ImportError",
|
|
76
|
+
'if __name__ == "__main__":',
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.mknodes]
|
|
80
|
+
allowed-commit-types = [
|
|
81
|
+
"fix",
|
|
82
|
+
"feat",
|
|
83
|
+
"refactor",
|
|
84
|
+
"docs",
|
|
85
|
+
"test",
|
|
86
|
+
"build",
|
|
87
|
+
"chore",
|
|
88
|
+
]
|
|
89
|
+
docstring-style = "google"
|
|
90
|
+
|
|
91
|
+
[tool.mypy]
|
|
92
|
+
python_version = "3.13"
|
|
93
|
+
disable_error_code = [
|
|
94
|
+
"misc",
|
|
95
|
+
"import",
|
|
96
|
+
]
|
|
97
|
+
pretty = true
|
|
98
|
+
check_untyped_defs = true
|
|
99
|
+
exclude = [
|
|
100
|
+
"venv/",
|
|
101
|
+
".venv/",
|
|
102
|
+
"src/codexed/models/v2_protocol.py",
|
|
103
|
+
]
|
|
104
|
+
plugins = ["pydantic.mypy"]
|
|
105
|
+
|
|
106
|
+
[tool.pyright]
|
|
107
|
+
venvPath = "."
|
|
108
|
+
venv = ".venv"
|
|
109
|
+
pythonVersion = "3.13"
|
|
110
|
+
pythonPlatform = "All"
|
|
111
|
+
typeCheckingMode = "basic"
|
|
112
|
+
deprecateTypingAliases = true
|
|
113
|
+
reportMissingTypeStubs = false
|
|
114
|
+
reportUnusedCallResult = false
|
|
115
|
+
reportUnknownVariableType = false
|
|
116
|
+
reportAny = false
|
|
117
|
+
reportImplicitOverride = false
|
|
118
|
+
reportUnusedFunction = false
|
|
119
|
+
reportImplicitStringConcatenation = false
|
|
120
|
+
reportIgnoreCommentWithoutRule = false
|
|
121
|
+
reportUnannotatedClassAttribute = false
|
|
122
|
+
reportSelfClsParameterName = false
|
|
123
|
+
reportPrivateImportUsage = false
|
|
124
|
+
|
|
125
|
+
[tool.pytest]
|
|
126
|
+
log_cli = true
|
|
127
|
+
log_date_format = "%Y-%m-%d %H:%M:%S"
|
|
128
|
+
log_format = "%(asctime)s %(levelname)s %(message)s"
|
|
129
|
+
minversion = "9.0"
|
|
130
|
+
testpaths = ["tests/"]
|
|
131
|
+
asyncio_mode = "auto"
|
|
132
|
+
|
|
133
|
+
[tool.ruff]
|
|
134
|
+
line-length = 100
|
|
135
|
+
extend-exclude = [
|
|
136
|
+
"docs",
|
|
137
|
+
"src/codexed/models/v2_protocol.py",
|
|
138
|
+
]
|
|
139
|
+
target-version = "py313"
|
|
140
|
+
|
|
141
|
+
[tool.ruff.lint]
|
|
142
|
+
future-annotations = true
|
|
143
|
+
select = [
|
|
144
|
+
"A",
|
|
145
|
+
"B",
|
|
146
|
+
"BLE",
|
|
147
|
+
"C",
|
|
148
|
+
"C4",
|
|
149
|
+
"COM",
|
|
150
|
+
"D",
|
|
151
|
+
"E",
|
|
152
|
+
"EM",
|
|
153
|
+
"EXE",
|
|
154
|
+
"F",
|
|
155
|
+
"FA",
|
|
156
|
+
"FLY",
|
|
157
|
+
"G",
|
|
158
|
+
"I",
|
|
159
|
+
"ICN",
|
|
160
|
+
"INP",
|
|
161
|
+
"INT",
|
|
162
|
+
"ISC",
|
|
163
|
+
"N",
|
|
164
|
+
"PERF",
|
|
165
|
+
"PIE",
|
|
166
|
+
"PLE",
|
|
167
|
+
"PLC",
|
|
168
|
+
"PLR",
|
|
169
|
+
"PT",
|
|
170
|
+
"PTH",
|
|
171
|
+
"PYI",
|
|
172
|
+
"Q",
|
|
173
|
+
"RET",
|
|
174
|
+
"RSE",
|
|
175
|
+
"RUF",
|
|
176
|
+
"SIM",
|
|
177
|
+
"SLF",
|
|
178
|
+
"SLOT",
|
|
179
|
+
"T10",
|
|
180
|
+
"TC",
|
|
181
|
+
"TID",
|
|
182
|
+
"TRY",
|
|
183
|
+
"UP",
|
|
184
|
+
"W",
|
|
185
|
+
"YTT",
|
|
186
|
+
]
|
|
187
|
+
ignore = [
|
|
188
|
+
"C408",
|
|
189
|
+
"B905",
|
|
190
|
+
"C901",
|
|
191
|
+
"COM812",
|
|
192
|
+
"D100",
|
|
193
|
+
"D101",
|
|
194
|
+
"D102",
|
|
195
|
+
"D103",
|
|
196
|
+
"D104",
|
|
197
|
+
"D105",
|
|
198
|
+
"D106",
|
|
199
|
+
"D107",
|
|
200
|
+
"D203",
|
|
201
|
+
"D204",
|
|
202
|
+
"D213",
|
|
203
|
+
"D215",
|
|
204
|
+
"D400",
|
|
205
|
+
"D401",
|
|
206
|
+
"D404",
|
|
207
|
+
"D406",
|
|
208
|
+
"D407",
|
|
209
|
+
"D408",
|
|
210
|
+
"D409",
|
|
211
|
+
"D413",
|
|
212
|
+
"EM101",
|
|
213
|
+
"EM102",
|
|
214
|
+
"ISC001",
|
|
215
|
+
"PLC0415",
|
|
216
|
+
"PLR0912",
|
|
217
|
+
"PLR0913",
|
|
218
|
+
"PLR0917",
|
|
219
|
+
"PLR0915",
|
|
220
|
+
"SLF001",
|
|
221
|
+
"TRY003",
|
|
222
|
+
"TC006",
|
|
223
|
+
]
|
|
224
|
+
|
|
225
|
+
[tool.ruff.lint.flake8-quotes]
|
|
226
|
+
docstring-quotes = "double"
|
|
227
|
+
|
|
228
|
+
[tool.ruff.lint.flake8-type-checking]
|
|
229
|
+
runtime-evaluated-base-classes = [
|
|
230
|
+
"pydantic.BaseModel",
|
|
231
|
+
"sqlalchemy.orm.DeclarativeBase",
|
|
232
|
+
"schemez.Schema",
|
|
233
|
+
"sqlmodel.SQLModel",
|
|
234
|
+
"codexed.models.base.CodexBaseModel",
|
|
235
|
+
]
|
|
236
|
+
runtime-evaluated-decorators = [
|
|
237
|
+
"pydantic.validate_call",
|
|
238
|
+
"fastapi.FastAPI.get",
|
|
239
|
+
"fastapi.FastAPI.post",
|
|
240
|
+
"fastmcp.FastMCP.tool",
|
|
241
|
+
"typer.Typer.command",
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
[tool.ruff.lint.isort]
|
|
245
|
+
lines-after-imports = 2
|
|
246
|
+
force-sort-within-sections = true
|
|
247
|
+
combine-as-imports = true
|
|
248
|
+
|
|
249
|
+
[tool.ruff.lint.mccabe]
|
|
250
|
+
max-complexity = 15
|
|
251
|
+
|
|
252
|
+
[tool.ruff.lint.per-file-ignores]
|
|
253
|
+
"__init__.py" = [
|
|
254
|
+
"E402",
|
|
255
|
+
"I001",
|
|
256
|
+
]
|
|
257
|
+
"scripts/*" = ["INP001"]
|
|
258
|
+
"*tests/*" = ["D100"]
|
|
259
|
+
|
|
260
|
+
[tool.ruff.format]
|
|
261
|
+
preview = true
|
|
262
|
+
|
|
263
|
+
[tool.ty.src]
|
|
264
|
+
exclude = ["src/codexed/models/v2_protocol.py"]
|
|
265
|
+
|
|
266
|
+
[tool.ty.environment]
|
|
267
|
+
python-version = "3.13"
|
|
268
|
+
python-platform = "all"
|
|
269
|
+
|
|
270
|
+
[tool.uv]
|
|
271
|
+
default-groups = [
|
|
272
|
+
"dev",
|
|
273
|
+
"lint",
|
|
274
|
+
"docs",
|
|
275
|
+
]
|
|
276
|
+
|
|
277
|
+
[tool.uv.build-backend]
|
|
278
|
+
wheel-exclude = [
|
|
279
|
+
".mypy_cache/**",
|
|
280
|
+
"__pycache__/**",
|
|
281
|
+
"*.pyc",
|
|
282
|
+
"*.pyo",
|
|
283
|
+
".pytest_cache/**",
|
|
284
|
+
".ruff_cache/**",
|
|
285
|
+
]
|
|
286
|
+
source-exclude = [
|
|
287
|
+
".mypy_cache/**",
|
|
288
|
+
"__pycache__/**",
|
|
289
|
+
"*.pyc",
|
|
290
|
+
"*.pyo",
|
|
291
|
+
".pytest_cache/**",
|
|
292
|
+
".ruff_cache/**",
|
|
293
|
+
]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[project]
|
|
4
4
|
name = "codexed"
|
|
5
|
-
version = "1.2.
|
|
5
|
+
version = "1.2.6"
|
|
6
6
|
description = "Alternative codex app-server client"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
requires-python = ">=3.13"
|
|
@@ -53,6 +53,7 @@ dev = [
|
|
|
53
53
|
"pytest",
|
|
54
54
|
"pytest-cov",
|
|
55
55
|
# Only add below (Copier)
|
|
56
|
+
"pytest-asyncio>=1.5.0",
|
|
56
57
|
]
|
|
57
58
|
benchmark = ["pyinstrument"]
|
|
58
59
|
docs = [
|
|
@@ -227,6 +228,7 @@ ignore = [
|
|
|
227
228
|
"PLC0415",
|
|
228
229
|
"PLR0912", # Too many branches
|
|
229
230
|
"PLR0913", # Too many arguments to function call
|
|
231
|
+
"PLR0917", # Too many positional arguments
|
|
230
232
|
"PLR0915", # Too many statements
|
|
231
233
|
# "PLR2004", # Magic values instead of named consts
|
|
232
234
|
"SLF001", # Private member accessed
|
|
@@ -9,10 +9,11 @@ import asyncio
|
|
|
9
9
|
from codexed import CodexClient
|
|
10
10
|
from codexed.models import ItemAgentMessageDeltaNotification, TurnCompletedEvent
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
async def main():
|
|
13
14
|
async with CodexClient() as client:
|
|
14
15
|
session = await client.thread_start(cwd="/path/to/project")
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
async for event in session.turn_stream("Help me refactor this code"):
|
|
17
18
|
match event:
|
|
18
19
|
case ItemAgentMessageDeltaNotification(data=data):
|
|
@@ -20,6 +21,7 @@ async def main():
|
|
|
20
21
|
case TurnCompletedEvent():
|
|
21
22
|
break
|
|
22
23
|
|
|
24
|
+
|
|
23
25
|
asyncio.run(main())
|
|
24
26
|
```
|
|
25
27
|
|
|
@@ -28,10 +30,12 @@ asyncio.run(main())
|
|
|
28
30
|
```python
|
|
29
31
|
from pydantic import BaseModel
|
|
30
32
|
|
|
33
|
+
|
|
31
34
|
class FileList(BaseModel):
|
|
32
35
|
files: list[str]
|
|
33
36
|
total: int
|
|
34
37
|
|
|
38
|
+
|
|
35
39
|
async with CodexClient() as client:
|
|
36
40
|
session = await client.thread_start(cwd=".")
|
|
37
41
|
result = await session.turn_stream_structured(
|
|
@@ -54,11 +58,13 @@ from codexed.models import (
|
|
|
54
58
|
|
|
55
59
|
async for event in session.turn_stream(message):
|
|
56
60
|
match event:
|
|
57
|
-
case
|
|
61
|
+
case (
|
|
62
|
+
ItemAgentMessageDeltaNotification(data=data)
|
|
63
|
+
| ItemCommandExecutionOutputDeltaNotification(data=data)
|
|
64
|
+
):
|
|
58
65
|
print(data.delta, end="")
|
|
59
66
|
case TurnCompletedEvent():
|
|
60
67
|
break
|
|
61
|
-
|
|
62
68
|
```
|
|
63
69
|
|
|
64
70
|
## See Also
|
|
@@ -108,7 +108,7 @@ class RealtimeSession:
|
|
|
108
108
|
event = await self._queue.get()
|
|
109
109
|
if event is None or isinstance(event, ThreadRealtimeClosedMessage):
|
|
110
110
|
break
|
|
111
|
-
except Exception:
|
|
111
|
+
except Exception:
|
|
112
112
|
logger.debug("Error during realtime cleanup", exc_info=True)
|
|
113
113
|
finally:
|
|
114
114
|
self._client._realtime_queues.pop(self._queue_key, None)
|
|
@@ -562,7 +562,6 @@ __all__ = [
|
|
|
562
562
|
"ConfigWriteResponse",
|
|
563
563
|
"ContentItem",
|
|
564
564
|
"ContextCompactedNotification",
|
|
565
|
-
"ContextCompactedNotification",
|
|
566
565
|
"CreditsSnapshot",
|
|
567
566
|
"CustomReviewTarget",
|
|
568
567
|
"CustomToolCallOutputResponseItem",
|
|
@@ -589,7 +588,6 @@ __all__ = [
|
|
|
589
588
|
"ExternalAgentConfigMigrationItem",
|
|
590
589
|
"ExternalAgentConfigMigrationItemType",
|
|
591
590
|
"ExternalSandboxSandboxPolicy",
|
|
592
|
-
"ExternalSandboxSandboxPolicy",
|
|
593
591
|
"FeedbackUploadParams",
|
|
594
592
|
"FeedbackUploadResponse",
|
|
595
593
|
"FileChangeOutputDeltaNotification",
|
|
@@ -822,13 +820,11 @@ __all__ = [
|
|
|
822
820
|
"TextUserInput",
|
|
823
821
|
"Thread",
|
|
824
822
|
"ThreadActiveFlag",
|
|
825
|
-
"ThreadActiveFlag",
|
|
826
823
|
"ThreadArchiveParams",
|
|
827
824
|
"ThreadArchivedMessage",
|
|
828
825
|
"ThreadArchivedNotification",
|
|
829
826
|
"ThreadCompactStartParams",
|
|
830
827
|
"ThreadCompactedMessage",
|
|
831
|
-
"ThreadCompactedMessage",
|
|
832
828
|
"ThreadForkParams",
|
|
833
829
|
"ThreadInjectItemsParams",
|
|
834
830
|
"ThreadItem",
|
|
@@ -873,7 +869,6 @@ __all__ = [
|
|
|
873
869
|
"ThreadRealtimeOutputAudioDeltaNotification",
|
|
874
870
|
"ThreadRealtimeStartParams",
|
|
875
871
|
"ThreadRealtimeStartResponse",
|
|
876
|
-
"ThreadRealtimeStartResponse",
|
|
877
872
|
"ThreadRealtimeStartTransport",
|
|
878
873
|
"ThreadRealtimeStartedMessage",
|
|
879
874
|
"ThreadRealtimeStartedNotification",
|
|
@@ -903,7 +898,6 @@ __all__ = [
|
|
|
903
898
|
"ThreadTurnsListParams",
|
|
904
899
|
"ThreadTurnsListResponse",
|
|
905
900
|
"ThreadUnarchiveParams",
|
|
906
|
-
"ThreadUnarchiveParams",
|
|
907
901
|
"ThreadUnarchiveResponse",
|
|
908
902
|
"ThreadUnarchivedMessage",
|
|
909
903
|
"ThreadUnsubscribeParams",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any, Literal
|
|
6
6
|
|
|
7
7
|
from mcp.types import Resource, ResourceTemplate, Tool
|
|
8
8
|
from pydantic import Field
|
|
@@ -16,6 +16,7 @@ from codexed.models.v2_protocol import (
|
|
|
16
16
|
McpAuthStatus,
|
|
17
17
|
NetworkApprovalProtocol,
|
|
18
18
|
NetworkDomainPermission,
|
|
19
|
+
ReasoningEffort,
|
|
19
20
|
SessionSource,
|
|
20
21
|
ThreadStatus,
|
|
21
22
|
TurnError,
|
|
@@ -154,6 +155,97 @@ class Turn(CodexBaseModel):
|
|
|
154
155
|
last_unphased = text
|
|
155
156
|
return last_unphased
|
|
156
157
|
|
|
158
|
+
items_view: TurnItemsView | None = None
|
|
159
|
+
"""How completely the turn's items are included in this payload."""
|
|
160
|
+
root_turn_id: str | None = None
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
type TurnItemsView = Literal["notLoaded", "summary", "full"]
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class ThreadStartThreadUnreadPosition(CodexBaseModel):
|
|
167
|
+
"""Explicitly marked unread, including when the thread has no turns."""
|
|
168
|
+
|
|
169
|
+
type: Literal["threadStart"] = "threadStart"
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class TurnThreadUnreadPosition(CodexBaseModel):
|
|
173
|
+
"""The earliest completed result needing attention."""
|
|
174
|
+
|
|
175
|
+
turn_id: str
|
|
176
|
+
type: Literal["turn"] = "turn"
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
type ThreadUnreadPosition = ThreadStartThreadUnreadPosition | TurnThreadUnreadPosition
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class ThreadReadState(CodexBaseModel):
|
|
183
|
+
"""The first unread position in a durable local thread (null position means read)."""
|
|
184
|
+
|
|
185
|
+
first_unread: ThreadUnreadPosition | None = None
|
|
186
|
+
revision: str
|
|
187
|
+
"""Opaque revision guarding edits against activity the caller has not seen."""
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class ThreadEnvironment(CodexBaseModel):
|
|
191
|
+
"""An environment selected by a loaded thread, independent of connection status."""
|
|
192
|
+
|
|
193
|
+
cwd: str
|
|
194
|
+
environment_id: str
|
|
195
|
+
runtime_workspace_roots: list[str]
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class ThreadExtra(CodexBaseModel):
|
|
199
|
+
"""Extra app-server data for a thread."""
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
type ThreadHistoryMode = Literal["legacy", "paginated"]
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class ThreadSectionAppearance(CodexBaseModel):
|
|
206
|
+
"""Extensible visual presentation for a custom thread section."""
|
|
207
|
+
|
|
208
|
+
color: str | None = None
|
|
209
|
+
icon: str | None = None
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class ThreadSection(CodexBaseModel):
|
|
213
|
+
"""An independently persisted, user-visible thread section."""
|
|
214
|
+
|
|
215
|
+
appearance: ThreadSectionAppearance | None = None
|
|
216
|
+
"""Optional appearance synchronized across clients."""
|
|
217
|
+
id: str
|
|
218
|
+
"""Opaque UUIDv7 identity that remains stable when the section is renamed."""
|
|
219
|
+
name: str
|
|
220
|
+
"""The current user-visible section name."""
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class ActivePermissionProfile(CodexBaseModel):
|
|
224
|
+
"""The permissions profile active for a thread."""
|
|
225
|
+
|
|
226
|
+
extends: str | None = None
|
|
227
|
+
"""Parent profile identifier from the selected profile's `extends` setting, if any."""
|
|
228
|
+
id: str
|
|
229
|
+
"""Identifier such as `:workspace` or a user-defined `[permissions.<id>]` profile."""
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
class CustomMultiAgentMode(CodexBaseModel):
|
|
233
|
+
"""Custom multi-agent delegation mode defined by the configured mode hint."""
|
|
234
|
+
|
|
235
|
+
custom: str
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
type MultiAgentMode = Literal["explicitRequestOnly", "proactive"] | CustomMultiAgentMode
|
|
239
|
+
"""Controls the effective multi-agent delegation instructions for a turn."""
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class TurnsPage(CodexBaseModel):
|
|
243
|
+
"""A page of turns."""
|
|
244
|
+
|
|
245
|
+
backwards_cursor: str | None = None
|
|
246
|
+
data: list[Turn]
|
|
247
|
+
next_cursor: str | None = None
|
|
248
|
+
|
|
157
249
|
|
|
158
250
|
class Thread(CodexBaseModel):
|
|
159
251
|
agent_nickname: str | None = None
|
|
@@ -224,6 +316,23 @@ class Thread(CodexBaseModel):
|
|
|
224
316
|
"""
|
|
225
317
|
Unix timestamp (in seconds) when the thread was last updated.
|
|
226
318
|
"""
|
|
319
|
+
attached_to_thread_id: str | None = None
|
|
320
|
+
can_accept_direct_input: bool | None = None
|
|
321
|
+
daybreak_enabled: bool | None = None
|
|
322
|
+
environments: list[ThreadEnvironment] | None = None
|
|
323
|
+
extra: ThreadExtra | None = None
|
|
324
|
+
history_mode: ThreadHistoryMode | None = None
|
|
325
|
+
model: str | None = None
|
|
326
|
+
originator: str | None = None
|
|
327
|
+
parent_thread_id: str | None = None
|
|
328
|
+
project_id: str | None = None
|
|
329
|
+
reasoning_effort: ReasoningEffort | None = None
|
|
330
|
+
recency_at: int | None = None
|
|
331
|
+
"""Unix timestamp (in seconds) used to order threads by recency."""
|
|
332
|
+
section: ThreadSection | None = None
|
|
333
|
+
section_entered_at: int | None = None
|
|
334
|
+
session_id: str | None = None
|
|
335
|
+
thread_source: str | None = None
|
|
227
336
|
|
|
228
337
|
|
|
229
338
|
class TurnData(CodexBaseModel):
|
|
@@ -234,6 +343,12 @@ class TurnData(CodexBaseModel):
|
|
|
234
343
|
thread_id: str | None = None
|
|
235
344
|
items: list[ThreadItem] = Field(default_factory=list)
|
|
236
345
|
error: str | None = None
|
|
346
|
+
items_view: TurnItemsView | None = None
|
|
347
|
+
"""How completely the turn's items are included in this payload."""
|
|
348
|
+
root_turn_id: str | None = None
|
|
349
|
+
started_at: int | None = None
|
|
350
|
+
completed_at: int | None = None
|
|
351
|
+
duration_ms: int | None = None
|
|
237
352
|
|
|
238
353
|
|
|
239
354
|
class McpServerStatusEntry(CodexBaseModel):
|
|
@@ -16,7 +16,7 @@ from codexed.models.v2_protocol import CommandAction
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
if TYPE_CHECKING:
|
|
19
|
-
from mcp.types import ElicitRequestFormParams, ElicitRequestURLParams
|
|
19
|
+
from mcp.types import ElicitRequestFormParams, ElicitRequestURLParams, RequestParamsMeta
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
HazelnutScope = Literal["example", "workspace-shared", "all-shared", "personal"]
|
|
@@ -120,6 +120,22 @@ class ToolApprovalMeta(TypedDict, total=False):
|
|
|
120
120
|
connector_description: str
|
|
121
121
|
|
|
122
122
|
|
|
123
|
+
def _to_mcp_meta(meta: Any) -> RequestParamsMeta | None:
|
|
124
|
+
"""Convert elicitation metadata to an MCP request `_meta` mapping."""
|
|
125
|
+
if not meta:
|
|
126
|
+
return None
|
|
127
|
+
from mcp.types import RequestParamsMeta
|
|
128
|
+
|
|
129
|
+
return TypeAdapter(RequestParamsMeta).validate_python(meta)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def _from_mcp_meta(meta: RequestParamsMeta | None) -> dict[str, Any] | None:
|
|
133
|
+
"""Convert an MCP request `_meta` mapping to elicitation metadata (without progress token)."""
|
|
134
|
+
if meta is None:
|
|
135
|
+
return None
|
|
136
|
+
return {key: value for key, value in meta.items() if key != "progress_token"}
|
|
137
|
+
|
|
138
|
+
|
|
123
139
|
class _McpElicitationBase(CodexBaseModel):
|
|
124
140
|
"""Common fields for MCP elicitation requests."""
|
|
125
141
|
|
|
@@ -142,8 +158,8 @@ class McpElicitationFormParams(_McpElicitationBase):
|
|
|
142
158
|
|
|
143
159
|
return ElicitRequestFormParams(
|
|
144
160
|
message=self.message,
|
|
145
|
-
|
|
146
|
-
meta=
|
|
161
|
+
requested_schema=self.requested_schema,
|
|
162
|
+
meta=_to_mcp_meta(self.meta),
|
|
147
163
|
)
|
|
148
164
|
|
|
149
165
|
@classmethod
|
|
@@ -157,8 +173,8 @@ class McpElicitationFormParams(_McpElicitationBase):
|
|
|
157
173
|
"""Create from MCP ElicitRequestFormParams."""
|
|
158
174
|
return cls(
|
|
159
175
|
message=params.message,
|
|
160
|
-
requested_schema=dict(params.
|
|
161
|
-
meta=params.meta
|
|
176
|
+
requested_schema=dict(params.requested_schema),
|
|
177
|
+
meta=_from_mcp_meta(params.meta),
|
|
162
178
|
thread_id=thread_id,
|
|
163
179
|
server_name=server_name,
|
|
164
180
|
turn_id=turn_id,
|
|
@@ -178,8 +194,8 @@ class McpElicitationUrlParams(_McpElicitationBase):
|
|
|
178
194
|
return ElicitRequestURLParams(
|
|
179
195
|
message=self.message,
|
|
180
196
|
url=self.url,
|
|
181
|
-
|
|
182
|
-
meta=
|
|
197
|
+
elicitation_id=self.elicitation_id,
|
|
198
|
+
meta=_to_mcp_meta(self.meta),
|
|
183
199
|
)
|
|
184
200
|
|
|
185
201
|
@classmethod
|
|
@@ -194,8 +210,8 @@ class McpElicitationUrlParams(_McpElicitationBase):
|
|
|
194
210
|
return cls(
|
|
195
211
|
message=params.message,
|
|
196
212
|
url=params.url,
|
|
197
|
-
elicitation_id=params.
|
|
198
|
-
meta=params.meta
|
|
213
|
+
elicitation_id=params.elicitation_id,
|
|
214
|
+
meta=_from_mcp_meta(params.meta),
|
|
199
215
|
thread_id=thread_id,
|
|
200
216
|
server_name=server_name,
|
|
201
217
|
turn_id=turn_id,
|
|
@@ -5,14 +5,20 @@ from typing import TYPE_CHECKING, Any
|
|
|
5
5
|
from codexed.models.base import CodexBaseModel
|
|
6
6
|
from codexed.models.codex_types import ApprovalDecision, ElicitationAction
|
|
7
7
|
from codexed.models.misc import (
|
|
8
|
+
ActivePermissionProfile,
|
|
8
9
|
McpServerStatusEntry,
|
|
10
|
+
MultiAgentMode,
|
|
9
11
|
Thread,
|
|
12
|
+
ThreadReadState,
|
|
10
13
|
ToolRequestUserInputAnswer,
|
|
11
14
|
Turn,
|
|
12
15
|
TurnData,
|
|
16
|
+
TurnsPage,
|
|
13
17
|
)
|
|
14
18
|
from codexed.models.v2_protocol import (
|
|
19
|
+
ApprovalsReviewer,
|
|
15
20
|
AskForApproval,
|
|
21
|
+
CollaborationMode,
|
|
16
22
|
DynamicToolCallOutputContentItem,
|
|
17
23
|
ReasoningEffort,
|
|
18
24
|
SandboxPolicy,
|
|
@@ -79,6 +85,7 @@ class ThreadReadResponse(CodexBaseModel):
|
|
|
79
85
|
"""Response for thread/read request."""
|
|
80
86
|
|
|
81
87
|
thread: Thread
|
|
88
|
+
read_state: ThreadReadState | None = None
|
|
82
89
|
|
|
83
90
|
|
|
84
91
|
class ThreadResponse(CodexBaseModel):
|
|
@@ -92,6 +99,20 @@ class ThreadResponse(CodexBaseModel):
|
|
|
92
99
|
sandbox: SandboxPolicy
|
|
93
100
|
reasoning_effort: ReasoningEffort | None = None
|
|
94
101
|
service_tier: ServiceTier | None = None
|
|
102
|
+
active_permission_profile: ActivePermissionProfile | None = None
|
|
103
|
+
approvals_reviewer: ApprovalsReviewer | None = None
|
|
104
|
+
collaboration_mode: CollaborationMode | None = None
|
|
105
|
+
"""Only returned by thread/resume."""
|
|
106
|
+
disabled_plugin_ids: list[str] | None = None
|
|
107
|
+
initial_turns_page: TurnsPage | None = None
|
|
108
|
+
"""Only returned by thread/resume."""
|
|
109
|
+
instruction_sources: list[str] | None = None
|
|
110
|
+
items_backwards_cursor: str | None = None
|
|
111
|
+
"""Only returned by thread/resume."""
|
|
112
|
+
multi_agent_mode: MultiAgentMode | None = None
|
|
113
|
+
runtime_workspace_roots: list[str] | None = None
|
|
114
|
+
turns_backwards_cursor: str | None = None
|
|
115
|
+
"""Only returned by thread/resume."""
|
|
95
116
|
|
|
96
117
|
|
|
97
118
|
class TurnStartResponse(CodexBaseModel):
|
|
@@ -112,6 +133,9 @@ class ThreadListResponse(CodexBaseModel):
|
|
|
112
133
|
|
|
113
134
|
data: list[Thread]
|
|
114
135
|
next_cursor: str | None = None
|
|
136
|
+
backwards_cursor: str | None = None
|
|
137
|
+
read_states: dict[str, ThreadReadState] | None = None
|
|
138
|
+
"""Read state per thread ID."""
|
|
115
139
|
|
|
116
140
|
|
|
117
141
|
class ThreadRollbackResponse(CodexBaseModel):
|
|
@@ -30,6 +30,8 @@ class McpToolCallResult(CodexBaseModel):
|
|
|
30
30
|
|
|
31
31
|
content: list[ContentBlock]
|
|
32
32
|
structured_content: Any = None
|
|
33
|
+
meta: dict[str, Any] | None = Field(default=None, alias="_meta")
|
|
34
|
+
"""MCP `_meta` field of the tool result."""
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
class BaseThreadItem(CodexBaseModel):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|