pub struct Action {
pub action_type: ActionType,
pub target: String,
pub payload: Option<Vec<u8>>,
pub metadata: Option<String>,
}Expand description
Action that can be performed by the AI
Fields§
§action_type: ActionType§target: String§payload: Option<Vec<u8>>§metadata: Option<String>Implementations§
Source§impl Action
impl Action
pub fn delete(target: impl Into<String>) -> Self
pub fn write_file(path: impl Into<String>, content: Vec<u8>) -> Self
pub fn read(target: impl Into<String>) -> Self
pub fn execute(command: impl Into<String>) -> Self
Sourcepub fn hash(&self) -> [u8; 32]
pub fn hash(&self) -> [u8; 32]
Get the canonical hash of this action
§Panics
Only panics in extreme OOM conditions (memory exhaustion). In practice, Action serialization is infallible for normal structs.
§v1.6.0 Security Enhancements
- H-2: Changed from
.unwrap()to.expect()with descriptive message - M-1: Migrated from JSON to bincode for guaranteed deterministic serialization
- JSON field order was implementation-defined (fragile across versions)
- Bincode guarantees byte-for-byte determinism (same Action = same hash)
- Critical for cross-platform and cross-version action binding security
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Action
impl<'de> Deserialize<'de> for Action
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnwindSafe for Action
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more