pub enum AgentResponse {
Ok {
data: Option<Value>,
},
Pong {
version: u32,
},
Progress {
message: String,
percent: Option<u8>,
layer: Option<String>,
},
Error {
message: String,
code: Option<String>,
},
Completed {
exit_code: i32,
stdout: Vec<u8>,
stderr: Vec<u8>,
},
Started,
Stdout {
data: Vec<u8>,
},
Stderr {
data: Vec<u8>,
},
Exited {
exit_code: i32,
},
DataChunk {
data: Vec<u8>,
done: bool,
},
}Expand description
Agent response types.
Variants§
Ok
Operation completed successfully.
Pong
Pong response to ping.
Progress
Progress update (for long operations like pull).
Fields
Error
Operation failed.
Completed
Command execution completed (non-interactive mode).
Fields
Started
Command started (interactive mode). Indicates the command is running and ready to receive stdin.
Stdout
Stdout data from a running command (interactive mode).
Stderr
Stderr data from a running command (interactive mode).
Exited
Command exited (interactive mode).
DataChunk
Streaming binary-data chunk.
Used by every streaming download direction: the agent sends
one or more DataChunk responses in sequence, with done: true
on the final chunk. Current producers: ExportLayer and
FileRead.
Payload size per chunk should stay under
LAYER_CHUNK_SIZE so the encoded frame (~1.33× after
base64) fits inside MAX_FRAME_SIZE with JSON overhead to
spare.
Implementations§
Source§impl AgentResponse
impl AgentResponse
Sourcepub fn error(message: impl Into<String>, code: &str) -> Self
pub fn error(message: impl Into<String>, code: &str) -> Self
Create an error response with the given message and code.
§Example
use smolvm_protocol::{AgentResponse, error_codes};
let response = AgentResponse::error("image not found", error_codes::NOT_FOUND);Sourcepub fn ok_with_data<T: Serialize>(data: T) -> Self
pub fn ok_with_data<T: Serialize>(data: T) -> Self
Create an Ok response with JSON-serializable data.
Returns an error response if serialization fails.
Sourcepub fn from_result<T, E>(result: Result<T, E>, error_code: &str) -> Self
pub fn from_result<T, E>(result: Result<T, E>, error_code: &str) -> Self
Trait Implementations§
Source§impl Clone for AgentResponse
impl Clone for AgentResponse
Source§fn clone(&self) -> AgentResponse
fn clone(&self) -> AgentResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more