Skip to main content

agent_session/
lib.rs

1// SPDX-License-Identifier: MIT
2// Copyright (c) 2026 eunomia-bpf org.
3
4//! Portable session IR, parsers, discovery, and process matching for local AI
5//! coding-agent transcripts.
6//!
7//! The crate currently normalizes Claude Code, Codex, and Gemini CLI sessions.
8//! It intentionally stops at session data and process/session correlation; UI,
9//! database storage, eBPF collection, and OpenTelemetry export belong in
10//! applications that consume this crate.
11
12mod longitudinal;
13mod parser;
14mod process_match;
15mod types;
16
17// Re-export constants
18pub const AGENT_CLAUDE: &str = "claude";
19pub const AGENT_CODEX: &str = "codex";
20pub const AGENT_GEMINI: &str = "gemini";
21
22pub const TRACE_EBPF_FILE: &str = "ebpf_file";
23pub const TRACE_PROC_FD: &str = "proc_fd";
24pub const TRACE_STICKY_BINDING: &str = "sticky";
25pub const TRACE_RECENT_CWD: &str = "cwd_recent";
26pub const SOURCE_SESSION_PROCESS_MATCH: &str = "agent_session.process_match";
27
28// Re-export types
29pub use types::{
30    AgentSession, EditSummary, LlmResponse, PathReference, SessionCache, SessionCandidate,
31    SessionDirStat, SessionEvents, TokenUsage, ToolEvent, UserPrompt,
32};
33
34// Re-export parser functions
35pub use parser::{
36    agent_source_for_path, codex_exec_prompt, collapse_project_path, command_process_chain,
37    contains_private_marker, count_session_dirs, discover_session_files,
38    discover_session_files_in_dir, discover_session_files_in_home, fixture_session_path,
39    is_codex_cli_entrypoint, normalize_session_log_path, parse_session_content, parse_session_file,
40    parse_session_path, path_component_strings, path_group, session_candidate_from_path,
41    session_log_path_from_str, short_hash, tool_category, truncate_clean,
42};
43
44// Re-export process matching types and functions
45pub use process_match::{
46    LiveProcessCandidate, ProcessKey, ProcessTree, SessionProcessInput, SessionProcessMatch,
47    SessionProcessMatcher, SessionProcessMatches,
48};
49
50pub use longitudinal::{
51    ArtifactSummary, CandidateAssociation, EventAssociation, ExportError, ExportWindow,
52    FileLifetime, GitChange, GitCommit, HunkFingerprint, LongitudinalArtifact, LongitudinalOptions,
53    NormalizedEvent, RepositorySummary, SessionSummary, build_longitudinal_artifact,
54    write_longitudinal_artifact,
55};