|
1 | | -from __future__ import annotations |
2 | | - |
3 | | -from typing import Literal, NotRequired, TypedDict |
4 | | - |
5 | | -CommandExecutionStatus = Literal["in_progress", "completed", "failed"] |
6 | | -PatchChangeKind = Literal["add", "delete", "update"] |
7 | | -PatchApplyStatus = Literal["completed", "failed"] |
8 | | -McpToolCallStatus = Literal["in_progress", "completed", "failed"] |
9 | | - |
10 | | - |
11 | | -class CommandExecutionItem(TypedDict): |
12 | | - id: str |
13 | | - type: Literal["command_execution"] |
14 | | - command: str |
15 | | - aggregated_output: str |
16 | | - status: CommandExecutionStatus |
17 | | - exit_code: NotRequired[int] |
18 | | - |
19 | | - |
20 | | -class FileUpdateChange(TypedDict): |
21 | | - path: str |
22 | | - kind: PatchChangeKind |
23 | | - |
24 | | - |
25 | | -class FileChangeItem(TypedDict): |
26 | | - id: str |
27 | | - type: Literal["file_change"] |
28 | | - changes: list[FileUpdateChange] |
29 | | - status: PatchApplyStatus |
30 | | - |
31 | | - |
32 | | -class McpTextContent(TypedDict): |
33 | | - type: Literal["text"] |
34 | | - text: str |
35 | | - |
36 | | - |
37 | | -class McpImageContent(TypedDict): |
38 | | - type: Literal["image"] |
39 | | - data: str |
40 | | - mimeType: str |
41 | | - |
42 | | - |
43 | | -McpContentBlock = McpTextContent | McpImageContent | dict[str, object] |
44 | | - |
45 | | - |
46 | | -class McpToolCallResult(TypedDict): |
47 | | - content: list[McpContentBlock] |
48 | | - structured_content: object |
49 | | - |
50 | | - |
51 | | -class McpToolCallError(TypedDict): |
52 | | - message: str |
53 | | - |
54 | | - |
55 | | -class McpToolCallItem(TypedDict): |
56 | | - id: str |
57 | | - type: Literal["mcp_tool_call"] |
58 | | - server: str |
59 | | - tool: str |
60 | | - arguments: NotRequired[object] |
61 | | - result: NotRequired[McpToolCallResult] |
62 | | - error: NotRequired[McpToolCallError] |
63 | | - status: McpToolCallStatus |
64 | | - |
65 | | - |
66 | | -class AgentMessageItem(TypedDict): |
67 | | - id: str |
68 | | - type: Literal["agent_message"] |
69 | | - text: str |
70 | | - |
71 | | - |
72 | | -class ReasoningItem(TypedDict): |
73 | | - id: str |
74 | | - type: Literal["reasoning"] |
75 | | - text: str |
76 | | - |
77 | | - |
78 | | -class WebSearchItem(TypedDict): |
79 | | - id: str |
80 | | - type: Literal["web_search"] |
81 | | - query: str |
82 | | - |
83 | | - |
84 | | -class ErrorItem(TypedDict): |
85 | | - id: str |
86 | | - type: Literal["error"] |
87 | | - message: str |
88 | | - |
89 | | - |
90 | | -class TodoItem(TypedDict): |
91 | | - text: str |
92 | | - completed: bool |
93 | | - |
94 | | - |
95 | | -class TodoListItem(TypedDict): |
96 | | - id: str |
97 | | - type: Literal["todo_list"] |
98 | | - items: list[TodoItem] |
| 1 | +"""Typed exec turn-item re-exports backed by generated protocol models.""" |
99 | 2 |
|
| 3 | +from __future__ import annotations |
100 | 4 |
|
101 | | -ThreadItem = ( |
102 | | - AgentMessageItem |
103 | | - | ReasoningItem |
104 | | - | CommandExecutionItem |
105 | | - | FileChangeItem |
106 | | - | McpToolCallItem |
107 | | - | WebSearchItem |
108 | | - | TodoListItem |
109 | | - | ErrorItem |
110 | | -) |
| 5 | +from codex.protocol import types as protocol |
| 6 | + |
| 7 | +TurnItem = protocol.TurnItem |
| 8 | +UserMessageItem = protocol.UserMessageTurnItem |
| 9 | +AgentMessageItem = protocol.AgentMessageTurnItem |
| 10 | +PlanItem = protocol.PlanTurnItem |
| 11 | +ReasoningItem = protocol.ReasoningTurnItem |
| 12 | +WebSearchItem = protocol.WebSearchTurnItem |
| 13 | +ImageGenerationItem = protocol.ImageGenerationTurnItem |
| 14 | +ContextCompactionItem = protocol.ContextCompactionTurnItem |
| 15 | + |
| 16 | +__all__ = [ |
| 17 | + "TurnItem", |
| 18 | + "UserMessageItem", |
| 19 | + "AgentMessageItem", |
| 20 | + "PlanItem", |
| 21 | + "ReasoningItem", |
| 22 | + "WebSearchItem", |
| 23 | + "ImageGenerationItem", |
| 24 | + "ContextCompactionItem", |
| 25 | +] |
0 commit comments