mirror of
https://github.com/openai/codex.git
synced 2026-04-25 07:05:38 +00:00
app-server: Add streaming and tty/pty capabilities to command/exec (#13640)
* Add an ability to stream stdin, stdout, and stderr * Streaming of stdout and stderr has a configurable cap for total amount of transmitted bytes (with an ability to disable it) * Add support for overriding environment variables * Add an ability to terminate running applications (using `command/exec/terminate`) * Add TTY/PTY support, with an ability to resize the terminal (using `command/exec/resize`)
This commit is contained in:
committed by
GitHub
parent
61098c7f51
commit
e9bd8b20a1
@@ -16,6 +16,10 @@ use codex_app_server_protocol::CancelLoginAccountParams;
|
||||
use codex_app_server_protocol::ClientInfo;
|
||||
use codex_app_server_protocol::ClientNotification;
|
||||
use codex_app_server_protocol::CollaborationModeListParams;
|
||||
use codex_app_server_protocol::CommandExecParams;
|
||||
use codex_app_server_protocol::CommandExecResizeParams;
|
||||
use codex_app_server_protocol::CommandExecTerminateParams;
|
||||
use codex_app_server_protocol::CommandExecWriteParams;
|
||||
use codex_app_server_protocol::ConfigBatchWriteParams;
|
||||
use codex_app_server_protocol::ConfigReadParams;
|
||||
use codex_app_server_protocol::ConfigValueWriteParams;
|
||||
@@ -494,6 +498,42 @@ impl McpProcess {
|
||||
self.send_request("turn/start", params).await
|
||||
}
|
||||
|
||||
/// Send a `command/exec` JSON-RPC request (v2).
|
||||
pub async fn send_command_exec_request(
|
||||
&mut self,
|
||||
params: CommandExecParams,
|
||||
) -> anyhow::Result<i64> {
|
||||
let params = Some(serde_json::to_value(params)?);
|
||||
self.send_request("command/exec", params).await
|
||||
}
|
||||
|
||||
/// Send a `command/exec/write` JSON-RPC request (v2).
|
||||
pub async fn send_command_exec_write_request(
|
||||
&mut self,
|
||||
params: CommandExecWriteParams,
|
||||
) -> anyhow::Result<i64> {
|
||||
let params = Some(serde_json::to_value(params)?);
|
||||
self.send_request("command/exec/write", params).await
|
||||
}
|
||||
|
||||
/// Send a `command/exec/resize` JSON-RPC request (v2).
|
||||
pub async fn send_command_exec_resize_request(
|
||||
&mut self,
|
||||
params: CommandExecResizeParams,
|
||||
) -> anyhow::Result<i64> {
|
||||
let params = Some(serde_json::to_value(params)?);
|
||||
self.send_request("command/exec/resize", params).await
|
||||
}
|
||||
|
||||
/// Send a `command/exec/terminate` JSON-RPC request (v2).
|
||||
pub async fn send_command_exec_terminate_request(
|
||||
&mut self,
|
||||
params: CommandExecTerminateParams,
|
||||
) -> anyhow::Result<i64> {
|
||||
let params = Some(serde_json::to_value(params)?);
|
||||
self.send_request("command/exec/terminate", params).await
|
||||
}
|
||||
|
||||
/// Send a `turn/interrupt` JSON-RPC request (v2).
|
||||
pub async fn send_turn_interrupt_request(
|
||||
&mut self,
|
||||
|
||||
Reference in New Issue
Block a user