MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / parse_event

Method parse_event

atomic-agent/src/hooks/mod.rs:478–490  ·  view source on GitHub ↗
(&self, hook_type: HookType, input: &[u8])

Source from the content-addressed store, hash-verified

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

Calls 4

with_raw_jsonMethod · 0.80
is_emptyMethod · 0.45
cloneMethod · 0.45
as_strMethod · 0.45