codexed 1.1.3__tar.gz → 1.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codexed-1.1.3 → codexed-1.1.5}/PKG-INFO +1 -1
- {codexed-1.1.3 → codexed-1.1.5}/pyproject.toml +1 -1
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/__init__.py +2 -12
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/client/client.py +4 -4
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/client/session.py +31 -16
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/__init__.py +5 -12
- codexed-1.1.5/src/codexed/models/codex_types.py +13 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/event_data.py +2 -1
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/events.py +0 -80
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/misc.py +1 -3
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/request_params.py +5 -9
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/responses.py +5 -8
- codexed-1.1.3/src/codexed/models/codex_types.py +0 -156
- codexed-1.1.3/src/codexed/models/response_item.py +0 -99
- {codexed-1.1.3 → codexed-1.1.5}/LICENSE +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/README.md +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/README.md +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/client/__init__.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/client/dispatch.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/client/fs.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/client/realtime.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/client/skills.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/exceptions.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/helpers.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/log.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/base.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/mcp_server.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/thread_item.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/tool_config.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/user_input.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/models/v2_protocol.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/py.typed +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/request_handlers.py +0 -0
- {codexed-1.1.3 → codexed-1.1.5}/src/codexed/transport.py +0 -0
|
@@ -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
|
+
ExternalSandboxSandboxPolicy,
|
|
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,
|
|
@@ -110,7 +106,6 @@ from codexed.models import (
|
|
|
110
106
|
CodexEvent,
|
|
111
107
|
ItemCommandExecutionOutputDeltaNotification,
|
|
112
108
|
ConfigWarningMessage,
|
|
113
|
-
EventType,
|
|
114
109
|
ItemFileChangeOutputDeltaNotification,
|
|
115
110
|
FsChangedMessage,
|
|
116
111
|
ItemCompletedEvent,
|
|
@@ -151,7 +146,6 @@ __all__ = [
|
|
|
151
146
|
"ApprovalDecision",
|
|
152
147
|
"ApprovalHandler",
|
|
153
148
|
"ApprovalParams",
|
|
154
|
-
"ApprovalPolicy",
|
|
155
149
|
"ApprovalResponse",
|
|
156
150
|
"AskForApproval",
|
|
157
151
|
"BuiltinToolsConfig",
|
|
@@ -171,9 +165,8 @@ __all__ = [
|
|
|
171
165
|
"ConfigWarningNotification",
|
|
172
166
|
"DangerFullAccessSandboxPolicy",
|
|
173
167
|
"DynamicToolCallHandler",
|
|
174
|
-
"EventType",
|
|
175
168
|
"ExperimentalFeature",
|
|
176
|
-
"
|
|
169
|
+
"ExternalSandboxSandboxPolicy",
|
|
177
170
|
"FsChangedMessage",
|
|
178
171
|
"HttpMcpServer",
|
|
179
172
|
"ImageUserInput",
|
|
@@ -188,7 +181,6 @@ __all__ = [
|
|
|
188
181
|
"ItemPlanDeltaNotification",
|
|
189
182
|
"ItemReasoningTextDeltaNotification",
|
|
190
183
|
"ItemStartedEvent",
|
|
191
|
-
"ItemStatus",
|
|
192
184
|
"LocalImageUserInput",
|
|
193
185
|
"McpAuthStatus",
|
|
194
186
|
"McpElicitationHandler",
|
|
@@ -210,8 +202,6 @@ __all__ = [
|
|
|
210
202
|
"ReasoningEffort",
|
|
211
203
|
"ReasoningSummary",
|
|
212
204
|
"ReasoningTextDeltaNotification",
|
|
213
|
-
"RejectApprovalPolicy",
|
|
214
|
-
"RejectConfig",
|
|
215
205
|
"RetryLimitExceededError",
|
|
216
206
|
"ReviewDelivery",
|
|
217
207
|
"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,
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
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 |
|
|
106
|
+
user_input: str | Sequence[UserInput],
|
|
102
107
|
*,
|
|
103
108
|
model: str | None = None,
|
|
104
109
|
effort: ReasoningEffort | None = None,
|
|
105
|
-
approval_policy:
|
|
110
|
+
approval_policy: AskForApproval | None = None,
|
|
106
111
|
approvals_reviewer: ApprovalsReviewer | None = None,
|
|
107
112
|
cwd: str | None = None,
|
|
108
|
-
sandbox_policy: SandboxMode |
|
|
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
|
-
|
|
152
|
+
policy: SandboxPolicy | None = None
|
|
148
153
|
case str():
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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)]
|
|
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=
|
|
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 |
|
|
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)]
|
|
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:
|
|
248
|
+
approval_policy: AskForApproval | None = None,
|
|
234
249
|
approvals_reviewer: ApprovalsReviewer | None = None,
|
|
235
250
|
cwd: str | None = None,
|
|
236
|
-
sandbox_policy: SandboxMode |
|
|
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:
|
|
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,10 @@ from codexed.models.base import (
|
|
|
10
10
|
JsonRpcResponse,
|
|
11
11
|
)
|
|
12
12
|
from codexed.models.codex_types import (
|
|
13
|
-
ApprovalPolicy,
|
|
14
13
|
ElicitationAction,
|
|
15
|
-
ExternalSandboxPolicy,
|
|
16
14
|
ApprovalDecision,
|
|
17
|
-
ItemStatus,
|
|
18
15
|
NetworkApprovalProtocol,
|
|
19
16
|
NetworkPolicyRuleAction,
|
|
20
|
-
RejectApprovalPolicy,
|
|
21
|
-
RejectConfig,
|
|
22
17
|
SkillApprovalDecision,
|
|
23
18
|
)
|
|
24
19
|
|
|
@@ -40,7 +35,6 @@ from codexed.models.events import (
|
|
|
40
35
|
AppListUpdatedMessage,
|
|
41
36
|
CodexEvent,
|
|
42
37
|
DeltaEvent,
|
|
43
|
-
EventType,
|
|
44
38
|
ItemCompletedEvent,
|
|
45
39
|
ItemStartedEvent,
|
|
46
40
|
RawResponseItemCompletedEvent,
|
|
@@ -176,6 +170,7 @@ from codexed.models.v2_protocol import (
|
|
|
176
170
|
LocalShellCallResponseItem,
|
|
177
171
|
MessageResponseItem,
|
|
178
172
|
OtherResponseItem,
|
|
173
|
+
Granular,
|
|
179
174
|
ReasoningResponseItem,
|
|
180
175
|
ResponseItem,
|
|
181
176
|
WebSearchCallResponseItem,
|
|
@@ -283,6 +278,7 @@ from codexed.models.v2_protocol import (
|
|
|
283
278
|
Personality,
|
|
284
279
|
ReadOnlyAccess,
|
|
285
280
|
ReadOnlySandboxPolicy,
|
|
281
|
+
ExternalSandboxSandboxPolicy,
|
|
286
282
|
ReasoningEffort,
|
|
287
283
|
RestrictedReadOnlyAccess,
|
|
288
284
|
SandboxPolicy,
|
|
@@ -475,7 +471,6 @@ __all__ = [
|
|
|
475
471
|
"AppScreenshot",
|
|
476
472
|
"ApplyPatchToolConfig",
|
|
477
473
|
"ApprovalDecision",
|
|
478
|
-
"ApprovalPolicy",
|
|
479
474
|
"ApprovalsReviewer",
|
|
480
475
|
"AppsListParams",
|
|
481
476
|
"AppsListResponse",
|
|
@@ -549,7 +544,6 @@ __all__ = [
|
|
|
549
544
|
"ElicitationAction",
|
|
550
545
|
"ErrorMessage",
|
|
551
546
|
"ErrorNotification",
|
|
552
|
-
"EventType",
|
|
553
547
|
"ExecPolicyAmendment",
|
|
554
548
|
"ExperimentalFeature",
|
|
555
549
|
"ExperimentalFeatureListParams",
|
|
@@ -560,7 +554,8 @@ __all__ = [
|
|
|
560
554
|
"ExternalAgentConfigImportParams",
|
|
561
555
|
"ExternalAgentConfigMigrationItem",
|
|
562
556
|
"ExternalAgentConfigMigrationItemType",
|
|
563
|
-
"
|
|
557
|
+
"ExternalSandboxSandboxPolicy",
|
|
558
|
+
"ExternalSandboxSandboxPolicy",
|
|
564
559
|
"FeedbackUploadParams",
|
|
565
560
|
"FeedbackUploadResponse",
|
|
566
561
|
"FileChangeOutputDeltaNotification",
|
|
@@ -608,6 +603,7 @@ __all__ = [
|
|
|
608
603
|
"GhostCommit",
|
|
609
604
|
"GhostSnapshotResponseItem",
|
|
610
605
|
"GitInfo",
|
|
606
|
+
"Granular",
|
|
611
607
|
"GrepFilesToolConfig",
|
|
612
608
|
"HazelnutScope",
|
|
613
609
|
"HookCompletedMessage",
|
|
@@ -642,7 +638,6 @@ __all__ = [
|
|
|
642
638
|
"ItemReasoningTextDeltaNotification",
|
|
643
639
|
"ItemStartedData",
|
|
644
640
|
"ItemStartedEvent",
|
|
645
|
-
"ItemStatus",
|
|
646
641
|
"JsReplToolConfig",
|
|
647
642
|
"JsonRpcError",
|
|
648
643
|
"JsonRpcNotification",
|
|
@@ -723,8 +718,6 @@ __all__ = [
|
|
|
723
718
|
"ReasoningSummaryPartAddedNotification",
|
|
724
719
|
"ReasoningSummaryTextDeltaNotification",
|
|
725
720
|
"ReasoningTextDeltaNotification",
|
|
726
|
-
"RejectApprovalPolicy",
|
|
727
|
-
"RejectConfig",
|
|
728
721
|
"RemoteSkillSummary",
|
|
729
722
|
"RequestPermissionsToolConfig",
|
|
730
723
|
"RequestUserInputToolConfig",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Codex data types."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Literal
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Type aliases for Codex types
|
|
9
|
+
ApprovalDecision = Literal["allow", "allowForSession", "deny", "denyForSession"]
|
|
10
|
+
SkillApprovalDecision = Literal["allow", "deny"]
|
|
11
|
+
ElicitationAction = Literal["accept", "decline", "cancel"]
|
|
12
|
+
NetworkApprovalProtocol = Literal["http", "https", "socks5Tcp", "socks5Udp"]
|
|
13
|
+
NetworkPolicyRuleAction = Literal["allow", "deny"]
|
|
@@ -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:
|
|
33
|
+
item: ResponseItem
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
class ThreadStartedData(CodexBaseModel):
|
|
@@ -227,86 +227,6 @@ CodexEvent = Annotated[
|
|
|
227
227
|
codex_event_adapter: TypeAdapter[CodexEvent] = TypeAdapter(CodexEvent)
|
|
228
228
|
|
|
229
229
|
|
|
230
|
-
# ============================================================================
|
|
231
|
-
# Event type literals (for external use)
|
|
232
|
-
# ============================================================================
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
EventType = Literal[
|
|
236
|
-
# Error events
|
|
237
|
-
"error",
|
|
238
|
-
# Thread lifecycle
|
|
239
|
-
"thread/started",
|
|
240
|
-
"thread/status/changed",
|
|
241
|
-
"thread/archived",
|
|
242
|
-
"thread/unarchived",
|
|
243
|
-
"thread/name/updated",
|
|
244
|
-
"thread/tokenUsage/updated",
|
|
245
|
-
"thread/compacted",
|
|
246
|
-
# Turn lifecycle
|
|
247
|
-
"turn/started",
|
|
248
|
-
"turn/completed",
|
|
249
|
-
"turn/error",
|
|
250
|
-
"turn/diff/updated",
|
|
251
|
-
"turn/plan/updated",
|
|
252
|
-
# Hook events
|
|
253
|
-
"hook/started",
|
|
254
|
-
"hook/completed",
|
|
255
|
-
# Realtime voice events (EXPERIMENTAL)
|
|
256
|
-
"thread/realtime/started",
|
|
257
|
-
"thread/realtime/itemAdded",
|
|
258
|
-
"thread/realtime/transcriptUpdated",
|
|
259
|
-
"thread/realtime/outputAudio/delta",
|
|
260
|
-
"thread/realtime/error",
|
|
261
|
-
"thread/realtime/closed",
|
|
262
|
-
# Terminal control events
|
|
263
|
-
"command/exec/outputDelta",
|
|
264
|
-
# Fuzzy file search events (EXPERIMENTAL)
|
|
265
|
-
"fuzzyFileSearch/sessionUpdated",
|
|
266
|
-
"fuzzyFileSearch/sessionCompleted",
|
|
267
|
-
# Item lifecycle
|
|
268
|
-
"item/started",
|
|
269
|
-
"item/completed",
|
|
270
|
-
"rawResponseItem/completed",
|
|
271
|
-
# Item deltas - agent messages
|
|
272
|
-
"item/agentMessage/delta",
|
|
273
|
-
# Item deltas - plan
|
|
274
|
-
"item/plan/delta",
|
|
275
|
-
# Item deltas - reasoning
|
|
276
|
-
"item/reasoning/summaryTextDelta",
|
|
277
|
-
"item/reasoning/summaryPartAdded",
|
|
278
|
-
"item/reasoning/textDelta",
|
|
279
|
-
# Item deltas - command execution
|
|
280
|
-
"item/commandExecution/outputDelta",
|
|
281
|
-
"item/commandExecution/terminalInteraction",
|
|
282
|
-
# Item deltas - file changes
|
|
283
|
-
"item/fileChange/outputDelta",
|
|
284
|
-
# Item deltas - MCP tool calls
|
|
285
|
-
"item/mcpToolCall/progress",
|
|
286
|
-
# MCP server status
|
|
287
|
-
"mcpServer/startupStatus/updated",
|
|
288
|
-
# MCP OAuth
|
|
289
|
-
"mcpServer/oauthLogin/completed",
|
|
290
|
-
# Account/Auth events
|
|
291
|
-
"account/updated",
|
|
292
|
-
"account/rateLimits/updated",
|
|
293
|
-
"account/login/completed",
|
|
294
|
-
"authStatusChange",
|
|
295
|
-
"loginChatGptComplete",
|
|
296
|
-
# System events
|
|
297
|
-
"sessionConfigured",
|
|
298
|
-
"deprecationNotice",
|
|
299
|
-
"windows/worldWritableWarning",
|
|
300
|
-
# New events
|
|
301
|
-
"model/rerouted",
|
|
302
|
-
"configWarning",
|
|
303
|
-
"app/list/updated",
|
|
304
|
-
"fs/changed",
|
|
305
|
-
"thread/compacted/v2",
|
|
306
|
-
"serverRequest/resolved",
|
|
307
|
-
]
|
|
308
|
-
|
|
309
|
-
|
|
310
230
|
# Type alias for all delta events
|
|
311
231
|
DeltaEvent = (
|
|
312
232
|
ItemAgentMessageDeltaNotification
|
|
@@ -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:
|
|
@@ -12,12 +12,12 @@ from codexed.models.misc import (
|
|
|
12
12
|
NetworkPolicyAmendment,
|
|
13
13
|
ToolRequestUserInputQuestion,
|
|
14
14
|
)
|
|
15
|
-
from codexed.models.response_item import ResponseItem
|
|
16
15
|
from codexed.models.v2_protocol import (
|
|
17
16
|
ApprovalsReviewer,
|
|
18
17
|
AskForApproval,
|
|
19
18
|
CommandAction,
|
|
20
19
|
Personality,
|
|
20
|
+
ResponseItem,
|
|
21
21
|
SandboxMode,
|
|
22
22
|
ServiceTier,
|
|
23
23
|
)
|
|
@@ -168,13 +168,11 @@ class McpElicitationFormParams(_McpElicitationBase):
|
|
|
168
168
|
def to_mcp(self) -> ElicitRequestFormParams:
|
|
169
169
|
from mcp.types import ElicitRequestFormParams, RequestParams
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
return ElicitRequestFormParams(
|
|
172
172
|
message=self.message,
|
|
173
173
|
requestedSchema=self.requested_schema,
|
|
174
|
+
_meta=RequestParams.Meta(**self.meta) if self.meta else None, # pyright: ignore[reportArgumentType]
|
|
174
175
|
)
|
|
175
|
-
if self.meta is not None:
|
|
176
|
-
params.meta = RequestParams.Meta(**self.meta) # pyright: ignore[reportArgumentType]
|
|
177
|
-
return params
|
|
178
176
|
|
|
179
177
|
@classmethod
|
|
180
178
|
def from_mcp(
|
|
@@ -205,14 +203,12 @@ class McpElicitationUrlParams(_McpElicitationBase):
|
|
|
205
203
|
def to_mcp(self) -> ElicitRequestURLParams:
|
|
206
204
|
from mcp.types import ElicitRequestURLParams, RequestParams
|
|
207
205
|
|
|
208
|
-
|
|
206
|
+
return ElicitRequestURLParams(
|
|
209
207
|
message=self.message,
|
|
210
208
|
url=self.url,
|
|
211
209
|
elicitationId=self.elicitation_id,
|
|
210
|
+
_meta=RequestParams.Meta(**self.meta) if self.meta else None, # pyright: ignore[reportArgumentType]
|
|
212
211
|
)
|
|
213
|
-
if self.meta is not None:
|
|
214
|
-
params.meta = RequestParams.Meta(**self.meta) # pyright: ignore[reportArgumentType]
|
|
215
|
-
return params
|
|
216
212
|
|
|
217
213
|
@classmethod
|
|
218
214
|
def from_mcp(
|
|
@@ -5,12 +5,7 @@ from typing import Any
|
|
|
5
5
|
import mcp.types
|
|
6
6
|
|
|
7
7
|
from codexed.models.base import CodexBaseModel
|
|
8
|
-
from codexed.models.codex_types import
|
|
9
|
-
ApprovalDecision,
|
|
10
|
-
AskForApproval,
|
|
11
|
-
ElicitationAction,
|
|
12
|
-
SandboxPolicy,
|
|
13
|
-
)
|
|
8
|
+
from codexed.models.codex_types import ApprovalDecision, ElicitationAction
|
|
14
9
|
from codexed.models.misc import (
|
|
15
10
|
McpServerStatusEntry,
|
|
16
11
|
Thread,
|
|
@@ -19,9 +14,11 @@ from codexed.models.misc import (
|
|
|
19
14
|
TurnData,
|
|
20
15
|
)
|
|
21
16
|
from codexed.models.v2_protocol import (
|
|
17
|
+
AskForApproval,
|
|
22
18
|
AuthMode,
|
|
23
19
|
DynamicToolCallOutputContentItem,
|
|
24
20
|
ReasoningEffort,
|
|
21
|
+
SandboxPolicy,
|
|
25
22
|
ServiceTier,
|
|
26
23
|
)
|
|
27
24
|
|
|
@@ -67,12 +64,12 @@ class McpServerElicitationResponse(CodexBaseModel):
|
|
|
67
64
|
"""
|
|
68
65
|
|
|
69
66
|
def to_mcp(self) -> mcp.types.ElicitResult:
|
|
70
|
-
return mcp.types.ElicitResult(action=self.action, content=self.content)
|
|
67
|
+
return mcp.types.ElicitResult(action=self.action, content=self.content, _meta=self.meta)
|
|
71
68
|
|
|
72
69
|
@classmethod
|
|
73
70
|
def from_mcp(cls, result: mcp.types.ElicitResult) -> McpServerElicitationResponse:
|
|
74
71
|
"""Create from MCP ElicitResult."""
|
|
75
|
-
return cls(action=result.action, content=result.content)
|
|
72
|
+
return cls(action=result.action, content=result.content, meta=result.meta)
|
|
76
73
|
|
|
77
74
|
|
|
78
75
|
class ThreadReadResponse(CodexBaseModel):
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"""Codex data types."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from typing import Annotated, Any, Literal
|
|
6
|
-
|
|
7
|
-
from pydantic import BaseModel, Discriminator, Field, Tag
|
|
8
|
-
|
|
9
|
-
from codexed.models.base import CodexBaseModel
|
|
10
|
-
from codexed.models.v2_protocol import NetworkAccess, RestrictedReadOnlyAccess
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Type aliases for Codex types
|
|
14
|
-
ApprovalPolicy = Literal["untrusted", "on-failure", "on-request", "never"]
|
|
15
|
-
ItemStatus = Literal["pending", "running", "completed", "error"]
|
|
16
|
-
McpServerStartupState = Literal["starting", "ready", "failed", "cancelled"]
|
|
17
|
-
"""Action taken by the user on an elicitation request."""
|
|
18
|
-
ApprovalDecision = Literal["allow", "allowForSession", "deny", "denyForSession"]
|
|
19
|
-
SkillApprovalDecision = Literal["allow", "deny"]
|
|
20
|
-
ElicitationAction = Literal["accept", "decline", "cancel"]
|
|
21
|
-
NetworkApprovalProtocol = Literal["http", "https", "socks5Tcp", "socks5Udp"]
|
|
22
|
-
NetworkPolicyRuleAction = Literal["allow", "deny"]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# ============================================================================
|
|
26
|
-
# AskForApproval (tagged union: string literals or {"reject": RejectConfig})
|
|
27
|
-
# ============================================================================
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class RejectConfig(CodexBaseModel):
|
|
31
|
-
"""Fine-grained rejection controls for approval prompts.
|
|
32
|
-
|
|
33
|
-
When a field is True, prompts of that category are automatically
|
|
34
|
-
rejected instead of shown to the user.
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
sandbox_approval: bool
|
|
38
|
-
rules: bool
|
|
39
|
-
mcp_elicitations: bool
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class RejectApprovalPolicy(CodexBaseModel):
|
|
43
|
-
"""Approval policy variant with fine-grained rejection controls."""
|
|
44
|
-
|
|
45
|
-
reject: RejectConfig
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def _ask_for_approval_discriminator(v: Any) -> str:
|
|
49
|
-
match v:
|
|
50
|
-
case str():
|
|
51
|
-
return "simple"
|
|
52
|
-
case {"reject": _}:
|
|
53
|
-
return "reject"
|
|
54
|
-
case RejectApprovalPolicy():
|
|
55
|
-
return "reject"
|
|
56
|
-
case _:
|
|
57
|
-
return "simple"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
AskForApproval = Annotated[
|
|
61
|
-
Annotated[ApprovalPolicy, Tag("simple")] | Annotated[RejectApprovalPolicy, Tag("reject")],
|
|
62
|
-
Discriminator(_ask_for_approval_discriminator),
|
|
63
|
-
]
|
|
64
|
-
"""Full AskForApproval type: simple string policy or reject config."""
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
# ============================================================================
|
|
68
|
-
# SandboxPolicy (discriminated union on 'type' field)
|
|
69
|
-
# ============================================================================
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
# Mapping from camelCase type values (turn-level API) to kebab-case (thread-level API)
|
|
73
|
-
_SANDBOX_TYPE_ALIASES: dict[str, str] = {
|
|
74
|
-
"workspaceWrite": "workspace-write",
|
|
75
|
-
"dangerFullAccess": "danger-full-access",
|
|
76
|
-
"readOnly": "read-only",
|
|
77
|
-
"externalSandbox": "external-sandbox",
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
_READ_ONLY_ACCESS_TYPE_ALIASES: dict[str, str] = {
|
|
81
|
-
"fullAccess": "full-access",
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def _sandbox_policy_discriminator(v: Any) -> str:
|
|
86
|
-
match v:
|
|
87
|
-
case {"type": str(raw_type)}:
|
|
88
|
-
return _SANDBOX_TYPE_ALIASES.get(raw_type, raw_type)
|
|
89
|
-
case BaseModel():
|
|
90
|
-
return str(type(v).model_fields["type"].default)
|
|
91
|
-
case _:
|
|
92
|
-
return str(v)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def _read_only_access_discriminator(v: Any) -> str:
|
|
96
|
-
match v:
|
|
97
|
-
case {"type": str(raw_type)}:
|
|
98
|
-
return _READ_ONLY_ACCESS_TYPE_ALIASES.get(raw_type, raw_type)
|
|
99
|
-
case BaseModel():
|
|
100
|
-
return str(type(v).model_fields["type"].default)
|
|
101
|
-
case _:
|
|
102
|
-
return str(v)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
class FullAccessReadOnlyAccess(CodexBaseModel):
|
|
106
|
-
"""Allow unrestricted file reads."""
|
|
107
|
-
|
|
108
|
-
type: Literal["full-access", "fullAccess"]
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
ReadOnlyAccess = Annotated[
|
|
112
|
-
Annotated[RestrictedReadOnlyAccess, Tag("restricted")]
|
|
113
|
-
| Annotated[FullAccessReadOnlyAccess, Tag("full-access")],
|
|
114
|
-
Discriminator(_read_only_access_discriminator),
|
|
115
|
-
]
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
class DangerFullAccessSandboxPolicy(CodexBaseModel):
|
|
119
|
-
"""No restrictions whatsoever. Use with caution."""
|
|
120
|
-
|
|
121
|
-
type: Literal["danger-full-access", "dangerFullAccess"]
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
class ReadOnlySandboxPolicy(CodexBaseModel):
|
|
125
|
-
"""Read-only access configuration."""
|
|
126
|
-
|
|
127
|
-
type: Literal["read-only", "readOnly"]
|
|
128
|
-
access: ReadOnlyAccess | None = None
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
class ExternalSandboxPolicy(CodexBaseModel):
|
|
132
|
-
"""Process is already in an external sandbox."""
|
|
133
|
-
|
|
134
|
-
type: Literal["external-sandbox", "externalSandbox"]
|
|
135
|
-
network_access: NetworkAccess = "restricted"
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
class WorkspaceWriteSandboxPolicy(CodexBaseModel):
|
|
139
|
-
"""Grants write access to the workspace directory."""
|
|
140
|
-
|
|
141
|
-
type: Literal["workspace-write", "workspaceWrite"]
|
|
142
|
-
writable_roots: list[str] = Field(default_factory=list)
|
|
143
|
-
read_only_access: ReadOnlyAccess | None = None
|
|
144
|
-
network_access: bool = False
|
|
145
|
-
exclude_slash_tmp: bool = False
|
|
146
|
-
exclude_tmpdir_env_var: bool = False
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
SandboxPolicy = Annotated[
|
|
150
|
-
Annotated[DangerFullAccessSandboxPolicy, Tag("danger-full-access")]
|
|
151
|
-
| Annotated[ReadOnlySandboxPolicy, Tag("read-only")]
|
|
152
|
-
| Annotated[ExternalSandboxPolicy, Tag("external-sandbox")]
|
|
153
|
-
| Annotated[WorkspaceWriteSandboxPolicy, Tag("workspace-write")],
|
|
154
|
-
Discriminator(_sandbox_policy_discriminator),
|
|
155
|
-
]
|
|
156
|
-
"""Discriminated union for sandbox execution restrictions."""
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|