MCPcopy Create free account
hub / github.com/AI45Lab/Code / session_id

Method session_id

core/src/hooks/events.rs:597–625  ·  view source on GitHub ↗

Get the session ID (returns empty string for skill events which are global)

(&self)

Source from the content-addressed store, hash-verified

595
596 /// Get the session ID (returns empty string for skill events which are global)
597 pub fn session_id(&self) -> &str {
598 match self {
599 HookEvent::PreToolUse(e) => &e.session_id,
600 HookEvent::PostToolUse(e) => &e.session_id,
601 HookEvent::GenerateStart(e) => &e.session_id,
602 HookEvent::GenerateEnd(e) => &e.session_id,
603 HookEvent::SessionStart(e) => &e.session_id,
604 HookEvent::SessionEnd(e) => &e.session_id,
605 HookEvent::PrePrompt(e) => &e.session_id,
606 HookEvent::PostResponse(e) => &e.session_id,
607 HookEvent::OnError(e) => &e.session_id,
608 // New harness points
609 HookEvent::PreContextPerception(e) => &e.session_id,
610 HookEvent::PostContextPerception(e) => &e.session_id,
611 HookEvent::OnSuccess(e) => &e.session_id,
612 HookEvent::PreMemoryRecall(e) => &e.session_id,
613 HookEvent::PostMemoryRecall(e) => &e.session_id,
614 HookEvent::PrePlanning(e) => &e.session_id,
615 HookEvent::PostPlanning(e) => &e.session_id,
616 HookEvent::PreReasoning(e) => &e.session_id,
617 HookEvent::PostReasoning(e) => &e.session_id,
618 HookEvent::OnRateLimit(e) => &e.session_id,
619 HookEvent::OnConfirmation(e) => &e.session_id,
620 HookEvent::IntentDetection(e) => &e.session_id,
621 // Skill events are global (not session-specific)
622 HookEvent::SkillLoad(_) => "",
623 HookEvent::SkillUnload(_) => "",
624 }
625 }
626
627 /// Get the tool name (for tool events)
628 pub fn tool_name(&self) -> Option<&str> {

Calls

no outgoing calls