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

Function parse_session_info

atomic-agent/src/hooks/claude_code/parse.rs:179–199  ·  view source on GitHub ↗
(
    agent_name: &str,
    hook_type: HookType,
    raw_json: serde_json::Value,
)

Source from the content-addressed store, hash-verified

177}
178
179fn 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
201fn parse_user_prompt(
202 agent_name: &str,

Callers 1

parse_hook_eventFunction · 0.85

Calls 5

extract_session_idFunction · 0.85
with_raw_jsonMethod · 0.80
with_transcript_pathMethod · 0.80
cloneMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected