Skip to main content

systemprompt_models/api/
cli_gateway.rs

1//! CLI Gateway models for remote command execution.
2
3use serde::{Deserialize, Serialize};
4use systemprompt_identifiers::ContextId;
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct CliExecuteRequest {
8    pub args: Vec<String>,
9    #[serde(default = "default_timeout")]
10    pub timeout_secs: u64,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub context_id: Option<ContextId>,
13}
14
15const fn default_timeout() -> u64 {
16    300
17}
18
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(tag = "type", rename_all = "snake_case")]
21pub enum CliOutputEvent {
22    Started { pid: u32 },
23    Stdout { data: String },
24    Stderr { data: String },
25    ExitCode { code: i32 },
26    Error { message: String },
27}