codexed 1.2.2__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {codexed-1.2.2 → codexed-1.3.0}/PKG-INFO +1 -1
  2. codexed-1.3.0/pyproject.toml +293 -0
  3. codexed-1.2.2/pyproject.toml → codexed-1.3.0/pyproject.toml.orig +3 -1
  4. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/README.md +9 -3
  5. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/__init__.py +2 -2
  6. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/__init__.py +0 -2
  7. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/client.py +22 -33
  8. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/realtime.py +7 -7
  9. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/session.py +29 -51
  10. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/__init__.py +14 -30
  11. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/event_data.py +8 -0
  12. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/events.py +102 -44
  13. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/misc.py +42 -1
  14. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/request_params.py +25 -9
  15. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/responses.py +32 -6
  16. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/thread_item.py +92 -0
  17. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/tool_config.py +3 -3
  18. codexed-1.3.0/src/codexed/models/v2_protocol.py +13355 -0
  19. codexed-1.2.2/src/codexed/client/device.py +0 -67
  20. codexed-1.2.2/src/codexed/models/v2_protocol.py +0 -6475
  21. {codexed-1.2.2 → codexed-1.3.0}/LICENSE +0 -0
  22. {codexed-1.2.2 → codexed-1.3.0}/README.md +0 -0
  23. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/account.py +0 -0
  24. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/dispatch.py +0 -0
  25. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/fs.py +0 -0
  26. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/marketplace.py +0 -0
  27. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/plugin.py +0 -0
  28. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/client/skills.py +0 -0
  29. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/exceptions.py +0 -0
  30. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/helpers.py +0 -0
  31. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/log.py +0 -0
  32. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/base.py +0 -0
  33. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/codex_types.py +0 -0
  34. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/models/mcp_server.py +0 -0
  35. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/py.typed +0 -0
  36. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/request_handlers.py +0 -0
  37. {codexed-1.2.2 → codexed-1.3.0}/src/codexed/transport.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codexed
3
- Version: 1.2.2
3
+ Version: 1.3.0
4
4
  Summary: Alternative codex app-server client
5
5
  Keywords:
6
6
  Author: Philipp Temminghoff
@@ -0,0 +1,293 @@
1
+ [project]
2
+ name = "codexed"
3
+ version = "1.3.0"
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.2"
5
+ version = "1.3.0"
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 ItemAgentMessageDeltaNotification(data=data) | ItemCommandExecutionOutputDeltaNotification(data=data):
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
@@ -53,7 +53,7 @@ from codexed.models import (
53
53
  ThreadNameUpdatedNotification,
54
54
  ThreadReadResponse,
55
55
  ThreadResponse,
56
- ThreadRollbackResponse,
56
+ ThreadRevertResponse,
57
57
  ThreadStartedData,
58
58
  ThreadStatusChangedNotification,
59
59
  ThreadTokenUsage,
@@ -228,7 +228,7 @@ __all__ = [
228
228
  "ThreadNameUpdatedNotification",
229
229
  "ThreadReadResponse",
230
230
  "ThreadResponse",
231
- "ThreadRollbackResponse",
231
+ "ThreadRevertResponse",
232
232
  "ThreadSortKey",
233
233
  "ThreadSourceKind",
234
234
  "ThreadStartedData",
@@ -5,13 +5,11 @@ from .fs import CodexFS
5
5
  from .skills import CodexSkills
6
6
  from .plugin import CodexPlugin
7
7
  from .marketplace import CodexMarketPlace
8
- from .device import CodexDevice
9
8
  from .realtime import RealtimeSession
10
9
  from .session import Session
11
10
 
12
11
  __all__ = [
13
12
  "CodexClient",
14
- "CodexDevice",
15
13
  "CodexFS",
16
14
  "CodexMarketPlace",
17
15
  "CodexPlugin",
@@ -10,7 +10,6 @@ from typing import TYPE_CHECKING, Any
10
10
  from pydantic import TypeAdapter
11
11
 
12
12
  from codexed.client.account import CodexAccount
13
- from codexed.client.device import CodexDevice
14
13
  from codexed.client.dispatch import Dispatch
15
14
  from codexed.client.fs import CodexFS
16
15
  from codexed.client.marketplace import CodexMarketPlace
@@ -90,11 +89,9 @@ if TYPE_CHECKING:
90
89
  McpServerConfig,
91
90
  McpServerStatusDetail,
92
91
  MergeStrategy,
93
- PermissionProfile,
94
92
  Personality,
95
93
  SandboxMode,
96
94
  SandboxPolicy,
97
- ServiceTier,
98
95
  SortDirection,
99
96
  ThreadSortKey,
100
97
  ThreadSourceKind,
@@ -184,7 +181,6 @@ class CodexClient:
184
181
  self._server_request_handlers: dict[str, ServerRequestHandler] = {}
185
182
  self.account = CodexAccount(self)
186
183
  self.fs = CodexFS(self)
187
- self.device = CodexDevice(self)
188
184
  self.plugins = CodexPlugin(self)
189
185
  self.marketplace = CodexMarketPlace(self)
190
186
  self.skills = CodexSkills(self)
@@ -236,13 +232,12 @@ class CodexClient:
236
232
  tools: list[ToolConfig] | None = None,
237
233
  code_mode: bool | None = None,
238
234
  service_name: str | None = None,
239
- service_tier: ServiceTier | None = None,
235
+ service_tier: str | None = None,
240
236
  personality: Personality | None = None,
241
237
  ephemeral: bool | None = None,
242
238
  dynamic_tools: list[DynamicToolSpec] | None = None,
243
239
  mcp_servers: Mapping[str, McpServerConfig] | None = None,
244
240
  experimental_raw_events: bool = False,
245
- persist_extended_history: bool = False,
246
241
  session_start_source: ThreadStartSource | None = None,
247
242
  environments: list[TurnEnvironmentParams] | None = None,
248
243
  ) -> Session:
@@ -263,14 +258,13 @@ class CodexClient:
263
258
  exactly those tools. Merged into ``config``.
264
259
  code_mode: Enable experimental code mode feature flag
265
260
  service_name: Optional service name
266
- service_tier: Service tier (fast/flex)
261
+ service_tier: Service tier
267
262
  personality: Personality preset (none, friendly, pragmatic)
268
263
  ephemeral: If true, thread is not persisted to disk
269
264
  dynamic_tools: Dynamic tool specifications
270
265
  mcp_servers: Per-thread MCP server configurations.
271
266
  Merged into ``config`` under the ``mcp_servers`` key.
272
267
  experimental_raw_events: Emit raw Responses API items (internal)
273
- persist_extended_history: Persist full history for resume/fork/read
274
268
  session_start_source: Source of the session start
275
269
  environments: List of environment variables to set for the thread
276
270
 
@@ -302,7 +296,6 @@ class CodexClient:
302
296
  ephemeral=ephemeral,
303
297
  dynamic_tools=dynamic_tools,
304
298
  experimental_raw_events=experimental_raw_events,
305
- persist_extended_history=persist_extended_history,
306
299
  session_start_source=session_start_source,
307
300
  environments=environments,
308
301
  )
@@ -327,12 +320,11 @@ class CodexClient:
327
320
  config: dict[str, Any] | None = None,
328
321
  tools: list[ToolConfig] | None = None,
329
322
  code_mode: bool | None = None,
330
- service_tier: ServiceTier | None = None,
323
+ service_tier: str | None = None,
331
324
  personality: Personality | None = None,
332
325
  mcp_servers: Mapping[str, McpServerConfig] | None = None,
333
- persist_extended_history: bool = False,
334
326
  exclude_turns: bool | None = None,
335
- permission_profile: PermissionProfile | None = None,
327
+ permissions: str | None = None,
336
328
  ) -> Session:
337
329
  """Resume an existing thread by ID.
338
330
 
@@ -350,12 +342,11 @@ class CodexClient:
350
342
  config: Additional configuration overrides
351
343
  tools: Builtin tool configurations override
352
344
  code_mode: Enable experimental code mode feature flag
353
- service_tier: Service tier (fast/flex)
345
+ service_tier: Service tier
354
346
  personality: Personality override
355
347
  mcp_servers: Per-thread MCP server configurations
356
- persist_extended_history: Persist full history for resume/fork/read
357
348
  exclude_turns: If true, exclude turns from the thread's history
358
- permission_profile: Permission profile override
349
+ permissions: Named permissions profile ID (cannot be combined with sandbox)
359
350
 
360
351
  Returns:
361
352
  Session wrapping the resumed thread
@@ -383,9 +374,8 @@ class CodexClient:
383
374
  config=cfg,
384
375
  service_tier=service_tier,
385
376
  personality=personality,
386
- persist_extended_history=persist_extended_history,
387
377
  exclude_turns=exclude_turns,
388
- permission_profile=permission_profile,
378
+ permissions=permissions,
389
379
  )
390
380
  result = await self.dispatch.send_request("thread/resume", params)
391
381
  response = ThreadResponse.model_validate(result)
@@ -408,13 +398,13 @@ class CodexClient:
408
398
  config: dict[str, Any] | None = None,
409
399
  tools: list[ToolConfig] | None = None,
410
400
  code_mode: bool | None = None,
411
- service_tier: ServiceTier | None = None,
401
+ service_tier: str | None = None,
412
402
  ephemeral: bool | None = None,
413
403
  mcp_servers: Mapping[str, McpServerConfig] | None = None,
414
- turn_id: str | None = None,
415
- persist_extended_history: bool = False,
404
+ last_turn_id: str | None = None,
405
+ before_turn_id: str | None = None,
416
406
  exclude_turns: bool | None = None,
417
- permission_profile: PermissionProfile | None = None,
407
+ permissions: str | None = None,
418
408
  ) -> Session:
419
409
  """Fork an existing thread into a new thread with copied history.
420
410
 
@@ -432,16 +422,16 @@ class CodexClient:
432
422
  config: Additional configuration overrides
433
423
  tools: Builtin tool configurations for forked thread
434
424
  code_mode: Enable experimental code mode feature flag
435
- service_tier: Service tier (fast/flex)
425
+ service_tier: Service tier
436
426
  personality: Personality for forked thread
437
427
  ephemeral: If true, forked thread is not persisted
438
428
  mcp_servers: Per-thread MCP server configurations
439
- turn_id: If provided, rollback the forked thread to this turn
440
- persist_extended_history: Persist full history for resume/fork/read
429
+ last_turn_id: Fork through this turn (inclusive), omitting later turns
430
+ before_turn_id: Fork before this turn, excluding it and all later turns
441
431
  exclude_turns: When true, return only thread metadata and live fork state
442
432
  without populating `thread.turns`. This is useful when
443
433
  the client plans to call `thread/turns/list` immediately after forking.
444
- permission_profile: Permission profile for forked thread
434
+ permissions: Named permissions profile ID (cannot be combined with sandbox)
445
435
 
446
436
  Returns:
447
437
  Session wrapping the new forked thread
@@ -469,17 +459,15 @@ class CodexClient:
469
459
  config=cfg,
470
460
  service_tier=service_tier,
471
461
  ephemeral=ephemeral,
472
- persist_extended_history=persist_extended_history,
462
+ last_turn_id=last_turn_id,
463
+ before_turn_id=before_turn_id,
473
464
  exclude_turns=exclude_turns,
474
- permission_profile=permission_profile,
465
+ permissions=permissions,
475
466
  )
476
467
  result = await self.dispatch.send_request("thread/fork", params)
477
468
  response = ThreadResponse.model_validate(result)
478
469
  self._active_threads.add(response.thread.id)
479
- session = Session(self, response)
480
- if turn_id is not None:
481
- await session.rollback_to_turn(turn_id)
482
- return session
470
+ return Session(self, response)
483
471
 
484
472
  async def thread_list(
485
473
  self,
@@ -593,7 +581,7 @@ class CodexClient:
593
581
  sandbox_policy: SandboxPolicy | None = None,
594
582
  output_bytes_cap: int | None = None,
595
583
  timeout_ms: int | None = None,
596
- permission_profile: PermissionProfile | None = None,
584
+ permission_profile: str | None = None,
597
585
  ) -> CommandExecResponse:
598
586
  """Execute a command without creating a thread/turn.
599
587
 
@@ -603,7 +591,8 @@ class CodexClient:
603
591
  sandbox_policy: Sandbox policy override
604
592
  output_bytes_cap: Cap output based on bytes
605
593
  timeout_ms: Timeout in milliseconds
606
- permission_profile: Permission profile override
594
+ permission_profile: Named permissions profile ID
595
+ (cannot be combined with sandbox_policy)
607
596
 
608
597
  Returns:
609
598
  CommandExecResponse with exit_code, stdout, stderr
@@ -49,14 +49,14 @@ class RealtimeSession:
49
49
  output_modality: RealtimeOutputModality,
50
50
  prompt: str | None = None,
51
51
  *,
52
- session_id: str | None = None,
52
+ realtime_session_id: str | None = None,
53
53
  transport: ThreadRealtimeStartTransport | None = None,
54
54
  voice: RealtimeVoice | None = None,
55
55
  ) -> None:
56
56
  self._client = client
57
57
  self._thread_id = thread_id
58
58
  self._prompt = prompt
59
- self._session_id = session_id
59
+ self._session_id = realtime_session_id
60
60
  self._queue: asyncio.Queue[CodexEvent | None] = asyncio.Queue()
61
61
  self._closed = False
62
62
  self._queue_key = f"realtime:{thread_id}"
@@ -69,7 +69,7 @@ class RealtimeSession:
69
69
  return self._thread_id
70
70
 
71
71
  @property
72
- def session_id(self) -> str | None:
72
+ def realtime_session_id(self) -> str | None:
73
73
  return self._session_id
74
74
 
75
75
  async def __aenter__(self) -> Self:
@@ -80,7 +80,7 @@ class RealtimeSession:
80
80
  params = ThreadRealtimeStartParams(
81
81
  thread_id=self._thread_id,
82
82
  prompt=self._prompt,
83
- session_id=self._session_id,
83
+ realtime_session_id=self._session_id,
84
84
  output_modality=self._output_modality,
85
85
  )
86
86
  result = await self._client.dispatch.send_request("thread/realtime/start", params)
@@ -89,7 +89,7 @@ class RealtimeSession:
89
89
  # Wait for the started notification
90
90
  event = await self._queue.get()
91
91
  if isinstance(event, ThreadRealtimeStartedMessage):
92
- self._session_id = event.params.session_id
92
+ self._session_id = event.params.realtime_session_id
93
93
  return self
94
94
 
95
95
  async def __aexit__(
@@ -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: # noqa: BLE001
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)
@@ -175,5 +175,5 @@ class RealtimeSession:
175
175
  state = "closed" if self._closed else "active"
176
176
  return (
177
177
  f"RealtimeSession(thread_id={self._thread_id!r}, "
178
- f"session_id={self._session_id!r}, {state})"
178
+ f"realtime_session_id={self._session_id!r}, {state})"
179
179
  )