| 473 | } |
| 474 | |
| 475 | fn parse_event(&self, hook_type: HookType, input: &[u8]) -> AgentResult<TurnEvent> { |
| 476 | if input.is_empty() { |
| 477 | return Err(AgentError::HookInputEmpty { |
| 478 | agent: self.agent_name.clone(), |
| 479 | hook_type: hook_type.as_str().to_string(), |
| 480 | }); |
| 481 | } |
| 482 | |
| 483 | let raw: serde_json::Value = serde_json::from_slice(input)?; |
| 484 | let session_id = raw["session_id"].as_str().unwrap_or("unknown").to_string(); |
| 485 | |
| 486 | Ok(TurnEvent::new(session_id, hook_type).with_raw_json(raw)) |
| 487 | } |
| 488 | |
| 489 | fn install(&self, _repo_root: &Path) -> AgentResult<usize> { |
| 490 | Ok(3) // pretend we installed 3 hooks |