codexed 0.0.8__tar.gz → 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codexed-0.0.8 → codexed-0.1.0}/PKG-INFO +1 -1
- {codexed-0.0.8 → codexed-0.1.0}/pyproject.toml +1 -1
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/__init__.py +2 -6
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/client.py +4 -6
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/__init__.py +126 -8
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/codex_types.py +3 -3
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/events.py +141 -0
- codexed-0.1.0/src/codexed/models/fuzzy_search.py +106 -0
- codexed-0.1.0/src/codexed/models/hooks.py +88 -0
- codexed-0.1.0/src/codexed/models/realtime.py +135 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/request_params.py +12 -8
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/response_item.py +20 -24
- codexed-0.1.0/src/codexed/models/terminal.py +84 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/thread_item.py +4 -6
- {codexed-0.0.8 → codexed-0.1.0}/LICENSE +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/README.md +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/README.md +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/exceptions.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/helpers.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/log.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/base.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/command_action.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/event_data.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/mcp_server.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/misc.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/responses.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/thread_status.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/token_usage.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/tool_config.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/user_input.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/models/web_search.py +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/py.typed +0 -0
- {codexed-0.0.8 → codexed-0.1.0}/src/codexed/request_handlers.py +0 -0
|
@@ -83,19 +83,17 @@ from codexed.models.codex_types import (
|
|
|
83
83
|
AskForApproval,
|
|
84
84
|
CollabAgentStatus,
|
|
85
85
|
CollabAgentTool,
|
|
86
|
-
CollabAgentToolCallStatus,
|
|
87
86
|
CollaborationMode,
|
|
88
87
|
CollaborationModeSettings,
|
|
89
88
|
CommandExecutionStatus,
|
|
90
89
|
DangerFullAccessSandboxPolicy,
|
|
91
|
-
DynamicToolCallStatus,
|
|
92
90
|
ExternalSandboxPolicy,
|
|
93
91
|
ApprovalDecision,
|
|
94
92
|
InputModality,
|
|
95
93
|
ItemStatus,
|
|
96
94
|
ItemType,
|
|
97
95
|
McpAuthStatusValue,
|
|
98
|
-
|
|
96
|
+
ToolCallStatus,
|
|
99
97
|
MessagePhase,
|
|
100
98
|
ModeKind,
|
|
101
99
|
ModelProvider,
|
|
@@ -184,7 +182,6 @@ __all__ = [
|
|
|
184
182
|
"CodexRequestError",
|
|
185
183
|
"CollabAgentStatus",
|
|
186
184
|
"CollabAgentTool",
|
|
187
|
-
"CollabAgentToolCallStatus",
|
|
188
185
|
"CollaborationMode",
|
|
189
186
|
"CollaborationModeSettings",
|
|
190
187
|
"CommandExecResponse",
|
|
@@ -195,7 +192,6 @@ __all__ = [
|
|
|
195
192
|
"ConfigWarningEvent",
|
|
196
193
|
"DangerFullAccessSandboxPolicy",
|
|
197
194
|
"DynamicToolCallHandler",
|
|
198
|
-
"DynamicToolCallStatus",
|
|
199
195
|
"EventData",
|
|
200
196
|
"EventType",
|
|
201
197
|
"ExperimentalFeature",
|
|
@@ -213,7 +209,6 @@ __all__ = [
|
|
|
213
209
|
"McpAuthStatusValue",
|
|
214
210
|
"McpElicitationHandler",
|
|
215
211
|
"McpServerConfig",
|
|
216
|
-
"McpToolCallStatus",
|
|
217
212
|
"MessagePhase",
|
|
218
213
|
"MethodNotFoundError",
|
|
219
214
|
"ModeKind",
|
|
@@ -269,6 +264,7 @@ __all__ = [
|
|
|
269
264
|
"ThreadUnarchivedData",
|
|
270
265
|
"ThreadUnarchivedEvent",
|
|
271
266
|
"TokenUsageBreakdown",
|
|
267
|
+
"ToolCallStatus",
|
|
272
268
|
"ToolConfig",
|
|
273
269
|
"TransportClosedError",
|
|
274
270
|
"TurnCompletedData",
|
|
@@ -507,6 +507,8 @@ class CodexClient:
|
|
|
507
507
|
merged = dict(config) if config else {}
|
|
508
508
|
if code_mode is not None:
|
|
509
509
|
merged.setdefault("features", {})["code_mode"] = code_mode
|
|
510
|
+
merged.setdefault("features", {})["codex_hooks"] = True
|
|
511
|
+
merged.setdefault("features", {})["realtime_conversation"] = True
|
|
510
512
|
if tools is not None:
|
|
511
513
|
from codexed.models.tool_config import tools_to_config_dict
|
|
512
514
|
|
|
@@ -698,7 +700,7 @@ class CodexClient:
|
|
|
698
700
|
self._active_threads.add(response.thread.id)
|
|
699
701
|
session = Session(self, response)
|
|
700
702
|
if turn_id is not None:
|
|
701
|
-
await
|
|
703
|
+
await session.rollback_to_turn(turn_id)
|
|
702
704
|
return session
|
|
703
705
|
|
|
704
706
|
async def thread_list(
|
|
@@ -1157,11 +1159,7 @@ class CodexClient:
|
|
|
1157
1159
|
# Model methods
|
|
1158
1160
|
# ========================================================================
|
|
1159
1161
|
|
|
1160
|
-
async def model_list(
|
|
1161
|
-
self,
|
|
1162
|
-
*,
|
|
1163
|
-
include_hidden: bool | None = None,
|
|
1164
|
-
) -> list[ModelData]:
|
|
1162
|
+
async def model_list(self, *, include_hidden: bool | None = None) -> list[ModelData]:
|
|
1165
1163
|
"""List available models with reasoning effort options.
|
|
1166
1164
|
|
|
1167
1165
|
Args:
|
|
@@ -14,12 +14,10 @@ from codexed.models.codex_types import (
|
|
|
14
14
|
AskForApproval,
|
|
15
15
|
CollabAgentStatus,
|
|
16
16
|
CollabAgentTool,
|
|
17
|
-
CollabAgentToolCallStatus,
|
|
18
17
|
CollaborationMode,
|
|
19
18
|
CollaborationModeSettings,
|
|
20
19
|
CommandExecutionStatus,
|
|
21
20
|
DangerFullAccessSandboxPolicy,
|
|
22
|
-
DynamicToolCallStatus,
|
|
23
21
|
ElicitationAction,
|
|
24
22
|
ExperimentalFeatureStage,
|
|
25
23
|
ExternalAgentConfigMigrationItemType,
|
|
@@ -30,7 +28,7 @@ from codexed.models.codex_types import (
|
|
|
30
28
|
ItemStatus,
|
|
31
29
|
ItemType,
|
|
32
30
|
McpAuthStatusValue,
|
|
33
|
-
|
|
31
|
+
ToolCallStatus,
|
|
34
32
|
MergeStrategy,
|
|
35
33
|
MessagePhase,
|
|
36
34
|
ModeKind,
|
|
@@ -111,6 +109,61 @@ from codexed.models.event_data import (
|
|
|
111
109
|
TurnStartedData,
|
|
112
110
|
WindowsWorldWritableWarningData,
|
|
113
111
|
)
|
|
112
|
+
from codexed.models.hooks import (
|
|
113
|
+
HookCompletedData,
|
|
114
|
+
HookEventName,
|
|
115
|
+
HookExecutionMode,
|
|
116
|
+
HookHandlerType,
|
|
117
|
+
HookOutputEntry,
|
|
118
|
+
HookOutputEntryKind,
|
|
119
|
+
HookRunStatus,
|
|
120
|
+
HookRunSummary,
|
|
121
|
+
HookScope,
|
|
122
|
+
HookStartedData,
|
|
123
|
+
)
|
|
124
|
+
from codexed.models.fuzzy_search import (
|
|
125
|
+
FuzzyFileSearchMatchType,
|
|
126
|
+
FuzzyFileSearchParams,
|
|
127
|
+
FuzzyFileSearchResponse,
|
|
128
|
+
FuzzyFileSearchResult,
|
|
129
|
+
FuzzyFileSearchSessionCompletedData,
|
|
130
|
+
FuzzyFileSearchSessionStartParams,
|
|
131
|
+
FuzzyFileSearchSessionStartResponse,
|
|
132
|
+
FuzzyFileSearchSessionStopParams,
|
|
133
|
+
FuzzyFileSearchSessionStopResponse,
|
|
134
|
+
FuzzyFileSearchSessionUpdateParams,
|
|
135
|
+
FuzzyFileSearchSessionUpdateResponse,
|
|
136
|
+
FuzzyFileSearchSessionUpdatedData,
|
|
137
|
+
)
|
|
138
|
+
from codexed.models.realtime import (
|
|
139
|
+
RealtimeAppendAudioParams,
|
|
140
|
+
RealtimeAppendAudioResponse,
|
|
141
|
+
RealtimeAppendTextParams,
|
|
142
|
+
RealtimeAppendTextResponse,
|
|
143
|
+
RealtimeAudioChunk,
|
|
144
|
+
RealtimeClosedData,
|
|
145
|
+
RealtimeConversationVersion,
|
|
146
|
+
RealtimeErrorData,
|
|
147
|
+
RealtimeItemAddedData,
|
|
148
|
+
RealtimeOutputAudioDeltaData,
|
|
149
|
+
RealtimeStartedData,
|
|
150
|
+
RealtimeStartParams,
|
|
151
|
+
RealtimeStartResponse,
|
|
152
|
+
RealtimeStopParams,
|
|
153
|
+
RealtimeStopResponse,
|
|
154
|
+
RealtimeTranscriptUpdatedData,
|
|
155
|
+
)
|
|
156
|
+
from codexed.models.terminal import (
|
|
157
|
+
CommandExecOutputStream,
|
|
158
|
+
CommandExecOutputDeltaData,
|
|
159
|
+
CommandExecResizeParams,
|
|
160
|
+
CommandExecResizeResponse,
|
|
161
|
+
CommandExecTerminalSize,
|
|
162
|
+
CommandExecTerminateParams,
|
|
163
|
+
CommandExecTerminateResponse,
|
|
164
|
+
CommandExecWriteParams,
|
|
165
|
+
CommandExecWriteResponse,
|
|
166
|
+
)
|
|
114
167
|
from codexed.models.events import (
|
|
115
168
|
AccountLoginCompletedEvent,
|
|
116
169
|
AccountRateLimitsUpdatedEvent,
|
|
@@ -124,6 +177,17 @@ from codexed.models.events import (
|
|
|
124
177
|
ConfigWarningEvent,
|
|
125
178
|
ContextCompactedEvent,
|
|
126
179
|
DeltaEvent,
|
|
180
|
+
HookCompletedEvent,
|
|
181
|
+
HookStartedEvent,
|
|
182
|
+
CommandExecOutputDeltaEvent,
|
|
183
|
+
FuzzyFileSearchSessionCompletedEvent,
|
|
184
|
+
FuzzyFileSearchSessionUpdatedEvent,
|
|
185
|
+
RealtimeClosedEvent,
|
|
186
|
+
RealtimeErrorEvent,
|
|
187
|
+
RealtimeItemAddedEvent,
|
|
188
|
+
RealtimeOutputAudioDeltaEvent,
|
|
189
|
+
RealtimeStartedEvent,
|
|
190
|
+
RealtimeTranscriptUpdatedEvent,
|
|
127
191
|
DeprecationNoticeEvent,
|
|
128
192
|
ErrorEvent,
|
|
129
193
|
EventType,
|
|
@@ -240,7 +304,6 @@ from codexed.models.request_params import (
|
|
|
240
304
|
ListMcpServerStatusParams,
|
|
241
305
|
LoginAccountParams,
|
|
242
306
|
LoginType,
|
|
243
|
-
McpElicitationAction,
|
|
244
307
|
McpElicitationFormParams,
|
|
245
308
|
McpElicitationUrlParams,
|
|
246
309
|
McpServerElicitationRequestParams,
|
|
@@ -449,7 +512,6 @@ __all__ = [
|
|
|
449
512
|
"CollabAgentState",
|
|
450
513
|
"CollabAgentStatus",
|
|
451
514
|
"CollabAgentTool",
|
|
452
|
-
"CollabAgentToolCallStatus",
|
|
453
515
|
"CollabToolsConfig",
|
|
454
516
|
"CollaborationMode",
|
|
455
517
|
"CollaborationModeListParams",
|
|
@@ -461,8 +523,18 @@ __all__ = [
|
|
|
461
523
|
"CommandActionRead",
|
|
462
524
|
"CommandActionSearch",
|
|
463
525
|
"CommandActionUnknown",
|
|
526
|
+
"CommandExecOutputDeltaData",
|
|
527
|
+
"CommandExecOutputDeltaEvent",
|
|
528
|
+
"CommandExecOutputStream",
|
|
464
529
|
"CommandExecParams",
|
|
530
|
+
"CommandExecResizeParams",
|
|
531
|
+
"CommandExecResizeResponse",
|
|
465
532
|
"CommandExecResponse",
|
|
533
|
+
"CommandExecTerminalSize",
|
|
534
|
+
"CommandExecTerminateParams",
|
|
535
|
+
"CommandExecTerminateResponse",
|
|
536
|
+
"CommandExecWriteParams",
|
|
537
|
+
"CommandExecWriteResponse",
|
|
466
538
|
"CommandExecutionOutputDeltaData",
|
|
467
539
|
"CommandExecutionOutputDeltaEvent",
|
|
468
540
|
"CommandExecutionRequestApprovalParams",
|
|
@@ -498,7 +570,6 @@ __all__ = [
|
|
|
498
570
|
"DynamicToolCallOutputContentItem",
|
|
499
571
|
"DynamicToolCallParams",
|
|
500
572
|
"DynamicToolCallResponse",
|
|
501
|
-
"DynamicToolCallStatus",
|
|
502
573
|
"ElicitationAction",
|
|
503
574
|
"ErrorEvent",
|
|
504
575
|
"ErrorEventData",
|
|
@@ -541,6 +612,20 @@ __all__ = [
|
|
|
541
612
|
"FunctionCallOutputPayload",
|
|
542
613
|
"FunctionCallOutputResponseItem",
|
|
543
614
|
"FunctionCallResponseItem",
|
|
615
|
+
"FuzzyFileSearchMatchType",
|
|
616
|
+
"FuzzyFileSearchParams",
|
|
617
|
+
"FuzzyFileSearchResponse",
|
|
618
|
+
"FuzzyFileSearchResult",
|
|
619
|
+
"FuzzyFileSearchSessionCompletedData",
|
|
620
|
+
"FuzzyFileSearchSessionCompletedEvent",
|
|
621
|
+
"FuzzyFileSearchSessionStartParams",
|
|
622
|
+
"FuzzyFileSearchSessionStartResponse",
|
|
623
|
+
"FuzzyFileSearchSessionStopParams",
|
|
624
|
+
"FuzzyFileSearchSessionStopResponse",
|
|
625
|
+
"FuzzyFileSearchSessionUpdateParams",
|
|
626
|
+
"FuzzyFileSearchSessionUpdateResponse",
|
|
627
|
+
"FuzzyFileSearchSessionUpdatedData",
|
|
628
|
+
"FuzzyFileSearchSessionUpdatedEvent",
|
|
544
629
|
"GetAccountParams",
|
|
545
630
|
"GetAccountRateLimitsResponse",
|
|
546
631
|
"GetAccountResponse",
|
|
@@ -548,6 +633,18 @@ __all__ = [
|
|
|
548
633
|
"GhostSnapshotResponseItem",
|
|
549
634
|
"GitInfo",
|
|
550
635
|
"GrepFilesToolConfig",
|
|
636
|
+
"HookCompletedData",
|
|
637
|
+
"HookCompletedEvent",
|
|
638
|
+
"HookEventName",
|
|
639
|
+
"HookExecutionMode",
|
|
640
|
+
"HookHandlerType",
|
|
641
|
+
"HookOutputEntry",
|
|
642
|
+
"HookOutputEntryKind",
|
|
643
|
+
"HookRunStatus",
|
|
644
|
+
"HookRunSummary",
|
|
645
|
+
"HookScope",
|
|
646
|
+
"HookStartedData",
|
|
647
|
+
"HookStartedEvent",
|
|
551
648
|
"HttpMcpServer",
|
|
552
649
|
"ImageGenerationCallResponseItem",
|
|
553
650
|
"ImageGenerationToolConfig",
|
|
@@ -574,7 +671,6 @@ __all__ = [
|
|
|
574
671
|
"LoginChatGptCompleteEvent",
|
|
575
672
|
"LoginType",
|
|
576
673
|
"McpAuthStatusValue",
|
|
577
|
-
"McpElicitationAction",
|
|
578
674
|
"McpElicitationFormParams",
|
|
579
675
|
"McpElicitationUrlParams",
|
|
580
676
|
"McpResource",
|
|
@@ -594,7 +690,6 @@ __all__ = [
|
|
|
594
690
|
"McpToolCallProgressData",
|
|
595
691
|
"McpToolCallProgressEvent",
|
|
596
692
|
"McpToolCallResult",
|
|
597
|
-
"McpToolCallStatus",
|
|
598
693
|
"MergeStrategy",
|
|
599
694
|
"MessagePhase",
|
|
600
695
|
"MessageResponseItem",
|
|
@@ -632,6 +727,28 @@ __all__ = [
|
|
|
632
727
|
"ReadFileToolConfig",
|
|
633
728
|
"ReadOnlyAccess",
|
|
634
729
|
"ReadOnlySandboxPolicy",
|
|
730
|
+
"RealtimeAppendAudioParams",
|
|
731
|
+
"RealtimeAppendAudioResponse",
|
|
732
|
+
"RealtimeAppendTextParams",
|
|
733
|
+
"RealtimeAppendTextResponse",
|
|
734
|
+
"RealtimeAudioChunk",
|
|
735
|
+
"RealtimeClosedData",
|
|
736
|
+
"RealtimeClosedEvent",
|
|
737
|
+
"RealtimeConversationVersion",
|
|
738
|
+
"RealtimeErrorData",
|
|
739
|
+
"RealtimeErrorEvent",
|
|
740
|
+
"RealtimeItemAddedData",
|
|
741
|
+
"RealtimeItemAddedEvent",
|
|
742
|
+
"RealtimeOutputAudioDeltaData",
|
|
743
|
+
"RealtimeOutputAudioDeltaEvent",
|
|
744
|
+
"RealtimeStartParams",
|
|
745
|
+
"RealtimeStartResponse",
|
|
746
|
+
"RealtimeStartedData",
|
|
747
|
+
"RealtimeStartedEvent",
|
|
748
|
+
"RealtimeStopParams",
|
|
749
|
+
"RealtimeStopResponse",
|
|
750
|
+
"RealtimeTranscriptUpdatedData",
|
|
751
|
+
"RealtimeTranscriptUpdatedEvent",
|
|
635
752
|
"ReasoningEffort",
|
|
636
753
|
"ReasoningEffortOption",
|
|
637
754
|
"ReasoningResponseItem",
|
|
@@ -743,6 +860,7 @@ __all__ = [
|
|
|
743
860
|
"ThreadUnsubscribeParams",
|
|
744
861
|
"ThreadUnsubscribeResponse",
|
|
745
862
|
"TokenUsageBreakdown",
|
|
863
|
+
"ToolCallStatus",
|
|
746
864
|
"ToolConfig",
|
|
747
865
|
"ToolRequestUserInputAnswer",
|
|
748
866
|
"ToolRequestUserInputOption",
|
|
@@ -27,6 +27,8 @@ ItemType = Literal[
|
|
|
27
27
|
"mcp_tool_call",
|
|
28
28
|
]
|
|
29
29
|
ItemStatus = Literal["pending", "running", "completed", "error"]
|
|
30
|
+
McpElicitationAction = Literal["accept", "decline", "cancel"]
|
|
31
|
+
"""Action taken by the user on an elicitation request."""
|
|
30
32
|
|
|
31
33
|
# New type aliases
|
|
32
34
|
SessionSource = Literal["cli", "vscode", "exec", "appServer", "unknown"]
|
|
@@ -46,10 +48,8 @@ ThreadSourceKind = Literal[
|
|
|
46
48
|
MessagePhase = Literal["commentary", "final_answer"]
|
|
47
49
|
PatchApplyStatus = Literal["inProgress", "completed", "failed", "declined"]
|
|
48
50
|
CommandExecutionStatus = Literal["inProgress", "completed", "failed", "declined"]
|
|
49
|
-
|
|
50
|
-
DynamicToolCallStatus = Literal["inProgress", "completed", "failed"]
|
|
51
|
+
ToolCallStatus = Literal["inProgress", "completed", "failed"]
|
|
51
52
|
CollabAgentTool = Literal["spawnAgent", "sendInput", "resumeAgent", "wait", "closeAgent"]
|
|
52
|
-
CollabAgentToolCallStatus = Literal["inProgress", "completed", "failed"]
|
|
53
53
|
CollabAgentStatus = Literal[
|
|
54
54
|
"pendingInit", "running", "completed", "errored", "shutdown", "notFound"
|
|
55
55
|
]
|
|
@@ -52,6 +52,20 @@ from codexed.models.event_data import ( # noqa: TC001
|
|
|
52
52
|
TurnStartedData,
|
|
53
53
|
WindowsWorldWritableWarningData,
|
|
54
54
|
)
|
|
55
|
+
from codexed.models.fuzzy_search import ( # noqa: TC001
|
|
56
|
+
FuzzyFileSearchSessionCompletedData,
|
|
57
|
+
FuzzyFileSearchSessionUpdatedData,
|
|
58
|
+
)
|
|
59
|
+
from codexed.models.hooks import HookCompletedData, HookStartedData # noqa: TC001
|
|
60
|
+
from codexed.models.realtime import ( # noqa: TC001
|
|
61
|
+
RealtimeClosedData,
|
|
62
|
+
RealtimeErrorData,
|
|
63
|
+
RealtimeItemAddedData,
|
|
64
|
+
RealtimeOutputAudioDeltaData,
|
|
65
|
+
RealtimeStartedData,
|
|
66
|
+
RealtimeTranscriptUpdatedData,
|
|
67
|
+
)
|
|
68
|
+
from codexed.models.terminal import CommandExecOutputDeltaData # noqa: TC001
|
|
55
69
|
|
|
56
70
|
|
|
57
71
|
if TYPE_CHECKING:
|
|
@@ -174,6 +188,103 @@ class TurnPlanUpdatedEvent(CodexBaseModel):
|
|
|
174
188
|
data: TurnPlanUpdatedData
|
|
175
189
|
|
|
176
190
|
|
|
191
|
+
# ============================================================================
|
|
192
|
+
# Hook events
|
|
193
|
+
# ============================================================================
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class HookStartedEvent(CodexBaseModel):
|
|
197
|
+
"""Hook started event."""
|
|
198
|
+
|
|
199
|
+
event_type: Literal["hook/started"] = "hook/started"
|
|
200
|
+
data: HookStartedData
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class HookCompletedEvent(CodexBaseModel):
|
|
204
|
+
"""Hook completed event."""
|
|
205
|
+
|
|
206
|
+
event_type: Literal["hook/completed"] = "hook/completed"
|
|
207
|
+
data: HookCompletedData
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
# ============================================================================
|
|
211
|
+
# Realtime voice events (EXPERIMENTAL)
|
|
212
|
+
# ============================================================================
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class RealtimeStartedEvent(CodexBaseModel):
|
|
216
|
+
"""Realtime session started event."""
|
|
217
|
+
|
|
218
|
+
event_type: Literal["thread/realtime/started"] = "thread/realtime/started"
|
|
219
|
+
data: RealtimeStartedData
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class RealtimeItemAddedEvent(CodexBaseModel):
|
|
223
|
+
"""Realtime item added event."""
|
|
224
|
+
|
|
225
|
+
event_type: Literal["thread/realtime/itemAdded"] = "thread/realtime/itemAdded"
|
|
226
|
+
data: RealtimeItemAddedData
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class RealtimeTranscriptUpdatedEvent(CodexBaseModel):
|
|
230
|
+
"""Realtime transcript updated event."""
|
|
231
|
+
|
|
232
|
+
event_type: Literal["thread/realtime/transcriptUpdated"] = "thread/realtime/transcriptUpdated"
|
|
233
|
+
data: RealtimeTranscriptUpdatedData
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class RealtimeOutputAudioDeltaEvent(CodexBaseModel):
|
|
237
|
+
"""Realtime output audio delta event."""
|
|
238
|
+
|
|
239
|
+
event_type: Literal["thread/realtime/outputAudio/delta"] = "thread/realtime/outputAudio/delta"
|
|
240
|
+
data: RealtimeOutputAudioDeltaData
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class RealtimeErrorEvent(CodexBaseModel):
|
|
244
|
+
"""Realtime error event."""
|
|
245
|
+
|
|
246
|
+
event_type: Literal["thread/realtime/error"] = "thread/realtime/error"
|
|
247
|
+
data: RealtimeErrorData
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class RealtimeClosedEvent(CodexBaseModel):
|
|
251
|
+
"""Realtime session closed event."""
|
|
252
|
+
|
|
253
|
+
event_type: Literal["thread/realtime/closed"] = "thread/realtime/closed"
|
|
254
|
+
data: RealtimeClosedData
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
# ============================================================================
|
|
258
|
+
# Terminal control events
|
|
259
|
+
# ============================================================================
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class CommandExecOutputDeltaEvent(CodexBaseModel):
|
|
263
|
+
"""Command exec output delta event (streaming stdout/stderr)."""
|
|
264
|
+
|
|
265
|
+
event_type: Literal["command/exec/outputDelta"] = "command/exec/outputDelta"
|
|
266
|
+
data: CommandExecOutputDeltaData
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
# ============================================================================
|
|
270
|
+
# Fuzzy file search events (EXPERIMENTAL)
|
|
271
|
+
# ============================================================================
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class FuzzyFileSearchSessionUpdatedEvent(CodexBaseModel):
|
|
275
|
+
"""Fuzzy file search session updated with results."""
|
|
276
|
+
|
|
277
|
+
event_type: Literal["fuzzyFileSearch/sessionUpdated"] = "fuzzyFileSearch/sessionUpdated"
|
|
278
|
+
data: FuzzyFileSearchSessionUpdatedData
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
class FuzzyFileSearchSessionCompletedEvent(CodexBaseModel):
|
|
282
|
+
"""Fuzzy file search session completed."""
|
|
283
|
+
|
|
284
|
+
event_type: Literal["fuzzyFileSearch/sessionCompleted"] = "fuzzyFileSearch/sessionCompleted"
|
|
285
|
+
data: FuzzyFileSearchSessionCompletedData
|
|
286
|
+
|
|
287
|
+
|
|
177
288
|
# ============================================================================
|
|
178
289
|
# Item lifecycle events
|
|
179
290
|
# ============================================================================
|
|
@@ -435,6 +546,21 @@ CodexEvent = Annotated[
|
|
|
435
546
|
| TurnErrorEvent
|
|
436
547
|
| TurnDiffUpdatedEvent
|
|
437
548
|
| TurnPlanUpdatedEvent
|
|
549
|
+
# Hook events
|
|
550
|
+
| HookStartedEvent
|
|
551
|
+
| HookCompletedEvent
|
|
552
|
+
# Realtime voice events (EXPERIMENTAL)
|
|
553
|
+
| RealtimeStartedEvent
|
|
554
|
+
| RealtimeItemAddedEvent
|
|
555
|
+
| RealtimeTranscriptUpdatedEvent
|
|
556
|
+
| RealtimeOutputAudioDeltaEvent
|
|
557
|
+
| RealtimeErrorEvent
|
|
558
|
+
| RealtimeClosedEvent
|
|
559
|
+
# Terminal control events
|
|
560
|
+
| CommandExecOutputDeltaEvent
|
|
561
|
+
# Fuzzy file search events (EXPERIMENTAL)
|
|
562
|
+
| FuzzyFileSearchSessionUpdatedEvent
|
|
563
|
+
| FuzzyFileSearchSessionCompletedEvent
|
|
438
564
|
# Item lifecycle
|
|
439
565
|
| ItemStartedEvent
|
|
440
566
|
| ItemCompletedEvent
|
|
@@ -502,6 +628,21 @@ EventType = Literal[
|
|
|
502
628
|
"turn/error",
|
|
503
629
|
"turn/diff/updated",
|
|
504
630
|
"turn/plan/updated",
|
|
631
|
+
# Hook events
|
|
632
|
+
"hook/started",
|
|
633
|
+
"hook/completed",
|
|
634
|
+
# Realtime voice events (EXPERIMENTAL)
|
|
635
|
+
"thread/realtime/started",
|
|
636
|
+
"thread/realtime/itemAdded",
|
|
637
|
+
"thread/realtime/transcriptUpdated",
|
|
638
|
+
"thread/realtime/outputAudio/delta",
|
|
639
|
+
"thread/realtime/error",
|
|
640
|
+
"thread/realtime/closed",
|
|
641
|
+
# Terminal control events
|
|
642
|
+
"command/exec/outputDelta",
|
|
643
|
+
# Fuzzy file search events (EXPERIMENTAL)
|
|
644
|
+
"fuzzyFileSearch/sessionUpdated",
|
|
645
|
+
"fuzzyFileSearch/sessionCompleted",
|
|
505
646
|
# Item lifecycle
|
|
506
647
|
"item/started",
|
|
507
648
|
"item/completed",
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""Fuzzy file search models for the Codex app-server protocol.
|
|
2
|
+
|
|
3
|
+
EXPERIMENTAL — Session-based fuzzy file search. Start a session with roots,
|
|
4
|
+
update with queries, and receive incremental results via notifications.
|
|
5
|
+
Also includes the legacy one-shot search API.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Literal
|
|
11
|
+
|
|
12
|
+
from codexed.models.base import CodexBaseModel
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# ============================================================================
|
|
16
|
+
# Supporting types
|
|
17
|
+
# ============================================================================
|
|
18
|
+
|
|
19
|
+
FuzzyFileSearchMatchType = Literal["file", "directory"]
|
|
20
|
+
"""Whether the match is a file or directory."""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class FuzzyFileSearchResult(CodexBaseModel):
|
|
24
|
+
"""A single fuzzy file search result."""
|
|
25
|
+
|
|
26
|
+
root: str
|
|
27
|
+
path: str
|
|
28
|
+
match_type: FuzzyFileSearchMatchType
|
|
29
|
+
file_name: str
|
|
30
|
+
score: int
|
|
31
|
+
indices: list[int] | None = None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# ============================================================================
|
|
35
|
+
# Legacy one-shot search
|
|
36
|
+
# ============================================================================
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class FuzzyFileSearchParams(CodexBaseModel):
|
|
40
|
+
"""Params for the legacy fuzzyFileSearch request."""
|
|
41
|
+
|
|
42
|
+
query: str
|
|
43
|
+
roots: list[str]
|
|
44
|
+
cancellation_token: str | None = None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class FuzzyFileSearchResponse(CodexBaseModel):
|
|
48
|
+
"""Response for the legacy fuzzyFileSearch request."""
|
|
49
|
+
|
|
50
|
+
files: list[FuzzyFileSearchResult]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# ============================================================================
|
|
54
|
+
# Session-based search (EXPERIMENTAL)
|
|
55
|
+
# ============================================================================
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class FuzzyFileSearchSessionStartParams(CodexBaseModel):
|
|
59
|
+
"""Params for fuzzyFileSearch/sessionStart request."""
|
|
60
|
+
|
|
61
|
+
session_id: str
|
|
62
|
+
roots: list[str]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class FuzzyFileSearchSessionStartResponse(CodexBaseModel):
|
|
66
|
+
"""Response for fuzzyFileSearch/sessionStart request."""
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class FuzzyFileSearchSessionUpdateParams(CodexBaseModel):
|
|
70
|
+
"""Params for fuzzyFileSearch/sessionUpdate request."""
|
|
71
|
+
|
|
72
|
+
session_id: str
|
|
73
|
+
query: str
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class FuzzyFileSearchSessionUpdateResponse(CodexBaseModel):
|
|
77
|
+
"""Response for fuzzyFileSearch/sessionUpdate request."""
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class FuzzyFileSearchSessionStopParams(CodexBaseModel):
|
|
81
|
+
"""Params for fuzzyFileSearch/sessionStop request."""
|
|
82
|
+
|
|
83
|
+
session_id: str
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class FuzzyFileSearchSessionStopResponse(CodexBaseModel):
|
|
87
|
+
"""Response for fuzzyFileSearch/sessionStop request."""
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# ============================================================================
|
|
91
|
+
# Server notification data
|
|
92
|
+
# ============================================================================
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class FuzzyFileSearchSessionUpdatedData(CodexBaseModel):
|
|
96
|
+
"""Data for fuzzyFileSearch/sessionUpdated notification."""
|
|
97
|
+
|
|
98
|
+
session_id: str
|
|
99
|
+
query: str
|
|
100
|
+
files: list[FuzzyFileSearchResult]
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class FuzzyFileSearchSessionCompletedData(CodexBaseModel):
|
|
104
|
+
"""Data for fuzzyFileSearch/sessionCompleted notification."""
|
|
105
|
+
|
|
106
|
+
session_id: str
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""Hook models for the Codex app-server protocol.
|
|
2
|
+
|
|
3
|
+
Hooks are user-defined commands that run at specific lifecycle events
|
|
4
|
+
(session start, user prompt submit, stop). They can inspect context,
|
|
5
|
+
inject system messages, or block operations.
|
|
6
|
+
|
|
7
|
+
See: https://github.com/openai/codex/tree/main/codex-rs/hooks
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import Literal
|
|
13
|
+
|
|
14
|
+
from codexed.models.base import CodexBaseModel
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# ============================================================================
|
|
18
|
+
# Enums / Literal types
|
|
19
|
+
# ============================================================================
|
|
20
|
+
|
|
21
|
+
HookEventName = Literal["sessionStart", "userPromptSubmit", "stop"]
|
|
22
|
+
"""Lifecycle event that triggers hooks."""
|
|
23
|
+
|
|
24
|
+
HookHandlerType = Literal["command", "prompt", "agent"]
|
|
25
|
+
"""How the hook is executed. Only 'command' is currently supported."""
|
|
26
|
+
|
|
27
|
+
HookExecutionMode = Literal["sync", "async"]
|
|
28
|
+
"""Whether the hook blocks the operation or runs in the background."""
|
|
29
|
+
|
|
30
|
+
HookScope = Literal["thread", "turn"]
|
|
31
|
+
"""Scope of the hook run."""
|
|
32
|
+
|
|
33
|
+
HookRunStatus = Literal["running", "completed", "failed", "blocked", "stopped"]
|
|
34
|
+
"""Current execution status of a hook run."""
|
|
35
|
+
|
|
36
|
+
HookOutputEntryKind = Literal["warning", "stop", "feedback", "context", "error"]
|
|
37
|
+
"""Kind of output entry produced by a hook."""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# ============================================================================
|
|
41
|
+
# Data models
|
|
42
|
+
# ============================================================================
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class HookOutputEntry(CodexBaseModel):
|
|
46
|
+
"""Single output entry from a hook run."""
|
|
47
|
+
|
|
48
|
+
kind: HookOutputEntryKind
|
|
49
|
+
text: str
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class HookRunSummary(CodexBaseModel):
|
|
53
|
+
"""Summary of a hook run, sent with started/completed notifications."""
|
|
54
|
+
|
|
55
|
+
id: str
|
|
56
|
+
event_name: HookEventName
|
|
57
|
+
handler_type: HookHandlerType
|
|
58
|
+
execution_mode: HookExecutionMode
|
|
59
|
+
scope: HookScope
|
|
60
|
+
source_path: str
|
|
61
|
+
display_order: int
|
|
62
|
+
status: HookRunStatus
|
|
63
|
+
status_message: str | None = None
|
|
64
|
+
started_at: int
|
|
65
|
+
completed_at: int | None = None
|
|
66
|
+
duration_ms: int | None = None
|
|
67
|
+
entries: list[HookOutputEntry]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# ============================================================================
|
|
71
|
+
# Notification data (params for hook/started and hook/completed)
|
|
72
|
+
# ============================================================================
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class HookStartedData(CodexBaseModel):
|
|
76
|
+
"""Data for hook/started notification."""
|
|
77
|
+
|
|
78
|
+
thread_id: str
|
|
79
|
+
turn_id: str | None = None
|
|
80
|
+
run: HookRunSummary
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class HookCompletedData(CodexBaseModel):
|
|
84
|
+
"""Data for hook/completed notification."""
|
|
85
|
+
|
|
86
|
+
thread_id: str
|
|
87
|
+
turn_id: str | None = None
|
|
88
|
+
run: HookRunSummary
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Realtime voice conversation models for the Codex app-server protocol.
|
|
2
|
+
|
|
3
|
+
EXPERIMENTAL - All realtime types are experimental and subject to change.
|
|
4
|
+
Realtime enables voice conversations with the Codex agent, supporting
|
|
5
|
+
bidirectional audio streaming, text input, and transcript updates.
|
|
6
|
+
|
|
7
|
+
See: https://github.com/openai/codex/tree/main/codex-rs/app-server-protocol
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import Any, Literal
|
|
13
|
+
|
|
14
|
+
from codexed.models.base import CodexBaseModel
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# ============================================================================
|
|
18
|
+
# Enums / Literal types
|
|
19
|
+
# ============================================================================
|
|
20
|
+
|
|
21
|
+
RealtimeConversationVersion = Literal["v1", "v2"]
|
|
22
|
+
"""Realtime conversation protocol version."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# ============================================================================
|
|
26
|
+
# Audio data
|
|
27
|
+
# ============================================================================
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class RealtimeAudioChunk(CodexBaseModel):
|
|
31
|
+
"""Audio chunk for realtime streaming (base64-encoded PCM data)."""
|
|
32
|
+
|
|
33
|
+
data: str
|
|
34
|
+
sample_rate: int
|
|
35
|
+
num_channels: int
|
|
36
|
+
samples_per_channel: int | None = None
|
|
37
|
+
item_id: str | None = None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# ============================================================================
|
|
41
|
+
# Client request params / responses
|
|
42
|
+
# ============================================================================
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class RealtimeStartParams(CodexBaseModel):
|
|
46
|
+
"""Params for thread/realtime/start request."""
|
|
47
|
+
|
|
48
|
+
thread_id: str
|
|
49
|
+
prompt: str
|
|
50
|
+
session_id: str | None = None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class RealtimeStartResponse(CodexBaseModel):
|
|
54
|
+
"""Response for thread/realtime/start request."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class RealtimeAppendAudioParams(CodexBaseModel):
|
|
58
|
+
"""Params for thread/realtime/appendAudio request."""
|
|
59
|
+
|
|
60
|
+
thread_id: str
|
|
61
|
+
audio: RealtimeAudioChunk
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class RealtimeAppendAudioResponse(CodexBaseModel):
|
|
65
|
+
"""Response for thread/realtime/appendAudio request."""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class RealtimeAppendTextParams(CodexBaseModel):
|
|
69
|
+
"""Params for thread/realtime/appendText request."""
|
|
70
|
+
|
|
71
|
+
thread_id: str
|
|
72
|
+
text: str
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class RealtimeAppendTextResponse(CodexBaseModel):
|
|
76
|
+
"""Response for thread/realtime/appendText request."""
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class RealtimeStopParams(CodexBaseModel):
|
|
80
|
+
"""Params for thread/realtime/stop request."""
|
|
81
|
+
|
|
82
|
+
thread_id: str
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class RealtimeStopResponse(CodexBaseModel):
|
|
86
|
+
"""Response for thread/realtime/stop request."""
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# ============================================================================
|
|
90
|
+
# Server notification data
|
|
91
|
+
# ============================================================================
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class RealtimeStartedData(CodexBaseModel):
|
|
95
|
+
"""Data for thread/realtime/started notification."""
|
|
96
|
+
|
|
97
|
+
thread_id: str
|
|
98
|
+
session_id: str | None = None
|
|
99
|
+
version: RealtimeConversationVersion
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class RealtimeItemAddedData(CodexBaseModel):
|
|
103
|
+
"""Data for thread/realtime/itemAdded notification."""
|
|
104
|
+
|
|
105
|
+
thread_id: str
|
|
106
|
+
item: Any
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class RealtimeTranscriptUpdatedData(CodexBaseModel):
|
|
110
|
+
"""Data for thread/realtime/transcriptUpdated notification."""
|
|
111
|
+
|
|
112
|
+
thread_id: str
|
|
113
|
+
role: str
|
|
114
|
+
text: str
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class RealtimeOutputAudioDeltaData(CodexBaseModel):
|
|
118
|
+
"""Data for thread/realtime/outputAudio/delta notification."""
|
|
119
|
+
|
|
120
|
+
thread_id: str
|
|
121
|
+
audio: RealtimeAudioChunk
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class RealtimeErrorData(CodexBaseModel):
|
|
125
|
+
"""Data for thread/realtime/error notification."""
|
|
126
|
+
|
|
127
|
+
thread_id: str
|
|
128
|
+
message: str
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class RealtimeClosedData(CodexBaseModel):
|
|
132
|
+
"""Data for thread/realtime/closed notification."""
|
|
133
|
+
|
|
134
|
+
thread_id: str
|
|
135
|
+
reason: str | None = None
|
|
@@ -31,6 +31,7 @@ from codexed.models.misc import ( # noqa: TC001
|
|
|
31
31
|
ToolRequestUserInputQuestion,
|
|
32
32
|
)
|
|
33
33
|
from codexed.models.response_item import ResponseItem # noqa: TC001
|
|
34
|
+
from codexed.models.terminal import CommandExecTerminalSize # noqa: TC001
|
|
34
35
|
from codexed.models.user_input import UserInput # noqa: TC001
|
|
35
36
|
|
|
36
37
|
|
|
@@ -280,9 +281,18 @@ class CommandExecParams(CodexBaseModel):
|
|
|
280
281
|
"""Parameters for command/exec request."""
|
|
281
282
|
|
|
282
283
|
command: list[str]
|
|
283
|
-
|
|
284
|
-
|
|
284
|
+
process_id: str | None = None
|
|
285
|
+
tty: bool = False
|
|
286
|
+
stream_stdin: bool = False
|
|
287
|
+
stream_stdout_stderr: bool = False
|
|
288
|
+
output_bytes_cap: int | None = None
|
|
289
|
+
disable_output_cap: bool = False
|
|
290
|
+
disable_timeout: bool = False
|
|
285
291
|
timeout_ms: int | None = None
|
|
292
|
+
cwd: str | None = None
|
|
293
|
+
env: dict[str, str | None] | None = None
|
|
294
|
+
size: CommandExecTerminalSize | None = None
|
|
295
|
+
sandbox_policy: dict[str, Any] | None = None
|
|
286
296
|
|
|
287
297
|
|
|
288
298
|
class ModelListParams(CodexBaseModel):
|
|
@@ -504,12 +514,6 @@ class DynamicToolCallParams(CodexBaseModel):
|
|
|
504
514
|
arguments: Any
|
|
505
515
|
|
|
506
516
|
|
|
507
|
-
# --- MCP Elicitation ---
|
|
508
|
-
|
|
509
|
-
McpElicitationAction = Literal["accept", "decline", "cancel"]
|
|
510
|
-
"""Action taken by the user on an elicitation request."""
|
|
511
|
-
|
|
512
|
-
|
|
513
517
|
class _McpElicitationBase(CodexBaseModel):
|
|
514
518
|
"""Common fields for MCP elicitation requests."""
|
|
515
519
|
|
|
@@ -8,7 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
|
|
9
9
|
from typing import Annotated, Literal
|
|
10
10
|
|
|
11
|
-
from pydantic import Discriminator, Field
|
|
11
|
+
from pydantic import Discriminator, Field
|
|
12
12
|
|
|
13
13
|
from codexed.models.base import CodexBaseModel
|
|
14
14
|
|
|
@@ -38,9 +38,7 @@ class OutputTextContent(CodexBaseModel):
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
ContentItem = Annotated[
|
|
41
|
-
|
|
42
|
-
| Annotated[InputImageContent, Tag("input_image")]
|
|
43
|
-
| Annotated[OutputTextContent, Tag("output_text")],
|
|
41
|
+
InputTextContent | InputImageContent | OutputTextContent,
|
|
44
42
|
Discriminator("type"),
|
|
45
43
|
]
|
|
46
44
|
|
|
@@ -63,8 +61,7 @@ class ReasoningPlainTextContent(CodexBaseModel):
|
|
|
63
61
|
|
|
64
62
|
|
|
65
63
|
ReasoningItemContent = Annotated[
|
|
66
|
-
|
|
67
|
-
| Annotated[ReasoningPlainTextContent, Tag("text")],
|
|
64
|
+
ReasoningTextContent | ReasoningPlainTextContent,
|
|
68
65
|
Discriminator("type"),
|
|
69
66
|
]
|
|
70
67
|
|
|
@@ -95,8 +92,7 @@ class FunctionCallOutputImageItem(CodexBaseModel):
|
|
|
95
92
|
|
|
96
93
|
|
|
97
94
|
FunctionCallOutputContentItem = Annotated[
|
|
98
|
-
|
|
99
|
-
| Annotated[FunctionCallOutputImageItem, Tag("input_image")],
|
|
95
|
+
FunctionCallOutputTextItem | FunctionCallOutputImageItem,
|
|
100
96
|
Discriminator("type"),
|
|
101
97
|
]
|
|
102
98
|
|
|
@@ -158,10 +154,10 @@ class WebSearchActionOther(CodexBaseModel):
|
|
|
158
154
|
|
|
159
155
|
|
|
160
156
|
WebSearchAction = Annotated[
|
|
161
|
-
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
157
|
+
WebSearchActionSearch
|
|
158
|
+
| WebSearchActionOpenPage
|
|
159
|
+
| WebSearchActionFindInPage
|
|
160
|
+
| WebSearchActionOther,
|
|
165
161
|
Discriminator("type"),
|
|
166
162
|
]
|
|
167
163
|
|
|
@@ -283,17 +279,17 @@ class OtherResponseItem(CodexBaseModel):
|
|
|
283
279
|
|
|
284
280
|
|
|
285
281
|
ResponseItem = Annotated[
|
|
286
|
-
|
|
287
|
-
|
|
|
288
|
-
|
|
|
289
|
-
|
|
|
290
|
-
|
|
|
291
|
-
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
294
|
-
|
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
|
|
|
282
|
+
MessageResponseItem
|
|
283
|
+
| ReasoningResponseItem
|
|
284
|
+
| LocalShellCallResponseItem
|
|
285
|
+
| FunctionCallResponseItem
|
|
286
|
+
| FunctionCallOutputResponseItem
|
|
287
|
+
| CustomToolCallResponseItem
|
|
288
|
+
| CustomToolCallOutputResponseItem
|
|
289
|
+
| WebSearchCallResponseItem
|
|
290
|
+
| ImageGenerationCallResponseItem
|
|
291
|
+
| GhostSnapshotResponseItem
|
|
292
|
+
| CompactionResponseItem
|
|
293
|
+
| OtherResponseItem,
|
|
298
294
|
Discriminator("type"),
|
|
299
295
|
]
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Interactive terminal control models for the Codex app-server protocol.
|
|
2
|
+
|
|
3
|
+
These models support the interactive PTY/streaming mode of `command/exec`.
|
|
4
|
+
After starting a command with `stream_stdin=True` or `tty=True`, use
|
|
5
|
+
`command/exec/write` to send stdin, `command/exec/resize` to resize the PTY,
|
|
6
|
+
and `command/exec/terminate` to kill the process. Output arrives as
|
|
7
|
+
`command/exec/outputDelta` notifications.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import Literal
|
|
13
|
+
|
|
14
|
+
from codexed.models.base import CodexBaseModel
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# ============================================================================
|
|
18
|
+
# Supporting types
|
|
19
|
+
# ============================================================================
|
|
20
|
+
|
|
21
|
+
CommandExecOutputStream = Literal["stdout", "stderr"]
|
|
22
|
+
"""Stream label for command/exec output delta notifications."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CommandExecTerminalSize(CodexBaseModel):
|
|
26
|
+
"""PTY size in character cells."""
|
|
27
|
+
|
|
28
|
+
rows: int
|
|
29
|
+
cols: int
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# ============================================================================
|
|
33
|
+
# Client request params / responses
|
|
34
|
+
# ============================================================================
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class CommandExecWriteParams(CodexBaseModel):
|
|
38
|
+
"""Params for command/exec/write request — write stdin to a running process."""
|
|
39
|
+
|
|
40
|
+
process_id: str
|
|
41
|
+
delta_base64: str | None = None
|
|
42
|
+
close_stdin: bool = False
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class CommandExecWriteResponse(CodexBaseModel):
|
|
46
|
+
"""Response for command/exec/write request."""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class CommandExecTerminateParams(CodexBaseModel):
|
|
50
|
+
"""Params for command/exec/terminate request — kill a running process."""
|
|
51
|
+
|
|
52
|
+
process_id: str
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class CommandExecTerminateResponse(CodexBaseModel):
|
|
56
|
+
"""Response for command/exec/terminate request."""
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class CommandExecResizeParams(CodexBaseModel):
|
|
60
|
+
"""Params for command/exec/resize request — resize a PTY session."""
|
|
61
|
+
|
|
62
|
+
process_id: str
|
|
63
|
+
size: CommandExecTerminalSize
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class CommandExecResizeResponse(CodexBaseModel):
|
|
67
|
+
"""Response for command/exec/resize request."""
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# ============================================================================
|
|
71
|
+
# Server notification data
|
|
72
|
+
# ============================================================================
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class CommandExecOutputDeltaData(CodexBaseModel):
|
|
76
|
+
"""Data for command/exec/outputDelta notification.
|
|
77
|
+
|
|
78
|
+
Base64-encoded output chunk emitted for a streaming command/exec request.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
process_id: str
|
|
82
|
+
stream: CommandExecOutputStream
|
|
83
|
+
delta_base64: str
|
|
84
|
+
cap_reached: bool
|
|
@@ -9,12 +9,10 @@ from codexed.models.base import CodexBaseModel
|
|
|
9
9
|
from codexed.models.codex_types import ( # noqa: TC001
|
|
10
10
|
CollabAgentStatus,
|
|
11
11
|
CollabAgentTool,
|
|
12
|
-
CollabAgentToolCallStatus,
|
|
13
12
|
CommandExecutionStatus,
|
|
14
|
-
DynamicToolCallStatus,
|
|
15
|
-
McpToolCallStatus,
|
|
16
13
|
MessagePhase,
|
|
17
14
|
PatchApplyStatus,
|
|
15
|
+
ToolCallStatus,
|
|
18
16
|
)
|
|
19
17
|
from codexed.models.command_action import CommandAction # noqa: TC001
|
|
20
18
|
from codexed.models.user_input import UserInput # noqa: TC001
|
|
@@ -160,7 +158,7 @@ class ThreadItemMcpToolCall(BaseThreadItem):
|
|
|
160
158
|
type: Literal["mcpToolCall"] = "mcpToolCall"
|
|
161
159
|
server: str
|
|
162
160
|
tool: str
|
|
163
|
-
status:
|
|
161
|
+
status: ToolCallStatus
|
|
164
162
|
arguments: dict[str, Any] | None = None
|
|
165
163
|
result: McpToolCallResult | None = None
|
|
166
164
|
error: McpToolCallError | None = None
|
|
@@ -182,7 +180,7 @@ class ThreadItemDynamicToolCall(BaseThreadItem):
|
|
|
182
180
|
type: Literal["dynamicToolCall"] = "dynamicToolCall"
|
|
183
181
|
tool: str
|
|
184
182
|
arguments: dict[str, Any] | None = None
|
|
185
|
-
status:
|
|
183
|
+
status: ToolCallStatus
|
|
186
184
|
content_items: list[DynamicToolCallOutputContentItem] | None = None
|
|
187
185
|
success: bool | None = None
|
|
188
186
|
duration_ms: int | None = None
|
|
@@ -248,7 +246,7 @@ class ThreadItemCollabAgentToolCall(BaseThreadItem):
|
|
|
248
246
|
|
|
249
247
|
type: Literal["collabAgentToolCall"] = "collabAgentToolCall"
|
|
250
248
|
tool: CollabAgentTool
|
|
251
|
-
status:
|
|
249
|
+
status: ToolCallStatus
|
|
252
250
|
sender_thread_id: str
|
|
253
251
|
receiver_thread_ids: list[str] = Field(default_factory=list)
|
|
254
252
|
prompt: str | None = None
|
|
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
|