codexed 1.2.6__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.6 → codexed-1.3.0}/PKG-INFO +1 -1
  2. {codexed-1.2.6 → codexed-1.3.0}/pyproject.toml +1 -1
  3. {codexed-1.2.6 → codexed-1.3.0}/pyproject.toml.orig +1 -1
  4. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/__init__.py +2 -2
  5. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/__init__.py +0 -2
  6. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/client.py +22 -33
  7. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/realtime.py +6 -6
  8. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/session.py +29 -51
  9. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/__init__.py +14 -24
  10. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/event_data.py +8 -0
  11. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/events.py +102 -44
  12. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/misc.py +7 -81
  13. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/responses.py +11 -9
  14. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/thread_item.py +90 -0
  15. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/tool_config.py +3 -3
  16. codexed-1.3.0/src/codexed/models/v2_protocol.py +13355 -0
  17. codexed-1.2.6/src/codexed/client/device.py +0 -67
  18. codexed-1.2.6/src/codexed/models/v2_protocol.py +0 -6475
  19. {codexed-1.2.6 → codexed-1.3.0}/LICENSE +0 -0
  20. {codexed-1.2.6 → codexed-1.3.0}/README.md +0 -0
  21. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/README.md +0 -0
  22. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/account.py +0 -0
  23. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/dispatch.py +0 -0
  24. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/fs.py +0 -0
  25. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/marketplace.py +0 -0
  26. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/plugin.py +0 -0
  27. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/client/skills.py +0 -0
  28. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/exceptions.py +0 -0
  29. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/helpers.py +0 -0
  30. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/log.py +0 -0
  31. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/base.py +0 -0
  32. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/codex_types.py +0 -0
  33. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/mcp_server.py +0 -0
  34. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/models/request_params.py +0 -0
  35. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/py.typed +0 -0
  36. {codexed-1.2.6 → codexed-1.3.0}/src/codexed/request_handlers.py +0 -0
  37. {codexed-1.2.6 → 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.6
3
+ Version: 1.3.0
4
4
  Summary: Alternative codex app-server client
5
5
  Keywords:
6
6
  Author: Philipp Temminghoff
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codexed"
3
- version = "1.2.6"
3
+ version = "1.3.0"
4
4
  description = "Alternative codex app-server client"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "codexed"
5
- version = "1.2.6"
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,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__(
@@ -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
  )
@@ -33,8 +33,8 @@ from codexed.models import (
33
33
  ThreadMemoryModeSetParams,
34
34
  ThreadReadParams,
35
35
  ThreadReadResponse,
36
- ThreadRollbackParams,
37
- ThreadRollbackResponse,
36
+ ThreadRevertParams,
37
+ ThreadRevertResponse,
38
38
  ThreadSetNameParams,
39
39
  ThreadShellCommandParams,
40
40
  ThreadTokenUsageUpdatedEvent,
@@ -72,7 +72,6 @@ if TYPE_CHECKING:
72
72
  CodexEvent,
73
73
  CollaborationMode,
74
74
  McpServerConfig,
75
- PermissionProfile,
76
75
  Personality,
77
76
  RealtimeOutputModality,
78
77
  ReasoningEffort,
@@ -80,7 +79,6 @@ if TYPE_CHECKING:
80
79
  ReviewDelivery,
81
80
  ReviewTarget,
82
81
  SandboxMode,
83
- ServiceTier,
84
82
  SortDirection,
85
83
  ThreadMemoryMode,
86
84
  ThreadResponse,
@@ -135,12 +133,12 @@ class Session:
135
133
  sandbox_policy: SandboxMode | SandboxPolicy | None = None,
136
134
  output_schema: dict[str, Any] | type[Any] | None = None,
137
135
  personality: Personality | None = None,
138
- service_tier: ServiceTier | None = None,
136
+ service_tier: str | None = None,
139
137
  summary: ReasoningSummary | None = None,
140
138
  collaboration_mode: CollaborationMode | None = None,
141
139
  responsesapi_client_metadata: dict[str, Any] | None = None,
142
140
  environments: list[TurnEnvironmentParams] | None = None,
143
- permission_profile: PermissionProfile | None = None,
141
+ permissions: str | None = None,
144
142
  ) -> AsyncIterator[CodexEvent]:
145
143
  """Start a turn and stream events.
146
144
 
@@ -159,7 +157,7 @@ class Session:
159
157
  collaboration_mode: Optional collaboration mode preset (experimental)
160
158
  responsesapi_client_metadata: Optional turn-scoped Responses API client metadata.
161
159
  environments: Optional list of environment variables to set for this turn.
162
- permission_profile: Optional permission profile to use for this turn.
160
+ permissions: Named permissions profile ID (cannot be combined with sandbox)
163
161
 
164
162
  Yields:
165
163
  CodexEvent: Streaming events from the turn
@@ -209,7 +207,7 @@ class Session:
209
207
  collaboration_mode=collaboration_mode,
210
208
  responsesapi_client_metadata=responsesapi_client_metadata,
211
209
  environments=environments,
212
- permission_profile=permission_profile,
210
+ permissions=permissions,
213
211
  )
214
212
  turn_result = await self._client.dispatch.send_request("turn/start", params)
215
213
  response = TurnStartResponse.model_validate(turn_result)
@@ -285,7 +283,7 @@ class Session:
285
283
  cwd: str | None = None,
286
284
  sandbox_policy: SandboxMode | SandboxPolicy | None = None,
287
285
  personality: Personality | None = None,
288
- service_tier: ServiceTier | None = None,
286
+ service_tier: str | None = None,
289
287
  summary: ReasoningSummary | None = None,
290
288
  collaboration_mode: CollaborationMode | None = None,
291
289
  ) -> ResultType:
@@ -377,7 +375,7 @@ class Session:
377
375
  output_modality: RealtimeOutputModality,
378
376
  prompt: str | None = None,
379
377
  *,
380
- session_id: str | None = None,
378
+ realtime_session_id: str | None = None,
381
379
  ) -> RealtimeSession:
382
380
  """Open a realtime voice session on this thread.
383
381
 
@@ -397,7 +395,7 @@ class Session:
397
395
  self.thread_id,
398
396
  output_modality=output_modality,
399
397
  prompt=prompt,
400
- session_id=session_id,
398
+ realtime_session_id=realtime_session_id,
401
399
  )
402
400
 
403
401
  async def list_turns(
@@ -416,41 +414,21 @@ class Session:
416
414
  result = await self._client.dispatch.send_request("thread/turns/list", params)
417
415
  return ThreadTurnsListResponse.model_validate(result)
418
416
 
419
- async def rollback(self, turns: int) -> ThreadRollbackResponse:
420
- """Rollback the last N turns from this thread.
417
+ async def revert(self, before_turn_id: str) -> ThreadRevertResponse:
418
+ """Replace the thread's persisted history with the turns before `before_turn_id`.
421
419
 
422
- Args:
423
- turns: Number of turns to rollback
424
-
425
- Returns:
426
- Updated thread object with turns populated
427
- """
428
- params = ThreadRollbackParams(thread_id=self.thread_id, num_turns=turns)
429
- result = await self._client.dispatch.send_request("thread/rollback", params)
430
- return ThreadRollbackResponse.model_validate(result)
431
-
432
- async def rollback_to_turn(self, turn_id: str) -> ThreadRollbackResponse:
433
- """Rollback to a specific turn, keeping that turn and removing all after it.
420
+ The given turn and all later turns are dropped. Only conversation history
421
+ changes; local file changes are not reverted.
434
422
 
435
423
  Args:
436
- turn_id: The turn ID to roll back to (this turn will be kept)
424
+ before_turn_id: First turn to drop (it and every later turn are removed)
437
425
 
438
426
  Returns:
439
- Updated thread object with turns populated
440
-
441
- Raises:
442
- ValueError: If the turn_id is not found in the thread
427
+ Updated thread metadata and cursors for re-hydrating the retained history
443
428
  """
444
- thread_response = await self.read(include_turns=True)
445
- turns = thread_response.thread.turns
446
- turn_index = next((i for i, turn in enumerate(turns) if turn.id == turn_id), None)
447
- if turn_index is None:
448
- raise ValueError(f"Turn {turn_id!r} not found in thread {self.thread_id!r}")
449
- num_turns_to_drop = len(turns) - turn_index - 1
450
- if num_turns_to_drop < 1:
451
- msg = f"Turn {turn_id!r} is already the last turn in thread {self.thread_id!r}"
452
- raise ValueError(msg)
453
- return await self.rollback(num_turns_to_drop)
429
+ params = ThreadRevertParams(thread_id=self.thread_id, before_turn_id=before_turn_id)
430
+ result = await self._client.dispatch.send_request("thread/revert", params)
431
+ return ThreadRevertResponse.model_validate(result)
454
432
 
455
433
  async def shell_command(self, command: str) -> None:
456
434
  """Run a user-initiated shell command against this thread.
@@ -551,13 +529,13 @@ class Session:
551
529
  config: dict[str, Any] | None = None,
552
530
  tools: list[ToolConfig] | None = None,
553
531
  code_mode: bool | None = None,
554
- service_tier: ServiceTier | None = None,
532
+ service_tier: str | None = None,
555
533
  ephemeral: bool | None = None,
556
534
  mcp_servers: Mapping[str, McpServerConfig] | None = None,
557
- turn_id: str | None = None,
558
- persist_extended_history: bool = False,
535
+ last_turn_id: str | None = None,
536
+ before_turn_id: str | None = None,
559
537
  exclude_turns: bool | None = None,
560
- permission_profile: PermissionProfile | None = None,
538
+ permissions: str | None = None,
561
539
  ) -> Session:
562
540
  """Fork this thread into a new thread with copied history.
563
541
 
@@ -574,15 +552,15 @@ class Session:
574
552
  config: Additional configuration overrides
575
553
  tools: Builtin tool configurations for forked thread
576
554
  code_mode: Enable experimental code mode feature flag
577
- service_tier: Service tier (fast/flex)
555
+ service_tier: Service tier
578
556
  ephemeral: If true, forked thread is not persisted
579
557
  mcp_servers: Per-thread MCP server configurations
580
- turn_id: If provided, rollback the forked thread to this turn
581
- persist_extended_history: Persist full history for resume/fork/read
558
+ last_turn_id: Fork through this turn (inclusive), omitting later turns
559
+ before_turn_id: Fork before this turn, excluding it and all later turns
582
560
  exclude_turns: When true, return only thread metadata and live fork state
583
561
  without populating `thread.turns`. This is useful when
584
562
  the client plans to call `thread/turns/list` immediately after forking.
585
- permission_profile: Permission profile for forked thread
563
+ permissions: Named permissions profile ID (cannot be combined with sandbox)
586
564
 
587
565
  Returns:
588
566
  Session wrapping the new forked thread
@@ -604,10 +582,10 @@ class Session:
604
582
  service_tier=service_tier,
605
583
  ephemeral=ephemeral,
606
584
  mcp_servers=mcp_servers,
607
- turn_id=turn_id,
608
- persist_extended_history=persist_extended_history,
585
+ last_turn_id=last_turn_id,
586
+ before_turn_id=before_turn_id,
609
587
  exclude_turns=exclude_turns,
610
- permission_profile=permission_profile,
588
+ permissions=permissions,
611
589
  )
612
590
 
613
591
  async def read_resource(self, server: str, uri: str) -> list[ResourceContents]:
@@ -30,7 +30,6 @@ from codexed.models.events import (
30
30
  DeltaEvent,
31
31
  ItemCompletedEvent,
32
32
  ItemStartedEvent,
33
- RawResponseItemCompletedEvent,
34
33
  ThreadStartedEvent,
35
34
  ThreadTokenUsageUpdatedEvent,
36
35
  TurnCompletedEvent,
@@ -80,7 +79,7 @@ from codexed.models.responses import (
80
79
  ThreadListResponse,
81
80
  ThreadReadResponse,
82
81
  ThreadResponse,
83
- ThreadRollbackResponse,
82
+ ThreadRevertResponse,
84
83
  ThreadUnarchiveResponse,
85
84
  ToolRequestUserInputResponse,
86
85
  TurnStartResponse,
@@ -92,6 +91,11 @@ from codexed.models.thread_item import (
92
91
  ThreadItemCollabAgentToolCall,
93
92
  ThreadItemCommandExecution,
94
93
  ThreadItemContextCompaction,
94
+ ThreadItemFunctionCallOutput,
95
+ ThreadItemHookPrompt,
96
+ ThreadItemImageGeneration,
97
+ ThreadItemSleep,
98
+ ThreadItemSubAgentActivity,
95
99
  ThreadItemDynamicToolCall,
96
100
  ThreadItemEnteredReviewMode,
97
101
  ThreadItemExitedReviewMode,
@@ -170,7 +174,6 @@ from codexed.models.v2_protocol import (
170
174
  TextUserInput,
171
175
  LoginAccountResponse,
172
176
  ThreadResumeParams,
173
- RawResponseItemCompletedNotification,
174
177
  ExternalAgentConfigImportParams,
175
178
  InitializeParams,
176
179
  CommandExecParams,
@@ -183,7 +186,6 @@ from codexed.models.v2_protocol import (
183
186
  CustomToolCallResponseItem,
184
187
  FunctionCallOutputResponseItem,
185
188
  FunctionCallResponseItem,
186
- GhostSnapshotResponseItem,
187
189
  ImageGenerationCallResponseItem,
188
190
  LocalShellCallResponseItem,
189
191
  MessageResponseItem,
@@ -202,7 +204,6 @@ from codexed.models.v2_protocol import (
202
204
  LoginAccountParams,
203
205
  TextElement,
204
206
  ThreadLoadedListParams,
205
- SkillsListExtraRootsForCwd,
206
207
  SkillsListParams,
207
208
  McpResourceReadParams,
208
209
  McpResourceReadResponse,
@@ -250,7 +251,6 @@ from codexed.models.v2_protocol import (
250
251
  AuthMode,
251
252
  WriteStatus,
252
253
  ActiveThreadStatus,
253
- GhostCommit,
254
254
  ThreadStatus,
255
255
  IdleThreadStatus,
256
256
  NotLoadedThreadStatus,
@@ -265,7 +265,7 @@ from codexed.models.v2_protocol import (
265
265
  ModelListResponse,
266
266
  ConfigReadResponse,
267
267
  ConfigWriteResponse,
268
- ThreadRollbackParams,
268
+ ThreadRevertParams,
269
269
  AccountLoginCompletedNotification,
270
270
  AccountRateLimitsUpdatedNotification,
271
271
  AccountUpdatedNotification,
@@ -293,17 +293,13 @@ from codexed.models.v2_protocol import (
293
293
  ExternalAgentConfigMigrationItem,
294
294
  CollaborationMode,
295
295
  ExternalAgentConfigMigrationItemType,
296
- FullAccessReadOnlyAccess,
297
296
  ModeKind,
298
297
  NetworkAccess,
299
298
  Personality,
300
- ReadOnlyAccess,
301
299
  ReadOnlySandboxPolicy,
302
300
  ExternalSandboxSandboxPolicy,
303
301
  ReasoningEffort,
304
- RestrictedReadOnlyAccess,
305
302
  SandboxPolicy,
306
- ServiceTier,
307
303
  SessionSource,
308
304
  ThreadSourceKind,
309
305
  TurnStatus,
@@ -457,7 +453,6 @@ from codexed.models.v2_protocol import (
457
453
  SkillToolDependency,
458
454
  TurnError,
459
455
  McpServerToolCallParams,
460
- PermissionProfile,
461
456
  CommandExecOutputStream,
462
457
  CommandExecOutputDeltaNotification,
463
458
  CommandExecResizeResponse,
@@ -616,7 +611,6 @@ __all__ = [
616
611
  "FsWatchResponse",
617
612
  "FsWriteFileParams",
618
613
  "FsWriteFileResponse",
619
- "FullAccessReadOnlyAccess",
620
614
  "FunctionCallOutputResponseItem",
621
615
  "FunctionCallResponseItem",
622
616
  "FuzzyFileSearchMatchType",
@@ -632,8 +626,6 @@ __all__ = [
632
626
  "GetAccountParams",
633
627
  "GetAccountRateLimitsResponse",
634
628
  "GetAccountResponse",
635
- "GhostCommit",
636
- "GhostSnapshotResponseItem",
637
629
  "GitInfo",
638
630
  "Granular",
639
631
  "GrepFilesToolConfig",
@@ -739,7 +731,6 @@ __all__ = [
739
731
  "OtherWebSearchAction",
740
732
  "PatchApplyStatus",
741
733
  "PatchChangeKind",
742
- "PermissionProfile",
743
734
  "Personality",
744
735
  "PlanDeltaNotification",
745
736
  "PlanToolConfig",
@@ -754,11 +745,8 @@ __all__ = [
754
745
  "ProductSurface",
755
746
  "RateLimitSnapshot",
756
747
  "RateLimitWindow",
757
- "RawResponseItemCompletedEvent",
758
- "RawResponseItemCompletedNotification",
759
748
  "ReadCommandAction",
760
749
  "ReadFileToolConfig",
761
- "ReadOnlyAccess",
762
750
  "ReadOnlySandboxPolicy",
763
751
  "RealtimeConversationVersion",
764
752
  "RealtimeEvent",
@@ -776,7 +764,6 @@ __all__ = [
776
764
  "RequestPermissionsToolConfig",
777
765
  "RequestUserInputToolConfig",
778
766
  "ResponseItem",
779
- "RestrictedReadOnlyAccess",
780
767
  "ReviewDelivery",
781
768
  "ReviewStartParams",
782
769
  "ReviewStartResponse",
@@ -788,7 +775,6 @@ __all__ = [
788
775
  "SendAddCreditsNudgeEmailParams",
789
776
  "ServerRequestResolvedMessage",
790
777
  "ServerRequestResolvedNotification",
791
- "ServiceTier",
792
778
  "SessionSource",
793
779
  "Settings",
794
780
  "ShellToolConfig",
@@ -805,7 +791,6 @@ __all__ = [
805
791
  "SkillsConfigWriteParams",
806
792
  "SkillsConfigWriteResponse",
807
793
  "SkillsListEntry",
808
- "SkillsListExtraRootsForCwd",
809
794
  "SkillsListParams",
810
795
  "SkillsListResponse",
811
796
  "SkillsRemoteExportParams",
@@ -836,10 +821,15 @@ __all__ = [
836
821
  "ThreadItemEnteredReviewMode",
837
822
  "ThreadItemExitedReviewMode",
838
823
  "ThreadItemFileChange",
824
+ "ThreadItemFunctionCallOutput",
825
+ "ThreadItemHookPrompt",
826
+ "ThreadItemImageGeneration",
839
827
  "ThreadItemImageView",
840
828
  "ThreadItemMcpToolCall",
841
829
  "ThreadItemPlan",
842
830
  "ThreadItemReasoning",
831
+ "ThreadItemSleep",
832
+ "ThreadItemSubAgentActivity",
843
833
  "ThreadItemUserMessage",
844
834
  "ThreadItemWebSearch",
845
835
  "ThreadListParams",
@@ -878,8 +868,8 @@ __all__ = [
878
868
  "ThreadRealtimeTranscriptDoneMessage",
879
869
  "ThreadResponse",
880
870
  "ThreadResumeParams",
881
- "ThreadRollbackParams",
882
- "ThreadRollbackResponse",
871
+ "ThreadRevertParams",
872
+ "ThreadRevertResponse",
883
873
  "ThreadSetNameParams",
884
874
  "ThreadShellCommandParams",
885
875
  "ThreadShellCommandResponse",