Download codex-rs/app-server-protocol/src/protocol/v2/process.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 8.04 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v2/process.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/app-server-protocol/src/protocol/v2/process.rs
-
curl -L -o process.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v2/process.rs
8.04 kB
| use crate::JsonSchema; | |
| use crate::TS; | |
| use codex_utils_absolute_path::AbsolutePathBuf; | |
| use serde::Deserialize; | |
| use serde::Serialize; | |
| use std::collections::HashMap; | |
| /// PTY size in character cells for `process/spawn` PTY sessions. | |
| pub struct ProcessTerminalSize { | |
| /// Terminal height in character cells. | |
| pub rows: u16, | |
| /// Terminal width in character cells. | |
| pub cols: u16, | |
| } | |
| /// Spawn a standalone process (argv vector) without a Codex sandbox on the host | |
| /// where the app server is running. | |
| /// | |
| /// `process/spawn` returns after the process has started and the connection-scoped | |
| /// `processHandle` has been registered. Process output and exit are reported via | |
| /// `process/outputDelta` and `process/exited` notifications. | |
| pub struct ProcessSpawnParams { | |
| /// Command argv vector. Empty arrays are rejected. | |
| pub command: Vec<String>, | |
| /// Client-supplied, connection-scoped process handle. | |
| /// | |
| /// Duplicate active handles are rejected on the same connection. The same | |
| /// handle can be reused after the prior process exits. | |
| pub process_handle: String, | |
| /// Absolute working directory for the process. | |
| pub cwd: AbsolutePathBuf, | |
| /// Enable PTY mode. | |
| /// | |
| /// This implies `streamStdin` and `streamStdoutStderr`. | |
| pub tty: bool, | |
| /// Allow follow-up `process/writeStdin` requests to write stdin bytes. | |
| pub stream_stdin: bool, | |
| /// Stream stdout/stderr via `process/outputDelta` notifications. | |
| /// | |
| /// Streamed bytes are not duplicated into the `process/exited` notification. | |
| pub stream_stdout_stderr: bool, | |
| /// Optional per-stream stdout/stderr capture cap in bytes. | |
| /// | |
| /// When omitted, the server default applies. Set to `null` to disable the | |
| /// cap. | |
| pub output_bytes_cap: Option<Option<usize>>, | |
| /// Optional timeout in milliseconds. | |
| /// | |
| /// When omitted, the server default applies. Set to `null` to disable the | |
| /// timeout. | |
| pub timeout_ms: Option<Option<i64>>, | |
| /// Optional environment overrides merged into the app-server process | |
| /// environment. | |
| /// | |
| /// Matching names override inherited values. Set a key to `null` to unset | |
| /// an inherited variable. | |
| pub env: Option<HashMap<String, Option<String>>>, | |
| /// Optional initial PTY size in character cells. Only valid when `tty` is | |
| /// true. | |
| pub size: Option<ProcessTerminalSize>, | |
| } | |
| /// Successful response for `process/spawn`. | |
| pub struct ProcessSpawnResponse {} | |
| /// Write stdin bytes to a running `process/spawn` session, close stdin, or | |
| /// both. | |
| pub struct ProcessWriteStdinParams { | |
| /// Client-supplied, connection-scoped `processHandle` from `process/spawn`. | |
| pub process_handle: String, | |
| /// Optional base64-encoded stdin bytes to write. | |
| pub delta_base64: Option<String>, | |
| /// Close stdin after writing `deltaBase64`, if present. | |
| pub close_stdin: bool, | |
| } | |
| /// Empty success response for `process/writeStdin`. | |
| pub struct ProcessWriteStdinResponse {} | |
| /// Terminate a running `process/spawn` session. | |
| pub struct ProcessKillParams { | |
| /// Client-supplied, connection-scoped `processHandle` from `process/spawn`. | |
| pub process_handle: String, | |
| } | |
| /// Empty success response for `process/kill`. | |
| pub struct ProcessKillResponse {} | |
| /// Resize a running PTY-backed `process/spawn` session. | |
| pub struct ProcessResizePtyParams { | |
| /// Client-supplied, connection-scoped `processHandle` from `process/spawn`. | |
| pub process_handle: String, | |
| /// New PTY size in character cells. | |
| pub size: ProcessTerminalSize, | |
| } | |
| /// Empty success response for `process/resizePty`. | |
| pub struct ProcessResizePtyResponse {} | |
| /// Stream label for `process/outputDelta` notifications. | |
| pub enum ProcessOutputStream { | |
| /// stdout stream. PTY mode multiplexes terminal output here. | |
| Stdout, | |
| /// stderr stream. | |
| Stderr, | |
| } | |
| /// Base64-encoded output chunk emitted for a streaming `process/spawn` request. | |
| pub struct ProcessOutputDeltaNotification { | |
| /// Client-supplied, connection-scoped `processHandle` from `process/spawn`. | |
| pub process_handle: String, | |
| /// Output stream this chunk belongs to. | |
| pub stream: ProcessOutputStream, | |
| /// Base64-encoded output bytes. | |
| pub delta_base64: String, | |
| /// True on the final streamed chunk for this stream when output was | |
| /// truncated by `outputBytesCap`. | |
| pub cap_reached: bool, | |
| } | |
| /// Final process exit notification for `process/spawn`. | |
| pub struct ProcessExitedNotification { | |
| /// Client-supplied, connection-scoped `processHandle` from `process/spawn`. | |
| pub process_handle: String, | |
| /// Process exit code. | |
| pub exit_code: i32, | |
| /// Buffered stdout capture. | |
| /// | |
| /// Empty when stdout was streamed via `process/outputDelta`. | |
| pub stdout: String, | |
| /// Whether stdout reached `outputBytesCap`. | |
| /// | |
| /// In streaming mode, stdout is empty and cap state is also reported on the | |
| /// final stdout `process/outputDelta` notification. | |
| pub stdout_cap_reached: bool, | |
| /// Buffered stderr capture. | |
| /// | |
| /// Empty when stderr was streamed via `process/outputDelta`. | |
| pub stderr: String, | |
| /// Whether stderr reached `outputBytesCap`. | |
| /// | |
| /// In streaming mode, stderr is empty and cap state is also reported on the | |
| /// final stderr `process/outputDelta` notification. | |
| pub stderr_cap_reached: bool, | |
| } | |