codexed 1.1.3__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.
- {codexed-1.1.3 → codexed-1.1.4}/PKG-INFO +1 -1
- {codexed-1.1.3 → codexed-1.1.4}/pyproject.toml +1 -1
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/__init__.py +0 -8
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/client/client.py +4 -4
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/client/session.py +31 -16
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/__init__.py +4 -8
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/codex_types.py +0 -46
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/event_data.py +2 -1
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/misc.py +1 -3
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/request_params.py +5 -9
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/responses.py +3 -3
- codexed-1.1.3/src/codexed/models/response_item.py +0 -99
- {codexed-1.1.3 → codexed-1.1.4}/LICENSE +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/README.md +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/README.md +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/client/__init__.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/client/dispatch.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/client/fs.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/client/realtime.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/client/skills.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/exceptions.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/helpers.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/log.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/base.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/events.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/mcp_server.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/thread_item.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/tool_config.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/user_input.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/models/v2_protocol.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/py.typed +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/src/codexed/request_handlers.py +0 -0
- {codexed-1.1.3 → codexed-1.1.4}/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
|
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,
|
|
@@ -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,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
|
|
|
@@ -176,6 +172,7 @@ from codexed.models.v2_protocol import (
|
|
|
176
172
|
LocalShellCallResponseItem,
|
|
177
173
|
MessageResponseItem,
|
|
178
174
|
OtherResponseItem,
|
|
175
|
+
Granular,
|
|
179
176
|
ReasoningResponseItem,
|
|
180
177
|
ResponseItem,
|
|
181
178
|
WebSearchCallResponseItem,
|
|
@@ -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,10 +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
|
-
McpServerStartupState = Literal["starting", "ready", "failed", "cancelled"]
|
|
17
|
-
"""Action taken by the user on an elicitation request."""
|
|
18
14
|
ApprovalDecision = Literal["allow", "allowForSession", "deny", "denyForSession"]
|
|
19
15
|
SkillApprovalDecision = Literal["allow", "deny"]
|
|
20
16
|
ElicitationAction = Literal["accept", "decline", "cancel"]
|
|
@@ -22,48 +18,6 @@ NetworkApprovalProtocol = Literal["http", "https", "socks5Tcp", "socks5Udp"]
|
|
|
22
18
|
NetworkPolicyRuleAction = Literal["allow", "deny"]
|
|
23
19
|
|
|
24
20
|
|
|
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
21
|
# ============================================================================
|
|
68
22
|
# SandboxPolicy (discriminated union on 'type' field)
|
|
69
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:
|
|
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:
|
|
@@ -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(
|
|
@@ -7,7 +7,6 @@ import mcp.types
|
|
|
7
7
|
from codexed.models.base import CodexBaseModel
|
|
8
8
|
from codexed.models.codex_types import (
|
|
9
9
|
ApprovalDecision,
|
|
10
|
-
AskForApproval,
|
|
11
10
|
ElicitationAction,
|
|
12
11
|
SandboxPolicy,
|
|
13
12
|
)
|
|
@@ -19,6 +18,7 @@ from codexed.models.misc import (
|
|
|
19
18
|
TurnData,
|
|
20
19
|
)
|
|
21
20
|
from codexed.models.v2_protocol import (
|
|
21
|
+
AskForApproval,
|
|
22
22
|
AuthMode,
|
|
23
23
|
DynamicToolCallOutputContentItem,
|
|
24
24
|
ReasoningEffort,
|
|
@@ -67,12 +67,12 @@ class McpServerElicitationResponse(CodexBaseModel):
|
|
|
67
67
|
"""
|
|
68
68
|
|
|
69
69
|
def to_mcp(self) -> mcp.types.ElicitResult:
|
|
70
|
-
return mcp.types.ElicitResult(action=self.action, content=self.content)
|
|
70
|
+
return mcp.types.ElicitResult(action=self.action, content=self.content, _meta=self.meta)
|
|
71
71
|
|
|
72
72
|
@classmethod
|
|
73
73
|
def from_mcp(cls, result: mcp.types.ElicitResult) -> McpServerElicitationResponse:
|
|
74
74
|
"""Create from MCP ElicitResult."""
|
|
75
|
-
return cls(action=result.action, content=result.content)
|
|
75
|
+
return cls(action=result.action, content=result.content, meta=result.meta)
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
class ThreadReadResponse(CodexBaseModel):
|
|
@@ -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
|
|
File without changes
|