codexed 1.1.7__tar.gz → 1.1.9__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 (32) hide show
  1. {codexed-1.1.7 → codexed-1.1.9}/PKG-INFO +2 -1
  2. {codexed-1.1.7 → codexed-1.1.9}/pyproject.toml +2 -1
  3. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/client/client.py +32 -12
  4. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/client/session.py +55 -6
  5. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/__init__.py +7 -14
  6. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/misc.py +6 -88
  7. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/responses.py +0 -14
  8. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/thread_item.py +3 -18
  9. codexed-1.1.7/src/codexed/models/user_input.py +0 -43
  10. {codexed-1.1.7 → codexed-1.1.9}/LICENSE +0 -0
  11. {codexed-1.1.7 → codexed-1.1.9}/README.md +0 -0
  12. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/README.md +0 -0
  13. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/__init__.py +0 -0
  14. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/client/__init__.py +0 -0
  15. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/client/dispatch.py +0 -0
  16. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/client/fs.py +0 -0
  17. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/client/realtime.py +0 -0
  18. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/client/skills.py +0 -0
  19. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/exceptions.py +0 -0
  20. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/helpers.py +0 -0
  21. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/log.py +0 -0
  22. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/base.py +0 -0
  23. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/codex_types.py +0 -0
  24. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/event_data.py +0 -0
  25. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/events.py +0 -0
  26. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/mcp_server.py +0 -0
  27. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/request_params.py +0 -0
  28. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/tool_config.py +0 -0
  29. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/models/v2_protocol.py +0 -0
  30. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/py.typed +0 -0
  31. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/request_handlers.py +0 -0
  32. {codexed-1.1.7 → codexed-1.1.9}/src/codexed/transport.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codexed
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: Alternative codex app-server client
5
5
  Keywords:
6
6
  Author: Philipp Temminghoff
@@ -22,6 +22,7 @@ Classifier: Topic :: Software Development
22
22
  Classifier: Topic :: Utilities
23
23
  Classifier: Typing :: Typed
24
24
  Requires-Dist: anyenv>=2.0.15
25
+ Requires-Dist: mcp>=1.27.0
25
26
  Requires-Dist: pydantic
26
27
  Requires-Dist: schemez
27
28
  Requires-Dist: websockets>=13.0 ; extra == 'websocket'
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "codexed"
5
- version = "1.1.7"
5
+ version = "1.1.9"
6
6
  description = "Alternative codex app-server client"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.13"
@@ -30,6 +30,7 @@ classifiers = [
30
30
  ]
31
31
  dependencies = [
32
32
  "anyenv>=2.0.15",
33
+ "mcp>=1.27.0",
33
34
  "pydantic",
34
35
  "schemez",
35
36
  # Only add below (Copier)
@@ -48,6 +48,7 @@ from codexed.models import (
48
48
  ThreadForkParams,
49
49
  ThreadListParams,
50
50
  ThreadListResponse,
51
+ ThreadLoadedListParams,
51
52
  ThreadLoadedListResponse,
52
53
  ThreadResponse,
53
54
  ThreadResumeParams,
@@ -86,7 +87,6 @@ if TYPE_CHECKING:
86
87
  ExternalAgentConfigMigrationItem,
87
88
  McpServerConfig,
88
89
  MergeStrategy,
89
- Model,
90
90
  Personality,
91
91
  SandboxMode,
92
92
  SandboxPolicy,
@@ -489,29 +489,49 @@ class CodexClient:
489
489
  result = await self.dispatch.send_request("thread/list", params)
490
490
  return ThreadListResponse.model_validate(result)
491
491
 
492
- async def thread_loaded_list(self) -> list[str]:
493
- """List thread IDs currently loaded in memory."""
494
- result = await self.dispatch.send_request("thread/loaded/list")
495
- response = ThreadLoadedListResponse.model_validate(result)
496
- return response.data
492
+ async def thread_loaded_list(
493
+ self,
494
+ *,
495
+ cursor: str | None = None,
496
+ limit: int | None = None,
497
+ ) -> ThreadLoadedListResponse:
498
+ """List thread IDs currently loaded in memory.
499
+
500
+ Args:
501
+ cursor: Opaque pagination cursor from previous response
502
+ limit: Maximum number of thread IDs to return
503
+
504
+ Returns:
505
+ ThreadLoadedListResponse with data (list of thread IDs) and next_cursor
506
+ """
507
+ params = ThreadLoadedListParams(cursor=cursor, limit=limit)
508
+ result = await self.dispatch.send_request("thread/loaded/list", params)
509
+ return ThreadLoadedListResponse.model_validate(result)
497
510
 
498
511
  # ========================================================================
499
512
  # Model methods
500
513
  # ========================================================================
501
514
 
502
- async def model_list(self, *, include_hidden: bool | None = None) -> list[Model]:
515
+ async def model_list(
516
+ self,
517
+ *,
518
+ include_hidden: bool | None = None,
519
+ cursor: str | None = None,
520
+ limit: int | None = None,
521
+ ) -> ModelListResponse:
503
522
  """List available models with reasoning effort options.
504
523
 
505
524
  Args:
506
525
  include_hidden: When true, include hidden models
526
+ cursor: Opaque pagination cursor from previous response
527
+ limit: Maximum number of models to return
507
528
 
508
529
  Returns:
509
- List of available models
530
+ ModelListResponse with data (list of models) and next_cursor
510
531
  """
511
- params = ModelListParams(include_hidden=include_hidden, limit=None)
532
+ params = ModelListParams(include_hidden=include_hidden, cursor=cursor, limit=limit)
512
533
  result = await self.dispatch.send_request("model/list", params)
513
- response = ModelListResponse.model_validate(result)
514
- return response.data
534
+ return ModelListResponse.model_validate(result)
515
535
 
516
536
  async def collaboration_mode_list(self) -> list[CollaborationModeMask]:
517
537
  """List available collaboration mode presets (experimental).
@@ -651,7 +671,7 @@ class CodexClient:
651
671
  )
652
672
  params = TypeAdapter[LoginAccountParams](LoginAccountParams).validate_python(dct)
653
673
  result = await self.dispatch.send_request("account/login/start", params)
654
- return LoginAccountResponse.model_validate(result)
674
+ return TypeAdapter[LoginAccountResponse](LoginAccountResponse).validate_python(result)
655
675
 
656
676
  async def account_login_cancel(self, login_id: str) -> CancelLoginAccountStatus:
657
677
  """Cancel an in-progress account login."""
@@ -197,12 +197,12 @@ class Session:
197
197
  case ErrorMessage(data=ErrorNotification(error=error)):
198
198
  yield event
199
199
  raise TurnFailedError(error.message, turn_id=turn_id)
200
+ case ThreadTokenUsageUpdatedEvent(
201
+ data=ThreadTokenUsageUpdatedNotification(token_usage=usage)
202
+ ):
203
+ self.usage = usage
204
+ yield event
200
205
  case _:
201
- match event:
202
- case ThreadTokenUsageUpdatedEvent(
203
- data=ThreadTokenUsageUpdatedNotification(token_usage=usage)
204
- ):
205
- self.usage = usage
206
206
  yield event
207
207
  finally:
208
208
  if turn_key in self._client._turn_queues:
@@ -407,10 +407,14 @@ class Session:
407
407
  self,
408
408
  target: ReviewTarget,
409
409
  *,
410
- delivery: ReviewDelivery | None = None,
410
+ delivery: ReviewDelivery = "inline",
411
411
  ) -> ReviewStartResponse:
412
412
  """Start a code review.
413
413
 
414
+ Inline delivery runs the review on the same thread, so review items
415
+ appear in the existing thread history. Detached delivery creates a new
416
+ thread for the review, keeping the original thread's history clean.
417
+
414
418
  Args:
415
419
  target: Review target (uncommittedChanges, baseBranch, commit, or custom)
416
420
  delivery: Where to run the review (inline or detached)
@@ -422,6 +426,51 @@ class Session:
422
426
  result = await self._client.dispatch.send_request("review/start", params)
423
427
  return ReviewStartResponse.model_validate(result)
424
428
 
429
+ async def review_stream(
430
+ self,
431
+ target: ReviewTarget,
432
+ *,
433
+ delivery: ReviewDelivery = "inline",
434
+ ) -> AsyncIterator[CodexEvent]:
435
+ """Start a code review and stream events.
436
+
437
+ Inline delivery runs the review on the same thread, so review items
438
+ appear in the existing thread history. Detached delivery creates a new
439
+ thread for the review, keeping the original thread's history clean.
440
+
441
+ Args:
442
+ target: Review target (uncommittedChanges, baseBranch, commit, or custom)
443
+ delivery: Where to run the review (inline or detached)
444
+
445
+ Yields:
446
+ CodexEvent: Streaming events from the review turn
447
+ """
448
+ params = ReviewStartParams(thread_id=self.thread_id, target=target, delivery=delivery)
449
+ result = await self._client.dispatch.send_request("review/start", params)
450
+ response = ReviewStartResponse.model_validate(result)
451
+ turn_id = response.turn.id
452
+ review_thread_id = response.review_thread_id
453
+ turn_queue: asyncio.Queue[CodexEvent | None] = asyncio.Queue()
454
+ turn_key = f"{review_thread_id}:{turn_id}"
455
+ self._client._turn_queues[turn_key] = turn_queue
456
+ try:
457
+ while True:
458
+ event = await turn_queue.get()
459
+ match event:
460
+ case None:
461
+ break
462
+ case TurnCompletedEvent():
463
+ yield event
464
+ break
465
+ case ErrorMessage(data=ErrorNotification(error=error)):
466
+ yield event
467
+ raise TurnFailedError(error.message, turn_id=turn_id)
468
+ case _:
469
+ yield event
470
+ finally:
471
+ if turn_key in self._client._turn_queues:
472
+ del self._client._turn_queues[turn_key]
473
+
425
474
  # -- Fork ----------------------------------------------------------------
426
475
 
427
476
  async def fork(
@@ -46,10 +46,7 @@ from codexed.models.events import (
46
46
  from codexed.models.mcp_server import HttpMcpServer, McpServerConfig, StdioMcpServer
47
47
  from codexed.models.misc import (
48
48
  ExecPolicyAmendment,
49
- McpResource,
50
- McpResourceTemplate,
51
49
  McpServerStatusEntry,
52
- McpTool,
53
50
  NetworkApprovalContext,
54
51
  NetworkPolicyAmendment,
55
52
  SkillRequestApprovalResponse,
@@ -80,7 +77,6 @@ from codexed.models.responses import (
80
77
  DynamicToolCallResponse,
81
78
  FileChangeRequestApprovalResponse,
82
79
  ListMcpServerStatusResponse,
83
- LoginAccountResponse,
84
80
  McpServerElicitationResponse,
85
81
  RemoteSkillSummary,
86
82
  ReviewStartResponse,
@@ -96,10 +92,8 @@ from codexed.models.responses import (
96
92
  )
97
93
  from codexed.models.thread_item import (
98
94
  CollabAgentState,
99
- FileUpdateChange,
100
95
  McpToolCallError,
101
96
  McpToolCallResult,
102
- PatchChangeKind,
103
97
  ThreadItem,
104
98
  ThreadItemAgentMessage,
105
99
  ThreadItemCollabAgentToolCall,
@@ -141,17 +135,19 @@ from codexed.models.tool_config import (
141
135
  WebSearchToolConfig,
142
136
  tools_to_config_dict,
143
137
  )
144
- from codexed.models.user_input import (
138
+
139
+ from codexed.models.v2_protocol import (
140
+ ByteRange,
141
+ InitializeCapabilities,
145
142
  UserInput,
146
143
  ImageUserInput,
144
+ PatchChangeKind,
145
+ FileUpdateChange,
147
146
  LocalImageUserInput,
148
147
  MentionUserInput,
149
148
  SkillUserInput,
150
149
  TextUserInput,
151
- )
152
- from codexed.models.v2_protocol import (
153
- ByteRange,
154
- InitializeCapabilities,
150
+ LoginAccountResponse,
155
151
  ThreadResumeParams,
156
152
  RawResponseItemCompletedNotification,
157
153
  ExternalAgentConfigImportParams,
@@ -656,8 +652,6 @@ __all__ = [
656
652
  "McpAuthStatus",
657
653
  "McpElicitationFormParams",
658
654
  "McpElicitationUrlParams",
659
- "McpResource",
660
- "McpResourceTemplate",
661
655
  "McpResourceToolsConfig",
662
656
  "McpServerConfig",
663
657
  "McpServerElicitationRequestParams",
@@ -670,7 +664,6 @@ __all__ = [
670
664
  "McpServerStartupStatusUpdatedNotification",
671
665
  "McpServerStatusEntry",
672
666
  "McpServerStatusUpdatedNotification",
673
- "McpTool",
674
667
  "McpToolCallError",
675
668
  "McpToolCallProgressNotification",
676
669
  "McpToolCallResult",
@@ -2,10 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import TYPE_CHECKING, Any
5
+ from typing import Any
6
6
 
7
- from mcp.types import Annotations, Icon, ToolAnnotations
8
- from pydantic import AnyUrl, Field
7
+ from mcp.types import Resource, ResourceTemplate, Tool
8
+ from pydantic import Field
9
9
 
10
10
  from codexed.models.base import CodexBaseModel
11
11
  from codexed.models.codex_types import (
@@ -24,10 +24,6 @@ from codexed.models.v2_protocol import (
24
24
  )
25
25
 
26
26
 
27
- if TYPE_CHECKING:
28
- from mcp.types import Resource, ResourceTemplate, Tool
29
-
30
-
31
27
  class NetworkApprovalContext(CodexBaseModel):
32
28
  """Network approval context for command approvals."""
33
29
 
@@ -169,89 +165,11 @@ class TurnData(CodexBaseModel):
169
165
  error: str | None = None
170
166
 
171
167
 
172
- class McpTool(CodexBaseModel):
173
- """Tool exposed by an MCP server. Mirrors `mcp.types.Tool`."""
174
-
175
- name: str
176
- title: str | None = None
177
- description: str | None = None
178
- input_schema: dict[str, Any]
179
- output_schema: dict[str, Any] | None = None
180
- annotations: ToolAnnotations | None = None
181
- icons: list[Icon] | None = None
182
- field_meta: dict[str, Any] | None = None
183
-
184
- def to_mcp_tool(self) -> Tool:
185
- from mcp.types import Tool
186
-
187
- return Tool(
188
- name=self.name,
189
- title=self.title,
190
- description=self.description,
191
- inputSchema=self.input_schema,
192
- outputSchema=self.output_schema,
193
- annotations=self.annotations,
194
- icons=self.icons,
195
- _meta=self.field_meta,
196
- )
197
-
198
-
199
- class McpResource(CodexBaseModel):
200
- """Resource exposed by an MCP server. Mirrors `mcp.types.Resource`."""
201
-
202
- uri: str
203
- name: str
204
- title: str | None = None
205
- description: str | None = None
206
- mime_type: str | None = None
207
- size: int | None = None
208
- annotations: Annotations | None = None
209
- icons: list[Icon] | None = None
210
- field_meta: dict[str, Any] | None = None
211
-
212
- def to_mcp_resource(self) -> Resource:
213
- from mcp.types import Resource
214
-
215
- return Resource(
216
- uri=AnyUrl(self.uri),
217
- name=self.name,
218
- title=self.title,
219
- description=self.description,
220
- mimeType=self.mime_type,
221
- size=self.size,
222
- annotations=self.annotations,
223
- icons=self.icons,
224
- _meta=self.field_meta,
225
- )
226
-
227
-
228
- class McpResourceTemplate(CodexBaseModel):
229
- """Resource template exposed by an MCP server. Mirrors `mcp.types.ResourceTemplate`."""
230
-
231
- uri_template: str
232
- name: str
233
- title: str | None = None
234
- description: str | None = None
235
- mime_type: str | None = None
236
- annotations: Annotations | None = None
237
-
238
- def to_mcp_resource(self) -> ResourceTemplate:
239
- from mcp.types import ResourceTemplate
240
-
241
- return ResourceTemplate(
242
- uriTemplate=self.uri_template,
243
- name=self.name,
244
- title=self.title,
245
- description=self.description,
246
- annotations=self.annotations,
247
- )
248
-
249
-
250
168
  class McpServerStatusEntry(CodexBaseModel):
251
169
  """Status of a single MCP server."""
252
170
 
253
171
  name: str
254
- tools: dict[str, McpTool] = Field(default_factory=dict)
255
- resources: list[McpResource] = Field(default_factory=list)
256
- resource_templates: list[McpResourceTemplate] = Field(default_factory=list)
172
+ tools: dict[str, Tool] = Field(default_factory=dict)
173
+ resources: list[Resource] = Field(default_factory=list)
174
+ resource_templates: list[ResourceTemplate] = Field(default_factory=list)
257
175
  auth_status: McpAuthStatus = "unsupported"
@@ -13,7 +13,6 @@ from codexed.models.misc import (
13
13
  )
14
14
  from codexed.models.v2_protocol import (
15
15
  AskForApproval,
16
- AuthMode,
17
16
  DynamicToolCallOutputContentItem,
18
17
  ReasoningEffort,
19
18
  SandboxPolicy,
@@ -154,16 +153,3 @@ class ListMcpServerStatusResponse(CodexBaseModel):
154
153
 
155
154
  data: list[McpServerStatusEntry]
156
155
  next_cursor: str | None = None
157
-
158
-
159
- # ============================================================================
160
- # Account models
161
- # ============================================================================
162
-
163
-
164
- class LoginAccountResponse(CodexBaseModel):
165
- """Response for account/login/start request."""
166
-
167
- type: AuthMode
168
- login_id: str | None = None
169
- auth_url: str | None = None
@@ -6,7 +6,6 @@ from mcp.types import ContentBlock
6
6
  from pydantic import Field
7
7
 
8
8
  from codexed.models.base import CodexBaseModel
9
- from codexed.models.user_input import UserInput
10
9
  from codexed.models.v2_protocol import (
11
10
  CollabAgentState,
12
11
  CollabAgentTool,
@@ -16,29 +15,16 @@ from codexed.models.v2_protocol import (
16
15
  CommandExecutionStatus,
17
16
  DynamicToolCallOutputContentItem,
18
17
  DynamicToolCallStatus,
18
+ FileUpdateChange,
19
19
  McpToolCallError,
20
20
  McpToolCallStatus,
21
21
  MessagePhase,
22
22
  PatchApplyStatus,
23
+ UserInput,
23
24
  WebSearchAction,
24
25
  )
25
26
 
26
27
 
27
- class PatchChangeKind(CodexBaseModel):
28
- """Kind of file change (nested object in Codex's fileChange item)."""
29
-
30
- kind: Literal["add", "delete", "update"] = Field(validation_alias="type")
31
- move_path: str | None = None
32
-
33
-
34
- class FileUpdateChange(CodexBaseModel):
35
- """File update change."""
36
-
37
- path: str
38
- kind: PatchChangeKind
39
- diff: str | None = None # May be absent in "inProgress" state
40
-
41
-
42
28
  class McpToolCallResult(CodexBaseModel):
43
29
  """MCP tool call result."""
44
30
 
@@ -111,9 +97,8 @@ class ThreadItemCommandExecution(BaseThreadItem):
111
97
  @property
112
98
  def item_summary(self) -> str:
113
99
  """Human-readable summary of this command execution."""
114
- output = self.aggregated_output or ""
115
100
  msg = f"[Executed: {self.command}]"
116
- if output:
101
+ if output := self.aggregated_output:
117
102
  msg += f"\n{output[:200]}"
118
103
  return msg
119
104
 
@@ -1,43 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import base64
4
- from typing import Self
5
-
6
- from codexed.models.v2_protocol import (
7
- ImageUserInput as CodexImageUserInput,
8
- LocalImageUserInput as CodexLocalImageUserInput,
9
- MentionUserInput as CodexMentionUserInput,
10
- SkillUserInput as CodexSkillUserInput,
11
- TextUserInput as CodexTextUserInput,
12
- )
13
-
14
-
15
- class TextUserInput(CodexTextUserInput):
16
- """Text user input."""
17
-
18
-
19
- class ImageUserInput(CodexImageUserInput):
20
- """Image URL user input."""
21
-
22
- @classmethod
23
- def from_bytes(cls, data: bytes, media_type: str) -> Self:
24
- """Create from raw bytes as a base64 data URI."""
25
- b64 = base64.b64encode(data).decode()
26
- data_uri = f"data:{media_type};base64,{b64}"
27
- return cls(url=data_uri)
28
-
29
-
30
- class LocalImageUserInput(CodexLocalImageUserInput):
31
- """Local image file user input."""
32
-
33
-
34
- class SkillUserInput(CodexSkillUserInput):
35
- """Skill file user input."""
36
-
37
-
38
- class MentionUserInput(CodexMentionUserInput):
39
- """Mention user input."""
40
-
41
-
42
- # Discriminated union of user input types
43
- UserInput = TextUserInput | ImageUserInput | LocalImageUserInput | SkillUserInput | MentionUserInput
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes