(
agent_name: &str,
hook_type: HookType,
raw_json: serde_json::Value,
)
| 177 | } |
| 178 | |
| 179 | fn parse_session_info( |
| 180 | agent_name: &str, |
| 181 | hook_type: HookType, |
| 182 | raw_json: serde_json::Value, |
| 183 | ) -> AgentResult<TurnEvent> { |
| 184 | let parsed: SessionInfoInput = |
| 185 | serde_json::from_value(raw_json.clone()).map_err(|e| AgentError::HookParseFailed { |
| 186 | agent: agent_name.to_string(), |
| 187 | hook_type: hook_type.as_str().to_string(), |
| 188 | reason: e.to_string(), |
| 189 | })?; |
| 190 | |
| 191 | let mut event = |
| 192 | TurnEvent::new(extract_session_id(parsed.session_id), hook_type).with_raw_json(raw_json); |
| 193 | |
| 194 | if let Some(path) = parsed.transcript_path { |
| 195 | event = event.with_transcript_path(path); |
| 196 | } |
| 197 | |
| 198 | Ok(event) |
| 199 | } |
| 200 | |
| 201 | fn parse_user_prompt( |
| 202 | agent_name: &str, |
no test coverage detected