| use super::SandboxPolicy; |
| use crate::JsonSchema; |
| use crate::TS; |
| use codex_experimental_api_macros::ExperimentalApi; |
| use serde::Deserialize; |
| use serde::Serialize; |
| use std::collections::HashMap; |
| use std::path::PathBuf; |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecTerminalSize { |
| |
| pub rows: u16, |
| |
| pub cols: u16, |
| } |
|
|
| |
| |
| |
| |
| |
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecParams { |
| |
| pub command: Vec<String>, |
| |
| |
| |
| |
| |
| |
| #[ts(optional = nullable)] |
| pub process_id: Option<String>, |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub tty: bool, |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub stream_stdin: bool, |
| |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub stream_stdout_stderr: bool, |
| |
| |
| |
| |
| #[ts(type = "number | null")] |
| #[ts(optional = nullable)] |
| pub output_bytes_cap: Option<usize>, |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub disable_output_cap: bool, |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub disable_timeout: bool, |
| |
| |
| |
| |
| #[ts(type = "number | null")] |
| #[ts(optional = nullable)] |
| pub timeout_ms: Option<i64>, |
| |
| #[ts(optional = nullable)] |
| pub cwd: Option<PathBuf>, |
| |
| |
| |
| |
| |
| #[ts(optional = nullable)] |
| pub env: Option<HashMap<String, Option<String>>>, |
| |
| |
| #[ts(optional = nullable)] |
| pub size: Option<CommandExecTerminalSize>, |
| |
| |
| |
| |
| |
| #[ts(optional = nullable)] |
| pub sandbox_policy: Option<SandboxPolicy>, |
| |
| |
| |
| |
| #[experimental("command/exec.permissionProfile")] |
| #[ts(optional = nullable)] |
| pub permission_profile: Option<String>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecResponse { |
| |
| pub exit_code: i32, |
| |
| |
| |
| pub stdout: String, |
| |
| |
| |
| pub stderr: String, |
| } |
|
|
| |
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecWriteParams { |
| |
| |
| pub process_id: String, |
| |
| #[ts(optional = nullable)] |
| pub delta_base64: Option<String>, |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub close_stdin: bool, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecWriteResponse {} |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecTerminateParams { |
| |
| |
| pub process_id: String, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecTerminateResponse {} |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecResizeParams { |
| |
| |
| pub process_id: String, |
| |
| pub size: CommandExecTerminalSize, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecResizeResponse {} |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub enum CommandExecOutputStream { |
| |
| Stdout, |
| |
| Stderr, |
| } |
| |
| |
| |
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct CommandExecOutputDeltaNotification { |
| |
| |
| pub process_id: String, |
| |
| pub stream: CommandExecOutputStream, |
| |
| pub delta_base64: String, |
| |
| |
| pub cap_reached: bool, |
| } |
|
|