(
agent_name: &str,
hook_type: HookType,
raw_json: serde_json::Value,
)
| 196 | } |
| 197 | |
| 198 | fn parse_user_prompt( |
| 199 | agent_name: &str, |
| 200 | hook_type: HookType, |
| 201 | raw_json: serde_json::Value, |
| 202 | ) -> AgentResult<TurnEvent> { |
| 203 | let parsed: UserPromptInput = |
| 204 | serde_json::from_value(raw_json.clone()).map_err(|e| AgentError::HookParseFailed { |
| 205 | agent: agent_name.to_string(), |
| 206 | hook_type: hook_type.as_str().to_string(), |
| 207 | reason: e.to_string(), |
| 208 | })?; |
| 209 | |
| 210 | let mut event = |
| 211 | TurnEvent::new(extract_session_id(parsed.session_id), hook_type).with_raw_json(raw_json); |
| 212 | |
| 213 | if let Some(path) = parsed.transcript_path { |
| 214 | event = event.with_transcript_path(path); |
| 215 | } |
| 216 | if let Some(prompt) = parsed.prompt { |
| 217 | event = event.with_prompt(prompt); |
| 218 | } |
| 219 | |
| 220 | Ok(event) |
| 221 | } |
| 222 | |
| 223 | fn parse_pre_tool( |
| 224 | agent_name: &str, |
no test coverage detected