Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aegis-runtime-mv/blob/main/src/execution/action.rs # aegis-runtime-mv Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aegis-runtime-mv / src / execution / action.rs` 77 lines ยท 2072 bytes Raw Blame History 1 use crate::execution::receipt::ActionReceipt; 2 use crate::sessions::id::{ActionId, RunId, SessionId}; 3 use serde::{Deserialize, Serialize}; 4 5 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] 6 #[serde(rename_all = "snake_case")] 7 pub enum ActionStatus { 8 Pending, 9 Approved, 10 Denied, 11 Executing, 12 Completed, 13 Failed, 14 } 15 16 impl ActionStatus { 17 pub fn as_str(&self) -> &'static str { 18 match self { 19 Self::Pending => "pending", 20 Self::Approved => "approved", 21 Self::Denied => "denied", 22 Self::Executing => "executing", 23 Self::Completed => "completed", 24 Self::Failed => "failed", 25 } 26 } 27 28 #[allow(clippy::should_implement_trait)] 29 pub fn from_str(s: &str) -> Option { 30 match s { 31 "pending" => Some(Self::Pending), 32 "approved" => Some(Self::Approved), 33 "denied" => Some(Self::Denied), 34 "executing" => Some(Self::Executing), 35 "completed" => Some(Self::Completed), 36 "failed" => Some(Self::Failed), 37 _ => None, 38 } 39 } 40 } 41 42 #[derive(Debug, Clone, Serialize, Deserialize)] 43 pub struct Action { 44 pub id: ActionId, 45 pub run_id: RunId, 46 pub session_id: SessionId, 47 pub capability: String, 48 pub intent: String, 49 pub params: serde_json::Value, 50 pub status: ActionStatus, 51 pub receipt: Option, 52 pub created_at: i64, 53 pub completed_at: Option, 54 } 55 56 impl Action { 57 pub fn new( 58 run_id: RunId, 59 session_id: SessionId, 60 capability: impl Into, 61 intent: impl Into, 62 params: serde_json::Value, 63 ) -> Self { 64 Self { 65 id: ActionId::new(), 66 run_id, 67 session_id, 68 capability: capability.into(), 69 intent: intent.into(), 70 params, 71 status: ActionStatus::Pending, 72 receipt: None, 73 created_at: chrono::Utc::now().timestamp(), 74 completed_at: None, 75 } 76 } 77 }