pub mod log;
pub mod replay;
pub mod sandbox;
use std::hash::{Hash, Hasher};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuditLogEntry {
pub timestamp: String,
#[serde(default)]
pub session_id: String,
pub tool_name: String,
pub tool_input_summary: String,
pub decision: String,
pub reason: Option<String>,
pub matched_rules: usize,
pub skipped_rules: usize,
pub resolution: String,
}
impl AuditLogEntry {
pub fn timestamp_secs(&self) -> Option<f64> {
self.timestamp.parse::<f64>().ok()
}
pub fn short_hash(&self) -> String {
let mut hasher = std::collections::hash_map::DefaultHasher::new();
self.timestamp.hash(&mut hasher);
self.tool_name.hash(&mut hasher);
self.tool_input_summary.hash(&mut hasher);
format!("{:07x}", hasher.finish() & 0x0FFF_FFFF)
}
}