Skip to main content

systemprompt_models/api/
cli_gateway.rs

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