ai-agent 0.13.4

Idiomatic agent sdk inspired by the claude code source leak
Documentation
// Source: /data/home/swei/claudecode/openclaudecode/src/commands/permissions/permissions.tsx
pub type UserId = String;
pub type SessionId = String;

#[derive(Debug, Clone, PartialEq)]
pub enum Permission {
    Read,
    Write,
    Execute,
    Admin,
}

#[derive(Debug, Clone)]
pub struct PermissionCheck {
    pub user_id: UserId,
    pub resource: String,
    pub permission: Permission,
    pub granted: bool,
}

impl PermissionCheck {
    pub fn new(user_id: UserId, resource: &str, permission: Permission) -> Self {
        Self {
            user_id,
            resource: resource.to_string(),
            permission,
            granted: false,
        }
    }

    pub fn grant(mut self) -> Self {
        self.granted = true;
        self
    }

    pub fn is_allowed(&self) -> bool {
        self.granted
    }
}