Skip to main content

agentkernel_sdk/
types.rs

1use serde::{Deserialize, Serialize};
2
3/// Security profile for sandbox execution.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5#[serde(rename_all = "lowercase")]
6pub enum SecurityProfile {
7    Permissive,
8    Moderate,
9    Restrictive,
10}
11
12/// Options for running a command.
13#[derive(Debug, Default, Serialize)]
14pub struct RunOptions {
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub image: Option<String>,
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub profile: Option<SecurityProfile>,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub fast: Option<bool>,
21}
22
23/// Output from a command execution.
24#[derive(Debug, Deserialize)]
25pub struct RunOutput {
26    pub output: String,
27}
28
29/// Information about a sandbox.
30#[derive(Debug, Deserialize)]
31pub struct SandboxInfo {
32    pub name: String,
33    pub status: String,
34    pub backend: String,
35}
36
37/// SSE stream event.
38#[derive(Debug)]
39pub struct StreamEvent {
40    pub event_type: String,
41    pub data: serde_json::Value,
42}
43
44/// API response wrapper (internal).
45#[derive(Debug, Deserialize)]
46pub(crate) struct ApiResponse<T> {
47    pub success: bool,
48    pub data: Option<T>,
49    pub error: Option<String>,
50}
51
52/// Run request body (internal).
53#[derive(Serialize)]
54pub(crate) struct RunRequest {
55    pub command: Vec<String>,
56    #[serde(skip_serializing_if = "Option::is_none")]
57    pub image: Option<String>,
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub profile: Option<SecurityProfile>,
60    pub fast: bool,
61}
62
63/// Create sandbox request body (internal).
64#[derive(Serialize)]
65pub(crate) struct CreateRequest {
66    pub name: String,
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub image: Option<String>,
69}
70
71/// Exec request body (internal).
72#[derive(Serialize)]
73pub(crate) struct ExecRequest {
74    pub command: Vec<String>,
75}