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 PermissionRequest,
27 UserPromptSubmit,
28 Notification,
29 SubagentStart,
30 SubagentStop,
31 Interrupt,
32 ModeTransition,
33 Unknown(String),
34}
35
36impl EventKind {
37 pub fn parse(s: &str) -> Self {
38 match s {
39 "PreToolUse" | "pre_tool_use" => Self::PreToolUse,
40 "PostToolUse" | "post_tool_use" => Self::PostToolUse,
41 "Stop" | "stop" => Self::Stop,
42 "SessionStart" | "session_start" => Self::SessionStart,
43 "PermissionRequest" | "permission_request" => Self::PermissionRequest,
44 "UserPromptSubmit" | "user_prompt_submit" => Self::UserPromptSubmit,
45 "Notification" | "notification" => Self::Notification,
46 "SubagentStart" | "subagent_start" => Self::SubagentStart,
47 "SubagentStop" | "subagent_stop" => Self::SubagentStop,
48 "Interrupt" | "interrupt" => Self::Interrupt,
49 "ModeTransition" | "mode_transition" => Self::ModeTransition,
50 other => Self::Unknown(other.to_string()),
51 }
52 }
53}