aien-protocols-mv
Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem
Brought by drakestapleton
aien-protocols-mv / crates / aien-action-protocol / src / lib.rs
| 1 | use aien_protocol_types::{ActionId, AgentId, Digest32, RunId, Timestamp}; |
| 2 | use serde::{Deserialize, Serialize}; |
| 3 | |
| 4 | #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] |
| 5 | pub struct CapabilityGrant { |
| 6 | pub capability: String, |
| 7 | pub scope: String, |
| 8 | pub granted_at: Timestamp, |
| 9 | pub expires_at: Option<Timestamp>, |
| 10 | } |
| 11 | |
| 12 | #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] |
| 13 | pub struct ContainmentState { |
| 14 | pub isolated_network: bool, |
| 15 | pub read_only_fs: bool, |
| 16 | pub seccomp_profile: String, |
| 17 | pub allowed_subprocesses: Vec<String>, |
| 18 | } |
| 19 | |
| 20 | impl Default for ContainmentState { |
| 21 | fn default() -> Self { |
| 22 | Self { |
| 23 | isolated_network: true, |
| 24 | read_only_fs: true, |
| 25 | seccomp_profile: "strict".to_string(), |
| 26 | allowed_subprocesses: Vec::new(), |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] |
| 32 | pub struct ActionRequest { |
| 33 | pub action_id: ActionId, |
| 34 | pub run_id: RunId, |
| 35 | pub agent_id: AgentId, |
| 36 | pub capability: String, |
| 37 | pub parameters: serde_json::Value, |
| 38 | pub timestamp: Timestamp, |
| 39 | } |
| 40 | |
| 41 | #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] |
| 42 | pub struct ActionAuthorization { |
| 43 | pub authorization_id: uuid::Uuid, |
| 44 | pub action_id: ActionId, |
| 45 | pub approved_by: String, |
| 46 | pub granted_capabilities: Vec<CapabilityGrant>, |
| 47 | pub timestamp: Timestamp, |
| 48 | } |
| 49 | |
| 50 | #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] |
| 51 | pub struct ActionReceipt { |
| 52 | pub receipt_id: uuid::Uuid, |
| 53 | pub action_id: ActionId, |
| 54 | pub success: bool, |
| 55 | pub output: serde_json::Value, |
| 56 | pub error: Option<String>, |
| 57 | pub execution_digest: Digest32, |
| 58 | pub completed_at: Timestamp, |
| 59 | } |