kaizen/collect/hooks/
mod.rs1pub mod claude;
5pub mod cursor;
6pub mod normalize;
7pub mod openclaw;
8
9#[derive(Debug, Clone, PartialEq, Eq)]
11pub struct HookEvent {
12 pub kind: EventKind,
13 pub session_id: String,
14 pub ts_ms: u64,
15 pub payload: serde_json::Value,
16}
17
18#[derive(Debug, Clone, PartialEq, Eq)]
20pub enum EventKind {
21 PreToolUse,
22 PostToolUse,
23 Stop,
24 SessionStart,
25 Unknown(String),
26}
27
28impl EventKind {
29 pub fn parse(s: &str) -> Self {
30 match s {
31 "PreToolUse" | "pre_tool_use" => Self::PreToolUse,
32 "PostToolUse" | "post_tool_use" => Self::PostToolUse,
33 "Stop" | "stop" => Self::Stop,
34 "SessionStart" | "session_start" => Self::SessionStart,
35 other => Self::Unknown(other.to_string()),
36 }
37 }
38}