codexed 1.3.0__tar.gz → 1.3.2__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.3.2/PKG-INFO +171 -0
- codexed-1.3.2/README.md +134 -0
- {codexed-1.3.0 → codexed-1.3.2}/pyproject.toml +29 -25
- {codexed-1.3.0 → codexed-1.3.2}/pyproject.toml.orig +34 -19
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/README.md +3 -3
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/account.py +13 -3
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/client.py +46 -15
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/plugin.py +3 -1
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/session.py +7 -7
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/request_params.py +9 -1
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/tool_config.py +1 -1
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/request_handlers.py +6 -2
- codexed-1.3.0/PKG-INFO +0 -63
- codexed-1.3.0/README.md +0 -26
- {codexed-1.3.0 → codexed-1.3.2}/LICENSE +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/__init__.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/__init__.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/dispatch.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/fs.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/marketplace.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/realtime.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/client/skills.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/exceptions.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/helpers.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/log.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/__init__.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/base.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/codex_types.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/event_data.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/events.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/mcp_server.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/misc.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/responses.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/thread_item.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/models/v2_protocol.py +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/py.typed +0 -0
- {codexed-1.3.0 → codexed-1.3.2}/src/codexed/transport.py +0 -0
codexed-1.3.2/PKG-INFO
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codexed
|
|
3
|
+
Version: 1.3.2
|
|
4
|
+
Summary: Async, typed Python client for the OpenAI Codex app-server JSON-RPC protocol
|
|
5
|
+
Keywords: ai-agent,app-server,asyncio,client,codex,json-rpc,llm,mcp,openai,pydantic
|
|
6
|
+
Author: Philipp Temminghoff
|
|
7
|
+
Author-email: Philipp Temminghoff <philipptemminghoff@googlemail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Framework :: AsyncIO
|
|
12
|
+
Classifier: Framework :: Pydantic
|
|
13
|
+
Classifier: Framework :: Pydantic :: 2
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Dist: anyenv>=2.0.15
|
|
25
|
+
Requires-Dist: mcp>=1.27.0
|
|
26
|
+
Requires-Dist: pydantic
|
|
27
|
+
Requires-Dist: websockets>=13.0 ; extra == 'websocket'
|
|
28
|
+
Requires-Python: >=3.13
|
|
29
|
+
Project-URL: Code coverage, https://app.codecov.io/gh/phil65/codexed
|
|
30
|
+
Project-URL: Discussions, https://github.com/phil65/codexed/discussions
|
|
31
|
+
Project-URL: Documentation, https://phil65.github.io/codexed/
|
|
32
|
+
Project-URL: Homepage, https://github.com/phil65/codexed
|
|
33
|
+
Project-URL: Issues, https://github.com/phil65/codexed/issues
|
|
34
|
+
Project-URL: Source, https://github.com/phil65/codexed
|
|
35
|
+
Provides-Extra: websocket
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# Codexed
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/codexed/)
|
|
41
|
+
[](https://pypi.org/project/codexed/)
|
|
42
|
+
[](https://pypi.org/project/codexed/)
|
|
43
|
+
[](https://pypi.org/project/codexed/)
|
|
44
|
+
[](https://pypi.org/project/codexed/)
|
|
45
|
+
[](https://pypi.org/project/codexed/)
|
|
46
|
+
[](https://pypi.org/project/codexed/)
|
|
47
|
+
[](https://github.com/phil65/codexed/releases)
|
|
48
|
+
[](https://github.com/phil65/codexed/graphs/contributors)
|
|
49
|
+
[](https://github.com/phil65/codexed/discussions)
|
|
50
|
+
[](https://github.com/phil65/codexed/forks)
|
|
51
|
+
[](https://github.com/phil65/codexed/issues)
|
|
52
|
+
[](https://github.com/phil65/codexed/pulls)
|
|
53
|
+
[](https://github.com/phil65/codexed/watchers)
|
|
54
|
+
[](https://github.com/phil65/codexed/stars)
|
|
55
|
+
[](https://github.com/phil65/codexed)
|
|
56
|
+
[](https://github.com/phil65/codexed/commits)
|
|
57
|
+
[](https://github.com/phil65/codexed/releases)
|
|
58
|
+
[](https://github.com/phil65/codexed)
|
|
59
|
+
[](https://github.com/phil65/codexed)
|
|
60
|
+
[](https://codecov.io/gh/phil65/codexed/)
|
|
61
|
+
[](https://pyup.io/repos/github/phil65/codexed/)
|
|
62
|
+
|
|
63
|
+
[Read the documentation!](https://phil65.github.io/codexed/)
|
|
64
|
+
|
|
65
|
+
Typed, async Python client for the [Codex](https://github.com/openai/codex) `app-server`
|
|
66
|
+
JSON-RPC protocol. `codexed` starts `codex app-server` as a subprocess (or connects to a
|
|
67
|
+
remote one via WebSocket), lets you create and resume threads, run turns and stream every
|
|
68
|
+
server notification as a pydantic model.
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install codexed
|
|
74
|
+
# WebSocket transport for remote app-servers
|
|
75
|
+
pip install "codexed[websocket]"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The `codex` CLI must be installed and logged in for the default subprocess transport.
|
|
79
|
+
|
|
80
|
+
## Quickstart
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import asyncio
|
|
84
|
+
|
|
85
|
+
from codexed import CodexClient, ItemAgentMessageDeltaNotification, TurnCompletedEvent
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
async def main() -> None:
|
|
89
|
+
async with CodexClient() as client:
|
|
90
|
+
session = await client.thread_start(cwd=".")
|
|
91
|
+
async for event in session.turn_stream("Summarize this repository"):
|
|
92
|
+
match event:
|
|
93
|
+
case ItemAgentMessageDeltaNotification(params=params):
|
|
94
|
+
print(params.delta, end="", flush=True)
|
|
95
|
+
case TurnCompletedEvent():
|
|
96
|
+
print()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
asyncio.run(main())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Events are a discriminated union (`codexed.CodexEvent`) keyed on the JSON-RPC `method`;
|
|
103
|
+
each event's payload lives in `.params`. `turn_stream` ends after `TurnCompletedEvent` and
|
|
104
|
+
raises `TurnFailedError` when the server reports an error.
|
|
105
|
+
|
|
106
|
+
### Structured output
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from pydantic import BaseModel
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class FileList(BaseModel):
|
|
113
|
+
files: list[str]
|
|
114
|
+
total: int
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
async with CodexClient() as client:
|
|
118
|
+
session = await client.thread_start(cwd=".")
|
|
119
|
+
result = await session.turn_stream_structured("List the Python files", FileList)
|
|
120
|
+
print(result.files)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### MCP servers, tools and approvals
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from codexed import CodexClient, HttpMcpServer, StdioMcpServer
|
|
127
|
+
from codexed.models.tool_config import ShellToolConfig, WebSearchToolConfig
|
|
128
|
+
|
|
129
|
+
mcp_servers = {
|
|
130
|
+
"docs": HttpMcpServer(url="http://localhost:8000/mcp"),
|
|
131
|
+
"fs": StdioMcpServer(command="npx", args=["-y", "@modelcontextprotocol/server-filesystem"]),
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async with CodexClient(mcp_servers=mcp_servers) as client:
|
|
135
|
+
client.set_auto_approve() # or pass on_approval=... / on_user_input=... to CodexClient
|
|
136
|
+
session = await client.thread_start(
|
|
137
|
+
cwd=".",
|
|
138
|
+
tools=[ShellToolConfig(), WebSearchToolConfig()], # [] disables all builtin tools
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Remote app-server
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from codexed import CodexClient, WebSocketTransport
|
|
146
|
+
|
|
147
|
+
transport = WebSocketTransport("ws://localhost:4500", auth_token="...")
|
|
148
|
+
async with CodexClient(transport=transport) as client:
|
|
149
|
+
models = await client.model_list()
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Features
|
|
153
|
+
|
|
154
|
+
- Full thread lifecycle: `thread_start`, `thread_resume`, `thread_fork`, `thread_list`, plus
|
|
155
|
+
per-thread `Session` operations (steer, interrupt, review, revert, compact, rename, archive,
|
|
156
|
+
inject items, MCP tool calls and resource reads).
|
|
157
|
+
- Streaming events as typed pydantic models, token usage tracking (`session.usage`), and
|
|
158
|
+
listeners for events outside a turn (`client.add_event_listener`).
|
|
159
|
+
- Structured output via pydantic models (`turn_stream_structured`).
|
|
160
|
+
- Programmatic MCP server injection (global or per thread) and builtin tool configuration.
|
|
161
|
+
- Server-request handlers for command/file-change/skill approvals, user input, dynamic tool
|
|
162
|
+
calls and MCP elicitation.
|
|
163
|
+
- Sub-APIs for account and rate limits (`client.account`), file system (`client.fs`), skills,
|
|
164
|
+
plugins and marketplace, config read/write, models, apps and experimental features.
|
|
165
|
+
- Realtime sessions (`session.realtime(...)`).
|
|
166
|
+
- Protocol models generated from the Codex app-server JSON schema, JSON-RPC errors mapped to
|
|
167
|
+
exceptions (`CodexRequestError`, `ServerBusyError`, ..., `is_retryable_error`).
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT
|
codexed-1.3.2/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Codexed
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/codexed/)
|
|
4
|
+
[](https://pypi.org/project/codexed/)
|
|
5
|
+
[](https://pypi.org/project/codexed/)
|
|
6
|
+
[](https://pypi.org/project/codexed/)
|
|
7
|
+
[](https://pypi.org/project/codexed/)
|
|
8
|
+
[](https://pypi.org/project/codexed/)
|
|
9
|
+
[](https://pypi.org/project/codexed/)
|
|
10
|
+
[](https://github.com/phil65/codexed/releases)
|
|
11
|
+
[](https://github.com/phil65/codexed/graphs/contributors)
|
|
12
|
+
[](https://github.com/phil65/codexed/discussions)
|
|
13
|
+
[](https://github.com/phil65/codexed/forks)
|
|
14
|
+
[](https://github.com/phil65/codexed/issues)
|
|
15
|
+
[](https://github.com/phil65/codexed/pulls)
|
|
16
|
+
[](https://github.com/phil65/codexed/watchers)
|
|
17
|
+
[](https://github.com/phil65/codexed/stars)
|
|
18
|
+
[](https://github.com/phil65/codexed)
|
|
19
|
+
[](https://github.com/phil65/codexed/commits)
|
|
20
|
+
[](https://github.com/phil65/codexed/releases)
|
|
21
|
+
[](https://github.com/phil65/codexed)
|
|
22
|
+
[](https://github.com/phil65/codexed)
|
|
23
|
+
[](https://codecov.io/gh/phil65/codexed/)
|
|
24
|
+
[](https://pyup.io/repos/github/phil65/codexed/)
|
|
25
|
+
|
|
26
|
+
[Read the documentation!](https://phil65.github.io/codexed/)
|
|
27
|
+
|
|
28
|
+
Typed, async Python client for the [Codex](https://github.com/openai/codex) `app-server`
|
|
29
|
+
JSON-RPC protocol. `codexed` starts `codex app-server` as a subprocess (or connects to a
|
|
30
|
+
remote one via WebSocket), lets you create and resume threads, run turns and stream every
|
|
31
|
+
server notification as a pydantic model.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install codexed
|
|
37
|
+
# WebSocket transport for remote app-servers
|
|
38
|
+
pip install "codexed[websocket]"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The `codex` CLI must be installed and logged in for the default subprocess transport.
|
|
42
|
+
|
|
43
|
+
## Quickstart
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
import asyncio
|
|
47
|
+
|
|
48
|
+
from codexed import CodexClient, ItemAgentMessageDeltaNotification, TurnCompletedEvent
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
async def main() -> None:
|
|
52
|
+
async with CodexClient() as client:
|
|
53
|
+
session = await client.thread_start(cwd=".")
|
|
54
|
+
async for event in session.turn_stream("Summarize this repository"):
|
|
55
|
+
match event:
|
|
56
|
+
case ItemAgentMessageDeltaNotification(params=params):
|
|
57
|
+
print(params.delta, end="", flush=True)
|
|
58
|
+
case TurnCompletedEvent():
|
|
59
|
+
print()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
asyncio.run(main())
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Events are a discriminated union (`codexed.CodexEvent`) keyed on the JSON-RPC `method`;
|
|
66
|
+
each event's payload lives in `.params`. `turn_stream` ends after `TurnCompletedEvent` and
|
|
67
|
+
raises `TurnFailedError` when the server reports an error.
|
|
68
|
+
|
|
69
|
+
### Structured output
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from pydantic import BaseModel
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class FileList(BaseModel):
|
|
76
|
+
files: list[str]
|
|
77
|
+
total: int
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
async with CodexClient() as client:
|
|
81
|
+
session = await client.thread_start(cwd=".")
|
|
82
|
+
result = await session.turn_stream_structured("List the Python files", FileList)
|
|
83
|
+
print(result.files)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### MCP servers, tools and approvals
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from codexed import CodexClient, HttpMcpServer, StdioMcpServer
|
|
90
|
+
from codexed.models.tool_config import ShellToolConfig, WebSearchToolConfig
|
|
91
|
+
|
|
92
|
+
mcp_servers = {
|
|
93
|
+
"docs": HttpMcpServer(url="http://localhost:8000/mcp"),
|
|
94
|
+
"fs": StdioMcpServer(command="npx", args=["-y", "@modelcontextprotocol/server-filesystem"]),
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async with CodexClient(mcp_servers=mcp_servers) as client:
|
|
98
|
+
client.set_auto_approve() # or pass on_approval=... / on_user_input=... to CodexClient
|
|
99
|
+
session = await client.thread_start(
|
|
100
|
+
cwd=".",
|
|
101
|
+
tools=[ShellToolConfig(), WebSearchToolConfig()], # [] disables all builtin tools
|
|
102
|
+
)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Remote app-server
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from codexed import CodexClient, WebSocketTransport
|
|
109
|
+
|
|
110
|
+
transport = WebSocketTransport("ws://localhost:4500", auth_token="...")
|
|
111
|
+
async with CodexClient(transport=transport) as client:
|
|
112
|
+
models = await client.model_list()
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Features
|
|
116
|
+
|
|
117
|
+
- Full thread lifecycle: `thread_start`, `thread_resume`, `thread_fork`, `thread_list`, plus
|
|
118
|
+
per-thread `Session` operations (steer, interrupt, review, revert, compact, rename, archive,
|
|
119
|
+
inject items, MCP tool calls and resource reads).
|
|
120
|
+
- Streaming events as typed pydantic models, token usage tracking (`session.usage`), and
|
|
121
|
+
listeners for events outside a turn (`client.add_event_listener`).
|
|
122
|
+
- Structured output via pydantic models (`turn_stream_structured`).
|
|
123
|
+
- Programmatic MCP server injection (global or per thread) and builtin tool configuration.
|
|
124
|
+
- Server-request handlers for command/file-change/skill approvals, user input, dynamic tool
|
|
125
|
+
calls and MCP elicitation.
|
|
126
|
+
- Sub-APIs for account and rate limits (`client.account`), file system (`client.fs`), skills,
|
|
127
|
+
plugins and marketplace, config read/write, models, apps and experimental features.
|
|
128
|
+
- Realtime sessions (`session.realtime(...)`).
|
|
129
|
+
- Protocol models generated from the Codex app-server JSON schema, JSON-RPC errors mapped to
|
|
130
|
+
exceptions (`CodexRequestError`, `ServerBusyError`, ..., `is_retryable_error`).
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT
|
|
@@ -1,33 +1,43 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "codexed"
|
|
3
|
-
version = "1.3.
|
|
4
|
-
description = "
|
|
3
|
+
version = "1.3.2"
|
|
4
|
+
description = "Async, typed Python client for the OpenAI Codex app-server JSON-RPC protocol"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
7
7
|
license = "MIT"
|
|
8
8
|
license-files = ["LICENSE"]
|
|
9
|
-
keywords = [
|
|
9
|
+
keywords = [
|
|
10
|
+
"ai-agent",
|
|
11
|
+
"app-server",
|
|
12
|
+
"asyncio",
|
|
13
|
+
"client",
|
|
14
|
+
"codex",
|
|
15
|
+
"json-rpc",
|
|
16
|
+
"llm",
|
|
17
|
+
"mcp",
|
|
18
|
+
"openai",
|
|
19
|
+
"pydantic",
|
|
20
|
+
]
|
|
10
21
|
classifiers = [
|
|
11
22
|
"Development Status :: 4 - Beta",
|
|
23
|
+
"Framework :: AsyncIO",
|
|
12
24
|
"Framework :: Pydantic",
|
|
13
25
|
"Framework :: Pydantic :: 2",
|
|
14
26
|
"Intended Audience :: Developers",
|
|
15
27
|
"Operating System :: OS Independent",
|
|
16
28
|
"Programming Language :: Python :: 3",
|
|
17
29
|
"Programming Language :: Python :: 3 :: Only",
|
|
18
|
-
"Programming Language :: Python :: 3.12",
|
|
19
30
|
"Programming Language :: Python :: 3.13",
|
|
20
31
|
"Programming Language :: Python :: 3.14",
|
|
21
|
-
"Topic ::
|
|
32
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
22
33
|
"Topic :: Software Development",
|
|
23
|
-
"Topic ::
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
35
|
"Typing :: Typed",
|
|
25
36
|
]
|
|
26
37
|
dependencies = [
|
|
27
38
|
"anyenv>=2.0.15",
|
|
28
39
|
"mcp>=1.27.0",
|
|
29
40
|
"pydantic",
|
|
30
|
-
"schemez",
|
|
31
41
|
]
|
|
32
42
|
|
|
33
43
|
[[project.authors]]
|
|
@@ -38,6 +48,7 @@ email = "philipptemminghoff@googlemail.com"
|
|
|
38
48
|
"Code coverage" = "https://app.codecov.io/gh/phil65/codexed"
|
|
39
49
|
Discussions = "https://github.com/phil65/codexed/discussions"
|
|
40
50
|
Documentation = "https://phil65.github.io/codexed/"
|
|
51
|
+
Homepage = "https://github.com/phil65/codexed"
|
|
41
52
|
Issues = "https://github.com/phil65/codexed/issues"
|
|
42
53
|
Source = "https://github.com/phil65/codexed"
|
|
43
54
|
|
|
@@ -46,11 +57,12 @@ websocket = ["websockets>=13.0"]
|
|
|
46
57
|
|
|
47
58
|
[dependency-groups]
|
|
48
59
|
dev = [
|
|
60
|
+
"deptry",
|
|
49
61
|
"devtools",
|
|
50
62
|
"pyreadline3",
|
|
51
63
|
"pytest",
|
|
52
|
-
"pytest-cov",
|
|
53
64
|
"pytest-asyncio>=1.5.0",
|
|
65
|
+
"pytest-cov",
|
|
54
66
|
]
|
|
55
67
|
benchmark = ["pyinstrument"]
|
|
56
68
|
docs = [
|
|
@@ -58,9 +70,9 @@ docs = [
|
|
|
58
70
|
"mkdocs-mknodes",
|
|
59
71
|
]
|
|
60
72
|
lint = [
|
|
61
|
-
"
|
|
62
|
-
"mypy[faster-cache]; python_version < '3.14'",
|
|
73
|
+
"openai",
|
|
63
74
|
"ruff",
|
|
75
|
+
"ty",
|
|
64
76
|
]
|
|
65
77
|
|
|
66
78
|
[build-system]
|
|
@@ -88,21 +100,6 @@ allowed-commit-types = [
|
|
|
88
100
|
]
|
|
89
101
|
docstring-style = "google"
|
|
90
102
|
|
|
91
|
-
[tool.mypy]
|
|
92
|
-
python_version = "3.13"
|
|
93
|
-
disable_error_code = [
|
|
94
|
-
"misc",
|
|
95
|
-
"import",
|
|
96
|
-
]
|
|
97
|
-
pretty = true
|
|
98
|
-
check_untyped_defs = true
|
|
99
|
-
exclude = [
|
|
100
|
-
"venv/",
|
|
101
|
-
".venv/",
|
|
102
|
-
"src/codexed/models/v2_protocol.py",
|
|
103
|
-
]
|
|
104
|
-
plugins = ["pydantic.mypy"]
|
|
105
|
-
|
|
106
103
|
[tool.pyright]
|
|
107
104
|
venvPath = "."
|
|
108
105
|
venv = ".venv"
|
|
@@ -261,12 +258,19 @@ max-complexity = 15
|
|
|
261
258
|
preview = true
|
|
262
259
|
|
|
263
260
|
[tool.ty.src]
|
|
261
|
+
include = ["src"]
|
|
264
262
|
exclude = ["src/codexed/models/v2_protocol.py"]
|
|
265
263
|
|
|
266
264
|
[tool.ty.environment]
|
|
267
265
|
python-version = "3.13"
|
|
268
266
|
python-platform = "all"
|
|
269
267
|
|
|
268
|
+
[tool.ty.analysis]
|
|
269
|
+
allowed-unresolved-imports = []
|
|
270
|
+
|
|
271
|
+
[tool.ty.rules]
|
|
272
|
+
incompatible-mutable-override = "ignore"
|
|
273
|
+
|
|
270
274
|
[tool.uv]
|
|
271
275
|
default-groups = [
|
|
272
276
|
"dev",
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[project]
|
|
4
4
|
name = "codexed"
|
|
5
|
-
version = "1.3.
|
|
6
|
-
description = "
|
|
5
|
+
version = "1.3.2"
|
|
6
|
+
description = "Async, typed Python client for the OpenAI Codex app-server JSON-RPC protocol"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
requires-python = ">=3.13"
|
|
9
9
|
license = "MIT"
|
|
@@ -11,28 +11,38 @@ license-files = ["LICENSE"]
|
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "Philipp Temminghoff", email = "philipptemminghoff@googlemail.com" },
|
|
13
13
|
]
|
|
14
|
-
keywords = [
|
|
14
|
+
keywords = [
|
|
15
|
+
"ai-agent",
|
|
16
|
+
"app-server",
|
|
17
|
+
"asyncio",
|
|
18
|
+
"client",
|
|
19
|
+
"codex",
|
|
20
|
+
"json-rpc",
|
|
21
|
+
"llm",
|
|
22
|
+
"mcp",
|
|
23
|
+
"openai",
|
|
24
|
+
"pydantic",
|
|
25
|
+
]
|
|
15
26
|
classifiers = [
|
|
16
27
|
"Development Status :: 4 - Beta",
|
|
28
|
+
"Framework :: AsyncIO",
|
|
17
29
|
"Framework :: Pydantic",
|
|
18
30
|
"Framework :: Pydantic :: 2",
|
|
19
31
|
"Intended Audience :: Developers",
|
|
20
32
|
"Operating System :: OS Independent",
|
|
21
33
|
"Programming Language :: Python :: 3",
|
|
22
34
|
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
-
"Programming Language :: Python :: 3.12",
|
|
24
35
|
"Programming Language :: Python :: 3.13",
|
|
25
36
|
"Programming Language :: Python :: 3.14",
|
|
26
|
-
"Topic ::
|
|
37
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
27
38
|
"Topic :: Software Development",
|
|
28
|
-
"Topic ::
|
|
39
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
29
40
|
"Typing :: Typed",
|
|
30
41
|
]
|
|
31
42
|
dependencies = [
|
|
32
43
|
"anyenv>=2.0.15",
|
|
33
44
|
"mcp>=1.27.0",
|
|
34
45
|
"pydantic",
|
|
35
|
-
"schemez",
|
|
36
46
|
# Only add below (Copier)
|
|
37
47
|
]
|
|
38
48
|
|
|
@@ -40,6 +50,7 @@ dependencies = [
|
|
|
40
50
|
"Code coverage" = "https://app.codecov.io/gh/phil65/codexed"
|
|
41
51
|
Discussions = "https://github.com/phil65/codexed/discussions"
|
|
42
52
|
Documentation = "https://phil65.github.io/codexed/"
|
|
53
|
+
Homepage = "https://github.com/phil65/codexed"
|
|
43
54
|
Issues = "https://github.com/phil65/codexed/issues"
|
|
44
55
|
Source = "https://github.com/phil65/codexed"
|
|
45
56
|
|
|
@@ -48,12 +59,13 @@ websocket = ["websockets>=13.0"]
|
|
|
48
59
|
|
|
49
60
|
[dependency-groups]
|
|
50
61
|
dev = [
|
|
62
|
+
"deptry",
|
|
51
63
|
"devtools",
|
|
52
64
|
"pyreadline3",
|
|
53
65
|
"pytest",
|
|
54
|
-
"pytest-cov",
|
|
55
66
|
# Only add below (Copier)
|
|
56
67
|
"pytest-asyncio>=1.5.0",
|
|
68
|
+
"pytest-cov",
|
|
57
69
|
]
|
|
58
70
|
benchmark = ["pyinstrument"]
|
|
59
71
|
docs = [
|
|
@@ -62,9 +74,9 @@ docs = [
|
|
|
62
74
|
# Only add below (Copier)
|
|
63
75
|
]
|
|
64
76
|
lint = [
|
|
65
|
-
"
|
|
66
|
-
"mypy[faster-cache]; python_version < '3.14'",
|
|
77
|
+
"openai", # type-only import (openai.types.responses) for ty
|
|
67
78
|
"ruff",
|
|
79
|
+
"ty",
|
|
68
80
|
# Only add below (Copier)
|
|
69
81
|
]
|
|
70
82
|
|
|
@@ -93,14 +105,6 @@ allowed-commit-types = [
|
|
|
93
105
|
]
|
|
94
106
|
docstring-style = "google"
|
|
95
107
|
|
|
96
|
-
[tool.mypy]
|
|
97
|
-
python_version = "3.13"
|
|
98
|
-
disable_error_code = ["misc", "import"]
|
|
99
|
-
pretty = true
|
|
100
|
-
check_untyped_defs = true
|
|
101
|
-
exclude = ["venv/", ".venv/", "src/codexed/models/v2_protocol.py"]
|
|
102
|
-
plugins = ["pydantic.mypy"]
|
|
103
|
-
|
|
104
108
|
[tool.pyright]
|
|
105
109
|
venvPath = "."
|
|
106
110
|
venv = ".venv"
|
|
@@ -245,7 +249,7 @@ runtime-evaluated-base-classes = [
|
|
|
245
249
|
"sqlalchemy.orm.DeclarativeBase",
|
|
246
250
|
"schemez.Schema",
|
|
247
251
|
"sqlmodel.SQLModel",
|
|
248
|
-
"codexed.models.base.CodexBaseModel"
|
|
252
|
+
"codexed.models.base.CodexBaseModel",
|
|
249
253
|
]
|
|
250
254
|
runtime-evaluated-decorators = [
|
|
251
255
|
"pydantic.validate_call",
|
|
@@ -274,12 +278,23 @@ max-complexity = 15
|
|
|
274
278
|
preview = true
|
|
275
279
|
|
|
276
280
|
[tool.ty.src]
|
|
281
|
+
include = ["src"]
|
|
277
282
|
exclude = ["src/codexed/models/v2_protocol.py"]
|
|
278
283
|
|
|
279
284
|
[tool.ty.environment]
|
|
280
285
|
python-version = "3.13"
|
|
281
286
|
python-platform = "all"
|
|
282
287
|
|
|
288
|
+
[tool.ty.analysis]
|
|
289
|
+
# Optional dependencies that are not always installed, e.g. "numpy", "numpy.**".
|
|
290
|
+
# Unresolved imports are errors otherwise, so broken imports are caught.
|
|
291
|
+
allowed-unresolved-imports = []
|
|
292
|
+
|
|
293
|
+
[tool.ty.rules]
|
|
294
|
+
# Narrowing an overridden class attribute (e.g. pydantic discriminators,
|
|
295
|
+
# `Config` attributes) is an intentional pattern.
|
|
296
|
+
incompatible-mutable-override = "ignore"
|
|
297
|
+
|
|
283
298
|
[tool.uv]
|
|
284
299
|
default-groups = ["dev", "lint", "docs"]
|
|
285
300
|
|
|
@@ -16,7 +16,7 @@ async def main():
|
|
|
16
16
|
|
|
17
17
|
async for event in session.turn_stream("Help me refactor this code"):
|
|
18
18
|
match event:
|
|
19
|
-
case ItemAgentMessageDeltaNotification(
|
|
19
|
+
case ItemAgentMessageDeltaNotification(params=data):
|
|
20
20
|
print(data.delta, end="", flush=True)
|
|
21
21
|
case TurnCompletedEvent():
|
|
22
22
|
break
|
|
@@ -59,8 +59,8 @@ from codexed.models import (
|
|
|
59
59
|
async for event in session.turn_stream(message):
|
|
60
60
|
match event:
|
|
61
61
|
case (
|
|
62
|
-
ItemAgentMessageDeltaNotification(
|
|
63
|
-
| ItemCommandExecutionOutputDeltaNotification(
|
|
62
|
+
ItemAgentMessageDeltaNotification(params=data)
|
|
63
|
+
| ItemCommandExecutionOutputDeltaNotification(params=data)
|
|
64
64
|
):
|
|
65
65
|
print(data.delta, end="")
|
|
66
66
|
case TurnCompletedEvent():
|
|
@@ -21,7 +21,12 @@ from codexed.models import (
|
|
|
21
21
|
|
|
22
22
|
if TYPE_CHECKING:
|
|
23
23
|
from codexed.client import CodexClient
|
|
24
|
-
from codexed.models import
|
|
24
|
+
from codexed.models import (
|
|
25
|
+
AddCreditsNudgeCreditType,
|
|
26
|
+
AuthMode,
|
|
27
|
+
CancelLoginAccountStatus,
|
|
28
|
+
RateLimitSnapshot,
|
|
29
|
+
)
|
|
25
30
|
|
|
26
31
|
logger = logging.getLogger(__name__)
|
|
27
32
|
|
|
@@ -29,6 +34,9 @@ logger = logging.getLogger(__name__)
|
|
|
29
34
|
class CodexAccount:
|
|
30
35
|
def __init__(self, client: CodexClient):
|
|
31
36
|
self._client = client
|
|
37
|
+
self.rate_limits: RateLimitSnapshot | None = None
|
|
38
|
+
"""Latest rate limits: from :meth:`rate_limits_read` and from the
|
|
39
|
+
``account/rateLimits/updated`` notifications the server sends during turns."""
|
|
32
40
|
|
|
33
41
|
async def read(self, *, refresh_token: bool = False) -> GetAccountResponse:
|
|
34
42
|
"""Read account information.
|
|
@@ -84,9 +92,11 @@ class CodexAccount:
|
|
|
84
92
|
await self._client.dispatch.send_request("account/logout")
|
|
85
93
|
|
|
86
94
|
async def rate_limits_read(self) -> GetAccountRateLimitsResponse:
|
|
87
|
-
"""Read account rate limits."""
|
|
95
|
+
"""Read account rate limits (also updates :attr:`rate_limits`)."""
|
|
88
96
|
result = await self._client.dispatch.send_request("account/rateLimits/read")
|
|
89
|
-
|
|
97
|
+
response = GetAccountRateLimitsResponse.model_validate(result)
|
|
98
|
+
self.rate_limits = response.rate_limits
|
|
99
|
+
return response
|
|
90
100
|
|
|
91
101
|
async def send_add_credits_nudge_email(self, credit_type: AddCreditsNudgeCreditType) -> None:
|
|
92
102
|
"""Send an add credits nudge email."""
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
|
-
from collections.abc import
|
|
6
|
+
from collections.abc import Awaitable, Callable, Mapping
|
|
7
|
+
import inspect
|
|
7
8
|
import logging
|
|
8
9
|
from typing import TYPE_CHECKING, Any
|
|
9
10
|
|
|
@@ -17,6 +18,7 @@ from codexed.client.plugin import CodexPlugin
|
|
|
17
18
|
from codexed.client.skills import CodexSkills
|
|
18
19
|
from codexed.helpers import merge_config
|
|
19
20
|
from codexed.models import (
|
|
21
|
+
AccountRateLimitsUpdatedMessage,
|
|
20
22
|
AppsListParams,
|
|
21
23
|
AppsListResponse,
|
|
22
24
|
CollaborationModeListResponse,
|
|
@@ -112,6 +114,9 @@ if TYPE_CHECKING:
|
|
|
112
114
|
|
|
113
115
|
logger = logging.getLogger(__name__)
|
|
114
116
|
|
|
117
|
+
type EventListener = Callable[[CodexEvent], Awaitable[None] | None]
|
|
118
|
+
"""Receives events that belong to no running turn."""
|
|
119
|
+
|
|
115
120
|
|
|
116
121
|
class CodexClient:
|
|
117
122
|
"""Client for the Codex app-server JSON-RPC protocol.
|
|
@@ -174,7 +179,7 @@ class CodexClient:
|
|
|
174
179
|
)
|
|
175
180
|
self._turn_queues: dict[str, asyncio.Queue[CodexEvent | None]] = {}
|
|
176
181
|
self._realtime_queues: dict[str, asyncio.Queue[CodexEvent | None]] = {}
|
|
177
|
-
self.
|
|
182
|
+
self._event_listeners: list[EventListener] = []
|
|
178
183
|
self._active_threads: set[str] = set()
|
|
179
184
|
self._mcp_elicitation_enabled = on_mcp_elicitation is not None
|
|
180
185
|
self._mcp_elicitation_for_approvals = mcp_elicitation_for_approvals
|
|
@@ -185,15 +190,15 @@ class CodexClient:
|
|
|
185
190
|
self.marketplace = CodexMarketPlace(self)
|
|
186
191
|
self.skills = CodexSkills(self)
|
|
187
192
|
if on_approval:
|
|
188
|
-
self.register_handler(SERVER_REQUEST_COMMAND_APPROVAL, on_approval) #
|
|
189
|
-
self.register_handler(SERVER_REQUEST_FILE_CHANGE_APPROVAL, on_approval) #
|
|
190
|
-
self.register_handler(SERVER_REQUEST_SKILL_APPROVAL, on_approval) #
|
|
193
|
+
self.register_handler(SERVER_REQUEST_COMMAND_APPROVAL, on_approval) # ty: ignore[invalid-argument-type]
|
|
194
|
+
self.register_handler(SERVER_REQUEST_FILE_CHANGE_APPROVAL, on_approval) # ty: ignore[invalid-argument-type]
|
|
195
|
+
self.register_handler(SERVER_REQUEST_SKILL_APPROVAL, on_approval) # ty: ignore[invalid-argument-type]
|
|
191
196
|
if on_user_input:
|
|
192
|
-
self.register_handler(SERVER_REQUEST_USER_INPUT, on_user_input) #
|
|
197
|
+
self.register_handler(SERVER_REQUEST_USER_INPUT, on_user_input) # ty: ignore[invalid-argument-type]
|
|
193
198
|
if on_dynamic_tool_call:
|
|
194
|
-
self.register_handler(SERVER_REQUEST_DYNAMIC_TOOL_CALL, on_dynamic_tool_call) #
|
|
199
|
+
self.register_handler(SERVER_REQUEST_DYNAMIC_TOOL_CALL, on_dynamic_tool_call) # ty: ignore[invalid-argument-type]
|
|
195
200
|
if on_mcp_elicitation:
|
|
196
|
-
self.register_handler(SERVER_REQUEST_MCP_ELICITATION, on_mcp_elicitation) #
|
|
201
|
+
self.register_handler(SERVER_REQUEST_MCP_ELICITATION, on_mcp_elicitation) # ty: ignore[invalid-argument-type]
|
|
197
202
|
|
|
198
203
|
async def __aenter__(self) -> Self:
|
|
199
204
|
"""Async context manager entry - starts the app-server."""
|
|
@@ -901,26 +906,52 @@ class CodexClient:
|
|
|
901
906
|
|
|
902
907
|
event_data = {"method": method, "params": params}
|
|
903
908
|
event = codex_event_adapter.validate_python(event_data)
|
|
909
|
+
if isinstance(event, AccountRateLimitsUpdatedMessage):
|
|
910
|
+
self.account.rate_limits = event.params.rate_limits
|
|
904
911
|
|
|
905
912
|
thread_id = params.get("threadId")
|
|
906
913
|
|
|
907
914
|
# Route realtime events to the realtime session queue
|
|
908
915
|
if method.startswith("thread/realtime/") and thread_id:
|
|
909
916
|
rt_key = f"realtime:{thread_id}"
|
|
910
|
-
queue
|
|
911
|
-
|
|
917
|
+
if (queue := self._realtime_queues.get(rt_key)) is not None:
|
|
918
|
+
await queue.put(event)
|
|
919
|
+
else:
|
|
920
|
+
await self._notify_listeners(event)
|
|
912
921
|
return
|
|
913
922
|
|
|
914
923
|
turn_id = params.get("turnId")
|
|
915
924
|
if not turn_id and "turn" in params:
|
|
916
925
|
turn_id = params.get("turn", {}).get("id")
|
|
917
926
|
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
927
|
+
turn_queue = (
|
|
928
|
+
self._turn_queues.get(f"{thread_id}:{turn_id}") if thread_id and turn_id else None
|
|
929
|
+
)
|
|
930
|
+
if turn_queue is not None:
|
|
931
|
+
await turn_queue.put(event)
|
|
922
932
|
else:
|
|
923
|
-
await self.
|
|
933
|
+
await self._notify_listeners(event)
|
|
934
|
+
|
|
935
|
+
def add_event_listener(self, listener: EventListener) -> None:
|
|
936
|
+
"""Receive events that belong to no running turn (account, config, app updates, ...).
|
|
937
|
+
|
|
938
|
+
Turn events go to the turn's stream; everything else is passed to the listeners
|
|
939
|
+
(and otherwise dropped).
|
|
940
|
+
"""
|
|
941
|
+
self._event_listeners.append(listener)
|
|
942
|
+
|
|
943
|
+
def remove_event_listener(self, listener: EventListener) -> None:
|
|
944
|
+
"""Stop passing events to a listener added with :meth:`add_event_listener`."""
|
|
945
|
+
self._event_listeners.remove(listener)
|
|
946
|
+
|
|
947
|
+
async def _notify_listeners(self, event: CodexEvent) -> None:
|
|
948
|
+
for listener in list(self._event_listeners):
|
|
949
|
+
try:
|
|
950
|
+
result = listener(event)
|
|
951
|
+
if inspect.isawaitable(result):
|
|
952
|
+
await result
|
|
953
|
+
except Exception:
|
|
954
|
+
logger.exception("Codex event listener failed for %s", event.method)
|
|
924
955
|
|
|
925
956
|
async def _handle_server_request(
|
|
926
957
|
self, method: str, request_id: int | str, params: dict[str, Any]
|
|
@@ -17,6 +17,8 @@ from codexed.models import (
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
if TYPE_CHECKING:
|
|
20
|
+
import builtins
|
|
21
|
+
|
|
20
22
|
from codexed.client import CodexClient
|
|
21
23
|
|
|
22
24
|
logger = logging.getLogger(__name__)
|
|
@@ -46,7 +48,7 @@ class CodexPlugin:
|
|
|
46
48
|
params = PluginUninstallParams(plugin_id=plugin_id)
|
|
47
49
|
await self._client.dispatch.send_request("plugin/uninstall", params)
|
|
48
50
|
|
|
49
|
-
async def list(self, cwds: list[str] | None = None) -> PluginListResponse:
|
|
51
|
+
async def list(self, cwds: builtins.list[str] | None = None) -> PluginListResponse:
|
|
50
52
|
params = PluginListParams(cwds=cwds)
|
|
51
53
|
response = await self._client.dispatch.send_request("plugin/list", params)
|
|
52
54
|
return PluginListResponse.model_validate(response)
|
|
@@ -224,11 +224,11 @@ class Session:
|
|
|
224
224
|
case TurnCompletedEvent():
|
|
225
225
|
yield event
|
|
226
226
|
break
|
|
227
|
-
case ErrorMessage(
|
|
227
|
+
case ErrorMessage(params=ErrorNotification(error=error)):
|
|
228
228
|
yield event
|
|
229
229
|
raise TurnFailedError(error.message, turn_id=turn_id)
|
|
230
230
|
case ThreadTokenUsageUpdatedEvent(
|
|
231
|
-
|
|
231
|
+
params=ThreadTokenUsageUpdatedNotification(token_usage=usage)
|
|
232
232
|
):
|
|
233
233
|
self.usage = usage
|
|
234
234
|
yield event
|
|
@@ -322,9 +322,9 @@ class Session:
|
|
|
322
322
|
collaboration_mode=collaboration_mode,
|
|
323
323
|
):
|
|
324
324
|
match event:
|
|
325
|
-
case TurnCompletedEvent(
|
|
325
|
+
case TurnCompletedEvent(params=TurnCompletedData(turn=t)):
|
|
326
326
|
turn = t
|
|
327
|
-
case ErrorMessage(
|
|
327
|
+
case ErrorMessage(params=ErrorNotification(error=error)):
|
|
328
328
|
raise TurnFailedError(error.message, turn_id="unknown")
|
|
329
329
|
|
|
330
330
|
if turn is None:
|
|
@@ -503,7 +503,7 @@ class Session:
|
|
|
503
503
|
case TurnCompletedEvent():
|
|
504
504
|
yield event
|
|
505
505
|
break
|
|
506
|
-
case ErrorMessage(
|
|
506
|
+
case ErrorMessage(params=ErrorNotification(error=error)):
|
|
507
507
|
yield event
|
|
508
508
|
raise TurnFailedError(error.message, turn_id=turn_id)
|
|
509
509
|
case _:
|
|
@@ -620,8 +620,8 @@ class Session:
|
|
|
620
620
|
result = await self._client.dispatch.send_request("mcpServer/tool/call", params)
|
|
621
621
|
data = McpServerToolCallResponse.model_validate(result)
|
|
622
622
|
return CallToolResult(
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
structured_content=data.structured_content,
|
|
624
|
+
is_error=bool(data.is_error),
|
|
625
625
|
content=data.content,
|
|
626
626
|
meta=data.field_meta,
|
|
627
627
|
)
|
|
@@ -206,7 +206,15 @@ class McpElicitationUrlParams(_McpElicitationBase):
|
|
|
206
206
|
server_name: str,
|
|
207
207
|
turn_id: str | None = None,
|
|
208
208
|
) -> McpElicitationUrlParams:
|
|
209
|
-
"""Create from MCP ElicitRequestURLParams.
|
|
209
|
+
"""Create from MCP ElicitRequestURLParams.
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
ValueError: If the MCP request carries no elicitation ID, which the
|
|
213
|
+
app-server protocol requires to correlate the response
|
|
214
|
+
"""
|
|
215
|
+
if params.elicitation_id is None:
|
|
216
|
+
msg = "URL elicitation request without elicitation_id cannot be forwarded"
|
|
217
|
+
raise ValueError(msg)
|
|
210
218
|
return cls(
|
|
211
219
|
message=params.message,
|
|
212
220
|
url=params.url,
|
|
@@ -341,7 +341,7 @@ def tools_to_config_dict(tools: list[ToolConfig]) -> dict[str, Any]:
|
|
|
341
341
|
case None:
|
|
342
342
|
pass
|
|
343
343
|
case _ as unreachable:
|
|
344
|
-
assert_never(unreachable)
|
|
344
|
+
assert_never(unreachable)
|
|
345
345
|
|
|
346
346
|
case WebSearchToolConfig(
|
|
347
347
|
mode=mode,
|
|
@@ -97,7 +97,11 @@ ApprovalResponse = (
|
|
|
97
97
|
ApprovalHandler = Callable[[ApprovalParams], Awaitable[ApprovalResponse]]
|
|
98
98
|
|
|
99
99
|
# Validator: either a model class or a TypeAdapter for discriminated unions
|
|
100
|
-
ParamsValidator =
|
|
100
|
+
ParamsValidator = (
|
|
101
|
+
type[ServerRequestParams]
|
|
102
|
+
| TypeAdapter[ServerRequestParams]
|
|
103
|
+
| TypeAdapter[McpServerElicitationRequestParams]
|
|
104
|
+
)
|
|
101
105
|
|
|
102
106
|
# Map from wire method names to param validator + response model type
|
|
103
107
|
SERVER_REQUEST_TYPES: dict[str, tuple[ParamsValidator, type[ServerRequestResponse]]] = {
|
|
@@ -119,7 +123,7 @@ SERVER_REQUEST_TYPES: dict[str, tuple[ParamsValidator, type[ServerRequestRespons
|
|
|
119
123
|
SkillRequestApprovalResponse,
|
|
120
124
|
),
|
|
121
125
|
SERVER_REQUEST_MCP_ELICITATION: (
|
|
122
|
-
mcp_elicitation_adapter,
|
|
126
|
+
mcp_elicitation_adapter,
|
|
123
127
|
McpServerElicitationResponse,
|
|
124
128
|
),
|
|
125
129
|
}
|
codexed-1.3.0/PKG-INFO
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: codexed
|
|
3
|
-
Version: 1.3.0
|
|
4
|
-
Summary: Alternative codex app-server client
|
|
5
|
-
Keywords:
|
|
6
|
-
Author: Philipp Temminghoff
|
|
7
|
-
Author-email: Philipp Temminghoff <philipptemminghoff@googlemail.com>
|
|
8
|
-
License-Expression: MIT
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: Framework :: Pydantic
|
|
12
|
-
Classifier: Framework :: Pydantic :: 2
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Operating System :: OS Independent
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
-
Classifier: Topic :: Documentation
|
|
21
|
-
Classifier: Topic :: Software Development
|
|
22
|
-
Classifier: Topic :: Utilities
|
|
23
|
-
Classifier: Typing :: Typed
|
|
24
|
-
Requires-Dist: anyenv>=2.0.15
|
|
25
|
-
Requires-Dist: mcp>=1.27.0
|
|
26
|
-
Requires-Dist: pydantic
|
|
27
|
-
Requires-Dist: schemez
|
|
28
|
-
Requires-Dist: websockets>=13.0 ; extra == 'websocket'
|
|
29
|
-
Requires-Python: >=3.13
|
|
30
|
-
Project-URL: Code coverage, https://app.codecov.io/gh/phil65/codexed
|
|
31
|
-
Project-URL: Discussions, https://github.com/phil65/codexed/discussions
|
|
32
|
-
Project-URL: Documentation, https://phil65.github.io/codexed/
|
|
33
|
-
Project-URL: Issues, https://github.com/phil65/codexed/issues
|
|
34
|
-
Project-URL: Source, https://github.com/phil65/codexed
|
|
35
|
-
Provides-Extra: websocket
|
|
36
|
-
Description-Content-Type: text/markdown
|
|
37
|
-
|
|
38
|
-
# Codexed
|
|
39
|
-
|
|
40
|
-
[](https://pypi.org/project/codexed/)
|
|
41
|
-
[](https://pypi.org/project/codexed/)
|
|
42
|
-
[](https://pypi.org/project/codexed/)
|
|
43
|
-
[](https://pypi.org/project/codexed/)
|
|
44
|
-
[](https://pypi.org/project/codexed/)
|
|
45
|
-
[](https://pypi.org/project/codexed/)
|
|
46
|
-
[](https://pypi.org/project/codexed/)
|
|
47
|
-
[](https://github.com/phil65/codexed/releases)
|
|
48
|
-
[](https://github.com/phil65/codexed/graphs/contributors)
|
|
49
|
-
[](https://github.com/phil65/codexed/discussions)
|
|
50
|
-
[](https://github.com/phil65/codexed/forks)
|
|
51
|
-
[](https://github.com/phil65/codexed/issues)
|
|
52
|
-
[](https://github.com/phil65/codexed/pulls)
|
|
53
|
-
[](https://github.com/phil65/codexed/watchers)
|
|
54
|
-
[](https://github.com/phil65/codexed/stars)
|
|
55
|
-
[](https://github.com/phil65/codexed)
|
|
56
|
-
[](https://github.com/phil65/codexed/commits)
|
|
57
|
-
[](https://github.com/phil65/codexed/releases)
|
|
58
|
-
[](https://github.com/phil65/codexed)
|
|
59
|
-
[](https://github.com/phil65/codexed)
|
|
60
|
-
[](https://codecov.io/gh/phil65/codexed/)
|
|
61
|
-
[](https://pyup.io/repos/github/phil65/codexed/)
|
|
62
|
-
|
|
63
|
-
[Read the documentation!](https://phil65.github.io/codexed/)
|
codexed-1.3.0/README.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Codexed
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/codexed/)
|
|
4
|
-
[](https://pypi.org/project/codexed/)
|
|
5
|
-
[](https://pypi.org/project/codexed/)
|
|
6
|
-
[](https://pypi.org/project/codexed/)
|
|
7
|
-
[](https://pypi.org/project/codexed/)
|
|
8
|
-
[](https://pypi.org/project/codexed/)
|
|
9
|
-
[](https://pypi.org/project/codexed/)
|
|
10
|
-
[](https://github.com/phil65/codexed/releases)
|
|
11
|
-
[](https://github.com/phil65/codexed/graphs/contributors)
|
|
12
|
-
[](https://github.com/phil65/codexed/discussions)
|
|
13
|
-
[](https://github.com/phil65/codexed/forks)
|
|
14
|
-
[](https://github.com/phil65/codexed/issues)
|
|
15
|
-
[](https://github.com/phil65/codexed/pulls)
|
|
16
|
-
[](https://github.com/phil65/codexed/watchers)
|
|
17
|
-
[](https://github.com/phil65/codexed/stars)
|
|
18
|
-
[](https://github.com/phil65/codexed)
|
|
19
|
-
[](https://github.com/phil65/codexed/commits)
|
|
20
|
-
[](https://github.com/phil65/codexed/releases)
|
|
21
|
-
[](https://github.com/phil65/codexed)
|
|
22
|
-
[](https://github.com/phil65/codexed)
|
|
23
|
-
[](https://codecov.io/gh/phil65/codexed/)
|
|
24
|
-
[](https://pyup.io/repos/github/phil65/codexed/)
|
|
25
|
-
|
|
26
|
-
[Read the documentation!](https://phil65.github.io/codexed/)
|
|
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
|
|
File without changes
|
|
File without changes
|