codex_runtime/runtime/api/
command_exec_api.rs1use crate::runtime::core::Runtime;
2use crate::runtime::errors::RpcError;
3use crate::runtime::rpc_contract::methods;
4
5use super::wire::{command_exec_params_to_wire, deserialize_result, serialize_params};
6use super::*;
7
8impl Runtime {
9 pub async fn command_exec(
13 &self,
14 p: CommandExecParams,
15 ) -> Result<CommandExecResponse, RpcError> {
16 let response = self
17 .call_validated(methods::COMMAND_EXEC, command_exec_params_to_wire(&p))
18 .await?;
19 deserialize_result(methods::COMMAND_EXEC, response)
20 }
21
22 pub async fn command_exec_write(
26 &self,
27 p: CommandExecWriteParams,
28 ) -> Result<CommandExecWriteResponse, RpcError> {
29 let params = serialize_params(methods::COMMAND_EXEC_WRITE, &p)?;
30 let response = self
31 .call_validated(methods::COMMAND_EXEC_WRITE, params)
32 .await?;
33 deserialize_result(methods::COMMAND_EXEC_WRITE, response)
34 }
35
36 pub async fn command_exec_resize(
40 &self,
41 p: CommandExecResizeParams,
42 ) -> Result<CommandExecResizeResponse, RpcError> {
43 let params = serialize_params(methods::COMMAND_EXEC_RESIZE, &p)?;
44 let response = self
45 .call_validated(methods::COMMAND_EXEC_RESIZE, params)
46 .await?;
47 deserialize_result(methods::COMMAND_EXEC_RESIZE, response)
48 }
49
50 pub async fn command_exec_terminate(
54 &self,
55 p: CommandExecTerminateParams,
56 ) -> Result<CommandExecTerminateResponse, RpcError> {
57 let params = serialize_params(methods::COMMAND_EXEC_TERMINATE, &p)?;
58 let response = self
59 .call_validated(methods::COMMAND_EXEC_TERMINATE, params)
60 .await?;
61 deserialize_result(methods::COMMAND_EXEC_TERMINATE, response)
62 }
63}