Add exec-server filesystem RPC implementation

Layer the filesystem RPC implementation and exec-server-only client cleanup on top of the process RPC follow-up.\n\nCo-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-03-18 13:01:16 -07:00
parent 79b46e346d
commit 51a656fc1e
17 changed files with 2837 additions and 1979 deletions

View File

@@ -0,0 +1,51 @@
use codex_app_server_protocol::JSONRPCMessage;
use codex_app_server_protocol::JSONRPCNotification;
use codex_app_server_protocol::JSONRPCRequest;
use codex_app_server_protocol::RequestId;
use serde::Serialize;
use tokio::sync::mpsc;
use super::ExecServerError;
pub(super) struct JsonRpcBackend {
write_tx: mpsc::Sender<JSONRPCMessage>,
}
impl JsonRpcBackend {
pub(super) fn new(write_tx: mpsc::Sender<JSONRPCMessage>) -> Self {
Self { write_tx }
}
pub(super) async fn notify<P: Serialize>(
&self,
method: &str,
params: &P,
) -> Result<(), ExecServerError> {
let params = serde_json::to_value(params)?;
self.write_tx
.send(JSONRPCMessage::Notification(JSONRPCNotification {
method: method.to_string(),
params: Some(params),
}))
.await
.map_err(|_| ExecServerError::Closed)
}
pub(super) async fn send_request<P: Serialize>(
&self,
request_id: RequestId,
method: &str,
params: &P,
) -> Result<(), ExecServerError> {
let params = serde_json::to_value(params)?;
self.write_tx
.send(JSONRPCMessage::Request(JSONRPCRequest {
id: request_id,
method: method.to_string(),
params: Some(params),
trace: None,
}))
.await
.map_err(|_| ExecServerError::Closed)
}
}