Skip to content

Commit 37fc55d

Browse files
authored
Merge branch 'main' into feat/scheduler-config-threading
2 parents f985a8b + 349ef7e commit 37fc55d

File tree

104 files changed

+1979
-1022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1979
-1022
lines changed

codex-rs/Cargo.lock

Lines changed: 24 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ members = [
33
"backend-client",
44
"ansi-escape",
55
"app-server",
6+
"app-server-protocol",
67
"apply-patch",
78
"arg0",
89
"codex-backend-openapi-models",
@@ -48,6 +49,7 @@ edition = "2024"
4849
app_test_support = { path = "app-server/tests/common" }
4950
codex-ansi-escape = { path = "ansi-escape" }
5051
codex-app-server = { path = "app-server" }
52+
codex-app-server-protocol = { path = "app-server-protocol" }
5153
codex-apply-patch = { path = "apply-patch" }
5254
codex-arg0 = { path = "arg0" }
5355
codex-chatgpt = { path = "chatgpt" }
@@ -124,6 +126,7 @@ opentelemetry-semantic-conventions = "0.30.0"
124126
opentelemetry_sdk = "0.30.0"
125127
os_info = "3.12.0"
126128
owo-colors = "4.2.0"
129+
paste = "1.0.15"
127130
path-absolutize = "3.1.1"
128131
path-clean = "1.0.1"
129132
pathdiff = "0.2"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
edition = "2024"
3+
name = "codex-app-server-protocol"
4+
version = { workspace = true }
5+
6+
[lib]
7+
name = "codex_app_server_protocol"
8+
path = "src/lib.rs"
9+
10+
[lints]
11+
workspace = true
12+
13+
[dependencies]
14+
codex-protocol = { workspace = true }
15+
paste = { workspace = true }
16+
serde = { workspace = true, features = ["derive"] }
17+
serde_json = { workspace = true }
18+
strum_macros = { workspace = true }
19+
ts-rs = { workspace = true }
20+
uuid = { workspace = true, features = ["serde", "v7"] }
21+
22+
[dev-dependencies]
23+
anyhow = { workspace = true }
24+
pretty_assertions = { workspace = true }
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//! We do not do true JSON-RPC 2.0, as we neither send nor expect the
2+
//! "jsonrpc": "2.0" field.
3+
4+
use serde::Deserialize;
5+
use serde::Serialize;
6+
use ts_rs::TS;
7+
8+
pub const JSONRPC_VERSION: &str = "2.0";
9+
10+
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq, TS)]
11+
#[serde(untagged)]
12+
pub enum RequestId {
13+
String(String),
14+
Integer(i64),
15+
}
16+
17+
pub type Result = serde_json::Value;
18+
19+
/// Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
20+
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
21+
#[serde(untagged)]
22+
pub enum JSONRPCMessage {
23+
Request(JSONRPCRequest),
24+
Notification(JSONRPCNotification),
25+
Response(JSONRPCResponse),
26+
Error(JSONRPCError),
27+
}
28+
29+
/// A request that expects a response.
30+
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
31+
pub struct JSONRPCRequest {
32+
pub id: RequestId,
33+
pub method: String,
34+
#[serde(default, skip_serializing_if = "Option::is_none")]
35+
pub params: Option<serde_json::Value>,
36+
}
37+
38+
/// A notification which does not expect a response.
39+
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
40+
pub struct JSONRPCNotification {
41+
pub method: String,
42+
#[serde(default, skip_serializing_if = "Option::is_none")]
43+
pub params: Option<serde_json::Value>,
44+
}
45+
46+
/// A successful (non-error) response to a request.
47+
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
48+
pub struct JSONRPCResponse {
49+
pub id: RequestId,
50+
pub result: Result,
51+
}
52+
53+
/// A response to a request that indicates an error occurred.
54+
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
55+
pub struct JSONRPCError {
56+
pub error: JSONRPCErrorError,
57+
pub id: RequestId,
58+
}
59+
60+
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]
61+
pub struct JSONRPCErrorError {
62+
pub code: i64,
63+
#[serde(default, skip_serializing_if = "Option::is_none")]
64+
pub data: Option<serde_json::Value>,
65+
pub message: String,
66+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mod jsonrpc_lite;
2+
mod protocol;
3+
4+
pub use jsonrpc_lite::*;
5+
pub use protocol::*;

0 commit comments

Comments
 (0)