codexed 1.1.2__tar.gz → 1.1.4__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 (33) hide show
  1. {codexed-1.1.2 → codexed-1.1.4}/PKG-INFO +1 -1
  2. {codexed-1.1.2 → codexed-1.1.4}/pyproject.toml +1 -1
  3. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/__init__.py +0 -8
  4. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/client/client.py +6 -6
  5. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/client/session.py +31 -16
  6. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/__init__.py +7 -11
  7. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/codex_types.py +0 -47
  8. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/event_data.py +2 -1
  9. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/misc.py +1 -3
  10. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/request_params.py +8 -56
  11. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/responses.py +12 -13
  12. codexed-1.1.2/src/codexed/models/response_item.py +0 -99
  13. {codexed-1.1.2 → codexed-1.1.4}/LICENSE +0 -0
  14. {codexed-1.1.2 → codexed-1.1.4}/README.md +0 -0
  15. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/README.md +0 -0
  16. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/client/__init__.py +0 -0
  17. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/client/dispatch.py +0 -0
  18. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/client/fs.py +0 -0
  19. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/client/realtime.py +0 -0
  20. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/client/skills.py +0 -0
  21. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/exceptions.py +0 -0
  22. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/helpers.py +0 -0
  23. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/log.py +0 -0
  24. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/base.py +0 -0
  25. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/events.py +0 -0
  26. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/mcp_server.py +0 -0
  27. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/thread_item.py +0 -0
  28. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/tool_config.py +0 -0
  29. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/user_input.py +0 -0
  30. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/models/v2_protocol.py +0 -0
  31. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/py.typed +0 -0
  32. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/request_handlers.py +0 -0
  33. {codexed-1.1.2 → codexed-1.1.4}/src/codexed/transport.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codexed
3
- Version: 1.1.2
3
+ Version: 1.1.4
4
4
  Summary: Alternative codex app-server client
5
5
  Keywords:
6
6
  Author: Philipp Temminghoff
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "codexed"
5
- version = "1.1.2"
5
+ version = "1.1.4"
6
6
  description = "Alternative codex app-server client"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.13"
@@ -69,14 +69,12 @@ from codexed.models import (
69
69
  MentionUserInput,
70
70
  SkillUserInput,
71
71
  TextUserInput,
72
- ApprovalPolicy,
73
72
  AskForApproval,
74
73
  CollaborationMode,
75
74
  Settings,
76
75
  DangerFullAccessSandboxPolicy,
77
76
  ExternalSandboxPolicy,
78
77
  ApprovalDecision,
79
- ItemStatus,
80
78
  CollabAgentStatus,
81
79
  CollabAgentTool,
82
80
  CommandExecutionSource,
@@ -95,8 +93,6 @@ from codexed.models import (
95
93
  ReadOnlySandboxPolicy,
96
94
  ReasoningEffort,
97
95
  ReasoningSummary,
98
- RejectApprovalPolicy,
99
- RejectConfig,
100
96
  SandboxPolicy,
101
97
  SessionSource,
102
98
  SkillApprovalDecision,
@@ -151,7 +147,6 @@ __all__ = [
151
147
  "ApprovalDecision",
152
148
  "ApprovalHandler",
153
149
  "ApprovalParams",
154
- "ApprovalPolicy",
155
150
  "ApprovalResponse",
156
151
  "AskForApproval",
157
152
  "BuiltinToolsConfig",
@@ -188,7 +183,6 @@ __all__ = [
188
183
  "ItemPlanDeltaNotification",
189
184
  "ItemReasoningTextDeltaNotification",
190
185
  "ItemStartedEvent",
191
- "ItemStatus",
192
186
  "LocalImageUserInput",
193
187
  "McpAuthStatus",
194
188
  "McpElicitationHandler",
@@ -210,8 +204,6 @@ __all__ = [
210
204
  "ReasoningEffort",
211
205
  "ReasoningSummary",
212
206
  "ReasoningTextDeltaNotification",
213
- "RejectApprovalPolicy",
214
- "RejectConfig",
215
207
  "RetryLimitExceededError",
216
208
  "ReviewDelivery",
217
209
  "ReviewStartResponse",
@@ -73,8 +73,8 @@ if TYPE_CHECKING:
73
73
  from codexed.client.session import Session
74
74
  from codexed.models import (
75
75
  AppInfo,
76
- ApprovalPolicy,
77
76
  ApprovalsReviewer,
77
+ AskForApproval,
78
78
  AuthMode,
79
79
  CancelLoginAccountStatus,
80
80
  CodexEvent,
@@ -190,11 +190,11 @@ class CodexClient:
190
190
  async def __aenter__(self) -> Self:
191
191
  """Async context manager entry - starts the app-server."""
192
192
  import codexed
193
- from codexed.models import InitializeParams
193
+ from codexed.models import ClientInfo, InitializeParams
194
194
 
195
195
  await self.dispatch.start()
196
196
  version = codexed.__version__
197
- init_params = InitializeParams.create(name="codexed", version=version)
197
+ init_params = InitializeParams(client_info=ClientInfo(name="codexed", version=version))
198
198
  await self.dispatch.send_request("initialize", init_params)
199
199
  return self
200
200
 
@@ -214,7 +214,7 @@ class CodexClient:
214
214
  model_provider: str | None = None,
215
215
  base_instructions: str | None = None,
216
216
  developer_instructions: str | None = None,
217
- approval_policy: ApprovalPolicy | None = None,
217
+ approval_policy: AskForApproval | None = None,
218
218
  approvals_reviewer: ApprovalsReviewer | None = None,
219
219
  sandbox: SandboxMode | None = None,
220
220
  config: dict[str, Any] | None = None,
@@ -300,7 +300,7 @@ class CodexClient:
300
300
  model_provider: str | None = None,
301
301
  base_instructions: str | None = None,
302
302
  developer_instructions: str | None = None,
303
- approval_policy: ApprovalPolicy | None = None,
303
+ approval_policy: AskForApproval | None = None,
304
304
  approvals_reviewer: ApprovalsReviewer | None = None,
305
305
  sandbox: SandboxMode | None = None,
306
306
  config: dict[str, Any] | None = None,
@@ -375,7 +375,7 @@ class CodexClient:
375
375
  model_provider: str | None = None,
376
376
  base_instructions: str | None = None,
377
377
  developer_instructions: str | None = None,
378
- approval_policy: ApprovalPolicy | None = None,
378
+ approval_policy: AskForApproval | None = None,
379
379
  approvals_reviewer: ApprovalsReviewer | None = None,
380
380
  sandbox: SandboxMode | None = None,
381
381
  config: dict[str, Any] | None = None,
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import asyncio
6
- from collections.abc import AsyncIterator, Mapping # noqa: TC003
6
+ from collections.abc import AsyncIterator, Mapping, Sequence # noqa: TC003
7
7
  import logging
8
8
  from typing import TYPE_CHECKING, Any, assert_never
9
9
 
@@ -13,10 +13,14 @@ from codexed.client.realtime import RealtimeSession
13
13
  from codexed.exceptions import CodexRequestError, TurnFailedError
14
14
  from codexed.helpers import kebab_to_camel
15
15
  from codexed.models import (
16
+ DangerFullAccessSandboxPolicy,
16
17
  ErrorMessage,
17
18
  ErrorNotification,
19
+ ExternalSandboxSandboxPolicy,
20
+ ReadOnlySandboxPolicy,
18
21
  ReviewStartParams,
19
22
  ReviewStartResponse,
23
+ SandboxPolicy,
20
24
  TextUserInput,
21
25
  ThreadArchiveParams,
22
26
  ThreadCompactStartParams,
@@ -39,14 +43,15 @@ from codexed.models import (
39
43
  TurnStartResponse,
40
44
  TurnSteerParams,
41
45
  TurnSteerResponse,
46
+ WorkspaceWriteSandboxPolicy,
42
47
  )
43
48
 
44
49
 
45
50
  if TYPE_CHECKING:
46
51
  from codexed.client import CodexClient
47
52
  from codexed.models import (
48
- ApprovalPolicy,
49
53
  ApprovalsReviewer,
54
+ AskForApproval,
50
55
  CodexEvent,
51
56
  CollaborationMode,
52
57
  McpServerConfig,
@@ -98,14 +103,14 @@ class Session:
98
103
 
99
104
  async def turn_stream(
100
105
  self,
101
- user_input: str | list[UserInput],
106
+ user_input: str | Sequence[UserInput],
102
107
  *,
103
108
  model: str | None = None,
104
109
  effort: ReasoningEffort | None = None,
105
- approval_policy: ApprovalPolicy | None = None,
110
+ approval_policy: AskForApproval | None = None,
106
111
  approvals_reviewer: ApprovalsReviewer | None = None,
107
112
  cwd: str | None = None,
108
- sandbox_policy: SandboxMode | dict[str, Any] | None = None,
113
+ sandbox_policy: SandboxMode | SandboxPolicy | None = None,
109
114
  output_schema: dict[str, Any] | type[Any] | None = None,
110
115
  personality: Personality | None = None,
111
116
  service_tier: ServiceTier | None = None,
@@ -144,22 +149,30 @@ class Session:
144
149
  # Handle sandbox_policy - convert string to dict if needed
145
150
  match sandbox_policy:
146
151
  case None:
147
- sandbox_dict: dict[str, Any] | None = None
152
+ policy: SandboxPolicy | None = None
148
153
  case str():
149
- sandbox_dict = {"type": kebab_to_camel(sandbox_policy)}
150
- case dict():
151
- sandbox_dict = sandbox_policy
154
+ dct = {"type": kebab_to_camel(sandbox_policy)}
155
+ policy = TypeAdapter[SandboxPolicy](SandboxPolicy).validate_python(dct)
156
+ case (
157
+ DangerFullAccessSandboxPolicy()
158
+ | ReadOnlySandboxPolicy()
159
+ | ExternalSandboxSandboxPolicy()
160
+ | WorkspaceWriteSandboxPolicy()
161
+ ):
162
+ policy = sandbox_policy
152
163
  case _:
153
164
  assert_never(sandbox_policy)
154
165
  params = TurnStartParams(
155
166
  thread_id=self.thread_id,
156
- input=[TextUserInput(text=user_input)] if isinstance(user_input, str) else user_input,
167
+ input=[TextUserInput(text=user_input)]
168
+ if isinstance(user_input, str)
169
+ else list(user_input),
157
170
  model=model,
158
171
  effort=effort,
159
172
  approval_policy=approval_policy,
160
173
  approvals_reviewer=approvals_reviewer,
161
174
  cwd=cwd,
162
- sandbox_policy=sandbox_dict,
175
+ sandbox_policy=policy,
163
176
  service_tier=service_tier,
164
177
  output_schema=schema_dict,
165
178
  personality=personality,
@@ -197,7 +210,7 @@ class Session:
197
210
 
198
211
  async def turn_steer(
199
212
  self,
200
- user_input: str | list[UserInput],
213
+ user_input: str | Sequence[UserInput],
201
214
  *,
202
215
  expected_turn_id: str,
203
216
  ) -> TurnSteerResponse:
@@ -212,7 +225,9 @@ class Session:
212
225
  """
213
226
  params = TurnSteerParams(
214
227
  thread_id=self.thread_id,
215
- input=[TextUserInput(text=user_input)] if isinstance(user_input, str) else user_input,
228
+ input=[TextUserInput(text=user_input)]
229
+ if isinstance(user_input, str)
230
+ else list(user_input),
216
231
  expected_turn_id=expected_turn_id,
217
232
  )
218
233
  result = await self._client.dispatch.send_request("turn/steer", params)
@@ -230,10 +245,10 @@ class Session:
230
245
  *,
231
246
  model: str | None = None,
232
247
  effort: ReasoningEffort | None = None,
233
- approval_policy: ApprovalPolicy | None = None,
248
+ approval_policy: AskForApproval | None = None,
234
249
  approvals_reviewer: ApprovalsReviewer | None = None,
235
250
  cwd: str | None = None,
236
- sandbox_policy: SandboxMode | dict[str, Any] | None = None,
251
+ sandbox_policy: SandboxMode | SandboxPolicy | None = None,
237
252
  personality: Personality | None = None,
238
253
  service_tier: ServiceTier | None = None,
239
254
  summary: ReasoningSummary | None = None,
@@ -418,7 +433,7 @@ class Session:
418
433
  model_provider: str | None = None,
419
434
  base_instructions: str | None = None,
420
435
  developer_instructions: str | None = None,
421
- approval_policy: ApprovalPolicy | None = None,
436
+ approval_policy: AskForApproval | None = None,
422
437
  approvals_reviewer: ApprovalsReviewer | None = None,
423
438
  sandbox: SandboxMode | None = None,
424
439
  config: dict[str, Any] | None = None,
@@ -10,15 +10,11 @@ from codexed.models.base import (
10
10
  JsonRpcResponse,
11
11
  )
12
12
  from codexed.models.codex_types import (
13
- ApprovalPolicy,
14
13
  ElicitationAction,
15
14
  ExternalSandboxPolicy,
16
15
  ApprovalDecision,
17
- ItemStatus,
18
16
  NetworkApprovalProtocol,
19
17
  NetworkPolicyRuleAction,
20
- RejectApprovalPolicy,
21
- RejectConfig,
22
18
  SkillApprovalDecision,
23
19
  )
24
20
 
@@ -68,11 +64,11 @@ from codexed.models.misc import (
68
64
  TurnData,
69
65
  )
70
66
  from codexed.models.request_params import (
71
- InitializeParams,
72
67
  HazelnutScope,
73
68
  ProductSurface,
74
69
  CommandExecutionRequestApprovalParams,
75
70
  DynamicToolCallParams,
71
+ ThreadResumeParams,
76
72
  FileChangeRequestApprovalParams,
77
73
  McpElicitationFormParams,
78
74
  McpElicitationUrlParams,
@@ -86,7 +82,6 @@ from codexed.models.request_params import (
86
82
  from codexed.models.responses import (
87
83
  CommandExecutionRequestApprovalResponse,
88
84
  DynamicToolCallResponse,
89
- ExternalAgentConfigDetectResponse,
90
85
  FileChangeRequestApprovalResponse,
91
86
  ListMcpServerStatusResponse,
92
87
  LoginAccountResponse,
@@ -161,11 +156,13 @@ from codexed.models.user_input import (
161
156
  from codexed.models.v2_protocol import (
162
157
  ByteRange,
163
158
  ExternalAgentConfigImportParams,
159
+ InitializeParams,
164
160
  CommandExecParams,
165
161
  ThreadStartParams,
166
162
  ThreadForkParams,
167
163
  CompactionResponseItem,
168
164
  ContentItem,
165
+ ExternalAgentConfigDetectResponse,
169
166
  CustomToolCallOutputResponseItem,
170
167
  CustomToolCallResponseItem,
171
168
  FunctionCallOutputResponseItem,
@@ -175,12 +172,12 @@ from codexed.models.v2_protocol import (
175
172
  LocalShellCallResponseItem,
176
173
  MessageResponseItem,
177
174
  OtherResponseItem,
175
+ Granular,
178
176
  ReasoningResponseItem,
179
177
  ResponseItem,
180
178
  WebSearchCallResponseItem,
181
179
  ReviewStartParams,
182
180
  ReviewTarget,
183
- ThreadResumeParams,
184
181
  TurnStartParams,
185
182
  TurnSteerParams,
186
183
  ConfigBatchWriteParams,
@@ -283,6 +280,7 @@ from codexed.models.v2_protocol import (
283
280
  Personality,
284
281
  ReadOnlyAccess,
285
282
  ReadOnlySandboxPolicy,
283
+ ExternalSandboxSandboxPolicy,
286
284
  ReasoningEffort,
287
285
  RestrictedReadOnlyAccess,
288
286
  SandboxPolicy,
@@ -475,7 +473,6 @@ __all__ = [
475
473
  "AppScreenshot",
476
474
  "ApplyPatchToolConfig",
477
475
  "ApprovalDecision",
478
- "ApprovalPolicy",
479
476
  "ApprovalsReviewer",
480
477
  "AppsListParams",
481
478
  "AppsListResponse",
@@ -561,6 +558,7 @@ __all__ = [
561
558
  "ExternalAgentConfigMigrationItem",
562
559
  "ExternalAgentConfigMigrationItemType",
563
560
  "ExternalSandboxPolicy",
561
+ "ExternalSandboxSandboxPolicy",
564
562
  "FeedbackUploadParams",
565
563
  "FeedbackUploadResponse",
566
564
  "FileChangeOutputDeltaNotification",
@@ -608,6 +606,7 @@ __all__ = [
608
606
  "GhostCommit",
609
607
  "GhostSnapshotResponseItem",
610
608
  "GitInfo",
609
+ "Granular",
611
610
  "GrepFilesToolConfig",
612
611
  "HazelnutScope",
613
612
  "HookCompletedMessage",
@@ -642,7 +641,6 @@ __all__ = [
642
641
  "ItemReasoningTextDeltaNotification",
643
642
  "ItemStartedData",
644
643
  "ItemStartedEvent",
645
- "ItemStatus",
646
644
  "JsReplToolConfig",
647
645
  "JsonRpcError",
648
646
  "JsonRpcNotification",
@@ -723,8 +721,6 @@ __all__ = [
723
721
  "ReasoningSummaryPartAddedNotification",
724
722
  "ReasoningSummaryTextDeltaNotification",
725
723
  "ReasoningTextDeltaNotification",
726
- "RejectApprovalPolicy",
727
- "RejectConfig",
728
724
  "RemoteSkillSummary",
729
725
  "RequestPermissionsToolConfig",
730
726
  "RequestUserInputToolConfig",
@@ -11,11 +11,6 @@ from codexed.models.v2_protocol import NetworkAccess, RestrictedReadOnlyAccess
11
11
 
12
12
 
13
13
  # Type aliases for Codex types
14
- ApprovalPolicy = Literal["untrusted", "on-failure", "on-request", "never"]
15
- ItemStatus = Literal["pending", "running", "completed", "error"]
16
- McpElicitationAction = Literal["accept", "decline", "cancel"]
17
- McpServerStartupState = Literal["starting", "ready", "failed", "cancelled"]
18
- """Action taken by the user on an elicitation request."""
19
14
  ApprovalDecision = Literal["allow", "allowForSession", "deny", "denyForSession"]
20
15
  SkillApprovalDecision = Literal["allow", "deny"]
21
16
  ElicitationAction = Literal["accept", "decline", "cancel"]
@@ -23,48 +18,6 @@ NetworkApprovalProtocol = Literal["http", "https", "socks5Tcp", "socks5Udp"]
23
18
  NetworkPolicyRuleAction = Literal["allow", "deny"]
24
19
 
25
20
 
26
- # ============================================================================
27
- # AskForApproval (tagged union: string literals or {"reject": RejectConfig})
28
- # ============================================================================
29
-
30
-
31
- class RejectConfig(CodexBaseModel):
32
- """Fine-grained rejection controls for approval prompts.
33
-
34
- When a field is True, prompts of that category are automatically
35
- rejected instead of shown to the user.
36
- """
37
-
38
- sandbox_approval: bool
39
- rules: bool
40
- mcp_elicitations: bool
41
-
42
-
43
- class RejectApprovalPolicy(CodexBaseModel):
44
- """Approval policy variant with fine-grained rejection controls."""
45
-
46
- reject: RejectConfig
47
-
48
-
49
- def _ask_for_approval_discriminator(v: Any) -> str:
50
- match v:
51
- case str():
52
- return "simple"
53
- case {"reject": _}:
54
- return "reject"
55
- case RejectApprovalPolicy():
56
- return "reject"
57
- case _:
58
- return "simple"
59
-
60
-
61
- AskForApproval = Annotated[
62
- Annotated[ApprovalPolicy, Tag("simple")] | Annotated[RejectApprovalPolicy, Tag("reject")],
63
- Discriminator(_ask_for_approval_discriminator),
64
- ]
65
- """Full AskForApproval type: simple string policy or reject config."""
66
-
67
-
68
21
  # ============================================================================
69
22
  # SandboxPolicy (discriminated union on 'type' field)
70
23
  # ============================================================================
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  from codexed.models.base import CodexBaseModel
4
4
  from codexed.models.misc import Thread, Turn
5
5
  from codexed.models.thread_item import ThreadItem
6
+ from codexed.models.v2_protocol import ResponseItem
6
7
 
7
8
 
8
9
  # Item lifecycle notifications
@@ -29,7 +30,7 @@ class RawResponseItemCompletedData(CodexBaseModel):
29
30
 
30
31
  thread_id: str
31
32
  turn_id: str
32
- item: ThreadItem
33
+ item: ResponseItem
33
34
 
34
35
 
35
36
  class ThreadStartedData(CodexBaseModel):
@@ -13,7 +13,7 @@ from codexed.models.codex_types import (
13
13
  NetworkPolicyRuleAction,
14
14
  SkillApprovalDecision,
15
15
  )
16
- from codexed.models.thread_item import ThreadItem
16
+ from codexed.models.thread_item import ThreadItem, ThreadItemAgentMessage
17
17
  from codexed.models.v2_protocol import (
18
18
  GitInfo,
19
19
  McpAuthStatus,
@@ -128,8 +128,6 @@ class Turn(CodexBaseModel):
128
128
 
129
129
  For structured output turns, this returns the raw JSON string.
130
130
  """
131
- from codexed.models.thread_item import ThreadItemAgentMessage
132
-
133
131
  last_unphased: str | None = None
134
132
  for item in reversed(self.items):
135
133
  match item:
@@ -1,29 +1,23 @@
1
1
  from __future__ import annotations
2
2
 
3
- from collections.abc import Sequence
4
- from typing import TYPE_CHECKING, Annotated, Any, Literal, Required, Self, TypedDict
3
+ from typing import TYPE_CHECKING, Annotated, Any, Literal, Required, TypedDict
5
4
 
6
5
  from pydantic import Discriminator, TypeAdapter
7
6
 
8
7
  from codexed.models.base import CodexBaseModel
9
- from codexed.models.codex_types import ApprovalDecision, ApprovalPolicy
8
+ from codexed.models.codex_types import ApprovalDecision
10
9
  from codexed.models.misc import (
11
10
  ExecPolicyAmendment,
12
11
  NetworkApprovalContext,
13
12
  NetworkPolicyAmendment,
14
13
  ToolRequestUserInputQuestion,
15
14
  )
16
- from codexed.models.response_item import ResponseItem
17
- from codexed.models.user_input import UserInput
18
15
  from codexed.models.v2_protocol import (
19
16
  ApprovalsReviewer,
20
17
  AskForApproval,
21
- ClientInfo,
22
- CollaborationMode,
23
18
  CommandAction,
24
19
  Personality,
25
- ReasoningEffort,
26
- ReasoningSummary,
20
+ ResponseItem,
27
21
  SandboxMode,
28
22
  ServiceTier,
29
23
  )
@@ -35,16 +29,7 @@ if TYPE_CHECKING:
35
29
 
36
30
  HazelnutScope = Literal["example", "workspace-shared", "all-shared", "personal"]
37
31
  ProductSurface = Literal["chatgpt", "codex", "api", "atlas"]
38
-
39
-
40
- class InitializeParams(CodexBaseModel):
41
- """Parameters for initialize request."""
42
-
43
- client_info: ClientInfo
44
-
45
- @classmethod
46
- def create(cls, name: str, version: str) -> Self:
47
- return cls(client_info=ClientInfo(name=name, version=version))
32
+ PersistOption = Literal["session", "always"]
48
33
 
49
34
 
50
35
  class ThreadResumeParams(CodexBaseModel):
@@ -67,32 +52,6 @@ class ThreadResumeParams(CodexBaseModel):
67
52
  persist_extended_history: bool = False
68
53
 
69
54
 
70
- class TurnStartParams(CodexBaseModel):
71
- """Parameters for turn/start request."""
72
-
73
- thread_id: str
74
- input: Sequence[UserInput]
75
- model: str | None = None
76
- effort: ReasoningEffort | None = None
77
- approval_policy: ApprovalPolicy | None = None
78
- approvals_reviewer: ApprovalsReviewer | None = None
79
- cwd: str | None = None
80
- sandbox_policy: dict[str, Any] | None = None # Sandbox config - flexible structure
81
- service_tier: ServiceTier | None = None
82
- summary: ReasoningSummary | None = None
83
- output_schema: dict[str, Any] | None = None # JSON Schema - arbitrary structure
84
- personality: Personality | None = None
85
- collaboration_mode: CollaborationMode | None = None
86
-
87
-
88
- class TurnSteerParams(CodexBaseModel):
89
- """Parameters for turn/steer request."""
90
-
91
- thread_id: str
92
- input: Sequence[UserInput]
93
- expected_turn_id: str
94
-
95
-
96
55
  class SkillsRemoteListParams(CodexBaseModel):
97
56
  """Parameters for skills/remote/list request."""
98
57
 
@@ -166,9 +125,6 @@ class DynamicToolCallParams(CodexBaseModel):
166
125
  arguments: Any
167
126
 
168
127
 
169
- PersistOption = Literal["session", "always"]
170
-
171
-
172
128
  class ToolApprovalParamDisplay(TypedDict):
173
129
  """A rendered tool parameter for display."""
174
130
 
@@ -212,13 +168,11 @@ class McpElicitationFormParams(_McpElicitationBase):
212
168
  def to_mcp(self) -> ElicitRequestFormParams:
213
169
  from mcp.types import ElicitRequestFormParams, RequestParams
214
170
 
215
- params = ElicitRequestFormParams(
171
+ return ElicitRequestFormParams(
216
172
  message=self.message,
217
173
  requestedSchema=self.requested_schema,
174
+ _meta=RequestParams.Meta(**self.meta) if self.meta else None, # pyright: ignore[reportArgumentType]
218
175
  )
219
- if self.meta is not None:
220
- params.meta = RequestParams.Meta(**self.meta) # pyright: ignore[reportArgumentType]
221
- return params
222
176
 
223
177
  @classmethod
224
178
  def from_mcp(
@@ -249,14 +203,12 @@ class McpElicitationUrlParams(_McpElicitationBase):
249
203
  def to_mcp(self) -> ElicitRequestURLParams:
250
204
  from mcp.types import ElicitRequestURLParams, RequestParams
251
205
 
252
- params = ElicitRequestURLParams(
206
+ return ElicitRequestURLParams(
253
207
  message=self.message,
254
208
  url=self.url,
255
209
  elicitationId=self.elicitation_id,
210
+ _meta=RequestParams.Meta(**self.meta) if self.meta else None, # pyright: ignore[reportArgumentType]
256
211
  )
257
- if self.meta is not None:
258
- params.meta = RequestParams.Meta(**self.meta) # pyright: ignore[reportArgumentType]
259
- return params
260
212
 
261
213
  @classmethod
262
214
  def from_mcp(
@@ -1,11 +1,15 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, Literal
3
+ from typing import Any
4
4
 
5
5
  import mcp.types
6
6
 
7
7
  from codexed.models.base import CodexBaseModel
8
- from codexed.models.codex_types import ApprovalDecision, AskForApproval, SandboxPolicy
8
+ from codexed.models.codex_types import (
9
+ ApprovalDecision,
10
+ ElicitationAction,
11
+ SandboxPolicy,
12
+ )
9
13
  from codexed.models.misc import (
10
14
  McpServerStatusEntry,
11
15
  Thread,
@@ -14,10 +18,11 @@ from codexed.models.misc import (
14
18
  TurnData,
15
19
  )
16
20
  from codexed.models.v2_protocol import (
21
+ AskForApproval,
17
22
  AuthMode,
18
23
  DynamicToolCallOutputContentItem,
19
- ExternalAgentConfigMigrationItem,
20
24
  ReasoningEffort,
25
+ ServiceTier,
21
26
  )
22
27
 
23
28
 
@@ -49,7 +54,7 @@ class DynamicToolCallResponse(CodexBaseModel):
49
54
  class McpServerElicitationResponse(CodexBaseModel):
50
55
  """Response for mcpServer/elicitation/request server request."""
51
56
 
52
- action: Literal["accept", "decline", "cancel"]
57
+ action: ElicitationAction
53
58
  content: Any | None = None
54
59
  meta: Any | None = None
55
60
  """Optional metadata to include in the response.
@@ -62,12 +67,12 @@ class McpServerElicitationResponse(CodexBaseModel):
62
67
  """
63
68
 
64
69
  def to_mcp(self) -> mcp.types.ElicitResult:
65
- return mcp.types.ElicitResult(action=self.action, content=self.content)
70
+ return mcp.types.ElicitResult(action=self.action, content=self.content, _meta=self.meta)
66
71
 
67
72
  @classmethod
68
73
  def from_mcp(cls, result: mcp.types.ElicitResult) -> McpServerElicitationResponse:
69
74
  """Create from MCP ElicitResult."""
70
- return cls(action=result.action, content=result.content)
75
+ return cls(action=result.action, content=result.content, meta=result.meta)
71
76
 
72
77
 
73
78
  class ThreadReadResponse(CodexBaseModel):
@@ -86,7 +91,7 @@ class ThreadResponse(CodexBaseModel):
86
91
  approval_policy: AskForApproval
87
92
  sandbox: SandboxPolicy
88
93
  reasoning_effort: ReasoningEffort | None = None
89
- service_tier: Literal["flex", "fast"] | None = None
94
+ service_tier: ServiceTier | None = None
90
95
 
91
96
 
92
97
  class TurnStartResponse(CodexBaseModel):
@@ -161,9 +166,3 @@ class LoginAccountResponse(CodexBaseModel):
161
166
  type: AuthMode
162
167
  login_id: str | None = None
163
168
  auth_url: str | None = None
164
-
165
-
166
- class ExternalAgentConfigDetectResponse(CodexBaseModel):
167
- """Response for externalAgentConfig/detect request."""
168
-
169
- items: list[ExternalAgentConfigMigrationItem]
@@ -1,99 +0,0 @@
1
- """ResponseItem types for the Codex protocol.
2
-
3
- These represent the conversation history items used in thread/resume.
4
- Matches the Rust `ResponseItem` discriminated union from the protocol.
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- from typing import Annotated, Literal
10
-
11
- from pydantic import Discriminator
12
-
13
- from codexed.models.base import CodexBaseModel
14
- from codexed.models.v2_protocol import (
15
- CompactionResponseItem,
16
- ContentItem,
17
- CustomToolCallOutputResponseItem,
18
- CustomToolCallResponseItem,
19
- FindInPageResponsesApiWebSearchAction,
20
- FunctionCallOutputResponseItem,
21
- FunctionCallResponseItem,
22
- GhostSnapshotResponseItem,
23
- ImageGenerationCallResponseItem,
24
- InputImageFunctionCallOutputContentItem,
25
- InputTextFunctionCallOutputContentItem,
26
- LocalShellCallResponseItem,
27
- OpenPageResponsesApiWebSearchAction,
28
- OtherResponseItem,
29
- OtherResponsesApiWebSearchAction,
30
- ReasoningTextReasoningItemContent,
31
- SearchResponsesApiWebSearchAction,
32
- SummaryTextReasoningItemReasoningSummary,
33
- TextReasoningItemContent,
34
- )
35
-
36
-
37
- ReasoningItemContent = Annotated[
38
- ReasoningTextReasoningItemContent | TextReasoningItemContent,
39
- Discriminator("type"),
40
- ]
41
-
42
-
43
- FunctionCallOutputContentItem = Annotated[
44
- InputTextFunctionCallOutputContentItem | InputImageFunctionCallOutputContentItem,
45
- Discriminator("type"),
46
- ]
47
-
48
-
49
- WebSearchAction = Annotated[
50
- SearchResponsesApiWebSearchAction
51
- | OpenPageResponsesApiWebSearchAction
52
- | FindInPageResponsesApiWebSearchAction
53
- | OtherResponsesApiWebSearchAction,
54
- Discriminator("type"),
55
- ]
56
-
57
-
58
- class MessageResponseItem(CodexBaseModel):
59
- """Message response item."""
60
-
61
- type: Literal["message"] = "message"
62
- role: str
63
- content: list[ContentItem]
64
- end_turn: bool | None = None
65
- phase: Literal["commentary", "final_answer"] | None = None
66
-
67
-
68
- class ReasoningResponseItem(CodexBaseModel):
69
- """Reasoning response item."""
70
-
71
- type: Literal["reasoning"] = "reasoning"
72
- summary: list[SummaryTextReasoningItemReasoningSummary]
73
- content: list[ReasoningItemContent] | None = None
74
- encrypted_content: str | None = None
75
-
76
-
77
- class WebSearchCallResponseItem(CodexBaseModel):
78
- """Web search call response item."""
79
-
80
- type: Literal["web_search_call"] = "web_search_call"
81
- status: str | None = None
82
- action: WebSearchAction | None = None
83
-
84
-
85
- ResponseItem = Annotated[
86
- MessageResponseItem
87
- | ReasoningResponseItem
88
- | LocalShellCallResponseItem
89
- | FunctionCallResponseItem
90
- | FunctionCallOutputResponseItem
91
- | CustomToolCallResponseItem
92
- | CustomToolCallOutputResponseItem
93
- | WebSearchCallResponseItem
94
- | ImageGenerationCallResponseItem
95
- | GhostSnapshotResponseItem
96
- | CompactionResponseItem
97
- | OtherResponseItem,
98
- Discriminator("type"),
99
- ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes