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