Skip to main content

rite_runtime/actions/
mod.rs

1//! Action support types used by handlers and the executor.
2//!
3//! The [`Action`](crate::Action) trait itself lives in [`crate::runner`];
4//! this module hosts the supporting data types ([`ActionCategory`],
5//! [`ActionMetadata`], [`ArtifactValue`], [`KeyFormat`]).
6
7mod types;
8
9use rite_model::ActionType;
10
11pub use types::{ArtifactValue, KeyFormat};
12
13/// Category of an action, determines how the frontend presents it.
14#[derive(Debug, Clone, Copy, PartialEq, Eq)]
15pub enum ActionCategory {
16    /// Requires human verification or confirmation.
17    Verification,
18    /// Cryptographic operation against a backend.
19    Crypto,
20    /// Formal attestation with audit binding.
21    Attestation,
22}
23
24impl std::fmt::Display for ActionCategory {
25    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26        match self {
27            ActionCategory::Verification => write!(f, "verification"),
28            ActionCategory::Crypto => write!(f, "crypto"),
29            ActionCategory::Attestation => write!(f, "attestation"),
30        }
31    }
32}
33
34/// Metadata describing an action, used for validation and presentation.
35#[derive(Debug, Clone)]
36pub struct ActionMetadata {
37    /// Action type (used in YAML and the registry).
38    pub action_type: ActionType,
39    /// Short human-readable description.
40    pub description: &'static str,
41    /// Action category.
42    pub category: ActionCategory,
43}