| 508 | } |
| 509 | |
| 510 | fn parse_event(&self, hook_type: HookType, input: &[u8]) -> AgentResult<TurnEvent> { |
| 511 | if input.is_empty() { |
| 512 | return Err(AgentError::HookInputEmpty { |
| 513 | agent: self.agent_name.clone(), |
| 514 | hook_type: hook_type.as_str().to_string(), |
| 515 | }); |
| 516 | } |
| 517 | |
| 518 | let raw: serde_json::Value = serde_json::from_slice(input)?; |
| 519 | let session_id = raw["session_id"].as_str().unwrap_or("unknown").to_string(); |
| 520 | |
| 521 | Ok(TurnEvent::new(session_id, hook_type).with_raw_json(raw)) |
| 522 | } |
| 523 | |
| 524 | fn install(&self, _repo_root: &Path) -> AgentResult<usize> { |
| 525 | Ok(3) // pretend we installed 3 hooks |